sig_chld_waitpid.c 176 B

1234567891011121314
  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. }
  10. return;
  11. }