[net.unix-wizards] VAX UNIX magtape lockout

solomon (07/16/82)

It just so happens that I recently wrote a couple of programs to do
something similar.  I will post them to net.sources as soon as I
get a chance.  The programs are called rq and rl (request and release).
Rq takes a list of files and requests exclusive write-access to them,
complaining and listing the name(s) if any are currently rq'ed by'
someone else.  Rl releases the files.  The programs work by fiddling
with mode bits.  Rq also does a chown, so it must be suid root.
Rl is also able to release all files in the current directory locked
by the caller.  However, it is still too easy to forget to release
files, so rq has an override flag (we are more interested in preventing
accidental interference than deliberate mischeif).

A few changes would be necessary to make this program useful for
locking the mag tape.  First, all the aliases for the device should
be requested at once.  Second, you would want to lock out read access
as well as write access, since you wouldn't want sombody else to move
the tape while you were writing on it.  Perhaps there are other
pitfalls I haven't thought of yet.  Oh yes, right now you can only
request files in your group.  That would have to be changed too.

BTW, back in the ancient past we had a v6 system with rq and rl
calls just for locking devices.  They had the feature of releasing
all locked devices on logout.  However, the guy who wrote them
was the sort of hacker who liked to make himself indespensible by
never documenting anything and hiding the sources.  (Rumor had it
that he used to patch the kernel through the console switches).
Anybody have a good idea how to make rl work on logout?

	Marvin Solomon
	Computer Scineces
	University of Wisconsin, Madison WI
	solomon@uwisc
	...!harpo!uwvax!solomon

mahler (07/17/82)

Owner/Group/World permission should be who can open this device.  IOCTL'S
should be used to determine "sub-access" qualities (like exclusive open).
Steve Mahler, Network Services Mgr, Engineering Computer Network, Purdue