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

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Wed, 25 Jan 2023 21:17:53 +0100

On Wed, Jan 25, 2023 at 04:24:36PM +0600, NRK wrote:
> On Wed, Jan 25, 2023 at 09:37:58AM +0100, Hiltjo Posthuma wrote:
> > I don't think there can be any zombies since it is run in setup() before any
> > processes can spawn (via keybindings etc) or am I overlooking something
> > obvious?
>
> It was recently discussed here: https://lists.suckless.org/hackers/2207/18424.html
> And here's the original thread from 2009: https://lists.suckless.org/dev/0908/0774.html
>
> - NRK
>

Thanks, yeah I'm also digging in the history now.

I just tried it on a Slackware 11 machine, because I'm curious what it might break etc.

Using the new patch it does not handle zombie/defunct processes anymore on this
machine. To reproduce it, in .xinitrc, on a dusty machine:

        sleep 10 &
        exec dwm

Run ps in the terminal, after the sleep process exits it is defunct. This used
to work without the patch.

I changed SIG_DFL to SIG_IGN and it seems to work.

Also, maybe it is better to not call sigprocmask? Since now it blocks all
signals, including SIGTERM in setup().

-- 
Kind regards,
Hiltjo
Received on Wed Jan 25 2023 - 21:17:53 CET

This archive was generated by hypermail 2.3.0 : Wed Jan 25 2023 - 21:26:10 CET