From owner-freebsd-arch@FreeBSD.ORG Wed Aug 24 13:45:45 2005 Return-Path: X-Original-To: freebsd-arch@FreeBSD.org Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 38A0D16A41F; Wed, 24 Aug 2005 13:45:45 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E03043D45; Wed, 24 Aug 2005 13:45:43 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.3/8.13.3) with ESMTP id j7ODjf78097506; Wed, 24 Aug 2005 17:45:42 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.3/8.13.3/Submit) id j7ODjfe6097505; Wed, 24 Aug 2005 17:45:41 +0400 (MSD) (envelope-from yar) Date: Wed, 24 Aug 2005 17:45:40 +0400 From: Yar Tikhiy To: Pawel Jakub Dawidek , Hajimu UMEMOTO , FreeBSD-arch Message-ID: <20050824134540.GA94265@comp.chem.msu.su> References: <20050822213028.GB4812@garage.freebsd.pl> <20050823080754.GA47261@garage.freebsd.pl> <20050823202656.GB30465@funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050823202656.GB30465@funkthat.com> User-Agent: Mutt/1.5.9i Cc: Subject: Re: New library: libpidfile. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2005 13:45:45 -0000 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 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