Catch a signal and write it to the self-pipe.
This routine can be used with sig_*_catch() to send other signals through the self-pipe.
Shut down the self-pipe.
Set up a self-pipe for catching child exit events.
This function opens up a pipe within the program used to safely handle exiting child processes. Every time a child exits, a single byte is written to the pipe. The resulting file descriptor is statically assigned, so do not call this function more than once within a single program. The file descriptor is set to non-blocking mode to prevent blocking when reading from it.
To use the file descriptor, use either
select to determine when it is readable. When it becomes readable, read the data written to it (and throw it away), and use
wait or equivalent to catch the
exit value from the child process(es).