[net.bugs.uucp] A better way to check lockfiles for HoneyDANBER.

dpb@laidbak.UUCP (Darryl Baker) (10/08/85)

In looking at justifing the cost of us getting HoneyDANBER uucp for our
4.2BSD system I found it still used timestamps on the lock file to see
if the lock was old. On System V systems HoneyDANBER uses kill(0,pid)
to see if the process who created the lock file still exists. Well on
4.2 systems it could do the same sort of thing using the getpriority()
system call since it allows anyone to get the priority of a process.
The usage would be:

		errno = 0;		/* the kernel also clear this */
		getpriority(PRIO_PROCESS, pid);/* returns the priority of */
					       /* but who cares and -1 is */
					       /* a valid priority */
		if(errno == ESRCH){
			remove lockfile
		} else {
			lock valid
		}

Using this would eliminate the problem of getting two processes doing
things at the same time.
-- 
				from the sleepy terminal of
				Darryl Baker
				[ihnp4!]laidbak!dpb

mp@allegra.UUCP (Mark Plotnick) (10/09/85)

kill(0,pid) works on 4.2bsd, too.  In HDB uucp, just #define
ATTSVKILL and you're all set.

dpb@laidbak.UUCP (Darryl Baker) (10/09/85)

As I said in the previous article I'm working from documentation. The
documentation and it says it uses the return value not that it checks
the errno value as to whether or not it is EPERM or ESRCH. Though if
it does it would work just fine to define ATTSVKILL.
-- 
				from the sleepy terminal of
				Darryl Baker
				[ihnp4!]laidbak!dpb