wait.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef _SYS_WAIT_H
  2. #define _SYS_WAIT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #define __NEED_pid_t
  8. #define __NEED_id_t
  9. #include <bits/alltypes.h>
  10. typedef enum {
  11. P_ALL = 0,
  12. P_PID = 1,
  13. P_PGID = 2,
  14. P_PIDFD = 3
  15. } idtype_t;
  16. pid_t wait (int *);
  17. pid_t waitpid (pid_t, int *, int );
  18. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  19. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  20. || defined(_BSD_SOURCE)
  21. #include <signal.h>
  22. int waitid (idtype_t, id_t, siginfo_t *, int);
  23. #endif
  24. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  25. #include <sys/resource.h>
  26. pid_t wait3 (int *, int, struct rusage *);
  27. pid_t wait4 (pid_t, int *, int, struct rusage *);
  28. #endif
  29. #define WNOHANG 1
  30. #define WUNTRACED 2
  31. #define WSTOPPED 2
  32. #define WEXITED 4
  33. #define WCONTINUED 8
  34. #define WNOWAIT 0x1000000
  35. #define __WNOTHREAD 0x20000000
  36. #define __WALL 0x40000000
  37. #define __WCLONE 0x80000000
  38. #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
  39. #define WTERMSIG(s) ((s) & 0x7f)
  40. #define WSTOPSIG(s) WEXITSTATUS(s)
  41. #define WCOREDUMP(s) ((s) & 0x80)
  42. #define WIFEXITED(s) (!WTERMSIG(s))
  43. #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
  44. #define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
  45. #define WIFCONTINUED(s) ((s) == 0xffff)
  46. #if _REDIR_TIME64
  47. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  48. __REDIR(wait3, __wait3_time64);
  49. __REDIR(wait4, __wait4_time64);
  50. #endif
  51. #endif
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif