🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #13965

Re: Lock Daemon, lockf fails

#13965
From: Guy Harris
Date: Thu, 22 Feb 1990 19:41
18 lines
1385 bytes
>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). 
Technical Details
Message-ID: <5291@brazos.Rice.edu>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!rice!sun-spots-request
From: auspex!guy@uunet.uu.net (Guy Harris)
Newsgroups: comp.sys.sun
Subject: Re: Lock Daemon, lockf fails
Keywords: SunOS
Message-ID: <5291@brazos.Rice.edu>
Date: 22 Feb 90 19:41:06 GMT
Sender: root@rice.edu
Organization: Sun-Spots
Lines: 18
Approved: Sun-Spots@rice.edu
X-Refs:  Original: v9n16, Replies: v9n36
X-Sun-Spots-Digest: Volume 9, Issue 53, message 8