• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <unistd.h>
2 #include "options.h"
3 #define T(t) (t*)0;
4 #define F(t,n) {t *y = &x.n;}
5 #define C(n) switch(n){case n:;}
6 #define A(n) {char p[n];}
f()7 static void f()
8 {
9 A(_POSIX_VERSION >= 200809L)
10 A(_POSIX2_VERSION >= 200809L)
11 #ifdef _XOPEN_SOURCE
12 A(_XOPEN_VERSION >= 700)
13 // A(_XOPEN_CRYPT >= 0)
14  A(_XOPEN_ENH_I18N > 0)
15 // A(_XOPEN_REALTIME >= 0)
16 // A(_XOPEN_REALTIME_THREADS >= 0)
17 // A(_XOPEN_SHM >= 0)
18  A(_XOPEN_UNIX >= 0)
19 #endif
20 A(_POSIX_ASYNCHRONOUS_IO >= 200809L)
21 A(_POSIX_BARRIERS >= 200809L)
22 A(_POSIX_CHOWN_RESTRICTED >= 0)
23 A(_POSIX_CLOCK_SELECTION >= 200809L)
24 A(_POSIX_JOB_CONTROL > 0)
25 A(_POSIX_MAPPED_FILES >= 200809L)
26 A(_POSIX_MEMORY_PROTECTION >= 200809L)
27 A(_POSIX_NO_TRUNC >= 0)
28 A(_POSIX_READER_WRITER_LOCKS >= 200809L)
29 A(_POSIX_REALTIME_SIGNALS >= 200809L)
30 A(_POSIX_REGEXP > 0)
31 A(_POSIX_SAVED_IDS > 0)
32 A(_POSIX_SEMAPHORES >= 200809L)
33 A(_POSIX_SHELL > 0)
34 A(_POSIX_SPIN_LOCKS >= 200809L)
35 A(_POSIX_THREAD_SAFE_FUNCTIONS >= 200809L)
36 A(_POSIX_THREADS >= 200809L)
37 A(_POSIX_TIMEOUTS >= 200809L)
38 A(_POSIX_TIMERS >= 200809L)
39 #if _POSIX_V7_ILP32_OFFBIG<=0 && _POSIX_V7_LP64_OFF64<=0 && _POSIX_V7_LPBIG_OFFBIG<=0
40 #error _POSIX_V7_ILP32_OFFBIG<=0 && _POSIX_V7_LP64_OFF64<=0 && _POSIX_V7_LPBIG_OFFBIG<=0
41 #endif
42 A(_POSIX2_C_BIND >= 200809L)
43 // not required by the standard
44  A(_POSIX_ADVISORY_INFO >= 0)
45  A(_POSIX_CPUTIME >= 0)
46  A(_POSIX_FSYNC >= 0)
47  A(_POSIX_IPV6 >= 0)
48  A(_POSIX_MEMLOCK >= 0)
49  A(_POSIX_MEMLOCK_RANGE >= 0)
50  A(_POSIX_MESSAGE_PASSING >= 0)
51  A(_POSIX_MONOTONIC_CLOCK >= 0)
52 // A(_POSIX_PRIORITIZED_IO >= 0)
53 // A(_POSIX_PRIORITY_SCHEDULING >= 0)
54  A(_POSIX_RAW_SOCKETS >= 0)
55 // A(_POSIX_SHARED_MEMORY_OBJECTS >= 0)
56  A(_POSIX_SPAWN >= 0)
57 // A(_POSIX_SPORADIC_SERVER >= 0)
58 // A(_POSIX_SYNCHRONIZED_IO >= 0)
59  A(_POSIX_THREAD_ATTR_STACKADDR >= 0)
60  A(_POSIX_THREAD_ATTR_STACKSIZE >= 0)
61  A(_POSIX_THREAD_CPUTIME >= 0)
62 // A(_POSIX_THREAD_PRIO_INHERIT >= 0)
63 // A(_POSIX_THREAD_PRIO_PROTECT >= 0)
64  A(_POSIX_THREAD_PRIORITY_SCHEDULING >= 0)
65  A(_POSIX_THREAD_PROCESS_SHARED >= 0)
66 // A(_POSIX_THREAD_ROBUST_PRIO_INHERIT >= 0)
67 // A(_POSIX_THREAD_ROBUST_PRIO_PROTECT >= 0)
68 // A(_POSIX_THREAD_SPORADIC_SERVER >= 0)
69 // A(_POSIX_TYPED_MEMORY_OBJECTS >= 0)
70 C(F_OK)
71 C(R_OK)
72 C(W_OK)
73 C(X_OK)
74 C(_CS_PATH)
75 C(_CS_POSIX_V7_ILP32_OFF32_CFLAGS)
76 C(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS)
77 C(_CS_POSIX_V7_ILP32_OFF32_LIBS)
78 C(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS)
79 C(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS)
80 C(_CS_POSIX_V7_ILP32_OFFBIG_LIBS)
81 C(_CS_POSIX_V7_LP64_OFF64_CFLAGS)
82 C(_CS_POSIX_V7_LP64_OFF64_LDFLAGS)
83 C(_CS_POSIX_V7_LP64_OFF64_LIBS)
84 C(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS)
85 C(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS)
86 C(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS)
87 C(_CS_POSIX_V7_THREADS_CFLAGS)
88 C(_CS_POSIX_V7_THREADS_LDFLAGS)
89 C(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS)
90 C(_CS_V7_ENV)
91 C(SEEK_CUR)
92 C(SEEK_END)
93 C(SEEK_SET)
94 C(F_LOCK)
95 C(F_TEST)
96 C(F_TLOCK)
97 C(F_ULOCK)
98 C(_PC_2_SYMLINKS)
99 C(_PC_ALLOC_SIZE_MIN)
100 C(_PC_ASYNC_IO)
101 C(_PC_CHOWN_RESTRICTED)
102 C(_PC_FILESIZEBITS)
103 C(_PC_LINK_MAX)
104 C(_PC_MAX_CANON)
105 C(_PC_MAX_INPUT)
106 C(_PC_NAME_MAX)
107 C(_PC_NO_TRUNC)
108 C(_PC_PATH_MAX)
109 C(_PC_PIPE_BUF)
110 C(_PC_PRIO_IO)
111 C(_PC_REC_INCR_XFER_SIZE)
112 C(_PC_REC_MAX_XFER_SIZE)
113 C(_PC_REC_MIN_XFER_SIZE)
114 C(_PC_REC_XFER_ALIGN)
115 C(_PC_SYMLINK_MAX)
116 C(_PC_SYNC_IO)
117 C(_PC_TIMESTAMP_RESOLUTION)
118 C(_PC_VDISABLE)
119 C(_SC_2_C_BIND)
120 C(_SC_2_C_DEV)
121 C(_SC_2_CHAR_TERM)
122 C(_SC_2_FORT_DEV)
123 C(_SC_2_FORT_RUN)
124 C(_SC_2_LOCALEDEF)
125 C(_SC_2_PBS)
126 C(_SC_2_PBS_ACCOUNTING)
127 C(_SC_2_PBS_CHECKPOINT)
128 C(_SC_2_PBS_LOCATE)
129 C(_SC_2_PBS_MESSAGE)
130 C(_SC_2_PBS_TRACK)
131 C(_SC_2_SW_DEV)
132 C(_SC_2_UPE)
133 C(_SC_2_VERSION)
134 C(_SC_ADVISORY_INFO)
135 C(_SC_AIO_LISTIO_MAX)
136 C(_SC_AIO_MAX)
137 C(_SC_AIO_PRIO_DELTA_MAX)
138 C(_SC_ARG_MAX)
139 C(_SC_ASYNCHRONOUS_IO)
140 C(_SC_ATEXIT_MAX)
141 C(_SC_BARRIERS)
142 C(_SC_BC_BASE_MAX)
143 C(_SC_BC_DIM_MAX)
144 C(_SC_BC_SCALE_MAX)
145 C(_SC_BC_STRING_MAX)
146 C(_SC_CHILD_MAX)
147 C(_SC_CLK_TCK)
148 C(_SC_CLOCK_SELECTION)
149 C(_SC_COLL_WEIGHTS_MAX)
150 C(_SC_CPUTIME)
151 C(_SC_DELAYTIMER_MAX)
152 C(_SC_EXPR_NEST_MAX)
153 C(_SC_FSYNC)
154 C(_SC_GETGR_R_SIZE_MAX)
155 C(_SC_GETPW_R_SIZE_MAX)
156 C(_SC_HOST_NAME_MAX)
157 C(_SC_IOV_MAX)
158 C(_SC_IPV6)
159 C(_SC_JOB_CONTROL)
160 C(_SC_LINE_MAX)
161 C(_SC_LOGIN_NAME_MAX)
162 C(_SC_MAPPED_FILES)
163 C(_SC_MEMLOCK)
164 C(_SC_MEMLOCK_RANGE)
165 C(_SC_MEMORY_PROTECTION)
166 C(_SC_MESSAGE_PASSING)
167 C(_SC_MONOTONIC_CLOCK)
168 C(_SC_MQ_OPEN_MAX)
169 C(_SC_MQ_PRIO_MAX)
170 C(_SC_NGROUPS_MAX)
171 C(_SC_OPEN_MAX)
172 C(_SC_PAGE_SIZE)
173 C(_SC_PAGESIZE)
174 C(_SC_PRIORITIZED_IO)
175 C(_SC_PRIORITY_SCHEDULING)
176 C(_SC_RAW_SOCKETS)
177 C(_SC_RE_DUP_MAX)
178 C(_SC_READER_WRITER_LOCKS)
179 C(_SC_REALTIME_SIGNALS)
180 C(_SC_REGEXP)
181 C(_SC_RTSIG_MAX)
182 C(_SC_SAVED_IDS)
183 C(_SC_SEM_NSEMS_MAX)
184 C(_SC_SEM_VALUE_MAX)
185 C(_SC_SEMAPHORES)
186 C(_SC_SHARED_MEMORY_OBJECTS)
187 C(_SC_SHELL)
188 C(_SC_SIGQUEUE_MAX)
189 C(_SC_SPAWN)
190 C(_SC_SPIN_LOCKS)
191 C(_SC_SPORADIC_SERVER)
192 C(_SC_SS_REPL_MAX)
193 C(_SC_STREAM_MAX)
194 C(_SC_SYMLOOP_MAX)
195 C(_SC_SYNCHRONIZED_IO)
196 C(_SC_THREAD_ATTR_STACKADDR)
197 C(_SC_THREAD_ATTR_STACKSIZE)
198 C(_SC_THREAD_CPUTIME)
199 C(_SC_THREAD_DESTRUCTOR_ITERATIONS)
200 C(_SC_THREAD_KEYS_MAX)
201 C(_SC_THREAD_PRIO_INHERIT)
202 C(_SC_THREAD_PRIO_PROTECT)
203 C(_SC_THREAD_PRIORITY_SCHEDULING)
204 C(_SC_THREAD_PROCESS_SHARED)
205 C(_SC_THREAD_ROBUST_PRIO_INHERIT)
206 C(_SC_THREAD_ROBUST_PRIO_PROTECT)
207 C(_SC_THREAD_SAFE_FUNCTIONS)
208 C(_SC_THREAD_SPORADIC_SERVER)
209 C(_SC_THREAD_STACK_MIN)
210 C(_SC_THREAD_THREADS_MAX)
211 C(_SC_THREADS)
212 C(_SC_TIMEOUTS)
213 C(_SC_TIMER_MAX)
214 C(_SC_TIMERS)
215 C(_SC_TRACE)
216 C(_SC_TRACE_EVENT_FILTER)
217 C(_SC_TRACE_EVENT_NAME_MAX)
218 C(_SC_TRACE_INHERIT)
219 C(_SC_TRACE_LOG)
220 C(_SC_TRACE_NAME_MAX)
221 C(_SC_TRACE_SYS_MAX)
222 C(_SC_TRACE_USER_EVENT_MAX)
223 C(_SC_TTY_NAME_MAX)
224 C(_SC_TYPED_MEMORY_OBJECTS)
225 C(_SC_TZNAME_MAX)
226 C(_SC_V7_ILP32_OFF32)
227 C(_SC_V7_ILP32_OFFBIG)
228 C(_SC_V7_LP64_OFF64)
229 C(_SC_V7_LPBIG_OFFBIG)
230 C(_SC_VERSION)
231 C(_SC_XOPEN_CRYPT)
232 C(_SC_XOPEN_ENH_I18N)
233 C(_SC_XOPEN_REALTIME)
234 C(_SC_XOPEN_REALTIME_THREADS)
235 C(_SC_XOPEN_SHM)
236 C(_SC_XOPEN_STREAMS)
237 C(_SC_XOPEN_UNIX)
238 C(_SC_XOPEN_UUCP)
239 C(_SC_XOPEN_VERSION)
240 C(STDERR_FILENO)
241 C(STDIN_FILENO)
242 C(STDOUT_FILENO)
243 C(_POSIX_VDISABLE)
244 T(size_t)
245 T(ssize_t)
246 T(uid_t)
247 T(gid_t)
248 T(off_t)
249 T(pid_t)
250 T(intptr_t)
251 {void(*p)(int) = _exit;}
252 {int(*p)(const char*,int) = access;}
253 {unsigned(*p)(unsigned) = alarm;}
254 {int(*p)(const char*) = chdir;}
255 {int(*p)(const char*,uid_t,gid_t) = chown;}
256 {int(*p)(int) = close;}
257 {size_t(*p)(int,char*,size_t) = confstr;}
258 {int(*p)(int) = dup;}
259 {int(*p)(int,int) = dup2;}
260 {extern char **environ; char **x = environ;};
261 {int(*p)(const char*,const char*,...) = execl;}
262 {int(*p)(const char*,const char*,...) = execle;}
263 {int(*p)(const char*,const char*,...) = execlp;}
264 {int(*p)(const char*,char*const[]) = execv;}
265 {int(*p)(const char*,char*const[],char*const[]) = execve;}
266 {int(*p)(const char*,char*const[]) = execvp;}
267 {int(*p)(int,const char*,int,int) = faccessat;}
268 {int(*p)(int) = fchdir;}
269 {int(*p)(int,uid_t,gid_t) = fchown;}
270 {int(*p)(int,const char*,uid_t,gid_t,int) = fchownat;}
271 #ifdef POSIX_SYNCHRONIZED_IO
272 {int(*p)(int) = fdatasync;}
273 #endif
274 {int(*p)(int,char*const[],char*const[]) = fexecve;}
275 {pid_t(*p)(void) = fork;}
276 {long(*p)(int,int) = fpathconf;}
277 {int(*p)(int) = fsync;}
278 {int(*p)(int,off_t) = ftruncate;}
279 {char*(*p)(char*,size_t) = getcwd;}
280 {gid_t(*p)(void) = getegid;}
281 {uid_t(*p)(void) = geteuid;}
282 {gid_t(*p)(void) = getgid;}
283 {int(*p)(int,gid_t[]) = getgroups;}
284 {int(*p)(char*,size_t) = gethostname;}
285 {char*(*p)(void) = getlogin;}
286 {int(*p)(char*,size_t) = getlogin_r;}
287 {int(*p)(int,char*const[],const char*) = getopt;}
288 {pid_t(*p)(pid_t) = getpgid;}
289 {pid_t(*p)(void) = getpgrp;}
290 {pid_t(*p)(void) = getpid;}
291 {pid_t(*p)(void) = getppid;}
292 {pid_t(*p)(pid_t) = getsid;}
293 {uid_t(*p)(void) = getuid;}
294 {int(*p)(int) = isatty;}
295 {int(*p)(const char*,uid_t,gid_t) = lchown;}
296 {int(*p)(const char*,const char*) = link;}
297 {int(*p)(int,const char*,int,const char*,int) = linkat;}
298 {off_t(*p)(int,off_t,int) = lseek;}
299 {char *x = optarg;}
300 {int i = opterr;}
301 {int i = optind;}
302 {int i = optopt;}
303 {long(*p)(const char*,int) = pathconf;}
304 {int(*p)(void) = pause;}
305 {int(*p)(int[]) = pipe;}
306 {ssize_t(*p)(int,void*,size_t,off_t) = pread;}
307 {ssize_t(*p)(int,const void*,size_t,off_t) = pwrite;}
308 {ssize_t(*p)(int,void*,size_t) = read;}
309 {ssize_t(*p)(const char*restrict,char*restrict,size_t) = readlink;}
310 {ssize_t(*p)(int,const char*restrict,char*restrict,size_t) = readlinkat;}
311 {int(*p)(const char*) = rmdir;}
312 {int(*p)(gid_t) = setegid;}
313 {int(*p)(uid_t) = seteuid;}
314 {int(*p)(gid_t) = setgid;}
315 {int(*p)(pid_t,pid_t) = setpgid;}
316 {pid_t(*p)(void) = setsid;}
317 {int(*p)(uid_t) = setuid;}
318 {unsigned(*p)(unsigned) = sleep;}
319 {int(*p)(const char*,const char*) = symlink;}
320 {int(*p)(const char*,int,const char*) = symlinkat;}
321 {long(*p)(int) = sysconf;}
322 {pid_t(*p)(int) = tcgetpgrp;}
323 {int(*p)(int,pid_t) = tcsetpgrp;}
324 {int(*p)(const char*,off_t) = truncate;}
325 {char*(*p)(int) = ttyname;}
326 {int(*p)(int,char*,size_t) = ttyname_r;}
327 {int(*p)(const char*) = unlink;}
328 {int(*p)(int,const char*,int) = unlinkat;}
329 {ssize_t(*p)(int,const void*,size_t) = write;}
330 #ifdef _XOPEN_SOURCE
331 {char*(*p)(const char*,const char*) = crypt;}
332 {void(*p)(char[],int) = encrypt;}
333 {long(*p)(void) = gethostid;}
334 {int(*p)(int,int,off_t) = lockf;}
335 {int(*p)(int) = nice;}
336 {int(*p)(gid_t,gid_t) = setregid;}
337 {int(*p)(uid_t,uid_t) = setreuid;}
338 {void(*p)(const void*restrict,void*restrict,ssize_t) = swab;}
339 {void(*p)(void) = sync;}
340 #endif
341 }
342