home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.wizards
- Path: sparky!uunet!krfiny!jeffj
- From: jeffj@krfiny.uucp (J. Jonas)
- Subject: Re: flock(2) emulation?
- Message-ID: <1992Aug14.171020.20534@krfiny.uucp>
- Summary: you can roll your own
- Organization: Jeff's house of computer pieces
- References: <1992Aug7.173126.25686@htsa.aha.nl> <BsrzAp.7KD@ef2007.efhd.ford.com> <19480@fritz.filenet.com>
- Date: Fri, 14 Aug 1992 17:10:20 GMT
- Lines: 28
-
- If I recall the history correctly:
- first was lockf(3) - a library that provided advisory record locking.
- Then it was rolled into the OS as flock(2), and lockf(3) became
- simply calls to flock. This enabled manditory record locking
- (write(2) returns EAGAIN or blocks if it would overwrite a locked
- region of the file).
-
- As mentioned in this newsgroup, the library probably kept a file
- containing
- - the file being locked (by major number/minor number/inode)
- - the region locked and the PID
- that way, all processes can access the global file and
- inspect each other's locks.
-
- You might even place the table in shared memory.
-
- The problem with advisory record locking is that a 'rude'
- program that doesn't respect the locking can destroy the file.
- Manditory record locking (having a file with the "get GID bit" set)
- enforces the lock by blocking writes on locked portions.
-
- - Jeffrey Jonas
- jeffj@synsys.uucp
- --
- --
- Jeffrey Jonas
-
- jeffj@synsys.uucp
-