Commentato il codice del server echo basato sulla funzione poll.
[gapil.git] / listati / hand_sigchild.c
1 void HandSigCHLD(int sig)
2 {
3     int errno_save;
4     int status;
5     pid_t pid;
6     /* save errno current value */
7     errno_save = errno;
8     /* loop until no */
9     do {
10         errno = 0;
11         pid = waitpid(WAIT_ANY, &status, WNOHANG);
12         if (pid > 0) {
13             debug("child %d terminated with status %x\n", pid, status);
14         }
15     } while ((pid > 0) && (errno == EINTR));
16     /* restore errno value */
17     errno = errno_save;
18     /* return */
19     return;
20 }