waitpid.c 488 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. */
  4. #include "portab.h"
  5. /**
  6. * @file
  7. * waitpid() implementation. Public domain.
  8. * Written by Steven D. Blackford for the NeXT system.
  9. */
  10. #ifndef HAVE_WAITPID
  11. #include "imp.h"
  12. #include <string.h>
  13. #include <stdlib.h>
  14. #include <sys/types.h>
  15. #include "exp.h"
  16. GLOBAL int
  17. waitpid(pid, stat_loc, options)
  18. int pid, *stat_loc, options;
  19. {
  20. for (;;) {
  21. int wpid = wait(stat_loc);
  22. if (wpid == pid || wpid == -1)
  23. return wpid;
  24. }
  25. }
  26. #endif