On Fri, Nov 17, 2006 at 07:03:00PM +0000, John Kelly wrote: > On Fri, 17 Nov 2006 19:54:13 +0100, Kurt Roeckx <[EMAIL PROTECTED]> > wrote: > > >I actually see no good reason to want to use flock() over fcntl(). > > > Maybe because the fcntl() > > >interface follows the completely stupid semantics of System V and > >IEEE Std 1003.1-1988 (``POSIX.1'') that require that all locks associated > >with a file for a given process are removed when any file descriptor for > >that file is closed by that process. This semantic means that applica- > >tions must be aware of any files that a subroutine library may access. > >For example if an application for updating the password file locks the > >password file database while making the update, and then calls > >getpwnam(3) to retrieve a record, the lock will be lost because > >getpwnam(3) opens, reads, and closes the password database. The database
I think this is a rather bad example. If you lock a file and then use something other than read() or write() that might access it, you're very likely having problems. Kurt -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]