Re: Re: [iPAQ] run-once ?

From: Vegard Engen <vegard_at_engen.priv.no>
Date: Mon, 31 Dec 2001 14:11:55 +0100

On Mon, Dec 31, 2001 at 01:55:03PM +0100, Tom wrote:
> On Mon, Dec 31, 2001 at 12:48:22PM +0000, Alan Cox wrote:
> > > that part is easy. I would, however, prefer to look into /proc or ps
> > > instead, just to make sure that a) I catch cases where the binary is
> > > started by other means, too and b) to avoid all sorts of trouble with
> > > lockfiles not being removed correctly (kill -9).
> >
> > How do you expect looking in /proc to help you ? as to b) its not a problem
> > because the kill will close the file and drop the lock.
>
> hm, right. as to /proc - /proc/(pid) contains the program name in
> numerous places and could reliably be used to check for running
> instances. much like ps, only without invoking an external program.
>

Well, but how do you avoid race conditions? That is, by the time you're
finished looping through all the /proc/(pid)'s, what's to stop something else
from having started a new process?

-- 
- Vegard Engen, member of the first RFC1149 implementation team.
Received on Mon Dec 31 2001 - 05:12:17 EST

This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:18:58 EDT