1#if !defined ISO && !defined ISO99 && !defined ISO11
2#ifdef POSIX
3# define uid_t __uid_t
4# define gid_t __gid_t
5# define off_t __off_t
6# define pid_t __pid_t
7#endif
8
9constant _POSIX_VERSION
10#if defined POSIX || defined XPG4 || defined XPG42 || defined UNIX98
11constant _POSIX2_C_VERSION
12#endif
13#ifndef POSIX
14optional-constant _XOPEN_VERSION
15optional-constant _XOPEN_XCU_VERSION
16#endif
17
18#ifndef POSIX
19optional-constant _POSIX2_C_BIND
20#endif
21optional-constant _POSIX2_CHAR_TERM
22optional-constant _POSIX2_LOCALEDEF
23optional-constant _POSIX2_UPE
24#ifndef POSIX
25optional-constant _POSIX2_VERSION
26#endif
27
28#ifndef POSIX
29optional-constant _XOPEN_XPG2
30optional-constant _XOPEN_XPG3
31optional-constant _XOPEN_XPG4
32optional-constant _XOPEN_UNIX
33#endif
34
35#ifndef POSIX
36optional-constant _POSIX_ADVISORY_INFO
37#endif
38optional-constant _POSIX_ASYNCHRONOUS_IO
39#ifndef POSIX
40optional-constant _POSIX_BARRIERS
41#endif
42optional-constant _POSIX_CHOWN_RESTRICTED
43#ifndef POSIX
44optional-constant _POSIX_CLOCK_SELECTION
45optional-constant _POSIX_CPUTIME
46#endif
47optional-constant _POSIX_NO_TRUNC
48optional-constant _POSIX_VDISABLE
49optional-constant _POSIX_SAVED_IDS
50optional-constant _POSIX_JOB_CONTROL
51#ifndef POSIX
52optional-constant _POSIX_MONOTONIC_CLOCK
53optional-constant _POSIX_READER_WRITER_LOCKS
54optional-constant _POSIX_SHELL
55optional-constant _POSIX_SPAWN
56optional-constant _POSIX_SPIN_LOCKS
57optional-constant _POSIX_SPORADIC_SERVER
58optional-constant _POSIX_THREAD_CPUTIME
59optional-constant _POSIX_TYPED_MEMORY_OBJECTS
60#endif
61
62optional-constant _POSIX_THREADS
63optional-constant _POSIX_THREAD_ATTR_STACKADDR
64optional-constant _POSIX_THREAD_ATTR_STACKSIZE
65optional-constant _POSIX_THREAD_PROCESS_SHARED
66optional-constant _POSIX_THREAD_SAFE_FUNCTIONS
67#ifndef POSIX
68optional-constant _POSIX_THREAD_SPORADIC_SERVER
69#endif
70
71# ifdef XOPEN2K
72optional-constant _POSIX_V6_ILP32_OFF32
73optional-constant _POSIX_V6_ILP32_OFFBIG
74optional-constant _POSIX_V6_LP64_OFF64
75optional-constant _POSIX_V6_LPBIG_OFFBIG
76# endif
77# if defined XOPEN2K8 || defined POSIX2008
78optional-constant _POSIX_V7_ILP32_OFF32
79optional-constant _POSIX_V7_ILP32_OFFBIG
80optional-constant _POSIX_V7_LP64_OFF64
81optional-constant _POSIX_V7_LPBIG_OFFBIG
82# endif
83
84optional-constant _POSIX2_C_DEV
85optional-constant _POSIX2_FORT_DEV
86optional-constant _POSIX2_FORT_RUN
87optional-constant _POSIX2_SW_DEV
88# if !defined POSIX && !defined POSIX2008
89optional-constant _XOPEN_CRYPT
90optional-constant _XOPEN_ENH_I18N
91optional-constant _XOPEN_LEGACY
92optional-constant _XOPEN_REALTIME
93optional-constant _XOPEN_REALTIME_THREADS
94optional-constant _XOPEN_SHM
95optional-constant _XOPEN_STREAMS
96# endif
97# ifndef POSIX
98allow _XBS5_ILP32_OFF32
99allow _XBS5_ILP32_OFBIG
100allow _XBS5_LP64_OFF64
101allow _XBS5_LPBIG_OFFBIG
102#endif
103optional-constant _POSIX_MEMLOCK
104optional-constant _POSIX_MEMLOCK_RANGE
105optional-constant _POSIX_MESSAGE_PASSING
106optional-constant _POSIX_PRIORITY_SCHEDULING
107optional-constant _POSIX_REALTIME_SIGNALS
108optional-constant _POSIX_SEMAPHORES
109optional-constant _POSIX_SHARED_MEMORY_OBJECTS
110optional-constant _POSIX_SYNCHRONIZED_IO
111optional-constant _POSIX_TIMERS
112#ifndef POSIX
113optional-constant _POSIX_TIMEOUTS
114#endif
115
116optional-constant _POSIX_FSYNC
117optional-constant _POSIX_MAPPED_FILES
118optional-constant _POSIX_MEMORY_PROTECTION
119
120optional-constant _POSIX_PRIORITIZED_IO
121
122optional-constant _POSIX_THREAD_PRIORITY_SCHEDULING
123optional-constant _POSIX_THREAD_PRIO_INHERIT
124optional-constant _POSIX_THREAD_PRIO_PROTECT
125
126optional-constant _POSIX_ASYNC_IO
127optional-constant _POSIX_PRIO_IO
128optional-constant _POSIX_SYNC_IO
129
130#ifndef POSIX
131optional-constant _POSIX2_PBS
132optional-constant _POSIX2_PBS_ACCOUNTING
133optional-constant _POSIX2_PBS_CHECKPOINT
134optional-constant _POSIX2_PBS_LOCATE
135optional-constant _POSIX2_PBS_MESSAGE
136optional-constant _POSIX2_PBS_TRACK
137#endif
138
139#ifndef POSIX
140optional-constant _POSIX_TIMESTAMP_RESOLUTION
141#endif
142
143constant NULL
144
145constant R_OK
146constant W_OK
147constant X_OK
148constant F_OK
149
150constant _CS_PATH
151#ifndef POSIX
152constant _CS_XBS5_ILP32_OFF32_CFLAGS
153constant _CS_XBS5_ILP32_OFF32_LDFLAGS
154constant _CS_XBS5_ILP32_OFF32_LIBS
155constant _CS_XBS5_ILP32_OFF32_LINTFLAGS
156constant _CS_XBS5_ILP32_OFFBIG_CFLAGS
157constant _CS_XBS5_ILP32_OFFBIG_LDFLAGS
158constant _CS_XBS5_ILP32_OFFBIG_LIBS
159constant _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
160constant _CS_XBS5_LP64_OFF64_CFLAGS
161constant _CS_XBS5_LP64_OFF64_LDFLAGS
162constant _CS_XBS5_LP64_OFF64_LIBS
163constant _CS_XBS5_LP64_OFF64_LINTFLAGS
164constant _CS_XBS5_LPBIG_OFFBIG_CFLAGS
165constant _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
166constant _CS_XBS5_LPBIG_OFFBIG_LIBS
167constant _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
168#endif
169
170constant SEEK_SET
171constant SEEK_CUR
172constant SEEK_END
173
174#ifndef POSIX
175constant _SC_2_C_BIND
176#endif
177constant _SC_2_C_DEV
178#ifndef POSIX
179constant _SC_2_C_VERSION
180#endif
181constant _SC_2_CHAR_TERM
182constant _SC_2_FORT_DEV
183constant _SC_2_FORT_RUN
184constant _SC_2_LOCALEDEF
185#ifndef POSIX
186constant _SC_2_PBS
187constant _SC_2_PBS_ACCOUNTING
188constant _SC_2_PBS_CHECKPOINT
189constant _SC_2_PBS_LOCATE
190constant _SC_2_PBS_MESSAGE
191constant _SC_2_PBS_TRACK
192#endif
193constant _SC_2_SW_DEV
194constant _SC_2_UPE
195constant _SC_2_VERSION
196constant _SC_ARG_MAX
197constant _SC_AIO_LISTIO_MAX
198constant _SC_AIO_MAX
199constant _SC_AIO_PRIO_DELTA_MAX
200constant _SC_ASYNCHRONOUS_IO
201#ifndef POSIX
202constant _SC_ATEXIT_MAX
203constant _SC_BARRIERS
204constant _SC_BASE
205#endif
206constant _SC_BC_BASE_MAX
207constant _SC_BC_DIM_MAX
208constant _SC_BC_SCALE_MAX
209constant _SC_BC_STRING_MAX
210constant _SC_CHILD_MAX
211constant _SC_CLK_TCK
212#ifndef POSIX
213constant _SC_CLOCK_SELECTION
214#endif
215constant _SC_COLL_WEIGHTS_MAX
216constant _SC_DELAYTIMER_MAX
217#ifndef POSIX
218constant _SC_DEVICE_IO
219constant _SC_DEVICE_SPECIFIC
220constant _SC_DEVICE_SPECIFIC_R
221#endif
222constant _SC_EXPR_NEST_MAX
223#ifndef POSIX
224constant _SC_FD_MGMT
225constant _SC_FIFO
226constant _SC_FILE_ATTRIBUTES
227constant _SC_FILE_LOCKING
228constant _SC_FILE_SYSTEM
229#endif
230constant _SC_FSYNC
231constant _SC_GETGR_R_SIZE_MAX
232constant _SC_GETPW_R_SIZE_MAX
233#ifndef POSIX
234constant _SC_IOV_MAX
235#endif
236constant _SC_JOB_CONTROL
237constant _SC_LINE_MAX
238constant _SC_LOGIN_NAME_MAX
239constant _SC_MAPPED_FILES
240constant _SC_MEMLOCK
241constant _SC_MEMLOCK_RANGE
242constant _SC_MEMORY_PROTECTION
243constant _SC_MESSAGE_PASSING
244#ifndef POSIX
245constant _SC_MONOTONIC_CLOCK
246#endif
247constant _SC_MQ_OPEN_MAX
248constant _SC_MQ_PRIO_MAX
249#ifndef POSIX
250constant _SC_NETWORKING
251#endif
252constant _SC_NGROUPS_MAX
253constant _SC_OPEN_MAX
254constant _SC_PAGESIZE
255#ifndef POSIX
256constant _SC_PAGE_SIZE
257constant _SC_PASS_MAX
258constant _SC_PIPE
259#endif
260constant _SC_PRIORITIZED_IO
261constant _SC_PRIORITY_SCHEDULING
262constant _SC_RE_DUP_MAX
263#ifndef POSIX
264constant _SC_READER_WRITER_LOCKS
265#endif
266constant _SC_REALTIME_SIGNALS
267#ifndef POSIX
268constant _SC_REGEXP
269#endif
270constant _SC_RTSIG_MAX
271constant _SC_SAVED_IDS
272constant _SC_SEMAPHORES
273constant _SC_SEM_NSEMS_MAX
274constant _SC_SEM_VALUE_MAX
275constant _SC_SHARED_MEMORY_OBJECTS
276#ifndef POSIX
277constant _SC_SHELL
278constant _SC_SIGNALS
279#endif
280constant _SC_SIGQUEUE_MAX
281#ifndef POSIX
282constant _SC_SINGLE_PROCESS
283constant _SC_SPIN_LOCKS
284#endif
285constant _SC_STREAM_MAX
286constant _SC_SYNCHRONIZED_IO
287constant _SC_THREADS
288constant _SC_THREAD_ATTR_STACKADDR
289constant _SC_THREAD_ATTR_STACKSIZE
290constant _SC_THREAD_DESTRUCTOR_ITERATIONS
291constant _SC_THREAD_KEYS_MAX
292constant _SC_THREAD_PRIORITY_SCHEDULING
293constant _SC_THREAD_PRIO_INHERIT
294constant _SC_THREAD_PRIO_PROTECT
295constant _SC_THREAD_PROCESS_SHARED
296constant _SC_THREAD_SAFE_FUNCTIONS
297constant _SC_THREAD_STACK_MIN
298constant _SC_THREAD_THREADS_MAX
299constant _SC_TIMERS
300constant _SC_TIMER_MAX
301constant _SC_TTY_NAME_MAX
302#ifndef POSIX
303constant _SC_TYPED_MEMORY_OBJECTS
304#endif
305constant _SC_TZNAME_MAX
306#ifndef POSIX
307constant _SC_USER_GROUPS
308constant _SC_USER_GROUPS_R
309#endif
310# ifdef XOPEN2K
311constant _SC_V6_ILP32_OFF32
312constant _SC_V6_ILP32_OFFBIG
313constant _SC_V6_LP64_OFF64
314constant _SC_V6_LPBIG_OFFBIG
315# endif
316# if defined XOPEN2K8 || defined POSIX2008
317constant _SC_V7_ILP32_OFF32
318constant _SC_V7_ILP32_OFFBIG
319constant _SC_V7_LP64_OFF64
320constant _SC_V7_LPBIG_OFFBIG
321# endif
322constant _SC_VERSION
323# if !defined POSIX && !defined POSIX2008
324constant _SC_XOPEN_VERSION
325constant _SC_XOPEN_CRYPT
326constant _SC_XOPEN_ENH_I18N
327constant _SC_XOPEN_SHM
328constant _SC_XOPEN_UNIX
329constant _SC_XOPEN_XCU_VERSION
330constant _SC_XOPEN_LEGACY
331constant _SC_XOPEN_REALTIME
332constant _SC_XOPEN_REALTIME_THREADS
333# endif
334# ifndef POSIX
335constant _SC_STREAMS
336constant _SC_XBS5_ILP32_OFF32
337constant _SC_XBS5_ILP32_OFFBIG
338constant _SC_XBS5_LP64_OFF64
339constant _SC_XBS5_LPBIG_OFFBIG
340# endif
341# ifdef XOPEN2K
342constant _CS_POSIX_V6_ILP32_OFF32_CFLAGS
343constant _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
344constant _CS_POSIX_V6_ILP32_OFF32_LIBS
345constant _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
346constant _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
347constant _CS_POSIX_V6_ILP32_OFFBIG_LIBS
348constant _CS_POSIX_V6_LP64_OFF64_CFLAGS
349constant _CS_POSIX_V6_LP64_OFF64_LDFLAGS
350constant _CS_POSIX_V6_LP64_OFF64_LIBS
351constant _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
352constant _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
353constant _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
354constant _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
355constant _CS_V6_ENV
356# endif
357# if defined XOPEN2K8 || defined POSIX2008
358constant _CS_POSIX_V7_ILP32_OFF32_CFLAGS
359constant _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
360constant _CS_POSIX_V7_ILP32_OFF32_LIBS
361constant _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
362constant _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
363constant _CS_POSIX_V7_ILP32_OFFBIG_LIBS
364constant _CS_POSIX_V7_LP64_OFF64_CFLAGS
365constant _CS_POSIX_V7_LP64_OFF64_LDFLAGS
366constant _CS_POSIX_V7_LP64_OFF64_LIBS
367constant _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
368constant _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
369constant _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
370constant _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
371constant _CS_V7_ENV
372# endif
373# ifndef POSIX
374constant _SC_THREAD_ROBUST_PRIO_INHERIT
375constant _SC_THREAD_ROBUST_PRIO_PROTECT
376#endif
377
378#if !defined XPG4 && !defined POSIX && !defined POSIX2008
379constant F_LOCK
380constant F_ULOCK
381constant F_TEST
382constant F_TLOCK
383#endif
384
385constant _PC_ASYNC_IO
386constant _PC_CHOWN_RESTRICTED
387#ifndef POSIX
388constant _PC_FILESIZEBITS
389#endif
390constant _PC_LINK_MAX
391constant _PC_MAX_CANON
392constant _PC_MAX_INPUT
393constant _PC_NAME_MAX
394constant _PC_NO_TRUNC
395constant _PC_PATH_MAX
396constant _PC_PIPE_BUF
397constant _PC_PRIO_IO
398#ifndef POSIX
399constant _PC_REC_INCR_XFER_SIZE
400constant _PC_REC_MAX_XFER_SIZE
401constant _PC_REC_MIN_XFER_SIZE
402constant _PC_REC_XFER_ALIGN
403#endif
404constant _PC_SYNC_IO
405constant _PC_VDISABLE
406
407constant STDIN_FILENO
408constant STDOUT_FILENO
409constant STDERR_FILENO
410
411type size_t
412type ssize_t
413#ifndef POSIX
414type uid_t
415type gid_t
416type off_t
417type pid_t
418#endif
419
420#if !defined POSIX && !defined XPG4
421type useconds_t
422
423# ifndef XPG42
424type intptr_t
425# endif
426#endif
427
428function int access (const char*, int)
429function {unsigned int} alarm (unsigned int)
430#if !defined XOPEN2K && !defined XOPEN2K8 && !defined XPG4 && !defined POSIX && !defined POSIX2008
431function int brk (void*)
432#endif
433function int chdir (const char*)
434#if defined XPG4 || defined XPG42 || defined UNIX98
435function int chroot (const char*)
436#endif
437function int chown (const char*, uid_t, gid_t)
438function int close (int)
439function size_t confstr (int, char*, size_t)
440#if defined XPG4 || defined XPG42 || defined UNIX98
441function {char*} ctermid (char*)
442function {char*} cuserid (char*)
443#endif
444#ifdef POSIX
445allow cuserid
446#endif
447function int dup (int)
448function int dup2 (int, int)
449function int execl (const char*, const char*, ...)
450function int execle (const char*, const char*, ...)
451function int execlp (const char*, const char*, ...)
452function int execv (const char*, char *const[])
453function int execve (const char*, char *const[], char *const[])
454function int execvp (const char*, char *const[])
455function void _exit (int)
456# if defined XOPEN2K8 || defined POSIX2008
457function int faccessat (int, const char*, int, int)
458# endif
459#if !defined XPG4 && !defined POSIX
460function int fchown (int, uid_t, gid_t)
461#endif
462# if defined XOPEN2K8 || defined POSIX2008
463function int fchownat (int, const char*, uid_t, gid_t, int)
464# endif
465#if !defined XPG4 && !defined POSIX
466function int fchdir (int)
467#endif
468#if !defined XPG4 && !defined XPG42
469function int fdatasync (int)
470#endif
471# if defined XOPEN2K8 || defined POSIX2008
472function int fexecve (int, char *const[], char *const[])
473# endif
474function pid_t fork (void)
475function {long int} fpathconf (int, int)
476function int fsync (int)
477#ifndef XPG4
478function int ftruncate (int, off_t)
479#endif
480function {char*} getcwd (char*, size_t)
481#if !defined XOPEN2K && !defined XOPEN2K8 && !defined XPG4 && !defined POSIX && !defined POSIX2008
482function int getdtablesize (void)
483#endif
484function gid_t getegid (void)
485function uid_t geteuid (void)
486function gid_t getgid (void)
487function int getgroups (int, gid_t[])
488#if !defined XPG4 && !defined POSIX && !defined POSIX2008
489function long gethostid (void)
490#endif
491#if !defined POSIX && !defined XPG4
492function int gethostname (char*, size_t)
493#endif
494function {char*} getlogin (void)
495#if !defined XPG4 && !defined XPG42
496function int getlogin_r (char*, size_t)
497#endif
498function int getopt (int, char*const[], const char*)
499#if defined XPG42 || defined UNIX98
500function int getpagesize (void)
501#endif
502#if defined XPG4 || defined XPG42 || defined UNIX98
503function {char*} getpass (const char*)
504#endif
505#if !defined XPG4 && !defined POSIX
506function pid_t getpgid (pid_t)
507#endif
508function pid_t getpgrp (void)
509function pid_t getpid (void)
510function pid_t getppid (void)
511#if !defined XPG4 && !defined POSIX
512function pid_t getsid (pid_t)
513#endif
514function uid_t getuid (void)
515#if defined XPG42 || defined UNIX98 || defined XOPEN2K
516function {char*} getwd (char*)
517#endif
518function int isatty (int)
519#if !defined XPG4 && !defined POSIX
520function int lchown (const char*, uid_t, gid_t)
521#endif
522function int link (const char*, const char*)
523# if defined XOPEN2K8 || defined POSIX2008
524function int linkat (int, const char*, int, const char*, int)
525# endif
526# if !defined XPG4 && !defined POSIX && !defined POSIX2008
527function int lockf (int, int, off_t)
528# endif
529function off_t lseek (int, off_t, int)
530# if !defined POSIX && !defined POSIX2008
531function int nice (int)
532# endif
533function {long int} pathconf (const char*, int)
534function int pause (void)
535function int pipe (int[2])
536#if !defined POSIX && !defined XPG4 && !defined XPG42
537function ssize_t pread (int, void*, size_t, off_t)
538#endif
539#if !defined POSIX && !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008 && !defined XPG4 && !defined XPG42
540function int pthread_atfork (void(*)(void), void(*)(void), void(*)(void))
541#endif
542#if !defined POSIX && !defined XPG4 && !defined XPG42
543function ssize_t pwrite (int, const void*, size_t, off_t)
544#endif
545function ssize_t read (int, void*, size_t)
546#if !defined XPG4 && !defined POSIX
547function ssize_t readlink (const char*, char*, size_t)
548#endif
549# if defined XOPEN2K8 || defined POSIX2008
550function ssize_t readlinkat (int, const char*, char*, size_t)
551# endif
552function int rmdir (const char*)
553#if !defined XOPEN2K && !defined XOPEN2K8 && !defined XPG4 && !defined POSIX && !defined POSIX2008
554function {void*} sbrk (intptr_t)
555#endif
556#if !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98
557function int setegid (gid_t)
558function int seteuid (uid_t)
559#endif
560function int setgid (gid_t)
561function int setpgid (pid_t, pid_t)
562# if !defined XPG4 && !defined POSIX && !defined POSIX2008
563function pid_t setpgrp (void)
564function int setregid (gid_t, gid_t)
565function int setreuid (uid_t, uid_t)
566# endif
567function pid_t setsid (void)
568function int setuid (uid_t)
569function {unsigned int} sleep (unsigned int)
570# if !defined POSIX && !defined POSIX2008
571function void swab (const void*, void*, ssize_t)
572# endif
573#if !defined XPG4 && !defined POSIX
574function int symlink (const char*, const char*)
575# endif
576# if defined XOPEN2K8 || defined POSIX2008
577function int symlinkat (const char*, int, const char*)
578# endif
579# if !defined XPG4 && !defined POSIX && !defined POSIX2008
580function void sync (void)
581# endif
582function {long int} sysconf (int)
583function pid_t tcgetpgrp (int)
584function int tcsetpgrp (int, pid_t)
585#if !defined XPG4 && !defined POSIX
586function int truncate (const char*, off_t)
587#endif
588function {char*} ttyname (int)
589function int ttyname_r (int, char*, size_t)
590#if defined XPG42 || defined UNIX98 || defined XOPEN2K
591function useconds_t ualarm (useconds_t, useconds_t)
592#endif
593function int unlink (const char*)
594# if defined XOPEN2K8 || defined POSIX2008
595function int unlinkat (int, const char*, int)
596# endif
597#if defined XPG42 || defined UNIX98 || defined XOPEN2K
598function int usleep (useconds_t)
599function pid_t vfork (void)
600#endif
601function ssize_t write (int, const void*, size_t)
602
603variable {char*} optarg
604variable int optind
605variable int opterr
606variable int optopt
607
608allow *_t
609#endif
610