wait.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. } idtype_t;
  15. pid_t wait (int *);
  16. pid_t waitpid (pid_t, int *, int );
  17. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  18. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  19. || defined(_BSD_SOURCE)
  20. #include <signal.h>
  21. int waitid (idtype_t, id_t, siginfo_t *, int);
  22. #endif
  23. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  24. #include <sys/resource.h>
  25. pid_t wait3 (int *, int, struct rusage *);
  26. pid_t wait4 (pid_t, int *, int, struct rusage *);
  27. #endif
  28. #define WNOHANG 1
  29. #define WUNTRACED 2
  30. #define WSTOPPED 2
  31. #define WEXITED 4
  32. #define WCONTINUED 8
  33. #define WNOWAIT 0x1000000
  34. #define __WNOTHREAD 0x20000000
  35. #define __WALL 0x40000000
  36. #define __WCLONE 0x80000000
  37. #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
  38. #define WTERMSIG(s) ((s) & 0x7f)
  39. #define WSTOPSIG(s) WEXITSTATUS(s)
  40. #define WCOREDUMP(s) ((s) & 0x80)
  41. #define WIFEXITED(s) (!WTERMSIG(s))
  42. #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
  43. #define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
  44. #define WIFCONTINUED(s) ((s) == 0xffff)
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif