wait.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef _SYS_WAIT_H
  2. #define _SYS_WAIT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #include <signal.h>
  8. #define __NEED_pid_t
  9. #define __NEED_id_t
  10. #define __NEED_siginfo_t
  11. #include <bits/alltypes.h>
  12. typedef int idtype_t;
  13. pid_t wait (int *);
  14. int waitid (idtype_t, id_t, siginfo_t *, int);
  15. pid_t waitpid (pid_t, int *, int );
  16. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  17. #include <sys/resource.h>
  18. pid_t wait3 (int *, int, struct rusage *);
  19. pid_t wait4 (pid_t, int *, int, struct rusage *);
  20. #endif
  21. #define WNOHANG 1
  22. #define WUNTRACED 2
  23. #define WSTOPPED 2
  24. #define WEXITED 4
  25. #define WCONTINUED 8
  26. #define WNOWAIT 0x1000000
  27. #define __WNOTHREAD 0x20000000
  28. #define __WALL 0x40000000
  29. #define __WCLONE 0x80000000
  30. #define P_ALL 0
  31. #define P_PID 1
  32. #define P_PGID 2
  33. #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
  34. #define WTERMSIG(s) ((s) & 0x7f)
  35. #define WSTOPSIG(s) WEXITSTATUS(s)
  36. #define WCOREDUMP(s) ((s) & 0x80)
  37. #define WIFEXITED(s) (!WTERMSIG(s))
  38. #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
  39. #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
  40. #define WIFCONTINUED(s) ((s) == 0xffff)
  41. #ifdef __cplusplus
  42. }
  43. #endif
  44. #endif