From owner-svn-src-head@FreeBSD.ORG Sun Feb 5 22:51:53 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 BC641106564A; Sun, 5 Feb 2012 22:51:53 +0000 (UTC) (envelope-from jos@catnook.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 660448FC13; Sun, 5 Feb 2012 22:51:53 +0000 (UTC) Received: by obcwo16 with SMTP id wo16so8756748obc.13 for ; Sun, 05 Feb 2012 14:51:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.174.101 with SMTP id br5mr6888432obc.0.1328480789567; Sun, 05 Feb 2012 14:26:29 -0800 (PST) Received: by 10.60.0.170 with HTTP; Sun, 5 Feb 2012 14:26:29 -0800 (PST) Received: by 10.60.0.170 with HTTP; Sun, 5 Feb 2012 14:26:29 -0800 (PST) In-Reply-To: <20120205214647.GI30033@garage.freebsd.pl> References: <201202011641.q11Gf0j6095461@svn.freebsd.org> <20120204074201.GA1694@garage.freebsd.pl> <4F2CEB1D.10607@zonov.org> <27A0A960-F767-4D2C-BF3E-31F73FBF4E28@palisadesystems.com> <86zkcy5ur9.fsf@kopusha.home.net> <20120205093938.GC30033@garage.freebsd.pl> <86lioh7yz5.fsf@kopusha.home.net> <20120205214647.GI30033@garage.freebsd.pl> Date: Sun, 5 Feb 2012 14:26:29 -0800 Message-ID: From: Jos Backus To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: src-committers@freebsd.org, Guy Helmer , svn-src-all@freebsd.org, Andrey Zonov , Mikolaj Golub , svn-src-head@freebsd.org Subject: Re: svn commit: r230869 - head/usr.sbin/daemon 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: Sun, 05 Feb 2012 22:51:53 -0000 Hi Pawel, On Feb 5, 2012 1:48 PM, "Pawel Jakub Dawidek" wrote: > > On Sun, Feb 05, 2012 at 11:27:10PM +0200, Mikolaj Golub wrote: > > Ok, using hastd code as a reference :-) here is my implementation. > > - I'd not pass selected signals to the child. The parent can still be > killed with a whole bunch of different signals that are not passed or > cannot be caught or the child process handle them gracefully. > Signals should be send to the PID from the pidfile anyway. If someone > is sending signals to the parent he has no right to expect well > behaviour from the parent. > > - Now that we handle the pidfile fully in the parent, I'd move dropping > provileges after fork(2) and pidfile_write(3). This way pidfiles will > always be created with root privileges and we can forget about all the > mess with pid directories, etc. > > - With the above you can wait for child to exit with simple wait(2). If you are going to wait for the child anyway, you are doing almost everything supervise does. All you now need is a Unix domain socket interface so you can receive commands in daemon(1), and run daemon(1) at boot. AND you can remove all the pidfile code :) Jos