1e3638e83SSiva Chandra Reddy //===-- Definition of macros from sys/wait.h ------------------------------===// 2e3638e83SSiva Chandra Reddy // 3e3638e83SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4e3638e83SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information. 5e3638e83SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e3638e83SSiva Chandra Reddy // 7e3638e83SSiva Chandra Reddy //===----------------------------------------------------------------------===// 8e3638e83SSiva Chandra Reddy 9*330793c9SNick Desaulniers #ifndef LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H 10*330793c9SNick Desaulniers #define LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H 11e3638e83SSiva Chandra Reddy 12995105deSSiva Chandra Reddy // Wait flags 13995105deSSiva Chandra Reddy #define WNOHANG 1 // Do not block 14995105deSSiva Chandra Reddy #define WUNTRACED 2 // Report is a child has stopped even if untraced 15c9783d2bSMikhail R. Gadelha #define WEXITED 4 // Report dead child 16995105deSSiva Chandra Reddy #define WCONTINUED 8 // Report if a stopped child has been resumed by SIGCONT 17c9783d2bSMikhail R. Gadelha #define WSTOPPED WUNTRACED 18995105deSSiva Chandra Reddy 19e3638e83SSiva Chandra Reddy // Wait status info macros 20c9783d2bSMikhail R. Gadelha #define __WEXITSTATUS(status) (((status)&0xff00) >> 8) 21c9783d2bSMikhail R. Gadelha #define __WTERMSIG(status) ((status)&0x7f) 22c9783d2bSMikhail R. Gadelha #define __WIFEXITED(status) (__WTERMSIG(status) == 0) 23c9783d2bSMikhail R. Gadelha 24c9783d2bSMikhail R. Gadelha // Macros for constructing status values. 25c9783d2bSMikhail R. Gadelha #define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) 26c9783d2bSMikhail R. Gadelha #define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) 27c9783d2bSMikhail R. Gadelha #define __W_CONTINUED 0xffff 28c9783d2bSMikhail R. Gadelha #define __WCOREFLAG 0x80 29c9783d2bSMikhail R. Gadelha 30c9783d2bSMikhail R. Gadelha #define WEXITSTATUS(status) __WEXITSTATUS(status) 31c9783d2bSMikhail R. Gadelha #define WTERMSIG(status) __WTERMSIG(status) 32c9783d2bSMikhail R. Gadelha #define WIFEXITED(status) __WIFEXITED(status) 33c9783d2bSMikhail R. Gadelha 34c9783d2bSMikhail R. Gadelha #define WCOREFLAG __WCOREFLAG 35c9783d2bSMikhail R. Gadelha #define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig) 36c9783d2bSMikhail R. Gadelha #define W_STOPCODE(sig) __W_STOPCODE(sig) 37c9783d2bSMikhail R. Gadelha 38c9783d2bSMikhail R. Gadelha // First argument to waitid: 39c9783d2bSMikhail R. Gadelha #define P_ALL 0 40c9783d2bSMikhail R. Gadelha #define P_PID 1 41c9783d2bSMikhail R. Gadelha #define P_PGID 2 42c9783d2bSMikhail R. Gadelha #define P_PIDFD 3 43e3638e83SSiva Chandra Reddy 44*330793c9SNick Desaulniers #endif // LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H 45