Text File

Aucbvax.2722 fa.unix-wizards utzoo!decvax!ucbvax!unix-wizards Tue Aug 18 02:40:01 1981 links and lox >From day@RAND-UNIX Mon Aug 17 22:24:29 1981

Re: ... exclusive access is already available if the user programs use links as locks.

This would work fine if systems and programs never crashed, but they do, and since there is no way to tell the difference between a lock file that is really valid and one that is left over from a crash, this solution has holes--an especially bad attribute of a locking mechanism!

Exclusive open gives you the locking you need plus the ability to distinguish between and deal with dead lock files. The change to the system would be something like this:

1. Add `create-if-nonexistent' and `exclusive' bits to the mode argument of the open(2) call. 2. Define a new errno for when an open fails because the exclusive bit is on and some process has the file open with the exclusive mode set. 3. If the file had to be created, set some high-order bit in the file descriptor returned by open(2).

To set a lock, you do an open with the two bits set. If the open succeeds, you have the lock you wanted. If you care, you can tell whether or not the lock file existed prior to your open call by looking at the special bit in the returned file descriptor. If the open fails and you got the no-exclusive error, you know you are actively locked out.

Why do I care about this?

Because my beloved Rand Editor would like to be able to determine whether its temp file exists because of an active editing session or a crashed one, so that it can recover from crashes.

I really wish you could see your way clear to solving this problem in VMUNIX, which is after all a standard, so that this feature of our editor will work on our system and other systems without a kernel change.

Re: The current thinking as expressed at a meeting last week of the ARPA steering committee for UNIX on the VAX is that locking modes (exclusive-open, etc) are neither necessary nor sufficient for user applications, and plans to add such to the standard VAX system have been dropped.

Can you elaborate?

Regards,

--dave

----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen <jgoerzen@complete.org> of http://communication.ucsd.edu/A-News/

This Usenet Oldnews Archive article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.