X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=listati%2Fhand_sigchild.c;fp=listati%2Fhand_sigchild.c;h=2ae8cc61f375eaa361d3f4581cc283afd63fc653;hp=0000000000000000000000000000000000000000;hb=bdf6e88eeb9b3aef06d57930ec8b89083639e56d;hpb=cf60963212306540ce7485ed7c86405e143a3352 diff --git a/listati/hand_sigchild.c b/listati/hand_sigchild.c new file mode 100644 index 0000000..2ae8cc6 --- /dev/null +++ b/listati/hand_sigchild.c @@ -0,0 +1,20 @@ +void HandSigCHLD(int sig) +{ + int errno_save; + int status; + pid_t pid; + /* save errno current value */ + errno_save = errno; + /* loop until no */ + do { + errno = 0; + pid = waitpid(WAIT_ANY, &status, WNOHANG); + if (pid > 0) { + debug("child %d terminated with status %x\n", pid, status); + } + } while ((pid > 0) && (errno == EINTR)); + /* restore errno value */ + errno = errno_save; + /* return */ + return; +}