|
9 | 9 | #ifndef LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
|
10 | 10 | #define LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
|
11 | 11 |
|
12 |
| -// Wait flags |
13 |
| -#define WNOHANG 1 // Do not block |
14 |
| -#define WUNTRACED 2 // Report is a child has stopped even if untraced |
15 |
| -#define WEXITED 4 // Report dead child |
16 |
| -#define WCONTINUED 8 // Report if a stopped child has been resumed by SIGCONT |
17 |
| -#define WSTOPPED WUNTRACED |
18 |
| - |
19 |
| -// Wait status info macros |
20 |
| -#define __WEXITSTATUS(status) (((status)&0xff00) >> 8) |
21 |
| -#define __WTERMSIG(status) ((status)&0x7f) |
22 |
| -#define __WIFEXITED(status) (__WTERMSIG(status) == 0) |
23 |
| - |
24 |
| -// Macros for constructing status values. |
25 |
| -#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) |
26 |
| -#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) |
27 |
| -#define __W_CONTINUED 0xffff |
28 |
| -#define __WCOREFLAG 0x80 |
29 |
| - |
30 |
| -#define WEXITSTATUS(status) __WEXITSTATUS(status) |
31 |
| -#define WTERMSIG(status) __WTERMSIG(status) |
32 |
| -#define WIFEXITED(status) __WIFEXITED(status) |
33 |
| - |
34 |
| -#define WCOREFLAG __WCOREFLAG |
35 |
| -#define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig) |
36 |
| -#define W_STOPCODE(sig) __W_STOPCODE(sig) |
37 |
| - |
38 |
| -// First argument to waitid: |
39 |
| -#define P_ALL 0 |
40 |
| -#define P_PID 1 |
41 |
| -#define P_PGID 2 |
42 |
| -#define P_PIDFD 3 |
| 12 | +#include <linux/wait.h> |
| 13 | + |
| 14 | +#define WCOREDUMP(status) ((status) & WCOREFLAG) |
| 15 | +#define WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
| 16 | +#define WIFCONTINUED(status) ((status) == 0xffff) |
| 17 | +#define WIFEXITED(status) (WTERMSIG(status) == 0) |
| 18 | +#define WIFSIGNALED(status) ((WTERMSIG(status) + 1) >= 2) |
| 19 | +#define WIFSTOPPED(status) (WTERMSIG(status) == 0x7f) |
| 20 | +#define WSTOPSIG(status) WEXITSTATUS(status) |
| 21 | +#define WTERMSIG(status) ((status) & 0x7f) |
| 22 | + |
| 23 | +#define WCOREFLAG 0x80 |
| 24 | +#define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) |
| 25 | +#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) |
43 | 26 |
|
44 | 27 | #endif // LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
|
0 commit comments