Reputation: 6057
After my system call has returned because it was interrupted by a signal, is there a way to determine exactly which signal type (i.e. child process termination) caused the interruption?
Upvotes: 2
Views: 1341
Reputation: 84159
There's a number of facilities in Linux to deal with signals:
waitpid(2)
could be used to wait inline for SIGCHLD
sigaction(2)
could be used to setup handler functions to react to specific signals, the SA_RESTART
flag here affects whether certain system calls are interrupted or restarted
sigprocmask(2)
could be used to block a number of signals
sigwait(3)
could be used to wait for number of signals inline
signalfd(2)
, which is convenient when one needs to combine signal handling and non-blocking IO.
Then there's the whole next level of complexity when we start talking about threads, though if you deal with signals explicitly you usually don't really care which signal interrupted the system call.
Upvotes: 3