As Ian Abbott showed, system calls do in fact get interrupted by SIGCHLD.
However the system call I wanted to interrupt wasn't in the main thread, but system calls seam to be only interrupted in the thread, that receives the signal. Blocking the signal in the main thread fixed the problem:
sigset_t signal_set;
sigemptyset(&signal_set);
sigaddset(&signal_set, SIGCHLD);
sigprocmask(SIG_BLOCK, &signal_set, NULL);
What makes SIGCHLD special is, that when the handler is set to SIG_DFL, it is actually ignored, so there must be signal handler, even if it doesn't do anything:
static void noop_handler (int signal) {
return;
}
struct sigaction handler = {0};
handler.sa_handler = noop_handler;
sigaction (SIGCHLD, &handler, NULL))
That maked me think, that SIGCHLD doesn't work, but combining both it does.
However, I wonder, if there is a different way to achieve that signal disposition, then specifying ǹoop_handler.