From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 5wDZJMy6y14uMQAA0tVLHw (envelope-from ) for ; Mon, 25 May 2020 12:32:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CKlqIMy6y15LcwAAB5/wlQ (envelope-from ) for ; Mon, 25 May 2020 12:32:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 07B2F9403EE for ; Mon, 25 May 2020 12:32:11 +0000 (UTC) Received: from localhost ([::1]:42024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdCH3-0006M7-5D for larch@yhetil.org; Mon, 25 May 2020 08:32:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdCGw-0006Lt-Kl for guix-patches@gnu.org; Mon, 25 May 2020 08:32:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56809) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jdCGw-0004Jc-A9 for guix-patches@gnu.org; Mon, 25 May 2020 08:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jdCGw-0006rZ-6G for guix-patches@gnu.org; Mon, 25 May 2020 08:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41507] [PATCH Shepherd 2/2] shepherd: Use 'signalfd' when possible. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 May 2020 12:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41507 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 41507@debbugs.gnu.org Received: via spool by 41507-submit@debbugs.gnu.org id=B41507.159040990326356 (code B ref 41507); Mon, 25 May 2020 12:32:02 +0000 Received: (at 41507) by debbugs.gnu.org; 25 May 2020 12:31:43 +0000 Received: from localhost ([127.0.0.1]:40122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdCGc-0006r1-TO for submit@debbugs.gnu.org; Mon, 25 May 2020 08:31:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdCGa-0006qn-FI for 41507@debbugs.gnu.org; Mon, 25 May 2020 08:31:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48290) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdCGU-0004Hy-G5; Mon, 25 May 2020 08:31:34 -0400 Received: from lfbn-ann-1-136-86.w86-200.abo.wanadoo.fr ([86.200.104.86]:39508 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jdCGT-00016i-PU; Mon, 25 May 2020 08:31:34 -0400 From: Mathieu Othacehe References: <20200524143700.6378-1-ludo@gnu.org> <20200524143700.6378-2-ludo@gnu.org> Date: Mon, 25 May 2020 14:31:30 +0200 In-Reply-To: <20200524143700.6378-2-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Cour\?\= \=\?utf-8\?Q\?t\=C3\=A8s\=22's\?\= message of "Sun, 24 May 2020 16:37:00 +0200") Message-ID: <87a71ww5zx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: 0FZD+jhtN31C Hello Ludo, This is a big improvement, thank you! > + (lambda args > + (if (= ENOSYS (system-error-errno args)) > + #f > + (apply throw args))))) Maybe: (and (= ENOSYS (system-error-errno args)) (apply throw args)) > + > +(define (handle-signal-port port) > + "Read from PORT, a signalfd port, and handle the signal accordingly." > + (let ((signal (consume-signalfd-siginfo port))) > + (cond ((= signal SIGCHLD) > + (handle-SIGCHLD)) > + ((= signal SIGINT) > + (catch 'quit > + (lambda () > + (stop root-service)) > + quit-exception-handler)) Maybe we should create a handle-SIGINT, to make sure that the same code is shared with the sigaction handler? > + (begin > + ;; Unblock any signals that might have been blocked by the parent > + ;; process. > + (unblock-signals (list SIGCHLD SIGINT SIGHUP SIGTERM)) This made me realize that we may want to disable/reset SIGINT and SIGHUP, in the same way that we do for SIGTERM? This is not related to your patch anyway. You could also extend the comment to say that it is only necessary if using the signalfd mechanism (because signals are not blocked otherwise). In any case, this looks fine! Thanks, Mathieu