8bcac8a3b2b072536bcc606ef3c54aa4f2bdb3b8
[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 <features.h>
8
9 #include <signal.h>
10
11 #define __NEED_pid_t
12 #define __NEED_id_t
13 #define __NEED_siginfo_t
14 #include <bits/alltypes.h>
15
16 typedef int idtype_t;
17
18 pid_t wait (int *);
19 int waitid (idtype_t, id_t, siginfo_t *, int);
20 pid_t waitpid (pid_t, int *, int );
21
22 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
23 #include <sys/resource.h>
24 pid_t wait3 (int *, int, struct rusage *);
25 pid_t wait4 (pid_t, int *, int, struct rusage *);
26 #endif
27
28 #define WNOHANG    1
29 #define WUNTRACED  2
30
31 #define WSTOPPED   2
32 #define WEXITED    4
33 #define WCONTINUED 8
34 #define WNOWAIT    0x1000000
35
36 #define P_ALL  0
37 #define P_PID  1
38 #define P_PGID 2
39
40 #ifndef WEXITSTATUS
41 #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
42 #define WTERMSIG(s) ((s) & 0x7f)
43 #define WSTOPSIG(s) WEXITSTATUS(s)
44 #define WCOREDUMP(s) ((s) & 0x80)
45 #define WIFEXITED(s) (!WTERMSIG(s))
46 #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
47 #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
48 #define WIFCONTINUED(s) ((s) == 0xffff)
49 #endif
50
51 #ifdef __cplusplus
52 }
53 #endif
54 #endif