[hackers] Re: [dwm][PATCH] Use sigaction(SA_NOCLDWAIT) for SIGCHLD handling

From: Chris Down <chris_AT_chrisdown.name>
Date: Tue, 26 Jul 2022 21:45:08 +0100

NRK writes:
>On Tue, Jul 26, 2022 at 09:15:30PM +0100, Chris Down wrote:
>> - /* clean up any zombies immediately */
>> - sigchld(0);
>> + if (sigaction(SIGCHLD, &sc, NULL)) {
>> + perror("sigaction");
>> + exit(EXIT_FAILURE);
>> + }
>
>Not too well versed on `sigaction` but what happens to any zombies
>*before* the sigaction call? Don't we need to clean those up?

Can there really be zombies before setup()? At that point we haven't even
started in earnest yet, I don't see how a child would even get going.

The old call to sigchld() seems to just be there to install the handler for
later, not actually to reap zombies during setup().

>Also `die` already calls perror, could just use:
>
> if (sigaction(SIGCHLD, &sc, NULL) < 0)
> die("sigaction failed:");

Oh, that's a good catch. die() it is for v2. :-)

>The comparison against 0 is mostly personal, but the suckless coding
>style recommends it as well: https://suckless.org/coding_style/

No strong preference, I'll put it in for v2.

Thanks!
Received on Tue Jul 26 2022 - 22:45:08 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 26 2022 - 23:48:29 CEST