From owner-svn-src-all@FreeBSD.ORG Sat Feb 11 10:35:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E0E21065672; Sat, 11 Feb 2012 10:35:35 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id CC5B58FC0A; Sat, 11 Feb 2012 10:35:33 +0000 (UTC) Received: by bkcjg1 with SMTP id jg1so3135310bkc.13 for ; Sat, 11 Feb 2012 02:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=61MFnUhawF3Zw+N6EhNqsW69skIfjHuaSClZWCcEVbU=; b=tuY6MzoMEJxj6Q5WJVAC1BT6LXi3u6T+sTY5SjNG0vxhqcHvTDpsMZQe+sQdNYRa7L d5JtSqy0E7t507ZQJ0sETV2N9J5zjUpZopSxF3UaniyrStcMMfsAVEr3F95uOpWY512W FAinW8YkzaQDtk9s0rsbzPMQ6DasqoLxJrLcI= Received: by 10.204.151.209 with SMTP id d17mr4068781bkw.52.1328956532884; Sat, 11 Feb 2012 02:35:32 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id o26sm25906448bko.14.2012.02.11.02.35.29 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 11 Feb 2012 02:35:30 -0800 (PST) From: Mikolaj Golub To: Pawel Jakub Dawidek References: <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> <86sjiov29o.fsf@in138.ua3> <20120206082706.GA1324@garage.freebsd.pl> <86wr7zmy8f.fsf@kopusha.home.net> <20120206221742.GA1336@garage.freebsd.pl> <86liodu3me.fsf@in138.ua3> <20120208090600.GA1308@garage.freebsd.pl> X-Comment-To: Pawel Jakub Dawidek Sender: Mikolaj Golub Date: Sat, 11 Feb 2012 12:35:27 +0200 In-Reply-To: <20120208090600.GA1308@garage.freebsd.pl> (Pawel Jakub Dawidek's message of "Wed, 8 Feb 2012 10:06:01 +0100") Message-ID: <86sjihsln4.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@FreeBSD.org, Guy Helmer , svn-src-all@FreeBSD.org, Andrey Zonov , src-committers@FreeBSD.org Subject: Re: svn commit: r230869 - head/usr.sbin/daemon X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2012 10:35:35 -0000 On Wed, 8 Feb 2012 10:06:01 +0100 Pawel Jakub Dawidek wrote: PJD> On Wed, Feb 08, 2012 at 10:32:41AM +0200, Mikolaj Golub wrote: >> >> On Mon, 6 Feb 2012 23:17:43 +0100 Pawel Jakub Dawidek wrote: >> >> PJD> On Mon, Feb 06, 2012 at 11:46:24PM +0200, Mikolaj Golub wrote: >> >> >> Thanks. The updated version is attached. >> >> PJD> Looks good to me. >> >> Thanks. But I still think that adding some signal handling is a good idea. I >> agree that there may be no sense in trying to handle many different signals, >> but handling SIGTERM (software termination signal :-) nicely looks like a good >> thing. PJD> Ok:) In that case could you break you patch into one that only fixes the PJD> problem we discussed and the other that implements new functionality? >> This would solve problems like stale pid files after shutdown or orphaned >> programs (again with stale pid files and a possibility to start another >> instance) due to a user mistakenly terminated the supervising daemons. >> >> Also it is possible then to add "automatic restart" option, as Andrey has >> proposed. >> >> Here is the patch that does it. It also change proctitle to make identifying a >> a supervisor with its charge. PJD> I'd prefer to see more general solution to that problem, but I guess PJD> this can't hurt. I've only one suggestion based on my experience. PJD> Before you restart the program, wait for 1 second. This helps a lot when PJD> you have misbehaving program or some misconfiguration that make the PJD> process to exit immediately. >> A technical question concerning the patch :-). Does sombody know if >> sigwaitinfo() may be interrupted in my case and I should check for EINTR, as I >> do in the patch? PJD> Calling sigwaitinfo() with second argument equal to NULL is equivalent PJD> to calling sigwait(). The only difference is that sigwait() cannot be PJD> interrupted by signal, thus never sets errno to EINTR. Why not to use PJD> just that? Thank you. Here are the patches I would like to commit if there are no objections or other suggestions: http://people.freebsd.org/~trociny/daemon/daemon.spawn.1.patch http://people.freebsd.org/~trociny/daemon/daemon.SIGTERM.1.patch http://people.freebsd.org/~trociny/daemon/daemon.restart.1.patch -- Mikolaj Golub