support _BSD_SOURCE feature test macro
[musl] / include / sys / wait.h
1 #ifndef _SYS_WAIT_H
2 #define _SYS_WAIT_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7 #include <signal.h>
8
9 #define __NEED_pid_t
10 #define __NEED_id_t
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 );
19
20 #if defined(_GNU_SOURCE) || defined(_BSD_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
25
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
48
49 #ifdef __cplusplus
50 }
51 #endif
52 #endif