3 ms·
Why is setting the signal handler for SIGHUP to getpid preferable to masking the signal?
by DblPlusUngood 10y ago
Why is setting the signal handler for SIGHUP to getpid preferable to masking the signal?
- swolchok 10y ago> But when we exec a child, the kernel resets any signal not set to `SIG_IGN` to `SIG_DFL`, so all our children, atomically, get their `SIGCHLD` handlers set to `SIG_DFL` at the moment of creation. Consequently, when either our process or the kernel sends `SIGHUP` to our process group, all our children die.
- DblPlusUngood 10y agoSIG_IGN is not the same as the signal mask. The result is the same though; I forgot that signal mask is not reset on exec. Damn POSIX signals!