X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=sources%2FHand_CHLD.c;fp=sources%2FHand_CHLD.c;h=c5113eecf0a26379f42cc8e42cf3cf1d4fd4d7c8;hb=86de518c1856b983608c791e0bbbc265aaf8e9b4;hp=0000000000000000000000000000000000000000;hpb=e63a5e53036597d8027e2bf727c606698863a5d6;p=gapil.git diff --git a/sources/Hand_CHLD.c b/sources/Hand_CHLD.c new file mode 100644 index 0000000..c5113ee --- /dev/null +++ b/sources/Hand_CHLD.c @@ -0,0 +1,26 @@ +#include /* error simbol definitions */ +#include /* signal handling declarations */ +#include +#include +#include "macro.h" + +void Hand_CHLD(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; +}