1 //===-- Definition of macros from sys/wait.h ------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
10 #define LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
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
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)
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
30 #define WEXITSTATUS(status) __WEXITSTATUS(status)
31 #define WTERMSIG(status) __WTERMSIG(status)
32 #define WIFEXITED(status) __WIFEXITED(status)
34 #define WCOREFLAG __WCOREFLAG
35 #define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig)
36 #define W_STOPCODE(sig) __W_STOPCODE(sig)
38 // First argument to waitid:
44 #endif // LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H