From: Michael C. Loewen (mloewen@cpumagic.scol.pa.us)
Date: 06/13/93


From: mloewen@cpumagic.scol.pa.us (Michael C. Loewen)
Subject: Re: Locking mechanisms / fcntl.c locks.c
Date: Mon, 14 Jun 1993 03:19:57 GMT

In article <1993Jun14.020428.22063@kf8nh.wariat.org> bsa@kf8nh.wariat.org (Brandon S. Allbery) writes:
>
>System V requires read access for F_WRLCK and write access for F_RDLCK. I
>don't know if Linux does this as well --- but I would hope not, since it won't
>harm compatibility and the System V behavior is arguably overly strict.
>
>Note also that fcntl() locking won't work over NFS. You need to use lockf()
>for that, I believe.
>

   Actually, both fcntl() and lockf() use the network lock manager (lockd),
and should work over NFS. The flock() call is the one that doesn't work over
NFS mounts. From the flock() man page:

     Locks obtained through the flock() mechanism are known only
     within the system on which they were placed. Thus, multiple
     clients may successfully acquire exclusive locks on the same
     remote file. If this behavior is not explicitly desired,
     the fcntl(2V) or lockf(3) system calls should be used
     instead; these make use of the services of the network lock
     manager (see lockd(8C)).

and from the fcntl() man page:

     fcntl() record locks are implemented in the kernel for local
     locks, and throughout the network by the network lock daemon
     (lockd(8C)) for remote locks on NFS files.

-- 
Mike Loewen                         The Centre Programmers Unit BBS
mloewen@cpumagic.scol.pa.us         (814) 353-0566     V.32bis/HST