lockf and the SVID, (Was "Re: Wanted: lockf system call source")

John Woods, Software john at frog.UUCP
Wed Dec 3 05:51:19 AEST 1986


> Article <5413 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn) writes:
> >Dave, our Goulds have System V fcntl() record locking and they require
> >(only) read permission to set a read lock, write permission to set a
> >write lock....
> Not that H-P is at fault for following the mighty SVID, but why require
> that the file-descriptor is open for write to do a write lock?  Wouldn't
> any open file-descriptor do?

I believe that the original message was about the routine named "lockf()",
which in SVID requires O_WRONLY or O_RDWR permission.  fcntl() read-only
locks require O_RDONLY or O_RDWR, and write locks require O_WRONLY or O_RDWR.
The implication is that a lockf() lock is equivalent to an fcntl() write
lock.

As far as implementing fcntl() locks, it isn't all that hard (we used to have
the John Bass lockf() code, and I restructured it to add fcntl() behavior).
Basically, I spent a day drawing pictures of overlapping locks of various
types until I became enlightened.


--
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc at MIT-XX.ARPA

"Soylent Green is People Helping People!"



More information about the Comp.unix.wizards mailing list