Xenix Help ? MapChan : Shell Layers : Backup : File Locking
Clarence Dold
dold at mitisft.Convergent.COM
Thu Jun 8 08:23:20 AEST 1989
in article <1169 at cheops.eecs.unsw.oz>, ashley at cheops.eecs.unsw.oz (Ashley M. Aitken) says:
> File "Locking":
>
> I would like to lock a file while someone is editing it, that is,
> if someone edits a file then it is not possible for someone else
> to edit (ie attempt to change) that file. The point being that
> only one of the edits could survive. Normal file locking does not
There are two types of lock possible, one is 'advisory', the other is
'mandatory'. Historically, most file locks have been advisory, where a
program checks to see if a mutually agreeable lock exists, before it
proceeds. Vi doesn't check, and isn't bound by advisory locks.
Mandatory locking would prevent vi from modifying a file that was opened
with a lock, but vi itself doesn't ask for such a lock.
With advisory locking, you can't prevent others from trashing your
edit session, unless you all agree to use the same 'wrapper' for the
editing.
With mandatory locking, you can prevent others from trashing your edit
session, but it requires that you invoke a non-standard wrapper around vi.
A wrapper in this sense would open the target with a lock, then invoke
the editor of choice via exec. If you have an exclusive lock, and a mandatory
locking file system, then someone else starting a vi would pause,
waiting for the lock to be released.
--
---
Clarence A Dold - dold at tsmiti.Convergent.COM (408) 434-5293
...pyramid!ctnews!tsmiti!dold
P.O.Box 6685, San Jose, CA 95150-6685 MS#10-007
More information about the Comp.unix.xenix
mailing list