llvm-project

Форк
0
1752 строки · 46.7 Кб
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>;
6

7
def SigInfoType : NamedType<"siginfo_t">;
8
def UnionSigVal : NamedType<"union sigval">;
9

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>;
15

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">;
23

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">;
33

34
def StatType : NamedType<"struct stat">;
35
def StatTypePtr : PtrType<StatType>;
36
def RestrictedStatTypePtr : RestrictedPtrType<StatType>;
37

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>;
45

46
def StructSchedParam : NamedType<"struct sched_param">;
47
def StructSchedParamPtr : PtrType<StructSchedParam>;
48
def ConstStructSchedParamPtr : ConstType<StructSchedParamPtr>;
49

50
def ExecArgvT : NamedType<"__exec_argv_t">;
51
def ExecEnvpT : NamedType<"__exec_envp_t">;
52

53
def AtForkCallbackT : NamedType<"__atfork_callback_t">;
54

55
def PosixSpawnFileActionsT : NamedType<"posix_spawn_file_actions_t">;
56
def PosixSpawnFileActionsTPtr : PtrType<PosixSpawnFileActionsT>;
57
def ConstPosixSpawnFileActionsTPtr : ConstType<PosixSpawnFileActionsTPtr>;
58
def PosixSpawnFileActionsTRestrictedPtr : RestrictedPtrType<PosixSpawnFileActionsT>;
59

60
def PosixSpawnAttrT : NamedType<"posix_spawnattr_t">;
61
def RestrictedPosixSpawnAttrTPtrType : RestrictedPtrType<PosixSpawnAttrT>;
62

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">;
69

70
def StackT : NamedType<"stack_t">;
71
def StackTPtr : PtrType<StackT>;
72
def RestrictedStackTPtr : RestrictedPtrType<StackT>;
73
def ConstRestrictedStackTPtr : ConstType<RestrictedStackTPtr>;
74

75
def FdSet : NamedType<"fd_set">;
76
def FdSetPtr : PtrType<FdSet>;
77
def RestrictedFdSetPtr : RestrictedPtrType<FdSet>;
78

79
def GetoptArgvT : NamedType<"__getoptargv_t">;
80

81
def SAFamilyType : NamedType<"sa_family_t">;
82
def SocklenType : NamedType<"socklen_t">;
83

84
def StructSockAddr : NamedType<"struct sockaddr">;
85
def StructSockAddrPtr : PtrType<StructSockAddr>;
86
def ConstStructSockAddrPtr : ConstType<StructSockAddrPtr>;
87

88
def StructSockAddrUn : NamedType<"struct sockaddr_un">;
89

90
def StructStatvfs : NamedType<"struct statvfs">;
91
def StructStatvfsPtr : PtrType<StructStatvfs>;
92
def RestrictedStructStatvfsPtr : RestrictedPtrType<StructStatvfs>;
93

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>;
100

101
  NamedType ModeTType = NamedType<"mode_t">;
102

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>;
108

109
  NamedType PThreadCondAttrTType = NamedType<"pthread_condattr_t">;
110
  PtrType PThreadCondAttrTPtr = PtrType<PThreadCondAttrTType>;
111
  ConstType ConstRestrictedPThreadCondAttrTPtr = ConstType<RestrictedPtrType<PThreadCondAttrTType>>;
112

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>;
118

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>;
124

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>;
130

131
  NamedType PThreadRWLockTType = NamedType<"pthread_rwlock_t">;
132
  PtrType PThreadRWLockTPtr = PtrType<PThreadRWLockTType>;
133
  RestrictedPtrType RestrictedPThreadRWLockTPtr = RestrictedPtrType<PThreadRWLockTType>;
134

135
  PtrType PThreadTPtr = PtrType<PThreadTType>;
136
  RestrictedPtrType RestrictedPThreadTPtr = RestrictedPtrType<PThreadTType>;
137

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
  >;
224

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
  >;
258

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
  >;
290

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">,
300

301
        Macro<"MAP_FIXED">,
302
        Macro<"MAP_PRIVATE">,
303
        Macro<"MAP_SHARED">,
304

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
  >;
387

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
  >;
448

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
          "getuid",
551
          RetValSpec<UidT>,
552
          [ArgSpec<VoidType>]
553
        >,
554
        FunctionSpec<
555
          "isatty",
556
          RetValSpec<IntType>,
557
          [ArgSpec<IntType>]
558
        >,
559
        FunctionSpec<
560
          "link",
561
          RetValSpec<IntType>,
562
          [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
563
        >,
564
        FunctionSpec<
565
          "linkat",
566
          RetValSpec<IntType>,
567
          [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
568
        >,
569
        FunctionSpec<
570
          "lseek",
571
          RetValSpec<OffTType>,
572
          [ArgSpec<IntType>, ArgSpec<OffTType>, ArgSpec<IntType>]
573
        >,
574
        FunctionSpec<
575
          "pread",
576
          RetValSpec<SSizeTType>,
577
          [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
578
        >,
579
        FunctionSpec<
580
          "pwrite",
581
          RetValSpec<SSizeTType>,
582
          [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
583
        >,
584
        FunctionSpec<
585
          "read",
586
          RetValSpec<SSizeTType>,
587
          [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
588
        >,
589
        FunctionSpec<
590
          "readlink",
591
          RetValSpec<SSizeTType>,
592
          [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
593
        >,
594
        FunctionSpec<
595
          "readlinkat",
596
          RetValSpec<SSizeTType>,
597
          [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
598
        >,
599
        FunctionSpec<
600
          "rmdir",
601
          RetValSpec<IntType>,
602
          [ArgSpec<ConstCharPtr>]
603
        >,
604
        FunctionSpec<
605
          "getpid",
606
          RetValSpec<IntType>,
607
          [ArgSpec<VoidType>]
608
        >,
609
        FunctionSpec<
610
          "getppid",
611
          RetValSpec<IntType>,
612
          [ArgSpec<VoidType>]
613
        >,
614
        FunctionSpec<
615
          "link",
616
          RetValSpec<IntType>,
617
          [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
618
        >,
619
        FunctionSpec<
620
          "linkat",
621
          RetValSpec<IntType>,
622
          [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
623
        >,
624
        FunctionSpec<
625
          "lseek",
626
          RetValSpec<OffTType>,
627
          [ArgSpec<IntType>, ArgSpec<OffTType>, ArgSpec<IntType>]
628
        >,
629
        FunctionSpec<
630
          "pipe",
631
          RetValSpec<IntType>,
632
          [ArgSpec<IntPtr>] //TODO: make this int[2]
633
        >,
634
        FunctionSpec<
635
          "pread",
636
          RetValSpec<SSizeTType>,
637
          [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
638
        >,
639
        FunctionSpec<
640
          "pwrite",
641
          RetValSpec<SSizeTType>,
642
          [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
643
        >,
644
        FunctionSpec<
645
          "read",
646
          RetValSpec<SSizeTType>,
647
          [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
648
        >,
649
        FunctionSpec<
650
          "readlink",
651
          RetValSpec<SSizeTType>,
652
          [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
653
        >,
654
        FunctionSpec<
655
          "readlinkat",
656
          RetValSpec<SSizeTType>,
657
          [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
658
        >,
659
        FunctionSpec<
660
          "rmdir",
661
          RetValSpec<IntType>,
662
          [ArgSpec<ConstCharPtr>]
663
        >,
664
        FunctionSpec<
665
          "swab",
666
          RetValSpec<VoidType>,
667
          [ArgSpec<ConstVoidRestrictedPtr>, ArgSpec<VoidPtr>, ArgSpec<SSizeTType>]
668
        >,
669
        FunctionSpec<
670
          "symlink",
671
          RetValSpec<IntType>,
672
          [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
673
        >,
674
        FunctionSpec<
675
          "symlinkat",
676
          RetValSpec<IntType>,
677
          [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>]
678
        >,
679
        FunctionSpec<
680
          "sysconf",
681
          RetValSpec<IntType>,
682
          [ArgSpec<IntType>]
683
        >,
684
        FunctionSpec<
685
          "__llvm_libc_syscall",
686
          RetValSpec<LongType>,
687
          [ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>]
688
        >,
689
        FunctionSpec<
690
          "truncate",
691
          RetValSpec<IntType>,
692
          [ArgSpec<ConstCharPtr>, ArgSpec<OffTType>]
693
        >,
694
        FunctionSpec<
695
          "unlink",
696
          RetValSpec<IntType>,
697
          [ArgSpec<ConstCharPtr>]
698
        >,
699
        FunctionSpec<
700
          "unlinkat",
701
          RetValSpec<IntType>,
702
          [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
703
        >,
704
        FunctionSpec<
705
          "write",
706
          RetValSpec<SSizeTType>,
707
          [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
708
        >,
709
        FunctionSpec<
710
          "getopt",
711
          RetValSpec<IntType>,
712
          [ArgSpec<IntType>, ArgSpec<GetoptArgvT>, ArgSpec<ConstCharPtr>]
713
        >,
714
    ],
715
    [
716
        ObjectSpec<"environ", "char **">,
717
        ObjectSpec<
718
          "optarg",
719
          "char *"
720
        >,
721
        ObjectSpec<
722
          "optind",
723
          "int"
724
        >,
725
        ObjectSpec<
726
          "opterr",
727
          "int"
728
        >,
729
        ObjectSpec<
730
          "optopt",
731
          "int"
732
        >,
733
    ]
734
  >;
735

736
  HeaderSpec StdLib = HeaderSpec<
737
    "stdlib.h",
738
    [], // Macros
739
    [], // Types
740
    [], // Enumerations
741
    [
742
        FunctionSpec<
743
          "getenv",
744
          RetValSpec<CharPtr>,
745
          [ArgSpec<ConstCharPtr>]
746
        >,
747
    ]
748
  >;
749

750
  HeaderSpec Sched = HeaderSpec<
751
      "sched.h",
752
      [], // Macros
753
      [PidT, TimeTType, StructTimeSpec, StructSchedParam], // Types
754
      [], // Enumerations
755
      [
756
        FunctionSpec<
757
            "sched_yield",
758
            RetValSpec<IntType>,
759
            [ArgSpec<VoidType>]
760
        >,
761
        FunctionSpec<
762
            "sched_setparam",
763
            RetValSpec<IntType>,
764
            [ArgSpec<PidT>, ArgSpec<ConstStructSchedParamPtr>]
765
        >,
766

767
        FunctionSpec<
768
            "sched_getparam",
769
            RetValSpec<IntType>,
770
            [ArgSpec<PidT>, ArgSpec<StructSchedParamPtr>]
771
        >,
772

773
        FunctionSpec<
774
            "sched_setscheduler",
775
            RetValSpec<IntType>,
776
            [ArgSpec<PidT>]
777
        >,
778

779
        FunctionSpec<
780
            "sched_getscheduler",
781
            RetValSpec<IntType>,
782
            [ArgSpec<PidT>, ArgSpec<IntType>, ArgSpec<ConstStructSchedParamPtr>]
783
        >,
784

785
        FunctionSpec<
786
            "sched_get_priority_min",
787
            RetValSpec<IntType>,
788
            [ArgSpec<IntType>]
789
        >,
790

791
        FunctionSpec<
792
            "sched_get_priority_max",
793
            RetValSpec<IntType>,
794
            [ArgSpec<IntType>]
795
        >,
796

797
        FunctionSpec<
798
            "sched_rr_get_interval",
799
            RetValSpec<IntType>,
800
            [ArgSpec<PidT>, ArgSpec<StructTimeSpecPtr>]
801
        >,
802
      ]
803
  >;
804

805
  HeaderSpec String = HeaderSpec<
806
    "string.h",
807
    [
808
        Macro<"NULL">,
809
    ],
810
    [
811
        SizeTType,
812
    ],
813
    [], // Enumerations
814
    [
815
        FunctionSpec<
816
            "memccpy",
817
            RetValSpec<VoidPtr>,
818
            [ArgSpec<VoidRestrictedPtr>,
819
             ArgSpec<ConstVoidRestrictedPtr>,
820
             ArgSpec<IntType>,
821
             ArgSpec<SizeTType>]
822
        >,
823
        FunctionSpec<
824
            "mempcpy",
825
            RetValSpec<VoidPtr>,
826
            [ArgSpec<VoidRestrictedPtr>,
827
             ArgSpec<ConstVoidRestrictedPtr>,
828
             ArgSpec<SizeTType>]
829
        >,
830
        FunctionSpec<
831
            "stpcpy",
832
            RetValSpec<CharPtr>,
833
            [ArgSpec<RestrictedCharPtr>,
834
             ArgSpec<ConstRestrictedCharPtr>]
835
        >,
836
        FunctionSpec<
837
            "stpncpy",
838
            RetValSpec<CharPtr>,
839
            [ArgSpec<RestrictedCharPtr>,
840
             ArgSpec<ConstRestrictedCharPtr>,
841
             ArgSpec<SizeTType>]
842
        >,
843
        FunctionSpec<
844
            "strnlen",
845
             RetValSpec<SizeTType>,
846
             [ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
847
        >,
848
        FunctionSpec<
849
            "strtok_r",
850
            RetValSpec<CharPtr>,
851
            [ArgSpec<RestrictedCharPtr>,
852
             ArgSpec<ConstRestrictedCharPtr>,
853
             ArgSpec<CharRestrictedDoublePtr>]
854
        >,
855
        FunctionSpec<
856
            "strsignal",
857
            RetValSpec<CharPtr>,
858
            [ArgSpec<IntType>]
859
        >,
860
    ]
861
  >;
862

863
  HeaderSpec CType = HeaderSpec<
864
    "ctype.h",
865
    [], // Macros
866
    [], // Types
867
    [], // Enumerations
868
    [
869
        FunctionSpec<
870
            "isascii",
871
            RetValSpec<IntType>,
872
            [ArgSpec<IntType>]
873
        >,
874
    ]
875
  >;
876

877
  NamedType RLimTType = NamedType<"rlim_t">;
878
  NamedType StructRLimitType = NamedType<"struct rlimit">;
879
  PtrType StructRLimitPtr = PtrType<StructRLimitType>;
880
  ConstType ConstStructRLimitPtr = ConstType<StructRLimitType>;
881
  HeaderSpec SysResource = HeaderSpec<
882
    "sys/resource.h",
883
    [], // Macros
884
    [RLimTType, StructRLimitType], // Types
885
    [], // Enumerations
886
    [
887
        FunctionSpec<
888
          "getrlimit",
889
          RetValSpec<IntType>,
890
          [ArgSpec<StructRLimitPtr>]
891
        >,
892
        FunctionSpec<
893
          "setrlimit",
894
          RetValSpec<IntType>,
895
          [ArgSpec<ConstStructRLimitPtr>]
896
        >,
897
    ]
898
  >;
899

900
  HeaderSpec SysStat = HeaderSpec<
901
    "sys/stat.h",
902
    [], // Macros
903
    [
904
        ModeTType,
905
        DevT,
906
        InoT,
907
        UidT,
908
        GidT,
909
        StructTimeSpec,
910
        StructTimevalType,
911
        BlkSizeT,
912
        BlkCntT,
913
        OffTType,
914
        NLinkT,
915
        StatType,
916
    ], // Types
917
    [], // Enumerations
918
    [
919
        FunctionSpec<
920
          "chmod",
921
          RetValSpec<IntType>,
922
          [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
923
        >,
924
        FunctionSpec<
925
          "fchmod",
926
          RetValSpec<IntType>,
927
          [ArgSpec<IntType>, ArgSpec<ModeTType>]
928
        >,
929
        FunctionSpec<
930
          "fchmodat",
931
          RetValSpec<IntType>,
932
          [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>, ArgSpec<IntType>]
933
        >,
934
        FunctionSpec<
935
            "fstat",
936
            RetValSpec<IntType>,
937
            [ArgSpec<IntType>, ArgSpec<StatTypePtr>]
938
        >,
939
        FunctionSpec<
940
            "lstat",
941
            RetValSpec<IntType>,
942
            [ArgSpec<ConstRestrictedCharPtr>, ArgSpec<RestrictedStatTypePtr>]
943
        >,
944
        FunctionSpec<
945
            "mkdir",
946
            RetValSpec<IntType>,
947
            [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
948
        >,
949
        FunctionSpec<
950
            "mkdirat",
951
            RetValSpec<IntType>,
952
            [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
953
        >,
954
        FunctionSpec<
955
            "stat",
956
            RetValSpec<IntType>,
957
            [ArgSpec<ConstRestrictedCharPtr>, ArgSpec<RestrictedStatTypePtr>]
958
        >,
959
    ]
960
  >;
961

962
  HeaderSpec SysStatvfs = HeaderSpec<
963
      "sys/statvfs.h",
964
      [], // Macros
965
      [StructStatvfs], // Types
966
      [], // Enumerations
967
      [
968
        FunctionSpec<
969
          "statvfs",
970
          RetValSpec<IntType>,
971
          [
972
            ArgSpec<ConstRestrictedCharPtr>,
973
            ArgSpec<RestrictedStructStatvfsPtr>
974
          ]
975
        >,
976
        FunctionSpec<
977
          "fstatvfs",
978
          RetValSpec<IntType>,
979
          [
980
            ArgSpec<IntType>,
981
            ArgSpec<StructStatvfsPtr>
982
          ]
983
        >,
984
      ]  // Functions
985
    >;
986

987
  NamedType StructUtsName = NamedType<"struct utsname">;
988
  PtrType StructUtsNamePtr = PtrType<StructUtsName>;
989
  HeaderSpec SysUtsName = HeaderSpec<
990
    "sys/utsname.h",
991
    [], // Macros
992
    [StructUtsName], // Types
993
    [], // Enumerations
994
    [
995
        FunctionSpec<
996
            "uname",
997
            RetValSpec<IntType>,
998
            [ArgSpec<StructUtsNamePtr>]
999
        >,
1000
    ]
1001
  >;
1002

1003
  HeaderSpec ArpaInet = HeaderSpec<
1004
      "arpa/inet.h",
1005
      [], // Macros
1006
      [], // Types
1007
      [], // Enumerations
1008
      [
1009
          FunctionSpec<
1010
              "htonl",
1011
              RetValSpec<UInt32Type>,
1012
              [ArgSpec<UInt32Type>]
1013
          >,
1014
          FunctionSpec<
1015
              "htons",
1016
              RetValSpec<UInt16Type>,
1017
              [ArgSpec<UInt16Type>]
1018
          >,
1019
          FunctionSpec<
1020
              "ntohl",
1021
              RetValSpec<UInt32Type>,
1022
              [ArgSpec<UInt32Type>]
1023
          >,
1024
          FunctionSpec<
1025
              "ntohs",
1026
              RetValSpec<UInt16Type>,
1027
              [ArgSpec<UInt16Type>]
1028
          >,
1029
      ]
1030
  >;
1031

1032
  HeaderSpec PThread = HeaderSpec<
1033
    "pthread.h",
1034
    [], // Macros
1035
    [
1036
        AtForkCallbackT,
1037
        ClockIdT,
1038
        PThreadAttrTType,
1039
        PThreadCondAttrTType,
1040
        PThreadKeyT,
1041
        PThreadMutexAttrTType,
1042
        PThreadMutexTType,
1043
        PThreadOnceCallback,
1044
        PThreadOnceT,
1045
        PThreadRWLockAttrTType,
1046
        PThreadRWLockTType,
1047
        PThreadStartT,
1048
        PThreadTSSDtorT,
1049
        PThreadTType,
1050
    ], // Types
1051
    [], // Enumerations
1052
    [
1053
      FunctionSpec<
1054
          "pthread_atfork",
1055
          RetValSpec<IntType>,
1056
          [ArgSpec<AtForkCallbackT>, ArgSpec<AtForkCallbackT>, ArgSpec<AtForkCallbackT>]
1057
      >,
1058
      FunctionSpec<
1059
          "pthread_attr_init",
1060
          RetValSpec<IntType>,
1061
          [ArgSpec<PThreadAttrTPtr>]
1062
      >,
1063
      FunctionSpec<
1064
          "pthread_attr_destroy",
1065
          RetValSpec<IntType>,
1066
          [ArgSpec<PThreadAttrTPtr>]
1067
      >,
1068
      FunctionSpec<
1069
          "pthread_attr_getdetachstate",
1070
          RetValSpec<IntType>,
1071
          [ArgSpec<ConstPThreadAttrTPtr>, ArgSpec<IntPtr>]
1072
      >,
1073
      FunctionSpec<
1074
          "pthread_attr_setdetachstate",
1075
          RetValSpec<IntType>,
1076
          [ArgSpec<PThreadAttrTPtr>, ArgSpec<IntType>]
1077
      >,
1078
      FunctionSpec<
1079
          "pthread_attr_getguardsize",
1080
          RetValSpec<IntType>,
1081
          [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedSizeTPtr>]
1082
      >,
1083
      FunctionSpec<
1084
          "pthread_attr_setguardsize",
1085
          RetValSpec<IntType>,
1086
          [ArgSpec<PThreadAttrTPtr>, ArgSpec<SizeTType>]
1087
      >,
1088
      FunctionSpec<
1089
          "pthread_attr_getstacksize",
1090
          RetValSpec<IntType>,
1091
          [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedSizeTPtr>]
1092
      >,
1093
      FunctionSpec<
1094
          "pthread_attr_setstacksize",
1095
          RetValSpec<IntType>,
1096
          [ArgSpec<PThreadAttrTPtr>, ArgSpec<SizeTType>]
1097
      >,
1098
      FunctionSpec<
1099
          "pthread_attr_getstack",
1100
          RetValSpec<IntType>,
1101
          [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedVoidPtrPtr>, ArgSpec<RestrictedSizeTPtr>]
1102
      >,
1103
      FunctionSpec<
1104
          "pthread_attr_setstack",
1105
          RetValSpec<IntType>,
1106
          [ArgSpec<PThreadAttrTPtr>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
1107
      >,
1108
      FunctionSpec<
1109
          "pthread_condattr_destroy",
1110
          RetValSpec<IntType>,
1111
          [ArgSpec<PThreadCondAttrTPtr>]
1112
      >,
1113
      FunctionSpec<
1114
          "pthread_condattr_getclock",
1115
          RetValSpec<IntType>,
1116
          [ArgSpec<ConstRestrictedPThreadCondAttrTPtr>, ArgSpec<RestrictedClockIdTPtr>]
1117
      >,
1118
      FunctionSpec<
1119
          "pthread_condattr_getpshared",
1120
          RetValSpec<IntType>,
1121
          [ArgSpec<ConstRestrictedPThreadCondAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1122
      >,
1123
      FunctionSpec<
1124
          "pthread_condattr_init",
1125
          RetValSpec<IntType>,
1126
          [ArgSpec<PThreadCondAttrTPtr>]
1127
      >,
1128
      FunctionSpec<
1129
          "pthread_condattr_setclock",
1130
          RetValSpec<IntType>,
1131
          [ArgSpec<PThreadCondAttrTPtr>, ArgSpec<ClockIdT>]
1132
      >,
1133
      FunctionSpec<
1134
          "pthread_condattr_setpshared",
1135
          RetValSpec<IntType>,
1136
          [ArgSpec<PThreadCondAttrTPtr>, ArgSpec<IntType>]
1137
      >,
1138
      FunctionSpec<
1139
          "pthread_create",
1140
          RetValSpec<IntType>,
1141
          [ArgSpec<RestrictedPThreadTPtr>, ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<PThreadStartT>, ArgSpec<VoidPtr>]
1142
      >,
1143
      FunctionSpec<
1144
          "pthread_join",
1145
          RetValSpec<IntType>,
1146
          [ArgSpec<PThreadTType>, ArgSpec<VoidPtrPtr>]
1147
      >,
1148
      FunctionSpec<
1149
          "pthread_detach",
1150
          RetValSpec<IntType>,
1151
          [ArgSpec<PThreadTType>]
1152
      >,
1153
      FunctionSpec<
1154
          "pthread_exit",
1155
          RetValSpec<NoReturn>,
1156
          [ArgSpec<VoidPtr>]
1157
      >,
1158
      FunctionSpec<
1159
          "pthread_self",
1160
          RetValSpec<PThreadTType>,
1161
          [ArgSpec<VoidType>]
1162
      >,
1163
      FunctionSpec<
1164
          "pthread_equal",
1165
          RetValSpec<IntType>,
1166
          [ArgSpec<PThreadTType>, ArgSpec<PThreadTType>]
1167
      >,
1168
      FunctionSpec<
1169
          "pthread_mutexattr_init",
1170
          RetValSpec<IntType>,
1171
          [ArgSpec<PThreadMutexAttrTPtr>]
1172
      >,
1173
      FunctionSpec<
1174
          "pthread_mutexattr_destroy",
1175
          RetValSpec<IntType>,
1176
          [ArgSpec<PThreadMutexAttrTPtr>]
1177
      >,
1178
      FunctionSpec<
1179
          "pthread_mutexattr_gettype",
1180
          RetValSpec<IntType>,
1181
          [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1182
      >,
1183
      FunctionSpec<
1184
          "pthread_mutexattr_settype",
1185
          RetValSpec<IntType>,
1186
          [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1187
      >,
1188
      FunctionSpec<
1189
          "pthread_mutexattr_getrobust",
1190
          RetValSpec<IntType>,
1191
          [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1192
      >,
1193
      FunctionSpec<
1194
          "pthread_mutexattr_setrobust",
1195
          RetValSpec<IntType>,
1196
          [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1197
      >,
1198
      FunctionSpec<
1199
          "pthread_mutexattr_getpshared",
1200
          RetValSpec<IntType>,
1201
          [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1202
      >,
1203
      FunctionSpec<
1204
          "pthread_mutexattr_setpshared",
1205
          RetValSpec<IntType>,
1206
          [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1207
      >,
1208
      FunctionSpec<
1209
          "pthread_mutexattr_getprotocol",
1210
          RetValSpec<IntType>,
1211
          [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1212
      >,
1213
      FunctionSpec<
1214
          "pthread_mutexattr_setprotocol",
1215
          RetValSpec<IntType>,
1216
          [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1217
      >,
1218
      FunctionSpec<
1219
          "pthread_mutexattr_getprioceiling",
1220
          RetValSpec<IntType>,
1221
          [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
1222
      >,
1223
      FunctionSpec<
1224
          "pthread_mutexattr_setprioceiling",
1225
          RetValSpec<IntType>,
1226
          [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
1227
      >,
1228
      FunctionSpec<
1229
          "pthread_mutex_init",
1230
          RetValSpec<IntType>,
1231
          [ArgSpec<RestrictedPThreadMutexTPtr>, ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>]
1232
      >,
1233
      FunctionSpec<
1234
          "pthread_mutex_destroy",
1235
          RetValSpec<IntType>,
1236
          [ArgSpec<PThreadMutexTPtr>]
1237
      >,
1238
      FunctionSpec<
1239
          "pthread_mutex_lock",
1240
          RetValSpec<IntType>,
1241
          [ArgSpec<PThreadMutexTPtr>]
1242
      >,
1243
      FunctionSpec<
1244
          "pthread_mutex_unlock",
1245
          RetValSpec<IntType>,
1246
          [ArgSpec<PThreadMutexTPtr>]
1247
      >,
1248
      FunctionSpec<
1249
          "pthread_key_create",
1250
          RetValSpec<IntType>,
1251
          [ArgSpec<PThreadKeyTPtr>, ArgSpec<PThreadTSSDtorT>]
1252
      >,
1253
      FunctionSpec<
1254
          "pthread_key_delete",
1255
          RetValSpec<IntType>,
1256
          [ArgSpec<PThreadKeyT>]
1257
      >,
1258
      FunctionSpec<
1259
          "pthread_getspecific",
1260
          RetValSpec<VoidPtr>,
1261
          [ArgSpec<PThreadKeyT>]
1262
      >,
1263
      FunctionSpec<
1264
          "pthread_setspecific",
1265
          RetValSpec<VoidPtr>,
1266
          [ArgSpec<PThreadKeyT>, ArgSpec<ConstVoidPtr>]
1267
      >,
1268
      FunctionSpec<
1269
          "pthread_once",
1270
          RetValSpec<IntType>,
1271
          [ArgSpec<PThreadOnceTPtr>, ArgSpec<PThreadOnceCallback>]
1272
      >,
1273
      FunctionSpec<
1274
          "pthread_rwlockattr_destroy",
1275
          RetValSpec<IntType>,
1276
          [ArgSpec<PThreadRWLockAttrTPtr>]
1277
      >,
1278
      FunctionSpec<
1279
          "pthread_rwlockattr_getkind_np",
1280
          RetValSpec<IntType>,
1281
          [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntPtr>]
1282
      >,
1283
      FunctionSpec<
1284
          "pthread_rwlockattr_getpshared",
1285
          RetValSpec<IntType>,
1286
          [ArgSpec<ConstPThreadRWLockAttrTPtr>, ArgSpec<IntPtr>]
1287
      >,
1288
      FunctionSpec<
1289
          "pthread_rwlockattr_init",
1290
          RetValSpec<IntType>,
1291
          [ArgSpec<PThreadRWLockAttrTPtr>]
1292
      >,
1293
      FunctionSpec<
1294
          "pthread_rwlockattr_setkind_np",
1295
          RetValSpec<IntType>,
1296
          [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntType>]
1297
      >,
1298
      FunctionSpec<
1299
          "pthread_rwlockattr_setpshared",
1300
          RetValSpec<IntType>,
1301
          [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntType>]
1302
      >,
1303
      FunctionSpec<
1304
        "pthread_rwlock_init",
1305
        RetValSpec<IntType>,
1306
        [ArgSpec<PThreadRWLockTPtr>, ArgSpec<ConstRestrictedPThreadRWLockAttrTPtr>]
1307
      >,
1308
      FunctionSpec<
1309
        "pthread_rwlock_tryrdlock",
1310
        RetValSpec<IntType>,
1311
        [ArgSpec<PThreadRWLockTPtr>]
1312
      >,
1313
      FunctionSpec<
1314
        "pthread_rwlock_trywrlock",
1315
        RetValSpec<IntType>,
1316
        [ArgSpec<PThreadRWLockTPtr>]
1317
      >,
1318
      FunctionSpec<
1319
        "pthread_rwlock_timedrdlock",
1320
        RetValSpec<IntType>,
1321
        [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
1322
      >,
1323
      FunctionSpec<
1324
        "pthread_rwlock_timedwrlock",
1325
        RetValSpec<IntType>,
1326
        [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
1327
      >,
1328
      FunctionSpec<
1329
        "pthread_rwlock_rdlock",
1330
        RetValSpec<IntType>,
1331
        [ArgSpec<PThreadRWLockTPtr>]
1332
      >,
1333
      FunctionSpec<
1334
        "pthread_rwlock_wrlock",
1335
        RetValSpec<IntType>,
1336
        [ArgSpec<PThreadRWLockTPtr>]
1337
      >,
1338
      FunctionSpec<
1339
        "pthread_rwlock_unlock",
1340
        RetValSpec<IntType>,
1341
        [ArgSpec<PThreadRWLockTPtr>]
1342
      >,
1343
      FunctionSpec<
1344
        "pthread_rwlock_destroy",
1345
        RetValSpec<IntType>,
1346
        [ArgSpec<PThreadRWLockTPtr>]
1347
      >,
1348
    ]
1349
  >;
1350

1351
  HeaderSpec StdIO = HeaderSpec<
1352
      "stdio.h",
1353
      [], // Macros
1354
      [OffTType], // Types
1355
      [], // Enumerations
1356
      [
1357
          FunctionSpec<
1358
              "flockfile",
1359
              RetValSpec<VoidType>,
1360
              [ArgSpec<FILEPtr>]
1361
          >,
1362
          FunctionSpec<
1363
              "funlockfile",
1364
              RetValSpec<VoidType>,
1365
              [ArgSpec<FILEPtr>]
1366
          >,
1367
          FunctionSpec<
1368
              "getc_unlocked",
1369
              RetValSpec<IntType>,
1370
              [ArgSpec<FILEPtr>]
1371
          >,
1372
          FunctionSpec<
1373
              "getchar_unlocked",
1374
              RetValSpec<IntType>,
1375
              [ArgSpec<VoidType>]
1376
          >,
1377
          FunctionSpec<
1378
            "fileno",
1379
            RetValSpec<IntType>,
1380
            [ArgSpec<FILEPtr>]
1381
          >,
1382
          FunctionSpec<
1383
            "fdopen",
1384
            RetValSpec<FILEPtr>,
1385
            [ArgSpec<IntType>, ArgSpec<ConstCharPtr>]
1386
          >,
1387
      ]
1388
  >;
1389

1390
  HeaderSpec Dirent = HeaderSpec<
1391
      "dirent.h",
1392
      [], // Macros
1393
      [InoT, StructDirent, DIR], // Types
1394
      [], // Enumerations
1395
      [
1396
          FunctionSpec<
1397
              "alphasort",
1398
              RetValSpec<IntType>,
1399
              [ArgSpec<ConstStructDirentPtrPtr>, ArgSpec<ConstStructDirentPtrPtr>]
1400
          >,
1401
          FunctionSpec<
1402
              "closedir",
1403
              RetValSpec<IntType>,
1404
              [ArgSpec<DIRPtr>]
1405
          >,
1406
          FunctionSpec<
1407
              "dirfd",
1408
              RetValSpec<IntType>,
1409
              [ArgSpec<DIRPtr>]
1410
          >,
1411
          FunctionSpec<
1412
              "fdopendir",
1413
              RetValSpec<DIRPtr>,
1414
              [ArgSpec<IntType>]
1415
          >,
1416
          FunctionSpec<
1417
              "opendir",
1418
              RetValSpec<DIRPtr>,
1419
              [ArgSpec<ConstCharPtr>]
1420
          >,
1421
          FunctionSpec<
1422
              "readdir",
1423
              RetValSpec<StructDirentPtr>,
1424
              [ArgSpec<DIRPtr>]
1425
          >,
1426
      ]
1427
  >;
1428

1429
  HeaderSpec Time = HeaderSpec<
1430
      "time.h",
1431
      [], // Macros
1432
      [ClockIdT, StructTimeSpec, StructTimevalType], // Types
1433
      [], // Enumerations
1434
      [
1435
          FunctionSpec<
1436
              "clock_gettime",
1437
              RetValSpec<IntType>,
1438
              [ArgSpec<ClockIdT>, ArgSpec<StructTimeSpecPtr>]
1439
          >,
1440
          FunctionSpec<
1441
              "gettimeofday",
1442
              RetValSpec<IntType>,
1443
              [ArgSpec<StructTimevalPtr>, ArgSpec<VoidPtr>]
1444
          >,
1445
          FunctionSpec<
1446
              "nanosleep",
1447
              RetValSpec<IntType>,
1448
              [ArgSpec<ConstStructTimeSpecPtr>, ArgSpec<StructTimeSpecPtr>]
1449
          >,
1450
      ]
1451
  >;
1452

1453
  HeaderSpec SysWait = HeaderSpec<
1454
    "sys/wait.h",
1455
    [], // Macros
1456
    [PidT, StructRUsage, SigInfoType],
1457
    [], // Enumerations
1458
    [
1459
      FunctionSpec<
1460
        "wait",
1461
        RetValSpec<PidT>,
1462
        [ArgSpec<IntPtr>]
1463
      >,
1464
      FunctionSpec<
1465
        "waitpid",
1466
        RetValSpec<PidT>,
1467
        [ArgSpec<PidT>, ArgSpec<IntPtr>, ArgSpec<IntType>]
1468
      >
1469
    ]
1470
  >;
1471

1472
  HeaderSpec SysIOctl = HeaderSpec<
1473
    "sys/ioctl.h",
1474
    [
1475
      Macro<"TIOCGETD">,
1476
    ],  // Macros
1477
    [], // Types
1478
    [], // Enumerations
1479
    []  // Functions
1480
  >;
1481

1482
  HeaderSpec Spawn = HeaderSpec<
1483
    "spawn.h",
1484
    [], // Macros
1485
    [ModeTType, PosixSpawnAttrT, PidT, PosixSpawnFileActionsT],
1486
    [], // Enumerations
1487
    [
1488
      FunctionSpec<
1489
        "posix_spawn_file_actions_addclose",
1490
        RetValSpec<IntType>,
1491
        [ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<IntType>]
1492
      >,
1493
      FunctionSpec<
1494
        "posix_spawn_file_actions_adddup2",
1495
        RetValSpec<IntType>,
1496
        [ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<IntType>, ArgSpec<IntType>]
1497
      >,
1498
      FunctionSpec<
1499
        "posix_spawn_file_actions_addopen",
1500
        RetValSpec<IntType>,
1501
        [ArgSpec<PosixSpawnFileActionsTRestrictedPtr>, ArgSpec<IntType>,
1502
         ArgSpec<ConstCharRestrictedPtr>, ArgSpec<IntType>, ArgSpec<ModeTType>]
1503
      >,
1504
      FunctionSpec<
1505
        "posix_spawn_file_actions_destroy",
1506
        RetValSpec<IntType>,
1507
        [ArgSpec<PosixSpawnFileActionsTPtr>]
1508
      >,
1509
      FunctionSpec<
1510
        "posix_spawn_file_actions_init",
1511
        RetValSpec<IntType>,
1512
        [ArgSpec<PosixSpawnFileActionsTPtr>]
1513
      >,
1514
      FunctionSpec<
1515
        "posix_spawn",
1516
        RetValSpec<IntType>,
1517
        [ArgSpec<RestrictedPidTPtr>, ArgSpec<ConstCharRestrictedPtr>,
1518
         ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<RestrictedPosixSpawnAttrTPtrType>,
1519
         ArgSpec<ConstCharRestrictedPtrPtr>, ArgSpec<ConstCharRestrictedPtrPtr>]
1520
      >,
1521
    ]
1522
  >;
1523

1524
  HeaderSpec Search = HeaderSpec<
1525
    "search.h",
1526
    [], // Macros
1527
    [
1528
        ActionType,
1529
        EntryType
1530
    ], // Types
1531
    [], // Enumerations
1532
    [
1533
        FunctionSpec<
1534
            "hcreate",
1535
            RetValSpec<IntType>,
1536
            [
1537
                ArgSpec<SizeTType>
1538
            ]
1539
        >,
1540
        FunctionSpec<
1541
            "hdestroy",
1542
            RetValSpec<VoidType>,
1543
            [] // Args
1544
        >,
1545
        FunctionSpec<
1546
            "hsearch",
1547
            RetValSpec<EntryTypePtr>,
1548
            [
1549
                ArgSpec<EntryType>,
1550
                ArgSpec<ActionType>
1551
            ]
1552
        >,
1553
        FunctionSpec<
1554
            "insque",
1555
            RetValSpec<VoidType>,
1556
            [
1557
                ArgSpec<VoidPtr>,
1558
                ArgSpec<VoidPtr>
1559
            ]
1560
        >,
1561
        FunctionSpec<
1562
            "remque",
1563
            RetValSpec<VoidType>,
1564
            [
1565
                ArgSpec<VoidPtr>
1566
            ]
1567
        >,
1568
    ]
1569
  >;
1570

1571
  HeaderSpec Termios = HeaderSpec<
1572
    "termios.h",
1573
    [
1574
      Macro<"NCCS">,
1575
    ],
1576
    [CcT, PidT, SpeedT, StructTermios, TcFlagT], // Types
1577
    [], // Enumerations
1578
    [
1579
      FunctionSpec<
1580
        "cfgetispeed",
1581
        RetValSpec<SpeedT>,
1582
        [ArgSpec<ConstStructTermiosPtr>]
1583
      >,
1584
      FunctionSpec<
1585
        "cfgetospeed",
1586
        RetValSpec<SpeedT>,
1587
        [ArgSpec<ConstStructTermiosPtr>]
1588
      >,
1589
      FunctionSpec<
1590
        "cfsetispeed",
1591
        RetValSpec<SpeedT>,
1592
        [ArgSpec<StructTermiosPtr>, ArgSpec<SpeedT>]
1593
      >,
1594
      FunctionSpec<
1595
        "cfsetospeed",
1596
        RetValSpec<SpeedT>,
1597
        [ArgSpec<StructTermiosPtr>, ArgSpec<SpeedT>]
1598
      >,
1599
      FunctionSpec<
1600
        "tcdrain",
1601
        RetValSpec<IntType>,
1602
        [ArgSpec<IntType>]
1603
      >,
1604
      FunctionSpec<
1605
        "tcflow",
1606
        RetValSpec<IntType>,
1607
        [ArgSpec<IntType>, ArgSpec<IntType>]
1608
      >,
1609
      FunctionSpec<
1610
        "tcflush",
1611
        RetValSpec<IntType>,
1612
        [ArgSpec<IntType>, ArgSpec<IntType>]
1613
      >,
1614
      FunctionSpec<
1615
        "tcgetattr",
1616
        RetValSpec<IntType>,
1617
        [ArgSpec<IntType>, ArgSpec<StructTermiosPtr>]
1618
      >,
1619
      FunctionSpec<
1620
        "tcgetsid",
1621
        RetValSpec<PidT>,
1622
        [ArgSpec<IntType>]
1623
      >,
1624
      FunctionSpec<
1625
        "tcsendbreak",
1626
        RetValSpec<IntType>,
1627
        [ArgSpec<IntType>, ArgSpec<IntType>]
1628
      >,
1629
      FunctionSpec<
1630
        "tcsetattr",
1631
        RetValSpec<IntType>,
1632
        [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<StructTermiosPtr>]
1633
      >,
1634
    ]
1635
  >;
1636

1637
  HeaderSpec SysSelect = HeaderSpec<
1638
    "sys/select.h",
1639
    [], // Macros
1640
    [FdSet, SigSetType, StructTimevalType, StructTimeSpec, SuSecondsT, TimeTType],
1641
    [], // Enumerations
1642
    [
1643
      FunctionSpec<
1644
        "select",
1645
        RetValSpec<IntType>,
1646
        [
1647
            ArgSpec<IntType>, ArgSpec<RestrictedFdSetPtr>, ArgSpec<RestrictedFdSetPtr>,
1648
            ArgSpec<RestrictedFdSetPtr>, ArgSpec<RestrictedStructTimevalPtr>
1649
        ]
1650
      >
1651
    ]
1652
  >;
1653

1654
  HeaderSpec SysSocket = HeaderSpec<
1655
      "sys/socket.h",
1656
      [
1657
        Macro<"AF_UNSPEC">,
1658
        Macro<"AF_UNIX">,
1659
        Macro<"AF_LOCAL">,
1660
        Macro<"AF_INET">,
1661
        Macro<"AF_INET6">,
1662
        Macro<"SOCK_STREAM">,
1663
        Macro<"SOCK_DGRAM">,
1664
        Macro<"SOCK_RAW">,
1665
        Macro<"SOCK_RDM">,
1666
        Macro<"SOCK_SEQPACKET">,
1667
        Macro<"SOCK_PACKET">,
1668
      ], // Macros
1669
      [
1670
        SAFamilyType,
1671
        StructSockAddr,
1672
        StructSockAddrUn,
1673
        SocklenType,
1674
      ], // Types
1675
      [], // Enumerations
1676
      [
1677
        FunctionSpec<
1678
          "socket",
1679
          RetValSpec<IntType>,
1680
          [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
1681
        >,
1682
        FunctionSpec<
1683
          "bind",
1684
          RetValSpec<IntType>,
1685
          [ArgSpec<IntType>, ArgSpec<ConstStructSockAddrPtr>, ArgSpec<SocklenType>]
1686
        >,
1687
      ]  // Functions
1688
  >;
1689

1690
  HeaderSpec SysTypes = HeaderSpec<
1691
    "sys/types.h",
1692
    [], // Macros
1693
    [
1694
      BlkCntT,
1695
      BlkSizeT,
1696
      ClockIdT,
1697
      DevT,
1698
      GidT,
1699
      InoT,
1700
      ModeTType,
1701
      NLinkT,
1702
      OffTType,
1703
      PThreadAttrTType,
1704
      PThreadCondAttrTType,
1705
      PThreadKeyT,
1706
      PThreadMutexAttrTType,
1707
      PThreadMutexTType,
1708
      PThreadOnceT,
1709
      PThreadRWLockAttrTType,
1710
      PThreadRWLockTType,
1711
      PThreadTType,
1712
      PidT,
1713
      SSizeTType,
1714
      SizeTType,
1715
      SuSecondsT,
1716
      TimeTType,
1717
      UidT
1718
    ], // Types
1719
    [], // Enumerations
1720
    []  // Functions
1721
  >;
1722

1723
  let Headers = [
1724
    ArpaInet,
1725
    CType,
1726
    Dirent,
1727
    DlFcn,
1728
    Errno,
1729
    FCntl,
1730
    PThread,
1731
    Sched,
1732
    Signal,
1733
    Spawn,
1734
    StdIO,
1735
    StdLib,
1736
    SysIOctl,
1737
    SysMMan,
1738
    SysResource,
1739
    SysSelect,
1740
    SysSocket,
1741
    SysStat,
1742
    SysStatvfs,
1743
    SysTypes,
1744
    SysUtsName,
1745
    SysWait,
1746
    Time,
1747
    Termios,
1748
    UniStd,
1749
    String,
1750
    Search,
1751
  ];
1752
}
1753

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.