Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Allocating a device
@ 1996-11-05  5:00 STRIZZOLO,CLAU./EP
  0 siblings, 0 replies; only message in thread
From: STRIZZOLO,CLAU./EP @ 1996-11-05  5:00 UTC (permalink / raw)



I need to allocate a device so that an user can reserve it for his/her
business, and nobody can interfere with this until he/she finishes his/her
work (VMS-like allocation).
I am not a OSF/1 expert, then I came to the (maybe wrong) idea that there
is not such a feature in the operating system, and that I need to make it
by myself. Maybe I should create two scripts (let's say "allocate" and
"deallocate", like on VMS) whose main purpose is to look for eventual 
allocation of the device, and then change the owner of the device. Then, 
allocate script might (very roughly) look like this:

#!/bin/sh
if [ $# != 1 ]
then
  echo "Usage:          allocate device-name   (for instance: allocate nrmt1h)" 
  exit 1
fi
#
lock_file="/usr/common/loader_lock/$1"
#
if [ -r "$lock_file" ]
then
  echo "Warning: /dev/$1 is allocated by another user."
  exit 1
fi
myname=`whoami`
echo "$myname" > $lock_file
chown $myname /dev/$1
echo "/dev/$1 allocated"

The lock_file does not exist if the device is not allocated, and keeps the
name of the allocating user if it exists. Both the script and the file
should be owned by root: the script should be executable by anybody while
the lock file should not be editable, just updatable by allocate procedure.
Now, here's the problem: I played around with protections on the script,
so that anybody can run it, but when it comes to "privileged" tasks (in
particular, changing the lock file and changing the owner) it crashes
due to missing privileges. 
The question is: is there any way for an user to execute the script above 
as a superuser (on VMS you can just INSTALL the procedure in a privileged
way)? Or is there any simpler/better way to do what I need?

Thank you all in advance

	Claudio Strizzolo




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-11-05  5:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-11-05  5:00 Allocating a device STRIZZOLO,CLAU./EP

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox