3 ms·
Here's an example I'm rather proud of. It involves setting getpid(2) as a signal handler(2) via JNA. https://github.com/facebook/buck/commit/48f1e201a966b9e2ad
by quotemstr 10y ago
Here's an example I'm rather proud of. It involves setting getpid(2) as a signal handler(2) via JNA.
https://github.com/facebook/buck/commit/48f1e201a966b9e2adabdde4a7425d0f3989208f https://github.com/facebook/buck/commit/48f1e201a966b9e2adab...
- DblPlusUngood 10y agoWhy 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!