Trying to understand flock()

Ronald F. Guilmette rfg at monkeys.com
Thu Nov 4 16:16:09 PST 2004


In message <418A992C.6040806 at broadpark.no>, you wrote:

> From the flock manpage:
>
>"...file descriptors duplicated through dup(2) or fork(2) do not result 
>in multiple instances of a lock, but rather multiple references to the 
>same lock."
>
>You're basically trying to place a lock you already hold, making the 
>flock function return immediately (this is what I gather, anyhow). The 
>fcntl function seems to operate slightly differently in this respect.
>
>This is the only explanation I can think of, others might think 
>differently, though.


Thank you.  That seems to make sense, now that you have explained it
for me.


More information about the freebsd-questions mailing list