summaryrefslogtreecommitdiff
path: root/sys/wait.h
blob: 1dd27795e25957ea6a3b419cbbb2254d8188c199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#ifndef __SYS_WAIT_H__
#define __SYS_WAIT_H__

/*
UNG's Not GNU

MIT License

Copyright (c) 2011-2020 Jakob Kaivo <jkk@ung.org>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#if defined _XOPEN_SOURCE && !defined _POSIX_C_SOURCE
#	if (_XOPEN_SOURCE >= 700)
#		define _POSIX_C_SOURCE 200809L
#	elif (_XOPEN_SOURCE >= 600)
#		define _POSIX_C_SOURCE 200112L
#	elif (_XOPEN_SOURCE >= 500)
#		define _POSIX_C_SOURCE 199506L
#	else
#		define _POSIX_C_SOURCE 2
#	endif
#endif

#if defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE
#	define _POSIX_SOURCE
#endif

#if	(defined _POSIX_SOURCE)
/* ./src/sys/wait/WEXITSTATUS.c */
#define WEXITSTATUS(__stat_val)                              (__stat_val & 0xff)
/* ./src/sys/wait/WIFEXITED.c */
#define WIFEXITED(__stat_val)                                (__stat_val <= 255)
/* ./src/sys/wait/WIFSIGNALED.c */
#define WIFSIGNALED(__stat_val)                             (__stat_val & 0x100)
/* ./src/sys/wait/WIFSTOPPED.c */
#define WIFSTOPPED(__stat_val)                              (__stat_val & 0x200)
/* ./src/sys/wait/WNOHANG.c */
#define WNOHANG                                                           (1<<0)
/* ./src/sys/wait/WSTOPSIG.c */
#define WSTOPSIG(__stat_val)                                 (__stat_val & 0xff)
/* ./src/sys/wait/WTERMSIG.c */
#define WTERMSIG(__stat_val)                                 (__stat_val & 0xff)
/* ./src/sys/wait/WUNTRACED.c */
#define WUNTRACED                                                         (1<<1)
#endif

#if	(defined _POSIX_C_SOURCE && 200809 <= _POSIX_C_SOURCE) || \
	(defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE))
/* ./src/sys/wait/WEXITED.c */
#define WEXITED                                                           (1<<3)
/* ./src/sys/wait/WNOWAIT.c */
#define WNOWAIT                                                           (1<<4)
/* ./src/sys/wait/WSTOPPED.c */
#define WSTOPPED                                                          (1<<5)
#endif

#if	(defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE))
/* ./src/sys/wait/WCONTINUED.c */
#define WCONTINUED                                                        (1<<2)
/* ./src/sys/wait/WIFCONTINUED.c */
#define WIFCONTINUED(__stat_val)                            (__stat_val & 0x400)
#endif

#if	(defined _POSIX_C_SOURCE && 200809 <= _POSIX_C_SOURCE) || \
	(defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE))
/* ./src/sys/wait/idtype_t.c */
#ifndef __TYPE_idtype_t_DEFINED__
#define __TYPE_idtype_t_DEFINED__
typedef enum {
	P_ALL,
	P_PGID,
	P_PID
} idtype_t;
#endif

#endif

#if	(defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE))
/* src/signal/siginfo_t.c */
#ifndef __TYPE_siginfo_t_DEFINED__
#define __TYPE_siginfo_t_DEFINED__
typedef struct {
	int si_signo;
	int si_code;
	pid_t si_pid;
	uid_t si_uid;
	void *si_addr;
	int si_status;
	long si_band;
	int si_errno;
	union sigval si_value;
} siginfo_t;
#endif

/* src/sys/types/id_t.c */
#ifndef __TYPE_id_t_DEFINED__
#define __TYPE_id_t_DEFINED__
typedef unsigned long long int                                             id_t;
#endif

/* src/sys/types/pid_t.c */
#ifndef __TYPE_pid_t_DEFINED__
#define __TYPE_pid_t_DEFINED__
typedef long int                                                          pid_t;
#endif

#endif

#if	(defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE))
/* src/sys/resource/struct_rusage.c */
#ifndef __TYPE_struct_rusage_DEFINED__
#define __TYPE_struct_rusage_DEFINED__
struct rusage {
	struct timeval ru_utime;
	struct timeval ru_stime;
};
#endif

#endif

#if	(defined _POSIX_SOURCE)
/* ./src/sys/wait/wait.c */
pid_t wait(int *__stat_loc);
/* ./src/sys/wait/waitpid.c */
pid_t waitpid(pid_t __pid, int *__stat_loc, int __options);
#endif

#if	(defined _POSIX_C_SOURCE && 200809 <= _POSIX_C_SOURCE) || \
	(defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE))
/* ./src/sys/wait/waitid.c */
int waitid(idtype_t __idtype, id_t __id, siginfo_t *__infop, int __options);
#endif

#if	(defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE) && _XOPEN_SOURCE < 600)
/* ./src/sys/wait/wait3.c */
pid_t wait3(int *__state_loc, int __options, struct rusage *__resource_usage);
#endif


#endif