Fix test failures introduced by PR #113697 (#116941)
[llvm-project.git] / libc / spec / posix.td
blobe354deef340f1b7340f8ffd724bc66acdf3d4723
1 def SigSetType : NamedType<"sigset_t">;
2 def SigSetPtrType : PtrType<SigSetType>;
3 def ConstSigSetPtrType : ConstType<SigSetPtrType>;
4 def RestrictedSigSetType : RestrictedPtrType<SigSetType>;
5 def ConstRestrictedSigSetType : ConstType<RestrictedSigSetType>;
7 def SigInfoType : NamedType<"siginfo_t">;
8 def UnionSigVal : NamedType<"union sigval">;
10 def StructSigaction : NamedType<"struct sigaction">;
11 def StructSigactionPtr : PtrType<StructSigaction>;
12 def ConstStructSigactionPtr : ConstType<StructSigactionPtr>;
13 def RestrictedStructSigactionPtr : RestrictedPtrType<StructSigaction>;
14 def ConstRestrictedStructSigactionPtr : ConstType<RestrictedStructSigactionPtr>;
16 def PThreadStartT : NamedType<"__pthread_start_t">;
17 def PThreadTSSDtorT : NamedType<"__pthread_tss_dtor_t">;
18 def PThreadKeyT : NamedType<"pthread_key_t">;
19 def PThreadKeyTPtr : PtrType<PThreadKeyT>;
20 def PThreadOnceT : NamedType<"pthread_once_t">;
21 def PThreadOnceTPtr : PtrType<PThreadOnceT>;
22 def PThreadOnceCallback : NamedType<"__pthread_once_func_t">;
24 def InoT : NamedType<"ino_t">;
25 def UidT : NamedType<"uid_t">;
26 def GidT : NamedType<"gid_t">;
27 def DevT : NamedType<"dev_t">;
28 def ClockIdT : NamedType<"clockid_t">;
29 def RestrictedClockIdTPtr : RestrictedPtrType<ClockIdT>;
30 def BlkSizeT : NamedType<"blksize_t">;
31 def BlkCntT : NamedType<"blkcnt_t">;
32 def NLinkT : NamedType<"nlink_t">;
34 def StatType : NamedType<"struct stat">;
35 def StatTypePtr : PtrType<StatType>;
36 def RestrictedStatTypePtr : RestrictedPtrType<StatType>;
38 def DIR : NamedType<"DIR">;
39 def DIRPtr : PtrType<DIR>;
40 def DIRRestrictedPtr : RestrictedPtrType<DIR>;
41 def StructDirent : NamedType<"struct dirent">;
42 def StructDirentPtr : PtrType<StructDirent>;
43 def StructDirentPtrPtr : PtrType<StructDirentPtr>;
44 def ConstStructDirentPtrPtr : ConstType<StructDirentPtrPtr>;
46 def StructSchedParam : NamedType<"struct sched_param">;
47 def StructSchedParamPtr : PtrType<StructSchedParam>;
48 def ConstStructSchedParamPtr : ConstType<StructSchedParamPtr>;
50 def ExecArgvT : NamedType<"__exec_argv_t">;
51 def ExecEnvpT : NamedType<"__exec_envp_t">;
53 def AtForkCallbackT : NamedType<"__atfork_callback_t">;
55 def PosixSpawnFileActionsT : NamedType<"posix_spawn_file_actions_t">;
56 def PosixSpawnFileActionsTPtr : PtrType<PosixSpawnFileActionsT>;
57 def ConstPosixSpawnFileActionsTPtr : ConstType<PosixSpawnFileActionsTPtr>;
58 def PosixSpawnFileActionsTRestrictedPtr : RestrictedPtrType<PosixSpawnFileActionsT>;
60 def PosixSpawnAttrT : NamedType<"posix_spawnattr_t">;
61 def RestrictedPosixSpawnAttrTPtrType : RestrictedPtrType<PosixSpawnAttrT>;
63 def CcT : NamedType<"cc_t">;
64 def SpeedT : NamedType<"speed_t">;
65 def StructTermios : NamedType<"struct termios">;
66 def StructTermiosPtr : PtrType<StructTermios>;
67 def ConstStructTermiosPtr : ConstType<StructTermiosPtr>;
68 def TcFlagT : NamedType<"tcflag_t">;
70 def StackT : NamedType<"stack_t">;
71 def StackTPtr : PtrType<StackT>;
72 def RestrictedStackTPtr : RestrictedPtrType<StackT>;
73 def ConstRestrictedStackTPtr : ConstType<RestrictedStackTPtr>;
75 def FdSet : NamedType<"fd_set">;
76 def FdSetPtr : PtrType<FdSet>;
77 def RestrictedFdSetPtr : RestrictedPtrType<FdSet>;
79 def GetoptArgvT : NamedType<"__getoptargv_t">;
81 def SAFamilyType : NamedType<"sa_family_t">;
82 def SocklenType : NamedType<"socklen_t">;
83 def SocklenPtr : PtrType<SocklenType>;
85 def StructSockAddr : NamedType<"struct sockaddr">;
86 def StructSockAddrPtr : PtrType<StructSockAddr>;
87 def ConstStructSockAddrPtr : ConstType<StructSockAddrPtr>;
89 def StructMsghdr : NamedType<"struct msghdr">;
90 def StructMsghdrPtr : PtrType<StructMsghdr>;
91 def ConstStructMsghdrPtr : ConstType<StructMsghdrPtr>;
93 def StructIovec : NamedType<"struct iovec">;
94 def StructIovecPtr : PtrType<StructIovec>;
95 def ConstStructIovecPtr : ConstType<StructIovecPtr>;
97 def StructSockAddrUn : NamedType<"struct sockaddr_un">;
99 def StructStatvfs : NamedType<"struct statvfs">;
100 def StructStatvfsPtr : PtrType<StructStatvfs>;
101 def RestrictedStructStatvfsPtr : RestrictedPtrType<StructStatvfs>;
103 // The function pointer type for the predicate for lsearch, lfind
104 def LSearchCompareT : NamedType<"__lsearchcompare_t">;
106 def POSIX : StandardSpec<"POSIX"> {
107   PtrType CharPtr = PtrType<CharType>;
108   RestrictedPtrType RestrictedCharPtr = RestrictedPtrType<CharType>;
109   RestrictedPtrType CharRestrictedDoublePtr = RestrictedPtrType<CharPtr>;
110   ConstType ConstCharPtr = ConstType<CharPtr>;
111   ConstType ConstRestrictedCharPtr = ConstType<RestrictedCharPtr>;
113   NamedType ModeTType = NamedType<"mode_t">;
115   NamedType PThreadAttrTType = NamedType<"pthread_attr_t">;
116   PtrType PThreadAttrTPtr = PtrType<PThreadAttrTType>;
117   RestrictedPtrType RestrictedPThreadAttrTPtr = RestrictedPtrType<PThreadAttrTType>;
118   ConstType ConstPThreadAttrTPtr = ConstType<PThreadAttrTPtr>;
119   ConstType ConstRestrictedPThreadAttrTPtr = ConstType<RestrictedPThreadAttrTPtr>;
121   NamedType PThreadCondAttrTType = NamedType<"pthread_condattr_t">;
122   PtrType PThreadCondAttrTPtr = PtrType<PThreadCondAttrTType>;
123   ConstType ConstRestrictedPThreadCondAttrTPtr = ConstType<RestrictedPtrType<PThreadCondAttrTType>>;
125   NamedType PThreadRWLockAttrTType = NamedType<"pthread_rwlockattr_t">;
126   PtrType PThreadRWLockAttrTPtr = PtrType<PThreadRWLockAttrTType>;
127   ConstType ConstPThreadRWLockAttrTPtr = ConstType<PThreadRWLockAttrTPtr>;
128   RestrictedPtrType RestrictedPThreadRWLockAttrTPtr = RestrictedPtrType<PThreadRWLockAttrTType>;
129   ConstType ConstRestrictedPThreadRWLockAttrTPtr = ConstType<RestrictedPThreadRWLockAttrTPtr>;
131   NamedType PThreadMutexAttrTType = NamedType<"pthread_mutexattr_t">;
132   PtrType PThreadMutexAttrTPtr = PtrType<PThreadMutexAttrTType>;
133   RestrictedPtrType RestrictedPThreadMutexAttrTPtr = RestrictedPtrType<PThreadMutexAttrTType>;
134   ConstType ConstPThreadMutexAttrTPtr = ConstType<PThreadMutexAttrTPtr>;
135   ConstType ConstRestrictedPThreadMutexAttrTPtr = ConstType<RestrictedPThreadMutexAttrTPtr>;
137   NamedType PThreadMutexTType = NamedType<"pthread_mutex_t">;
138   PtrType PThreadMutexTPtr = PtrType<PThreadMutexTType>;
139   RestrictedPtrType RestrictedPThreadMutexTPtr = RestrictedPtrType<PThreadMutexTType>;
140   ConstType ConstPThreadMutexTPtr = ConstType<PThreadMutexTPtr>;
141   ConstType ConstRestrictedPThreadMutexTPtr = ConstType<RestrictedPThreadMutexTPtr>;
143   NamedType PThreadRWLockTType = NamedType<"pthread_rwlock_t">;
144   PtrType PThreadRWLockTPtr = PtrType<PThreadRWLockTType>;
145   RestrictedPtrType RestrictedPThreadRWLockTPtr = RestrictedPtrType<PThreadRWLockTType>;
147   NamedType PThreadSpinLockTType = NamedType<"pthread_spinlock_t">;
148   PtrType PThreadSpinLockTPtr = PtrType<PThreadSpinLockTType>;
150   PtrType PThreadTPtr = PtrType<PThreadTType>;
151   RestrictedPtrType RestrictedPThreadTPtr = RestrictedPtrType<PThreadTType>;
153   HeaderSpec Errno = HeaderSpec<
154       "errno.h",
155       [
156         Macro<"E2BIG">,
157         Macro<"EACCES">,
158         Macro<"EADDRINUSE">,
159         Macro<"EADDRNOTAVAIL">,
160         Macro<"EAFNOSUPPORT">,
161         Macro<"EAGAIN">,
162         Macro<"EALREADY">,
163         Macro<"EBADF">,
164         Macro<"EBADMSG">,
165         Macro<"EBUSY">,
166         Macro<"ECANCELED">,
167         Macro<"ECHILD">,
168         Macro<"ECONNABORTED">,
169         Macro<"ECONNREFUSED">,
170         Macro<"ECONNRESET">,
171         Macro<"EDEADLK">,
172         Macro<"EDESTADDRREQ">,
173         Macro<"EDQUOT">,
174         Macro<"EEXIST">,
175         Macro<"EFAULT">,
176         Macro<"EFBIG">,
177         Macro<"EHOSTUNREACH">,
178         Macro<"EIDRM">,
179         Macro<"EINPROGRESS">,
180         Macro<"EINTR">,
181         Macro<"EINVAL">,
182         Macro<"EIO">,
183         Macro<"EISCONN">,
184         Macro<"EISDIR">,
185         Macro<"ELOOP">,
186         Macro<"EMFILE">,
187         Macro<"EMLINK">,
188         Macro<"EMSGSIZE">,
189         Macro<"EMULTIHOP">,
190         Macro<"ENAMETOOLONG">,
191         Macro<"ENETDOWN">,
192         Macro<"ENETRESET">,
193         Macro<"ENETUNREACH">,
194         Macro<"ENFILE">,
195         Macro<"ENOBUFS">,
196         Macro<"ENODATA">,
197         Macro<"ENODEV">,
198         Macro<"ENOENT">,
199         Macro<"ENOEXEC">,
200         Macro<"ENOLCK">,
201         Macro<"ENOLINK">,
202         Macro<"ENOMEM">,
203         Macro<"ENOMSG">,
204         Macro<"ENOPROTOOPT">,
205         Macro<"ENOSPC">,
206         Macro<"ENOSR">,
207         Macro<"ENOSTR">,
208         Macro<"ENOSYS">,
209         Macro<"ENOTCONN">,
210         Macro<"ENOTDIR">,
211         Macro<"ENOTEMPTY">,
212         Macro<"ENOTRECOVERABLE">,
213         Macro<"ENOTSOCK">,
214         Macro<"ENOTSUP">,
215         Macro<"ENOTTY">,
216         Macro<"ENXIO">,
217         Macro<"EOPNOTSUPP">,
218         Macro<"EOVERFLOW">,
219         Macro<"EOWNERDEAD">,
220         Macro<"EPERM">,
221         Macro<"EPIPE">,
222         Macro<"EPROTO">,
223         Macro<"EPROTONOSUPPORT">,
224         Macro<"EPROTOTYPE">,
225         Macro<"EROFS">,
226         Macro<"ESPIPE">,
227         Macro<"ESRCH">,
228         Macro<"ESTALE">,
229         Macro<"ETIME">,
230         Macro<"ETIMEDOUT">,
231         Macro<"ETXTBSY">,
232         Macro<"EWOULDBLOCK">,
233         Macro<"EXDEV">,
234       ],
235       [], // Types
236       [], // Enumerations
237       []  // Functions
238   >;
240   HeaderSpec DlFcn = HeaderSpec<
241     "dlfcn.h",
242     [
243       Macro<"RTLD_LAZY">,
244       Macro<"RTLD_NOW">,
245       Macro<"RTLD_GLOBAL">,
246       Macro<"RTLD_LOCAL">,
247     ],
248     [],  // Types
249     [], // Enumerations
250     [
251       FunctionSpec<
252           "dlclose",
253           RetValSpec<IntType>,
254           [ArgSpec<VoidPtr>]
255       >,
256       FunctionSpec<
257           "dlerror",
258           RetValSpec<CharPtr>,
259           []
260       >,
261       FunctionSpec<
262           "dlopen",
263           RetValSpec<VoidPtr>,
264           [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
265       >,
266       FunctionSpec<
267           "dlsym",
268           RetValSpec<VoidPtr>,
269           [ArgSpec<VoidRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
270       >,
271     ]
272   >;
274   HeaderSpec FCntl = HeaderSpec<
275     "fcntl.h",
276     [], // Macros
277     [
278         ModeTType,
279         OffTType,
280     ],
281     [], // Enumerations
282     [
283       FunctionSpec<
284           "creat",
285           RetValSpec<IntType>,
286           [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
287       >,
288       FunctionSpec<
289           "fcntl",
290           RetValSpec<IntType>,
291           [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<VarArgType>]
292       >,
293       FunctionSpec<
294           "open",
295           RetValSpec<IntType>,
296           [ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<VarArgType>]
297       >,
298       FunctionSpec<
299           "openat",
300           RetValSpec<IntType>,
301           [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<VarArgType>]
302       >,
303     ]
304   >;
306   HeaderSpec SysMMan = HeaderSpec<
307       "sys/mman.h",
308       [
309         // TODO: Add a facility to bunch macros into bitwise-or-able groups.
310         // POSIX requires it, so such thing should be captured in this spec.
311         Macro<"PROT_EXEC">,
312         Macro<"PROT_NONE">,
313         Macro<"PROT_READ">,
314         Macro<"PROT_WRITE">,
316         Macro<"MAP_FIXED">,
317         Macro<"MAP_PRIVATE">,
318         Macro<"MAP_SHARED">,
320         Macro<"MAP_FAILED">,
321       ],
322       [
323         SizeTType,
324         OffTType,
325         ModeTType,
326       ],
327       [], // Enumerations
328       [
329         FunctionSpec<
330             "madvise",
331             RetValSpec<IntType>,
332             [ArgSpec<VoidPtr>,
333              ArgSpec<SizeTType>,
334              ArgSpec<IntType>]
335         >,
336         FunctionSpec<
337             "mmap",
338             RetValSpec<VoidPtr>,
339             [ArgSpec<VoidPtr>,
340              ArgSpec<SizeTType>,
341              ArgSpec<IntType>,
342              ArgSpec<IntType>,
343              ArgSpec<IntType>,
344              ArgSpec<OffTType>]
345         >,
346         FunctionSpec<
347             "mprotect",
348             RetValSpec<IntType>,
349             [ArgSpec<VoidPtr>,
350              ArgSpec<SizeTType>,
351              ArgSpec<IntType>]
352         >,
353         FunctionSpec<
354             "munmap",
355             RetValSpec<IntType>,
356             [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
357         >,
358         FunctionSpec<
359             "posix_madvise",
360             RetValSpec<IntType>,
361             [ArgSpec<VoidPtr>,
362              ArgSpec<SizeTType>,
363              ArgSpec<IntType>]
364         >,
365         FunctionSpec<
366           "mlock",
367           RetValSpec<IntType>,
368           [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
369         >,
370         FunctionSpec<
371           "munlock",
372           RetValSpec<IntType>,
373           [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
374         >,
375         FunctionSpec<
376           "mlockall",
377           RetValSpec<IntType>,
378           [ArgSpec<IntType>]
379         >,
380         FunctionSpec<
381           "munlockall",
382           RetValSpec<IntType>,
383           [ArgSpec<VoidType>]
384         >,
385         FunctionSpec<
386           "msync",
387           RetValSpec<IntType>,
388           [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<IntType>]
389         >,
390         FunctionSpec<
391           "shm_open",
392           RetValSpec<IntType>,
393           [ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ModeTType>]
394         >,
395         FunctionSpec<
396           "shm_unlink",
397           RetValSpec<IntType>,
398           [ArgSpec<ConstCharPtr>]
399         >,
400       ]
401   >;
403   HeaderSpec Signal = HeaderSpec<
404       "signal.h",
405       [], // Macros
406       [
407         SigInfoType,
408         SigSetType,
409         StackT,
410         StructSigaction,
411         UnionSigVal,
412         PidT,
413       ],
414       [], // Enumerations
415       [
416         FunctionSpec<
417           "kill",
418           RetValSpec<IntType>,
419           [ArgSpec<PidT>,
420             ArgSpec<IntType>]
421         >,
422         FunctionSpec<
423           "sigaction",
424           RetValSpec<IntType>,
425           [ArgSpec<IntType>,
426            ArgSpec<ConstRestrictedStructSigactionPtr>,
427            ArgSpec<RestrictedStructSigactionPtr>]
428         >,
429         FunctionSpec<
430           "sigaltstack",
431           RetValSpec<IntType>,
432           [ArgSpec<ConstRestrictedStackTPtr>, ArgSpec<RestrictedStackTPtr>]
433         >,
434         FunctionSpec<
435           "sigdelset",
436           RetValSpec<IntType>,
437           [ArgSpec<SigSetPtrType>,
438            ArgSpec<IntType>]
439         >,
440         FunctionSpec<
441           "sigprocmask",
442           RetValSpec<IntType>,
443           [ArgSpec<IntType>, ArgSpec<ConstRestrictedSigSetType>, ArgSpec<RestrictedSigSetType>]
444         >,
445         FunctionSpec<
446           "sigemptyset",
447           RetValSpec<IntType>,
448           [ArgSpec<SigSetPtrType>]
449         >,
450         FunctionSpec<
451           "sigaddset",
452           RetValSpec<IntType>,
453           [ArgSpec<SigSetPtrType>,
454            ArgSpec<IntType>]
455         >,
456         FunctionSpec<
457           "sigfillset",
458           RetValSpec<IntType>,
459           [ArgSpec<SigSetPtrType>]
460         >,
461       ]
462   >;
464   HeaderSpec UniStd = HeaderSpec<
465     "unistd.h",
466     [], // Macros
467     [
468       ExecArgvT,
469       ExecEnvpT,
470       OffTType,
471       SSizeTType,
472       SizeTType,
473       PidT,
474       UidT,
475       GetoptArgvT,
476     ],
477     [], // Enumerations
478     [
479         FunctionSpec<
480           "_exit",
481           RetValSpec<NoReturn>,
482           [ArgSpec<IntType>]
483         >,
484         FunctionSpec<
485           "access",
486           RetValSpec<IntType>,
487           [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
488         >,
489         FunctionSpec<
490           "chdir",
491           RetValSpec<IntType>,
492           [ArgSpec<ConstCharPtr>]
493         >,
494         FunctionSpec<
495           "dup",
496           RetValSpec<IntType>,
497           [ArgSpec<IntType>]
498         >,
499         FunctionSpec<
500           "dup2",
501           RetValSpec<IntType>,
502           [ArgSpec<IntType>, ArgSpec<IntType>]
503         >,
504         FunctionSpec<
505           "dup3",
506           RetValSpec<IntType>,
507           [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
508         >,
509         FunctionSpec<
510           "fchdir",
511           RetValSpec<IntType>,
512           [ArgSpec<IntType>]
513         >,
514         FunctionSpec<
515           "getcwd",
516           RetValSpec<CharPtr>,
517           [ArgSpec<CharPtr>, ArgSpec<SizeTType>]
518         >,
519         FunctionSpec<
520           "close",
521           RetValSpec<IntType>,
522           [ArgSpec<IntType>]
523         >,
524         FunctionSpec<
525           "execv",
526           RetValSpec<IntType>,
527           [ArgSpec<ConstCharPtr>, ArgSpec<ExecArgvT>]
528         >,
529         FunctionSpec<
530           "execve",
531           RetValSpec<IntType>,
532           [ArgSpec<ConstCharPtr>, ArgSpec<ExecArgvT>, ArgSpec<ExecEnvpT>]
533         >,
534         FunctionSpec<
535           "fork",
536           RetValSpec<PidT>,
537           [ArgSpec<VoidType>]
538         >,
539         FunctionSpec<
540           "fsync",
541           RetValSpec<IntType>,
542           [ArgSpec<IntType>]
543         >,
544         FunctionSpec<
545           "ftruncate",
546           RetValSpec<IntType>,
547           [ArgSpec<IntType>, ArgSpec<OffTType>]
548         >,
549         FunctionSpec<
550           "geteuid",
551           RetValSpec<UidT>,
552           [ArgSpec<VoidType>]
553         >,
554         FunctionSpec<
555           "getpid",
556           RetValSpec<PidT>,
557           [ArgSpec<VoidType>]
558         >,
559         FunctionSpec<
560           "getppid",
561           RetValSpec<PidT>,
562           [ArgSpec<VoidType>]
563         >,
564         FunctionSpec<
565           "gettid",
566           RetValSpec<PidT>,
567           [ArgSpec<VoidType>]
568         >,
569         FunctionSpec<
570           "getuid",
571           RetValSpec<UidT>,
572           [ArgSpec<VoidType>]
573         >,
574         FunctionSpec<
575           "isatty",
576           RetValSpec<IntType>,
577           [ArgSpec<IntType>]
578         >,
579         FunctionSpec<
580           "link",
581           RetValSpec<IntType>,
582           [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
583         >,
584         FunctionSpec<
585           "linkat",
586           RetValSpec<IntType>,
587           [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
588         >,
589         FunctionSpec<
590           "lseek",
591           RetValSpec<OffTType>,
592           [ArgSpec<IntType>, ArgSpec<OffTType>, ArgSpec<IntType>]
593         >,
594         FunctionSpec<
595           "pread",
596           RetValSpec<SSizeTType>,
597           [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
598         >,
599         FunctionSpec<
600           "pwrite",
601           RetValSpec<SSizeTType>,
602           [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
603         >,
604         FunctionSpec<
605           "read",
606           RetValSpec<SSizeTType>,
607           [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
608         >,
609         FunctionSpec<
610           "readlink",
611           RetValSpec<SSizeTType>,
612           [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
613         >,
614         FunctionSpec<
615           "readlinkat",
616           RetValSpec<SSizeTType>,
617           [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
618         >,
619         FunctionSpec<
620           "rmdir",
621           RetValSpec<IntType>,
622           [ArgSpec<ConstCharPtr>]
623         >,
624         FunctionSpec<
625           "getpid",
626           RetValSpec<IntType>,
627           [ArgSpec<VoidType>]
628         >,
629         FunctionSpec<
630           "getppid",
631           RetValSpec<IntType>,
632           [ArgSpec<VoidType>]
633         >,
634         FunctionSpec<
635           "link",
636           RetValSpec<IntType>,
637           [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
638         >,
639         FunctionSpec<
640           "linkat",
641           RetValSpec<IntType>,
642           [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
643         >,
644         FunctionSpec<
645           "lseek",
646           RetValSpec<OffTType>,
647           [ArgSpec<IntType>, ArgSpec<OffTType>, ArgSpec<IntType>]
648         >,
649         FunctionSpec<
650           "pipe",
651           RetValSpec<IntType>,
652           [ArgSpec<IntPtr>] //TODO: make this int[2]
653         >,
654         FunctionSpec<
655           "pread",
656           RetValSpec<SSizeTType>,
657           [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
658         >,
659         FunctionSpec<
660           "pwrite",
661           RetValSpec<SSizeTType>,
662           [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
663         >,
664         FunctionSpec<
665           "read",
666           RetValSpec<SSizeTType>,
667           [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
668         >,
669         FunctionSpec<
670           "readlink",
671           RetValSpec<SSizeTType>,
672           [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
673         >,
674         FunctionSpec<
675           "readlinkat",
676           RetValSpec<SSizeTType>,
677           [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
678         >,
679         FunctionSpec<
680           "rmdir",
681           RetValSpec<IntType>,
682           [ArgSpec<ConstCharPtr>]
683         >,
684         FunctionSpec<
685           "swab",
686           RetValSpec<VoidType>,
687           [ArgSpec<ConstVoidRestrictedPtr>, ArgSpec<VoidPtr>, ArgSpec<SSizeTType>]
688         >,
689         FunctionSpec<
690           "symlink",
691           RetValSpec<IntType>,
692           [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
693         >,
694         FunctionSpec<
695           "symlinkat",
696           RetValSpec<IntType>,
697           [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>]
698         >,
699         FunctionSpec<
700           "sysconf",
701           RetValSpec<IntType>,
702           [ArgSpec<IntType>]
703         >,
704         FunctionSpec<
705           "__llvm_libc_syscall",
706           RetValSpec<LongType>,
707           [ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>]
708         >,
709         FunctionSpec<
710           "truncate",
711           RetValSpec<IntType>,
712           [ArgSpec<ConstCharPtr>, ArgSpec<OffTType>]
713         >,
714         FunctionSpec<
715           "unlink",
716           RetValSpec<IntType>,
717           [ArgSpec<ConstCharPtr>]
718         >,
719         FunctionSpec<
720           "unlinkat",
721           RetValSpec<IntType>,
722           [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
723         >,
724         FunctionSpec<
725           "write",
726           RetValSpec<SSizeTType>,
727           [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
728         >,
729         FunctionSpec<
730           "getopt",
731           RetValSpec<IntType>,
732           [ArgSpec<IntType>, ArgSpec<GetoptArgvT>, ArgSpec<ConstCharPtr>]
733         >,
734     ],
735     [
736         ObjectSpec<"environ", "char **">,
737         ObjectSpec<
738           "optarg",
739           "char *"
740         >,
741         ObjectSpec<
742           "optind",
743           "int"
744         >,
745         ObjectSpec<
746           "opterr",
747           "int"
748         >,
749         ObjectSpec<
750           "optopt",
751           "int"
752         >,
753     ]
754   >;
756   HeaderSpec StdLib = HeaderSpec<
757     "stdlib.h",
758     [], // Macros
759     [], // Types
760     [], // Enumerations
761     [
762         FunctionSpec<
763           "getenv",
764           RetValSpec<CharPtr>,
765           [ArgSpec<ConstCharPtr>]
766         >,
767     ]
768   >;
770   HeaderSpec Sched = HeaderSpec<
771       "sched.h",
772       [], // Macros
773       [PidT, TimeTType, StructTimeSpec, StructSchedParam], // Types
774       [], // Enumerations
775       [
776         FunctionSpec<
777             "sched_yield",
778             RetValSpec<IntType>,
779             [ArgSpec<VoidType>]
780         >,
781         FunctionSpec<
782             "sched_setparam",
783             RetValSpec<IntType>,
784             [ArgSpec<PidT>, ArgSpec<ConstStructSchedParamPtr>]
785         >,
787         FunctionSpec<
788             "sched_getparam",
789             RetValSpec<IntType>,
790             [ArgSpec<PidT>, ArgSpec<StructSchedParamPtr>]
791         >,
793         FunctionSpec<
794             "sched_setscheduler",
795             RetValSpec<IntType>,
796             [ArgSpec<PidT>]
797         >,
799         FunctionSpec<
800             "sched_getscheduler",
801             RetValSpec<IntType>,
802             [ArgSpec<PidT>, ArgSpec<IntType>, ArgSpec<ConstStructSchedParamPtr>]
803         >,
805         FunctionSpec<
806             "sched_get_priority_min",
807             RetValSpec<IntType>,
808             [ArgSpec<IntType>]
809         >,
811         FunctionSpec<
812             "sched_get_priority_max",
813             RetValSpec<IntType>,
814             [ArgSpec<IntType>]
815         >,
817         FunctionSpec<
818             "sched_rr_get_interval",
819             RetValSpec<IntType>,
820             [ArgSpec<PidT>, ArgSpec<StructTimeSpecPtr>]
821         >,
822       ]
823   >;
825   HeaderSpec String = HeaderSpec<
826     "string.h",
827     [
828         Macro<"NULL">,
829     ],
830     [
831         SizeTType,
832     ],
833     [], // Enumerations
834     [
835         FunctionSpec<
836             "memccpy",
837             RetValSpec<VoidPtr>,
838             [ArgSpec<VoidRestrictedPtr>,
839              ArgSpec<ConstVoidRestrictedPtr>,
840              ArgSpec<IntType>,
841              ArgSpec<SizeTType>]
842         >,
843         FunctionSpec<
844             "mempcpy",
845             RetValSpec<VoidPtr>,
846             [ArgSpec<VoidRestrictedPtr>,
847              ArgSpec<ConstVoidRestrictedPtr>,
848              ArgSpec<SizeTType>]
849         >,
850         FunctionSpec<
851             "stpcpy",
852             RetValSpec<CharPtr>,
853             [ArgSpec<RestrictedCharPtr>,
854              ArgSpec<ConstRestrictedCharPtr>]
855         >,
856         FunctionSpec<
857             "stpncpy",
858             RetValSpec<CharPtr>,
859             [ArgSpec<RestrictedCharPtr>,
860              ArgSpec<ConstRestrictedCharPtr>,
861              ArgSpec<SizeTType>]
862         >,
863         FunctionSpec<
864             "strnlen",
865              RetValSpec<SizeTType>,
866              [ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
867         >,
868         FunctionSpec<
869             "strtok_r",
870             RetValSpec<CharPtr>,
871             [ArgSpec<RestrictedCharPtr>,
872              ArgSpec<ConstRestrictedCharPtr>,
873              ArgSpec<CharRestrictedDoublePtr>]
874         >,
875         FunctionSpec<
876             "strsignal",
877             RetValSpec<CharPtr>,
878             [ArgSpec<IntType>]
879         >,
880     ]
881   >;
883   HeaderSpec CType = HeaderSpec<
884     "ctype.h",
885     [], // Macros
886     [], // Types
887     [], // Enumerations
888     [
889         FunctionSpec<
890             "isascii",
891             RetValSpec<IntType>,
892             [ArgSpec<IntType>]
893         >,
894     ]
895   >;
897   NamedType RLimTType = NamedType<"rlim_t">;
898   NamedType StructRLimitType = NamedType<"struct rlimit">;
899   PtrType StructRLimitPtr = PtrType<StructRLimitType>;
900   ConstType ConstStructRLimitPtr = ConstType<StructRLimitType>;
901   HeaderSpec SysResource = HeaderSpec<
902     "sys/resource.h",
903     [], // Macros
904     [RLimTType, StructRLimitType], // Types
905     [], // Enumerations
906     [
907         FunctionSpec<
908           "getrlimit",
909           RetValSpec<IntType>,
910           [ArgSpec<StructRLimitPtr>]
911         >,
912         FunctionSpec<
913           "setrlimit",
914           RetValSpec<IntType>,
915           [ArgSpec<ConstStructRLimitPtr>]
916         >,
917     ]
918   >;
920   HeaderSpec SysStat = HeaderSpec<
921     "sys/stat.h",
922     [], // Macros
923     [
924         ModeTType,
925         DevT,
926         InoT,
927         UidT,
928         GidT,
929         StructTimeSpec,
930         StructTimevalType,
931         BlkSizeT,
932         BlkCntT,
933         OffTType,
934         NLinkT,
935         StatType,
936     ], // Types
937     [], // Enumerations
938     [
939         FunctionSpec<
940           "chmod",
941           RetValSpec<IntType>,
942           [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
943         >,
944         FunctionSpec<
945           "fchmod",
946           RetValSpec<IntType>,
947           [ArgSpec<IntType>, ArgSpec<ModeTType>]
948         >,
949         FunctionSpec<
950           "fchmodat",
951           RetValSpec<IntType>,
952           [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>, ArgSpec<IntType>]
953         >,
954         FunctionSpec<
955             "fstat",
956             RetValSpec<IntType>,
957             [ArgSpec<IntType>, ArgSpec<StatTypePtr>]
958         >,
959         FunctionSpec<
960             "lstat",
961             RetValSpec<IntType>,
962             [ArgSpec<ConstRestrictedCharPtr>, ArgSpec<RestrictedStatTypePtr>]
963         >,
964         FunctionSpec<
965             "mkdir",
966             RetValSpec<IntType>,
967             [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
968         >,
969         FunctionSpec<
970             "mkdirat",
971             RetValSpec<IntType>,
972             [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
973         >,
974         FunctionSpec<
975             "stat",
976             RetValSpec<IntType>,
977             [ArgSpec<ConstRestrictedCharPtr>, ArgSpec<RestrictedStatTypePtr>]
978         >,
979     ]
980   >;
982   HeaderSpec SysStatvfs = HeaderSpec<
983       "sys/statvfs.h",
984       [], // Macros
985       [StructStatvfs], // Types
986       [], // Enumerations
987       [
988         FunctionSpec<
989           "statvfs",
990           RetValSpec<IntType>,
991           [
992             ArgSpec<ConstRestrictedCharPtr>,
993             ArgSpec<RestrictedStructStatvfsPtr>
994           ]
995         >,
996         FunctionSpec<
997           "fstatvfs",
998           RetValSpec<IntType>,
999           [
1000             ArgSpec<IntType>,
1001             ArgSpec<StructStatvfsPtr>
1002           ]
1003         >,
1004       ]  // Functions
1005     >;
1007   NamedType StructUtsName = NamedType<"struct utsname">;
1008   PtrType StructUtsNamePtr = PtrType<StructUtsName>;
1009   HeaderSpec SysUtsName = HeaderSpec<
1010     "sys/utsname.h",
1011     [], // Macros
1012     [StructUtsName], // Types
1013     [], // Enumerations
1014     [
1015         FunctionSpec<
1016             "uname",
1017             RetValSpec<IntType>,
1018             [ArgSpec<StructUtsNamePtr>]
1019         >,
1020     ]
1021   >;
1023   HeaderSpec ArpaInet = HeaderSpec<
1024       "arpa/inet.h",
1025       [], // Macros
1026       [], // Types
1027       [], // Enumerations
1028       [
1029           FunctionSpec<
1030               "htonl",
1031               RetValSpec<UInt32Type>,
1032               [ArgSpec<UInt32Type>]
1033           >,
1034           FunctionSpec<
1035               "htons",
1036               RetValSpec<UInt16Type>,
1037               [ArgSpec<UInt16Type>]
1038           >,
1039           FunctionSpec<
1040               "ntohl",
1041               RetValSpec<UInt32Type>,
1042               [ArgSpec<UInt32Type>]
1043           >,
1044           FunctionSpec<
1045               "ntohs",
1046               RetValSpec<UInt16Type>,
1047               [ArgSpec<UInt16Type>]
1048           >,
1049       ]
1050   >;
1052   HeaderSpec PThread = HeaderSpec<
1053     "pthread.h",
1054     [], // Macros
1055     [
1056         AtForkCallbackT,
1057         ClockIdT,
1058         PThreadAttrTType,
1059         PThreadCondAttrTType,
1060         PThreadKeyT,
1061         PThreadMutexAttrTType,
1062         PThreadMutexTType,
1063         PThreadOnceCallback,
1064         PThreadOnceT,
1065         PThreadRWLockAttrTType,
1066         PThreadRWLockTType,
1067         PThreadSpinLockTType,
1068         PThreadStartT,
1069         PThreadTSSDtorT,
1070         PThreadTType,
1071     ], // Types
1072     [], // Enumerations
1073     [
1074       FunctionSpec<
1075           "pthread_atfork",
1076           RetValSpec<IntType>,
1077           [ArgSpec<AtForkCallbackT>, ArgSpec<AtForkCallbackT>, ArgSpec<AtForkCallbackT>]
1078       >,
1079       FunctionSpec<
1080           "pthread_attr_init",
1081           RetValSpec<IntType>,
1082           [ArgSpec<PThreadAttrTPtr>]
1083       >,
1084       FunctionSpec<
1085           "pthread_attr_destroy",
1086           RetValSpec<IntType>,
1087           [ArgSpec<PThreadAttrTPtr>]
1088       >,
1089       FunctionSpec<
1090           "pthread_attr_getdetachstate",
1091           RetValSpec<IntType>,
1092           [ArgSpec<ConstPThreadAttrTPtr>, ArgSpec<IntPtr>]
1093       >,
1094       FunctionSpec<
1095           "pthread_attr_setdetachstate",
1096           RetValSpec<IntType>,
1097           [ArgSpec<PThreadAttrTPtr>, ArgSpec<IntType>]
1098       >,
1099       FunctionSpec<
1100           "pthread_attr_getguardsize",
1101           RetValSpec<IntType>,
1102           [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedSizeTPtr>]
1103       >,
1104       FunctionSpec<
1105           "pthread_attr_setguardsize",
1106           RetValSpec<IntType>,
1107           [ArgSpec<PThreadAttrTPtr>, ArgSpec<SizeTType>]
1108       >,
1109       FunctionSpec<
1110           "pthread_attr_getstacksize",
1111           RetValSpec<IntType>,
1112           [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedSizeTPtr>]
1113       >,
1114       FunctionSpec<
1115           "pthread_attr_setstacksize",
1116           RetValSpec<IntType>,
1117           [ArgSpec<PThreadAttrTPtr>, ArgSpec<SizeTType>]
1118       >,
1119       FunctionSpec<
1120           "pthread_attr_getstack",
1121           RetValSpec<IntType>,
1122           [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedVoidPtrPtr>, ArgSpec<RestrictedSizeTPtr>]
1123       >,
1124       FunctionSpec<
1125           "pthread_attr_setstack",
1126           RetValSpec<IntType>,
1127           [ArgSpec<PThreadAttrTPtr>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
1128       >,
1129       FunctionSpec<
1130           "pthread_condattr_destroy",
1131           RetValSpec<IntType>,
1132           [ArgSpec<PThreadCondAttrTPtr>]
1133       >,
1134       FunctionSpec<
1135           "pthread_condattr_getclock",
1136           RetValSpec<IntType>,
1137           [ArgSpec<ConstRestrictedPThreadCondAttrTPtr>, ArgSpec<RestrictedClockIdTPtr>]
1138       >,
1139       FunctionSpec<
1140           "pthread_condattr_getpshared",
1141           RetValSpec<IntType>,
1142           [ArgSpec<ConstRestrictedPThreadCondAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1143       >,
1144       FunctionSpec<
1145           "pthread_condattr_init",
1146           RetValSpec<IntType>,
1147           [ArgSpec<PThreadCondAttrTPtr>]
1148       >,
1149       FunctionSpec<
1150           "pthread_condattr_setclock",
1151           RetValSpec<IntType>,
1152           [ArgSpec<PThreadCondAttrTPtr>, ArgSpec<ClockIdT>]
1153       >,
1154       FunctionSpec<
1155           "pthread_condattr_setpshared",
1156           RetValSpec<IntType>,
1157           [ArgSpec<PThreadCondAttrTPtr>, ArgSpec<IntType>]
1158       >,
1159       FunctionSpec<
1160           "pthread_create",
1161           RetValSpec<IntType>,
1162           [ArgSpec<RestrictedPThreadTPtr>, ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<PThreadStartT>, ArgSpec<VoidPtr>]
1163       >,
1164       FunctionSpec<
1165           "pthread_join",
1166           RetValSpec<IntType>,
1167           [ArgSpec<PThreadTType>, ArgSpec<VoidPtrPtr>]
1168       >,
1169       FunctionSpec<
1170           "pthread_detach",
1171           RetValSpec<IntType>,
1172           [ArgSpec<PThreadTType>]
1173       >,
1174       FunctionSpec<
1175           "pthread_exit",
1176           RetValSpec<NoReturn>,
1177           [ArgSpec<VoidPtr>]
1178       >,
1179       FunctionSpec<
1180           "pthread_self",
1181           RetValSpec<PThreadTType>,
1182           [ArgSpec<VoidType>]
1183       >,
1184       FunctionSpec<
1185           "pthread_equal",
1186           RetValSpec<IntType>,
1187           [ArgSpec<PThreadTType>, ArgSpec<PThreadTType>]
1188       >,
1189       FunctionSpec<
1190           "pthread_mutexattr_init",
1191           RetValSpec<IntType>,
1192           [ArgSpec<PThreadMutexAttrTPtr>]
1193       >,
1194       FunctionSpec<
1195           "pthread_mutexattr_destroy",
1196           RetValSpec<IntType>,
1197           [ArgSpec<PThreadMutexAttrTPtr>]
1198       >,
1199       FunctionSpec<
1200           "pthread_mutexattr_gettype",
1201           RetValSpec<IntType>,
1202           [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1203       >,
1204       FunctionSpec<
1205           "pthread_mutexattr_settype",
1206           RetValSpec<IntType>,
1207           [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1208       >,
1209       FunctionSpec<
1210           "pthread_mutexattr_getrobust",
1211           RetValSpec<IntType>,
1212           [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1213       >,
1214       FunctionSpec<
1215           "pthread_mutexattr_setrobust",
1216           RetValSpec<IntType>,
1217           [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1218       >,
1219       FunctionSpec<
1220           "pthread_mutexattr_getpshared",
1221           RetValSpec<IntType>,
1222           [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1223       >,
1224       FunctionSpec<
1225           "pthread_mutexattr_setpshared",
1226           RetValSpec<IntType>,
1227           [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1228       >,
1229       FunctionSpec<
1230           "pthread_mutexattr_getprotocol",
1231           RetValSpec<IntType>,
1232           [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1233       >,
1234       FunctionSpec<
1235           "pthread_mutexattr_setprotocol",
1236           RetValSpec<IntType>,
1237           [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1238       >,
1239       FunctionSpec<
1240           "pthread_mutexattr_getprioceiling",
1241           RetValSpec<IntType>,
1242           [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1243       >,
1244       FunctionSpec<
1245           "pthread_mutexattr_setprioceiling",
1246           RetValSpec<IntType>,
1247           [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1248       >,
1249       FunctionSpec<
1250           "pthread_mutex_init",
1251           RetValSpec<IntType>,
1252           [ArgSpec<RestrictedPThreadMutexTPtr>, ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>]
1253       >,
1254       FunctionSpec<
1255           "pthread_mutex_destroy",
1256           RetValSpec<IntType>,
1257           [ArgSpec<PThreadMutexTPtr>]
1258       >,
1259       FunctionSpec<
1260           "pthread_mutex_lock",
1261           RetValSpec<IntType>,
1262           [ArgSpec<PThreadMutexTPtr>]
1263       >,
1264       FunctionSpec<
1265           "pthread_mutex_unlock",
1266           RetValSpec<IntType>,
1267           [ArgSpec<PThreadMutexTPtr>]
1268       >,
1269       FunctionSpec<
1270           "pthread_key_create",
1271           RetValSpec<IntType>,
1272           [ArgSpec<PThreadKeyTPtr>, ArgSpec<PThreadTSSDtorT>]
1273       >,
1274       FunctionSpec<
1275           "pthread_key_delete",
1276           RetValSpec<IntType>,
1277           [ArgSpec<PThreadKeyT>]
1278       >,
1279       FunctionSpec<
1280           "pthread_getspecific",
1281           RetValSpec<VoidPtr>,
1282           [ArgSpec<PThreadKeyT>]
1283       >,
1284       FunctionSpec<
1285           "pthread_setspecific",
1286           RetValSpec<VoidPtr>,
1287           [ArgSpec<PThreadKeyT>, ArgSpec<ConstVoidPtr>]
1288       >,
1289       FunctionSpec<
1290           "pthread_once",
1291           RetValSpec<IntType>,
1292           [ArgSpec<PThreadOnceTPtr>, ArgSpec<PThreadOnceCallback>]
1293       >,
1294       FunctionSpec<
1295           "pthread_rwlockattr_destroy",
1296           RetValSpec<IntType>,
1297           [ArgSpec<PThreadRWLockAttrTPtr>]
1298       >,
1299       FunctionSpec<
1300           "pthread_rwlockattr_getkind_np",
1301           RetValSpec<IntType>,
1302           [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntPtr>]
1303       >,
1304       FunctionSpec<
1305           "pthread_rwlockattr_getpshared",
1306           RetValSpec<IntType>,
1307           [ArgSpec<ConstPThreadRWLockAttrTPtr>, ArgSpec<IntPtr>]
1308       >,
1309       FunctionSpec<
1310           "pthread_rwlockattr_init",
1311           RetValSpec<IntType>,
1312           [ArgSpec<PThreadRWLockAttrTPtr>]
1313       >,
1314       FunctionSpec<
1315           "pthread_rwlockattr_setkind_np",
1316           RetValSpec<IntType>,
1317           [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntType>]
1318       >,
1319       FunctionSpec<
1320           "pthread_rwlockattr_setpshared",
1321           RetValSpec<IntType>,
1322           [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntType>]
1323       >,
1324       FunctionSpec<
1325         "pthread_rwlock_init",
1326         RetValSpec<IntType>,
1327         [ArgSpec<PThreadRWLockTPtr>, ArgSpec<ConstRestrictedPThreadRWLockAttrTPtr>]
1328       >,
1329       FunctionSpec<
1330         "pthread_rwlock_tryrdlock",
1331         RetValSpec<IntType>,
1332         [ArgSpec<PThreadRWLockTPtr>]
1333       >,
1334       FunctionSpec<
1335         "pthread_rwlock_trywrlock",
1336         RetValSpec<IntType>,
1337         [ArgSpec<PThreadRWLockTPtr>]
1338       >,
1339       FunctionSpec<
1340         "pthread_rwlock_timedrdlock",
1341         RetValSpec<IntType>,
1342         [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
1343       >,
1344       FunctionSpec<
1345         "pthread_rwlock_timedwrlock",
1346         RetValSpec<IntType>,
1347         [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
1348       >,
1349       FunctionSpec<
1350         "pthread_rwlock_clockrdlock",
1351         RetValSpec<IntType>,
1352         [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ClockIdT>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
1353       >,
1354       FunctionSpec<
1355         "pthread_rwlock_clockwrlock",
1356         RetValSpec<IntType>,
1357         [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ClockIdT>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
1358       >,
1359       FunctionSpec<
1360         "pthread_rwlock_rdlock",
1361         RetValSpec<IntType>,
1362         [ArgSpec<PThreadRWLockTPtr>]
1363       >,
1364       FunctionSpec<
1365         "pthread_rwlock_wrlock",
1366         RetValSpec<IntType>,
1367         [ArgSpec<PThreadRWLockTPtr>]
1368       >,
1369       FunctionSpec<
1370         "pthread_rwlock_unlock",
1371         RetValSpec<IntType>,
1372         [ArgSpec<PThreadRWLockTPtr>]
1373       >,
1374       FunctionSpec<
1375         "pthread_rwlock_destroy",
1376         RetValSpec<IntType>,
1377         [ArgSpec<PThreadRWLockTPtr>]
1378       >,
1379       FunctionSpec<
1380         "pthread_spin_init",
1381         RetValSpec<IntType>,
1382         [ArgSpec<PThreadSpinLockTPtr>, ArgSpec<IntType>]
1383       >,
1384       FunctionSpec<
1385         "pthread_spin_destroy",
1386         RetValSpec<IntType>,
1387         [ArgSpec<PThreadSpinLockTPtr>]
1388       >,
1389       FunctionSpec<
1390         "pthread_spin_lock",
1391         RetValSpec<IntType>,
1392         [ArgSpec<PThreadSpinLockTPtr>]
1393       >,
1394       FunctionSpec<
1395         "pthread_spin_trylock",
1396         RetValSpec<IntType>,
1397         [ArgSpec<PThreadSpinLockTPtr>]
1398       >,
1399       FunctionSpec<
1400         "pthread_spin_unlock",
1401         RetValSpec<IntType>,
1402         [ArgSpec<PThreadSpinLockTPtr>]
1403       >
1404     ]
1405   >;
1407   HeaderSpec StdIO = HeaderSpec<
1408       "stdio.h",
1409       [], // Macros
1410       [OffTType], // Types
1411       [], // Enumerations
1412       [
1413           FunctionSpec<
1414               "flockfile",
1415               RetValSpec<VoidType>,
1416               [ArgSpec<FILEPtr>]
1417           >,
1418           FunctionSpec<
1419               "funlockfile",
1420               RetValSpec<VoidType>,
1421               [ArgSpec<FILEPtr>]
1422           >,
1423           FunctionSpec<
1424               "getc_unlocked",
1425               RetValSpec<IntType>,
1426               [ArgSpec<FILEPtr>]
1427           >,
1428           FunctionSpec<
1429               "getchar_unlocked",
1430               RetValSpec<IntType>,
1431               [ArgSpec<VoidType>]
1432           >,
1433           FunctionSpec<
1434             "fileno",
1435             RetValSpec<IntType>,
1436             [ArgSpec<FILEPtr>]
1437           >,
1438           FunctionSpec<
1439             "fdopen",
1440             RetValSpec<FILEPtr>,
1441             [ArgSpec<IntType>, ArgSpec<ConstCharPtr>]
1442           >,
1443       ]
1444   >;
1446   HeaderSpec Dirent = HeaderSpec<
1447       "dirent.h",
1448       [], // Macros
1449       [InoT, StructDirent, DIR], // Types
1450       [], // Enumerations
1451       [
1452           FunctionSpec<
1453               "alphasort",
1454               RetValSpec<IntType>,
1455               [ArgSpec<ConstStructDirentPtrPtr>, ArgSpec<ConstStructDirentPtrPtr>]
1456           >,
1457           FunctionSpec<
1458               "closedir",
1459               RetValSpec<IntType>,
1460               [ArgSpec<DIRPtr>]
1461           >,
1462           FunctionSpec<
1463               "dirfd",
1464               RetValSpec<IntType>,
1465               [ArgSpec<DIRPtr>]
1466           >,
1467           FunctionSpec<
1468               "fdopendir",
1469               RetValSpec<DIRPtr>,
1470               [ArgSpec<IntType>]
1471           >,
1472           FunctionSpec<
1473               "opendir",
1474               RetValSpec<DIRPtr>,
1475               [ArgSpec<ConstCharPtr>]
1476           >,
1477           FunctionSpec<
1478               "readdir",
1479               RetValSpec<StructDirentPtr>,
1480               [ArgSpec<DIRPtr>]
1481           >,
1482       ]
1483   >;
1485   HeaderSpec Time = HeaderSpec<
1486       "time.h",
1487       [], // Macros
1488       [ClockIdT, StructTimeSpec, StructTimevalType], // Types
1489       [], // Enumerations
1490       [
1491           FunctionSpec<
1492               "clock_gettime",
1493               RetValSpec<IntType>,
1494               [ArgSpec<ClockIdT>, ArgSpec<StructTimeSpecPtr>]
1495           >,
1496           FunctionSpec<
1497               "gettimeofday",
1498               RetValSpec<IntType>,
1499               [ArgSpec<StructTimevalPtr>, ArgSpec<VoidPtr>]
1500           >,
1501           FunctionSpec<
1502               "nanosleep",
1503               RetValSpec<IntType>,
1504               [ArgSpec<ConstStructTimeSpecPtr>, ArgSpec<StructTimeSpecPtr>]
1505           >,
1506       ]
1507   >;
1509   HeaderSpec SysWait = HeaderSpec<
1510     "sys/wait.h",
1511     [], // Macros
1512     [PidT, StructRUsage, SigInfoType],
1513     [], // Enumerations
1514     [
1515       FunctionSpec<
1516         "wait",
1517         RetValSpec<PidT>,
1518         [ArgSpec<IntPtr>]
1519       >,
1520       FunctionSpec<
1521         "waitpid",
1522         RetValSpec<PidT>,
1523         [ArgSpec<PidT>, ArgSpec<IntPtr>, ArgSpec<IntType>]
1524       >
1525     ]
1526   >;
1528   HeaderSpec SysIOctl = HeaderSpec<
1529     "sys/ioctl.h",
1530     [
1531       Macro<"TIOCGETD">,
1532     ],  // Macros
1533     [], // Types
1534     [], // Enumerations
1535     []  // Functions
1536   >;
1538   HeaderSpec Spawn = HeaderSpec<
1539     "spawn.h",
1540     [], // Macros
1541     [ModeTType, PosixSpawnAttrT, PidT, PosixSpawnFileActionsT],
1542     [], // Enumerations
1543     [
1544       FunctionSpec<
1545         "posix_spawn_file_actions_addclose",
1546         RetValSpec<IntType>,
1547         [ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<IntType>]
1548       >,
1549       FunctionSpec<
1550         "posix_spawn_file_actions_adddup2",
1551         RetValSpec<IntType>,
1552         [ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<IntType>, ArgSpec<IntType>]
1553       >,
1554       FunctionSpec<
1555         "posix_spawn_file_actions_addopen",
1556         RetValSpec<IntType>,
1557         [ArgSpec<PosixSpawnFileActionsTRestrictedPtr>, ArgSpec<IntType>,
1558          ArgSpec<ConstCharRestrictedPtr>, ArgSpec<IntType>, ArgSpec<ModeTType>]
1559       >,
1560       FunctionSpec<
1561         "posix_spawn_file_actions_destroy",
1562         RetValSpec<IntType>,
1563         [ArgSpec<PosixSpawnFileActionsTPtr>]
1564       >,
1565       FunctionSpec<
1566         "posix_spawn_file_actions_init",
1567         RetValSpec<IntType>,
1568         [ArgSpec<PosixSpawnFileActionsTPtr>]
1569       >,
1570       FunctionSpec<
1571         "posix_spawn",
1572         RetValSpec<IntType>,
1573         [ArgSpec<RestrictedPidTPtr>, ArgSpec<ConstCharRestrictedPtr>,
1574          ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<RestrictedPosixSpawnAttrTPtrType>,
1575          ArgSpec<ConstCharRestrictedPtrPtr>, ArgSpec<ConstCharRestrictedPtrPtr>]
1576       >,
1577     ]
1578   >;
1580   HeaderSpec Search = HeaderSpec<
1581     "search.h",
1582     [], // Macros
1583     [
1584         ActionType,
1585         EntryType,
1586         LSearchCompareT,
1587     ], // Types
1588     [], // Enumerations
1589     [
1590         FunctionSpec<
1591             "hcreate",
1592             RetValSpec<IntType>,
1593             [
1594                 ArgSpec<SizeTType>
1595             ]
1596         >,
1597         FunctionSpec<
1598             "hdestroy",
1599             RetValSpec<VoidType>,
1600             [] // Args
1601         >,
1602         FunctionSpec<
1603             "hsearch",
1604             RetValSpec<EntryTypePtr>,
1605             [
1606                 ArgSpec<EntryType>,
1607                 ArgSpec<ActionType>
1608             ]
1609         >,
1610         FunctionSpec<
1611             "insque",
1612             RetValSpec<VoidType>,
1613             [
1614                 ArgSpec<VoidPtr>,
1615                 ArgSpec<VoidPtr>
1616             ]
1617         >,
1618         FunctionSpec<
1619             "remque",
1620             RetValSpec<VoidType>,
1621             [
1622                 ArgSpec<VoidPtr>
1623             ]
1624         >,
1625         FunctionSpec<
1626             "lfind",
1627             RetValSpec<VoidPtr>,
1628             [
1629                 ArgSpec<ConstVoidPtr>,
1630                 ArgSpec<ConstVoidPtr>,
1631                 ArgSpec<SizeTPtr>,
1632                 ArgSpec<SizeTType>,
1633                 ArgSpec<LSearchCompareT>
1634             ]
1635         >
1636     ]
1637   >;
1639   HeaderSpec Termios = HeaderSpec<
1640     "termios.h",
1641     [
1642       Macro<"NCCS">,
1643     ],
1644     [CcT, PidT, SpeedT, StructTermios, TcFlagT], // Types
1645     [], // Enumerations
1646     [
1647       FunctionSpec<
1648         "cfgetispeed",
1649         RetValSpec<SpeedT>,
1650         [ArgSpec<ConstStructTermiosPtr>]
1651       >,
1652       FunctionSpec<
1653         "cfgetospeed",
1654         RetValSpec<SpeedT>,
1655         [ArgSpec<ConstStructTermiosPtr>]
1656       >,
1657       FunctionSpec<
1658         "cfsetispeed",
1659         RetValSpec<SpeedT>,
1660         [ArgSpec<StructTermiosPtr>, ArgSpec<SpeedT>]
1661       >,
1662       FunctionSpec<
1663         "cfsetospeed",
1664         RetValSpec<SpeedT>,
1665         [ArgSpec<StructTermiosPtr>, ArgSpec<SpeedT>]
1666       >,
1667       FunctionSpec<
1668         "tcdrain",
1669         RetValSpec<IntType>,
1670         [ArgSpec<IntType>]
1671       >,
1672       FunctionSpec<
1673         "tcflow",
1674         RetValSpec<IntType>,
1675         [ArgSpec<IntType>, ArgSpec<IntType>]
1676       >,
1677       FunctionSpec<
1678         "tcflush",
1679         RetValSpec<IntType>,
1680         [ArgSpec<IntType>, ArgSpec<IntType>]
1681       >,
1682       FunctionSpec<
1683         "tcgetattr",
1684         RetValSpec<IntType>,
1685         [ArgSpec<IntType>, ArgSpec<StructTermiosPtr>]
1686       >,
1687       FunctionSpec<
1688         "tcgetsid",
1689         RetValSpec<PidT>,
1690         [ArgSpec<IntType>]
1691       >,
1692       FunctionSpec<
1693         "tcsendbreak",
1694         RetValSpec<IntType>,
1695         [ArgSpec<IntType>, ArgSpec<IntType>]
1696       >,
1697       FunctionSpec<
1698         "tcsetattr",
1699         RetValSpec<IntType>,
1700         [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<StructTermiosPtr>]
1701       >,
1702     ]
1703   >;
1705   HeaderSpec SysSelect = HeaderSpec<
1706     "sys/select.h",
1707     [], // Macros
1708     [FdSet, SigSetType, StructTimevalType, StructTimeSpec, SuSecondsT, TimeTType],
1709     [], // Enumerations
1710     [
1711       FunctionSpec<
1712         "select",
1713         RetValSpec<IntType>,
1714         [
1715             ArgSpec<IntType>, ArgSpec<RestrictedFdSetPtr>, ArgSpec<RestrictedFdSetPtr>,
1716             ArgSpec<RestrictedFdSetPtr>, ArgSpec<RestrictedStructTimevalPtr>
1717         ]
1718       >
1719     ]
1720   >;
1722   HeaderSpec SysSocket = HeaderSpec<
1723       "sys/socket.h",
1724       [
1725         Macro<"AF_UNSPEC">,
1726         Macro<"AF_UNIX">,
1727         Macro<"AF_LOCAL">,
1728         Macro<"AF_INET">,
1729         Macro<"AF_INET6">,
1730         Macro<"SOCK_STREAM">,
1731         Macro<"SOCK_DGRAM">,
1732         Macro<"SOCK_RAW">,
1733         Macro<"SOCK_RDM">,
1734         Macro<"SOCK_SEQPACKET">,
1735         Macro<"SOCK_PACKET">,
1736       ], // Macros
1737       [
1738         SizeTType,
1739         SSizeTType,
1740         SAFamilyType,
1741         StructSockAddr,
1742         StructSockAddrUn,
1743         SocklenType,
1744         StructIovec,
1745         StructMsghdr,
1746       ], // Types
1747       [], // Enumerations
1748       [
1749         FunctionSpec<
1750           "socket",
1751           RetValSpec<IntType>,
1752           [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
1753         >,
1754         FunctionSpec<
1755           "socketpair",
1756           RetValSpec<IntType>,
1757           [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntPtr>]
1758         >,
1759         FunctionSpec<
1760           "bind",
1761           RetValSpec<IntType>,
1762           [ArgSpec<IntType>, ArgSpec<ConstStructSockAddrPtr>, ArgSpec<SocklenType>]
1763         >,
1764         FunctionSpec<
1765           "send",
1766           RetValSpec<SSizeTType>,
1767           [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<IntType>]
1768         >,
1769         FunctionSpec<
1770           "sendto",
1771           RetValSpec<SSizeTType>,
1772           [
1773             ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>,
1774             ArgSpec<IntType>, ArgSpec<ConstStructSockAddrPtr>,
1775             ArgSpec<SocklenType>
1776           ]
1777         >,
1778         FunctionSpec<
1779           "sendmsg",
1780           RetValSpec<SSizeTType>,
1781           [ArgSpec<IntType>, ArgSpec<ConstStructMsghdrPtr>, ArgSpec<IntType>]
1782         >,
1783         FunctionSpec<
1784           "recv",
1785           RetValSpec<SSizeTType>,
1786           [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<IntType>]
1787         >,
1788         FunctionSpec<
1789           "recvfrom",
1790           RetValSpec<SSizeTType>,
1791           [
1792             ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>,
1793             ArgSpec<IntType>, ArgSpec<StructSockAddrPtr>,
1794             ArgSpec<SocklenPtr>
1795           ]
1796         >,
1797         FunctionSpec<
1798           "recvmsg",
1799           RetValSpec<SSizeTType>,
1800           [ArgSpec<IntType>, ArgSpec<StructMsghdrPtr>, ArgSpec<IntType>]
1801         >,
1802       ]  // Functions
1803   >;
1805   HeaderSpec SysTypes = HeaderSpec<
1806     "sys/types.h",
1807     [], // Macros
1808     [
1809       BlkCntT,
1810       BlkSizeT,
1811       ClockIdT,
1812       DevT,
1813       GidT,
1814       InoT,
1815       ModeTType,
1816       NLinkT,
1817       OffTType,
1818       PThreadAttrTType,
1819       PThreadCondAttrTType,
1820       PThreadKeyT,
1821       PThreadMutexAttrTType,
1822       PThreadMutexTType,
1823       PThreadOnceT,
1824       PThreadRWLockAttrTType,
1825       PThreadRWLockTType,
1826       PThreadTType,
1827       PidT,
1828       SSizeTType,
1829       SizeTType,
1830       SuSecondsT,
1831       TimeTType,
1832       UidT
1833     ], // Types
1834     [], // Enumerations
1835     []  // Functions
1836   >;
1838   let Headers = [
1839     ArpaInet,
1840     CType,
1841     Dirent,
1842     DlFcn,
1843     Errno,
1844     FCntl,
1845     PThread,
1846     Sched,
1847     Signal,
1848     Spawn,
1849     StdIO,
1850     StdLib,
1851     SysIOctl,
1852     SysMMan,
1853     SysResource,
1854     SysSelect,
1855     SysSocket,
1856     SysStat,
1857     SysStatvfs,
1858     SysTypes,
1859     SysUtsName,
1860     SysWait,
1861     Time,
1862     Termios,
1863     UniStd,
1864     String,
1865     Search,
1866   ];