xref: /aosp_15_r20/external/cronet/third_party/rust/chromium_crates_io/vendor/libc-0.2.153/src/teeos/mod.rs (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 //! Libc bindings for teeos
2 //!
3 //! Apparently the loader just dynamically links it anyway, but fails
4 //! when linking is explicitly requested.
5 #![allow(non_camel_case_types)]
6 #![allow(non_snake_case)]
7 
8 // only supported on Rust > 1.59, so we can directly reexport c_void from core.
9 pub use core::ffi::c_void;
10 
11 use Option;
12 
13 pub type c_schar = i8;
14 
15 pub type c_uchar = u8;
16 
17 pub type c_short = i16;
18 
19 pub type c_ushort = u16;
20 
21 pub type c_int = i32;
22 
23 pub type c_uint = u32;
24 
25 pub type c_bool = i32;
26 
27 pub type c_float = f32;
28 
29 pub type c_double = f64;
30 
31 pub type c_longlong = i64;
32 
33 pub type c_ulonglong = u64;
34 
35 pub type intmax_t = i64;
36 
37 pub type uintmax_t = u64;
38 
39 pub type size_t = usize;
40 
41 pub type ptrdiff_t = isize;
42 
43 pub type intptr_t = isize;
44 
45 pub type uintptr_t = usize;
46 
47 pub type ssize_t = isize;
48 
49 pub type pid_t = c_int;
50 
51 // aarch64 specifc
52 pub type c_char = u8;
53 
54 pub type wchar_t = u32;
55 
56 pub type c_long = i64;
57 
58 pub type c_ulong = u64;
59 
60 #[repr(align(16))]
61 pub struct _CLongDouble(pub u128);
62 
63 // long double in C means A float point value, which has 128bit length.
64 // but some bit maybe not used, so the really length of long double could be 80(x86) or 128(power pc/IEEE)
65 // this is different from f128(not stable and not included default) in Rust, so we use u128 for FFI(Rust to C).
66 // this is unstable and will couse to memfault/data abort.
67 pub type c_longdouble = _CLongDouble;
68 
69 pub type pthread_t = c_ulong;
70 
71 pub type pthread_key_t = c_uint;
72 
73 pub type pthread_spinlock_t = c_int;
74 
75 pub type off_t = i64;
76 
77 pub type time_t = c_long;
78 
79 pub type clock_t = c_long;
80 
81 pub type clockid_t = c_int;
82 
83 pub type suseconds_t = c_long;
84 
85 pub type once_fn = extern "C" fn() -> c_void;
86 
87 pub type pthread_once_t = c_int;
88 
89 pub type va_list = *mut c_char;
90 
91 pub type wint_t = c_uint;
92 
93 pub type wctype_t = c_ulong;
94 
95 pub type cmpfunc = extern "C" fn(x: *const c_void, y: *const c_void) -> c_int;
96 
97 #[repr(align(8))]
98 #[repr(C)]
99 pub struct pthread_cond_t {
100     #[doc(hidden)]
101     size: [u8; __SIZEOF_PTHREAD_COND_T],
102 }
103 
104 #[repr(align(8))]
105 #[repr(C)]
106 pub struct pthread_mutex_t {
107     #[doc(hidden)]
108     size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
109 }
110 
111 #[repr(align(4))]
112 #[repr(C)]
113 pub struct pthread_mutexattr_t {
114     #[doc(hidden)]
115     size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
116 }
117 
118 #[repr(align(4))]
119 #[repr(C)]
120 pub struct pthread_condattr_t {
121     #[doc(hidden)]
122     size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
123 }
124 
125 #[repr(C)]
126 pub struct pthread_attr_t {
127     __size: [u64; 7],
128 }
129 
130 #[repr(C)]
131 pub struct cpu_set_t {
132     bits: [c_ulong; 128 / core::mem::size_of::<c_ulong>()],
133 }
134 
135 #[repr(C)]
136 pub struct timespec {
137     pub tv_sec: time_t,
138     pub tv_nsec: c_long,
139 }
140 
141 #[repr(C)]
142 pub struct timeval {
143     pub tv_sec: time_t,
144     pub tv_usec: suseconds_t,
145 }
146 
147 #[repr(C)]
148 pub struct tm {
149     pub tm_sec: c_int,
150     pub tm_min: c_int,
151     pub tm_hour: c_int,
152     pub tm_mday: c_int,
153     pub tm_mon: c_int,
154     pub tm_year: c_int,
155     pub tm_wday: c_int,
156     pub tm_yday: c_int,
157     pub tm_isdst: c_int,
158     pub __tm_gmtoff: c_long,
159     pub __tm_zone: *const c_char,
160 }
161 
162 #[repr(C)]
163 pub struct mbstate_t {
164     pub __opaque1: c_uint,
165     pub __opaque2: c_uint,
166 }
167 
168 #[repr(C)]
169 pub struct sem_t {
170     pub __val: [c_int; 4 * core::mem::size_of::<c_long>() / core::mem::size_of::<c_int>()],
171 }
172 
173 #[repr(C)]
174 pub struct div_t {
175     pub quot: c_int,
176     pub rem: c_int,
177 }
178 
179 // fcntl
180 pub const O_CREAT: u32 = 0100;
181 
182 pub const O_EXCL: u32 = 0200;
183 
184 pub const O_NOCTTY: u32 = 0400;
185 
186 pub const O_TRUNC: u32 = 01000;
187 
188 pub const O_APPEND: u32 = 02000;
189 
190 pub const O_NONBLOCK: u32 = 04000;
191 
192 pub const O_DSYNC: u32 = 010000;
193 
194 pub const O_SYNC: u32 = 04010000;
195 
196 pub const O_RSYNC: u32 = 04010000;
197 
198 pub const O_DIRECTORY: u32 = 0200000;
199 
200 pub const O_NOFOLLOW: u32 = 0400000;
201 
202 pub const O_CLOEXEC: u32 = 02000000;
203 
204 pub const O_ASYNC: u32 = 020000;
205 
206 pub const O_DIRECT: u32 = 040000;
207 
208 pub const O_LARGEFILE: u32 = 0100000;
209 
210 pub const O_NOATIME: u32 = 01000000;
211 
212 pub const O_PATH: u32 = 010000000;
213 
214 pub const O_TMPFILE: u32 = 020200000;
215 
216 pub const O_NDELAY: u32 = O_NONBLOCK;
217 
218 pub const F_DUPFD: u32 = 0;
219 
220 pub const F_GETFD: u32 = 1;
221 
222 pub const F_SETFD: u32 = 2;
223 
224 pub const F_GETFL: u32 = 3;
225 
226 pub const F_SETFL: u32 = 4;
227 
228 pub const F_SETOWN: u32 = 8;
229 
230 pub const F_GETOWN: u32 = 9;
231 
232 pub const F_SETSIG: u32 = 10;
233 
234 pub const F_GETSIG: u32 = 11;
235 
236 pub const F_GETLK: u32 = 12;
237 
238 pub const F_SETLK: u32 = 13;
239 
240 pub const F_SETLKW: u32 = 14;
241 
242 pub const F_SETOWN_EX: u32 = 15;
243 
244 pub const F_GETOWN_EX: u32 = 16;
245 
246 pub const F_GETOWNER_UIDS: u32 = 17;
247 
248 // mman
249 pub const MAP_FAILED: u64 = 0xffffffffffffffff;
250 
251 pub const MAP_FIXED_NOREPLACE: u32 = 0x100000;
252 
253 pub const MAP_SHARED_VALIDATE: u32 = 0x03;
254 
255 pub const MAP_SHARED: u32 = 0x01;
256 
257 pub const MAP_PRIVATE: u32 = 0x02;
258 
259 pub const MAP_TYPE: u32 = 0x0f;
260 
261 pub const MAP_FIXED: u32 = 0x10;
262 
263 pub const MAP_ANON: u32 = 0x20;
264 
265 pub const MAP_ANONYMOUS: u32 = MAP_ANON;
266 
267 pub const MAP_NORESERVE: u32 = 0x4000;
268 
269 pub const MAP_GROWSDOWN: u32 = 0x0100;
270 
271 pub const MAP_DENYWRITE: u32 = 0x0800;
272 
273 pub const MAP_EXECUTABLE: u32 = 0x1000;
274 
275 pub const MAP_LOCKED: u32 = 0x2000;
276 
277 pub const MAP_POPULATE: u32 = 0x8000;
278 
279 pub const MAP_NONBLOCK: u32 = 0x10000;
280 
281 pub const MAP_STACK: u32 = 0x20000;
282 
283 pub const MAP_HUGETLB: u32 = 0x40000;
284 
285 pub const MAP_SYNC: u32 = 0x80000;
286 
287 pub const MAP_FILE: u32 = 0;
288 
289 pub const MAP_HUGE_SHIFT: u32 = 26;
290 
291 pub const MAP_HUGE_MASK: u32 = 0x3f;
292 
293 pub const MAP_HUGE_16KB: u32 = 14 << 26;
294 
295 pub const MAP_HUGE_64KB: u32 = 16 << 26;
296 
297 pub const MAP_HUGE_512KB: u32 = 19 << 26;
298 
299 pub const MAP_HUGE_1MB: u32 = 20 << 26;
300 
301 pub const MAP_HUGE_2MB: u32 = 21 << 26;
302 
303 pub const MAP_HUGE_8MB: u32 = 23 << 26;
304 
305 pub const MAP_HUGE_16MB: u32 = 24 << 26;
306 
307 pub const MAP_HUGE_32MB: u32 = 25 << 26;
308 
309 pub const MAP_HUGE_256MB: u32 = 28 << 26;
310 
311 pub const MAP_HUGE_512MB: u32 = 29 << 26;
312 
313 pub const MAP_HUGE_1GB: u32 = 30 << 26;
314 
315 pub const MAP_HUGE_2GB: u32 = 31 << 26;
316 
317 pub const MAP_HUGE_16GB: u32 = 34u32 << 26;
318 
319 pub const PROT_NONE: u32 = 0;
320 
321 pub const PROT_READ: u32 = 1;
322 
323 pub const PROT_WRITE: u32 = 2;
324 
325 pub const PROT_EXEC: u32 = 4;
326 
327 pub const PROT_GROWSDOWN: u32 = 0x01000000;
328 
329 pub const PROT_GROWSUP: u32 = 0x02000000;
330 
331 pub const MS_ASYNC: u32 = 1;
332 
333 pub const MS_INVALIDATE: u32 = 2;
334 
335 pub const MS_SYNC: u32 = 4;
336 
337 pub const MCL_CURRENT: u32 = 1;
338 
339 pub const MCL_FUTURE: u32 = 2;
340 
341 pub const MCL_ONFAULT: u32 = 4;
342 
343 pub const POSIX_MADV_NORMAL: u32 = 0;
344 
345 pub const POSIX_MADV_RANDOM: u32 = 1;
346 
347 pub const POSIX_MADV_SEQUENTIAL: u32 = 2;
348 
349 pub const POSIX_MADV_WILLNEED: u32 = 3;
350 
351 pub const POSIX_MADV_DONTNEED: u32 = 4;
352 
353 // wctype
354 pub const WCTYPE_ALNUM: u64 = 1;
355 
356 pub const WCTYPE_ALPHA: u64 = 2;
357 
358 pub const WCTYPE_BLANK: u64 = 3;
359 
360 pub const WCTYPE_CNTRL: u64 = 4;
361 
362 pub const WCTYPE_DIGIT: u64 = 5;
363 
364 pub const WCTYPE_GRAPH: u64 = 6;
365 
366 pub const WCTYPE_LOWER: u64 = 7;
367 
368 pub const WCTYPE_PRINT: u64 = 8;
369 
370 pub const WCTYPE_PUNCT: u64 = 9;
371 
372 pub const WCTYPE_SPACE: u64 = 10;
373 
374 pub const WCTYPE_UPPER: u64 = 11;
375 
376 pub const WCTYPE_XDIGIT: u64 = 12;
377 
378 // locale
379 pub const LC_CTYPE: i32 = 0;
380 
381 pub const LC_NUMERIC: i32 = 1;
382 
383 pub const LC_TIME: i32 = 2;
384 
385 pub const LC_COLLATE: i32 = 3;
386 
387 pub const LC_MONETARY: i32 = 4;
388 
389 pub const LC_MESSAGES: i32 = 5;
390 
391 pub const LC_ALL: i32 = 6;
392 
393 // pthread
394 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
395 
396 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
397 
398 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
399 
400 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
401 
402 // errno.h
403 pub const EPERM: c_int = 1;
404 
405 pub const ENOENT: c_int = 2;
406 
407 pub const ESRCH: c_int = 3;
408 
409 pub const EINTR: c_int = 4;
410 
411 pub const EIO: c_int = 5;
412 
413 pub const ENXIO: c_int = 6;
414 
415 pub const E2BIG: c_int = 7;
416 
417 pub const ENOEXEC: c_int = 8;
418 
419 pub const EBADF: c_int = 9;
420 
421 pub const ECHILD: c_int = 10;
422 
423 pub const EAGAIN: c_int = 11;
424 
425 pub const ENOMEM: c_int = 12;
426 
427 pub const EACCES: c_int = 13;
428 
429 pub const EFAULT: c_int = 14;
430 
431 pub const ENOTBLK: c_int = 15;
432 
433 pub const EBUSY: c_int = 16;
434 
435 pub const EEXIST: c_int = 17;
436 
437 pub const EXDEV: c_int = 18;
438 
439 pub const ENODEV: c_int = 19;
440 
441 pub const ENOTDIR: c_int = 20;
442 
443 pub const EISDIR: c_int = 21;
444 
445 pub const EINVAL: c_int = 22;
446 
447 pub const ENFILE: c_int = 23;
448 
449 pub const EMFILE: c_int = 24;
450 
451 pub const ENOTTY: c_int = 25;
452 
453 pub const ETXTBSY: c_int = 26;
454 
455 pub const EFBIG: c_int = 27;
456 
457 pub const ENOSPC: c_int = 28;
458 
459 pub const ESPIPE: c_int = 29;
460 
461 pub const EROFS: c_int = 30;
462 
463 pub const EMLINK: c_int = 31;
464 
465 pub const EPIPE: c_int = 32;
466 
467 pub const EDOM: c_int = 33;
468 
469 pub const ERANGE: c_int = 34;
470 
471 pub const EDEADLK: c_int = 35;
472 
473 pub const ENAMETOOLONG: c_int = 36;
474 
475 pub const ENOLCK: c_int = 37;
476 
477 pub const ENOSYS: c_int = 38;
478 
479 pub const ENOTEMPTY: c_int = 39;
480 
481 pub const ELOOP: c_int = 40;
482 
483 pub const EWOULDBLOCK: c_int = EAGAIN;
484 
485 pub const ENOMSG: c_int = 42;
486 
487 pub const EIDRM: c_int = 43;
488 
489 pub const ECHRNG: c_int = 44;
490 
491 pub const EL2NSYNC: c_int = 45;
492 
493 pub const EL3HLT: c_int = 46;
494 
495 pub const EL3RST: c_int = 47;
496 
497 pub const ELNRNG: c_int = 48;
498 
499 pub const EUNATCH: c_int = 49;
500 
501 pub const ENOCSI: c_int = 50;
502 
503 pub const EL2HLT: c_int = 51;
504 
505 pub const EBADE: c_int = 52;
506 
507 pub const EBADR: c_int = 53;
508 
509 pub const EXFULL: c_int = 54;
510 
511 pub const ENOANO: c_int = 55;
512 
513 pub const EBADRQC: c_int = 56;
514 
515 pub const EBADSLT: c_int = 57;
516 
517 pub const EDEADLOCK: c_int = EDEADLK;
518 
519 pub const EBFONT: c_int = 59;
520 
521 pub const ENOSTR: c_int = 60;
522 
523 pub const ENODATA: c_int = 61;
524 
525 pub const ETIME: c_int = 62;
526 
527 pub const ENOSR: c_int = 63;
528 
529 pub const ENONET: c_int = 64;
530 
531 pub const ENOPKG: c_int = 65;
532 
533 pub const EREMOTE: c_int = 66;
534 
535 pub const ENOLINK: c_int = 67;
536 
537 pub const EADV: c_int = 68;
538 
539 pub const ESRMNT: c_int = 69;
540 
541 pub const ECOMM: c_int = 70;
542 
543 pub const EPROTO: c_int = 71;
544 
545 pub const EMULTIHOP: c_int = 72;
546 
547 pub const EDOTDOT: c_int = 73;
548 
549 pub const EBADMSG: c_int = 74;
550 
551 pub const EOVERFLOW: c_int = 75;
552 
553 pub const ENOTUNIQ: c_int = 76;
554 
555 pub const EBADFD: c_int = 77;
556 
557 pub const EREMCHG: c_int = 78;
558 
559 pub const ELIBACC: c_int = 79;
560 
561 pub const ELIBBAD: c_int = 80;
562 
563 pub const ELIBSCN: c_int = 81;
564 
565 pub const ELIBMAX: c_int = 82;
566 
567 pub const ELIBEXEC: c_int = 83;
568 
569 pub const EILSEQ: c_int = 84;
570 
571 pub const ERESTART: c_int = 85;
572 
573 pub const ESTRPIPE: c_int = 86;
574 
575 pub const EUSERS: c_int = 87;
576 
577 pub const ENOTSOCK: c_int = 88;
578 
579 pub const EDESTADDRREQ: c_int = 89;
580 
581 pub const EMSGSIZE: c_int = 90;
582 
583 pub const EPROTOTYPE: c_int = 91;
584 
585 pub const ENOPROTOOPT: c_int = 92;
586 
587 pub const EPROTONOSUPPOR: c_int = 93;
588 
589 pub const ESOCKTNOSUPPOR: c_int = 94;
590 
591 pub const EOPNOTSUPP: c_int = 95;
592 
593 pub const ENOTSUP: c_int = EOPNOTSUPP;
594 
595 pub const EPFNOSUPPORT: c_int = 96;
596 
597 pub const EAFNOSUPPORT: c_int = 97;
598 
599 pub const EADDRINUSE: c_int = 98;
600 
601 pub const EADDRNOTAVAIL: c_int = 99;
602 
603 pub const ENETDOWN: c_int = 100;
604 
605 pub const ENETUNREACH: c_int = 101;
606 
607 pub const ENETRESET: c_int = 102;
608 
609 pub const ECONNABORTED: c_int = 103;
610 
611 pub const ECONNRESET: c_int = 104;
612 
613 pub const ENOBUFS: c_int = 105;
614 
615 pub const EISCONN: c_int = 106;
616 
617 pub const ENOTCONN: c_int = 107;
618 
619 pub const ESHUTDOWN: c_int = 108;
620 
621 pub const ETOOMANYREFS: c_int = 109;
622 
623 pub const ETIMEDOUT: c_int = 110;
624 
625 pub const ECONNREFUSED: c_int = 111;
626 
627 pub const EHOSTDOWN: c_int = 112;
628 
629 pub const EHOSTUNREACH: c_int = 113;
630 
631 pub const EALREADY: c_int = 114;
632 
633 pub const EINPROGRESS: c_int = 115;
634 
635 pub const ESTALE: c_int = 116;
636 
637 pub const EUCLEAN: c_int = 117;
638 
639 pub const ENOTNAM: c_int = 118;
640 
641 pub const ENAVAIL: c_int = 119;
642 
643 pub const EISNAM: c_int = 120;
644 
645 pub const EREMOTEIO: c_int = 121;
646 
647 pub const EDQUOT: c_int = 122;
648 
649 pub const ENOMEDIUM: c_int = 123;
650 
651 pub const EMEDIUMTYPE: c_int = 124;
652 
653 pub const ECANCELED: c_int = 125;
654 
655 pub const ENOKEY: c_int = 126;
656 
657 pub const EKEYEXPIRED: c_int = 127;
658 
659 pub const EKEYREVOKED: c_int = 128;
660 
661 pub const EKEYREJECTED: c_int = 129;
662 
663 pub const EOWNERDEAD: c_int = 130;
664 
665 pub const ENOTRECOVERABLE: c_int = 131;
666 
667 pub const ERFKILL: c_int = 132;
668 
669 pub const EHWPOISON: c_int = 133;
670 
671 // pthread_attr.h
672 pub const TEESMP_THREAD_ATTR_CA_WILDCARD: c_int = 0;
673 
674 pub const TEESMP_THREAD_ATTR_CA_INHERIT: c_int = -1;
675 
676 pub const TEESMP_THREAD_ATTR_TASK_ID_INHERIT: c_int = -1;
677 
678 pub const TEESMP_THREAD_ATTR_HAS_SHADOW: c_int = 0x1;
679 
680 pub const TEESMP_THREAD_ATTR_NO_SHADOW: c_int = 0x0;
681 
682 // unistd.h
683 pub const _SC_ARG_MAX: c_int = 0;
684 
685 pub const _SC_CHILD_MAX: c_int = 1;
686 
687 pub const _SC_CLK_TCK: c_int = 2;
688 
689 pub const _SC_NGROUPS_MAX: c_int = 3;
690 
691 pub const _SC_OPEN_MAX: c_int = 4;
692 
693 pub const _SC_STREAM_MAX: c_int = 5;
694 
695 pub const _SC_TZNAME_MAX: c_int = 6;
696 
697 pub const _SC_JOB_CONTROL: c_int = 7;
698 
699 pub const _SC_SAVED_IDS: c_int = 8;
700 
701 pub const _SC_REALTIME_SIGNALS: c_int = 9;
702 
703 pub const _SC_PRIORITY_SCHEDULING: c_int = 10;
704 
705 pub const _SC_TIMERS: c_int = 11;
706 
707 pub const _SC_ASYNCHRONOUS_IO: c_int = 12;
708 
709 pub const _SC_PRIORITIZED_IO: c_int = 13;
710 
711 pub const _SC_SYNCHRONIZED_IO: c_int = 14;
712 
713 pub const _SC_FSYNC: c_int = 15;
714 
715 pub const _SC_MAPPED_FILES: c_int = 16;
716 
717 pub const _SC_MEMLOCK: c_int = 17;
718 
719 pub const _SC_MEMLOCK_RANGE: c_int = 18;
720 
721 pub const _SC_MEMORY_PROTECTION: c_int = 19;
722 
723 pub const _SC_MESSAGE_PASSING: c_int = 20;
724 
725 pub const _SC_SEMAPHORES: c_int = 21;
726 
727 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 22;
728 
729 pub const _SC_AIO_LISTIO_MAX: c_int = 23;
730 
731 pub const _SC_AIO_MAX: c_int = 24;
732 
733 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 25;
734 
735 pub const _SC_DELAYTIMER_MAX: c_int = 26;
736 
737 pub const _SC_MQ_OPEN_MAX: c_int = 27;
738 
739 pub const _SC_MQ_PRIO_MAX: c_int = 28;
740 
741 pub const _SC_VERSION: c_int = 29;
742 
743 pub const _SC_PAGE_SIZE: c_int = 30;
744 
745 pub const _SC_PAGESIZE: c_int = 30; /* !! */
746 
747 pub const _SC_RTSIG_MAX: c_int = 31;
748 
749 pub const _SC_SEM_NSEMS_MAX: c_int = 32;
750 
751 pub const _SC_SEM_VALUE_MAX: c_int = 33;
752 
753 pub const _SC_SIGQUEUE_MAX: c_int = 34;
754 
755 pub const _SC_TIMER_MAX: c_int = 35;
756 
757 pub const _SC_BC_BASE_MAX: c_int = 36;
758 
759 pub const _SC_BC_DIM_MAX: c_int = 37;
760 
761 pub const _SC_BC_SCALE_MAX: c_int = 38;
762 
763 pub const _SC_BC_STRING_MAX: c_int = 39;
764 
765 pub const _SC_COLL_WEIGHTS_MAX: c_int = 40;
766 
767 pub const _SC_EXPR_NEST_MAX: c_int = 42;
768 
769 pub const _SC_LINE_MAX: c_int = 43;
770 
771 pub const _SC_RE_DUP_MAX: c_int = 44;
772 
773 pub const _SC_2_VERSION: c_int = 46;
774 
775 pub const _SC_2_C_BIND: c_int = 47;
776 
777 pub const _SC_2_C_DEV: c_int = 48;
778 
779 pub const _SC_2_FORT_DEV: c_int = 49;
780 
781 pub const _SC_2_FORT_RUN: c_int = 50;
782 
783 pub const _SC_2_SW_DEV: c_int = 51;
784 
785 pub const _SC_2_LOCALEDEF: c_int = 52;
786 
787 pub const _SC_UIO_MAXIOV: c_int = 60; /* !! */
788 
789 pub const _SC_IOV_MAX: c_int = 60;
790 
791 pub const _SC_THREADS: c_int = 67;
792 
793 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 68;
794 
795 pub const _SC_GETGR_R_SIZE_MAX: c_int = 69;
796 
797 pub const _SC_GETPW_R_SIZE_MAX: c_int = 70;
798 
799 pub const _SC_LOGIN_NAME_MAX: c_int = 71;
800 
801 pub const _SC_TTY_NAME_MAX: c_int = 72;
802 
803 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 73;
804 
805 pub const _SC_THREAD_KEYS_MAX: c_int = 74;
806 
807 pub const _SC_THREAD_STACK_MIN: c_int = 75;
808 
809 pub const _SC_THREAD_THREADS_MAX: c_int = 76;
810 
811 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77;
812 
813 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78;
814 
815 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 79;
816 
817 pub const _SC_THREAD_PRIO_INHERIT: c_int = 80;
818 
819 pub const _SC_THREAD_PRIO_PROTECT: c_int = 81;
820 
821 pub const _SC_THREAD_PROCESS_SHARED: c_int = 82;
822 
823 pub const _SC_NPROCESSORS_CONF: c_int = 83;
824 
825 pub const _SC_NPROCESSORS_ONLN: c_int = 84;
826 
827 pub const _SC_PHYS_PAGES: c_int = 85;
828 
829 pub const _SC_AVPHYS_PAGES: c_int = 86;
830 
831 pub const _SC_ATEXIT_MAX: c_int = 87;
832 
833 pub const _SC_PASS_MAX: c_int = 88;
834 
835 pub const _SC_XOPEN_VERSION: c_int = 89;
836 
837 pub const _SC_XOPEN_XCU_VERSION: c_int = 90;
838 
839 pub const _SC_XOPEN_UNIX: c_int = 91;
840 
841 pub const _SC_XOPEN_CRYPT: c_int = 92;
842 
843 pub const _SC_XOPEN_ENH_I18N: c_int = 93;
844 
845 pub const _SC_XOPEN_SHM: c_int = 94;
846 
847 pub const _SC_2_CHAR_TERM: c_int = 95;
848 
849 pub const _SC_2_UPE: c_int = 97;
850 
851 pub const _SC_XOPEN_XPG2: c_int = 98;
852 
853 pub const _SC_XOPEN_XPG3: c_int = 99;
854 
855 pub const _SC_XOPEN_XPG4: c_int = 100;
856 
857 pub const _SC_NZERO: c_int = 109;
858 
859 pub const _SC_XBS5_ILP32_OFF32: c_int = 125;
860 
861 pub const _SC_XBS5_ILP32_OFFBIG: c_int = 126;
862 
863 pub const _SC_XBS5_LP64_OFF64: c_int = 127;
864 
865 pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 128;
866 
867 pub const _SC_XOPEN_LEGACY: c_int = 129;
868 
869 pub const _SC_XOPEN_REALTIME: c_int = 130;
870 
871 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 131;
872 
873 pub const _SC_ADVISORY_INFO: c_int = 132;
874 
875 pub const _SC_BARRIERS: c_int = 133;
876 
877 pub const _SC_CLOCK_SELECTION: c_int = 137;
878 
879 pub const _SC_CPUTIME: c_int = 138;
880 
881 pub const _SC_THREAD_CPUTIME: c_int = 139;
882 
883 pub const _SC_MONOTONIC_CLOCK: c_int = 149;
884 
885 pub const _SC_READER_WRITER_LOCKS: c_int = 153;
886 
887 pub const _SC_SPIN_LOCKS: c_int = 154;
888 
889 pub const _SC_REGEXP: c_int = 155;
890 
891 pub const _SC_SHELL: c_int = 157;
892 
893 pub const _SC_SPAWN: c_int = 159;
894 
895 pub const _SC_SPORADIC_SERVER: c_int = 160;
896 
897 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 161;
898 
899 pub const _SC_TIMEOUTS: c_int = 164;
900 
901 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 165;
902 
903 pub const _SC_2_PBS: c_int = 168;
904 
905 pub const _SC_2_PBS_ACCOUNTING: c_int = 169;
906 
907 pub const _SC_2_PBS_LOCATE: c_int = 170;
908 
909 pub const _SC_2_PBS_MESSAGE: c_int = 171;
910 
911 pub const _SC_2_PBS_TRACK: c_int = 172;
912 
913 pub const _SC_SYMLOOP_MAX: c_int = 173;
914 
915 pub const _SC_STREAMS: c_int = 174;
916 
917 pub const _SC_2_PBS_CHECKPOINT: c_int = 175;
918 
919 pub const _SC_V6_ILP32_OFF32: c_int = 176;
920 
921 pub const _SC_V6_ILP32_OFFBIG: c_int = 177;
922 
923 pub const _SC_V6_LP64_OFF64: c_int = 178;
924 
925 pub const _SC_V6_LPBIG_OFFBIG: c_int = 179;
926 
927 pub const _SC_HOST_NAME_MAX: c_int = 180;
928 
929 pub const _SC_TRACE: c_int = 181;
930 
931 pub const _SC_TRACE_EVENT_FILTER: c_int = 182;
932 
933 pub const _SC_TRACE_INHERIT: c_int = 183;
934 
935 pub const _SC_TRACE_LOG: c_int = 184;
936 
937 pub const _SC_IPV6: c_int = 235;
938 
939 pub const _SC_RAW_SOCKETS: c_int = 236;
940 
941 pub const _SC_V7_ILP32_OFF32: c_int = 237;
942 
943 pub const _SC_V7_ILP32_OFFBIG: c_int = 238;
944 
945 pub const _SC_V7_LP64_OFF64: c_int = 239;
946 
947 pub const _SC_V7_LPBIG_OFFBIG: c_int = 240;
948 
949 pub const _SC_SS_REPL_MAX: c_int = 241;
950 
951 pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 242;
952 
953 pub const _SC_TRACE_NAME_MAX: c_int = 243;
954 
955 pub const _SC_TRACE_SYS_MAX: c_int = 244;
956 
957 pub const _SC_TRACE_USER_EVENT_MAX: c_int = 245;
958 
959 pub const _SC_XOPEN_STREAMS: c_int = 246;
960 
961 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 247;
962 
963 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 248;
964 
965 // limits.h
966 pub const PTHREAD_KEYS_MAX: c_int = 128;
967 
968 pub const PTHREAD_STACK_MIN: c_int = 2048;
969 
970 pub const PTHREAD_DESTRUCTOR_ITERATIONS: c_int = 4;
971 
972 pub const SEM_VALUE_MAX: c_int = 0x7fffffff;
973 
974 pub const SEM_NSEMS_MAX: c_int = 256;
975 
976 pub const DELAYTIMER_MAX: c_int = 0x7fffffff;
977 
978 pub const MQ_PRIO_MAX: c_int = 32768;
979 
980 pub const LOGIN_NAME_MAX: c_int = 256;
981 
982 // time.h
983 pub const CLOCK_REALTIME: clockid_t = 0;
984 
985 pub const CLOCK_MONOTONIC: clockid_t = 1;
986 
987 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
988     size: [0; __SIZEOF_PTHREAD_MUTEX_T],
989 };
990 
991 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
992     size: [0; __SIZEOF_PTHREAD_COND_T],
993 };
994 
995 pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
996 
997 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1;
998 
999 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2;
1000 
1001 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
1002 
1003 pub const PTHREAD_MUTEX_STALLED: c_int = 0;
1004 
1005 pub const PTHREAD_MUTEX_ROBUST: c_int = 1;
1006 
1007 extern "C" {
1008     // ---- ALLOC -----------------------------------------------------------------------------
calloc(nobj: size_t, size: size_t) -> *mut c_void1009     pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
1010 
malloc(size: size_t) -> *mut c_void1011     pub fn malloc(size: size_t) -> *mut c_void;
1012 
realloc(p: *mut c_void, size: size_t) -> *mut c_void1013     pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
1014 
aligned_alloc(align: size_t, len: size_t) -> *mut c_void1015     pub fn aligned_alloc(align: size_t, len: size_t) -> *mut c_void;
1016 
free(p: *mut c_void)1017     pub fn free(p: *mut c_void);
1018 
posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int1019     pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int;
1020 
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void1021     pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
1022 
wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t1023     pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
1024 
memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int1025     pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
1026 
memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void1027     pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
1028 
memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void1029     pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
1030 
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void1031     pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
1032 
1033     // ----- PTHREAD ---------------------------------------------------------------------------
pthread_self() -> pthread_t1034     pub fn pthread_self() -> pthread_t;
1035 
pthread_join(native: pthread_t, value: *mut *mut c_void) -> c_int1036     pub fn pthread_join(native: pthread_t, value: *mut *mut c_void) -> c_int;
1037 
1038     // detach or pthread_attr_setdetachstate must not be called!
1039     //pub fn pthread_detach(thread: pthread_t) -> c_int;
1040 
pthread_exit(value: *mut c_void) -> !1041     pub fn pthread_exit(value: *mut c_void) -> !;
1042 
pthread_attr_init(attr: *mut pthread_attr_t) -> c_int1043     pub fn pthread_attr_init(attr: *mut pthread_attr_t) -> c_int;
1044 
pthread_attr_destroy(attr: *mut pthread_attr_t) -> c_int1045     pub fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> c_int;
1046 
pthread_attr_getstack( attr: *const pthread_attr_t, stackaddr: *mut *mut c_void, stacksize: *mut size_t, ) -> c_int1047     pub fn pthread_attr_getstack(
1048         attr: *const pthread_attr_t,
1049         stackaddr: *mut *mut c_void,
1050         stacksize: *mut size_t,
1051     ) -> c_int;
1052 
pthread_attr_setstacksize(attr: *mut pthread_attr_t, stack_size: size_t) -> c_int1053     pub fn pthread_attr_setstacksize(attr: *mut pthread_attr_t, stack_size: size_t) -> c_int;
1054 
pthread_attr_getstacksize(attr: *const pthread_attr_t, size: *mut size_t) -> c_int1055     pub fn pthread_attr_getstacksize(attr: *const pthread_attr_t, size: *mut size_t) -> c_int;
1056 
pthread_attr_settee( attr: *mut pthread_attr_t, ca: c_int, task_id: c_int, shadow: c_int, ) -> c_int1057     pub fn pthread_attr_settee(
1058         attr: *mut pthread_attr_t,
1059         ca: c_int,
1060         task_id: c_int,
1061         shadow: c_int,
1062     ) -> c_int;
1063 
1064     // C-TA API do not include this interface, but TA can use.
sched_yield() -> c_int1065     pub fn sched_yield() -> c_int;
1066 
pthread_key_create( key: *mut pthread_key_t, dtor: Option<unsafe extern "C" fn(*mut c_void)>, ) -> c_int1067     pub fn pthread_key_create(
1068         key: *mut pthread_key_t,
1069         dtor: Option<unsafe extern "C" fn(*mut c_void)>,
1070     ) -> c_int;
1071 
pthread_key_delete(key: pthread_key_t) -> c_int1072     pub fn pthread_key_delete(key: pthread_key_t) -> c_int;
1073 
pthread_getspecific(key: pthread_key_t) -> *mut c_void1074     pub fn pthread_getspecific(key: pthread_key_t) -> *mut c_void;
1075 
pthread_setspecific(key: pthread_key_t, value: *const c_void) -> c_int1076     pub fn pthread_setspecific(key: pthread_key_t, value: *const c_void) -> c_int;
1077 
pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> c_int1078     pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> c_int;
1079 
pthread_mutex_init( lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> c_int1080     pub fn pthread_mutex_init(
1081         lock: *mut pthread_mutex_t,
1082         attr: *const pthread_mutexattr_t,
1083     ) -> c_int;
1084 
pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int1085     pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int;
1086 
pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> c_int1087     pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> c_int;
1088 
pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int1089     pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int;
1090 
pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int1091     pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int;
1092 
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int1093     pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int;
1094 
pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: c_int) -> c_int1095     pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: c_int) -> c_int;
1096 
pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int1097     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
1098 
pthread_cond_broadcast(cond: *mut pthread_cond_t) -> c_int1099     pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> c_int;
1100 
pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int1101     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int;
1102 
pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> c_int1103     pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> c_int;
1104 
pthread_cond_signal(cond: *mut pthread_cond_t) -> c_int1105     pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> c_int;
1106 
pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int1107     pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int;
1108 
pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1109     pub fn pthread_cond_timedwait(
1110         cond: *mut pthread_cond_t,
1111         lock: *mut pthread_mutex_t,
1112         abstime: *const ::timespec,
1113     ) -> ::c_int;
1114 
pthread_mutexattr_setrobust(attr: *mut pthread_mutexattr_t, robustness: c_int) -> c_int1115     pub fn pthread_mutexattr_setrobust(attr: *mut pthread_mutexattr_t, robustness: c_int) -> c_int;
1116 
pthread_create( native: *mut pthread_t, attr: *const pthread_attr_t, f: extern "C" fn(*mut c_void) -> *mut c_void, value: *mut c_void, ) -> c_int1117     pub fn pthread_create(
1118         native: *mut pthread_t,
1119         attr: *const pthread_attr_t,
1120         f: extern "C" fn(*mut c_void) -> *mut c_void,
1121         value: *mut c_void,
1122     ) -> c_int;
1123 
pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int1124     pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int;
1125 
pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int1126     pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int;
1127 
pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int1128     pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int;
1129 
pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int1130     pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int;
1131 
pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int1132     pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int;
1133 
pthread_setschedprio(native: pthread_t, priority: c_int) -> c_int1134     pub fn pthread_setschedprio(native: pthread_t, priority: c_int) -> c_int;
1135 
pthread_once(pot: *mut pthread_once_t, f: Option<once_fn>) -> c_int1136     pub fn pthread_once(pot: *mut pthread_once_t, f: Option<once_fn>) -> c_int;
1137 
pthread_equal(p1: pthread_t, p2: pthread_t) -> c_int1138     pub fn pthread_equal(p1: pthread_t, p2: pthread_t) -> c_int;
1139 
pthread_mutexattr_setprotocol(a: *mut pthread_mutexattr_t, protocol: c_int) -> c_int1140     pub fn pthread_mutexattr_setprotocol(a: *mut pthread_mutexattr_t, protocol: c_int) -> c_int;
1141 
pthread_attr_setstack( attr: *mut pthread_attr_t, stack: *mut c_void, size: size_t, ) -> c_int1142     pub fn pthread_attr_setstack(
1143         attr: *mut pthread_attr_t,
1144         stack: *mut c_void,
1145         size: size_t,
1146     ) -> c_int;
1147 
pthread_setaffinity_np(td: pthread_t, size: size_t, set: *const cpu_set_t) -> c_int1148     pub fn pthread_setaffinity_np(td: pthread_t, size: size_t, set: *const cpu_set_t) -> c_int;
1149 
pthread_getaffinity_np(td: pthread_t, size: size_t, set: *mut cpu_set_t) -> c_int1150     pub fn pthread_getaffinity_np(td: pthread_t, size: size_t, set: *mut cpu_set_t) -> c_int;
1151 
1152     // stdio.h
printf(fmt: *const c_char, ...) -> c_int1153     pub fn printf(fmt: *const c_char, ...) -> c_int;
1154 
scanf(fmt: *const c_char, ...) -> c_int1155     pub fn scanf(fmt: *const c_char, ...) -> c_int;
1156 
snprintf(s: *mut c_char, n: size_t, fmt: *const c_char, ...) -> c_int1157     pub fn snprintf(s: *mut c_char, n: size_t, fmt: *const c_char, ...) -> c_int;
1158 
sprintf(s: *mut c_char, fmt: *const c_char, ...) -> c_int1159     pub fn sprintf(s: *mut c_char, fmt: *const c_char, ...) -> c_int;
1160 
vsnprintf(s: *mut c_char, n: size_t, fmt: *const c_char, ap: va_list) -> c_int1161     pub fn vsnprintf(s: *mut c_char, n: size_t, fmt: *const c_char, ap: va_list) -> c_int;
1162 
vsprintf(s: *mut c_char, fmt: *const c_char, ap: va_list) -> c_int1163     pub fn vsprintf(s: *mut c_char, fmt: *const c_char, ap: va_list) -> c_int;
1164 
1165     // Not available.
1166     //pub fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int;
1167 
abort() -> !1168     pub fn abort() -> !;
1169 
1170     // Not available.
1171     //pub fn prctl(op: c_int, ...) -> c_int;
1172 
sched_getaffinity(pid: pid_t, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> c_int1173     pub fn sched_getaffinity(pid: pid_t, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> c_int;
1174 
sched_setaffinity(pid: pid_t, cpusetsize: size_t, cpuset: *const cpu_set_t) -> c_int1175     pub fn sched_setaffinity(pid: pid_t, cpusetsize: size_t, cpuset: *const cpu_set_t) -> c_int;
1176 
1177     // sysconf is currently only implemented as a stub.
sysconf(name: c_int) -> c_long1178     pub fn sysconf(name: c_int) -> c_long;
1179 
1180     // mman.h
mmap( addr: *mut c_void, len: size_t, prot: c_int, flags: c_int, fd: c_int, offset: off_t, ) -> *mut c_void1181     pub fn mmap(
1182         addr: *mut c_void,
1183         len: size_t,
1184         prot: c_int,
1185         flags: c_int,
1186         fd: c_int,
1187         offset: off_t,
1188     ) -> *mut c_void;
munmap(addr: *mut c_void, len: size_t) -> c_int1189     pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
1190 
1191     // errno.h
__errno_location() -> *mut c_int1192     pub fn __errno_location() -> *mut c_int;
1193 
strerror(e: c_int) -> *mut c_char1194     pub fn strerror(e: c_int) -> *mut c_char;
1195 
1196     // time.h
clock_gettime(clock_id: clockid_t, tp: *mut timespec) -> c_int1197     pub fn clock_gettime(clock_id: clockid_t, tp: *mut timespec) -> c_int;
1198 
1199     // unistd
getpid() -> pid_t1200     pub fn getpid() -> pid_t;
1201 
1202     // time
gettimeofday(tv: *mut timeval, tz: *mut c_void) -> c_int1203     pub fn gettimeofday(tv: *mut timeval, tz: *mut c_void) -> c_int;
1204 
strftime( restrict: *mut c_char, sz: size_t, _restrict: *const c_char, __restrict: *const tm, ) -> size_t1205     pub fn strftime(
1206         restrict: *mut c_char,
1207         sz: size_t,
1208         _restrict: *const c_char,
1209         __restrict: *const tm,
1210     ) -> size_t;
1211 
time(t: *mut time_t) -> time_t1212     pub fn time(t: *mut time_t) -> time_t;
1213 
1214     // sem
sem_close(sem: *mut sem_t) -> c_int1215     pub fn sem_close(sem: *mut sem_t) -> c_int;
1216 
sem_destroy(sem: *mut sem_t) -> c_int1217     pub fn sem_destroy(sem: *mut sem_t) -> c_int;
1218 
sem_getvalue(sem: *mut sem_t, valp: *mut c_int) -> c_int1219     pub fn sem_getvalue(sem: *mut sem_t, valp: *mut c_int) -> c_int;
1220 
sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int1221     pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
1222 
sem_open(name: *const c_char, flags: c_int, ...) -> *mut sem_t1223     pub fn sem_open(name: *const c_char, flags: c_int, ...) -> *mut sem_t;
1224 
sem_post(sem: *mut sem_t) -> c_int1225     pub fn sem_post(sem: *mut sem_t) -> c_int;
1226 
sem_unlink(name: *const c_char) -> c_int1227     pub fn sem_unlink(name: *const c_char) -> c_int;
1228 
sem_wait(sem: *mut sem_t) -> c_int1229     pub fn sem_wait(sem: *mut sem_t) -> c_int;
1230 
1231     // locale
setlocale(cat: c_int, name: *const c_char) -> *mut c_char1232     pub fn setlocale(cat: c_int, name: *const c_char) -> *mut c_char;
1233 
strcoll(l: *const c_char, r: *const c_char) -> c_int1234     pub fn strcoll(l: *const c_char, r: *const c_char) -> c_int;
1235 
strxfrm(dest: *mut c_char, src: *const c_char, n: size_t) -> size_t1236     pub fn strxfrm(dest: *mut c_char, src: *const c_char, n: size_t) -> size_t;
1237 
strtod(s: *const c_char, p: *mut *mut c_char) -> c_double1238     pub fn strtod(s: *const c_char, p: *mut *mut c_char) -> c_double;
1239 
1240     // multibyte
mbrtowc(wc: *mut wchar_t, src: *const c_char, n: size_t, st: *mut mbstate_t) -> size_t1241     pub fn mbrtowc(wc: *mut wchar_t, src: *const c_char, n: size_t, st: *mut mbstate_t) -> size_t;
1242 
wcrtomb(s: *mut c_char, wc: wchar_t, st: *mut mbstate_t) -> size_t1243     pub fn wcrtomb(s: *mut c_char, wc: wchar_t, st: *mut mbstate_t) -> size_t;
1244 
wctob(c: wint_t) -> c_int1245     pub fn wctob(c: wint_t) -> c_int;
1246 
1247     // prng
srandom(seed: c_uint)1248     pub fn srandom(seed: c_uint);
1249 
initstate(seed: c_uint, state: *mut c_char, size: size_t) -> *mut c_char1250     pub fn initstate(seed: c_uint, state: *mut c_char, size: size_t) -> *mut c_char;
1251 
setstate(state: *mut c_char) -> *mut c_char1252     pub fn setstate(state: *mut c_char) -> *mut c_char;
1253 
random() -> c_long1254     pub fn random() -> c_long;
1255 
1256     // string
strchr(s: *const c_char, c: c_int) -> *mut c_char1257     pub fn strchr(s: *const c_char, c: c_int) -> *mut c_char;
1258 
strlen(cs: *const c_char) -> size_t1259     pub fn strlen(cs: *const c_char) -> size_t;
1260 
strcmp(l: *const c_char, r: *const c_char) -> c_int1261     pub fn strcmp(l: *const c_char, r: *const c_char) -> c_int;
1262 
strcpy(dest: *mut c_char, src: *const c_char) -> *mut c_char1263     pub fn strcpy(dest: *mut c_char, src: *const c_char) -> *mut c_char;
1264 
strncmp(_l: *const c_char, r: *const c_char, n: size_t) -> c_int1265     pub fn strncmp(_l: *const c_char, r: *const c_char, n: size_t) -> c_int;
1266 
strncpy(dest: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char1267     pub fn strncpy(dest: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
1268 
strnlen(cs: *const c_char, n: size_t) -> size_t1269     pub fn strnlen(cs: *const c_char, n: size_t) -> size_t;
1270 
strrchr(s: *const c_char, c: c_int) -> *mut c_char1271     pub fn strrchr(s: *const c_char, c: c_int) -> *mut c_char;
1272 
strstr(h: *const c_char, n: *const c_char) -> *mut c_char1273     pub fn strstr(h: *const c_char, n: *const c_char) -> *mut c_char;
1274 
wcschr(s: *const wchar_t, c: wchar_t) -> *mut wchar_t1275     pub fn wcschr(s: *const wchar_t, c: wchar_t) -> *mut wchar_t;
1276 
wcslen(s: *const wchar_t) -> size_t1277     pub fn wcslen(s: *const wchar_t) -> size_t;
1278 
1279     // ctype
isalpha(c: c_int) -> c_int1280     pub fn isalpha(c: c_int) -> c_int;
1281 
isascii(c: c_int) -> c_int1282     pub fn isascii(c: c_int) -> c_int;
1283 
isdigit(c: c_int) -> c_int1284     pub fn isdigit(c: c_int) -> c_int;
1285 
islower(c: c_int) -> c_int1286     pub fn islower(c: c_int) -> c_int;
1287 
isprint(c: c_int) -> c_int1288     pub fn isprint(c: c_int) -> c_int;
1289 
isspace(c: c_int) -> c_int1290     pub fn isspace(c: c_int) -> c_int;
1291 
iswctype(wc: wint_t, ttype: wctype_t) -> c_int1292     pub fn iswctype(wc: wint_t, ttype: wctype_t) -> c_int;
1293 
iswdigit(wc: wint_t) -> c_int1294     pub fn iswdigit(wc: wint_t) -> c_int;
1295 
iswlower(wc: wint_t) -> c_int1296     pub fn iswlower(wc: wint_t) -> c_int;
1297 
iswspace(wc: wint_t) -> c_int1298     pub fn iswspace(wc: wint_t) -> c_int;
1299 
iswupper(wc: wint_t) -> c_int1300     pub fn iswupper(wc: wint_t) -> c_int;
1301 
towupper(wc: wint_t) -> wint_t1302     pub fn towupper(wc: wint_t) -> wint_t;
1303 
towlower(wc: wint_t) -> wint_t1304     pub fn towlower(wc: wint_t) -> wint_t;
1305 
1306     // cmath
atan(x: c_double) -> c_double1307     pub fn atan(x: c_double) -> c_double;
1308 
ceil(x: c_double) -> c_double1309     pub fn ceil(x: c_double) -> c_double;
1310 
ceilf(x: c_float) -> c_float1311     pub fn ceilf(x: c_float) -> c_float;
1312 
exp(x: c_double) -> c_double1313     pub fn exp(x: c_double) -> c_double;
1314 
fabs(x: c_double) -> c_double1315     pub fn fabs(x: c_double) -> c_double;
1316 
floor(x: c_double) -> c_double1317     pub fn floor(x: c_double) -> c_double;
1318 
frexp(x: c_double, e: *mut c_int) -> c_double1319     pub fn frexp(x: c_double, e: *mut c_int) -> c_double;
1320 
log(x: c_double) -> c_double1321     pub fn log(x: c_double) -> c_double;
1322 
log2(x: c_double) -> c_double1323     pub fn log2(x: c_double) -> c_double;
1324 
pow(x: c_double, y: c_double) -> c_double1325     pub fn pow(x: c_double, y: c_double) -> c_double;
1326 
roundf(x: c_float) -> c_float1327     pub fn roundf(x: c_float) -> c_float;
1328 
scalbn(x: c_double, n: c_int) -> c_double1329     pub fn scalbn(x: c_double, n: c_int) -> c_double;
1330 
sqrt(x: c_double) -> c_double1331     pub fn sqrt(x: c_double) -> c_double;
1332 
1333     // stdlib
abs(x: c_int) -> c_int1334     pub fn abs(x: c_int) -> c_int;
1335 
atof(s: *const c_char) -> c_double1336     pub fn atof(s: *const c_char) -> c_double;
1337 
atoi(s: *const c_char) -> c_int1338     pub fn atoi(s: *const c_char) -> c_int;
1339 
atol(s: *const c_char) -> c_long1340     pub fn atol(s: *const c_char) -> c_long;
1341 
atoll(s: *const c_char) -> c_longlong1342     pub fn atoll(s: *const c_char) -> c_longlong;
1343 
bsearch( key: *const c_void, base: *const c_void, nel: size_t, width: size_t, cmp: cmpfunc, ) -> *mut c_void1344     pub fn bsearch(
1345         key: *const c_void,
1346         base: *const c_void,
1347         nel: size_t,
1348         width: size_t,
1349         cmp: cmpfunc,
1350     ) -> *mut c_void;
1351 
div(num: c_int, den: c_int) -> div_t1352     pub fn div(num: c_int, den: c_int) -> div_t;
1353 
ecvt(x: c_double, n: c_int, dp: *mut c_int, sign: *mut c_int) -> *mut c_char1354     pub fn ecvt(x: c_double, n: c_int, dp: *mut c_int, sign: *mut c_int) -> *mut c_char;
1355 
imaxabs(a: intmax_t) -> intmax_t1356     pub fn imaxabs(a: intmax_t) -> intmax_t;
1357 
llabs(a: c_longlong) -> c_longlong1358     pub fn llabs(a: c_longlong) -> c_longlong;
1359 
qsort(base: *mut c_void, nel: size_t, width: size_t, cmp: cmpfunc)1360     pub fn qsort(base: *mut c_void, nel: size_t, width: size_t, cmp: cmpfunc);
1361 
strtoul(s: *const c_char, p: *mut *mut c_char, base: c_int) -> c_ulong1362     pub fn strtoul(s: *const c_char, p: *mut *mut c_char, base: c_int) -> c_ulong;
1363 
strtol(s: *const c_char, p: *mut *mut c_char, base: c_int) -> c_long1364     pub fn strtol(s: *const c_char, p: *mut *mut c_char, base: c_int) -> c_long;
1365 
wcstod(s: *const wchar_t, p: *mut *mut wchar_t) -> c_double1366     pub fn wcstod(s: *const wchar_t, p: *mut *mut wchar_t) -> c_double;
1367 }
1368 
errno() -> c_int1369 pub fn errno() -> c_int {
1370     unsafe { *__errno_location() }
1371 }
1372 
CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int1373 pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int {
1374     let mut s: u32 = 0;
1375     let size_of_mask = core::mem::size_of_val(&cpuset.bits[0]);
1376 
1377     for i in cpuset.bits[..(size / size_of_mask)].iter() {
1378         s += i.count_ones();
1379     }
1380     s as c_int
1381 }
1382 
CPU_COUNT(cpuset: &cpu_set_t) -> c_int1383 pub fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int {
1384     CPU_COUNT_S(core::mem::size_of::<cpu_set_t>(), cpuset)
1385 }
1386