Re: [PATCH 2/3] daemon: use sigaction() to install child_handler()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 24, 2025, 21:32 UTC
- Message-ID
- <xmqqms9wzuz2.fsf@gitster.g>
- In-Reply-To
- <7f3ac4djbbhskbryzr754kdjdiyauiiy5dduv7h2uaa7mvafsr@chntkatmbbcb>
Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:
Show 9 quoted lines
>> 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?
Show 5 quoted lines
> 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.