Why is there an exclusive lock *count* ???

Michael Bloom mb at ttidca.TTI.COM
Thu Feb 2 12:24:01 AEST 1989


In article <9036 at bloom-beacon.MIT.EDU> jfc at athena.mit.edu (John F Carr) writes:

>If a process forks while holding an exclusive lock, the number of locks
>increases by one (the lock remains until both parent and child have
>released it).

I'm wondering if perhaps that was the original intent, but that for
some reason it was not done that way.  From the man page:

     Locks are on files, not file descriptors.	That is, file
     descriptors duplicated through dup(2) or fork(2) do not
     result in multiple instances of a lock, but rather multiple
     references to a single lock.  If a process holding a lock on
     a file forks and the child explicitly unlocks the file, the
     parent will lose its lock.

Several people have written with the same answer referring to forks,
which would make sense except that I see no code supporting
incrementing i_exlockc for such cases. As this is also implied by the
man page, I'm still confused as to why exlockc is needed, unless it's
just present for future expansion - and even so, such a change could
introduce mucho incompatibility ...



More information about the Comp.unix.wizards mailing list