>Solaris man-page of dup() says:

If you read this with the proper lexicon, it does in fact specify the
broken-as-designed behavior people are complaining about.

>dup() returns a new file descriptor having the following  in
>     common with the original open file descriptor fildes:
>
>          Same open file (or pipe).

Locks are associated with files, and consequently with open files, so dup()
creates a new file descriptor that is associated with the same locks as the
original.


>     All locks associated with a file for  a  given  process  are
>     removed  when  a  file descriptor for that file is closed by
>     that process

So when you close one file descriptor for a file, the file's locks are
removed, and therefore the locks associated with all of that file's file
descriptors are as well.

>I would have thought that  dup()  creates new file object which
>does not share file state with the original one

I guess it depends on what a "file object" is.  The quoted man page doesn't
use that term, and I can see it applying to a file descriptor or an open
instance, or even to a file.  I don't think it's a well defined term.

I don't really believe the man page here.  I'll bet you can mount a
filesystem twice, and then Solaris sees a single file in it as two
different files, and closing the file doesn't cause all of the file's locks
to get dropped.  I usually use the term "file image" in a case like this
instead of "file."


-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]

Reply via email to