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