Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!purdue!ames!oliveb!pyramid!ctnews!mitisft!dold From: dold@mitisft.Convergent.COM (Clarence Dold) Newsgroups: comp.unix.xenix Subject: Re: Xenix Help ? MapChan : Shell Layers : Backup : File Locking Message-ID: <724@mitisft.Convergent.COM> Date: 7 Jun 89 22:23:20 GMT References: <1169@cheops.eecs.unsw.oz> Organization: Convergent Technologies, San Jose, CA Lines: 31 in article <1169@cheops.eecs.unsw.oz>, ashley@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@tsmiti.Convergent.COM (408) 434-5293 ...pyramid!ctnews!tsmiti!dold P.O.Box 6685, San Jose, CA 95150-6685 MS#10-007