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