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