1 /* 2 * Copyright 2004-2011, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SYS_WAIT_H 6 #define _SYS_WAIT_H 7 8 9 #include <sys/types.h> 10 #include <signal.h> 11 12 13 /* waitpid()/waitid() options */ 14 #define WNOHANG 0x01 15 #define WUNTRACED 0x02 16 #define WCONTINUED 0x04 17 #define WEXITED 0x08 18 #define WSTOPPED 0x10 19 #define WNOWAIT 0x20 20 21 /* macros to interprete wait()/waitpid() status */ 22 #define WIFEXITED(value) (((value) & ~0xff) == 0) 23 #define WEXITSTATUS(value) ((value) & 0xff) 24 #define WIFSIGNALED(value) ((((value) >> 8) & 0xff) != 0) 25 #define WTERMSIG(value) (((value) >> 8) & 0xff) 26 #define WIFSTOPPED(value) ((((value) >> 16) & 0xff) != 0) 27 #define WSTOPSIG(value) (((value) >> 16) & 0xff) 28 #define WIFCORED(value) ((value) & 0x10000) 29 #define WIFCONTINUED(value) ((value) & 0x20000) 30 31 /* ID types for waitid() */ 32 typedef enum { 33 P_ALL, /* wait for any children, ignore ID */ 34 P_PID, /* wait for the child whose process ID matches */ 35 P_PGID /* wait for any child whose process group ID matches */ 36 } idtype_t; 37 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 extern pid_t wait(int *_status); 44 extern pid_t waitpid(pid_t pid, int *_status, int options); 45 extern int waitid(idtype_t idType, id_t id, siginfo_t *info, int options); 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif /* _SYS_WAIT_H */ 52