From owner-freebsd-current@FreeBSD.ORG Thu Mar 14 16:51:14 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 43EDD395; Thu, 14 Mar 2013 16:51:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 13EDFB03; Thu, 14 Mar 2013 16:51:14 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id CA788B96E; Thu, 14 Mar 2013 12:51:11 -0400 (EDT) From: John Baldwin To: Pawel Jakub Dawidek Subject: Re: pidfile_open incorrectly returns EAGAIN when pidfile is locked Date: Thu, 14 Mar 2013 12:50:59 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <513F8D20.2050707@erdgeist.org> <201303140942.40945.jhb@freebsd.org> <20130314162958.GD1344@garage.freebsd.pl> In-Reply-To: <20130314162958.GD1344@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201303141250.59521.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 14 Mar 2013 12:51:12 -0400 (EDT) Cc: Dirk Engling , freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 16:51:14 -0000 On Thursday, March 14, 2013 12:29:58 pm Pawel Jakub Dawidek wrote: > On Thu, Mar 14, 2013 at 09:42:40AM -0400, John Baldwin wrote: > > On Thursday, March 14, 2013 4:44:20 am Pawel Jakub Dawidek wrote: > > > On Thu, Mar 14, 2013 at 08:28:25AM +0100, Dirk Engling wrote: > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Hash: SHA1 > > > > > > > > On 13.03.13 23:08, Pawel Jakub Dawidek wrote: > > > > > > > > > I think I considered something similar at first, but the change I > > > > > proposed was optimal, IMHO at the cost of producing pretty large > > > > > diff, because of indentation change. But to be sure, can you send a > > > > > patch of your proposed change? > > > > > > > > http://erdgeist.org/arts/software/Code/pidfile.c.diff > > > > > > Right. Your patch assumes EWOULDBLOCK is equal to EAGAIN, which is true > > > on FreeBSD, but is not portable. Also in case pidptr is NULL you compare > > > errno three times instead of just one (not a big deal of course, just > > > something that could be done a bit more optimal:)). > > > > Geeze, why not just add an else. That's the really short diff: > > Heh, I did consider that as well, but here you check errno twice, > instead of once. Guys, is there anything wrong with the patch I > proposed? I'm sure the compiler can work that out just fine and it should do whatever is most readable to the programmer. I don't care either way. -- John Baldwin