Re: Why does "system" have to block SIGCHLD?



Hello Ronald,

Why does "system" have to block SIGCHLD?

as explained by the Authoritative documentation, the Single Unix
Specification standard:
http://www.unix.org/version3/online.html:

<copy>
The system() function shall ignore the SIGINT and SIGQUIT signals, and
shall block the SIGCHLD signal, while waiting for the command to
terminate. If this might cause the application to miss a signal that
would have killed it, then the application should examine the return
value from system() and take whatever action is appropriate to the
application if the command terminated due to receipt of a signal.

[...]

Blocking SIGCHLD while waiting for the child to terminate prevents the
application from catching the signal and obtaining status from
system()'s child process before system() can get the status itself.

</copy>

Cheers,
Loic.

.



Relevant Pages

  • Sending signals from client to server
    ... Has any sshd implementation added support for sending signals from client ... A user at an SSH client clicks to close the window. ... The sshd passes this signal on to the appropriate child process. ... The termination may ripple up the process tree and terminate ...
    (SSH)
  • Re: Process with many NPTL threads terminates slowly on core dump signal
    ... clear false pending signal indication in core dump ... > to terminate if it receives a signal that may cause a core dump. ... > program is designed to consume infinite CPU time). ... > * The slow process termination time only occurs for those signals that ...
    (Linux-Kernel)
  • monitor and restart child process
    ... int main ... for signal from the children (in case they terminate), ... i want to restart any child process when he terminates (if he ... i have a signal catcher function that handles signals from the child, ...
    (comp.unix.programmer)
  • Re: Signals, threads and the use of SIGUSR1
    ... No, I think that SIGINT, SIGHUP and SIGTERM are the signals to be covered in ... >> that's OK to just terminate your process as usual, ... if you don't send explicitely SIGUSR1 to that thread upon ...
    (comp.unix.programmer)
  • Re: NMEA ref.clock better than my ISPs timeserver?
    ... David J Taylor wrote: ... signals. ... On very long runs, you would not only need to terminate the cable correctly, you would need to drive it correctly as well, requiring powered line drivers and receivers at either end. ... To play safe with the ttl level pps I've setup to use a simple ...
    (comp.protocols.time.ntp)