On Thu, May 03, 2001 at 06:03:07PM -0700, Jeremy Allison wrote:
...
> The only change that Samba really requires is a POSIX lock that
> has *exactly* the same semantics as present, except for the fact
> the close(dup(fd)) doesn't drop all locks on an fd.

You mean that:

    int fd2 = dup(fd);
    close(fd2);

drops all locks at the original fd ?

I would have thought that  dup()  creates new file object which
does not share file state with the original one -- meaning it has
its own read/write pointer, etc.  The backend file is of course
shared.

Solaris man-page of dup() says:

     dup() returns a new file descriptor having the following  in
     common with the original open file descriptor fildes:

          Same open file (or pipe).

          Same file pointer (that is, both file descriptors share
          one file pointer).

          Same access mode (read, write or read/write).

Hmm... File-pointer is shared, I see.

It definitely doesn't say that locks are shared as a result, and
that close() should kill them..

The  fcntl(2)  man-page says:

     All locks associated with a file for  a  given  process  are
     removed  when  a  file descriptor for that file is closed by
     that process or the process  holding  that  file  descriptor
     terminates.   Locks  are  not  inherited  by a child process
     created using fork(2).

Nowhere (in Solaris) is mention that  dup(2)  should copy locks
from source fd to the new fd.


...
> The only thing we need to fix (IMHO) is the close(dup(fd)) "bug",
> which I have yet to see any application treat as anything other
> than a spec. bug that must be worked around.
> 
> Thanks,
>               Jeremy Allison,
>               Samba Team.

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

Reply via email to