New library: libpidfile.
Yar Tikhiy
yar at comp.chem.msu.su
Wed Aug 24 13:45:45 GMT 2005
On Tue, Aug 23, 2005 at 01:26:56PM -0700, John-Mark Gurney wrote:
> Pawel Jakub Dawidek wrote this message on Tue, Aug 23, 2005 at 10:07 +0200:
> > On Tue, Aug 23, 2005 at 12:46:52PM +0900, Hajimu UMEMOTO wrote:
> > +> Hi,
> > +>
> > +> >>>>> On Mon, 22 Aug 2005 23:30:28 +0200
> > +> >>>>> Pawel Jakub Dawidek <pjd at FreeBSD.org> said:
> > +>
> > +> pjd> I'd like to commit a small library for handling "pidfiles".
> > +>
> > +> NetBSD and OpenBSD has similar functions already in libutil. I think
> > +> we alone have a different API is bad idea. So, it is good to bring
> > +> them into FreeBSD from NetBSD or OpenBSD, IMHO.
> >
> > I assume you're talking about NetBSD's pidlock(3).
> >
> > This is exactly an example of a bad way of doing it, as I understand the
> > code.
>
> /me just checked NetBSD and OpenBSD's code at:
> http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libutil/pidfile.c?rev=1.7&content-type=text/x-cvsweb-markup
> http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/pidfile.c?rev=1.7&content-type=text/x-cvsweb-markup
>
> Neither, of these are safe to prevent multiple daemons from starting
> up at the same time... Both NetBSD and OpenBSD doesn't even check if
> a daemon is running.. it just blindly splats the pid into the file..
Of course, giving advices is much easier than doing the real work,
but I dare suggest cooperation with NetBSD and OpenBSD on this issue
so that eventually we have a good and compatible implementation of
the pidfile API in *BSD. I believe that the NetBSD and OpenBSD
folks won't take offence if approached with a well-grounded explanation
of why their current pidfile functions suck.
--
Yar
More information about the freebsd-arch
mailing list