[1] | 1 | #ifndef _SYS_WAIT_H |
---|
| 2 | #define _SYS_WAIT_H |
---|
| 3 | |
---|
| 4 | #include <sys/cdefs.h> |
---|
| 5 | #include <sys/resource.h> |
---|
| 6 | |
---|
| 7 | __BEGIN_DECLS |
---|
| 8 | |
---|
| 9 | #define WNOHANG 0x00000001 |
---|
| 10 | #define WUNTRACED 0x00000002 |
---|
| 11 | |
---|
| 12 | #define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ |
---|
| 13 | #define __WALL 0x40000000 /* Wait on all children, regardless of type */ |
---|
| 14 | #define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */ |
---|
| 15 | |
---|
| 16 | /* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ |
---|
| 17 | #define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
---|
| 18 | #define WEXITSTATUS __WEXITSTATUS |
---|
| 19 | |
---|
| 20 | /* If WIFSIGNALED(STATUS), the terminating signal. */ |
---|
| 21 | #define __WTERMSIG(status) ((status) & 0x7f) |
---|
| 22 | #define WTERMSIG __WTERMSIG |
---|
| 23 | |
---|
| 24 | /* If WIFSTOPPED(STATUS), the signal that stopped the child. */ |
---|
| 25 | #define __WSTOPSIG(status) __WEXITSTATUS(status) |
---|
| 26 | #define WSTOPSIG __WSTOPSIG |
---|
| 27 | |
---|
| 28 | /* Nonzero if STATUS indicates normal termination. */ |
---|
| 29 | #define WIFEXITED(status) (__WTERMSIG(status) == 0) |
---|
| 30 | |
---|
| 31 | /* Nonzero if STATUS indicates termination by a signal. */ |
---|
| 32 | #define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) |
---|
| 33 | |
---|
| 34 | /* Nonzero if STATUS indicates the child is stopped. */ |
---|
| 35 | #define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) |
---|
| 36 | |
---|
| 37 | /* Nonzero if STATUS indicates the child dumped core. */ |
---|
| 38 | #define WCOREDUMP(status) ((status) & 0x80) |
---|
| 39 | |
---|
| 40 | #ifdef _BSD_SOURCE |
---|
| 41 | #define W_STOPCODE(sig) ((sig) << 8 | 0x7f) |
---|
| 42 | #endif |
---|
| 43 | |
---|
| 44 | pid_t wait(int *status) __THROW; |
---|
| 45 | pid_t waitpid(pid_t pid, int *status, int options) __THROW; |
---|
| 46 | |
---|
| 47 | pid_t wait3(int *status, int options, struct rusage *rusage) __THROW; |
---|
| 48 | |
---|
| 49 | pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage) __THROW; |
---|
| 50 | |
---|
| 51 | typedef enum { |
---|
| 52 | P_ALL, /* Wait for any child. */ |
---|
| 53 | P_PID, /* Wait for specified process. */ |
---|
| 54 | P_PGID /* Wait for members of process group. */ |
---|
| 55 | } idtype_t; |
---|
| 56 | |
---|
| 57 | //int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); |
---|
| 58 | |
---|
| 59 | __END_DECLS |
---|
| 60 | |
---|
| 61 | #endif |
---|