[net.bugs.4bsd] file locking misconception

gnu@l5.uucp (John Gilmore) (12/27/85)

In article <7022@ki4pv.UUCP>, tanner@ki4pv.UUCP (Tanner Andrews) writes:
>                                                    there's no real
> excuse for a read-only prog to need to lock a file if the write-file
> prog successfully locks the damned thing anyway.

Uh, suppose the readers want a consistent copy of the file?  flock(),
at least in 4.2BSD, is an *advisory* lock -- it doesn't stop anybody
from doing anything with the file except flock() it again.  Readers can
use shared locks and writers use exclusive locks, for many applications.