GNU bug report logs - #41507
[PATCH Shepherd 0/2] Use 'signalfd' on GNU/Linux

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Sun, 24 May 2020 14:28:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 41507 <at> debbugs.gnu.org
Subject: [bug#41507] [PATCH Shepherd 2/2] shepherd: Use 'signalfd' when possible.
Date: Mon, 25 May 2020 14:31:30 +0200
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




This bug report was last modified 4 years and 350 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.