From owner-svn-src-head@FreeBSD.ORG Mon Feb 6 14:25:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 576901065672; Mon, 6 Feb 2012 14:25:17 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 07EDC8FC08; Mon, 6 Feb 2012 14:25:15 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id C2541A2D; Mon, 6 Feb 2012 15:25:14 +0100 (CET) Date: Mon, 6 Feb 2012 15:24:02 +0100 From: Pawel Jakub Dawidek To: Guy Helmer Message-ID: <20120206142402.GG1324@garage.freebsd.pl> References: <201202061411.q16EBOwt039268@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UTZ8bGhNySVQ9LYl" Content-Disposition: inline In-Reply-To: <201202061411.q16EBOwt039268@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r231087 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2012 14:25:17 -0000 --UTZ8bGhNySVQ9LYl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 06, 2012 at 02:11:24PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Mon Feb 6 14:11:24 2012 > New Revision: 231087 > URL: http://svn.freebsd.org/changeset/base/231087 >=20 > Log: > Using the O_CLOEXEC flag on open(2) caused the pidfile lock to be lost > when the child process execs daemon's target program thanks to flock(2) > semantics. So, we apparently have to leak the open pidfile's file > descriptor to keep the lock for the pidfile(3) functions to work proper= ly. > > Test case demonstrated by trociny: > =20 > ref8-amd64:/home/trociny% uname -r > 8.2-STABLE > ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 > ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 > daemon: process already running, pid: 19799 > =20 > kopusha:~% uname -r > 10.0-CURRENT > kopusha:~% daemon -p /tmp/sleep.pid sleep 10 > kopusha:~% daemon -p /tmp/sleep.pid sleep 10 > kopusha:~% Not sure if you saw the following discussion, but O_CLOEXEC is ok here. Mikolaj is working on improving daemon to handle it properly. What we had in 8.2-STABLE is also incorrect, but for other reasons. All in all, O_CLOEXEC should stay. What Mikolaj presented is a problem in daemon(8) and not pidfile(3). --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --UTZ8bGhNySVQ9LYl Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk8v4oIACgkQForvXbEpPzSRMQCfc5oRcV8KhB8d2JJLul7mbJoG Zq8AoJ39wwZRPVWUydlDyiA1QC4QrBVX =No2B -----END PGP SIGNATURE----- --UTZ8bGhNySVQ9LYl--