1 pub type c_char = i8;
2 pub type wchar_t = i32;
3 pub type useconds_t = u32;
4 pub type dev_t = u32;
5 pub type socklen_t = u32;
6 pub type pthread_t = c_ulong;
7 pub type mode_t = u32;
8 pub type shmatt_t = ::c_ulong;
9 pub type mqd_t = ::c_int;
10 pub type msgqnum_t = ::c_ulong;
11 pub type msglen_t = ::c_ulong;
12 pub type nfds_t = ::c_ulong;
13 pub type nl_item = ::c_int;
14 pub type idtype_t = ::c_uint;
15 pub type loff_t = i64;
16 pub type pthread_key_t = ::c_uint;
17 
18 pub type clock_t = c_long;
19 pub type time_t = c_long;
20 pub type suseconds_t = c_long;
21 pub type ino_t = u64;
22 pub type off_t = i64;
23 pub type blkcnt_t = i32;
24 
25 pub type blksize_t = c_long;
26 pub type fsblkcnt_t = u32;
27 pub type fsfilcnt_t = u32;
28 pub type rlim_t = u64;
29 pub type c_long = i32;
30 pub type c_ulong = u32;
31 pub type nlink_t = u32;
32 
33 pub type ino64_t = ::ino_t;
34 pub type off64_t = ::off_t;
35 pub type blkcnt64_t = ::blkcnt_t;
36 pub type rlim64_t = ::rlim_t;
37 
38 pub type rlimit64 = ::rlimit;
39 pub type flock64 = ::flock;
40 pub type stat64 = ::stat;
41 pub type statfs64 = ::statfs;
42 pub type statvfs64 = ::statvfs;
43 pub type dirent64 = ::dirent;
44 
45 #[cfg_attr(feature = "extra_traits", derive(Debug))]
46 pub enum fpos64_t {} // FIXME: fill this out with a struct
47 impl ::Copy for fpos64_t {}
48 impl ::Clone for fpos64_t {
clone(&self) -> fpos64_t49     fn clone(&self) -> fpos64_t {
50         *self
51     }
52 }
53 
54 s! {
55     pub struct glob_t {
56         pub gl_pathc: ::size_t,
57         pub gl_pathv: *mut *mut c_char,
58         pub gl_offs: ::size_t,
59         pub gl_flags: ::c_int,
60 
61         __unused1: *mut ::c_void,
62         __unused2: *mut ::c_void,
63         __unused3: *mut ::c_void,
64         __unused4: *mut ::c_void,
65         __unused5: *mut ::c_void,
66     }
67 
68     pub struct passwd {
69         pub pw_name: *mut ::c_char,
70         pub pw_passwd: *mut ::c_char,
71         pub pw_uid: ::uid_t,
72         pub pw_gid: ::gid_t,
73         pub pw_gecos: *mut ::c_char,
74         pub pw_dir: *mut ::c_char,
75         pub pw_shell: *mut ::c_char,
76     }
77 
78     pub struct spwd {
79         pub sp_namp: *mut ::c_char,
80         pub sp_pwdp: *mut ::c_char,
81         pub sp_lstchg: ::c_long,
82         pub sp_min: ::c_long,
83         pub sp_max: ::c_long,
84         pub sp_warn: ::c_long,
85         pub sp_inact: ::c_long,
86         pub sp_expire: ::c_long,
87         pub sp_flag: ::c_ulong,
88     }
89 
90     pub struct statvfs {
91         pub f_bsize: ::c_ulong,
92         pub f_frsize: ::c_ulong,
93         pub f_blocks: ::fsblkcnt_t,
94         pub f_bfree: ::fsblkcnt_t,
95         pub f_bavail: ::fsblkcnt_t,
96         pub f_files: ::fsfilcnt_t,
97         pub f_ffree: ::fsfilcnt_t,
98         pub f_favail: ::fsfilcnt_t,
99         pub f_fsid: ::c_ulong,
100         __f_unused: ::c_int,
101         pub f_flag: ::c_ulong,
102         pub f_namemax: ::c_ulong,
103         __f_spare: [::c_int; 6],
104     }
105 
106     pub struct dqblk {
107         pub dqb_bhardlimit: u64,
108         pub dqb_bsoftlimit: u64,
109         pub dqb_curspace: u64,
110         pub dqb_ihardlimit: u64,
111         pub dqb_isoftlimit: u64,
112         pub dqb_curinodes: u64,
113         pub dqb_btime: u64,
114         pub dqb_itime: u64,
115         pub dqb_valid: u32,
116     }
117 
118     pub struct signalfd_siginfo {
119         pub ssi_signo: u32,
120         pub ssi_errno: i32,
121         pub ssi_code: i32,
122         pub ssi_pid: u32,
123         pub ssi_uid: u32,
124         pub ssi_fd: i32,
125         pub ssi_tid: u32,
126         pub ssi_band: u32,
127         pub ssi_overrun: u32,
128         pub ssi_trapno: u32,
129         pub ssi_status: i32,
130         pub ssi_int: i32,
131         pub ssi_ptr: u64,
132         pub ssi_utime: u64,
133         pub ssi_stime: u64,
134         pub ssi_addr: u64,
135         pub ssi_addr_lsb: u16,
136         _pad2: u16,
137         pub ssi_syscall: i32,
138         pub ssi_call_addr: u64,
139         pub ssi_arch: u32,
140         _pad: [u8; 28],
141     }
142 
143     pub struct fsid_t {
144         __val: [::c_int; 2],
145     }
146 
147     pub struct cpu_set_t {
148         bits: [u32; 32],
149     }
150 
151     pub struct if_nameindex {
152         pub if_index: ::c_uint,
153         pub if_name: *mut ::c_char,
154     }
155 
156     // System V IPC
157     pub struct msginfo {
158         pub msgpool: ::c_int,
159         pub msgmap: ::c_int,
160         pub msgmax: ::c_int,
161         pub msgmnb: ::c_int,
162         pub msgmni: ::c_int,
163         pub msgssz: ::c_int,
164         pub msgtql: ::c_int,
165         pub msgseg: ::c_ushort,
166     }
167 
168     pub struct sembuf {
169         pub sem_num: ::c_ushort,
170         pub sem_op: ::c_short,
171         pub sem_flg: ::c_short,
172     }
173 
174     pub struct aiocb {
175         pub aio_fildes: ::c_int,
176         pub aio_lio_opcode: ::c_int,
177         pub aio_reqprio: ::c_int,
178         pub aio_buf: *mut ::c_void,
179         pub aio_nbytes: ::size_t,
180         pub aio_sigevent: ::sigevent,
181         __td: *mut ::c_void,
182         __lock: [::c_int; 2],
183         __err: ::c_int,
184         __ret: ::ssize_t,
185         pub aio_offset: off_t,
186         __next: *mut ::c_void,
187         __prev: *mut ::c_void,
188         __dummy4: [::c_char; 24],
189     }
190 
191     pub struct sigaction {
192         pub sa_sigaction: ::sighandler_t,
193         pub sa_mask: ::sigset_t,
194         pub sa_flags: ::c_int,
195         pub sa_restorer: ::Option<extern fn()>,
196     }
197 
198     pub struct ipc_perm {
199         pub __ipc_perm_key: ::key_t,
200         pub uid: ::uid_t,
201         pub gid: ::gid_t,
202         pub cuid: ::uid_t,
203         pub cgid: ::gid_t,
204         pub mode: ::mode_t,
205         pub __seq: ::c_int,
206         __unused1: ::c_long,
207         __unused2: ::c_long
208     }
209 
210     pub struct termios {
211         pub c_iflag: ::tcflag_t,
212         pub c_oflag: ::tcflag_t,
213         pub c_cflag: ::tcflag_t,
214         pub c_lflag: ::tcflag_t,
215         pub c_line: ::cc_t,
216         pub c_cc: [::cc_t; ::NCCS],
217         pub __c_ispeed: ::speed_t,
218         pub __c_ospeed: ::speed_t,
219     }
220 
221     pub struct flock {
222         pub l_type: ::c_short,
223         pub l_whence: ::c_short,
224         pub l_start: ::off_t,
225         pub l_len: ::off_t,
226         pub l_pid: ::pid_t,
227     }
228 
229     pub struct pthread_attr_t {
230         __size: [u32; 11]
231     }
232 
233     pub struct sigset_t {
234         __val: [::c_ulong; 32],
235     }
236 
237     pub struct msghdr {
238         pub msg_name: *mut ::c_void,
239         pub msg_namelen: ::socklen_t,
240         pub msg_iov: *mut ::iovec,
241         pub msg_iovlen: ::c_int,
242         pub msg_control: *mut ::c_void,
243         pub msg_controllen: ::socklen_t,
244         pub msg_flags: ::c_int,
245     }
246 
247     pub struct cmsghdr {
248         pub cmsg_len: ::socklen_t,
249         pub cmsg_level: ::c_int,
250         pub cmsg_type: ::c_int,
251     }
252 
253     pub struct sem_t {
254         __val: [::c_int; 4],
255     }
256     pub struct stat {
257         pub st_dev: ::dev_t,
258         #[cfg(not(emscripten_new_stat_abi))]
259         __st_dev_padding: ::c_int,
260         #[cfg(not(emscripten_new_stat_abi))]
261         __st_ino_truncated: ::c_long,
262         pub st_mode: ::mode_t,
263         pub st_nlink: ::nlink_t,
264         pub st_uid: ::uid_t,
265         pub st_gid: ::gid_t,
266         pub st_rdev: ::dev_t,
267         #[cfg(not(emscripten_new_stat_abi))]
268         __st_rdev_padding: ::c_int,
269         pub st_size: ::off_t,
270         pub st_blksize: ::blksize_t,
271         pub st_blocks: ::blkcnt_t,
272         pub st_atime: ::time_t,
273         pub st_atime_nsec: ::c_long,
274         pub st_mtime: ::time_t,
275         pub st_mtime_nsec: ::c_long,
276         pub st_ctime: ::time_t,
277         pub st_ctime_nsec: ::c_long,
278         pub st_ino: ::ino_t,
279     }
280 
281     pub struct stack_t {
282         pub ss_sp: *mut ::c_void,
283         pub ss_flags: ::c_int,
284         pub ss_size: ::size_t
285     }
286 
287     pub struct shmid_ds {
288         pub shm_perm: ::ipc_perm,
289         pub shm_segsz: ::size_t,
290         pub shm_atime: ::time_t,
291         __unused1: ::c_int,
292         pub shm_dtime: ::time_t,
293         __unused2: ::c_int,
294         pub shm_ctime: ::time_t,
295         __unused3: ::c_int,
296         pub shm_cpid: ::pid_t,
297         pub shm_lpid: ::pid_t,
298         pub shm_nattch: ::c_ulong,
299         __pad1: ::c_ulong,
300         __pad2: ::c_ulong,
301     }
302 
303     pub struct msqid_ds {
304         pub msg_perm: ::ipc_perm,
305         pub msg_stime: ::time_t,
306         __unused1: ::c_int,
307         pub msg_rtime: ::time_t,
308         __unused2: ::c_int,
309         pub msg_ctime: ::time_t,
310         __unused3: ::c_int,
311         __msg_cbytes: ::c_ulong,
312         pub msg_qnum: ::msgqnum_t,
313         pub msg_qbytes: ::msglen_t,
314         pub msg_lspid: ::pid_t,
315         pub msg_lrpid: ::pid_t,
316         __pad1: ::c_ulong,
317         __pad2: ::c_ulong,
318     }
319 
320     pub struct statfs {
321         pub f_type: ::c_ulong,
322         pub f_bsize: ::c_ulong,
323         pub f_blocks: ::fsblkcnt_t,
324         pub f_bfree: ::fsblkcnt_t,
325         pub f_bavail: ::fsblkcnt_t,
326         pub f_files: ::fsfilcnt_t,
327         pub f_ffree: ::fsfilcnt_t,
328         pub f_fsid: ::fsid_t,
329         pub f_namelen: ::c_ulong,
330         pub f_frsize: ::c_ulong,
331         pub f_flags: ::c_ulong,
332         pub f_spare: [::c_ulong; 4],
333     }
334 
335     pub struct siginfo_t {
336         pub si_signo: ::c_int,
337         pub si_errno: ::c_int,
338         pub si_code: ::c_int,
339         pub _pad: [::c_int; 29],
340         _align: [usize; 0],
341     }
342 
343     pub struct arpd_request {
344         pub req: ::c_ushort,
345         pub ip: u32,
346         pub dev: ::c_ulong,
347         pub stamp: ::c_ulong,
348         pub updated: ::c_ulong,
349         pub ha: [::c_uchar; ::MAX_ADDR_LEN],
350     }
351 }
352 
353 s_no_extra_traits! {
354     pub struct dirent {
355         pub d_ino: ::ino_t,
356         pub d_off: ::off_t,
357         pub d_reclen: ::c_ushort,
358         pub d_type: ::c_uchar,
359         pub d_name: [::c_char; 256],
360     }
361 
362     pub struct sysinfo {
363         pub uptime: ::c_ulong,
364         pub loads: [::c_ulong; 3],
365         pub totalram: ::c_ulong,
366         pub freeram: ::c_ulong,
367         pub sharedram: ::c_ulong,
368         pub bufferram: ::c_ulong,
369         pub totalswap: ::c_ulong,
370         pub freeswap: ::c_ulong,
371         pub procs: ::c_ushort,
372         pub pad: ::c_ushort,
373         pub totalhigh: ::c_ulong,
374         pub freehigh: ::c_ulong,
375         pub mem_unit: ::c_uint,
376         pub __reserved: [::c_char; 256],
377     }
378 
379     pub struct mq_attr {
380         pub mq_flags: ::c_long,
381         pub mq_maxmsg: ::c_long,
382         pub mq_msgsize: ::c_long,
383         pub mq_curmsgs: ::c_long,
384         pad: [::c_long; 4]
385     }
386 }
387 
388 cfg_if! {
389     if #[cfg(feature = "extra_traits")] {
390         impl PartialEq for dirent {
391             fn eq(&self, other: &dirent) -> bool {
392                 self.d_ino == other.d_ino
393                     && self.d_off == other.d_off
394                     && self.d_reclen == other.d_reclen
395                     && self.d_type == other.d_type
396                     && self
397                     .d_name
398                     .iter()
399                     .zip(other.d_name.iter())
400                     .all(|(a,b)| a == b)
401             }
402         }
403         impl Eq for dirent {}
404         impl ::fmt::Debug for dirent {
405             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
406                 f.debug_struct("dirent")
407                     .field("d_ino", &self.d_ino)
408                     .field("d_off", &self.d_off)
409                     .field("d_reclen", &self.d_reclen)
410                     .field("d_type", &self.d_type)
411                     // FIXME: .field("d_name", &self.d_name)
412                     .finish()
413             }
414         }
415         impl ::hash::Hash for dirent {
416             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
417                 self.d_ino.hash(state);
418                 self.d_off.hash(state);
419                 self.d_reclen.hash(state);
420                 self.d_type.hash(state);
421                 self.d_name.hash(state);
422             }
423         }
424 
425         impl PartialEq for sysinfo {
426             fn eq(&self, other: &sysinfo) -> bool {
427                 self.uptime == other.uptime
428                     && self.loads == other.loads
429                     && self.totalram == other.totalram
430                     && self.freeram == other.freeram
431                     && self.sharedram == other.sharedram
432                     && self.bufferram == other.bufferram
433                     && self.totalswap == other.totalswap
434                     && self.freeswap == other.freeswap
435                     && self.procs == other.procs
436                     && self.pad == other.pad
437                     && self.totalhigh == other.totalhigh
438                     && self.freehigh == other.freehigh
439                     && self.mem_unit == other.mem_unit
440                     && self
441                     .__reserved
442                     .iter()
443                     .zip(other.__reserved.iter())
444                     .all(|(a,b)| a == b)
445             }
446         }
447         impl Eq for sysinfo {}
448         impl ::fmt::Debug for sysinfo {
449             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
450                 f.debug_struct("sysinfo")
451                     .field("uptime", &self.uptime)
452                     .field("loads", &self.loads)
453                     .field("totalram", &self.totalram)
454                     .field("freeram", &self.freeram)
455                     .field("sharedram", &self.sharedram)
456                     .field("bufferram", &self.bufferram)
457                     .field("totalswap", &self.totalswap)
458                     .field("freeswap", &self.freeswap)
459                     .field("procs", &self.procs)
460                     .field("pad", &self.pad)
461                     .field("totalhigh", &self.totalhigh)
462                     .field("freehigh", &self.freehigh)
463                     .field("mem_unit", &self.mem_unit)
464                     // FIXME: .field("__reserved", &self.__reserved)
465                     .finish()
466             }
467         }
468         impl ::hash::Hash for sysinfo {
469             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
470                 self.uptime.hash(state);
471                 self.loads.hash(state);
472                 self.totalram.hash(state);
473                 self.freeram.hash(state);
474                 self.sharedram.hash(state);
475                 self.bufferram.hash(state);
476                 self.totalswap.hash(state);
477                 self.freeswap.hash(state);
478                 self.procs.hash(state);
479                 self.pad.hash(state);
480                 self.totalhigh.hash(state);
481                 self.freehigh.hash(state);
482                 self.mem_unit.hash(state);
483                 self.__reserved.hash(state);
484             }
485         }
486 
487         impl PartialEq for mq_attr {
488             fn eq(&self, other: &mq_attr) -> bool {
489                 self.mq_flags == other.mq_flags &&
490                 self.mq_maxmsg == other.mq_maxmsg &&
491                 self.mq_msgsize == other.mq_msgsize &&
492                 self.mq_curmsgs == other.mq_curmsgs
493             }
494         }
495         impl Eq for mq_attr {}
496         impl ::fmt::Debug for mq_attr {
497             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
498                 f.debug_struct("mq_attr")
499                     .field("mq_flags", &self.mq_flags)
500                     .field("mq_maxmsg", &self.mq_maxmsg)
501                     .field("mq_msgsize", &self.mq_msgsize)
502                     .field("mq_curmsgs", &self.mq_curmsgs)
503                     .finish()
504             }
505         }
506         impl ::hash::Hash for mq_attr {
507             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
508                 self.mq_flags.hash(state);
509                 self.mq_maxmsg.hash(state);
510                 self.mq_msgsize.hash(state);
511                 self.mq_curmsgs.hash(state);
512             }
513         }
514     }
515 }
516 
517 pub const MADV_SOFT_OFFLINE: ::c_int = 101;
518 pub const MS_NOUSER: ::c_ulong = 0x80000000;
519 pub const MS_RMT_MASK: ::c_ulong = 0x02800051;
520 
521 pub const ABDAY_1: ::nl_item = 0x20000;
522 pub const ABDAY_2: ::nl_item = 0x20001;
523 pub const ABDAY_3: ::nl_item = 0x20002;
524 pub const ABDAY_4: ::nl_item = 0x20003;
525 pub const ABDAY_5: ::nl_item = 0x20004;
526 pub const ABDAY_6: ::nl_item = 0x20005;
527 pub const ABDAY_7: ::nl_item = 0x20006;
528 
529 pub const DAY_1: ::nl_item = 0x20007;
530 pub const DAY_2: ::nl_item = 0x20008;
531 pub const DAY_3: ::nl_item = 0x20009;
532 pub const DAY_4: ::nl_item = 0x2000A;
533 pub const DAY_5: ::nl_item = 0x2000B;
534 pub const DAY_6: ::nl_item = 0x2000C;
535 pub const DAY_7: ::nl_item = 0x2000D;
536 
537 pub const ABMON_1: ::nl_item = 0x2000E;
538 pub const ABMON_2: ::nl_item = 0x2000F;
539 pub const ABMON_3: ::nl_item = 0x20010;
540 pub const ABMON_4: ::nl_item = 0x20011;
541 pub const ABMON_5: ::nl_item = 0x20012;
542 pub const ABMON_6: ::nl_item = 0x20013;
543 pub const ABMON_7: ::nl_item = 0x20014;
544 pub const ABMON_8: ::nl_item = 0x20015;
545 pub const ABMON_9: ::nl_item = 0x20016;
546 pub const ABMON_10: ::nl_item = 0x20017;
547 pub const ABMON_11: ::nl_item = 0x20018;
548 pub const ABMON_12: ::nl_item = 0x20019;
549 
550 pub const MON_1: ::nl_item = 0x2001A;
551 pub const MON_2: ::nl_item = 0x2001B;
552 pub const MON_3: ::nl_item = 0x2001C;
553 pub const MON_4: ::nl_item = 0x2001D;
554 pub const MON_5: ::nl_item = 0x2001E;
555 pub const MON_6: ::nl_item = 0x2001F;
556 pub const MON_7: ::nl_item = 0x20020;
557 pub const MON_8: ::nl_item = 0x20021;
558 pub const MON_9: ::nl_item = 0x20022;
559 pub const MON_10: ::nl_item = 0x20023;
560 pub const MON_11: ::nl_item = 0x20024;
561 pub const MON_12: ::nl_item = 0x20025;
562 
563 pub const AM_STR: ::nl_item = 0x20026;
564 pub const PM_STR: ::nl_item = 0x20027;
565 
566 pub const D_T_FMT: ::nl_item = 0x20028;
567 pub const D_FMT: ::nl_item = 0x20029;
568 pub const T_FMT: ::nl_item = 0x2002A;
569 pub const T_FMT_AMPM: ::nl_item = 0x2002B;
570 
571 pub const ERA: ::nl_item = 0x2002C;
572 pub const ERA_D_FMT: ::nl_item = 0x2002E;
573 pub const ALT_DIGITS: ::nl_item = 0x2002F;
574 pub const ERA_D_T_FMT: ::nl_item = 0x20030;
575 pub const ERA_T_FMT: ::nl_item = 0x20031;
576 
577 pub const CODESET: ::nl_item = 14;
578 
579 pub const CRNCYSTR: ::nl_item = 0x4000F;
580 
581 pub const RUSAGE_THREAD: ::c_int = 1;
582 pub const RUSAGE_CHILDREN: ::c_int = -1;
583 
584 pub const RADIXCHAR: ::nl_item = 0x10000;
585 pub const THOUSEP: ::nl_item = 0x10001;
586 
587 pub const YESEXPR: ::nl_item = 0x50000;
588 pub const NOEXPR: ::nl_item = 0x50001;
589 pub const YESSTR: ::nl_item = 0x50002;
590 pub const NOSTR: ::nl_item = 0x50003;
591 
592 pub const FILENAME_MAX: ::c_uint = 4096;
593 pub const L_tmpnam: ::c_uint = 20;
594 pub const _PC_LINK_MAX: ::c_int = 0;
595 pub const _PC_MAX_CANON: ::c_int = 1;
596 pub const _PC_MAX_INPUT: ::c_int = 2;
597 pub const _PC_NAME_MAX: ::c_int = 3;
598 pub const _PC_PATH_MAX: ::c_int = 4;
599 pub const _PC_PIPE_BUF: ::c_int = 5;
600 pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
601 pub const _PC_NO_TRUNC: ::c_int = 7;
602 pub const _PC_VDISABLE: ::c_int = 8;
603 pub const _PC_SYNC_IO: ::c_int = 9;
604 pub const _PC_ASYNC_IO: ::c_int = 10;
605 pub const _PC_PRIO_IO: ::c_int = 11;
606 pub const _PC_SOCK_MAXBUF: ::c_int = 12;
607 pub const _PC_FILESIZEBITS: ::c_int = 13;
608 pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
609 pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
610 pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
611 pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
612 pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
613 pub const _PC_SYMLINK_MAX: ::c_int = 19;
614 pub const _PC_2_SYMLINKS: ::c_int = 20;
615 
616 pub const _SC_ARG_MAX: ::c_int = 0;
617 pub const _SC_CHILD_MAX: ::c_int = 1;
618 pub const _SC_CLK_TCK: ::c_int = 2;
619 pub const _SC_NGROUPS_MAX: ::c_int = 3;
620 pub const _SC_OPEN_MAX: ::c_int = 4;
621 pub const _SC_STREAM_MAX: ::c_int = 5;
622 pub const _SC_TZNAME_MAX: ::c_int = 6;
623 pub const _SC_JOB_CONTROL: ::c_int = 7;
624 pub const _SC_SAVED_IDS: ::c_int = 8;
625 pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
626 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
627 pub const _SC_TIMERS: ::c_int = 11;
628 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
629 pub const _SC_PRIORITIZED_IO: ::c_int = 13;
630 pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
631 pub const _SC_FSYNC: ::c_int = 15;
632 pub const _SC_MAPPED_FILES: ::c_int = 16;
633 pub const _SC_MEMLOCK: ::c_int = 17;
634 pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
635 pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
636 pub const _SC_MESSAGE_PASSING: ::c_int = 20;
637 pub const _SC_SEMAPHORES: ::c_int = 21;
638 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
639 pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
640 pub const _SC_AIO_MAX: ::c_int = 24;
641 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
642 pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
643 pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
644 pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
645 pub const _SC_VERSION: ::c_int = 29;
646 pub const _SC_PAGESIZE: ::c_int = 30;
647 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
648 pub const _SC_RTSIG_MAX: ::c_int = 31;
649 pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
650 pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
651 pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
652 pub const _SC_TIMER_MAX: ::c_int = 35;
653 pub const _SC_BC_BASE_MAX: ::c_int = 36;
654 pub const _SC_BC_DIM_MAX: ::c_int = 37;
655 pub const _SC_BC_SCALE_MAX: ::c_int = 38;
656 pub const _SC_BC_STRING_MAX: ::c_int = 39;
657 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
658 pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
659 pub const _SC_LINE_MAX: ::c_int = 43;
660 pub const _SC_RE_DUP_MAX: ::c_int = 44;
661 pub const _SC_2_VERSION: ::c_int = 46;
662 pub const _SC_2_C_BIND: ::c_int = 47;
663 pub const _SC_2_C_DEV: ::c_int = 48;
664 pub const _SC_2_FORT_DEV: ::c_int = 49;
665 pub const _SC_2_FORT_RUN: ::c_int = 50;
666 pub const _SC_2_SW_DEV: ::c_int = 51;
667 pub const _SC_2_LOCALEDEF: ::c_int = 52;
668 pub const _SC_UIO_MAXIOV: ::c_int = 60;
669 pub const _SC_IOV_MAX: ::c_int = 60;
670 pub const _SC_THREADS: ::c_int = 67;
671 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
672 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
673 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
674 pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
675 pub const _SC_TTY_NAME_MAX: ::c_int = 72;
676 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
677 pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
678 pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
679 pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
680 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
681 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
682 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
683 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
684 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
685 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
686 pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
687 pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
688 pub const _SC_PHYS_PAGES: ::c_int = 85;
689 pub const _SC_AVPHYS_PAGES: ::c_int = 86;
690 pub const _SC_ATEXIT_MAX: ::c_int = 87;
691 pub const _SC_PASS_MAX: ::c_int = 88;
692 pub const _SC_XOPEN_VERSION: ::c_int = 89;
693 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
694 pub const _SC_XOPEN_UNIX: ::c_int = 91;
695 pub const _SC_XOPEN_CRYPT: ::c_int = 92;
696 pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
697 pub const _SC_XOPEN_SHM: ::c_int = 94;
698 pub const _SC_2_CHAR_TERM: ::c_int = 95;
699 pub const _SC_2_UPE: ::c_int = 97;
700 pub const _SC_XOPEN_XPG2: ::c_int = 98;
701 pub const _SC_XOPEN_XPG3: ::c_int = 99;
702 pub const _SC_XOPEN_XPG4: ::c_int = 100;
703 pub const _SC_NZERO: ::c_int = 109;
704 pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
705 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
706 pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
707 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
708 pub const _SC_XOPEN_LEGACY: ::c_int = 129;
709 pub const _SC_XOPEN_REALTIME: ::c_int = 130;
710 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
711 pub const _SC_ADVISORY_INFO: ::c_int = 132;
712 pub const _SC_BARRIERS: ::c_int = 133;
713 pub const _SC_CLOCK_SELECTION: ::c_int = 137;
714 pub const _SC_CPUTIME: ::c_int = 138;
715 pub const _SC_THREAD_CPUTIME: ::c_int = 139;
716 pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
717 pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
718 pub const _SC_SPIN_LOCKS: ::c_int = 154;
719 pub const _SC_REGEXP: ::c_int = 155;
720 pub const _SC_SHELL: ::c_int = 157;
721 pub const _SC_SPAWN: ::c_int = 159;
722 pub const _SC_SPORADIC_SERVER: ::c_int = 160;
723 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
724 pub const _SC_TIMEOUTS: ::c_int = 164;
725 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
726 pub const _SC_2_PBS: ::c_int = 168;
727 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
728 pub const _SC_2_PBS_LOCATE: ::c_int = 170;
729 pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
730 pub const _SC_2_PBS_TRACK: ::c_int = 172;
731 pub const _SC_SYMLOOP_MAX: ::c_int = 173;
732 pub const _SC_STREAMS: ::c_int = 174;
733 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
734 pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
735 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
736 pub const _SC_V6_LP64_OFF64: ::c_int = 178;
737 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
738 pub const _SC_HOST_NAME_MAX: ::c_int = 180;
739 pub const _SC_TRACE: ::c_int = 181;
740 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
741 pub const _SC_TRACE_INHERIT: ::c_int = 183;
742 pub const _SC_TRACE_LOG: ::c_int = 184;
743 pub const _SC_IPV6: ::c_int = 235;
744 pub const _SC_RAW_SOCKETS: ::c_int = 236;
745 pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
746 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
747 pub const _SC_V7_LP64_OFF64: ::c_int = 239;
748 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
749 pub const _SC_SS_REPL_MAX: ::c_int = 241;
750 pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
751 pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
752 pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
753 pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
754 pub const _SC_XOPEN_STREAMS: ::c_int = 246;
755 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
756 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
757 
758 pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
759 pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
760 
761 pub const GLOB_ERR: ::c_int = 1 << 0;
762 pub const GLOB_MARK: ::c_int = 1 << 1;
763 pub const GLOB_NOSORT: ::c_int = 1 << 2;
764 pub const GLOB_DOOFFS: ::c_int = 1 << 3;
765 pub const GLOB_NOCHECK: ::c_int = 1 << 4;
766 pub const GLOB_APPEND: ::c_int = 1 << 5;
767 pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
768 
769 pub const GLOB_NOSPACE: ::c_int = 1;
770 pub const GLOB_ABORTED: ::c_int = 2;
771 pub const GLOB_NOMATCH: ::c_int = 3;
772 
773 pub const POSIX_MADV_NORMAL: ::c_int = 0;
774 pub const POSIX_MADV_RANDOM: ::c_int = 1;
775 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
776 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
777 
778 pub const S_IEXEC: mode_t = 64;
779 pub const S_IWRITE: mode_t = 128;
780 pub const S_IREAD: mode_t = 256;
781 
782 pub const F_LOCK: ::c_int = 1;
783 pub const F_TEST: ::c_int = 3;
784 pub const F_TLOCK: ::c_int = 2;
785 pub const F_ULOCK: ::c_int = 0;
786 
787 pub const ST_RDONLY: ::c_ulong = 1;
788 pub const ST_NOSUID: ::c_ulong = 2;
789 pub const ST_NODEV: ::c_ulong = 4;
790 pub const ST_NOEXEC: ::c_ulong = 8;
791 pub const ST_SYNCHRONOUS: ::c_ulong = 16;
792 pub const ST_MANDLOCK: ::c_ulong = 64;
793 pub const ST_WRITE: ::c_ulong = 128;
794 pub const ST_APPEND: ::c_ulong = 256;
795 pub const ST_IMMUTABLE: ::c_ulong = 512;
796 pub const ST_NOATIME: ::c_ulong = 1024;
797 pub const ST_NODIRATIME: ::c_ulong = 2048;
798 
799 pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
800 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
801 pub const RTLD_NODELETE: ::c_int = 0x1000;
802 pub const RTLD_NOW: ::c_int = 0x2;
803 
804 align_const! {
805     pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
806         size: [0; __SIZEOF_PTHREAD_MUTEX_T],
807     };
808     pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
809         size: [0; __SIZEOF_PTHREAD_COND_T],
810     };
811     pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
812         size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
813     };
814 }
815 
816 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
817 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
818 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
819 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
820 pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
821 pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
822 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
823 
824 pub const SCHED_OTHER: ::c_int = 0;
825 pub const SCHED_FIFO: ::c_int = 1;
826 pub const SCHED_RR: ::c_int = 2;
827 pub const SCHED_BATCH: ::c_int = 3;
828 pub const SCHED_IDLE: ::c_int = 5;
829 
830 pub const AF_IB: ::c_int = 27;
831 pub const AF_MPLS: ::c_int = 28;
832 pub const AF_NFC: ::c_int = 39;
833 pub const AF_VSOCK: ::c_int = 40;
834 pub const PF_IB: ::c_int = AF_IB;
835 pub const PF_MPLS: ::c_int = AF_MPLS;
836 pub const PF_NFC: ::c_int = AF_NFC;
837 pub const PF_VSOCK: ::c_int = AF_VSOCK;
838 
839 // System V IPC
840 pub const IPC_PRIVATE: ::key_t = 0;
841 
842 pub const IPC_CREAT: ::c_int = 0o1000;
843 pub const IPC_EXCL: ::c_int = 0o2000;
844 pub const IPC_NOWAIT: ::c_int = 0o4000;
845 
846 pub const IPC_RMID: ::c_int = 0;
847 pub const IPC_SET: ::c_int = 1;
848 pub const IPC_STAT: ::c_int = 2;
849 pub const IPC_INFO: ::c_int = 3;
850 pub const MSG_STAT: ::c_int = 11;
851 pub const MSG_INFO: ::c_int = 12;
852 
853 pub const MSG_NOERROR: ::c_int = 0o10000;
854 pub const MSG_EXCEPT: ::c_int = 0o20000;
855 
856 pub const SHM_R: ::c_int = 0o400;
857 pub const SHM_W: ::c_int = 0o200;
858 
859 pub const SHM_RDONLY: ::c_int = 0o10000;
860 pub const SHM_RND: ::c_int = 0o20000;
861 pub const SHM_REMAP: ::c_int = 0o40000;
862 pub const SHM_EXEC: ::c_int = 0o100000;
863 
864 pub const SHM_LOCK: ::c_int = 11;
865 pub const SHM_UNLOCK: ::c_int = 12;
866 
867 pub const SHM_HUGETLB: ::c_int = 0o4000;
868 pub const SHM_NORESERVE: ::c_int = 0o10000;
869 
870 pub const QFMT_VFS_OLD: ::c_int = 1;
871 pub const QFMT_VFS_V0: ::c_int = 2;
872 
873 pub const EFD_SEMAPHORE: ::c_int = 0x1;
874 
875 pub const LOG_NFACILITIES: ::c_int = 24;
876 
877 pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
878 
879 pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
880 pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
881 pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
882 pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
883 pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
884 pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
885 pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
886 
887 pub const AI_PASSIVE: ::c_int = 0x0001;
888 pub const AI_CANONNAME: ::c_int = 0x0002;
889 pub const AI_NUMERICHOST: ::c_int = 0x0004;
890 pub const AI_V4MAPPED: ::c_int = 0x0008;
891 pub const AI_ALL: ::c_int = 0x0010;
892 pub const AI_ADDRCONFIG: ::c_int = 0x0020;
893 
894 pub const AI_NUMERICSERV: ::c_int = 0x0400;
895 
896 pub const EAI_BADFLAGS: ::c_int = -1;
897 pub const EAI_NONAME: ::c_int = -2;
898 pub const EAI_AGAIN: ::c_int = -3;
899 pub const EAI_FAIL: ::c_int = -4;
900 pub const EAI_FAMILY: ::c_int = -6;
901 pub const EAI_SOCKTYPE: ::c_int = -7;
902 pub const EAI_SERVICE: ::c_int = -8;
903 pub const EAI_MEMORY: ::c_int = -10;
904 pub const EAI_OVERFLOW: ::c_int = -12;
905 
906 pub const NI_NUMERICHOST: ::c_int = 1;
907 pub const NI_NUMERICSERV: ::c_int = 2;
908 pub const NI_NOFQDN: ::c_int = 4;
909 pub const NI_NAMEREQD: ::c_int = 8;
910 pub const NI_DGRAM: ::c_int = 16;
911 
912 pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
913 pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
914 pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
915 
916 pub const EAI_SYSTEM: ::c_int = -11;
917 
918 pub const AIO_CANCELED: ::c_int = 0;
919 pub const AIO_NOTCANCELED: ::c_int = 1;
920 pub const AIO_ALLDONE: ::c_int = 2;
921 pub const LIO_READ: ::c_int = 0;
922 pub const LIO_WRITE: ::c_int = 1;
923 pub const LIO_NOP: ::c_int = 2;
924 pub const LIO_WAIT: ::c_int = 0;
925 pub const LIO_NOWAIT: ::c_int = 1;
926 
927 pub const MREMAP_MAYMOVE: ::c_int = 1;
928 pub const MREMAP_FIXED: ::c_int = 2;
929 
930 pub const PR_SET_PDEATHSIG: ::c_int = 1;
931 pub const PR_GET_PDEATHSIG: ::c_int = 2;
932 
933 pub const PR_GET_DUMPABLE: ::c_int = 3;
934 pub const PR_SET_DUMPABLE: ::c_int = 4;
935 
936 pub const PR_GET_UNALIGN: ::c_int = 5;
937 pub const PR_SET_UNALIGN: ::c_int = 6;
938 pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
939 pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
940 
941 pub const PR_GET_KEEPCAPS: ::c_int = 7;
942 pub const PR_SET_KEEPCAPS: ::c_int = 8;
943 
944 pub const PR_GET_FPEMU: ::c_int = 9;
945 pub const PR_SET_FPEMU: ::c_int = 10;
946 pub const PR_FPEMU_NOPRINT: ::c_int = 1;
947 pub const PR_FPEMU_SIGFPE: ::c_int = 2;
948 
949 pub const PR_GET_FPEXC: ::c_int = 11;
950 pub const PR_SET_FPEXC: ::c_int = 12;
951 pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
952 pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
953 pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
954 pub const PR_FP_EXC_UND: ::c_int = 0x040000;
955 pub const PR_FP_EXC_RES: ::c_int = 0x080000;
956 pub const PR_FP_EXC_INV: ::c_int = 0x100000;
957 pub const PR_FP_EXC_DISABLED: ::c_int = 0;
958 pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
959 pub const PR_FP_EXC_ASYNC: ::c_int = 2;
960 pub const PR_FP_EXC_PRECISE: ::c_int = 3;
961 
962 pub const PR_GET_TIMING: ::c_int = 13;
963 pub const PR_SET_TIMING: ::c_int = 14;
964 pub const PR_TIMING_STATISTICAL: ::c_int = 0;
965 pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
966 
967 pub const PR_SET_NAME: ::c_int = 15;
968 pub const PR_GET_NAME: ::c_int = 16;
969 
970 pub const PR_GET_ENDIAN: ::c_int = 19;
971 pub const PR_SET_ENDIAN: ::c_int = 20;
972 pub const PR_ENDIAN_BIG: ::c_int = 0;
973 pub const PR_ENDIAN_LITTLE: ::c_int = 1;
974 pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
975 
976 pub const PR_GET_SECCOMP: ::c_int = 21;
977 pub const PR_SET_SECCOMP: ::c_int = 22;
978 
979 pub const PR_CAPBSET_READ: ::c_int = 23;
980 pub const PR_CAPBSET_DROP: ::c_int = 24;
981 
982 pub const PR_GET_TSC: ::c_int = 25;
983 pub const PR_SET_TSC: ::c_int = 26;
984 pub const PR_TSC_ENABLE: ::c_int = 1;
985 pub const PR_TSC_SIGSEGV: ::c_int = 2;
986 
987 pub const PR_GET_SECUREBITS: ::c_int = 27;
988 pub const PR_SET_SECUREBITS: ::c_int = 28;
989 
990 pub const PR_SET_TIMERSLACK: ::c_int = 29;
991 pub const PR_GET_TIMERSLACK: ::c_int = 30;
992 
993 pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
994 pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
995 
996 pub const PR_MCE_KILL: ::c_int = 33;
997 pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
998 pub const PR_MCE_KILL_SET: ::c_int = 1;
999 
1000 pub const PR_MCE_KILL_LATE: ::c_int = 0;
1001 pub const PR_MCE_KILL_EARLY: ::c_int = 1;
1002 pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
1003 
1004 pub const PR_MCE_KILL_GET: ::c_int = 34;
1005 
1006 pub const PR_SET_MM: ::c_int = 35;
1007 pub const PR_SET_MM_START_CODE: ::c_int = 1;
1008 pub const PR_SET_MM_END_CODE: ::c_int = 2;
1009 pub const PR_SET_MM_START_DATA: ::c_int = 3;
1010 pub const PR_SET_MM_END_DATA: ::c_int = 4;
1011 pub const PR_SET_MM_START_STACK: ::c_int = 5;
1012 pub const PR_SET_MM_START_BRK: ::c_int = 6;
1013 pub const PR_SET_MM_BRK: ::c_int = 7;
1014 pub const PR_SET_MM_ARG_START: ::c_int = 8;
1015 pub const PR_SET_MM_ARG_END: ::c_int = 9;
1016 pub const PR_SET_MM_ENV_START: ::c_int = 10;
1017 pub const PR_SET_MM_ENV_END: ::c_int = 11;
1018 pub const PR_SET_MM_AUXV: ::c_int = 12;
1019 pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
1020 pub const PR_SET_MM_MAP: ::c_int = 14;
1021 pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
1022 
1023 pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
1024 pub const PR_SET_PTRACER_ANY: ::c_ulong = 0xffffffffffffffff;
1025 
1026 pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
1027 pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
1028 
1029 pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
1030 pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
1031 
1032 pub const PR_GET_TID_ADDRESS: ::c_int = 40;
1033 
1034 pub const PR_SET_THP_DISABLE: ::c_int = 41;
1035 pub const PR_GET_THP_DISABLE: ::c_int = 42;
1036 
1037 pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43;
1038 pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44;
1039 
1040 pub const PR_SET_FP_MODE: ::c_int = 45;
1041 pub const PR_GET_FP_MODE: ::c_int = 46;
1042 pub const PR_FP_MODE_FR: ::c_int = 1 << 0;
1043 pub const PR_FP_MODE_FRE: ::c_int = 1 << 1;
1044 
1045 pub const PR_CAP_AMBIENT: ::c_int = 47;
1046 pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1;
1047 pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
1048 pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
1049 pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
1050 
1051 pub const ITIMER_REAL: ::c_int = 0;
1052 pub const ITIMER_VIRTUAL: ::c_int = 1;
1053 pub const ITIMER_PROF: ::c_int = 2;
1054 
1055 pub const _POSIX_VDISABLE: ::cc_t = 0;
1056 
1057 pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
1058 pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
1059 
1060 // On Linux, libc doesn't define this constant, libattr does instead.
1061 // We still define it for Linux as it's defined by libc on other platforms,
1062 // and it's mentioned in the man pages for getxattr and setxattr.
1063 pub const SFD_CLOEXEC: ::c_int = 0x080000;
1064 
1065 pub const NCCS: usize = 32;
1066 
1067 pub const O_TRUNC: ::c_int = 512;
1068 pub const O_NOATIME: ::c_int = 0o1000000;
1069 pub const O_CLOEXEC: ::c_int = 0x80000;
1070 
1071 // Defined as wasi value.
1072 pub const EPERM: ::c_int = 63;
1073 pub const ENOENT: ::c_int = 44;
1074 pub const ESRCH: ::c_int = 71;
1075 pub const EINTR: ::c_int = 27;
1076 pub const EIO: ::c_int = 29;
1077 pub const ENXIO: ::c_int = 60;
1078 pub const E2BIG: ::c_int = 1;
1079 pub const ENOEXEC: ::c_int = 45;
1080 pub const EBADF: ::c_int = 8;
1081 pub const ECHILD: ::c_int = 12;
1082 pub const EAGAIN: ::c_int = 6;
1083 pub const ENOMEM: ::c_int = 48;
1084 pub const EACCES: ::c_int = 2;
1085 pub const EFAULT: ::c_int = 21;
1086 pub const ENOTBLK: ::c_int = 105;
1087 pub const EBUSY: ::c_int = 10;
1088 pub const EEXIST: ::c_int = 20;
1089 pub const EXDEV: ::c_int = 75;
1090 pub const ENODEV: ::c_int = 43;
1091 pub const ENOTDIR: ::c_int = 54;
1092 pub const EISDIR: ::c_int = 31;
1093 pub const EINVAL: ::c_int = 28;
1094 pub const ENFILE: ::c_int = 41;
1095 pub const EMFILE: ::c_int = 33;
1096 pub const ENOTTY: ::c_int = 59;
1097 pub const ETXTBSY: ::c_int = 74;
1098 pub const EFBIG: ::c_int = 22;
1099 pub const ENOSPC: ::c_int = 51;
1100 pub const ESPIPE: ::c_int = 70;
1101 pub const EROFS: ::c_int = 69;
1102 pub const EMLINK: ::c_int = 34;
1103 pub const EPIPE: ::c_int = 64;
1104 pub const EDOM: ::c_int = 18;
1105 pub const ERANGE: ::c_int = 68;
1106 pub const EWOULDBLOCK: ::c_int = EAGAIN;
1107 pub const ENOLINK: ::c_int = 47;
1108 pub const EPROTO: ::c_int = 65;
1109 pub const EDEADLK: ::c_int = 16;
1110 pub const EDEADLOCK: ::c_int = EDEADLK;
1111 pub const ENAMETOOLONG: ::c_int = 37;
1112 pub const ENOLCK: ::c_int = 46;
1113 pub const ENOSYS: ::c_int = 52;
1114 pub const ENOTEMPTY: ::c_int = 55;
1115 pub const ELOOP: ::c_int = 32;
1116 pub const ENOMSG: ::c_int = 49;
1117 pub const EIDRM: ::c_int = 24;
1118 pub const EMULTIHOP: ::c_int = 36;
1119 pub const EBADMSG: ::c_int = 9;
1120 pub const EOVERFLOW: ::c_int = 61;
1121 pub const EILSEQ: ::c_int = 25;
1122 pub const ENOTSOCK: ::c_int = 57;
1123 pub const EDESTADDRREQ: ::c_int = 17;
1124 pub const EMSGSIZE: ::c_int = 35;
1125 pub const EPROTOTYPE: ::c_int = 67;
1126 pub const ENOPROTOOPT: ::c_int = 50;
1127 pub const EPROTONOSUPPORT: ::c_int = 66;
1128 pub const EAFNOSUPPORT: ::c_int = 5;
1129 pub const EADDRINUSE: ::c_int = 3;
1130 pub const EADDRNOTAVAIL: ::c_int = 4;
1131 pub const ENETDOWN: ::c_int = 38;
1132 pub const ENETUNREACH: ::c_int = 40;
1133 pub const ENETRESET: ::c_int = 39;
1134 pub const ECONNABORTED: ::c_int = 13;
1135 pub const ECONNRESET: ::c_int = 15;
1136 pub const ENOBUFS: ::c_int = 42;
1137 pub const EISCONN: ::c_int = 30;
1138 pub const ENOTCONN: ::c_int = 53;
1139 pub const ETIMEDOUT: ::c_int = 73;
1140 pub const ECONNREFUSED: ::c_int = 14;
1141 pub const EHOSTUNREACH: ::c_int = 23;
1142 pub const EALREADY: ::c_int = 7;
1143 pub const EINPROGRESS: ::c_int = 26;
1144 pub const ESTALE: ::c_int = 72;
1145 pub const EDQUOT: ::c_int = 19;
1146 pub const ECANCELED: ::c_int = 11;
1147 pub const EOWNERDEAD: ::c_int = 62;
1148 pub const ENOTRECOVERABLE: ::c_int = 56;
1149 
1150 pub const ENOSTR: ::c_int = 100;
1151 pub const EBFONT: ::c_int = 101;
1152 pub const EBADSLT: ::c_int = 102;
1153 pub const EBADRQC: ::c_int = 103;
1154 pub const ENOANO: ::c_int = 104;
1155 pub const ECHRNG: ::c_int = 106;
1156 pub const EL3HLT: ::c_int = 107;
1157 pub const EL3RST: ::c_int = 108;
1158 pub const ELNRNG: ::c_int = 109;
1159 pub const EUNATCH: ::c_int = 110;
1160 pub const ENOCSI: ::c_int = 111;
1161 pub const EL2HLT: ::c_int = 112;
1162 pub const EBADE: ::c_int = 113;
1163 pub const EBADR: ::c_int = 114;
1164 pub const EXFULL: ::c_int = 115;
1165 pub const ENODATA: ::c_int = 116;
1166 pub const ETIME: ::c_int = 117;
1167 pub const ENOSR: ::c_int = 118;
1168 pub const ENONET: ::c_int = 119;
1169 pub const ENOPKG: ::c_int = 120;
1170 pub const EREMOTE: ::c_int = 121;
1171 pub const EADV: ::c_int = 122;
1172 pub const ESRMNT: ::c_int = 123;
1173 pub const ECOMM: ::c_int = 124;
1174 pub const EDOTDOT: ::c_int = 125;
1175 pub const ENOTUNIQ: ::c_int = 126;
1176 pub const EBADFD: ::c_int = 127;
1177 pub const EREMCHG: ::c_int = 128;
1178 pub const ELIBACC: ::c_int = 129;
1179 pub const ELIBBAD: ::c_int = 130;
1180 pub const ELIBSCN: ::c_int = 131;
1181 pub const ELIBMAX: ::c_int = 132;
1182 pub const ELIBEXEC: ::c_int = 133;
1183 pub const ERESTART: ::c_int = 134;
1184 pub const ESTRPIPE: ::c_int = 135;
1185 pub const EUSERS: ::c_int = 136;
1186 pub const ESOCKTNOSUPPORT: ::c_int = 137;
1187 pub const EOPNOTSUPP: ::c_int = 138;
1188 pub const ENOTSUP: ::c_int = EOPNOTSUPP;
1189 pub const EPFNOSUPPORT: ::c_int = 139;
1190 pub const ESHUTDOWN: ::c_int = 140;
1191 pub const ETOOMANYREFS: ::c_int = 141;
1192 pub const EHOSTDOWN: ::c_int = 142;
1193 pub const EUCLEAN: ::c_int = 143;
1194 pub const ENOTNAM: ::c_int = 144;
1195 pub const ENAVAIL: ::c_int = 145;
1196 pub const EISNAM: ::c_int = 146;
1197 pub const EREMOTEIO: ::c_int = 147;
1198 pub const ENOMEDIUM: ::c_int = 148;
1199 pub const EMEDIUMTYPE: ::c_int = 149;
1200 pub const ENOKEY: ::c_int = 150;
1201 pub const EKEYEXPIRED: ::c_int = 151;
1202 pub const EKEYREVOKED: ::c_int = 152;
1203 pub const EKEYREJECTED: ::c_int = 153;
1204 pub const ERFKILL: ::c_int = 154;
1205 pub const EHWPOISON: ::c_int = 155;
1206 pub const EL2NSYNC: ::c_int = 156;
1207 
1208 pub const SA_NODEFER: ::c_int = 0x40000000;
1209 pub const SA_RESETHAND: ::c_int = 0x80000000;
1210 pub const SA_RESTART: ::c_int = 0x10000000;
1211 pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
1212 
1213 pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
1214 
1215 pub const EFD_CLOEXEC: ::c_int = 0x80000;
1216 
1217 pub const BUFSIZ: ::c_uint = 1024;
1218 pub const TMP_MAX: ::c_uint = 10000;
1219 pub const FOPEN_MAX: ::c_uint = 1000;
1220 pub const O_PATH: ::c_int = 0o10000000;
1221 pub const O_EXEC: ::c_int = 0o10000000;
1222 pub const O_SEARCH: ::c_int = 0o10000000;
1223 pub const O_ACCMODE: ::c_int = 0o10000003;
1224 pub const O_NDELAY: ::c_int = O_NONBLOCK;
1225 pub const NI_MAXHOST: ::socklen_t = 255;
1226 pub const PTHREAD_STACK_MIN: ::size_t = 2048;
1227 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
1228 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
1229 
1230 pub const POSIX_MADV_DONTNEED: ::c_int = 0;
1231 
1232 pub const RLIM_INFINITY: ::rlim_t = !0;
1233 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1234 pub const RLIMIT_NLIMITS: ::c_int = 15;
1235 #[allow(deprecated)]
1236 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1237 pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
1238 
1239 pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
1240 
1241 #[doc(hidden)]
1242 #[deprecated(since = "0.2.55", note = "Use SIGSYS instead")]
1243 pub const SIGUNUSED: ::c_int = ::SIGSYS;
1244 
1245 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
1246 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
1247 pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
1248 
1249 pub const CPU_SETSIZE: ::c_int = 128;
1250 
1251 pub const QFMT_VFS_V1: ::c_int = 4;
1252 
1253 pub const PTRACE_TRACEME: ::c_int = 0;
1254 pub const PTRACE_PEEKTEXT: ::c_int = 1;
1255 pub const PTRACE_PEEKDATA: ::c_int = 2;
1256 pub const PTRACE_PEEKUSER: ::c_int = 3;
1257 pub const PTRACE_POKETEXT: ::c_int = 4;
1258 pub const PTRACE_POKEDATA: ::c_int = 5;
1259 pub const PTRACE_POKEUSER: ::c_int = 6;
1260 pub const PTRACE_CONT: ::c_int = 7;
1261 pub const PTRACE_KILL: ::c_int = 8;
1262 pub const PTRACE_SINGLESTEP: ::c_int = 9;
1263 pub const PTRACE_ATTACH: ::c_int = 16;
1264 pub const PTRACE_DETACH: ::c_int = 17;
1265 pub const PTRACE_SYSCALL: ::c_int = 24;
1266 pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
1267 pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
1268 pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
1269 pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
1270 pub const PTRACE_GETREGSET: ::c_int = 0x4204;
1271 pub const PTRACE_SETREGSET: ::c_int = 0x4205;
1272 pub const PTRACE_SEIZE: ::c_int = 0x4206;
1273 pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
1274 pub const PTRACE_LISTEN: ::c_int = 0x4208;
1275 pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
1276 
1277 pub const PTRACE_GETFPREGS: ::c_uint = 14;
1278 pub const PTRACE_SETFPREGS: ::c_uint = 15;
1279 pub const PTRACE_GETFPXREGS: ::c_uint = 18;
1280 pub const PTRACE_SETFPXREGS: ::c_uint = 19;
1281 pub const PTRACE_GETREGS: ::c_uint = 12;
1282 pub const PTRACE_SETREGS: ::c_uint = 13;
1283 
1284 pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
1285 
1286 pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
1287 
1288 pub const TCSANOW: ::c_int = 0;
1289 pub const TCSADRAIN: ::c_int = 1;
1290 pub const TCSAFLUSH: ::c_int = 2;
1291 
1292 pub const TIOCINQ: ::c_int = ::FIONREAD;
1293 
1294 pub const RTLD_GLOBAL: ::c_int = 0x100;
1295 pub const RTLD_NOLOAD: ::c_int = 0x4;
1296 
1297 pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
1298 
1299 pub const MCL_CURRENT: ::c_int = 0x0001;
1300 pub const MCL_FUTURE: ::c_int = 0x0002;
1301 
1302 pub const SIGSTKSZ: ::size_t = 8192;
1303 pub const MINSIGSTKSZ: ::size_t = 2048;
1304 pub const CBAUD: ::tcflag_t = 0o0010017;
1305 pub const TAB1: ::c_int = 0x00000800;
1306 pub const TAB2: ::c_int = 0x00001000;
1307 pub const TAB3: ::c_int = 0x00001800;
1308 pub const CR1: ::c_int = 0x00000200;
1309 pub const CR2: ::c_int = 0x00000400;
1310 pub const CR3: ::c_int = 0x00000600;
1311 pub const FF1: ::c_int = 0x00008000;
1312 pub const BS1: ::c_int = 0x00002000;
1313 pub const VT1: ::c_int = 0x00004000;
1314 pub const VWERASE: usize = 14;
1315 pub const VREPRINT: usize = 12;
1316 pub const VSUSP: usize = 10;
1317 pub const VSTART: usize = 8;
1318 pub const VSTOP: usize = 9;
1319 pub const VDISCARD: usize = 13;
1320 pub const VTIME: usize = 5;
1321 pub const IXON: ::tcflag_t = 0x00000400;
1322 pub const IXOFF: ::tcflag_t = 0x00001000;
1323 pub const ONLCR: ::tcflag_t = 0x4;
1324 pub const CSIZE: ::tcflag_t = 0x00000030;
1325 pub const CS6: ::tcflag_t = 0x00000010;
1326 pub const CS7: ::tcflag_t = 0x00000020;
1327 pub const CS8: ::tcflag_t = 0x00000030;
1328 pub const CSTOPB: ::tcflag_t = 0x00000040;
1329 pub const CREAD: ::tcflag_t = 0x00000080;
1330 pub const PARENB: ::tcflag_t = 0x00000100;
1331 pub const PARODD: ::tcflag_t = 0x00000200;
1332 pub const HUPCL: ::tcflag_t = 0x00000400;
1333 pub const CLOCAL: ::tcflag_t = 0x00000800;
1334 pub const ECHOKE: ::tcflag_t = 0x00000800;
1335 pub const ECHOE: ::tcflag_t = 0x00000010;
1336 pub const ECHOK: ::tcflag_t = 0x00000020;
1337 pub const ECHONL: ::tcflag_t = 0x00000040;
1338 pub const ECHOPRT: ::tcflag_t = 0x00000400;
1339 pub const ECHOCTL: ::tcflag_t = 0x00000200;
1340 pub const ISIG: ::tcflag_t = 0x00000001;
1341 pub const ICANON: ::tcflag_t = 0x00000002;
1342 pub const PENDIN: ::tcflag_t = 0x00004000;
1343 pub const NOFLSH: ::tcflag_t = 0x00000080;
1344 pub const CBAUDEX: ::tcflag_t = 0o010000;
1345 pub const VSWTC: usize = 7;
1346 pub const OLCUC: ::tcflag_t = 0o000002;
1347 pub const NLDLY: ::tcflag_t = 0o000400;
1348 pub const CRDLY: ::tcflag_t = 0o003000;
1349 pub const TABDLY: ::tcflag_t = 0o014000;
1350 pub const BSDLY: ::tcflag_t = 0o020000;
1351 pub const FFDLY: ::tcflag_t = 0o100000;
1352 pub const VTDLY: ::tcflag_t = 0o040000;
1353 pub const XTABS: ::tcflag_t = 0o014000;
1354 
1355 pub const B0: ::speed_t = 0o000000;
1356 pub const B50: ::speed_t = 0o000001;
1357 pub const B75: ::speed_t = 0o000002;
1358 pub const B110: ::speed_t = 0o000003;
1359 pub const B134: ::speed_t = 0o000004;
1360 pub const B150: ::speed_t = 0o000005;
1361 pub const B200: ::speed_t = 0o000006;
1362 pub const B300: ::speed_t = 0o000007;
1363 pub const B600: ::speed_t = 0o000010;
1364 pub const B1200: ::speed_t = 0o000011;
1365 pub const B1800: ::speed_t = 0o000012;
1366 pub const B2400: ::speed_t = 0o000013;
1367 pub const B4800: ::speed_t = 0o000014;
1368 pub const B9600: ::speed_t = 0o000015;
1369 pub const B19200: ::speed_t = 0o000016;
1370 pub const B38400: ::speed_t = 0o000017;
1371 pub const B57600: ::speed_t = 0o010001;
1372 pub const B115200: ::speed_t = 0o010002;
1373 pub const B230400: ::speed_t = 0o010003;
1374 pub const B460800: ::speed_t = 0o010004;
1375 pub const B500000: ::speed_t = 0o010005;
1376 pub const B576000: ::speed_t = 0o010006;
1377 pub const B921600: ::speed_t = 0o010007;
1378 pub const B1000000: ::speed_t = 0o010010;
1379 pub const B1152000: ::speed_t = 0o010011;
1380 pub const B1500000: ::speed_t = 0o010012;
1381 pub const B2000000: ::speed_t = 0o010013;
1382 pub const B2500000: ::speed_t = 0o010014;
1383 pub const B3000000: ::speed_t = 0o010015;
1384 pub const B3500000: ::speed_t = 0o010016;
1385 pub const B4000000: ::speed_t = 0o010017;
1386 
1387 pub const SO_BINDTODEVICE: ::c_int = 25;
1388 pub const SO_TIMESTAMP: ::c_int = 29;
1389 pub const SO_MARK: ::c_int = 36;
1390 pub const SO_RXQ_OVFL: ::c_int = 40;
1391 pub const SO_PEEK_OFF: ::c_int = 42;
1392 pub const SO_BUSY_POLL: ::c_int = 46;
1393 
1394 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
1395 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
1396 
1397 pub const O_DIRECT: ::c_int = 0x4000;
1398 pub const O_DIRECTORY: ::c_int = 0x10000;
1399 pub const O_NOFOLLOW: ::c_int = 0x20000;
1400 pub const O_ASYNC: ::c_int = 0x2000;
1401 
1402 pub const FIOCLEX: ::c_int = 0x5451;
1403 pub const FIONBIO: ::c_int = 0x5421;
1404 
1405 pub const RLIMIT_RSS: ::c_int = 5;
1406 pub const RLIMIT_NOFILE: ::c_int = 7;
1407 pub const RLIMIT_AS: ::c_int = 9;
1408 pub const RLIMIT_NPROC: ::c_int = 6;
1409 pub const RLIMIT_MEMLOCK: ::c_int = 8;
1410 pub const RLIMIT_CPU: ::c_int = 0;
1411 pub const RLIMIT_FSIZE: ::c_int = 1;
1412 pub const RLIMIT_DATA: ::c_int = 2;
1413 pub const RLIMIT_STACK: ::c_int = 3;
1414 pub const RLIMIT_CORE: ::c_int = 4;
1415 pub const RLIMIT_LOCKS: ::c_int = 10;
1416 pub const RLIMIT_SIGPENDING: ::c_int = 11;
1417 pub const RLIMIT_MSGQUEUE: ::c_int = 12;
1418 pub const RLIMIT_NICE: ::c_int = 13;
1419 pub const RLIMIT_RTPRIO: ::c_int = 14;
1420 
1421 pub const O_APPEND: ::c_int = 1024;
1422 pub const O_CREAT: ::c_int = 64;
1423 pub const O_EXCL: ::c_int = 128;
1424 pub const O_NOCTTY: ::c_int = 256;
1425 pub const O_NONBLOCK: ::c_int = 2048;
1426 pub const O_SYNC: ::c_int = 1052672;
1427 pub const O_RSYNC: ::c_int = 1052672;
1428 pub const O_DSYNC: ::c_int = 4096;
1429 
1430 pub const SOCK_NONBLOCK: ::c_int = 2048;
1431 
1432 pub const MAP_ANON: ::c_int = 0x0020;
1433 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
1434 pub const MAP_DENYWRITE: ::c_int = 0x0800;
1435 pub const MAP_EXECUTABLE: ::c_int = 0x01000;
1436 pub const MAP_LOCKED: ::c_int = 0x02000;
1437 pub const MAP_NORESERVE: ::c_int = 0x04000;
1438 pub const MAP_POPULATE: ::c_int = 0x08000;
1439 pub const MAP_NONBLOCK: ::c_int = 0x010000;
1440 pub const MAP_STACK: ::c_int = 0x020000;
1441 
1442 pub const SOCK_STREAM: ::c_int = 1;
1443 pub const SOCK_DGRAM: ::c_int = 2;
1444 pub const SOCK_SEQPACKET: ::c_int = 5;
1445 
1446 pub const IPPROTO_MAX: ::c_int = 256;
1447 
1448 pub const SOL_SOCKET: ::c_int = 1;
1449 
1450 pub const SO_REUSEADDR: ::c_int = 2;
1451 pub const SO_TYPE: ::c_int = 3;
1452 pub const SO_ERROR: ::c_int = 4;
1453 pub const SO_DONTROUTE: ::c_int = 5;
1454 pub const SO_BROADCAST: ::c_int = 6;
1455 pub const SO_SNDBUF: ::c_int = 7;
1456 pub const SO_RCVBUF: ::c_int = 8;
1457 pub const SO_KEEPALIVE: ::c_int = 9;
1458 pub const SO_OOBINLINE: ::c_int = 10;
1459 pub const SO_LINGER: ::c_int = 13;
1460 pub const SO_REUSEPORT: ::c_int = 15;
1461 pub const SO_RCVLOWAT: ::c_int = 18;
1462 pub const SO_SNDLOWAT: ::c_int = 19;
1463 pub const SO_RCVTIMEO: ::c_int = 20;
1464 pub const SO_SNDTIMEO: ::c_int = 21;
1465 pub const SO_ACCEPTCONN: ::c_int = 30;
1466 
1467 pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
1468 pub const IPV6_RTHDR_STRICT: ::c_int = 1;
1469 
1470 pub const SA_ONSTACK: ::c_int = 0x08000000;
1471 pub const SA_SIGINFO: ::c_int = 0x00000004;
1472 pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
1473 
1474 pub const SIGCHLD: ::c_int = 17;
1475 pub const SIGBUS: ::c_int = 7;
1476 pub const SIGTTIN: ::c_int = 21;
1477 pub const SIGTTOU: ::c_int = 22;
1478 pub const SIGXCPU: ::c_int = 24;
1479 pub const SIGXFSZ: ::c_int = 25;
1480 pub const SIGVTALRM: ::c_int = 26;
1481 pub const SIGPROF: ::c_int = 27;
1482 pub const SIGWINCH: ::c_int = 28;
1483 pub const SIGUSR1: ::c_int = 10;
1484 pub const SIGUSR2: ::c_int = 12;
1485 pub const SIGCONT: ::c_int = 18;
1486 pub const SIGSTOP: ::c_int = 19;
1487 pub const SIGTSTP: ::c_int = 20;
1488 pub const SIGURG: ::c_int = 23;
1489 pub const SIGIO: ::c_int = 29;
1490 pub const SIGSYS: ::c_int = 31;
1491 pub const SIGSTKFLT: ::c_int = 16;
1492 pub const SIGPOLL: ::c_int = 29;
1493 pub const SIGPWR: ::c_int = 30;
1494 pub const SIG_SETMASK: ::c_int = 2;
1495 pub const SIG_BLOCK: ::c_int = 0x000000;
1496 pub const SIG_UNBLOCK: ::c_int = 0x01;
1497 
1498 pub const EXTPROC: ::tcflag_t = 0x00010000;
1499 
1500 pub const MAP_HUGETLB: ::c_int = 0x040000;
1501 
1502 pub const F_GETLK: ::c_int = 12;
1503 pub const F_GETOWN: ::c_int = 9;
1504 pub const F_SETLK: ::c_int = 13;
1505 pub const F_SETLKW: ::c_int = 14;
1506 pub const F_SETOWN: ::c_int = 8;
1507 pub const F_OFD_GETLK: ::c_int = 36;
1508 pub const F_OFD_SETLK: ::c_int = 37;
1509 pub const F_OFD_SETLKW: ::c_int = 38;
1510 
1511 pub const VEOF: usize = 4;
1512 pub const VEOL: usize = 11;
1513 pub const VEOL2: usize = 16;
1514 pub const VMIN: usize = 6;
1515 pub const IEXTEN: ::tcflag_t = 0x00008000;
1516 pub const TOSTOP: ::tcflag_t = 0x00000100;
1517 pub const FLUSHO: ::tcflag_t = 0x00001000;
1518 
1519 pub const TCGETS: ::c_int = 0x5401;
1520 pub const TCSETS: ::c_int = 0x5402;
1521 pub const TCSETSW: ::c_int = 0x5403;
1522 pub const TCSETSF: ::c_int = 0x5404;
1523 pub const TCGETA: ::c_int = 0x5405;
1524 pub const TCSETA: ::c_int = 0x5406;
1525 pub const TCSETAW: ::c_int = 0x5407;
1526 pub const TCSETAF: ::c_int = 0x5408;
1527 pub const TCSBRK: ::c_int = 0x5409;
1528 pub const TCXONC: ::c_int = 0x540A;
1529 pub const TCFLSH: ::c_int = 0x540B;
1530 pub const TIOCGSOFTCAR: ::c_int = 0x5419;
1531 pub const TIOCSSOFTCAR: ::c_int = 0x541A;
1532 pub const TIOCLINUX: ::c_int = 0x541C;
1533 pub const TIOCGSERIAL: ::c_int = 0x541E;
1534 pub const TIOCEXCL: ::c_int = 0x540C;
1535 pub const TIOCNXCL: ::c_int = 0x540D;
1536 pub const TIOCSCTTY: ::c_int = 0x540E;
1537 pub const TIOCGPGRP: ::c_int = 0x540F;
1538 pub const TIOCSPGRP: ::c_int = 0x5410;
1539 pub const TIOCOUTQ: ::c_int = 0x5411;
1540 pub const TIOCSTI: ::c_int = 0x5412;
1541 pub const TIOCGWINSZ: ::c_int = 0x5413;
1542 pub const TIOCSWINSZ: ::c_int = 0x5414;
1543 pub const TIOCMGET: ::c_int = 0x5415;
1544 pub const TIOCMBIS: ::c_int = 0x5416;
1545 pub const TIOCMBIC: ::c_int = 0x5417;
1546 pub const TIOCMSET: ::c_int = 0x5418;
1547 pub const FIONREAD: ::c_int = 0x541B;
1548 pub const TIOCCONS: ::c_int = 0x541D;
1549 
1550 pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit)
1551 
1552 pub const POLLWRNORM: ::c_short = 0x100;
1553 pub const POLLWRBAND: ::c_short = 0x200;
1554 
1555 pub const TIOCM_LE: ::c_int = 0x001;
1556 pub const TIOCM_DTR: ::c_int = 0x002;
1557 pub const TIOCM_RTS: ::c_int = 0x004;
1558 pub const TIOCM_ST: ::c_int = 0x008;
1559 pub const TIOCM_SR: ::c_int = 0x010;
1560 pub const TIOCM_CTS: ::c_int = 0x020;
1561 pub const TIOCM_CAR: ::c_int = 0x040;
1562 pub const TIOCM_RNG: ::c_int = 0x080;
1563 pub const TIOCM_DSR: ::c_int = 0x100;
1564 pub const TIOCM_CD: ::c_int = TIOCM_CAR;
1565 pub const TIOCM_RI: ::c_int = TIOCM_RNG;
1566 pub const O_TMPFILE: ::c_int = 0x400000;
1567 
1568 pub const MAX_ADDR_LEN: usize = 7;
1569 pub const ARPD_UPDATE: ::c_ushort = 0x01;
1570 pub const ARPD_LOOKUP: ::c_ushort = 0x02;
1571 pub const ARPD_FLUSH: ::c_ushort = 0x03;
1572 pub const ATF_MAGIC: ::c_int = 0x80;
1573 
1574 pub const PRIO_PROCESS: ::c_int = 0;
1575 pub const PRIO_PGRP: ::c_int = 1;
1576 pub const PRIO_USER: ::c_int = 2;
1577 
1578 pub const SOMAXCONN: ::c_int = 128;
1579 
1580 f! {
1581     pub fn CMSG_NXTHDR(mhdr: *const msghdr,
1582                        cmsg: *const cmsghdr) -> *mut cmsghdr {
1583         if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() {
1584             return 0 as *mut cmsghdr;
1585         };
1586         let next = (cmsg as usize +
1587                     super::CMSG_ALIGN((*cmsg).cmsg_len as usize))
1588             as *mut cmsghdr;
1589         let max = (*mhdr).msg_control as usize
1590             + (*mhdr).msg_controllen as usize;
1591         if (next.offset(1)) as usize > max {
1592             0 as *mut cmsghdr
1593         } else {
1594             next as *mut cmsghdr
1595         }
1596     }
1597 
1598     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1599         for slot in cpuset.bits.iter_mut() {
1600             *slot = 0;
1601         }
1602     }
1603 
1604     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1605         let size_in_bits
1606             = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1607         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1608         cpuset.bits[idx] |= 1 << offset;
1609         ()
1610     }
1611 
1612     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1613         let size_in_bits
1614             = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1615         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1616         cpuset.bits[idx] &= !(1 << offset);
1617         ()
1618     }
1619 
1620     pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
1621         let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]);
1622         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1623         0 != (cpuset.bits[idx] & (1 << offset))
1624     }
1625 
1626     pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
1627         set1.bits == set2.bits
1628     }
1629 
1630     pub fn major(dev: ::dev_t) -> ::c_uint {
1631         // see
1632         // https://github.com/emscripten-core/emscripten/blob/
1633         // main/system/lib/libc/musl/include/sys/sysmacros.h
1634         let mut major = 0;
1635         major |= (dev & 0x00000fff) >> 8;
1636         major |= (dev & 0xfffff000) >> 31 >> 1;
1637         major as ::c_uint
1638     }
1639 
1640     pub fn minor(dev: ::dev_t) -> ::c_uint {
1641         // see
1642         // https://github.com/emscripten-core/emscripten/blob/
1643         // main/system/lib/libc/musl/include/sys/sysmacros.h
1644         let mut minor = 0;
1645         minor |= (dev & 0x000000ff) >> 0;
1646         minor |= (dev & 0xffffff00) >> 12;
1647         minor as ::c_uint
1648     }
1649 }
1650 
1651 safe_f! {
1652     pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
1653         let major = major as ::dev_t;
1654         let minor = minor as ::dev_t;
1655         let mut dev = 0;
1656         dev |= (major & 0x00000fff) << 8;
1657         dev |= (major & 0xfffff000) << 31 << 1;
1658         dev |= (minor & 0x000000ff) << 0;
1659         dev |= (minor & 0xffffff00) << 12;
1660         dev
1661     }
1662 }
1663 
1664 extern "C" {
getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int1665     pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int1666     pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int1667     pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
1668 
abs(i: ::c_int) -> ::c_int1669     pub fn abs(i: ::c_int) -> ::c_int;
labs(i: ::c_long) -> ::c_long1670     pub fn labs(i: ::c_long) -> ::c_long;
rand() -> ::c_int1671     pub fn rand() -> ::c_int;
srand(seed: ::c_uint)1672     pub fn srand(seed: ::c_uint);
1673 
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1674     pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
1675 
setpwent()1676     pub fn setpwent();
endpwent()1677     pub fn endpwent();
getpwent() -> *mut passwd1678     pub fn getpwent() -> *mut passwd;
1679 
shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int1680     pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;
1681 
mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int1682     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
__errno_location() -> *mut ::c_int1683     pub fn __errno_location() -> *mut ::c_int;
1684 
posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int1685     pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t1686     pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
1687         -> ::ssize_t;
preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t1688     pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int1689     pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int1690     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int1691     pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char1692     pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
accept4( fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t, flg: ::c_int, ) -> ::c_int1693     pub fn accept4(
1694         fd: ::c_int,
1695         addr: *mut ::sockaddr,
1696         len: *mut ::socklen_t,
1697         flg: ::c_int,
1698     ) -> ::c_int;
getnameinfo( sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int1699     pub fn getnameinfo(
1700         sa: *const ::sockaddr,
1701         salen: ::socklen_t,
1702         host: *mut ::c_char,
1703         hostlen: ::socklen_t,
1704         serv: *mut ::c_char,
1705         servlen: ::socklen_t,
1706         flags: ::c_int,
1707     ) -> ::c_int;
getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int1708     pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
1709 
mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int1710     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
if_nameindex() -> *mut if_nameindex1711     pub fn if_nameindex() -> *mut if_nameindex;
if_freenameindex(ptr: *mut if_nameindex)1712     pub fn if_freenameindex(ptr: *mut if_nameindex);
1713 
mremap( addr: *mut ::c_void, len: ::size_t, new_len: ::size_t, flags: ::c_int, ... ) -> *mut ::c_void1714     pub fn mremap(
1715         addr: *mut ::c_void,
1716         len: ::size_t,
1717         new_len: ::size_t,
1718         flags: ::c_int,
1719         ...
1720     ) -> *mut ::c_void;
1721 
glob( pattern: *const c_char, flags: ::c_int, errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t, ) -> ::c_int1722     pub fn glob(
1723         pattern: *const c_char,
1724         flags: ::c_int,
1725         errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>,
1726         pglob: *mut ::glob_t,
1727     ) -> ::c_int;
globfree(pglob: *mut ::glob_t)1728     pub fn globfree(pglob: *mut ::glob_t);
1729 
posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1730     pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
1731 
shm_unlink(name: *const ::c_char) -> ::c_int1732     pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1733 
seekdir(dirp: *mut ::DIR, loc: ::c_long)1734     pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
1735 
telldir(dirp: *mut ::DIR) -> ::c_long1736     pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1737     pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
1738 
msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int1739     pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
1740 
recvfrom( socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, ) -> ::ssize_t1741     pub fn recvfrom(
1742         socket: ::c_int,
1743         buf: *mut ::c_void,
1744         len: ::size_t,
1745         flags: ::c_int,
1746         addr: *mut ::sockaddr,
1747         addrlen: *mut ::socklen_t,
1748     ) -> ::ssize_t;
mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int1749     pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
nl_langinfo(item: ::nl_item) -> *mut ::c_char1750     pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
1751 
getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int1752     pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int1753     pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
sendmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_uint, ) -> ::c_int1754     pub fn sendmmsg(
1755         sockfd: ::c_int,
1756         msgvec: *mut ::mmsghdr,
1757         vlen: ::c_uint,
1758         flags: ::c_uint,
1759     ) -> ::c_int;
recvmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_uint, timeout: *mut ::timespec, ) -> ::c_int1760     pub fn recvmmsg(
1761         sockfd: ::c_int,
1762         msgvec: *mut ::mmsghdr,
1763         vlen: ::c_uint,
1764         flags: ::c_uint,
1765         timeout: *mut ::timespec,
1766     ) -> ::c_int;
sync()1767     pub fn sync();
ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int1768     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
getpriority(which: ::c_int, who: ::id_t) -> ::c_int1769     pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int1770     pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
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_int1771     pub fn pthread_create(
1772         native: *mut ::pthread_t,
1773         attr: *const ::pthread_attr_t,
1774         f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
1775         value: *mut ::c_void,
1776     ) -> ::c_int;
1777 
getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int1778     pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
1779 }
1780 
1781 // Alias <foo> to <foo>64 to mimic glibc's LFS64 support
1782 mod lfs64;
1783 pub use self::lfs64::*;
1784 
1785 cfg_if! {
1786     if #[cfg(libc_align)] {
1787         #[macro_use]
1788         mod align;
1789     } else {
1790         #[macro_use]
1791         mod no_align;
1792     }
1793 }
1794 expand_align!();
1795