sigchldwaitpid.c 171 B

12345678910111213
  1. #include "unp.h"
  2. void
  3. sig_chld(int signo)
  4. {
  5. pid_t pid;
  6. int stat;
  7. while ( (pid = waitpid(-1, &stat, WNOHANG)) > 0)
  8. printf("child %d terminated\n", pid);
  9. return;
  10. }