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