1 //===-- Definition of macros from sys/wait.h ------------------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H 10 #define LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H 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 43 44 #endif // LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H 45