From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id yIzSGe+UzV4kYQAA0tVLHw (envelope-from ) for ; Tue, 26 May 2020 22:15:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uICnFe+UzV7abAAAbx9fmQ (envelope-from ) for ; Tue, 26 May 2020 22:15:11 +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 CC0089404CB for ; Tue, 26 May 2020 22:15:10 +0000 (UTC) Received: from localhost ([::1]:39112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdhqm-0003Do-Ey for larch@yhetil.org; Tue, 26 May 2020 18:15:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdhqg-0003C6-EX for guix-patches@gnu.org; Tue, 26 May 2020 18:15:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jdhqg-0006gw-32 for guix-patches@gnu.org; Tue, 26 May 2020 18:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jdhqf-00072f-TD for guix-patches@gnu.org; Tue, 26 May 2020 18:15:01 -0400 Subject: bug#41507: [PATCH Shepherd 2/2] shepherd: Use 'signalfd' when possible. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Tue, 26 May 2020 22:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 41507 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 41507-done@debbugs.gnu.org, Jan Nieuwenhuizen Mail-Followup-To: 41507@debbugs.gnu.org, ludo@gnu.org, ludo@gnu.org Received: via spool by 41507-done@debbugs.gnu.org id=D41507.159053124526987 (code D ref 41507); Tue, 26 May 2020 22:15:01 +0000 Received: (at 41507-done) by debbugs.gnu.org; 26 May 2020 22:14:05 +0000 Received: from localhost ([127.0.0.1]:47319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdhpl-00071D-68 for submit@debbugs.gnu.org; Tue, 26 May 2020 18:14:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdhpj-00070b-QN for 41507-done@debbugs.gnu.org; Tue, 26 May 2020 18:14:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53787) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdhpd-0006Vj-PW; Tue, 26 May 2020 18:13:57 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57684 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jdhpc-0004PO-Bd; Tue, 26 May 2020 18:13:57 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200524143700.6378-1-ludo@gnu.org> <20200524143700.6378-2-ludo@gnu.org> <87a71ww5zx.fsf@gnu.org> Date: Wed, 27 May 2020 00:13:53 +0200 In-Reply-To: <87a71ww5zx.fsf@gnu.org> (Mathieu Othacehe's message of "Mon, 25 May 2020 14:31:30 +0200") Message-ID: <875zcimjj2.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: 4hH/q42nEVU0 Hi! Mathieu Othacehe skribis: >> + (lambda args >> + (if (=3D ENOSYS (system-error-errno args)) >> + #f >> + (apply throw args))))) > > Maybe: > > (and (=3D ENOSYS (system-error-errno args)) > (apply throw args)) It=E2=80=99s not equivalent. :-) >> +(define (handle-signal-port port) >> + "Read from PORT, a signalfd port, and handle the signal accordingly." >> + (let ((signal (consume-signalfd-siginfo port))) >> + (cond ((=3D signal SIGCHLD) >> + (handle-SIGCHLD)) >> + ((=3D 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? Good idea, done! >> + (begin >> + ;; Unblock any signals that might have been blocked by the pa= rent >> + ;; 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. Right, I=E2=80=99ll let you look into it if that=E2=80=99s fine with you. > You could also extend the comment to say that it is only necessary if > using the signalfd mechanism (because signals are not blocked > otherwise). Done. I did: make dist guix build shepherd --with-source=3Dshepherd-0.8.0.tar.gz \ -s x86_64-linux -s i686-linux -s armhf-linux -s aarch64-linux guix build shepherd --with-source=3Dshepherd-0.8.0.tar.gz \ --target=3Di586-pc-gnu and it all passes. Janneke, could you check that it works on GNU/Hurd? Ludo=E2=80=99.