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