wait.h 856 B

1234567891011121314151617181920212223242526
  1. /* Define how to access the structure that the wait system call stores.
  2. On many systems, there is a structure defined for this.
  3. But on vanilla-ish USG systems there is not. */
  4. #ifndef HAVE_WAIT_STRUCT
  5. #define WAITTYPE int
  6. #define WIFSTOPPED(w) (((w)&0377) == 0177)
  7. #define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
  8. #define WIFEXITED(w) (((w)&0377) == 0)
  9. #define WRETCODE(w) ((w) >> 8)
  10. #define WSTOPSIG(w) ((w) >> 8)
  11. #define WCOREDUMP(w) (((w)&0200) != 0)
  12. #define WTERMSIG(w) ((w) & 0177)
  13. #define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8)))
  14. #else
  15. #include <sys/wait.h>
  16. #define WAITTYPE union wait
  17. #define WRETCODE(w) (w).w_retcode
  18. #define WSTOPSIG(w) (w).w_stopsig
  19. #define WCOREDUMP(w) (w).w_coredump
  20. #define WTERMSIG(w) (w).w_termsig
  21. #define WSETSTOP(w,sig) \
  22. ((w).stopsig = (sig), (w).coredump = 0, (w).termsig = 0177)
  23. #endif