Lock Daemon, lockf fails
Guy Harris
auspex!guy at uunet.uu.net
Fri Feb 23 06:41:06 AEST 1990
>4. It's worth pointing out a SunOS fcntl locking "feature" that may not be
>obvious: if you open() 2 file descriptors on a single file, fd1 and fd2,
>establish a lock on fd1 and then close(fd2), the lock established through
>fd1 is lost.
That's not a "SunOS fcntl locking feature", it's a System V "fcntl"
locking feature. To quote SVID Issue 2, volume 3, FCNTL(BA_OS):
...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.
Note that it says "a file descriptor", not "the file descriptor with which
that lock was established" or something like that.
In addition, note that POSIX says the same thing; in other words, it's not
specific to SunOS, and you'd better be prepared for it to work that way on
*all* UNIX systems (and even non-UNIX POSIX systems).
More information about the Comp.sys.sun
mailing list