1 /* 2 * Copyright 2004-2010 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 /* TODO: waitid() is part of the real-time signal extension. Uncomment when 32 * implemented! */ 33 #if 0 34 /* ID types for waitid() */ 35 typedef enum { 36 P_ALL, /* wait for any children, ignore ID */ 37 P_PID, /* wait for the child whose process ID matches */ 38 P_PGID /* wait for any child whose process group ID matches */ 39 } idtype_t; 40 #endif /* 0 */ 41 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 extern pid_t wait(int *_status); 48 extern pid_t waitpid(pid_t pid, int *_status, int options); 49 /* extern int waitid(idtype_t idType, id_t id, siginfo_t *info, int options); */ 50 51 #ifdef __cplusplus 52 } 53 #endif 54 55 #endif /* _SYS_WAIT_H */ 56