rework langinfo code for ABI compat and for use by time code
[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 #include <bits/alltypes.h>
14
15 typedef enum {
16         P_ALL = 0,
17         P_PID = 1,
18         P_PGID = 2
19 } idtype_t;
20
21 pid_t wait (int *);
22 int waitid (idtype_t, id_t, siginfo_t *, int);
23 pid_t waitpid (pid_t, int *, int );
24
25 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
26 #include <sys/resource.h>
27 pid_t wait3 (int *, int, struct rusage *);
28 pid_t wait4 (pid_t, int *, int, struct rusage *);
29 #endif
30
31 #define WNOHANG    1
32 #define WUNTRACED  2
33
34 #define WSTOPPED   2
35 #define WEXITED    4
36 #define WCONTINUED 8
37 #define WNOWAIT    0x1000000
38
39 #define __WNOTHREAD 0x20000000
40 #define __WALL      0x40000000
41 #define __WCLONE    0x80000000
42
43 #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
44 #define WTERMSIG(s) ((s) & 0x7f)
45 #define WSTOPSIG(s) WEXITSTATUS(s)
46 #define WCOREDUMP(s) ((s) & 0x80)
47 #define WIFEXITED(s) (!WTERMSIG(s))
48 #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
49 #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
50 #define WIFCONTINUED(s) ((s) == 0xffff)
51
52 #ifdef __cplusplus
53 }
54 #endif
55 #endif