I have a server application which I want to protect from being stopped by any signal which I can ignore. Is there a way to ignore all possible signals at once, without setti
Yes:
#include
sigset_t mask;
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
This does not exactly ignore the signals, but blocks them; which in practice is the same effect.
I guess there's no need to mention that SIGKILL
and SIGSTOP
cannot be blocked nor ignored in any way.
For more detailed semantics, like mask inheritance rules and the like, check the man page