Subject: Re: [PATCH 2/3] daemon: use sigaction() to install child_handler()

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Jun 2025 14:32:33 -0700

Carlo Marcelo Arenas Belón <[email-masked]> writes:

>> Hmph.  Wouldn't it a much smaller change and fix to discard 2/3 and
>> most of the 3/3 and instead make a siginterrupt() call to tell the
>> system to interrupt us when SIGCHLD is received only on platforms
>> where siginterrupt() is available?  Use of sigaction() does not seem
>> to be buying us anything for the purpose of this series.
>
> Using siginterrupt() would work (at least it did when I tested it in
> OpenBSD), but its use is discouraged as it has been obsoleted by the
> last two versions of POSIX (since 2018).

OK, but it feels a bit funny to base the conditional compilation to
use sigaction() (as opposed to signal()) on a symbol whose name was
derived from that deprecated interface, doesn't it, then?

> Most systems seem to be implementing `signal()` with `sigaction()`
> nowadays, but in the ones that are not (ex: Solaris) calling the later
> to get a `struct sigaction` with the flags being used, doesn't work
> and therefore it would seem, that the only way to do this reliably is
> by using sigaction everywhere for this signal, as implemented in 2/3.

Still the many #ifdef's sprinkled all over looked really ugly.  Can
we abstract this out a bit better?

Thanks.