Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #ifndef _SYS_WAIT_H |
| 2 | #define _SYS_WAIT_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
Rich Felker | f492c95 | 2011-04-21 14:21:57 -0400 | [diff] [blame] | 7 | #include <signal.h> |
| 8 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 9 | #define __NEED_pid_t |
| 10 | #define __NEED_id_t |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 11 | #define __NEED_siginfo_t |
| 12 | #include <bits/alltypes.h> |
| 13 | |
| 14 | typedef int idtype_t; |
| 15 | |
| 16 | pid_t wait (int *); |
| 17 | int waitid (idtype_t, id_t, siginfo_t *, int); |
| 18 | pid_t waitpid (pid_t, int *, int ); |
Rich Felker | 52874c8 | 2011-02-19 02:26:11 -0500 | [diff] [blame] | 19 | |
| 20 | #ifdef _GNU_SOURCE |
| 21 | #include <sys/resource.h> |
| 22 | pid_t wait3 (int *, int, struct rusage *); |
| 23 | pid_t wait4 (pid_t, int *, int, struct rusage *); |
| 24 | #endif |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 25 | |
Rich Felker | 4b5f054 | 2011-04-21 14:27:28 -0400 | [diff] [blame] | 26 | #define WNOHANG 1 |
| 27 | #define WUNTRACED 2 |
| 28 | |
| 29 | #define WSTOPPED 2 |
| 30 | #define WEXITED 4 |
| 31 | #define WCONTINUED 8 |
| 32 | #define WNOWAIT 0x1000000 |
| 33 | |
| 34 | #define P_ALL 0 |
| 35 | #define P_PID 1 |
| 36 | #define P_PGID 2 |
| 37 | |
| 38 | #ifndef WEXITSTATUS |
| 39 | #define WEXITSTATUS(s) (((s) & 0xff00) >> 8) |
| 40 | #define WTERMSIG(s) ((s) & 0x7f) |
| 41 | #define WSTOPSIG(s) WEXITSTATUS(s) |
| 42 | #define WCOREDUMP(s) ((s) & 0x80) |
| 43 | #define WIFEXITED(s) (!WTERMSIG(s)) |
| 44 | #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f) |
| 45 | #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0) |
| 46 | #define WIFCONTINUED(s) ((s) == 0xffff) |
| 47 | #endif |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 48 | |
| 49 | #ifdef __cplusplus |
| 50 | } |
| 51 | #endif |
| 52 | #endif |