Date: Tue, 03 Jun 1997 02:05:05 +0100 From: Brian Somers <brian@awfulhak.org> To: Adam David <adam@veda.is> Cc: ache@nagual.pp.ru (=?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?=), cvs-committers@freebsd.org, cvs-all@freebsd.org, cvs-etc@freebsd.org Subject: Re: cvs commit: src/etc rc Message-ID: <199706030105.CAA19996@awfulhak.demon.co.uk> In-Reply-To: Your message of "Mon, 02 Jun 1997 22:27:07 -0000." <199706022227.WAA10666@veda.is>
next in thread | previous in thread | raw e-mail | index | archive | help
[.....] > I have also seen stale locks, but not on a healthy system. > (file claims to be locked, but no process holds the lock). Sounds like a *very* sick system. One that's likely to be doing other stupid things like SEGVing things for no reason 'cos the descriptor tables are shagged. > > Modification of each such application is not acceptable solution. > > Each such application already uses its own methods, which are demonstrably > deficient in many cases. What we need is a set of calls in libutil: int pfile_create(const char *prog); /* create a pid file, return fd */ void pfile_destroy(int fd); /* remove a pid file */ pid_t pfile_read(const char *prog); /* Get pid from file */ And maybe a program that uses pfile_read for use in scripts. As has already been said, the existence of a lock on an existing file says whether the process is running or not. Of course to cater for all eventualities, we may need a "max" arg in pfile_create and an "n" arg in pfile_read, allowing more than one of a given process. Or maybe this is over- complicating things. If programs want to use this mechanism, they can. Killers like newsyslog should extract the pid to kill using pfile_read, therefore disabling it from killing un-cooperating processes (pfile_read will come up with nothing from a stale file). > -- > Adam David <adam@veda.is> > -- Brian <brian@awfulhak.org>, <brian@freebsd.org> <http://www.awfulhak.org> Don't _EVER_ lose your sense of humour....
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706030105.CAA19996>