Subject: [bug#41507] [PATCH Shepherd 2/2] shepherd: Use 'signalfd' when possible.

From: Ludovic Courtès <[email-masked]>
Date: Tue, 02 Jun 2020 23:38:35 +0200

Hi,

Mathieu Othacehe <[email-masked]> skribis:

>> That way, the child is guaranteed to never execute the original
>> handlers, and neither the parent nor the child misses any of these
>> signals (previously, the temporary (sigaction SIGTERM SIG_DFL)
>> introduced a window during which shepherd could be killed by a SIGTERM
>> instead of handling it gracefully.)
>>
>> WDYT?
>
> Yes, this is indeed much better this way!
>
>> +(define %precious-signals
>> +  ;; Signals that the shepherd process handles.
>> +  (list SIGCHLD SIGINT SIGHUP SIGTERM))
>
> We could maybe factorize this list with the one in "signal-port" in the
> "main" procedure. This way if we ever add an extra signal, we do not
> forget to add it to blocked signals list.

Yes, good idea.

I pushed the series with a followup commit to do that:

  38e3589 shepherd: Factorize list of handled signals.
  576ac61 service: 'fork+exec-command' blocks handled signals before forking.
  ec36311 system: Add 'with-blocked-signals'.
  bc74b5e system: 'sigprocmask' returns the previous set of blocked signals.

Let’s see if I can tag a release tomorrow…

Thanks for your feedback!

Ludo’.