libc/fuchsia/
mod.rs

1//! Definitions found commonly among almost all Unix derivatives
2//!
3//! More functions and definitions can be found in the more specific modules
4//! according to the platform in question.
5
6use crate::prelude::*;
7
8// PUB_TYPE
9
10pub type c_schar = i8;
11pub type c_uchar = u8;
12pub type c_short = i16;
13pub type c_ushort = u16;
14pub type c_int = i32;
15pub type c_uint = u32;
16pub type c_float = f32;
17pub type c_double = f64;
18pub type c_longlong = i64;
19pub type c_ulonglong = u64;
20pub type intmax_t = i64;
21pub type uintmax_t = u64;
22
23pub type locale_t = *mut c_void;
24
25pub type size_t = usize;
26pub type ptrdiff_t = isize;
27pub type intptr_t = isize;
28pub type uintptr_t = usize;
29pub type ssize_t = isize;
30
31pub type pid_t = i32;
32pub type uid_t = u32;
33pub type gid_t = u32;
34pub type in_addr_t = u32;
35pub type in_port_t = u16;
36pub type sighandler_t = size_t;
37pub type cc_t = c_uchar;
38pub type sa_family_t = u16;
39pub type pthread_key_t = c_uint;
40pub type speed_t = c_uint;
41pub type tcflag_t = c_uint;
42pub type clockid_t = c_int;
43pub type key_t = c_int;
44pub type id_t = c_uint;
45pub type useconds_t = u32;
46pub type dev_t = u64;
47pub type socklen_t = u32;
48pub type pthread_t = c_ulong;
49pub type mode_t = u32;
50pub type ino64_t = u64;
51pub type off64_t = i64;
52pub type blkcnt64_t = i64;
53pub type rlim64_t = u64;
54pub type mqd_t = c_int;
55pub type nfds_t = c_ulong;
56pub type nl_item = c_int;
57pub type idtype_t = c_uint;
58pub type loff_t = c_longlong;
59
60pub type __u8 = c_uchar;
61pub type __u16 = c_ushort;
62pub type __s16 = c_short;
63pub type __u32 = c_uint;
64pub type __s32 = c_int;
65
66pub type Elf32_Half = u16;
67pub type Elf32_Word = u32;
68pub type Elf32_Off = u32;
69pub type Elf32_Addr = u32;
70
71pub type Elf64_Half = u16;
72pub type Elf64_Word = u32;
73pub type Elf64_Off = u64;
74pub type Elf64_Addr = u64;
75pub type Elf64_Xword = u64;
76
77pub type clock_t = c_long;
78pub type time_t = c_long;
79pub type suseconds_t = c_long;
80pub type ino_t = u64;
81pub type off_t = i64;
82pub type blkcnt_t = i64;
83
84pub type shmatt_t = c_ulong;
85pub type msgqnum_t = c_ulong;
86pub type msglen_t = c_ulong;
87pub type fsblkcnt_t = c_ulonglong;
88pub type fsfilcnt_t = c_ulonglong;
89pub type rlim_t = c_ulonglong;
90
91pub type c_long = i64;
92pub type c_ulong = u64;
93
94// FIXME: why are these uninhabited types? that seems... wrong?
95// Presumably these should be `()` or an `extern type` (when that stabilizes).
96#[cfg_attr(feature = "extra_traits", derive(Debug))]
97pub enum timezone {}
98impl Copy for timezone {}
99impl Clone for timezone {
100    fn clone(&self) -> timezone {
101        *self
102    }
103}
104#[cfg_attr(feature = "extra_traits", derive(Debug))]
105pub enum DIR {}
106impl Copy for DIR {}
107impl Clone for DIR {
108    fn clone(&self) -> DIR {
109        *self
110    }
111}
112
113#[cfg_attr(feature = "extra_traits", derive(Debug))]
114pub enum fpos64_t {} // FIXME: fill this out with a struct
115impl Copy for fpos64_t {}
116impl Clone for fpos64_t {
117    fn clone(&self) -> fpos64_t {
118        *self
119    }
120}
121
122// PUB_STRUCT
123
124s! {
125    pub struct group {
126        pub gr_name: *mut c_char,
127        pub gr_passwd: *mut c_char,
128        pub gr_gid: crate::gid_t,
129        pub gr_mem: *mut *mut c_char,
130    }
131
132    pub struct utimbuf {
133        pub actime: time_t,
134        pub modtime: time_t,
135    }
136
137    pub struct timeval {
138        pub tv_sec: time_t,
139        pub tv_usec: suseconds_t,
140    }
141
142    pub struct timespec {
143        pub tv_sec: time_t,
144        pub tv_nsec: c_long,
145    }
146
147    // FIXME: the rlimit and rusage related functions and types don't exist
148    // within zircon. Are there reasons for keeping them around?
149    pub struct rlimit {
150        pub rlim_cur: rlim_t,
151        pub rlim_max: rlim_t,
152    }
153
154    pub struct rusage {
155        pub ru_utime: timeval,
156        pub ru_stime: timeval,
157        pub ru_maxrss: c_long,
158        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
159        __pad1: u32,
160        pub ru_ixrss: c_long,
161        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
162        __pad2: u32,
163        pub ru_idrss: c_long,
164        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
165        __pad3: u32,
166        pub ru_isrss: c_long,
167        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
168        __pad4: u32,
169        pub ru_minflt: c_long,
170        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
171        __pad5: u32,
172        pub ru_majflt: c_long,
173        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
174        __pad6: u32,
175        pub ru_nswap: c_long,
176        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
177        __pad7: u32,
178        pub ru_inblock: c_long,
179        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
180        __pad8: u32,
181        pub ru_oublock: c_long,
182        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
183        __pad9: u32,
184        pub ru_msgsnd: c_long,
185        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
186        __pad10: u32,
187        pub ru_msgrcv: c_long,
188        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
189        __pad11: u32,
190        pub ru_nsignals: c_long,
191        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
192        __pad12: u32,
193        pub ru_nvcsw: c_long,
194        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
195        __pad13: u32,
196        pub ru_nivcsw: c_long,
197        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
198        __pad14: u32,
199    }
200
201    pub struct in_addr {
202        pub s_addr: in_addr_t,
203    }
204
205    pub struct in6_addr {
206        pub s6_addr: [u8; 16],
207    }
208
209    pub struct ip_mreq {
210        pub imr_multiaddr: in_addr,
211        pub imr_interface: in_addr,
212    }
213
214    pub struct ip_mreqn {
215        pub imr_multiaddr: in_addr,
216        pub imr_address: in_addr,
217        pub imr_ifindex: c_int,
218    }
219
220    pub struct ipv6_mreq {
221        pub ipv6mr_multiaddr: in6_addr,
222        pub ipv6mr_interface: c_uint,
223    }
224
225    pub struct hostent {
226        pub h_name: *mut c_char,
227        pub h_aliases: *mut *mut c_char,
228        pub h_addrtype: c_int,
229        pub h_length: c_int,
230        pub h_addr_list: *mut *mut c_char,
231    }
232
233    pub struct iovec {
234        pub iov_base: *mut c_void,
235        pub iov_len: size_t,
236    }
237
238    pub struct pollfd {
239        pub fd: c_int,
240        pub events: c_short,
241        pub revents: c_short,
242    }
243
244    pub struct winsize {
245        pub ws_row: c_ushort,
246        pub ws_col: c_ushort,
247        pub ws_xpixel: c_ushort,
248        pub ws_ypixel: c_ushort,
249    }
250
251    pub struct linger {
252        pub l_onoff: c_int,
253        pub l_linger: c_int,
254    }
255
256    pub struct sigval {
257        // Actually a union of an int and a void*
258        pub sival_ptr: *mut c_void,
259    }
260
261    // <sys/time.h>
262    pub struct itimerval {
263        pub it_interval: crate::timeval,
264        pub it_value: crate::timeval,
265    }
266
267    // <sys/times.h>
268    pub struct tms {
269        pub tms_utime: crate::clock_t,
270        pub tms_stime: crate::clock_t,
271        pub tms_cutime: crate::clock_t,
272        pub tms_cstime: crate::clock_t,
273    }
274
275    pub struct servent {
276        pub s_name: *mut c_char,
277        pub s_aliases: *mut *mut c_char,
278        pub s_port: c_int,
279        pub s_proto: *mut c_char,
280    }
281
282    pub struct protoent {
283        pub p_name: *mut c_char,
284        pub p_aliases: *mut *mut c_char,
285        pub p_proto: c_int,
286    }
287
288    pub struct aiocb {
289        pub aio_fildes: c_int,
290        pub aio_lio_opcode: c_int,
291        pub aio_reqprio: c_int,
292        pub aio_buf: *mut c_void,
293        pub aio_nbytes: size_t,
294        pub aio_sigevent: crate::sigevent,
295        __td: *mut c_void,
296        __lock: [c_int; 2],
297        __err: c_int,
298        __ret: ssize_t,
299        pub aio_offset: off_t,
300        __next: *mut c_void,
301        __prev: *mut c_void,
302        #[cfg(target_pointer_width = "32")]
303        __dummy4: [c_char; 24],
304        #[cfg(target_pointer_width = "64")]
305        __dummy4: [c_char; 16],
306    }
307
308    pub struct sigaction {
309        pub sa_sigaction: crate::sighandler_t,
310        pub sa_mask: crate::sigset_t,
311        pub sa_flags: c_int,
312        pub sa_restorer: Option<extern "C" fn()>,
313    }
314
315    pub struct termios {
316        pub c_iflag: crate::tcflag_t,
317        pub c_oflag: crate::tcflag_t,
318        pub c_cflag: crate::tcflag_t,
319        pub c_lflag: crate::tcflag_t,
320        pub c_line: crate::cc_t,
321        pub c_cc: [crate::cc_t; crate::NCCS],
322        pub __c_ispeed: crate::speed_t,
323        pub __c_ospeed: crate::speed_t,
324    }
325
326    pub struct flock {
327        pub l_type: c_short,
328        pub l_whence: c_short,
329        pub l_start: off_t,
330        pub l_len: off_t,
331        pub l_pid: crate::pid_t,
332    }
333
334    pub struct ucred {
335        pub pid: crate::pid_t,
336        pub uid: crate::uid_t,
337        pub gid: crate::gid_t,
338    }
339
340    pub struct sockaddr {
341        pub sa_family: sa_family_t,
342        pub sa_data: [c_char; 14],
343    }
344
345    pub struct sockaddr_in {
346        pub sin_family: sa_family_t,
347        pub sin_port: crate::in_port_t,
348        pub sin_addr: crate::in_addr,
349        pub sin_zero: [u8; 8],
350    }
351
352    pub struct sockaddr_in6 {
353        pub sin6_family: sa_family_t,
354        pub sin6_port: crate::in_port_t,
355        pub sin6_flowinfo: u32,
356        pub sin6_addr: crate::in6_addr,
357        pub sin6_scope_id: u32,
358    }
359
360    pub struct sockaddr_vm {
361        pub svm_family: sa_family_t,
362        pub svm_reserved1: c_ushort,
363        pub svm_port: crate::in_port_t,
364        pub svm_cid: c_uint,
365        pub svm_zero: [u8; 4],
366    }
367
368    pub struct addrinfo {
369        pub ai_flags: c_int,
370        pub ai_family: c_int,
371        pub ai_socktype: c_int,
372        pub ai_protocol: c_int,
373        pub ai_addrlen: socklen_t,
374
375        pub ai_addr: *mut crate::sockaddr,
376
377        pub ai_canonname: *mut c_char,
378
379        pub ai_next: *mut addrinfo,
380    }
381
382    pub struct sockaddr_ll {
383        pub sll_family: c_ushort,
384        pub sll_protocol: c_ushort,
385        pub sll_ifindex: c_int,
386        pub sll_hatype: c_ushort,
387        pub sll_pkttype: c_uchar,
388        pub sll_halen: c_uchar,
389        pub sll_addr: [c_uchar; 8],
390    }
391
392    pub struct fd_set {
393        fds_bits: [c_ulong; FD_SETSIZE as usize / ULONG_SIZE],
394    }
395
396    pub struct tm {
397        pub tm_sec: c_int,
398        pub tm_min: c_int,
399        pub tm_hour: c_int,
400        pub tm_mday: c_int,
401        pub tm_mon: c_int,
402        pub tm_year: c_int,
403        pub tm_wday: c_int,
404        pub tm_yday: c_int,
405        pub tm_isdst: c_int,
406        pub tm_gmtoff: c_long,
407        pub tm_zone: *const c_char,
408    }
409
410    pub struct sched_param {
411        pub sched_priority: c_int,
412        pub sched_ss_low_priority: c_int,
413        pub sched_ss_repl_period: crate::timespec,
414        pub sched_ss_init_budget: crate::timespec,
415        pub sched_ss_max_repl: c_int,
416    }
417
418    pub struct Dl_info {
419        pub dli_fname: *const c_char,
420        pub dli_fbase: *mut c_void,
421        pub dli_sname: *const c_char,
422        pub dli_saddr: *mut c_void,
423    }
424
425    pub struct epoll_event {
426        pub events: u32,
427        pub u64: u64,
428    }
429
430    pub struct lconv {
431        pub decimal_point: *mut c_char,
432        pub thousands_sep: *mut c_char,
433        pub grouping: *mut c_char,
434        pub int_curr_symbol: *mut c_char,
435        pub currency_symbol: *mut c_char,
436        pub mon_decimal_point: *mut c_char,
437        pub mon_thousands_sep: *mut c_char,
438        pub mon_grouping: *mut c_char,
439        pub positive_sign: *mut c_char,
440        pub negative_sign: *mut c_char,
441        pub int_frac_digits: c_char,
442        pub frac_digits: c_char,
443        pub p_cs_precedes: c_char,
444        pub p_sep_by_space: c_char,
445        pub n_cs_precedes: c_char,
446        pub n_sep_by_space: c_char,
447        pub p_sign_posn: c_char,
448        pub n_sign_posn: c_char,
449        pub int_p_cs_precedes: c_char,
450        pub int_p_sep_by_space: c_char,
451        pub int_n_cs_precedes: c_char,
452        pub int_n_sep_by_space: c_char,
453        pub int_p_sign_posn: c_char,
454        pub int_n_sign_posn: c_char,
455    }
456
457    pub struct rlimit64 {
458        pub rlim_cur: rlim64_t,
459        pub rlim_max: rlim64_t,
460    }
461
462    pub struct glob_t {
463        pub gl_pathc: size_t,
464        pub gl_pathv: *mut *mut c_char,
465        pub gl_offs: size_t,
466        pub gl_flags: c_int,
467
468        __unused1: *mut c_void,
469        __unused2: *mut c_void,
470        __unused3: *mut c_void,
471        __unused4: *mut c_void,
472        __unused5: *mut c_void,
473    }
474
475    pub struct ifaddrs {
476        pub ifa_next: *mut ifaddrs,
477        pub ifa_name: *mut c_char,
478        pub ifa_flags: c_uint,
479        pub ifa_addr: *mut crate::sockaddr,
480        pub ifa_netmask: *mut crate::sockaddr,
481        pub ifa_ifu: *mut crate::sockaddr, // FIXME This should be a union
482        pub ifa_data: *mut c_void,
483    }
484
485    pub struct passwd {
486        pub pw_name: *mut c_char,
487        pub pw_passwd: *mut c_char,
488        pub pw_uid: crate::uid_t,
489        pub pw_gid: crate::gid_t,
490        pub pw_gecos: *mut c_char,
491        pub pw_dir: *mut c_char,
492        pub pw_shell: *mut c_char,
493    }
494
495    pub struct spwd {
496        pub sp_namp: *mut c_char,
497        pub sp_pwdp: *mut c_char,
498        pub sp_lstchg: c_long,
499        pub sp_min: c_long,
500        pub sp_max: c_long,
501        pub sp_warn: c_long,
502        pub sp_inact: c_long,
503        pub sp_expire: c_long,
504        pub sp_flag: c_ulong,
505    }
506
507    pub struct statvfs {
508        pub f_bsize: c_ulong,
509        pub f_frsize: c_ulong,
510        pub f_blocks: crate::fsblkcnt_t,
511        pub f_bfree: crate::fsblkcnt_t,
512        pub f_bavail: crate::fsblkcnt_t,
513        pub f_files: crate::fsfilcnt_t,
514        pub f_ffree: crate::fsfilcnt_t,
515        pub f_favail: crate::fsfilcnt_t,
516        #[cfg(target_endian = "little")]
517        pub f_fsid: c_ulong,
518        #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
519        __f_unused: c_int,
520        #[cfg(target_endian = "big")]
521        pub f_fsid: c_ulong,
522        pub f_flag: c_ulong,
523        pub f_namemax: c_ulong,
524        __f_spare: [c_int; 6],
525    }
526
527    pub struct dqblk {
528        pub dqb_bhardlimit: u64,
529        pub dqb_bsoftlimit: u64,
530        pub dqb_curspace: u64,
531        pub dqb_ihardlimit: u64,
532        pub dqb_isoftlimit: u64,
533        pub dqb_curinodes: u64,
534        pub dqb_btime: u64,
535        pub dqb_itime: u64,
536        pub dqb_valid: u32,
537    }
538
539    pub struct signalfd_siginfo {
540        pub ssi_signo: u32,
541        pub ssi_errno: i32,
542        pub ssi_code: i32,
543        pub ssi_pid: u32,
544        pub ssi_uid: u32,
545        pub ssi_fd: i32,
546        pub ssi_tid: u32,
547        pub ssi_band: u32,
548        pub ssi_overrun: u32,
549        pub ssi_trapno: u32,
550        pub ssi_status: i32,
551        pub ssi_int: i32,
552        pub ssi_ptr: u64,
553        pub ssi_utime: u64,
554        pub ssi_stime: u64,
555        pub ssi_addr: u64,
556        pub ssi_addr_lsb: u16,
557        _pad2: u16,
558        pub ssi_syscall: i32,
559        pub ssi_call_addr: u64,
560        pub ssi_arch: u32,
561        _pad: [u8; 28],
562    }
563
564    pub struct itimerspec {
565        pub it_interval: crate::timespec,
566        pub it_value: crate::timespec,
567    }
568
569    pub struct fsid_t {
570        __val: [c_int; 2],
571    }
572
573    pub struct cpu_set_t {
574        #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
575        bits: [u32; 32],
576        #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))]
577        bits: [u64; 16],
578    }
579
580    pub struct if_nameindex {
581        pub if_index: c_uint,
582        pub if_name: *mut c_char,
583    }
584
585    // System V IPC
586    pub struct msginfo {
587        pub msgpool: c_int,
588        pub msgmap: c_int,
589        pub msgmax: c_int,
590        pub msgmnb: c_int,
591        pub msgmni: c_int,
592        pub msgssz: c_int,
593        pub msgtql: c_int,
594        pub msgseg: c_ushort,
595    }
596
597    pub struct mmsghdr {
598        pub msg_hdr: crate::msghdr,
599        pub msg_len: c_uint,
600    }
601
602    pub struct sembuf {
603        pub sem_num: c_ushort,
604        pub sem_op: c_short,
605        pub sem_flg: c_short,
606    }
607
608    pub struct input_event {
609        pub time: crate::timeval,
610        pub type_: crate::__u16,
611        pub code: crate::__u16,
612        pub value: crate::__s32,
613    }
614
615    pub struct input_id {
616        pub bustype: crate::__u16,
617        pub vendor: crate::__u16,
618        pub product: crate::__u16,
619        pub version: crate::__u16,
620    }
621
622    pub struct input_absinfo {
623        pub value: crate::__s32,
624        pub minimum: crate::__s32,
625        pub maximum: crate::__s32,
626        pub fuzz: crate::__s32,
627        pub flat: crate::__s32,
628        pub resolution: crate::__s32,
629    }
630
631    pub struct input_keymap_entry {
632        pub flags: crate::__u8,
633        pub len: crate::__u8,
634        pub index: crate::__u16,
635        pub keycode: crate::__u32,
636        pub scancode: [crate::__u8; 32],
637    }
638
639    pub struct input_mask {
640        pub type_: crate::__u32,
641        pub codes_size: crate::__u32,
642        pub codes_ptr: crate::__u64,
643    }
644
645    pub struct ff_replay {
646        pub length: crate::__u16,
647        pub delay: crate::__u16,
648    }
649
650    pub struct ff_trigger {
651        pub button: crate::__u16,
652        pub interval: crate::__u16,
653    }
654
655    pub struct ff_envelope {
656        pub attack_length: crate::__u16,
657        pub attack_level: crate::__u16,
658        pub fade_length: crate::__u16,
659        pub fade_level: crate::__u16,
660    }
661
662    pub struct ff_constant_effect {
663        pub level: crate::__s16,
664        pub envelope: ff_envelope,
665    }
666
667    pub struct ff_ramp_effect {
668        pub start_level: crate::__s16,
669        pub end_level: crate::__s16,
670        pub envelope: ff_envelope,
671    }
672
673    pub struct ff_condition_effect {
674        pub right_saturation: crate::__u16,
675        pub left_saturation: crate::__u16,
676
677        pub right_coeff: crate::__s16,
678        pub left_coeff: crate::__s16,
679
680        pub deadband: crate::__u16,
681        pub center: crate::__s16,
682    }
683
684    pub struct ff_periodic_effect {
685        pub waveform: crate::__u16,
686        pub period: crate::__u16,
687        pub magnitude: crate::__s16,
688        pub offset: crate::__s16,
689        pub phase: crate::__u16,
690
691        pub envelope: ff_envelope,
692
693        pub custom_len: crate::__u32,
694        pub custom_data: *mut crate::__s16,
695    }
696
697    pub struct ff_rumble_effect {
698        pub strong_magnitude: crate::__u16,
699        pub weak_magnitude: crate::__u16,
700    }
701
702    pub struct ff_effect {
703        pub type_: crate::__u16,
704        pub id: crate::__s16,
705        pub direction: crate::__u16,
706        pub trigger: ff_trigger,
707        pub replay: ff_replay,
708        // FIXME(1.0): this is actually a union
709        #[cfg(target_pointer_width = "64")]
710        pub u: [u64; 4],
711        #[cfg(target_pointer_width = "32")]
712        pub u: [u32; 7],
713    }
714
715    pub struct dl_phdr_info {
716        #[cfg(target_pointer_width = "64")]
717        pub dlpi_addr: Elf64_Addr,
718        #[cfg(target_pointer_width = "32")]
719        pub dlpi_addr: Elf32_Addr,
720
721        pub dlpi_name: *const c_char,
722
723        #[cfg(target_pointer_width = "64")]
724        pub dlpi_phdr: *const Elf64_Phdr,
725        #[cfg(target_pointer_width = "32")]
726        pub dlpi_phdr: *const Elf32_Phdr,
727
728        #[cfg(target_pointer_width = "64")]
729        pub dlpi_phnum: Elf64_Half,
730        #[cfg(target_pointer_width = "32")]
731        pub dlpi_phnum: Elf32_Half,
732
733        pub dlpi_adds: c_ulonglong,
734        pub dlpi_subs: c_ulonglong,
735        pub dlpi_tls_modid: size_t,
736        pub dlpi_tls_data: *mut c_void,
737    }
738
739    pub struct Elf32_Phdr {
740        pub p_type: Elf32_Word,
741        pub p_offset: Elf32_Off,
742        pub p_vaddr: Elf32_Addr,
743        pub p_paddr: Elf32_Addr,
744        pub p_filesz: Elf32_Word,
745        pub p_memsz: Elf32_Word,
746        pub p_flags: Elf32_Word,
747        pub p_align: Elf32_Word,
748    }
749
750    pub struct Elf64_Phdr {
751        pub p_type: Elf64_Word,
752        pub p_flags: Elf64_Word,
753        pub p_offset: Elf64_Off,
754        pub p_vaddr: Elf64_Addr,
755        pub p_paddr: Elf64_Addr,
756        pub p_filesz: Elf64_Xword,
757        pub p_memsz: Elf64_Xword,
758        pub p_align: Elf64_Xword,
759    }
760
761    pub struct statfs64 {
762        pub f_type: c_ulong,
763        pub f_bsize: c_ulong,
764        pub f_blocks: crate::fsblkcnt_t,
765        pub f_bfree: crate::fsblkcnt_t,
766        pub f_bavail: crate::fsblkcnt_t,
767        pub f_files: crate::fsfilcnt_t,
768        pub f_ffree: crate::fsfilcnt_t,
769        pub f_fsid: crate::fsid_t,
770        pub f_namelen: c_ulong,
771        pub f_frsize: c_ulong,
772        pub f_flags: c_ulong,
773        pub f_spare: [c_ulong; 4],
774    }
775
776    pub struct statvfs64 {
777        pub f_bsize: c_ulong,
778        pub f_frsize: c_ulong,
779        pub f_blocks: u64,
780        pub f_bfree: u64,
781        pub f_bavail: u64,
782        pub f_files: u64,
783        pub f_ffree: u64,
784        pub f_favail: u64,
785        pub f_fsid: c_ulong,
786        pub f_flag: c_ulong,
787        pub f_namemax: c_ulong,
788        __f_spare: [c_int; 6],
789    }
790
791    pub struct stack_t {
792        pub ss_sp: *mut c_void,
793        pub ss_flags: c_int,
794        pub ss_size: size_t,
795    }
796
797    pub struct pthread_attr_t {
798        __size: [u64; 7],
799    }
800
801    pub struct sigset_t {
802        __val: [c_ulong; 16],
803    }
804
805    pub struct shmid_ds {
806        pub shm_perm: crate::ipc_perm,
807        pub shm_segsz: size_t,
808        pub shm_atime: crate::time_t,
809        pub shm_dtime: crate::time_t,
810        pub shm_ctime: crate::time_t,
811        pub shm_cpid: crate::pid_t,
812        pub shm_lpid: crate::pid_t,
813        pub shm_nattch: c_ulong,
814        __pad1: c_ulong,
815        __pad2: c_ulong,
816    }
817
818    pub struct msqid_ds {
819        pub msg_perm: crate::ipc_perm,
820        pub msg_stime: crate::time_t,
821        pub msg_rtime: crate::time_t,
822        pub msg_ctime: crate::time_t,
823        __msg_cbytes: c_ulong,
824        pub msg_qnum: crate::msgqnum_t,
825        pub msg_qbytes: crate::msglen_t,
826        pub msg_lspid: crate::pid_t,
827        pub msg_lrpid: crate::pid_t,
828        __pad1: c_ulong,
829        __pad2: c_ulong,
830    }
831
832    pub struct statfs {
833        pub f_type: c_ulong,
834        pub f_bsize: c_ulong,
835        pub f_blocks: crate::fsblkcnt_t,
836        pub f_bfree: crate::fsblkcnt_t,
837        pub f_bavail: crate::fsblkcnt_t,
838        pub f_files: crate::fsfilcnt_t,
839        pub f_ffree: crate::fsfilcnt_t,
840        pub f_fsid: crate::fsid_t,
841        pub f_namelen: c_ulong,
842        pub f_frsize: c_ulong,
843        pub f_flags: c_ulong,
844        pub f_spare: [c_ulong; 4],
845    }
846
847    pub struct msghdr {
848        pub msg_name: *mut c_void,
849        pub msg_namelen: crate::socklen_t,
850        pub msg_iov: *mut crate::iovec,
851        pub msg_iovlen: c_int,
852        __pad1: c_int,
853        pub msg_control: *mut c_void,
854        pub msg_controllen: crate::socklen_t,
855        __pad2: crate::socklen_t,
856        pub msg_flags: c_int,
857    }
858
859    pub struct cmsghdr {
860        pub cmsg_len: crate::socklen_t,
861        pub __pad1: c_int,
862        pub cmsg_level: c_int,
863        pub cmsg_type: c_int,
864    }
865
866    pub struct sem_t {
867        __val: [c_int; 8],
868    }
869
870    pub struct siginfo_t {
871        pub si_signo: c_int,
872        pub si_errno: c_int,
873        pub si_code: c_int,
874        pub _pad: [c_int; 29],
875        _align: [usize; 0],
876    }
877
878    pub struct termios2 {
879        pub c_iflag: crate::tcflag_t,
880        pub c_oflag: crate::tcflag_t,
881        pub c_cflag: crate::tcflag_t,
882        pub c_lflag: crate::tcflag_t,
883        pub c_line: crate::cc_t,
884        pub c_cc: [crate::cc_t; 19],
885        pub c_ispeed: crate::speed_t,
886        pub c_ospeed: crate::speed_t,
887    }
888
889    pub struct in6_pktinfo {
890        pub ipi6_addr: crate::in6_addr,
891        pub ipi6_ifindex: c_uint,
892    }
893
894    #[cfg_attr(
895        any(target_pointer_width = "32", target_arch = "x86_64"),
896        repr(align(4))
897    )]
898    #[cfg_attr(
899        not(any(target_pointer_width = "32", target_arch = "x86_64")),
900        repr(align(8))
901    )]
902    pub struct pthread_mutexattr_t {
903        size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T],
904    }
905
906    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
907    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
908    pub struct pthread_rwlockattr_t {
909        size: [u8; crate::__SIZEOF_PTHREAD_RWLOCKATTR_T],
910    }
911
912    #[repr(align(4))]
913    pub struct pthread_condattr_t {
914        size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T],
915    }
916}
917
918s_no_extra_traits! {
919    pub struct sysinfo {
920        pub uptime: c_ulong,
921        pub loads: [c_ulong; 3],
922        pub totalram: c_ulong,
923        pub freeram: c_ulong,
924        pub sharedram: c_ulong,
925        pub bufferram: c_ulong,
926        pub totalswap: c_ulong,
927        pub freeswap: c_ulong,
928        pub procs: c_ushort,
929        pub pad: c_ushort,
930        pub totalhigh: c_ulong,
931        pub freehigh: c_ulong,
932        pub mem_unit: c_uint,
933        pub __reserved: [c_char; 256],
934    }
935
936    pub struct sockaddr_un {
937        pub sun_family: sa_family_t,
938        pub sun_path: [c_char; 108],
939    }
940
941    pub struct sockaddr_storage {
942        pub ss_family: sa_family_t,
943        __ss_pad2: [u8; 128 - 2 - 8],
944        __ss_align: size_t,
945    }
946
947    pub struct utsname {
948        pub sysname: [c_char; 65],
949        pub nodename: [c_char; 65],
950        pub release: [c_char; 65],
951        pub version: [c_char; 65],
952        pub machine: [c_char; 65],
953        pub domainname: [c_char; 65],
954    }
955
956    pub struct dirent {
957        pub d_ino: crate::ino_t,
958        pub d_off: off_t,
959        pub d_reclen: c_ushort,
960        pub d_type: c_uchar,
961        pub d_name: [c_char; 256],
962    }
963
964    pub struct dirent64 {
965        pub d_ino: crate::ino64_t,
966        pub d_off: off64_t,
967        pub d_reclen: c_ushort,
968        pub d_type: c_uchar,
969        pub d_name: [c_char; 256],
970    }
971
972    // x32 compatibility
973    // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
974    pub struct mq_attr {
975        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
976        pub mq_flags: i64,
977        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
978        pub mq_maxmsg: i64,
979        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
980        pub mq_msgsize: i64,
981        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
982        pub mq_curmsgs: i64,
983        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
984        pad: [i64; 4],
985
986        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
987        pub mq_flags: c_long,
988        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
989        pub mq_maxmsg: c_long,
990        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
991        pub mq_msgsize: c_long,
992        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
993        pub mq_curmsgs: c_long,
994        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
995        pad: [c_long; 4],
996    }
997
998    pub struct sockaddr_nl {
999        pub nl_family: crate::sa_family_t,
1000        nl_pad: c_ushort,
1001        pub nl_pid: u32,
1002        pub nl_groups: u32,
1003    }
1004
1005    pub struct sigevent {
1006        pub sigev_value: crate::sigval,
1007        pub sigev_signo: c_int,
1008        pub sigev_notify: c_int,
1009        pub sigev_notify_function: fn(crate::sigval),
1010        pub sigev_notify_attributes: *mut pthread_attr_t,
1011        pub __pad: [c_char; 56 - 3 * 8],
1012    }
1013
1014    #[cfg_attr(
1015        all(
1016            target_pointer_width = "32",
1017            any(target_arch = "arm", target_arch = "x86_64")
1018        ),
1019        repr(align(4))
1020    )]
1021    #[cfg_attr(
1022        any(
1023            target_pointer_width = "64",
1024            not(any(target_arch = "arm", target_arch = "x86_64"))
1025        ),
1026        repr(align(8))
1027    )]
1028    pub struct pthread_mutex_t {
1029        size: [u8; crate::__SIZEOF_PTHREAD_MUTEX_T],
1030    }
1031
1032    #[cfg_attr(
1033        all(
1034            target_pointer_width = "32",
1035            any(target_arch = "arm", target_arch = "x86_64")
1036        ),
1037        repr(align(4))
1038    )]
1039    #[cfg_attr(
1040        any(
1041            target_pointer_width = "64",
1042            not(any(target_arch = "arm", target_arch = "x86_64"))
1043        ),
1044        repr(align(8))
1045    )]
1046    pub struct pthread_rwlock_t {
1047        size: [u8; crate::__SIZEOF_PTHREAD_RWLOCK_T],
1048    }
1049
1050    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
1051    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
1052    #[cfg_attr(target_arch = "x86", repr(align(4)))]
1053    #[cfg_attr(not(target_arch = "x86"), repr(align(8)))]
1054    pub struct pthread_cond_t {
1055        size: [u8; crate::__SIZEOF_PTHREAD_COND_T],
1056    }
1057}
1058
1059cfg_if! {
1060    if #[cfg(feature = "extra_traits")] {
1061        impl PartialEq for sysinfo {
1062            fn eq(&self, other: &sysinfo) -> bool {
1063                self.uptime == other.uptime
1064                    && self.loads == other.loads
1065                    && self.totalram == other.totalram
1066                    && self.freeram == other.freeram
1067                    && self.sharedram == other.sharedram
1068                    && self.bufferram == other.bufferram
1069                    && self.totalswap == other.totalswap
1070                    && self.freeswap == other.freeswap
1071                    && self.procs == other.procs
1072                    && self.pad == other.pad
1073                    && self.totalhigh == other.totalhigh
1074                    && self.freehigh == other.freehigh
1075                    && self.mem_unit == other.mem_unit
1076                    && self
1077                        .__reserved
1078                        .iter()
1079                        .zip(other.__reserved.iter())
1080                        .all(|(a, b)| a == b)
1081            }
1082        }
1083        impl Eq for sysinfo {}
1084        impl fmt::Debug for sysinfo {
1085            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1086                f.debug_struct("sysinfo")
1087                    .field("uptime", &self.uptime)
1088                    .field("loads", &self.loads)
1089                    .field("totalram", &self.totalram)
1090                    .field("freeram", &self.freeram)
1091                    .field("sharedram", &self.sharedram)
1092                    .field("bufferram", &self.bufferram)
1093                    .field("totalswap", &self.totalswap)
1094                    .field("freeswap", &self.freeswap)
1095                    .field("procs", &self.procs)
1096                    .field("pad", &self.pad)
1097                    .field("totalhigh", &self.totalhigh)
1098                    .field("freehigh", &self.freehigh)
1099                    .field("mem_unit", &self.mem_unit)
1100                    // FIXME: .field("__reserved", &self.__reserved)
1101                    .finish()
1102            }
1103        }
1104        impl hash::Hash for sysinfo {
1105            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1106                self.uptime.hash(state);
1107                self.loads.hash(state);
1108                self.totalram.hash(state);
1109                self.freeram.hash(state);
1110                self.sharedram.hash(state);
1111                self.bufferram.hash(state);
1112                self.totalswap.hash(state);
1113                self.freeswap.hash(state);
1114                self.procs.hash(state);
1115                self.pad.hash(state);
1116                self.totalhigh.hash(state);
1117                self.freehigh.hash(state);
1118                self.mem_unit.hash(state);
1119                self.__reserved.hash(state);
1120            }
1121        }
1122
1123        impl PartialEq for sockaddr_un {
1124            fn eq(&self, other: &sockaddr_un) -> bool {
1125                self.sun_family == other.sun_family
1126                    && self
1127                        .sun_path
1128                        .iter()
1129                        .zip(other.sun_path.iter())
1130                        .all(|(a, b)| a == b)
1131            }
1132        }
1133        impl Eq for sockaddr_un {}
1134        impl fmt::Debug for sockaddr_un {
1135            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1136                f.debug_struct("sockaddr_un")
1137                    .field("sun_family", &self.sun_family)
1138                    // FIXME: .field("sun_path", &self.sun_path)
1139                    .finish()
1140            }
1141        }
1142        impl hash::Hash for sockaddr_un {
1143            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1144                self.sun_family.hash(state);
1145                self.sun_path.hash(state);
1146            }
1147        }
1148
1149        impl PartialEq for sockaddr_storage {
1150            fn eq(&self, other: &sockaddr_storage) -> bool {
1151                self.ss_family == other.ss_family
1152                    && self.__ss_align == other.__ss_align
1153                    && self
1154                        .__ss_pad2
1155                        .iter()
1156                        .zip(other.__ss_pad2.iter())
1157                        .all(|(a, b)| a == b)
1158            }
1159        }
1160        impl Eq for sockaddr_storage {}
1161        impl fmt::Debug for sockaddr_storage {
1162            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1163                f.debug_struct("sockaddr_storage")
1164                    .field("ss_family", &self.ss_family)
1165                    .field("__ss_align", &self.__ss_align)
1166                    // FIXME: .field("__ss_pad2", &self.__ss_pad2)
1167                    .finish()
1168            }
1169        }
1170        impl hash::Hash for sockaddr_storage {
1171            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1172                self.ss_family.hash(state);
1173                self.__ss_align.hash(state);
1174                self.__ss_pad2.hash(state);
1175            }
1176        }
1177
1178        impl PartialEq for utsname {
1179            fn eq(&self, other: &utsname) -> bool {
1180                self.sysname
1181                    .iter()
1182                    .zip(other.sysname.iter())
1183                    .all(|(a, b)| a == b)
1184                    && self
1185                        .nodename
1186                        .iter()
1187                        .zip(other.nodename.iter())
1188                        .all(|(a, b)| a == b)
1189                    && self
1190                        .release
1191                        .iter()
1192                        .zip(other.release.iter())
1193                        .all(|(a, b)| a == b)
1194                    && self
1195                        .version
1196                        .iter()
1197                        .zip(other.version.iter())
1198                        .all(|(a, b)| a == b)
1199                    && self
1200                        .machine
1201                        .iter()
1202                        .zip(other.machine.iter())
1203                        .all(|(a, b)| a == b)
1204            }
1205        }
1206        impl Eq for utsname {}
1207        impl fmt::Debug for utsname {
1208            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1209                f.debug_struct("utsname")
1210                    // FIXME: .field("sysname", &self.sysname)
1211                    // FIXME: .field("nodename", &self.nodename)
1212                    // FIXME: .field("release", &self.release)
1213                    // FIXME: .field("version", &self.version)
1214                    // FIXME: .field("machine", &self.machine)
1215                    .finish()
1216            }
1217        }
1218        impl hash::Hash for utsname {
1219            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1220                self.sysname.hash(state);
1221                self.nodename.hash(state);
1222                self.release.hash(state);
1223                self.version.hash(state);
1224                self.machine.hash(state);
1225            }
1226        }
1227
1228        impl PartialEq for dirent {
1229            fn eq(&self, other: &dirent) -> bool {
1230                self.d_ino == other.d_ino
1231                    && self.d_off == other.d_off
1232                    && self.d_reclen == other.d_reclen
1233                    && self.d_type == other.d_type
1234                    && self
1235                        .d_name
1236                        .iter()
1237                        .zip(other.d_name.iter())
1238                        .all(|(a, b)| a == b)
1239            }
1240        }
1241        impl Eq for dirent {}
1242        impl fmt::Debug for dirent {
1243            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1244                f.debug_struct("dirent")
1245                    .field("d_ino", &self.d_ino)
1246                    .field("d_off", &self.d_off)
1247                    .field("d_reclen", &self.d_reclen)
1248                    .field("d_type", &self.d_type)
1249                    // FIXME: .field("d_name", &self.d_name)
1250                    .finish()
1251            }
1252        }
1253        impl hash::Hash for dirent {
1254            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1255                self.d_ino.hash(state);
1256                self.d_off.hash(state);
1257                self.d_reclen.hash(state);
1258                self.d_type.hash(state);
1259                self.d_name.hash(state);
1260            }
1261        }
1262
1263        impl PartialEq for dirent64 {
1264            fn eq(&self, other: &dirent64) -> bool {
1265                self.d_ino == other.d_ino
1266                    && self.d_off == other.d_off
1267                    && self.d_reclen == other.d_reclen
1268                    && self.d_type == other.d_type
1269                    && self
1270                        .d_name
1271                        .iter()
1272                        .zip(other.d_name.iter())
1273                        .all(|(a, b)| a == b)
1274            }
1275        }
1276        impl Eq for dirent64 {}
1277        impl fmt::Debug for dirent64 {
1278            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1279                f.debug_struct("dirent64")
1280                    .field("d_ino", &self.d_ino)
1281                    .field("d_off", &self.d_off)
1282                    .field("d_reclen", &self.d_reclen)
1283                    .field("d_type", &self.d_type)
1284                    // FIXME: .field("d_name", &self.d_name)
1285                    .finish()
1286            }
1287        }
1288        impl hash::Hash for dirent64 {
1289            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1290                self.d_ino.hash(state);
1291                self.d_off.hash(state);
1292                self.d_reclen.hash(state);
1293                self.d_type.hash(state);
1294                self.d_name.hash(state);
1295            }
1296        }
1297
1298        impl PartialEq for mq_attr {
1299            fn eq(&self, other: &mq_attr) -> bool {
1300                self.mq_flags == other.mq_flags
1301                    && self.mq_maxmsg == other.mq_maxmsg
1302                    && self.mq_msgsize == other.mq_msgsize
1303                    && self.mq_curmsgs == other.mq_curmsgs
1304            }
1305        }
1306        impl Eq for mq_attr {}
1307        impl fmt::Debug for mq_attr {
1308            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1309                f.debug_struct("mq_attr")
1310                    .field("mq_flags", &self.mq_flags)
1311                    .field("mq_maxmsg", &self.mq_maxmsg)
1312                    .field("mq_msgsize", &self.mq_msgsize)
1313                    .field("mq_curmsgs", &self.mq_curmsgs)
1314                    .finish()
1315            }
1316        }
1317        impl hash::Hash for mq_attr {
1318            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1319                self.mq_flags.hash(state);
1320                self.mq_maxmsg.hash(state);
1321                self.mq_msgsize.hash(state);
1322                self.mq_curmsgs.hash(state);
1323            }
1324        }
1325
1326        impl PartialEq for sockaddr_nl {
1327            fn eq(&self, other: &sockaddr_nl) -> bool {
1328                self.nl_family == other.nl_family
1329                    && self.nl_pid == other.nl_pid
1330                    && self.nl_groups == other.nl_groups
1331            }
1332        }
1333        impl Eq for sockaddr_nl {}
1334        impl fmt::Debug for sockaddr_nl {
1335            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1336                f.debug_struct("sockaddr_nl")
1337                    .field("nl_family", &self.nl_family)
1338                    .field("nl_pid", &self.nl_pid)
1339                    .field("nl_groups", &self.nl_groups)
1340                    .finish()
1341            }
1342        }
1343        impl hash::Hash for sockaddr_nl {
1344            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1345                self.nl_family.hash(state);
1346                self.nl_pid.hash(state);
1347                self.nl_groups.hash(state);
1348            }
1349        }
1350
1351        // FIXME(msrv): suggested method was added in 1.85
1352        #[allow(unpredictable_function_pointer_comparisons)]
1353        impl PartialEq for sigevent {
1354            fn eq(&self, other: &sigevent) -> bool {
1355                self.sigev_value == other.sigev_value
1356                    && self.sigev_signo == other.sigev_signo
1357                    && self.sigev_notify == other.sigev_notify
1358                    && self.sigev_notify_function == other.sigev_notify_function
1359                    && self.sigev_notify_attributes == other.sigev_notify_attributes
1360            }
1361        }
1362        impl Eq for sigevent {}
1363        impl fmt::Debug for sigevent {
1364            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1365                f.debug_struct("sigevent")
1366                    .field("sigev_value", &self.sigev_value)
1367                    .field("sigev_signo", &self.sigev_signo)
1368                    .field("sigev_notify", &self.sigev_notify)
1369                    .field("sigev_notify_function", &self.sigev_notify_function)
1370                    .field("sigev_notify_attributes", &self.sigev_notify_attributes)
1371                    .finish()
1372            }
1373        }
1374        impl hash::Hash for sigevent {
1375            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1376                self.sigev_value.hash(state);
1377                self.sigev_signo.hash(state);
1378                self.sigev_notify.hash(state);
1379                self.sigev_notify_function.hash(state);
1380                self.sigev_notify_attributes.hash(state);
1381            }
1382        }
1383
1384        impl PartialEq for pthread_cond_t {
1385            fn eq(&self, other: &pthread_cond_t) -> bool {
1386                self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
1387            }
1388        }
1389        impl Eq for pthread_cond_t {}
1390        impl fmt::Debug for pthread_cond_t {
1391            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1392                f.debug_struct("pthread_cond_t")
1393                    // FIXME: .field("size", &self.size)
1394                    .finish()
1395            }
1396        }
1397        impl hash::Hash for pthread_cond_t {
1398            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1399                self.size.hash(state);
1400            }
1401        }
1402
1403        impl PartialEq for pthread_mutex_t {
1404            fn eq(&self, other: &pthread_mutex_t) -> bool {
1405                self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
1406            }
1407        }
1408        impl Eq for pthread_mutex_t {}
1409        impl fmt::Debug for pthread_mutex_t {
1410            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1411                f.debug_struct("pthread_mutex_t")
1412                    // FIXME: .field("size", &self.size)
1413                    .finish()
1414            }
1415        }
1416        impl hash::Hash for pthread_mutex_t {
1417            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1418                self.size.hash(state);
1419            }
1420        }
1421
1422        impl PartialEq for pthread_rwlock_t {
1423            fn eq(&self, other: &pthread_rwlock_t) -> bool {
1424                self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
1425            }
1426        }
1427        impl Eq for pthread_rwlock_t {}
1428        impl fmt::Debug for pthread_rwlock_t {
1429            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1430                f.debug_struct("pthread_rwlock_t")
1431                    // FIXME: .field("size", &self.size)
1432                    .finish()
1433            }
1434        }
1435        impl hash::Hash for pthread_rwlock_t {
1436            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1437                self.size.hash(state);
1438            }
1439        }
1440    }
1441}
1442
1443// PUB_CONST
1444
1445pub const INT_MIN: c_int = -2147483648;
1446pub const INT_MAX: c_int = 2147483647;
1447
1448pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
1449pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
1450pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
1451
1452pub const DT_UNKNOWN: u8 = 0;
1453pub const DT_FIFO: u8 = 1;
1454pub const DT_CHR: u8 = 2;
1455pub const DT_DIR: u8 = 4;
1456pub const DT_BLK: u8 = 6;
1457pub const DT_REG: u8 = 8;
1458pub const DT_LNK: u8 = 10;
1459pub const DT_SOCK: u8 = 12;
1460
1461pub const FD_CLOEXEC: c_int = 0x1;
1462
1463pub const USRQUOTA: c_int = 0;
1464pub const GRPQUOTA: c_int = 1;
1465
1466pub const SIGIOT: c_int = 6;
1467
1468pub const S_ISUID: crate::mode_t = 0o4000;
1469pub const S_ISGID: crate::mode_t = 0o2000;
1470pub const S_ISVTX: crate::mode_t = 0o1000;
1471
1472pub const IF_NAMESIZE: size_t = 16;
1473pub const IFNAMSIZ: size_t = IF_NAMESIZE;
1474
1475pub const LOG_EMERG: c_int = 0;
1476pub const LOG_ALERT: c_int = 1;
1477pub const LOG_CRIT: c_int = 2;
1478pub const LOG_ERR: c_int = 3;
1479pub const LOG_WARNING: c_int = 4;
1480pub const LOG_NOTICE: c_int = 5;
1481pub const LOG_INFO: c_int = 6;
1482pub const LOG_DEBUG: c_int = 7;
1483
1484pub const LOG_KERN: c_int = 0;
1485pub const LOG_USER: c_int = 1 << 3;
1486pub const LOG_MAIL: c_int = 2 << 3;
1487pub const LOG_DAEMON: c_int = 3 << 3;
1488pub const LOG_AUTH: c_int = 4 << 3;
1489pub const LOG_SYSLOG: c_int = 5 << 3;
1490pub const LOG_LPR: c_int = 6 << 3;
1491pub const LOG_NEWS: c_int = 7 << 3;
1492pub const LOG_UUCP: c_int = 8 << 3;
1493pub const LOG_LOCAL0: c_int = 16 << 3;
1494pub const LOG_LOCAL1: c_int = 17 << 3;
1495pub const LOG_LOCAL2: c_int = 18 << 3;
1496pub const LOG_LOCAL3: c_int = 19 << 3;
1497pub const LOG_LOCAL4: c_int = 20 << 3;
1498pub const LOG_LOCAL5: c_int = 21 << 3;
1499pub const LOG_LOCAL6: c_int = 22 << 3;
1500pub const LOG_LOCAL7: c_int = 23 << 3;
1501
1502pub const LOG_PID: c_int = 0x01;
1503pub const LOG_CONS: c_int = 0x02;
1504pub const LOG_ODELAY: c_int = 0x04;
1505pub const LOG_NDELAY: c_int = 0x08;
1506pub const LOG_NOWAIT: c_int = 0x10;
1507
1508pub const LOG_PRIMASK: c_int = 7;
1509pub const LOG_FACMASK: c_int = 0x3f8;
1510
1511pub const PRIO_PROCESS: c_int = 0;
1512pub const PRIO_PGRP: c_int = 1;
1513pub const PRIO_USER: c_int = 2;
1514
1515pub const PRIO_MIN: c_int = -20;
1516pub const PRIO_MAX: c_int = 20;
1517
1518pub const IPPROTO_ICMP: c_int = 1;
1519pub const IPPROTO_ICMPV6: c_int = 58;
1520pub const IPPROTO_TCP: c_int = 6;
1521pub const IPPROTO_UDP: c_int = 17;
1522pub const IPPROTO_IP: c_int = 0;
1523pub const IPPROTO_IPV6: c_int = 41;
1524
1525pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
1526pub const INADDR_ANY: in_addr_t = 0;
1527pub const INADDR_BROADCAST: in_addr_t = 4294967295;
1528pub const INADDR_NONE: in_addr_t = 4294967295;
1529
1530pub const EXIT_FAILURE: c_int = 1;
1531pub const EXIT_SUCCESS: c_int = 0;
1532pub const RAND_MAX: c_int = 2147483647;
1533pub const EOF: c_int = -1;
1534pub const SEEK_SET: c_int = 0;
1535pub const SEEK_CUR: c_int = 1;
1536pub const SEEK_END: c_int = 2;
1537pub const _IOFBF: c_int = 0;
1538pub const _IONBF: c_int = 2;
1539pub const _IOLBF: c_int = 1;
1540
1541pub const F_DUPFD: c_int = 0;
1542pub const F_GETFD: c_int = 1;
1543pub const F_SETFD: c_int = 2;
1544pub const F_GETFL: c_int = 3;
1545pub const F_SETFL: c_int = 4;
1546
1547// Linux-specific fcntls
1548pub const F_SETLEASE: c_int = 1024;
1549pub const F_GETLEASE: c_int = 1025;
1550pub const F_NOTIFY: c_int = 1026;
1551pub const F_CANCELLK: c_int = 1029;
1552pub const F_DUPFD_CLOEXEC: c_int = 1030;
1553pub const F_SETPIPE_SZ: c_int = 1031;
1554pub const F_GETPIPE_SZ: c_int = 1032;
1555pub const F_ADD_SEALS: c_int = 1033;
1556pub const F_GET_SEALS: c_int = 1034;
1557
1558pub const F_SEAL_SEAL: c_int = 0x0001;
1559pub const F_SEAL_SHRINK: c_int = 0x0002;
1560pub const F_SEAL_GROW: c_int = 0x0004;
1561pub const F_SEAL_WRITE: c_int = 0x0008;
1562
1563// FIXME(#235): Include file sealing fcntls once we have a way to verify them.
1564
1565pub const SIGTRAP: c_int = 5;
1566
1567pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
1568pub const PTHREAD_CREATE_DETACHED: c_int = 1;
1569
1570pub const CLOCK_REALTIME: crate::clockid_t = 0;
1571pub const CLOCK_MONOTONIC: crate::clockid_t = 1;
1572pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2;
1573pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 3;
1574pub const CLOCK_MONOTONIC_RAW: crate::clockid_t = 4;
1575pub const CLOCK_REALTIME_COARSE: crate::clockid_t = 5;
1576pub const CLOCK_MONOTONIC_COARSE: crate::clockid_t = 6;
1577pub const CLOCK_BOOTTIME: crate::clockid_t = 7;
1578pub const CLOCK_REALTIME_ALARM: crate::clockid_t = 8;
1579pub const CLOCK_BOOTTIME_ALARM: crate::clockid_t = 9;
1580pub const CLOCK_SGI_CYCLE: crate::clockid_t = 10;
1581pub const CLOCK_TAI: crate::clockid_t = 11;
1582pub const TIMER_ABSTIME: c_int = 1;
1583
1584pub const RLIMIT_CPU: c_int = 0;
1585pub const RLIMIT_FSIZE: c_int = 1;
1586pub const RLIMIT_DATA: c_int = 2;
1587pub const RLIMIT_STACK: c_int = 3;
1588pub const RLIMIT_CORE: c_int = 4;
1589pub const RLIMIT_LOCKS: c_int = 10;
1590pub const RLIMIT_SIGPENDING: c_int = 11;
1591pub const RLIMIT_MSGQUEUE: c_int = 12;
1592pub const RLIMIT_NICE: c_int = 13;
1593pub const RLIMIT_RTPRIO: c_int = 14;
1594
1595pub const RUSAGE_SELF: c_int = 0;
1596
1597pub const O_RDONLY: c_int = 0;
1598pub const O_WRONLY: c_int = 1;
1599pub const O_RDWR: c_int = 2;
1600
1601pub const S_IFIFO: crate::mode_t = 0o1_0000;
1602pub const S_IFCHR: crate::mode_t = 0o2_0000;
1603pub const S_IFBLK: crate::mode_t = 0o6_0000;
1604pub const S_IFDIR: crate::mode_t = 0o4_0000;
1605pub const S_IFREG: crate::mode_t = 0o10_0000;
1606pub const S_IFLNK: crate::mode_t = 0o12_0000;
1607pub const S_IFSOCK: crate::mode_t = 0o14_0000;
1608pub const S_IFMT: crate::mode_t = 0o17_0000;
1609pub const S_IRWXU: crate::mode_t = 0o0700;
1610pub const S_IXUSR: crate::mode_t = 0o0100;
1611pub const S_IWUSR: crate::mode_t = 0o0200;
1612pub const S_IRUSR: crate::mode_t = 0o0400;
1613pub const S_IRWXG: crate::mode_t = 0o0070;
1614pub const S_IXGRP: crate::mode_t = 0o0010;
1615pub const S_IWGRP: crate::mode_t = 0o0020;
1616pub const S_IRGRP: crate::mode_t = 0o0040;
1617pub const S_IRWXO: crate::mode_t = 0o0007;
1618pub const S_IXOTH: crate::mode_t = 0o0001;
1619pub const S_IWOTH: crate::mode_t = 0o0002;
1620pub const S_IROTH: crate::mode_t = 0o0004;
1621pub const F_OK: c_int = 0;
1622pub const R_OK: c_int = 4;
1623pub const W_OK: c_int = 2;
1624pub const X_OK: c_int = 1;
1625pub const STDIN_FILENO: c_int = 0;
1626pub const STDOUT_FILENO: c_int = 1;
1627pub const STDERR_FILENO: c_int = 2;
1628pub const SIGHUP: c_int = 1;
1629pub const SIGINT: c_int = 2;
1630pub const SIGQUIT: c_int = 3;
1631pub const SIGILL: c_int = 4;
1632pub const SIGABRT: c_int = 6;
1633pub const SIGFPE: c_int = 8;
1634pub const SIGKILL: c_int = 9;
1635pub const SIGSEGV: c_int = 11;
1636pub const SIGPIPE: c_int = 13;
1637pub const SIGALRM: c_int = 14;
1638pub const SIGTERM: c_int = 15;
1639
1640pub const PROT_NONE: c_int = 0;
1641pub const PROT_READ: c_int = 1;
1642pub const PROT_WRITE: c_int = 2;
1643pub const PROT_EXEC: c_int = 4;
1644
1645pub const LC_CTYPE: c_int = 0;
1646pub const LC_NUMERIC: c_int = 1;
1647pub const LC_TIME: c_int = 2;
1648pub const LC_COLLATE: c_int = 3;
1649pub const LC_MONETARY: c_int = 4;
1650pub const LC_MESSAGES: c_int = 5;
1651pub const LC_ALL: c_int = 6;
1652pub const LC_CTYPE_MASK: c_int = 1 << LC_CTYPE;
1653pub const LC_NUMERIC_MASK: c_int = 1 << LC_NUMERIC;
1654pub const LC_TIME_MASK: c_int = 1 << LC_TIME;
1655pub const LC_COLLATE_MASK: c_int = 1 << LC_COLLATE;
1656pub const LC_MONETARY_MASK: c_int = 1 << LC_MONETARY;
1657pub const LC_MESSAGES_MASK: c_int = 1 << LC_MESSAGES;
1658// LC_ALL_MASK defined per platform
1659
1660pub const MAP_FILE: c_int = 0x0000;
1661pub const MAP_SHARED: c_int = 0x0001;
1662pub const MAP_PRIVATE: c_int = 0x0002;
1663pub const MAP_FIXED: c_int = 0x0010;
1664
1665pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
1666
1667// MS_ flags for msync(2)
1668pub const MS_ASYNC: c_int = 0x0001;
1669pub const MS_INVALIDATE: c_int = 0x0002;
1670pub const MS_SYNC: c_int = 0x0004;
1671
1672// MS_ flags for mount(2)
1673pub const MS_RDONLY: c_ulong = 0x01;
1674pub const MS_NOSUID: c_ulong = 0x02;
1675pub const MS_NODEV: c_ulong = 0x04;
1676pub const MS_NOEXEC: c_ulong = 0x08;
1677pub const MS_SYNCHRONOUS: c_ulong = 0x10;
1678pub const MS_REMOUNT: c_ulong = 0x20;
1679pub const MS_MANDLOCK: c_ulong = 0x40;
1680pub const MS_DIRSYNC: c_ulong = 0x80;
1681pub const MS_NOATIME: c_ulong = 0x0400;
1682pub const MS_NODIRATIME: c_ulong = 0x0800;
1683pub const MS_BIND: c_ulong = 0x1000;
1684pub const MS_MOVE: c_ulong = 0x2000;
1685pub const MS_REC: c_ulong = 0x4000;
1686pub const MS_SILENT: c_ulong = 0x8000;
1687pub const MS_POSIXACL: c_ulong = 0x010000;
1688pub const MS_UNBINDABLE: c_ulong = 0x020000;
1689pub const MS_PRIVATE: c_ulong = 0x040000;
1690pub const MS_SLAVE: c_ulong = 0x080000;
1691pub const MS_SHARED: c_ulong = 0x100000;
1692pub const MS_RELATIME: c_ulong = 0x200000;
1693pub const MS_KERNMOUNT: c_ulong = 0x400000;
1694pub const MS_I_VERSION: c_ulong = 0x800000;
1695pub const MS_STRICTATIME: c_ulong = 0x1000000;
1696pub const MS_ACTIVE: c_ulong = 0x40000000;
1697pub const MS_NOUSER: c_ulong = 0x80000000;
1698pub const MS_MGC_VAL: c_ulong = 0xc0ed0000;
1699pub const MS_MGC_MSK: c_ulong = 0xffff0000;
1700pub const MS_RMT_MASK: c_ulong = 0x800051;
1701
1702pub const EPERM: c_int = 1;
1703pub const ENOENT: c_int = 2;
1704pub const ESRCH: c_int = 3;
1705pub const EINTR: c_int = 4;
1706pub const EIO: c_int = 5;
1707pub const ENXIO: c_int = 6;
1708pub const E2BIG: c_int = 7;
1709pub const ENOEXEC: c_int = 8;
1710pub const EBADF: c_int = 9;
1711pub const ECHILD: c_int = 10;
1712pub const EAGAIN: c_int = 11;
1713pub const ENOMEM: c_int = 12;
1714pub const EACCES: c_int = 13;
1715pub const EFAULT: c_int = 14;
1716pub const ENOTBLK: c_int = 15;
1717pub const EBUSY: c_int = 16;
1718pub const EEXIST: c_int = 17;
1719pub const EXDEV: c_int = 18;
1720pub const ENODEV: c_int = 19;
1721pub const ENOTDIR: c_int = 20;
1722pub const EISDIR: c_int = 21;
1723pub const EINVAL: c_int = 22;
1724pub const ENFILE: c_int = 23;
1725pub const EMFILE: c_int = 24;
1726pub const ENOTTY: c_int = 25;
1727pub const ETXTBSY: c_int = 26;
1728pub const EFBIG: c_int = 27;
1729pub const ENOSPC: c_int = 28;
1730pub const ESPIPE: c_int = 29;
1731pub const EROFS: c_int = 30;
1732pub const EMLINK: c_int = 31;
1733pub const EPIPE: c_int = 32;
1734pub const EDOM: c_int = 33;
1735pub const ERANGE: c_int = 34;
1736pub const EWOULDBLOCK: c_int = EAGAIN;
1737
1738pub const SCM_RIGHTS: c_int = 0x01;
1739pub const SCM_CREDENTIALS: c_int = 0x02;
1740
1741pub const PROT_GROWSDOWN: c_int = 0x1000000;
1742pub const PROT_GROWSUP: c_int = 0x2000000;
1743
1744pub const MAP_TYPE: c_int = 0x000f;
1745
1746pub const MADV_NORMAL: c_int = 0;
1747pub const MADV_RANDOM: c_int = 1;
1748pub const MADV_SEQUENTIAL: c_int = 2;
1749pub const MADV_WILLNEED: c_int = 3;
1750pub const MADV_DONTNEED: c_int = 4;
1751pub const MADV_FREE: c_int = 8;
1752pub const MADV_REMOVE: c_int = 9;
1753pub const MADV_DONTFORK: c_int = 10;
1754pub const MADV_DOFORK: c_int = 11;
1755pub const MADV_MERGEABLE: c_int = 12;
1756pub const MADV_UNMERGEABLE: c_int = 13;
1757pub const MADV_HUGEPAGE: c_int = 14;
1758pub const MADV_NOHUGEPAGE: c_int = 15;
1759pub const MADV_DONTDUMP: c_int = 16;
1760pub const MADV_DODUMP: c_int = 17;
1761pub const MADV_HWPOISON: c_int = 100;
1762pub const MADV_SOFT_OFFLINE: c_int = 101;
1763
1764pub const IFF_UP: c_int = 0x1;
1765pub const IFF_BROADCAST: c_int = 0x2;
1766pub const IFF_DEBUG: c_int = 0x4;
1767pub const IFF_LOOPBACK: c_int = 0x8;
1768pub const IFF_POINTOPOINT: c_int = 0x10;
1769pub const IFF_NOTRAILERS: c_int = 0x20;
1770pub const IFF_RUNNING: c_int = 0x40;
1771pub const IFF_NOARP: c_int = 0x80;
1772pub const IFF_PROMISC: c_int = 0x100;
1773pub const IFF_ALLMULTI: c_int = 0x200;
1774pub const IFF_MASTER: c_int = 0x400;
1775pub const IFF_SLAVE: c_int = 0x800;
1776pub const IFF_MULTICAST: c_int = 0x1000;
1777pub const IFF_PORTSEL: c_int = 0x2000;
1778pub const IFF_AUTOMEDIA: c_int = 0x4000;
1779pub const IFF_DYNAMIC: c_int = 0x8000;
1780pub const IFF_TUN: c_int = 0x0001;
1781pub const IFF_TAP: c_int = 0x0002;
1782pub const IFF_NO_PI: c_int = 0x1000;
1783
1784pub const SOL_IP: c_int = 0;
1785pub const SOL_TCP: c_int = 6;
1786pub const SOL_UDP: c_int = 17;
1787pub const SOL_IPV6: c_int = 41;
1788pub const SOL_ICMPV6: c_int = 58;
1789pub const SOL_RAW: c_int = 255;
1790pub const SOL_DECNET: c_int = 261;
1791pub const SOL_X25: c_int = 262;
1792pub const SOL_PACKET: c_int = 263;
1793pub const SOL_ATM: c_int = 264;
1794pub const SOL_AAL: c_int = 265;
1795pub const SOL_IRDA: c_int = 266;
1796pub const SOL_NETBEUI: c_int = 267;
1797pub const SOL_LLC: c_int = 268;
1798pub const SOL_DCCP: c_int = 269;
1799pub const SOL_NETLINK: c_int = 270;
1800pub const SOL_TIPC: c_int = 271;
1801
1802pub const AF_UNSPEC: c_int = 0;
1803pub const AF_UNIX: c_int = 1;
1804pub const AF_LOCAL: c_int = 1;
1805pub const AF_INET: c_int = 2;
1806pub const AF_AX25: c_int = 3;
1807pub const AF_IPX: c_int = 4;
1808pub const AF_APPLETALK: c_int = 5;
1809pub const AF_NETROM: c_int = 6;
1810pub const AF_BRIDGE: c_int = 7;
1811pub const AF_ATMPVC: c_int = 8;
1812pub const AF_X25: c_int = 9;
1813pub const AF_INET6: c_int = 10;
1814pub const AF_ROSE: c_int = 11;
1815pub const AF_DECnet: c_int = 12;
1816pub const AF_NETBEUI: c_int = 13;
1817pub const AF_SECURITY: c_int = 14;
1818pub const AF_KEY: c_int = 15;
1819pub const AF_NETLINK: c_int = 16;
1820pub const AF_ROUTE: c_int = AF_NETLINK;
1821pub const AF_PACKET: c_int = 17;
1822pub const AF_ASH: c_int = 18;
1823pub const AF_ECONET: c_int = 19;
1824pub const AF_ATMSVC: c_int = 20;
1825pub const AF_RDS: c_int = 21;
1826pub const AF_SNA: c_int = 22;
1827pub const AF_IRDA: c_int = 23;
1828pub const AF_PPPOX: c_int = 24;
1829pub const AF_WANPIPE: c_int = 25;
1830pub const AF_LLC: c_int = 26;
1831pub const AF_CAN: c_int = 29;
1832pub const AF_TIPC: c_int = 30;
1833pub const AF_BLUETOOTH: c_int = 31;
1834pub const AF_IUCV: c_int = 32;
1835pub const AF_RXRPC: c_int = 33;
1836pub const AF_ISDN: c_int = 34;
1837pub const AF_PHONET: c_int = 35;
1838pub const AF_IEEE802154: c_int = 36;
1839pub const AF_CAIF: c_int = 37;
1840pub const AF_ALG: c_int = 38;
1841
1842pub const PF_UNSPEC: c_int = AF_UNSPEC;
1843pub const PF_UNIX: c_int = AF_UNIX;
1844pub const PF_LOCAL: c_int = AF_LOCAL;
1845pub const PF_INET: c_int = AF_INET;
1846pub const PF_AX25: c_int = AF_AX25;
1847pub const PF_IPX: c_int = AF_IPX;
1848pub const PF_APPLETALK: c_int = AF_APPLETALK;
1849pub const PF_NETROM: c_int = AF_NETROM;
1850pub const PF_BRIDGE: c_int = AF_BRIDGE;
1851pub const PF_ATMPVC: c_int = AF_ATMPVC;
1852pub const PF_X25: c_int = AF_X25;
1853pub const PF_INET6: c_int = AF_INET6;
1854pub const PF_ROSE: c_int = AF_ROSE;
1855pub const PF_DECnet: c_int = AF_DECnet;
1856pub const PF_NETBEUI: c_int = AF_NETBEUI;
1857pub const PF_SECURITY: c_int = AF_SECURITY;
1858pub const PF_KEY: c_int = AF_KEY;
1859pub const PF_NETLINK: c_int = AF_NETLINK;
1860pub const PF_ROUTE: c_int = AF_ROUTE;
1861pub const PF_PACKET: c_int = AF_PACKET;
1862pub const PF_ASH: c_int = AF_ASH;
1863pub const PF_ECONET: c_int = AF_ECONET;
1864pub const PF_ATMSVC: c_int = AF_ATMSVC;
1865pub const PF_RDS: c_int = AF_RDS;
1866pub const PF_SNA: c_int = AF_SNA;
1867pub const PF_IRDA: c_int = AF_IRDA;
1868pub const PF_PPPOX: c_int = AF_PPPOX;
1869pub const PF_WANPIPE: c_int = AF_WANPIPE;
1870pub const PF_LLC: c_int = AF_LLC;
1871pub const PF_CAN: c_int = AF_CAN;
1872pub const PF_TIPC: c_int = AF_TIPC;
1873pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
1874pub const PF_IUCV: c_int = AF_IUCV;
1875pub const PF_RXRPC: c_int = AF_RXRPC;
1876pub const PF_ISDN: c_int = AF_ISDN;
1877pub const PF_PHONET: c_int = AF_PHONET;
1878pub const PF_IEEE802154: c_int = AF_IEEE802154;
1879pub const PF_CAIF: c_int = AF_CAIF;
1880pub const PF_ALG: c_int = AF_ALG;
1881
1882pub const SOMAXCONN: c_int = 128;
1883
1884pub const MSG_OOB: c_int = 1;
1885pub const MSG_PEEK: c_int = 2;
1886pub const MSG_DONTROUTE: c_int = 4;
1887pub const MSG_CTRUNC: c_int = 8;
1888pub const MSG_TRUNC: c_int = 0x20;
1889pub const MSG_DONTWAIT: c_int = 0x40;
1890pub const MSG_EOR: c_int = 0x80;
1891pub const MSG_WAITALL: c_int = 0x100;
1892pub const MSG_FIN: c_int = 0x200;
1893pub const MSG_SYN: c_int = 0x400;
1894pub const MSG_CONFIRM: c_int = 0x800;
1895pub const MSG_RST: c_int = 0x1000;
1896pub const MSG_ERRQUEUE: c_int = 0x2000;
1897pub const MSG_NOSIGNAL: c_int = 0x4000;
1898pub const MSG_MORE: c_int = 0x8000;
1899pub const MSG_WAITFORONE: c_int = 0x10000;
1900pub const MSG_FASTOPEN: c_int = 0x20000000;
1901pub const MSG_CMSG_CLOEXEC: c_int = 0x40000000;
1902
1903pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP;
1904
1905pub const SOCK_RAW: c_int = 3;
1906pub const SOCK_RDM: c_int = 4;
1907
1908pub const IP_TOS: c_int = 1;
1909pub const IP_TTL: c_int = 2;
1910pub const IP_HDRINCL: c_int = 3;
1911pub const IP_RECVTOS: c_int = 13;
1912pub const IP_FREEBIND: c_int = 15;
1913pub const IP_TRANSPARENT: c_int = 19;
1914pub const IP_MULTICAST_IF: c_int = 32;
1915pub const IP_MULTICAST_TTL: c_int = 33;
1916pub const IP_MULTICAST_LOOP: c_int = 34;
1917pub const IP_ADD_MEMBERSHIP: c_int = 35;
1918pub const IP_DROP_MEMBERSHIP: c_int = 36;
1919
1920pub const IPV6_UNICAST_HOPS: c_int = 16;
1921pub const IPV6_MULTICAST_IF: c_int = 17;
1922pub const IPV6_MULTICAST_HOPS: c_int = 18;
1923pub const IPV6_MULTICAST_LOOP: c_int = 19;
1924pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
1925pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
1926pub const IPV6_V6ONLY: c_int = 26;
1927pub const IPV6_RECVPKTINFO: c_int = 49;
1928pub const IPV6_RECVTCLASS: c_int = 66;
1929pub const IPV6_TCLASS: c_int = 67;
1930
1931pub const TCP_NODELAY: c_int = 1;
1932pub const TCP_MAXSEG: c_int = 2;
1933pub const TCP_CORK: c_int = 3;
1934pub const TCP_KEEPIDLE: c_int = 4;
1935pub const TCP_KEEPINTVL: c_int = 5;
1936pub const TCP_KEEPCNT: c_int = 6;
1937pub const TCP_SYNCNT: c_int = 7;
1938pub const TCP_LINGER2: c_int = 8;
1939pub const TCP_DEFER_ACCEPT: c_int = 9;
1940pub const TCP_WINDOW_CLAMP: c_int = 10;
1941pub const TCP_INFO: c_int = 11;
1942pub const TCP_QUICKACK: c_int = 12;
1943pub const TCP_CONGESTION: c_int = 13;
1944
1945pub const SO_DEBUG: c_int = 1;
1946
1947pub const SHUT_RD: c_int = 0;
1948pub const SHUT_WR: c_int = 1;
1949pub const SHUT_RDWR: c_int = 2;
1950
1951pub const LOCK_SH: c_int = 1;
1952pub const LOCK_EX: c_int = 2;
1953pub const LOCK_NB: c_int = 4;
1954pub const LOCK_UN: c_int = 8;
1955
1956pub const SS_ONSTACK: c_int = 1;
1957pub const SS_DISABLE: c_int = 2;
1958
1959pub const PATH_MAX: c_int = 4096;
1960
1961pub const FD_SETSIZE: usize = 1024;
1962
1963pub const EPOLLIN: c_int = 0x1;
1964pub const EPOLLPRI: c_int = 0x2;
1965pub const EPOLLOUT: c_int = 0x4;
1966pub const EPOLLRDNORM: c_int = 0x40;
1967pub const EPOLLRDBAND: c_int = 0x80;
1968pub const EPOLLWRNORM: c_int = 0x100;
1969pub const EPOLLWRBAND: c_int = 0x200;
1970pub const EPOLLMSG: c_int = 0x400;
1971pub const EPOLLERR: c_int = 0x8;
1972pub const EPOLLHUP: c_int = 0x10;
1973pub const EPOLLET: c_int = 0x80000000;
1974
1975pub const EPOLL_CTL_ADD: c_int = 1;
1976pub const EPOLL_CTL_MOD: c_int = 3;
1977pub const EPOLL_CTL_DEL: c_int = 2;
1978
1979pub const MNT_DETACH: c_int = 0x2;
1980pub const MNT_EXPIRE: c_int = 0x4;
1981
1982pub const Q_GETFMT: c_int = 0x800004;
1983pub const Q_GETINFO: c_int = 0x800005;
1984pub const Q_SETINFO: c_int = 0x800006;
1985pub const QIF_BLIMITS: u32 = 1;
1986pub const QIF_SPACE: u32 = 2;
1987pub const QIF_ILIMITS: u32 = 4;
1988pub const QIF_INODES: u32 = 8;
1989pub const QIF_BTIME: u32 = 16;
1990pub const QIF_ITIME: u32 = 32;
1991pub const QIF_LIMITS: u32 = 5;
1992pub const QIF_USAGE: u32 = 10;
1993pub const QIF_TIMES: u32 = 48;
1994pub const QIF_ALL: u32 = 63;
1995
1996pub const MNT_FORCE: c_int = 0x1;
1997
1998pub const Q_SYNC: c_int = 0x800001;
1999pub const Q_QUOTAON: c_int = 0x800002;
2000pub const Q_QUOTAOFF: c_int = 0x800003;
2001pub const Q_GETQUOTA: c_int = 0x800007;
2002pub const Q_SETQUOTA: c_int = 0x800008;
2003
2004pub const TCIOFF: c_int = 2;
2005pub const TCION: c_int = 3;
2006pub const TCOOFF: c_int = 0;
2007pub const TCOON: c_int = 1;
2008pub const TCIFLUSH: c_int = 0;
2009pub const TCOFLUSH: c_int = 1;
2010pub const TCIOFLUSH: c_int = 2;
2011pub const NL0: c_int = 0x00000000;
2012pub const NL1: c_int = 0x00000100;
2013pub const TAB0: c_int = 0x00000000;
2014pub const CR0: c_int = 0x00000000;
2015pub const FF0: c_int = 0x00000000;
2016pub const BS0: c_int = 0x00000000;
2017pub const VT0: c_int = 0x00000000;
2018pub const VERASE: usize = 2;
2019pub const VKILL: usize = 3;
2020pub const VINTR: usize = 0;
2021pub const VQUIT: usize = 1;
2022pub const VLNEXT: usize = 15;
2023pub const IGNBRK: crate::tcflag_t = 0x00000001;
2024pub const BRKINT: crate::tcflag_t = 0x00000002;
2025pub const IGNPAR: crate::tcflag_t = 0x00000004;
2026pub const PARMRK: crate::tcflag_t = 0x00000008;
2027pub const INPCK: crate::tcflag_t = 0x00000010;
2028pub const ISTRIP: crate::tcflag_t = 0x00000020;
2029pub const INLCR: crate::tcflag_t = 0x00000040;
2030pub const IGNCR: crate::tcflag_t = 0x00000080;
2031pub const ICRNL: crate::tcflag_t = 0x00000100;
2032pub const IXANY: crate::tcflag_t = 0x00000800;
2033pub const IMAXBEL: crate::tcflag_t = 0x00002000;
2034pub const OPOST: crate::tcflag_t = 0x1;
2035pub const CS5: crate::tcflag_t = 0x00000000;
2036pub const CRTSCTS: crate::tcflag_t = 0x80000000;
2037pub const ECHO: crate::tcflag_t = 0x00000008;
2038pub const OCRNL: crate::tcflag_t = 0o000010;
2039pub const ONOCR: crate::tcflag_t = 0o000020;
2040pub const ONLRET: crate::tcflag_t = 0o000040;
2041pub const OFILL: crate::tcflag_t = 0o000100;
2042pub const OFDEL: crate::tcflag_t = 0o000200;
2043
2044pub const CLONE_VM: c_int = 0x100;
2045pub const CLONE_FS: c_int = 0x200;
2046pub const CLONE_FILES: c_int = 0x400;
2047pub const CLONE_SIGHAND: c_int = 0x800;
2048pub const CLONE_PTRACE: c_int = 0x2000;
2049pub const CLONE_VFORK: c_int = 0x4000;
2050pub const CLONE_PARENT: c_int = 0x8000;
2051pub const CLONE_THREAD: c_int = 0x10000;
2052pub const CLONE_NEWNS: c_int = 0x20000;
2053pub const CLONE_SYSVSEM: c_int = 0x40000;
2054pub const CLONE_SETTLS: c_int = 0x80000;
2055pub const CLONE_PARENT_SETTID: c_int = 0x100000;
2056pub const CLONE_CHILD_CLEARTID: c_int = 0x200000;
2057pub const CLONE_DETACHED: c_int = 0x400000;
2058pub const CLONE_UNTRACED: c_int = 0x800000;
2059pub const CLONE_CHILD_SETTID: c_int = 0x01000000;
2060pub const CLONE_NEWUTS: c_int = 0x04000000;
2061pub const CLONE_NEWIPC: c_int = 0x08000000;
2062pub const CLONE_NEWUSER: c_int = 0x10000000;
2063pub const CLONE_NEWPID: c_int = 0x20000000;
2064pub const CLONE_NEWNET: c_int = 0x40000000;
2065pub const CLONE_IO: c_int = 0x80000000;
2066pub const CLONE_NEWCGROUP: c_int = 0x02000000;
2067
2068pub const WNOHANG: c_int = 0x00000001;
2069pub const WUNTRACED: c_int = 0x00000002;
2070pub const WSTOPPED: c_int = WUNTRACED;
2071pub const WEXITED: c_int = 0x00000004;
2072pub const WCONTINUED: c_int = 0x00000008;
2073pub const WNOWAIT: c_int = 0x01000000;
2074
2075// Options set using PTRACE_SETOPTIONS.
2076pub const PTRACE_O_TRACESYSGOOD: c_int = 0x00000001;
2077pub const PTRACE_O_TRACEFORK: c_int = 0x00000002;
2078pub const PTRACE_O_TRACEVFORK: c_int = 0x00000004;
2079pub const PTRACE_O_TRACECLONE: c_int = 0x00000008;
2080pub const PTRACE_O_TRACEEXEC: c_int = 0x00000010;
2081pub const PTRACE_O_TRACEVFORKDONE: c_int = 0x00000020;
2082pub const PTRACE_O_TRACEEXIT: c_int = 0x00000040;
2083pub const PTRACE_O_TRACESECCOMP: c_int = 0x00000080;
2084pub const PTRACE_O_EXITKILL: c_int = 0x00100000;
2085pub const PTRACE_O_SUSPEND_SECCOMP: c_int = 0x00200000;
2086pub const PTRACE_O_MASK: c_int = 0x003000ff;
2087
2088// Wait extended result codes for the above trace options.
2089pub const PTRACE_EVENT_FORK: c_int = 1;
2090pub const PTRACE_EVENT_VFORK: c_int = 2;
2091pub const PTRACE_EVENT_CLONE: c_int = 3;
2092pub const PTRACE_EVENT_EXEC: c_int = 4;
2093pub const PTRACE_EVENT_VFORK_DONE: c_int = 5;
2094pub const PTRACE_EVENT_EXIT: c_int = 6;
2095pub const PTRACE_EVENT_SECCOMP: c_int = 7;
2096// PTRACE_EVENT_STOP was added to glibc in 2.26
2097// pub const PTRACE_EVENT_STOP: c_int = 128;
2098
2099pub const __WNOTHREAD: c_int = 0x20000000;
2100pub const __WALL: c_int = 0x40000000;
2101pub const __WCLONE: c_int = 0x80000000;
2102
2103pub const SPLICE_F_MOVE: c_uint = 0x01;
2104pub const SPLICE_F_NONBLOCK: c_uint = 0x02;
2105pub const SPLICE_F_MORE: c_uint = 0x04;
2106pub const SPLICE_F_GIFT: c_uint = 0x08;
2107
2108pub const RTLD_LOCAL: c_int = 0;
2109pub const RTLD_LAZY: c_int = 1;
2110
2111pub const POSIX_FADV_NORMAL: c_int = 0;
2112pub const POSIX_FADV_RANDOM: c_int = 1;
2113pub const POSIX_FADV_SEQUENTIAL: c_int = 2;
2114pub const POSIX_FADV_WILLNEED: c_int = 3;
2115
2116pub const AT_FDCWD: c_int = -100;
2117pub const AT_SYMLINK_NOFOLLOW: c_int = 0x100;
2118pub const AT_REMOVEDIR: c_int = 0x200;
2119pub const AT_EACCESS: c_int = 0x200;
2120pub const AT_SYMLINK_FOLLOW: c_int = 0x400;
2121pub const AT_NO_AUTOMOUNT: c_int = 0x800;
2122pub const AT_EMPTY_PATH: c_int = 0x1000;
2123
2124pub const LOG_CRON: c_int = 9 << 3;
2125pub const LOG_AUTHPRIV: c_int = 10 << 3;
2126pub const LOG_FTP: c_int = 11 << 3;
2127pub const LOG_PERROR: c_int = 0x20;
2128
2129pub const PIPE_BUF: usize = 4096;
2130
2131pub const SI_LOAD_SHIFT: c_uint = 16;
2132
2133pub const CLD_EXITED: c_int = 1;
2134pub const CLD_KILLED: c_int = 2;
2135pub const CLD_DUMPED: c_int = 3;
2136pub const CLD_TRAPPED: c_int = 4;
2137pub const CLD_STOPPED: c_int = 5;
2138pub const CLD_CONTINUED: c_int = 6;
2139
2140pub const SIGEV_SIGNAL: c_int = 0;
2141pub const SIGEV_NONE: c_int = 1;
2142pub const SIGEV_THREAD: c_int = 2;
2143
2144pub const P_ALL: idtype_t = 0;
2145pub const P_PID: idtype_t = 1;
2146pub const P_PGID: idtype_t = 2;
2147
2148pub const UTIME_OMIT: c_long = 1073741822;
2149pub const UTIME_NOW: c_long = 1073741823;
2150
2151pub const POLLIN: c_short = 0x1;
2152pub const POLLPRI: c_short = 0x2;
2153pub const POLLOUT: c_short = 0x4;
2154pub const POLLERR: c_short = 0x8;
2155pub const POLLHUP: c_short = 0x10;
2156pub const POLLNVAL: c_short = 0x20;
2157pub const POLLRDNORM: c_short = 0x040;
2158pub const POLLRDBAND: c_short = 0x080;
2159
2160pub const ABDAY_1: crate::nl_item = 0x20000;
2161pub const ABDAY_2: crate::nl_item = 0x20001;
2162pub const ABDAY_3: crate::nl_item = 0x20002;
2163pub const ABDAY_4: crate::nl_item = 0x20003;
2164pub const ABDAY_5: crate::nl_item = 0x20004;
2165pub const ABDAY_6: crate::nl_item = 0x20005;
2166pub const ABDAY_7: crate::nl_item = 0x20006;
2167
2168pub const DAY_1: crate::nl_item = 0x20007;
2169pub const DAY_2: crate::nl_item = 0x20008;
2170pub const DAY_3: crate::nl_item = 0x20009;
2171pub const DAY_4: crate::nl_item = 0x2000A;
2172pub const DAY_5: crate::nl_item = 0x2000B;
2173pub const DAY_6: crate::nl_item = 0x2000C;
2174pub const DAY_7: crate::nl_item = 0x2000D;
2175
2176pub const ABMON_1: crate::nl_item = 0x2000E;
2177pub const ABMON_2: crate::nl_item = 0x2000F;
2178pub const ABMON_3: crate::nl_item = 0x20010;
2179pub const ABMON_4: crate::nl_item = 0x20011;
2180pub const ABMON_5: crate::nl_item = 0x20012;
2181pub const ABMON_6: crate::nl_item = 0x20013;
2182pub const ABMON_7: crate::nl_item = 0x20014;
2183pub const ABMON_8: crate::nl_item = 0x20015;
2184pub const ABMON_9: crate::nl_item = 0x20016;
2185pub const ABMON_10: crate::nl_item = 0x20017;
2186pub const ABMON_11: crate::nl_item = 0x20018;
2187pub const ABMON_12: crate::nl_item = 0x20019;
2188
2189pub const MON_1: crate::nl_item = 0x2001A;
2190pub const MON_2: crate::nl_item = 0x2001B;
2191pub const MON_3: crate::nl_item = 0x2001C;
2192pub const MON_4: crate::nl_item = 0x2001D;
2193pub const MON_5: crate::nl_item = 0x2001E;
2194pub const MON_6: crate::nl_item = 0x2001F;
2195pub const MON_7: crate::nl_item = 0x20020;
2196pub const MON_8: crate::nl_item = 0x20021;
2197pub const MON_9: crate::nl_item = 0x20022;
2198pub const MON_10: crate::nl_item = 0x20023;
2199pub const MON_11: crate::nl_item = 0x20024;
2200pub const MON_12: crate::nl_item = 0x20025;
2201
2202pub const AM_STR: crate::nl_item = 0x20026;
2203pub const PM_STR: crate::nl_item = 0x20027;
2204
2205pub const D_T_FMT: crate::nl_item = 0x20028;
2206pub const D_FMT: crate::nl_item = 0x20029;
2207pub const T_FMT: crate::nl_item = 0x2002A;
2208pub const T_FMT_AMPM: crate::nl_item = 0x2002B;
2209
2210pub const ERA: crate::nl_item = 0x2002C;
2211pub const ERA_D_FMT: crate::nl_item = 0x2002E;
2212pub const ALT_DIGITS: crate::nl_item = 0x2002F;
2213pub const ERA_D_T_FMT: crate::nl_item = 0x20030;
2214pub const ERA_T_FMT: crate::nl_item = 0x20031;
2215
2216pub const CODESET: crate::nl_item = 14;
2217
2218pub const CRNCYSTR: crate::nl_item = 0x4000F;
2219
2220pub const RUSAGE_THREAD: c_int = 1;
2221pub const RUSAGE_CHILDREN: c_int = -1;
2222
2223pub const RADIXCHAR: crate::nl_item = 0x10000;
2224pub const THOUSEP: crate::nl_item = 0x10001;
2225
2226pub const YESEXPR: crate::nl_item = 0x50000;
2227pub const NOEXPR: crate::nl_item = 0x50001;
2228pub const YESSTR: crate::nl_item = 0x50002;
2229pub const NOSTR: crate::nl_item = 0x50003;
2230
2231pub const FILENAME_MAX: c_uint = 4096;
2232pub const L_tmpnam: c_uint = 20;
2233pub const _PC_LINK_MAX: c_int = 0;
2234pub const _PC_MAX_CANON: c_int = 1;
2235pub const _PC_MAX_INPUT: c_int = 2;
2236pub const _PC_NAME_MAX: c_int = 3;
2237pub const _PC_PATH_MAX: c_int = 4;
2238pub const _PC_PIPE_BUF: c_int = 5;
2239pub const _PC_CHOWN_RESTRICTED: c_int = 6;
2240pub const _PC_NO_TRUNC: c_int = 7;
2241pub const _PC_VDISABLE: c_int = 8;
2242pub const _PC_SYNC_IO: c_int = 9;
2243pub const _PC_ASYNC_IO: c_int = 10;
2244pub const _PC_PRIO_IO: c_int = 11;
2245pub const _PC_SOCK_MAXBUF: c_int = 12;
2246pub const _PC_FILESIZEBITS: c_int = 13;
2247pub const _PC_REC_INCR_XFER_SIZE: c_int = 14;
2248pub const _PC_REC_MAX_XFER_SIZE: c_int = 15;
2249pub const _PC_REC_MIN_XFER_SIZE: c_int = 16;
2250pub const _PC_REC_XFER_ALIGN: c_int = 17;
2251pub const _PC_ALLOC_SIZE_MIN: c_int = 18;
2252pub const _PC_SYMLINK_MAX: c_int = 19;
2253pub const _PC_2_SYMLINKS: c_int = 20;
2254
2255pub const _SC_ARG_MAX: c_int = 0;
2256pub const _SC_CHILD_MAX: c_int = 1;
2257pub const _SC_CLK_TCK: c_int = 2;
2258pub const _SC_NGROUPS_MAX: c_int = 3;
2259pub const _SC_OPEN_MAX: c_int = 4;
2260pub const _SC_STREAM_MAX: c_int = 5;
2261pub const _SC_TZNAME_MAX: c_int = 6;
2262pub const _SC_JOB_CONTROL: c_int = 7;
2263pub const _SC_SAVED_IDS: c_int = 8;
2264pub const _SC_REALTIME_SIGNALS: c_int = 9;
2265pub const _SC_PRIORITY_SCHEDULING: c_int = 10;
2266pub const _SC_TIMERS: c_int = 11;
2267pub const _SC_ASYNCHRONOUS_IO: c_int = 12;
2268pub const _SC_PRIORITIZED_IO: c_int = 13;
2269pub const _SC_SYNCHRONIZED_IO: c_int = 14;
2270pub const _SC_FSYNC: c_int = 15;
2271pub const _SC_MAPPED_FILES: c_int = 16;
2272pub const _SC_MEMLOCK: c_int = 17;
2273pub const _SC_MEMLOCK_RANGE: c_int = 18;
2274pub const _SC_MEMORY_PROTECTION: c_int = 19;
2275pub const _SC_MESSAGE_PASSING: c_int = 20;
2276pub const _SC_SEMAPHORES: c_int = 21;
2277pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 22;
2278pub const _SC_AIO_LISTIO_MAX: c_int = 23;
2279pub const _SC_AIO_MAX: c_int = 24;
2280pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 25;
2281pub const _SC_DELAYTIMER_MAX: c_int = 26;
2282pub const _SC_MQ_OPEN_MAX: c_int = 27;
2283pub const _SC_MQ_PRIO_MAX: c_int = 28;
2284pub const _SC_VERSION: c_int = 29;
2285pub const _SC_PAGESIZE: c_int = 30;
2286pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
2287pub const _SC_RTSIG_MAX: c_int = 31;
2288pub const _SC_SEM_NSEMS_MAX: c_int = 32;
2289pub const _SC_SEM_VALUE_MAX: c_int = 33;
2290pub const _SC_SIGQUEUE_MAX: c_int = 34;
2291pub const _SC_TIMER_MAX: c_int = 35;
2292pub const _SC_BC_BASE_MAX: c_int = 36;
2293pub const _SC_BC_DIM_MAX: c_int = 37;
2294pub const _SC_BC_SCALE_MAX: c_int = 38;
2295pub const _SC_BC_STRING_MAX: c_int = 39;
2296pub const _SC_COLL_WEIGHTS_MAX: c_int = 40;
2297pub const _SC_EXPR_NEST_MAX: c_int = 42;
2298pub const _SC_LINE_MAX: c_int = 43;
2299pub const _SC_RE_DUP_MAX: c_int = 44;
2300pub const _SC_2_VERSION: c_int = 46;
2301pub const _SC_2_C_BIND: c_int = 47;
2302pub const _SC_2_C_DEV: c_int = 48;
2303pub const _SC_2_FORT_DEV: c_int = 49;
2304pub const _SC_2_FORT_RUN: c_int = 50;
2305pub const _SC_2_SW_DEV: c_int = 51;
2306pub const _SC_2_LOCALEDEF: c_int = 52;
2307pub const _SC_UIO_MAXIOV: c_int = 60;
2308pub const _SC_IOV_MAX: c_int = 60;
2309pub const _SC_THREADS: c_int = 67;
2310pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 68;
2311pub const _SC_GETGR_R_SIZE_MAX: c_int = 69;
2312pub const _SC_GETPW_R_SIZE_MAX: c_int = 70;
2313pub const _SC_LOGIN_NAME_MAX: c_int = 71;
2314pub const _SC_TTY_NAME_MAX: c_int = 72;
2315pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 73;
2316pub const _SC_THREAD_KEYS_MAX: c_int = 74;
2317pub const _SC_THREAD_STACK_MIN: c_int = 75;
2318pub const _SC_THREAD_THREADS_MAX: c_int = 76;
2319pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77;
2320pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78;
2321pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 79;
2322pub const _SC_THREAD_PRIO_INHERIT: c_int = 80;
2323pub const _SC_THREAD_PRIO_PROTECT: c_int = 81;
2324pub const _SC_THREAD_PROCESS_SHARED: c_int = 82;
2325pub const _SC_NPROCESSORS_CONF: c_int = 83;
2326pub const _SC_NPROCESSORS_ONLN: c_int = 84;
2327pub const _SC_PHYS_PAGES: c_int = 85;
2328pub const _SC_AVPHYS_PAGES: c_int = 86;
2329pub const _SC_ATEXIT_MAX: c_int = 87;
2330pub const _SC_PASS_MAX: c_int = 88;
2331pub const _SC_XOPEN_VERSION: c_int = 89;
2332pub const _SC_XOPEN_XCU_VERSION: c_int = 90;
2333pub const _SC_XOPEN_UNIX: c_int = 91;
2334pub const _SC_XOPEN_CRYPT: c_int = 92;
2335pub const _SC_XOPEN_ENH_I18N: c_int = 93;
2336pub const _SC_XOPEN_SHM: c_int = 94;
2337pub const _SC_2_CHAR_TERM: c_int = 95;
2338pub const _SC_2_UPE: c_int = 97;
2339pub const _SC_XOPEN_XPG2: c_int = 98;
2340pub const _SC_XOPEN_XPG3: c_int = 99;
2341pub const _SC_XOPEN_XPG4: c_int = 100;
2342pub const _SC_NZERO: c_int = 109;
2343pub const _SC_XBS5_ILP32_OFF32: c_int = 125;
2344pub const _SC_XBS5_ILP32_OFFBIG: c_int = 126;
2345pub const _SC_XBS5_LP64_OFF64: c_int = 127;
2346pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 128;
2347pub const _SC_XOPEN_LEGACY: c_int = 129;
2348pub const _SC_XOPEN_REALTIME: c_int = 130;
2349pub const _SC_XOPEN_REALTIME_THREADS: c_int = 131;
2350pub const _SC_ADVISORY_INFO: c_int = 132;
2351pub const _SC_BARRIERS: c_int = 133;
2352pub const _SC_CLOCK_SELECTION: c_int = 137;
2353pub const _SC_CPUTIME: c_int = 138;
2354pub const _SC_THREAD_CPUTIME: c_int = 139;
2355pub const _SC_MONOTONIC_CLOCK: c_int = 149;
2356pub const _SC_READER_WRITER_LOCKS: c_int = 153;
2357pub const _SC_SPIN_LOCKS: c_int = 154;
2358pub const _SC_REGEXP: c_int = 155;
2359pub const _SC_SHELL: c_int = 157;
2360pub const _SC_SPAWN: c_int = 159;
2361pub const _SC_SPORADIC_SERVER: c_int = 160;
2362pub const _SC_THREAD_SPORADIC_SERVER: c_int = 161;
2363pub const _SC_TIMEOUTS: c_int = 164;
2364pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 165;
2365pub const _SC_2_PBS: c_int = 168;
2366pub const _SC_2_PBS_ACCOUNTING: c_int = 169;
2367pub const _SC_2_PBS_LOCATE: c_int = 170;
2368pub const _SC_2_PBS_MESSAGE: c_int = 171;
2369pub const _SC_2_PBS_TRACK: c_int = 172;
2370pub const _SC_SYMLOOP_MAX: c_int = 173;
2371pub const _SC_STREAMS: c_int = 174;
2372pub const _SC_2_PBS_CHECKPOINT: c_int = 175;
2373pub const _SC_V6_ILP32_OFF32: c_int = 176;
2374pub const _SC_V6_ILP32_OFFBIG: c_int = 177;
2375pub const _SC_V6_LP64_OFF64: c_int = 178;
2376pub const _SC_V6_LPBIG_OFFBIG: c_int = 179;
2377pub const _SC_HOST_NAME_MAX: c_int = 180;
2378pub const _SC_TRACE: c_int = 181;
2379pub const _SC_TRACE_EVENT_FILTER: c_int = 182;
2380pub const _SC_TRACE_INHERIT: c_int = 183;
2381pub const _SC_TRACE_LOG: c_int = 184;
2382pub const _SC_IPV6: c_int = 235;
2383pub const _SC_RAW_SOCKETS: c_int = 236;
2384pub const _SC_V7_ILP32_OFF32: c_int = 237;
2385pub const _SC_V7_ILP32_OFFBIG: c_int = 238;
2386pub const _SC_V7_LP64_OFF64: c_int = 239;
2387pub const _SC_V7_LPBIG_OFFBIG: c_int = 240;
2388pub const _SC_SS_REPL_MAX: c_int = 241;
2389pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 242;
2390pub const _SC_TRACE_NAME_MAX: c_int = 243;
2391pub const _SC_TRACE_SYS_MAX: c_int = 244;
2392pub const _SC_TRACE_USER_EVENT_MAX: c_int = 245;
2393pub const _SC_XOPEN_STREAMS: c_int = 246;
2394pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 247;
2395pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 248;
2396
2397pub const RLIM_SAVED_MAX: crate::rlim_t = RLIM_INFINITY;
2398pub const RLIM_SAVED_CUR: crate::rlim_t = RLIM_INFINITY;
2399
2400pub const GLOB_ERR: c_int = 1 << 0;
2401pub const GLOB_MARK: c_int = 1 << 1;
2402pub const GLOB_NOSORT: c_int = 1 << 2;
2403pub const GLOB_DOOFFS: c_int = 1 << 3;
2404pub const GLOB_NOCHECK: c_int = 1 << 4;
2405pub const GLOB_APPEND: c_int = 1 << 5;
2406pub const GLOB_NOESCAPE: c_int = 1 << 6;
2407
2408pub const GLOB_NOSPACE: c_int = 1;
2409pub const GLOB_ABORTED: c_int = 2;
2410pub const GLOB_NOMATCH: c_int = 3;
2411
2412pub const POSIX_MADV_NORMAL: c_int = 0;
2413pub const POSIX_MADV_RANDOM: c_int = 1;
2414pub const POSIX_MADV_SEQUENTIAL: c_int = 2;
2415pub const POSIX_MADV_WILLNEED: c_int = 3;
2416
2417pub const S_IEXEC: mode_t = 0o0100;
2418pub const S_IWRITE: mode_t = 0o0200;
2419pub const S_IREAD: mode_t = 0o0400;
2420
2421pub const F_LOCK: c_int = 1;
2422pub const F_TEST: c_int = 3;
2423pub const F_TLOCK: c_int = 2;
2424pub const F_ULOCK: c_int = 0;
2425
2426pub const IFF_LOWER_UP: c_int = 0x10000;
2427pub const IFF_DORMANT: c_int = 0x20000;
2428pub const IFF_ECHO: c_int = 0x40000;
2429
2430pub const ST_RDONLY: c_ulong = 1;
2431pub const ST_NOSUID: c_ulong = 2;
2432pub const ST_NODEV: c_ulong = 4;
2433pub const ST_NOEXEC: c_ulong = 8;
2434pub const ST_SYNCHRONOUS: c_ulong = 16;
2435pub const ST_MANDLOCK: c_ulong = 64;
2436pub const ST_WRITE: c_ulong = 128;
2437pub const ST_APPEND: c_ulong = 256;
2438pub const ST_IMMUTABLE: c_ulong = 512;
2439pub const ST_NOATIME: c_ulong = 1024;
2440pub const ST_NODIRATIME: c_ulong = 2048;
2441
2442pub const RTLD_NEXT: *mut c_void = -1i64 as *mut c_void;
2443pub const RTLD_DEFAULT: *mut c_void = 0i64 as *mut c_void;
2444pub const RTLD_NODELETE: c_int = 0x1000;
2445pub const RTLD_NOW: c_int = 0x2;
2446
2447pub const TCP_MD5SIG: c_int = 14;
2448
2449pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2450    size: [0; __SIZEOF_PTHREAD_MUTEX_T],
2451};
2452pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2453    size: [0; __SIZEOF_PTHREAD_COND_T],
2454};
2455pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2456    size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
2457};
2458pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
2459pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1;
2460pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2;
2461pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
2462pub const PTHREAD_PROCESS_PRIVATE: c_int = 0;
2463pub const PTHREAD_PROCESS_SHARED: c_int = 1;
2464pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
2465
2466pub const RENAME_NOREPLACE: c_int = 1;
2467pub const RENAME_EXCHANGE: c_int = 2;
2468pub const RENAME_WHITEOUT: c_int = 4;
2469
2470pub const SCHED_OTHER: c_int = 0;
2471pub const SCHED_FIFO: c_int = 1;
2472pub const SCHED_RR: c_int = 2;
2473pub const SCHED_BATCH: c_int = 3;
2474pub const SCHED_IDLE: c_int = 5;
2475
2476// netinet/in.h
2477// NOTE: These are in addition to the constants defined in src/unix/mod.rs
2478
2479// IPPROTO_IP defined in src/unix/mod.rs
2480/// Hop-by-hop option header
2481pub const IPPROTO_HOPOPTS: c_int = 0;
2482// IPPROTO_ICMP defined in src/unix/mod.rs
2483/// group mgmt protocol
2484pub const IPPROTO_IGMP: c_int = 2;
2485/// for compatibility
2486pub const IPPROTO_IPIP: c_int = 4;
2487// IPPROTO_TCP defined in src/unix/mod.rs
2488/// exterior gateway protocol
2489pub const IPPROTO_EGP: c_int = 8;
2490/// pup
2491pub const IPPROTO_PUP: c_int = 12;
2492// IPPROTO_UDP defined in src/unix/mod.rs
2493/// xns idp
2494pub const IPPROTO_IDP: c_int = 22;
2495/// tp-4 w/ class negotiation
2496pub const IPPROTO_TP: c_int = 29;
2497/// DCCP
2498pub const IPPROTO_DCCP: c_int = 33;
2499// IPPROTO_IPV6 defined in src/unix/mod.rs
2500/// IP6 routing header
2501pub const IPPROTO_ROUTING: c_int = 43;
2502/// IP6 fragmentation header
2503pub const IPPROTO_FRAGMENT: c_int = 44;
2504/// resource reservation
2505pub const IPPROTO_RSVP: c_int = 46;
2506/// General Routing Encap.
2507pub const IPPROTO_GRE: c_int = 47;
2508/// IP6 Encap Sec. Payload
2509pub const IPPROTO_ESP: c_int = 50;
2510/// IP6 Auth Header
2511pub const IPPROTO_AH: c_int = 51;
2512// IPPROTO_ICMPV6 defined in src/unix/mod.rs
2513/// IP6 no next header
2514pub const IPPROTO_NONE: c_int = 59;
2515/// IP6 destination option
2516pub const IPPROTO_DSTOPTS: c_int = 60;
2517pub const IPPROTO_MTP: c_int = 92;
2518pub const IPPROTO_BEETPH: c_int = 94;
2519/// encapsulation header
2520pub const IPPROTO_ENCAP: c_int = 98;
2521/// Protocol indep. multicast
2522pub const IPPROTO_PIM: c_int = 103;
2523/// IP Payload Comp. Protocol
2524pub const IPPROTO_COMP: c_int = 108;
2525/// SCTP
2526pub const IPPROTO_SCTP: c_int = 132;
2527pub const IPPROTO_MH: c_int = 135;
2528pub const IPPROTO_UDPLITE: c_int = 136;
2529pub const IPPROTO_MPLS: c_int = 137;
2530/// raw IP packet
2531pub const IPPROTO_RAW: c_int = 255;
2532pub const IPPROTO_MAX: c_int = 256;
2533
2534pub const AF_IB: c_int = 27;
2535pub const AF_MPLS: c_int = 28;
2536pub const AF_NFC: c_int = 39;
2537pub const AF_VSOCK: c_int = 40;
2538pub const PF_IB: c_int = AF_IB;
2539pub const PF_MPLS: c_int = AF_MPLS;
2540pub const PF_NFC: c_int = AF_NFC;
2541pub const PF_VSOCK: c_int = AF_VSOCK;
2542
2543// System V IPC
2544pub const IPC_PRIVATE: crate::key_t = 0;
2545
2546pub const IPC_CREAT: c_int = 0o1000;
2547pub const IPC_EXCL: c_int = 0o2000;
2548pub const IPC_NOWAIT: c_int = 0o4000;
2549
2550pub const IPC_RMID: c_int = 0;
2551pub const IPC_SET: c_int = 1;
2552pub const IPC_STAT: c_int = 2;
2553pub const IPC_INFO: c_int = 3;
2554pub const MSG_STAT: c_int = 11;
2555pub const MSG_INFO: c_int = 12;
2556
2557pub const MSG_NOERROR: c_int = 0o10000;
2558pub const MSG_EXCEPT: c_int = 0o20000;
2559pub const MSG_COPY: c_int = 0o40000;
2560
2561pub const SHM_R: c_int = 0o400;
2562pub const SHM_W: c_int = 0o200;
2563
2564pub const SHM_RDONLY: c_int = 0o10000;
2565pub const SHM_RND: c_int = 0o20000;
2566pub const SHM_REMAP: c_int = 0o40000;
2567pub const SHM_EXEC: c_int = 0o100000;
2568
2569pub const SHM_LOCK: c_int = 11;
2570pub const SHM_UNLOCK: c_int = 12;
2571
2572pub const SHM_HUGETLB: c_int = 0o4000;
2573pub const SHM_NORESERVE: c_int = 0o10000;
2574
2575pub const EPOLLRDHUP: c_int = 0x2000;
2576pub const EPOLLEXCLUSIVE: c_int = 0x10000000;
2577pub const EPOLLONESHOT: c_int = 0x40000000;
2578
2579pub const QFMT_VFS_OLD: c_int = 1;
2580pub const QFMT_VFS_V0: c_int = 2;
2581pub const QFMT_VFS_V1: c_int = 4;
2582
2583pub const EFD_SEMAPHORE: c_int = 0x1;
2584
2585pub const LOG_NFACILITIES: c_int = 24;
2586
2587pub const SEM_FAILED: *mut crate::sem_t = 0 as *mut sem_t;
2588
2589pub const RB_AUTOBOOT: c_int = 0x01234567u32 as i32;
2590pub const RB_HALT_SYSTEM: c_int = 0xcdef0123u32 as i32;
2591pub const RB_ENABLE_CAD: c_int = 0x89abcdefu32 as i32;
2592pub const RB_DISABLE_CAD: c_int = 0x00000000u32 as i32;
2593pub const RB_POWER_OFF: c_int = 0x4321fedcu32 as i32;
2594pub const RB_SW_SUSPEND: c_int = 0xd000fce2u32 as i32;
2595pub const RB_KEXEC: c_int = 0x45584543u32 as i32;
2596
2597pub const AI_PASSIVE: c_int = 0x0001;
2598pub const AI_CANONNAME: c_int = 0x0002;
2599pub const AI_NUMERICHOST: c_int = 0x0004;
2600pub const AI_V4MAPPED: c_int = 0x0008;
2601pub const AI_ALL: c_int = 0x0010;
2602pub const AI_ADDRCONFIG: c_int = 0x0020;
2603
2604pub const AI_NUMERICSERV: c_int = 0x0400;
2605
2606pub const EAI_BADFLAGS: c_int = -1;
2607pub const EAI_NONAME: c_int = -2;
2608pub const EAI_AGAIN: c_int = -3;
2609pub const EAI_FAIL: c_int = -4;
2610pub const EAI_FAMILY: c_int = -6;
2611pub const EAI_SOCKTYPE: c_int = -7;
2612pub const EAI_SERVICE: c_int = -8;
2613pub const EAI_MEMORY: c_int = -10;
2614pub const EAI_OVERFLOW: c_int = -12;
2615
2616pub const NI_NUMERICHOST: c_int = 1;
2617pub const NI_NUMERICSERV: c_int = 2;
2618pub const NI_NOFQDN: c_int = 4;
2619pub const NI_NAMEREQD: c_int = 8;
2620pub const NI_DGRAM: c_int = 16;
2621
2622pub const SYNC_FILE_RANGE_WAIT_BEFORE: c_uint = 1;
2623pub const SYNC_FILE_RANGE_WRITE: c_uint = 2;
2624pub const SYNC_FILE_RANGE_WAIT_AFTER: c_uint = 4;
2625
2626pub const EAI_SYSTEM: c_int = -11;
2627
2628pub const AIO_CANCELED: c_int = 0;
2629pub const AIO_NOTCANCELED: c_int = 1;
2630pub const AIO_ALLDONE: c_int = 2;
2631pub const LIO_READ: c_int = 0;
2632pub const LIO_WRITE: c_int = 1;
2633pub const LIO_NOP: c_int = 2;
2634pub const LIO_WAIT: c_int = 0;
2635pub const LIO_NOWAIT: c_int = 1;
2636
2637pub const MREMAP_MAYMOVE: c_int = 1;
2638pub const MREMAP_FIXED: c_int = 2;
2639
2640pub const PR_SET_PDEATHSIG: c_int = 1;
2641pub const PR_GET_PDEATHSIG: c_int = 2;
2642
2643pub const PR_GET_DUMPABLE: c_int = 3;
2644pub const PR_SET_DUMPABLE: c_int = 4;
2645
2646pub const PR_GET_UNALIGN: c_int = 5;
2647pub const PR_SET_UNALIGN: c_int = 6;
2648pub const PR_UNALIGN_NOPRINT: c_int = 1;
2649pub const PR_UNALIGN_SIGBUS: c_int = 2;
2650
2651pub const PR_GET_KEEPCAPS: c_int = 7;
2652pub const PR_SET_KEEPCAPS: c_int = 8;
2653
2654pub const PR_GET_FPEMU: c_int = 9;
2655pub const PR_SET_FPEMU: c_int = 10;
2656pub const PR_FPEMU_NOPRINT: c_int = 1;
2657pub const PR_FPEMU_SIGFPE: c_int = 2;
2658
2659pub const PR_GET_FPEXC: c_int = 11;
2660pub const PR_SET_FPEXC: c_int = 12;
2661pub const PR_FP_EXC_SW_ENABLE: c_int = 0x80;
2662pub const PR_FP_EXC_DIV: c_int = 0x010000;
2663pub const PR_FP_EXC_OVF: c_int = 0x020000;
2664pub const PR_FP_EXC_UND: c_int = 0x040000;
2665pub const PR_FP_EXC_RES: c_int = 0x080000;
2666pub const PR_FP_EXC_INV: c_int = 0x100000;
2667pub const PR_FP_EXC_DISABLED: c_int = 0;
2668pub const PR_FP_EXC_NONRECOV: c_int = 1;
2669pub const PR_FP_EXC_ASYNC: c_int = 2;
2670pub const PR_FP_EXC_PRECISE: c_int = 3;
2671
2672pub const PR_GET_TIMING: c_int = 13;
2673pub const PR_SET_TIMING: c_int = 14;
2674pub const PR_TIMING_STATISTICAL: c_int = 0;
2675pub const PR_TIMING_TIMESTAMP: c_int = 1;
2676
2677pub const PR_SET_NAME: c_int = 15;
2678pub const PR_GET_NAME: c_int = 16;
2679
2680pub const PR_GET_ENDIAN: c_int = 19;
2681pub const PR_SET_ENDIAN: c_int = 20;
2682pub const PR_ENDIAN_BIG: c_int = 0;
2683pub const PR_ENDIAN_LITTLE: c_int = 1;
2684pub const PR_ENDIAN_PPC_LITTLE: c_int = 2;
2685
2686pub const PR_GET_SECCOMP: c_int = 21;
2687pub const PR_SET_SECCOMP: c_int = 22;
2688
2689pub const PR_CAPBSET_READ: c_int = 23;
2690pub const PR_CAPBSET_DROP: c_int = 24;
2691
2692pub const PR_GET_TSC: c_int = 25;
2693pub const PR_SET_TSC: c_int = 26;
2694pub const PR_TSC_ENABLE: c_int = 1;
2695pub const PR_TSC_SIGSEGV: c_int = 2;
2696
2697pub const PR_GET_SECUREBITS: c_int = 27;
2698pub const PR_SET_SECUREBITS: c_int = 28;
2699
2700pub const PR_SET_TIMERSLACK: c_int = 29;
2701pub const PR_GET_TIMERSLACK: c_int = 30;
2702
2703pub const PR_TASK_PERF_EVENTS_DISABLE: c_int = 31;
2704pub const PR_TASK_PERF_EVENTS_ENABLE: c_int = 32;
2705
2706pub const PR_MCE_KILL: c_int = 33;
2707pub const PR_MCE_KILL_CLEAR: c_int = 0;
2708pub const PR_MCE_KILL_SET: c_int = 1;
2709
2710pub const PR_MCE_KILL_LATE: c_int = 0;
2711pub const PR_MCE_KILL_EARLY: c_int = 1;
2712pub const PR_MCE_KILL_DEFAULT: c_int = 2;
2713
2714pub const PR_MCE_KILL_GET: c_int = 34;
2715
2716pub const PR_SET_MM: c_int = 35;
2717pub const PR_SET_MM_START_CODE: c_int = 1;
2718pub const PR_SET_MM_END_CODE: c_int = 2;
2719pub const PR_SET_MM_START_DATA: c_int = 3;
2720pub const PR_SET_MM_END_DATA: c_int = 4;
2721pub const PR_SET_MM_START_STACK: c_int = 5;
2722pub const PR_SET_MM_START_BRK: c_int = 6;
2723pub const PR_SET_MM_BRK: c_int = 7;
2724pub const PR_SET_MM_ARG_START: c_int = 8;
2725pub const PR_SET_MM_ARG_END: c_int = 9;
2726pub const PR_SET_MM_ENV_START: c_int = 10;
2727pub const PR_SET_MM_ENV_END: c_int = 11;
2728pub const PR_SET_MM_AUXV: c_int = 12;
2729pub const PR_SET_MM_EXE_FILE: c_int = 13;
2730pub const PR_SET_MM_MAP: c_int = 14;
2731pub const PR_SET_MM_MAP_SIZE: c_int = 15;
2732
2733pub const PR_SET_PTRACER: c_int = 0x59616d61;
2734pub const PR_SET_PTRACER_ANY: c_ulong = 0xffffffffffffffff;
2735
2736pub const PR_SET_CHILD_SUBREAPER: c_int = 36;
2737pub const PR_GET_CHILD_SUBREAPER: c_int = 37;
2738
2739pub const PR_SET_NO_NEW_PRIVS: c_int = 38;
2740pub const PR_GET_NO_NEW_PRIVS: c_int = 39;
2741
2742pub const PR_GET_TID_ADDRESS: c_int = 40;
2743
2744pub const PR_SET_THP_DISABLE: c_int = 41;
2745pub const PR_GET_THP_DISABLE: c_int = 42;
2746
2747pub const PR_MPX_ENABLE_MANAGEMENT: c_int = 43;
2748pub const PR_MPX_DISABLE_MANAGEMENT: c_int = 44;
2749
2750pub const PR_SET_FP_MODE: c_int = 45;
2751pub const PR_GET_FP_MODE: c_int = 46;
2752pub const PR_FP_MODE_FR: c_int = 1 << 0;
2753pub const PR_FP_MODE_FRE: c_int = 1 << 1;
2754
2755pub const PR_CAP_AMBIENT: c_int = 47;
2756pub const PR_CAP_AMBIENT_IS_SET: c_int = 1;
2757pub const PR_CAP_AMBIENT_RAISE: c_int = 2;
2758pub const PR_CAP_AMBIENT_LOWER: c_int = 3;
2759pub const PR_CAP_AMBIENT_CLEAR_ALL: c_int = 4;
2760
2761pub const ITIMER_REAL: c_int = 0;
2762pub const ITIMER_VIRTUAL: c_int = 1;
2763pub const ITIMER_PROF: c_int = 2;
2764
2765pub const TFD_CLOEXEC: c_int = O_CLOEXEC;
2766pub const TFD_NONBLOCK: c_int = O_NONBLOCK;
2767pub const TFD_TIMER_ABSTIME: c_int = 1;
2768
2769pub const XATTR_CREATE: c_int = 0x1;
2770pub const XATTR_REPLACE: c_int = 0x2;
2771
2772pub const _POSIX_VDISABLE: crate::cc_t = 0;
2773
2774pub const FALLOC_FL_KEEP_SIZE: c_int = 0x01;
2775pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x02;
2776pub const FALLOC_FL_COLLAPSE_RANGE: c_int = 0x08;
2777pub const FALLOC_FL_ZERO_RANGE: c_int = 0x10;
2778pub const FALLOC_FL_INSERT_RANGE: c_int = 0x20;
2779pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x40;
2780
2781// On Linux, libc doesn't define this constant, libattr does instead.
2782// We still define it for Linux as it's defined by libc on other platforms,
2783// and it's mentioned in the man pages for getxattr and setxattr.
2784pub const ENOATTR: c_int = crate::ENODATA;
2785
2786pub const SO_ORIGINAL_DST: c_int = 80;
2787pub const IUTF8: crate::tcflag_t = 0x00004000;
2788pub const CMSPAR: crate::tcflag_t = 0o10000000000;
2789
2790pub const MFD_CLOEXEC: c_uint = 0x0001;
2791pub const MFD_ALLOW_SEALING: c_uint = 0x0002;
2792
2793// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
2794// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
2795// so we can use that type here to avoid having to cast.
2796pub const PT_NULL: u32 = 0;
2797pub const PT_LOAD: u32 = 1;
2798pub const PT_DYNAMIC: u32 = 2;
2799pub const PT_INTERP: u32 = 3;
2800pub const PT_NOTE: u32 = 4;
2801pub const PT_SHLIB: u32 = 5;
2802pub const PT_PHDR: u32 = 6;
2803pub const PT_TLS: u32 = 7;
2804pub const PT_NUM: u32 = 8;
2805pub const PT_LOOS: u32 = 0x60000000;
2806pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
2807pub const PT_GNU_STACK: u32 = 0x6474e551;
2808pub const PT_GNU_RELRO: u32 = 0x6474e552;
2809
2810// Ethernet protocol IDs.
2811pub const ETH_P_LOOP: c_int = 0x0060;
2812pub const ETH_P_PUP: c_int = 0x0200;
2813pub const ETH_P_PUPAT: c_int = 0x0201;
2814pub const ETH_P_IP: c_int = 0x0800;
2815pub const ETH_P_X25: c_int = 0x0805;
2816pub const ETH_P_ARP: c_int = 0x0806;
2817pub const ETH_P_BPQ: c_int = 0x08FF;
2818pub const ETH_P_IEEEPUP: c_int = 0x0a00;
2819pub const ETH_P_IEEEPUPAT: c_int = 0x0a01;
2820pub const ETH_P_BATMAN: c_int = 0x4305;
2821pub const ETH_P_DEC: c_int = 0x6000;
2822pub const ETH_P_DNA_DL: c_int = 0x6001;
2823pub const ETH_P_DNA_RC: c_int = 0x6002;
2824pub const ETH_P_DNA_RT: c_int = 0x6003;
2825pub const ETH_P_LAT: c_int = 0x6004;
2826pub const ETH_P_DIAG: c_int = 0x6005;
2827pub const ETH_P_CUST: c_int = 0x6006;
2828pub const ETH_P_SCA: c_int = 0x6007;
2829pub const ETH_P_TEB: c_int = 0x6558;
2830pub const ETH_P_RARP: c_int = 0x8035;
2831pub const ETH_P_ATALK: c_int = 0x809B;
2832pub const ETH_P_AARP: c_int = 0x80F3;
2833pub const ETH_P_8021Q: c_int = 0x8100;
2834pub const ETH_P_IPX: c_int = 0x8137;
2835pub const ETH_P_IPV6: c_int = 0x86DD;
2836pub const ETH_P_PAUSE: c_int = 0x8808;
2837pub const ETH_P_SLOW: c_int = 0x8809;
2838pub const ETH_P_WCCP: c_int = 0x883E;
2839pub const ETH_P_MPLS_UC: c_int = 0x8847;
2840pub const ETH_P_MPLS_MC: c_int = 0x8848;
2841pub const ETH_P_ATMMPOA: c_int = 0x884c;
2842pub const ETH_P_PPP_DISC: c_int = 0x8863;
2843pub const ETH_P_PPP_SES: c_int = 0x8864;
2844pub const ETH_P_LINK_CTL: c_int = 0x886c;
2845pub const ETH_P_ATMFATE: c_int = 0x8884;
2846pub const ETH_P_PAE: c_int = 0x888E;
2847pub const ETH_P_AOE: c_int = 0x88A2;
2848pub const ETH_P_8021AD: c_int = 0x88A8;
2849pub const ETH_P_802_EX1: c_int = 0x88B5;
2850pub const ETH_P_TIPC: c_int = 0x88CA;
2851pub const ETH_P_8021AH: c_int = 0x88E7;
2852pub const ETH_P_MVRP: c_int = 0x88F5;
2853pub const ETH_P_1588: c_int = 0x88F7;
2854pub const ETH_P_PRP: c_int = 0x88FB;
2855pub const ETH_P_FCOE: c_int = 0x8906;
2856pub const ETH_P_TDLS: c_int = 0x890D;
2857pub const ETH_P_FIP: c_int = 0x8914;
2858pub const ETH_P_80221: c_int = 0x8917;
2859pub const ETH_P_LOOPBACK: c_int = 0x9000;
2860pub const ETH_P_QINQ1: c_int = 0x9100;
2861pub const ETH_P_QINQ2: c_int = 0x9200;
2862pub const ETH_P_QINQ3: c_int = 0x9300;
2863pub const ETH_P_EDSA: c_int = 0xDADA;
2864pub const ETH_P_AF_IUCV: c_int = 0xFBFB;
2865
2866pub const ETH_P_802_3_MIN: c_int = 0x0600;
2867
2868pub const ETH_P_802_3: c_int = 0x0001;
2869pub const ETH_P_AX25: c_int = 0x0002;
2870pub const ETH_P_ALL: c_int = 0x0003;
2871pub const ETH_P_802_2: c_int = 0x0004;
2872pub const ETH_P_SNAP: c_int = 0x0005;
2873pub const ETH_P_DDCMP: c_int = 0x0006;
2874pub const ETH_P_WAN_PPP: c_int = 0x0007;
2875pub const ETH_P_PPP_MP: c_int = 0x0008;
2876pub const ETH_P_LOCALTALK: c_int = 0x0009;
2877pub const ETH_P_CAN: c_int = 0x000C;
2878pub const ETH_P_CANFD: c_int = 0x000D;
2879pub const ETH_P_PPPTALK: c_int = 0x0010;
2880pub const ETH_P_TR_802_2: c_int = 0x0011;
2881pub const ETH_P_MOBITEX: c_int = 0x0015;
2882pub const ETH_P_CONTROL: c_int = 0x0016;
2883pub const ETH_P_IRDA: c_int = 0x0017;
2884pub const ETH_P_ECONET: c_int = 0x0018;
2885pub const ETH_P_HDLC: c_int = 0x0019;
2886pub const ETH_P_ARCNET: c_int = 0x001A;
2887pub const ETH_P_DSA: c_int = 0x001B;
2888pub const ETH_P_TRAILER: c_int = 0x001C;
2889pub const ETH_P_PHONET: c_int = 0x00F5;
2890pub const ETH_P_IEEE802154: c_int = 0x00F6;
2891pub const ETH_P_CAIF: c_int = 0x00F7;
2892
2893pub const SFD_CLOEXEC: c_int = 0x080000;
2894
2895pub const NCCS: usize = 32;
2896
2897pub const O_TRUNC: c_int = 0x00040000;
2898pub const O_NOATIME: c_int = 0x00002000;
2899pub const O_CLOEXEC: c_int = 0x00000100;
2900pub const O_TMPFILE: c_int = 0x00004000;
2901
2902pub const EBFONT: c_int = 59;
2903pub const ENOSTR: c_int = 60;
2904pub const ENODATA: c_int = 61;
2905pub const ETIME: c_int = 62;
2906pub const ENOSR: c_int = 63;
2907pub const ENONET: c_int = 64;
2908pub const ENOPKG: c_int = 65;
2909pub const EREMOTE: c_int = 66;
2910pub const ENOLINK: c_int = 67;
2911pub const EADV: c_int = 68;
2912pub const ESRMNT: c_int = 69;
2913pub const ECOMM: c_int = 70;
2914pub const EPROTO: c_int = 71;
2915pub const EDOTDOT: c_int = 73;
2916
2917pub const SA_NODEFER: c_int = 0x40000000;
2918pub const SA_RESETHAND: c_int = 0x80000000;
2919pub const SA_RESTART: c_int = 0x10000000;
2920pub const SA_NOCLDSTOP: c_int = 0x00000001;
2921
2922pub const EPOLL_CLOEXEC: c_int = 0x80000;
2923
2924pub const EFD_CLOEXEC: c_int = 0x80000;
2925
2926pub const BUFSIZ: c_uint = 1024;
2927pub const TMP_MAX: c_uint = 10000;
2928pub const FOPEN_MAX: c_uint = 1000;
2929pub const O_PATH: c_int = 0x00400000;
2930pub const O_EXEC: c_int = O_PATH;
2931pub const O_SEARCH: c_int = O_PATH;
2932pub const O_ACCMODE: c_int = 03 | O_SEARCH;
2933pub const O_NDELAY: c_int = O_NONBLOCK;
2934pub const NI_MAXHOST: crate::socklen_t = 255;
2935pub const PTHREAD_STACK_MIN: size_t = 2048;
2936pub const POSIX_FADV_DONTNEED: c_int = 4;
2937pub const POSIX_FADV_NOREUSE: c_int = 5;
2938
2939pub const POSIX_MADV_DONTNEED: c_int = 4;
2940
2941pub const RLIM_INFINITY: crate::rlim_t = !0;
2942pub const RLIMIT_RTTIME: c_int = 15;
2943#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
2944pub const RLIMIT_NLIMITS: c_int = 16;
2945#[allow(deprecated)]
2946#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
2947pub const RLIM_NLIMITS: c_int = RLIMIT_NLIMITS;
2948
2949pub const MAP_ANONYMOUS: c_int = MAP_ANON;
2950
2951pub const SOCK_DCCP: c_int = 6;
2952pub const SOCK_PACKET: c_int = 10;
2953
2954pub const TCP_COOKIE_TRANSACTIONS: c_int = 15;
2955pub const TCP_THIN_LINEAR_TIMEOUTS: c_int = 16;
2956pub const TCP_THIN_DUPACK: c_int = 17;
2957pub const TCP_USER_TIMEOUT: c_int = 18;
2958pub const TCP_REPAIR: c_int = 19;
2959pub const TCP_REPAIR_QUEUE: c_int = 20;
2960pub const TCP_QUEUE_SEQ: c_int = 21;
2961pub const TCP_REPAIR_OPTIONS: c_int = 22;
2962pub const TCP_FASTOPEN: c_int = 23;
2963pub const TCP_TIMESTAMP: c_int = 24;
2964
2965pub const SIGUNUSED: c_int = crate::SIGSYS;
2966
2967pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
2968pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
2969pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
2970
2971pub const CPU_SETSIZE: c_int = 128;
2972
2973pub const PTRACE_TRACEME: c_int = 0;
2974pub const PTRACE_PEEKTEXT: c_int = 1;
2975pub const PTRACE_PEEKDATA: c_int = 2;
2976pub const PTRACE_PEEKUSER: c_int = 3;
2977pub const PTRACE_POKETEXT: c_int = 4;
2978pub const PTRACE_POKEDATA: c_int = 5;
2979pub const PTRACE_POKEUSER: c_int = 6;
2980pub const PTRACE_CONT: c_int = 7;
2981pub const PTRACE_KILL: c_int = 8;
2982pub const PTRACE_SINGLESTEP: c_int = 9;
2983pub const PTRACE_GETREGS: c_int = 12;
2984pub const PTRACE_SETREGS: c_int = 13;
2985pub const PTRACE_GETFPREGS: c_int = 14;
2986pub const PTRACE_SETFPREGS: c_int = 15;
2987pub const PTRACE_ATTACH: c_int = 16;
2988pub const PTRACE_DETACH: c_int = 17;
2989pub const PTRACE_GETFPXREGS: c_int = 18;
2990pub const PTRACE_SETFPXREGS: c_int = 19;
2991pub const PTRACE_SYSCALL: c_int = 24;
2992pub const PTRACE_SETOPTIONS: c_int = 0x4200;
2993pub const PTRACE_GETEVENTMSG: c_int = 0x4201;
2994pub const PTRACE_GETSIGINFO: c_int = 0x4202;
2995pub const PTRACE_SETSIGINFO: c_int = 0x4203;
2996pub const PTRACE_GETREGSET: c_int = 0x4204;
2997pub const PTRACE_SETREGSET: c_int = 0x4205;
2998pub const PTRACE_SEIZE: c_int = 0x4206;
2999pub const PTRACE_INTERRUPT: c_int = 0x4207;
3000pub const PTRACE_LISTEN: c_int = 0x4208;
3001pub const PTRACE_PEEKSIGINFO: c_int = 0x4209;
3002
3003pub const EPOLLWAKEUP: c_int = 0x20000000;
3004
3005pub const EFD_NONBLOCK: c_int = crate::O_NONBLOCK;
3006
3007pub const SFD_NONBLOCK: c_int = crate::O_NONBLOCK;
3008
3009pub const TCSANOW: c_int = 0;
3010pub const TCSADRAIN: c_int = 1;
3011pub const TCSAFLUSH: c_int = 2;
3012
3013pub const TIOCINQ: c_int = crate::FIONREAD;
3014
3015pub const RTLD_GLOBAL: c_int = 0x100;
3016pub const RTLD_NOLOAD: c_int = 0x4;
3017
3018pub const MCL_CURRENT: c_int = 0x0001;
3019pub const MCL_FUTURE: c_int = 0x0002;
3020
3021pub const CBAUD: crate::tcflag_t = 0o0010017;
3022pub const TAB1: c_int = 0x00000800;
3023pub const TAB2: c_int = 0x00001000;
3024pub const TAB3: c_int = 0x00001800;
3025pub const CR1: c_int = 0x00000200;
3026pub const CR2: c_int = 0x00000400;
3027pub const CR3: c_int = 0x00000600;
3028pub const FF1: c_int = 0x00008000;
3029pub const BS1: c_int = 0x00002000;
3030pub const VT1: c_int = 0x00004000;
3031pub const VWERASE: usize = 14;
3032pub const VREPRINT: usize = 12;
3033pub const VSUSP: usize = 10;
3034pub const VSTART: usize = 8;
3035pub const VSTOP: usize = 9;
3036pub const VDISCARD: usize = 13;
3037pub const VTIME: usize = 5;
3038pub const IXON: crate::tcflag_t = 0x00000400;
3039pub const IXOFF: crate::tcflag_t = 0x00001000;
3040pub const ONLCR: crate::tcflag_t = 0x4;
3041pub const CSIZE: crate::tcflag_t = 0x00000030;
3042pub const CS6: crate::tcflag_t = 0x00000010;
3043pub const CS7: crate::tcflag_t = 0x00000020;
3044pub const CS8: crate::tcflag_t = 0x00000030;
3045pub const CSTOPB: crate::tcflag_t = 0x00000040;
3046pub const CREAD: crate::tcflag_t = 0x00000080;
3047pub const PARENB: crate::tcflag_t = 0x00000100;
3048pub const PARODD: crate::tcflag_t = 0x00000200;
3049pub const HUPCL: crate::tcflag_t = 0x00000400;
3050pub const CLOCAL: crate::tcflag_t = 0x00000800;
3051pub const ECHOKE: crate::tcflag_t = 0x00000800;
3052pub const ECHOE: crate::tcflag_t = 0x00000010;
3053pub const ECHOK: crate::tcflag_t = 0x00000020;
3054pub const ECHONL: crate::tcflag_t = 0x00000040;
3055pub const ECHOPRT: crate::tcflag_t = 0x00000400;
3056pub const ECHOCTL: crate::tcflag_t = 0x00000200;
3057pub const ISIG: crate::tcflag_t = 0x00000001;
3058pub const ICANON: crate::tcflag_t = 0x00000002;
3059pub const PENDIN: crate::tcflag_t = 0x00004000;
3060pub const NOFLSH: crate::tcflag_t = 0x00000080;
3061pub const CIBAUD: crate::tcflag_t = 0o02003600000;
3062pub const CBAUDEX: crate::tcflag_t = 0o010000;
3063pub const VSWTC: usize = 7;
3064pub const OLCUC: crate::tcflag_t = 0o000002;
3065pub const NLDLY: crate::tcflag_t = 0o000400;
3066pub const CRDLY: crate::tcflag_t = 0o003000;
3067pub const TABDLY: crate::tcflag_t = 0o014000;
3068pub const BSDLY: crate::tcflag_t = 0o020000;
3069pub const FFDLY: crate::tcflag_t = 0o100000;
3070pub const VTDLY: crate::tcflag_t = 0o040000;
3071pub const XTABS: crate::tcflag_t = 0o014000;
3072
3073pub const B0: crate::speed_t = 0o000000;
3074pub const B50: crate::speed_t = 0o000001;
3075pub const B75: crate::speed_t = 0o000002;
3076pub const B110: crate::speed_t = 0o000003;
3077pub const B134: crate::speed_t = 0o000004;
3078pub const B150: crate::speed_t = 0o000005;
3079pub const B200: crate::speed_t = 0o000006;
3080pub const B300: crate::speed_t = 0o000007;
3081pub const B600: crate::speed_t = 0o000010;
3082pub const B1200: crate::speed_t = 0o000011;
3083pub const B1800: crate::speed_t = 0o000012;
3084pub const B2400: crate::speed_t = 0o000013;
3085pub const B4800: crate::speed_t = 0o000014;
3086pub const B9600: crate::speed_t = 0o000015;
3087pub const B19200: crate::speed_t = 0o000016;
3088pub const B38400: crate::speed_t = 0o000017;
3089pub const EXTA: crate::speed_t = B19200;
3090pub const EXTB: crate::speed_t = B38400;
3091pub const B57600: crate::speed_t = 0o010001;
3092pub const B115200: crate::speed_t = 0o010002;
3093pub const B230400: crate::speed_t = 0o010003;
3094pub const B460800: crate::speed_t = 0o010004;
3095pub const B500000: crate::speed_t = 0o010005;
3096pub const B576000: crate::speed_t = 0o010006;
3097pub const B921600: crate::speed_t = 0o010007;
3098pub const B1000000: crate::speed_t = 0o010010;
3099pub const B1152000: crate::speed_t = 0o010011;
3100pub const B1500000: crate::speed_t = 0o010012;
3101pub const B2000000: crate::speed_t = 0o010013;
3102pub const B2500000: crate::speed_t = 0o010014;
3103pub const B3000000: crate::speed_t = 0o010015;
3104pub const B3500000: crate::speed_t = 0o010016;
3105pub const B4000000: crate::speed_t = 0o010017;
3106
3107pub const SO_BINDTODEVICE: c_int = 25;
3108pub const SO_TIMESTAMP: c_int = 29;
3109pub const SO_MARK: c_int = 36;
3110pub const SO_RXQ_OVFL: c_int = 40;
3111pub const SO_PEEK_OFF: c_int = 42;
3112pub const SO_BUSY_POLL: c_int = 46;
3113pub const SO_BINDTOIFINDEX: c_int = 62;
3114
3115pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
3116pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
3117
3118pub const O_ASYNC: c_int = 0x00000400;
3119
3120pub const FIOCLEX: c_int = 0x5451;
3121pub const FIONBIO: c_int = 0x5421;
3122
3123pub const RLIMIT_RSS: c_int = 5;
3124pub const RLIMIT_NOFILE: c_int = 7;
3125pub const RLIMIT_AS: c_int = 9;
3126pub const RLIMIT_NPROC: c_int = 6;
3127pub const RLIMIT_MEMLOCK: c_int = 8;
3128
3129pub const O_APPEND: c_int = 0x00100000;
3130pub const O_CREAT: c_int = 0x00010000;
3131pub const O_EXCL: c_int = 0x00020000;
3132pub const O_NOCTTY: c_int = 0x00000200;
3133pub const O_NONBLOCK: c_int = 0x00000010;
3134pub const O_SYNC: c_int = 0x00000040 | O_DSYNC;
3135pub const O_RSYNC: c_int = O_SYNC;
3136pub const O_DSYNC: c_int = 0x00000020;
3137
3138pub const SOCK_CLOEXEC: c_int = 0o2000000;
3139pub const SOCK_NONBLOCK: c_int = 0o4000;
3140
3141pub const MAP_ANON: c_int = 0x0020;
3142pub const MAP_GROWSDOWN: c_int = 0x0100;
3143pub const MAP_DENYWRITE: c_int = 0x0800;
3144pub const MAP_EXECUTABLE: c_int = 0x01000;
3145pub const MAP_LOCKED: c_int = 0x02000;
3146pub const MAP_NORESERVE: c_int = 0x04000;
3147pub const MAP_POPULATE: c_int = 0x08000;
3148pub const MAP_NONBLOCK: c_int = 0x010000;
3149pub const MAP_STACK: c_int = 0x020000;
3150
3151pub const SOCK_STREAM: c_int = 1;
3152pub const SOCK_DGRAM: c_int = 2;
3153pub const SOCK_SEQPACKET: c_int = 5;
3154
3155pub const SOL_SOCKET: c_int = 1;
3156
3157pub const EDEADLK: c_int = 35;
3158pub const ENAMETOOLONG: c_int = 36;
3159pub const ENOLCK: c_int = 37;
3160pub const ENOSYS: c_int = 38;
3161pub const ENOTEMPTY: c_int = 39;
3162pub const ELOOP: c_int = 40;
3163pub const ENOMSG: c_int = 42;
3164pub const EIDRM: c_int = 43;
3165pub const ECHRNG: c_int = 44;
3166pub const EL2NSYNC: c_int = 45;
3167pub const EL3HLT: c_int = 46;
3168pub const EL3RST: c_int = 47;
3169pub const ELNRNG: c_int = 48;
3170pub const EUNATCH: c_int = 49;
3171pub const ENOCSI: c_int = 50;
3172pub const EL2HLT: c_int = 51;
3173pub const EBADE: c_int = 52;
3174pub const EBADR: c_int = 53;
3175pub const EXFULL: c_int = 54;
3176pub const ENOANO: c_int = 55;
3177pub const EBADRQC: c_int = 56;
3178pub const EBADSLT: c_int = 57;
3179pub const EDEADLOCK: c_int = EDEADLK;
3180pub const EMULTIHOP: c_int = 72;
3181pub const EBADMSG: c_int = 74;
3182pub const EOVERFLOW: c_int = 75;
3183pub const ENOTUNIQ: c_int = 76;
3184pub const EBADFD: c_int = 77;
3185pub const EREMCHG: c_int = 78;
3186pub const ELIBACC: c_int = 79;
3187pub const ELIBBAD: c_int = 80;
3188pub const ELIBSCN: c_int = 81;
3189pub const ELIBMAX: c_int = 82;
3190pub const ELIBEXEC: c_int = 83;
3191pub const EILSEQ: c_int = 84;
3192pub const ERESTART: c_int = 85;
3193pub const ESTRPIPE: c_int = 86;
3194pub const EUSERS: c_int = 87;
3195pub const ENOTSOCK: c_int = 88;
3196pub const EDESTADDRREQ: c_int = 89;
3197pub const EMSGSIZE: c_int = 90;
3198pub const EPROTOTYPE: c_int = 91;
3199pub const ENOPROTOOPT: c_int = 92;
3200pub const EPROTONOSUPPORT: c_int = 93;
3201pub const ESOCKTNOSUPPORT: c_int = 94;
3202pub const EOPNOTSUPP: c_int = 95;
3203pub const ENOTSUP: c_int = EOPNOTSUPP;
3204pub const EPFNOSUPPORT: c_int = 96;
3205pub const EAFNOSUPPORT: c_int = 97;
3206pub const EADDRINUSE: c_int = 98;
3207pub const EADDRNOTAVAIL: c_int = 99;
3208pub const ENETDOWN: c_int = 100;
3209pub const ENETUNREACH: c_int = 101;
3210pub const ENETRESET: c_int = 102;
3211pub const ECONNABORTED: c_int = 103;
3212pub const ECONNRESET: c_int = 104;
3213pub const ENOBUFS: c_int = 105;
3214pub const EISCONN: c_int = 106;
3215pub const ENOTCONN: c_int = 107;
3216pub const ESHUTDOWN: c_int = 108;
3217pub const ETOOMANYREFS: c_int = 109;
3218pub const ETIMEDOUT: c_int = 110;
3219pub const ECONNREFUSED: c_int = 111;
3220pub const EHOSTDOWN: c_int = 112;
3221pub const EHOSTUNREACH: c_int = 113;
3222pub const EALREADY: c_int = 114;
3223pub const EINPROGRESS: c_int = 115;
3224pub const ESTALE: c_int = 116;
3225pub const EUCLEAN: c_int = 117;
3226pub const ENOTNAM: c_int = 118;
3227pub const ENAVAIL: c_int = 119;
3228pub const EISNAM: c_int = 120;
3229pub const EREMOTEIO: c_int = 121;
3230pub const EDQUOT: c_int = 122;
3231pub const ENOMEDIUM: c_int = 123;
3232pub const EMEDIUMTYPE: c_int = 124;
3233pub const ECANCELED: c_int = 125;
3234pub const ENOKEY: c_int = 126;
3235pub const EKEYEXPIRED: c_int = 127;
3236pub const EKEYREVOKED: c_int = 128;
3237pub const EKEYREJECTED: c_int = 129;
3238pub const EOWNERDEAD: c_int = 130;
3239pub const ENOTRECOVERABLE: c_int = 131;
3240pub const ERFKILL: c_int = 132;
3241pub const EHWPOISON: c_int = 133;
3242
3243pub const SO_REUSEADDR: c_int = 2;
3244pub const SO_TYPE: c_int = 3;
3245pub const SO_ERROR: c_int = 4;
3246pub const SO_DONTROUTE: c_int = 5;
3247pub const SO_BROADCAST: c_int = 6;
3248pub const SO_SNDBUF: c_int = 7;
3249pub const SO_RCVBUF: c_int = 8;
3250pub const SO_KEEPALIVE: c_int = 9;
3251pub const SO_OOBINLINE: c_int = 10;
3252pub const SO_NO_CHECK: c_int = 11;
3253pub const SO_PRIORITY: c_int = 12;
3254pub const SO_LINGER: c_int = 13;
3255pub const SO_BSDCOMPAT: c_int = 14;
3256pub const SO_REUSEPORT: c_int = 15;
3257pub const SO_PASSCRED: c_int = 16;
3258pub const SO_PEERCRED: c_int = 17;
3259pub const SO_RCVLOWAT: c_int = 18;
3260pub const SO_SNDLOWAT: c_int = 19;
3261pub const SO_RCVTIMEO: c_int = 20;
3262pub const SO_SNDTIMEO: c_int = 21;
3263pub const SO_ACCEPTCONN: c_int = 30;
3264pub const SO_SNDBUFFORCE: c_int = 32;
3265pub const SO_RCVBUFFORCE: c_int = 33;
3266pub const SO_PROTOCOL: c_int = 38;
3267pub const SO_DOMAIN: c_int = 39;
3268
3269pub const SA_ONSTACK: c_int = 0x08000000;
3270pub const SA_SIGINFO: c_int = 0x00000004;
3271pub const SA_NOCLDWAIT: c_int = 0x00000002;
3272
3273pub const SIGCHLD: c_int = 17;
3274pub const SIGBUS: c_int = 7;
3275pub const SIGTTIN: c_int = 21;
3276pub const SIGTTOU: c_int = 22;
3277pub const SIGXCPU: c_int = 24;
3278pub const SIGXFSZ: c_int = 25;
3279pub const SIGVTALRM: c_int = 26;
3280pub const SIGPROF: c_int = 27;
3281pub const SIGWINCH: c_int = 28;
3282pub const SIGUSR1: c_int = 10;
3283pub const SIGUSR2: c_int = 12;
3284pub const SIGCONT: c_int = 18;
3285pub const SIGSTOP: c_int = 19;
3286pub const SIGTSTP: c_int = 20;
3287pub const SIGURG: c_int = 23;
3288pub const SIGIO: c_int = 29;
3289pub const SIGSYS: c_int = 31;
3290pub const SIGSTKFLT: c_int = 16;
3291pub const SIGPOLL: c_int = 29;
3292pub const SIGPWR: c_int = 30;
3293pub const SIG_SETMASK: c_int = 2;
3294pub const SIG_BLOCK: c_int = 0x000000;
3295pub const SIG_UNBLOCK: c_int = 0x01;
3296
3297pub const EXTPROC: crate::tcflag_t = 0x00010000;
3298
3299pub const MAP_HUGETLB: c_int = 0x040000;
3300
3301pub const F_GETLK: c_int = 5;
3302pub const F_GETOWN: c_int = 9;
3303pub const F_SETLK: c_int = 6;
3304pub const F_SETLKW: c_int = 7;
3305pub const F_SETOWN: c_int = 8;
3306
3307pub const VEOF: usize = 4;
3308pub const VEOL: usize = 11;
3309pub const VEOL2: usize = 16;
3310pub const VMIN: usize = 6;
3311pub const IEXTEN: crate::tcflag_t = 0x00008000;
3312pub const TOSTOP: crate::tcflag_t = 0x00000100;
3313pub const FLUSHO: crate::tcflag_t = 0x00001000;
3314
3315pub const TCGETS: c_int = 0x5401;
3316pub const TCSETS: c_int = 0x5402;
3317pub const TCSETSW: c_int = 0x5403;
3318pub const TCSETSF: c_int = 0x5404;
3319pub const TCGETA: c_int = 0x5405;
3320pub const TCSETA: c_int = 0x5406;
3321pub const TCSETAW: c_int = 0x5407;
3322pub const TCSETAF: c_int = 0x5408;
3323pub const TCSBRK: c_int = 0x5409;
3324pub const TCXONC: c_int = 0x540A;
3325pub const TCFLSH: c_int = 0x540B;
3326pub const TIOCGSOFTCAR: c_int = 0x5419;
3327pub const TIOCSSOFTCAR: c_int = 0x541A;
3328pub const TIOCLINUX: c_int = 0x541C;
3329pub const TIOCGSERIAL: c_int = 0x541E;
3330pub const TIOCEXCL: c_int = 0x540C;
3331pub const TIOCNXCL: c_int = 0x540D;
3332pub const TIOCSCTTY: c_int = 0x540E;
3333pub const TIOCGPGRP: c_int = 0x540F;
3334pub const TIOCSPGRP: c_int = 0x5410;
3335pub const TIOCOUTQ: c_int = 0x5411;
3336pub const TIOCSTI: c_int = 0x5412;
3337pub const TIOCGWINSZ: c_int = 0x5413;
3338pub const TIOCSWINSZ: c_int = 0x5414;
3339pub const TIOCMGET: c_int = 0x5415;
3340pub const TIOCMBIS: c_int = 0x5416;
3341pub const TIOCMBIC: c_int = 0x5417;
3342pub const TIOCMSET: c_int = 0x5418;
3343pub const FIONREAD: c_int = 0x541B;
3344pub const TIOCCONS: c_int = 0x541D;
3345
3346pub const POLLWRNORM: c_short = 0x100;
3347pub const POLLWRBAND: c_short = 0x200;
3348
3349pub const TIOCM_LE: c_int = 0x001;
3350pub const TIOCM_DTR: c_int = 0x002;
3351pub const TIOCM_RTS: c_int = 0x004;
3352pub const TIOCM_ST: c_int = 0x008;
3353pub const TIOCM_SR: c_int = 0x010;
3354pub const TIOCM_CTS: c_int = 0x020;
3355pub const TIOCM_CAR: c_int = 0x040;
3356pub const TIOCM_RNG: c_int = 0x080;
3357pub const TIOCM_DSR: c_int = 0x100;
3358pub const TIOCM_CD: c_int = TIOCM_CAR;
3359pub const TIOCM_RI: c_int = TIOCM_RNG;
3360
3361pub const O_DIRECTORY: c_int = 0x00080000;
3362pub const O_DIRECT: c_int = 0x00000800;
3363pub const O_LARGEFILE: c_int = 0x00001000;
3364pub const O_NOFOLLOW: c_int = 0x00000080;
3365
3366pub const HUGETLB_FLAG_ENCODE_SHIFT: u32 = 26;
3367pub const MAP_HUGE_SHIFT: u32 = 26;
3368
3369// intentionally not public, only used for fd_set
3370cfg_if! {
3371    if #[cfg(target_pointer_width = "32")] {
3372        const ULONG_SIZE: usize = 32;
3373    } else if #[cfg(target_pointer_width = "64")] {
3374        const ULONG_SIZE: usize = 64;
3375    } else {
3376        // Unknown target_pointer_width
3377    }
3378}
3379
3380// END_PUB_CONST
3381
3382f! {
3383    pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
3384        let fd = fd as usize;
3385        let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
3386        (*set).fds_bits[fd / size] &= !(1 << (fd % size));
3387        return;
3388    }
3389
3390    pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
3391        let fd = fd as usize;
3392        let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
3393        return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0;
3394    }
3395
3396    pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
3397        let fd = fd as usize;
3398        let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
3399        (*set).fds_bits[fd / size] |= 1 << (fd % size);
3400        return;
3401    }
3402
3403    pub fn FD_ZERO(set: *mut fd_set) -> () {
3404        for slot in (*set).fds_bits.iter_mut() {
3405            *slot = 0;
3406        }
3407    }
3408
3409    pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
3410        for slot in cpuset.bits.iter_mut() {
3411            *slot = 0;
3412        }
3413    }
3414
3415    pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
3416        let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
3417        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
3418        cpuset.bits[idx] |= 1 << offset;
3419        ()
3420    }
3421
3422    pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
3423        let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
3424        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
3425        cpuset.bits[idx] &= !(1 << offset);
3426        ()
3427    }
3428
3429    pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
3430        let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]);
3431        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
3432        0 != (cpuset.bits[idx] & (1 << offset))
3433    }
3434
3435    pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
3436        set1.bits == set2.bits
3437    }
3438
3439    pub fn major(dev: crate::dev_t) -> c_uint {
3440        let mut major = 0;
3441        major |= (dev & 0x00000000000fff00) >> 8;
3442        major |= (dev & 0xfffff00000000000) >> 32;
3443        major as c_uint
3444    }
3445
3446    pub fn minor(dev: crate::dev_t) -> c_uint {
3447        let mut minor = 0;
3448        minor |= (dev & 0x00000000000000ff) >> 0;
3449        minor |= (dev & 0x00000ffffff00000) >> 12;
3450        minor as c_uint
3451    }
3452
3453    pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
3454        cmsg.offset(1) as *mut c_uchar
3455    }
3456
3457    pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
3458        if ((*cmsg).cmsg_len as size_t) < mem::size_of::<cmsghdr>() {
3459            0 as *mut cmsghdr
3460        } else if __CMSG_NEXT(cmsg).add(mem::size_of::<cmsghdr>()) >= __MHDR_END(mhdr) {
3461            0 as *mut cmsghdr
3462        } else {
3463            __CMSG_NEXT(cmsg).cast()
3464        }
3465    }
3466
3467    pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
3468        if (*mhdr).msg_controllen as size_t >= mem::size_of::<cmsghdr>() {
3469            (*mhdr).msg_control.cast()
3470        } else {
3471            0 as *mut cmsghdr
3472        }
3473    }
3474
3475    pub {const} fn CMSG_ALIGN(len: size_t) -> size_t {
3476        (len + mem::size_of::<size_t>() - 1) & !(mem::size_of::<size_t>() - 1)
3477    }
3478
3479    pub {const} fn CMSG_SPACE(len: c_uint) -> c_uint {
3480        (CMSG_ALIGN(len as size_t) + CMSG_ALIGN(mem::size_of::<cmsghdr>())) as c_uint
3481    }
3482
3483    pub {const} fn CMSG_LEN(len: c_uint) -> c_uint {
3484        (CMSG_ALIGN(mem::size_of::<cmsghdr>()) + len as size_t) as c_uint
3485    }
3486}
3487
3488safe_f! {
3489    pub {const} fn WIFSTOPPED(status: c_int) -> bool {
3490        (status & 0xff) == 0x7f
3491    }
3492
3493    pub {const} fn WSTOPSIG(status: c_int) -> c_int {
3494        (status >> 8) & 0xff
3495    }
3496
3497    pub {const} fn WIFCONTINUED(status: c_int) -> bool {
3498        status == 0xffff
3499    }
3500
3501    pub {const} fn WIFSIGNALED(status: c_int) -> bool {
3502        ((status & 0x7f) + 1) as i8 >= 2
3503    }
3504
3505    pub {const} fn WTERMSIG(status: c_int) -> c_int {
3506        status & 0x7f
3507    }
3508
3509    pub {const} fn WIFEXITED(status: c_int) -> bool {
3510        (status & 0x7f) == 0
3511    }
3512
3513    pub {const} fn WEXITSTATUS(status: c_int) -> c_int {
3514        (status >> 8) & 0xff
3515    }
3516
3517    pub {const} fn WCOREDUMP(status: c_int) -> bool {
3518        (status & 0x80) != 0
3519    }
3520
3521    pub {const} fn QCMD(cmd: c_int, type_: c_int) -> c_int {
3522        (cmd << 8) | (type_ & 0x00ff)
3523    }
3524
3525    pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t {
3526        let major = major as crate::dev_t;
3527        let minor = minor as crate::dev_t;
3528        let mut dev = 0;
3529        dev |= (major & 0x00000fff) << 8;
3530        dev |= (major & 0xfffff000) << 32;
3531        dev |= (minor & 0x000000ff) << 0;
3532        dev |= (minor & 0xffffff00) << 12;
3533        dev
3534    }
3535}
3536
3537fn __CMSG_LEN(cmsg: *const cmsghdr) -> ssize_t {
3538    ((unsafe { (*cmsg).cmsg_len as size_t } + mem::size_of::<c_long>() - 1)
3539        & !(mem::size_of::<c_long>() - 1)) as ssize_t
3540}
3541
3542fn __CMSG_NEXT(cmsg: *const cmsghdr) -> *mut c_uchar {
3543    (unsafe { cmsg.offset(__CMSG_LEN(cmsg)) }) as *mut c_uchar
3544}
3545
3546fn __MHDR_END(mhdr: *const msghdr) -> *mut c_uchar {
3547    unsafe { (*mhdr).msg_control.offset((*mhdr).msg_controllen as isize) }.cast()
3548}
3549
3550// EXTERN_FN
3551
3552#[link(name = "c")]
3553#[link(name = "fdio")]
3554extern "C" {}
3555
3556#[cfg_attr(feature = "extra_traits", derive(Debug))]
3557pub enum FILE {}
3558impl Copy for FILE {}
3559impl Clone for FILE {
3560    fn clone(&self) -> FILE {
3561        *self
3562    }
3563}
3564#[cfg_attr(feature = "extra_traits", derive(Debug))]
3565pub enum fpos_t {} // FIXME: fill this out with a struct
3566impl Copy for fpos_t {}
3567impl Clone for fpos_t {
3568    fn clone(&self) -> fpos_t {
3569        *self
3570    }
3571}
3572
3573extern "C" {
3574    pub fn isalnum(c: c_int) -> c_int;
3575    pub fn isalpha(c: c_int) -> c_int;
3576    pub fn iscntrl(c: c_int) -> c_int;
3577    pub fn isdigit(c: c_int) -> c_int;
3578    pub fn isgraph(c: c_int) -> c_int;
3579    pub fn islower(c: c_int) -> c_int;
3580    pub fn isprint(c: c_int) -> c_int;
3581    pub fn ispunct(c: c_int) -> c_int;
3582    pub fn isspace(c: c_int) -> c_int;
3583    pub fn isupper(c: c_int) -> c_int;
3584    pub fn isxdigit(c: c_int) -> c_int;
3585    pub fn isblank(c: c_int) -> c_int;
3586    pub fn tolower(c: c_int) -> c_int;
3587    pub fn toupper(c: c_int) -> c_int;
3588    pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
3589    pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
3590    pub fn fflush(file: *mut FILE) -> c_int;
3591    pub fn fclose(file: *mut FILE) -> c_int;
3592    pub fn remove(filename: *const c_char) -> c_int;
3593    pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
3594    pub fn tmpfile() -> *mut FILE;
3595    pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
3596    pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
3597    pub fn getchar() -> c_int;
3598    pub fn putchar(c: c_int) -> c_int;
3599    pub fn fgetc(stream: *mut FILE) -> c_int;
3600    pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
3601    pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
3602    pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
3603    pub fn puts(s: *const c_char) -> c_int;
3604    pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
3605    pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
3606    pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
3607    pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
3608    pub fn ftell(stream: *mut FILE) -> c_long;
3609    pub fn rewind(stream: *mut FILE);
3610    pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
3611    pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
3612    pub fn feof(stream: *mut FILE) -> c_int;
3613    pub fn ferror(stream: *mut FILE) -> c_int;
3614    pub fn perror(s: *const c_char);
3615    pub fn atof(s: *const c_char) -> c_double;
3616    pub fn atoi(s: *const c_char) -> c_int;
3617    pub fn atol(s: *const c_char) -> c_long;
3618    pub fn atoll(s: *const c_char) -> c_longlong;
3619    pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
3620    pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
3621    pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
3622    pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong;
3623    pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
3624    pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
3625    pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
3626    pub fn malloc(size: size_t) -> *mut c_void;
3627    pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
3628    pub fn free(p: *mut c_void);
3629    pub fn abort() -> !;
3630    pub fn exit(status: c_int) -> !;
3631    pub fn _exit(status: c_int) -> !;
3632    pub fn atexit(cb: extern "C" fn()) -> c_int;
3633    pub fn system(s: *const c_char) -> c_int;
3634    pub fn getenv(s: *const c_char) -> *mut c_char;
3635
3636    pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
3637    pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
3638    pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
3639    pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
3640    pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
3641    pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
3642    pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
3643    pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
3644    pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
3645    pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
3646    pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
3647    pub fn strdup(cs: *const c_char) -> *mut c_char;
3648    pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
3649    pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
3650    pub fn strlen(cs: *const c_char) -> size_t;
3651    pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
3652    pub fn strerror(n: c_int) -> *mut c_char;
3653    pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
3654    pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
3655    pub fn wcslen(buf: *const wchar_t) -> size_t;
3656    pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> size_t;
3657
3658    pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
3659    pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
3660    pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
3661    pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
3662    pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
3663    pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
3664
3665    pub fn abs(i: c_int) -> c_int;
3666    pub fn labs(i: c_long) -> c_long;
3667    pub fn rand() -> c_int;
3668    pub fn srand(seed: c_uint);
3669
3670    pub fn getpwnam(name: *const c_char) -> *mut passwd;
3671    pub fn getpwuid(uid: crate::uid_t) -> *mut passwd;
3672
3673    pub fn fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
3674    pub fn printf(format: *const c_char, ...) -> c_int;
3675    pub fn snprintf(s: *mut c_char, n: size_t, format: *const c_char, ...) -> c_int;
3676    pub fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int;
3677    pub fn fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
3678    pub fn scanf(format: *const c_char, ...) -> c_int;
3679    pub fn sscanf(s: *const c_char, format: *const c_char, ...) -> c_int;
3680    pub fn getchar_unlocked() -> c_int;
3681    pub fn putchar_unlocked(c: c_int) -> c_int;
3682
3683    pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
3684    pub fn connect(socket: c_int, address: *const sockaddr, len: socklen_t) -> c_int;
3685    pub fn listen(socket: c_int, backlog: c_int) -> c_int;
3686    pub fn accept(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> c_int;
3687    pub fn getpeername(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t)
3688        -> c_int;
3689    pub fn getsockname(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t)
3690        -> c_int;
3691    pub fn setsockopt(
3692        socket: c_int,
3693        level: c_int,
3694        name: c_int,
3695        value: *const c_void,
3696        option_len: socklen_t,
3697    ) -> c_int;
3698    pub fn socketpair(
3699        domain: c_int,
3700        type_: c_int,
3701        protocol: c_int,
3702        socket_vector: *mut c_int,
3703    ) -> c_int;
3704    pub fn sendto(
3705        socket: c_int,
3706        buf: *const c_void,
3707        len: size_t,
3708        flags: c_int,
3709        addr: *const sockaddr,
3710        addrlen: socklen_t,
3711    ) -> ssize_t;
3712    pub fn shutdown(socket: c_int, how: c_int) -> c_int;
3713
3714    pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
3715    pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
3716
3717    pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
3718
3719    pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
3720
3721    pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
3722
3723    pub fn pclose(stream: *mut crate::FILE) -> c_int;
3724    pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE;
3725    pub fn fileno(stream: *mut crate::FILE) -> c_int;
3726
3727    pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
3728    pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
3729    pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
3730
3731    pub fn opendir(dirname: *const c_char) -> *mut crate::DIR;
3732    pub fn readdir(dirp: *mut crate::DIR) -> *mut crate::dirent;
3733    pub fn readdir_r(
3734        dirp: *mut crate::DIR,
3735        entry: *mut crate::dirent,
3736        result: *mut *mut crate::dirent,
3737    ) -> c_int;
3738    pub fn closedir(dirp: *mut crate::DIR) -> c_int;
3739    pub fn rewinddir(dirp: *mut crate::DIR);
3740
3741    pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
3742    pub fn fchmodat(
3743        dirfd: c_int,
3744        pathname: *const c_char,
3745        mode: crate::mode_t,
3746        flags: c_int,
3747    ) -> c_int;
3748    pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int;
3749    pub fn fchownat(
3750        dirfd: c_int,
3751        pathname: *const c_char,
3752        owner: crate::uid_t,
3753        group: crate::gid_t,
3754        flags: c_int,
3755    ) -> c_int;
3756    pub fn fstatat(dirfd: c_int, pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int;
3757    pub fn linkat(
3758        olddirfd: c_int,
3759        oldpath: *const c_char,
3760        newdirfd: c_int,
3761        newpath: *const c_char,
3762        flags: c_int,
3763    ) -> c_int;
3764    pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
3765    pub fn readlinkat(
3766        dirfd: c_int,
3767        pathname: *const c_char,
3768        buf: *mut c_char,
3769        bufsiz: size_t,
3770    ) -> ssize_t;
3771    pub fn renameat(
3772        olddirfd: c_int,
3773        oldpath: *const c_char,
3774        newdirfd: c_int,
3775        newpath: *const c_char,
3776    ) -> c_int;
3777    pub fn symlinkat(target: *const c_char, newdirfd: c_int, linkpath: *const c_char) -> c_int;
3778    pub fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int;
3779
3780    pub fn access(path: *const c_char, amode: c_int) -> c_int;
3781    pub fn alarm(seconds: c_uint) -> c_uint;
3782    pub fn chdir(dir: *const c_char) -> c_int;
3783    pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int;
3784    pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int;
3785    pub fn close(fd: c_int) -> c_int;
3786    pub fn dup(fd: c_int) -> c_int;
3787    pub fn dup2(src: c_int, dst: c_int) -> c_int;
3788
3789    pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> c_int;
3790    pub fn execle(path: *const c_char, arg0: *const c_char, ...) -> c_int;
3791    pub fn execlp(file: *const c_char, arg0: *const c_char, ...) -> c_int;
3792
3793    // DIFF(main): changed to `*const *mut` in e77f551de9
3794    pub fn execv(prog: *const c_char, argv: *const *const c_char) -> c_int;
3795    pub fn execve(
3796        prog: *const c_char,
3797        argv: *const *const c_char,
3798        envp: *const *const c_char,
3799    ) -> c_int;
3800    pub fn execvp(c: *const c_char, argv: *const *const c_char) -> c_int;
3801
3802    pub fn fork() -> pid_t;
3803    pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
3804    pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
3805    pub fn getegid() -> gid_t;
3806    pub fn geteuid() -> uid_t;
3807    pub fn getgid() -> gid_t;
3808    pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int;
3809    pub fn getlogin() -> *mut c_char;
3810    pub fn getopt(argc: c_int, argv: *const *mut c_char, optstr: *const c_char) -> c_int;
3811    pub fn getpgid(pid: pid_t) -> pid_t;
3812    pub fn getpgrp() -> pid_t;
3813    pub fn getpid() -> pid_t;
3814    pub fn getppid() -> pid_t;
3815    pub fn getuid() -> uid_t;
3816    pub fn isatty(fd: c_int) -> c_int;
3817    pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
3818    pub fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
3819    pub fn pathconf(path: *const c_char, name: c_int) -> c_long;
3820    pub fn pause() -> c_int;
3821    pub fn pipe(fds: *mut c_int) -> c_int;
3822    pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int;
3823    pub fn read(fd: c_int, buf: *mut c_void, count: size_t) -> ssize_t;
3824    pub fn rmdir(path: *const c_char) -> c_int;
3825    pub fn seteuid(uid: uid_t) -> c_int;
3826    pub fn setegid(gid: gid_t) -> c_int;
3827    pub fn setgid(gid: gid_t) -> c_int;
3828    pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
3829    pub fn setsid() -> pid_t;
3830    pub fn setuid(uid: uid_t) -> c_int;
3831    pub fn sleep(secs: c_uint) -> c_uint;
3832    pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> c_int;
3833    pub fn tcgetpgrp(fd: c_int) -> pid_t;
3834    pub fn tcsetpgrp(fd: c_int, pgrp: crate::pid_t) -> c_int;
3835    pub fn ttyname(fd: c_int) -> *mut c_char;
3836    pub fn unlink(c: *const c_char) -> c_int;
3837    pub fn wait(status: *mut c_int) -> pid_t;
3838    pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t;
3839    pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;
3840    pub fn pread(fd: c_int, buf: *mut c_void, count: size_t, offset: off_t) -> ssize_t;
3841    pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t, offset: off_t) -> ssize_t;
3842    pub fn umask(mask: mode_t) -> mode_t;
3843
3844    pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
3845
3846    pub fn kill(pid: pid_t, sig: c_int) -> c_int;
3847
3848    pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
3849    pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
3850    pub fn mlockall(flags: c_int) -> c_int;
3851    pub fn munlockall() -> c_int;
3852
3853    pub fn mmap(
3854        addr: *mut c_void,
3855        len: size_t,
3856        prot: c_int,
3857        flags: c_int,
3858        fd: c_int,
3859        offset: off_t,
3860    ) -> *mut c_void;
3861    pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
3862
3863    pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
3864    pub fn if_indextoname(ifindex: c_uint, ifname: *mut c_char) -> *mut c_char;
3865
3866    pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
3867
3868    pub fn fsync(fd: c_int) -> c_int;
3869
3870    pub fn setenv(name: *const c_char, val: *const c_char, overwrite: c_int) -> c_int;
3871    pub fn unsetenv(name: *const c_char) -> c_int;
3872
3873    pub fn symlink(path1: *const c_char, path2: *const c_char) -> c_int;
3874
3875    pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
3876
3877    pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
3878
3879    pub fn realpath(pathname: *const c_char, resolved: *mut c_char) -> *mut c_char;
3880
3881    pub fn flock(fd: c_int, operation: c_int) -> c_int;
3882
3883    pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
3884    pub fn times(buf: *mut crate::tms) -> crate::clock_t;
3885
3886    pub fn pthread_self() -> crate::pthread_t;
3887    pub fn pthread_join(native: crate::pthread_t, value: *mut *mut c_void) -> c_int;
3888    pub fn pthread_exit(value: *mut c_void) -> !;
3889    pub fn pthread_attr_init(attr: *mut crate::pthread_attr_t) -> c_int;
3890    pub fn pthread_attr_destroy(attr: *mut crate::pthread_attr_t) -> c_int;
3891    pub fn pthread_attr_getstacksize(
3892        attr: *const crate::pthread_attr_t,
3893        stacksize: *mut size_t,
3894    ) -> c_int;
3895    pub fn pthread_attr_setstacksize(attr: *mut crate::pthread_attr_t, stack_size: size_t)
3896        -> c_int;
3897    pub fn pthread_attr_setdetachstate(attr: *mut crate::pthread_attr_t, state: c_int) -> c_int;
3898    pub fn pthread_detach(thread: crate::pthread_t) -> c_int;
3899    pub fn sched_yield() -> c_int;
3900    pub fn pthread_key_create(
3901        key: *mut pthread_key_t,
3902        dtor: Option<unsafe extern "C" fn(*mut c_void)>,
3903    ) -> c_int;
3904    pub fn pthread_key_delete(key: pthread_key_t) -> c_int;
3905    pub fn pthread_getspecific(key: pthread_key_t) -> *mut c_void;
3906    pub fn pthread_setspecific(key: pthread_key_t, value: *const c_void) -> c_int;
3907    pub fn pthread_mutex_init(
3908        lock: *mut pthread_mutex_t,
3909        attr: *const pthread_mutexattr_t,
3910    ) -> c_int;
3911    pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> c_int;
3912    pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int;
3913    pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> c_int;
3914    pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int;
3915
3916    pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int;
3917    pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int;
3918    pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: c_int) -> c_int;
3919
3920    pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> c_int;
3921    pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int;
3922    pub fn pthread_cond_timedwait(
3923        cond: *mut pthread_cond_t,
3924        lock: *mut pthread_mutex_t,
3925        abstime: *const crate::timespec,
3926    ) -> c_int;
3927    pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> c_int;
3928    pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> c_int;
3929    pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int;
3930    pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> c_int;
3931    pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> c_int;
3932    pub fn pthread_rwlock_init(
3933        lock: *mut pthread_rwlock_t,
3934        attr: *const pthread_rwlockattr_t,
3935    ) -> c_int;
3936    pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> c_int;
3937    pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> c_int;
3938    pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> c_int;
3939    pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> c_int;
3940    pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> c_int;
3941    pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> c_int;
3942    pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> c_int;
3943    pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> c_int;
3944    pub fn pthread_getname_np(thread: crate::pthread_t, name: *mut c_char, len: size_t) -> c_int;
3945    pub fn pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int;
3946    pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
3947
3948    pub fn getsockopt(
3949        sockfd: c_int,
3950        level: c_int,
3951        optname: c_int,
3952        optval: *mut c_void,
3953        optlen: *mut crate::socklen_t,
3954    ) -> c_int;
3955    pub fn raise(signum: c_int) -> c_int;
3956    pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction) -> c_int;
3957
3958    pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int;
3959    pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void;
3960    pub fn dlerror() -> *mut c_char;
3961    pub fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void;
3962    pub fn dlclose(handle: *mut c_void) -> c_int;
3963    pub fn dladdr(addr: *const c_void, info: *mut Dl_info) -> c_int;
3964
3965    pub fn getaddrinfo(
3966        node: *const c_char,
3967        service: *const c_char,
3968        hints: *const addrinfo,
3969        res: *mut *mut addrinfo,
3970    ) -> c_int;
3971    pub fn freeaddrinfo(res: *mut addrinfo);
3972    pub fn gai_strerror(errcode: c_int) -> *const c_char;
3973    pub fn res_init() -> c_int;
3974
3975    pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
3976    pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
3977    pub fn mktime(tm: *mut tm) -> time_t;
3978    pub fn time(time: *mut time_t) -> time_t;
3979    pub fn gmtime(time_p: *const time_t) -> *mut tm;
3980    pub fn localtime(time_p: *const time_t) -> *mut tm;
3981
3982    pub fn mknod(pathname: *const c_char, mode: crate::mode_t, dev: crate::dev_t) -> c_int;
3983    pub fn uname(buf: *mut crate::utsname) -> c_int;
3984    pub fn gethostname(name: *mut c_char, len: size_t) -> c_int;
3985    pub fn getservbyname(name: *const c_char, proto: *const c_char) -> *mut servent;
3986    pub fn getprotobyname(name: *const c_char) -> *mut protoent;
3987    pub fn getprotobynumber(proto: c_int) -> *mut protoent;
3988    pub fn usleep(secs: c_uint) -> c_int;
3989    pub fn send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t;
3990    pub fn recv(socket: c_int, buf: *mut c_void, len: size_t, flags: c_int) -> ssize_t;
3991    pub fn putenv(string: *mut c_char) -> c_int;
3992    pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int;
3993    pub fn select(
3994        nfds: c_int,
3995        readfds: *mut fd_set,
3996        writefds: *mut fd_set,
3997        errorfds: *mut fd_set,
3998        timeout: *mut timeval,
3999    ) -> c_int;
4000    pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char;
4001    pub fn localeconv() -> *mut lconv;
4002
4003    pub fn sem_destroy(sem: *mut sem_t) -> c_int;
4004    pub fn sem_wait(sem: *mut sem_t) -> c_int;
4005    pub fn sem_trywait(sem: *mut sem_t) -> c_int;
4006    pub fn sem_post(sem: *mut sem_t) -> c_int;
4007    pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
4008    pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> c_int;
4009    pub fn fstatvfs(fd: c_int, buf: *mut statvfs) -> c_int;
4010
4011    pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> ssize_t;
4012
4013    pub fn sigemptyset(set: *mut sigset_t) -> c_int;
4014    pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int;
4015    pub fn sigfillset(set: *mut sigset_t) -> c_int;
4016    pub fn sigdelset(set: *mut sigset_t, signum: c_int) -> c_int;
4017    pub fn sigismember(set: *const sigset_t, signum: c_int) -> c_int;
4018
4019    pub fn sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
4020    pub fn sigpending(set: *mut sigset_t) -> c_int;
4021
4022    pub fn timegm(tm: *mut crate::tm) -> time_t;
4023
4024    pub fn getsid(pid: pid_t) -> pid_t;
4025
4026    pub fn sysconf(name: c_int) -> c_long;
4027
4028    pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
4029
4030    pub fn pselect(
4031        nfds: c_int,
4032        readfds: *mut fd_set,
4033        writefds: *mut fd_set,
4034        errorfds: *mut fd_set,
4035        timeout: *const timespec,
4036        sigmask: *const sigset_t,
4037    ) -> c_int;
4038    pub fn fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int;
4039    pub fn ftello(stream: *mut crate::FILE) -> off_t;
4040    pub fn tcdrain(fd: c_int) -> c_int;
4041    pub fn cfgetispeed(termios: *const crate::termios) -> crate::speed_t;
4042    pub fn cfgetospeed(termios: *const crate::termios) -> crate::speed_t;
4043    pub fn cfmakeraw(termios: *mut crate::termios);
4044    pub fn cfsetispeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
4045    pub fn cfsetospeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
4046    pub fn cfsetspeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
4047    pub fn tcgetattr(fd: c_int, termios: *mut crate::termios) -> c_int;
4048    pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios: *const crate::termios) -> c_int;
4049    pub fn tcflow(fd: c_int, action: c_int) -> c_int;
4050    pub fn tcflush(fd: c_int, action: c_int) -> c_int;
4051    pub fn tcgetsid(fd: c_int) -> crate::pid_t;
4052    pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int;
4053    pub fn mkstemp(template: *mut c_char) -> c_int;
4054    pub fn mkdtemp(template: *mut c_char) -> *mut c_char;
4055
4056    pub fn tmpnam(ptr: *mut c_char) -> *mut c_char;
4057
4058    pub fn openlog(ident: *const c_char, logopt: c_int, facility: c_int);
4059    pub fn closelog();
4060    pub fn setlogmask(maskpri: c_int) -> c_int;
4061    pub fn syslog(priority: c_int, message: *const c_char, ...);
4062
4063    pub fn grantpt(fd: c_int) -> c_int;
4064    pub fn posix_openpt(flags: c_int) -> c_int;
4065    pub fn ptsname(fd: c_int) -> *mut c_char;
4066    pub fn unlockpt(fd: c_int) -> c_int;
4067
4068    pub fn fdatasync(fd: c_int) -> c_int;
4069    pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
4070    pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
4071    pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
4072    pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
4073
4074    pub fn pthread_getattr_np(native: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
4075    pub fn pthread_attr_getstack(
4076        attr: *const crate::pthread_attr_t,
4077        stackaddr: *mut *mut c_void,
4078        stacksize: *mut size_t,
4079    ) -> c_int;
4080    pub fn memalign(align: size_t, size: size_t) -> *mut c_void;
4081    pub fn setgroups(ngroups: size_t, ptr: *const crate::gid_t) -> c_int;
4082    pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int;
4083    pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
4084    pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
4085    pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
4086
4087    pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
4088    pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
4089    pub fn utimensat(
4090        dirfd: c_int,
4091        path: *const c_char,
4092        times: *const crate::timespec,
4093        flag: c_int,
4094    ) -> c_int;
4095    pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
4096    pub fn freelocale(loc: crate::locale_t);
4097    pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
4098    pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
4099
4100    pub fn fdopendir(fd: c_int) -> *mut crate::DIR;
4101
4102    pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t, dev: dev_t)
4103        -> c_int;
4104    pub fn pthread_condattr_getclock(
4105        attr: *const pthread_condattr_t,
4106        clock_id: *mut clockid_t,
4107    ) -> c_int;
4108    pub fn pthread_condattr_setclock(
4109        attr: *mut pthread_condattr_t,
4110        clock_id: crate::clockid_t,
4111    ) -> c_int;
4112    pub fn accept4(
4113        fd: c_int,
4114        addr: *mut crate::sockaddr,
4115        len: *mut crate::socklen_t,
4116        flg: c_int,
4117    ) -> c_int;
4118    pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
4119    pub fn clearenv() -> c_int;
4120    pub fn waitid(
4121        idtype: idtype_t,
4122        id: id_t,
4123        infop: *mut crate::siginfo_t,
4124        options: c_int,
4125    ) -> c_int;
4126    pub fn setreuid(ruid: crate::uid_t, euid: crate::uid_t) -> c_int;
4127    pub fn setregid(rgid: crate::gid_t, egid: crate::gid_t) -> c_int;
4128    pub fn getresuid(
4129        ruid: *mut crate::uid_t,
4130        euid: *mut crate::uid_t,
4131        suid: *mut crate::uid_t,
4132    ) -> c_int;
4133    pub fn getresgid(
4134        rgid: *mut crate::gid_t,
4135        egid: *mut crate::gid_t,
4136        sgid: *mut crate::gid_t,
4137    ) -> c_int;
4138    pub fn acct(filename: *const c_char) -> c_int;
4139    pub fn brk(addr: *mut c_void) -> c_int;
4140    pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int;
4141    pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int;
4142    pub fn openpty(
4143        amaster: *mut c_int,
4144        aslave: *mut c_int,
4145        name: *mut c_char,
4146        termp: *const termios,
4147        winp: *const crate::winsize,
4148    ) -> c_int;
4149
4150    // DIFF(main): changed to `*const *mut` in e77f551de9
4151    pub fn execvpe(
4152        file: *const c_char,
4153        argv: *const *const c_char,
4154        envp: *const *const c_char,
4155    ) -> c_int;
4156    pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
4157
4158    pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int;
4159
4160    pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
4161
4162    pub fn setpwent();
4163    pub fn endpwent();
4164    pub fn getpwent() -> *mut passwd;
4165
4166    pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
4167
4168    // System V IPC
4169    pub fn shmget(key: crate::key_t, size: size_t, shmflg: c_int) -> c_int;
4170    pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void;
4171    pub fn shmdt(shmaddr: *const c_void) -> c_int;
4172    pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int;
4173    pub fn ftok(pathname: *const c_char, proj_id: c_int) -> crate::key_t;
4174    pub fn semget(key: crate::key_t, nsems: c_int, semflag: c_int) -> c_int;
4175    pub fn semop(semid: c_int, sops: *mut crate::sembuf, nsops: size_t) -> c_int;
4176    pub fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) -> c_int;
4177    pub fn msgctl(msqid: c_int, cmd: c_int, buf: *mut msqid_ds) -> c_int;
4178    pub fn msgget(key: crate::key_t, msgflg: c_int) -> c_int;
4179    pub fn msgrcv(
4180        msqid: c_int,
4181        msgp: *mut c_void,
4182        msgsz: size_t,
4183        msgtyp: c_long,
4184        msgflg: c_int,
4185    ) -> ssize_t;
4186    pub fn msgsnd(msqid: c_int, msgp: *const c_void, msgsz: size_t, msgflg: c_int) -> c_int;
4187
4188    pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
4189    pub fn __errno_location() -> *mut c_int;
4190
4191    pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int;
4192    pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
4193    pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t;
4194    pub fn signalfd(fd: c_int, mask: *const crate::sigset_t, flags: c_int) -> c_int;
4195    pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int;
4196    pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int;
4197    pub fn timerfd_settime(
4198        fd: c_int,
4199        flags: c_int,
4200        new_value: *const itimerspec,
4201        old_value: *mut itimerspec,
4202    ) -> c_int;
4203    pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
4204    pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
4205    pub fn quotactl(cmd: c_int, special: *const c_char, id: c_int, data: *mut c_char) -> c_int;
4206    pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int;
4207    pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
4208    pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;
4209    pub fn sigtimedwait(
4210        set: *const sigset_t,
4211        info: *mut siginfo_t,
4212        timeout: *const crate::timespec,
4213    ) -> c_int;
4214    pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
4215    pub fn nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char;
4216    pub fn getnameinfo(
4217        sa: *const crate::sockaddr,
4218        salen: crate::socklen_t,
4219        host: *mut c_char,
4220        hostlen: crate::socklen_t,
4221        serv: *mut c_char,
4222        servlen: crate::socklen_t,
4223        flags: c_int,
4224    ) -> c_int;
4225    pub fn reboot(how_to: c_int) -> c_int;
4226    pub fn setfsgid(gid: crate::gid_t) -> c_int;
4227    pub fn setfsuid(uid: crate::uid_t) -> c_int;
4228
4229    // Not available now on Android
4230    pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
4231    pub fn if_nameindex() -> *mut if_nameindex;
4232    pub fn if_freenameindex(ptr: *mut if_nameindex);
4233    pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int;
4234    pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int;
4235    pub fn freeifaddrs(ifa: *mut crate::ifaddrs);
4236
4237    pub fn glob(
4238        pattern: *const c_char,
4239        flags: c_int,
4240        errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>,
4241        pglob: *mut crate::glob_t,
4242    ) -> c_int;
4243    pub fn globfree(pglob: *mut crate::glob_t);
4244
4245    pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
4246
4247    pub fn shm_unlink(name: *const c_char) -> c_int;
4248
4249    pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
4250
4251    pub fn telldir(dirp: *mut crate::DIR) -> c_long;
4252    pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
4253
4254    pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
4255
4256    pub fn recvfrom(
4257        socket: c_int,
4258        buf: *mut c_void,
4259        len: size_t,
4260        flags: c_int,
4261        addr: *mut crate::sockaddr,
4262        addrlen: *mut crate::socklen_t,
4263    ) -> ssize_t;
4264    pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int;
4265    pub fn futimes(fd: c_int, times: *const crate::timeval) -> c_int;
4266    pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char;
4267
4268    pub fn bind(
4269        socket: c_int,
4270        address: *const crate::sockaddr,
4271        address_len: crate::socklen_t,
4272    ) -> c_int;
4273
4274    pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
4275    pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
4276
4277    pub fn sendmsg(fd: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t;
4278    pub fn recvmsg(fd: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t;
4279    pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int;
4280    pub fn setdomainname(name: *const c_char, len: size_t) -> c_int;
4281    pub fn vhangup() -> c_int;
4282    pub fn sendmmsg(sockfd: c_int, msgvec: *mut mmsghdr, vlen: c_uint, flags: c_int) -> c_int;
4283    pub fn recvmmsg(
4284        sockfd: c_int,
4285        msgvec: *mut mmsghdr,
4286        vlen: c_uint,
4287        flags: c_int,
4288        timeout: *mut crate::timespec,
4289    ) -> c_int;
4290    pub fn sync();
4291    pub fn syscall(num: c_long, ...) -> c_long;
4292    pub fn sched_getaffinity(
4293        pid: crate::pid_t,
4294        cpusetsize: size_t,
4295        cpuset: *mut cpu_set_t,
4296    ) -> c_int;
4297    pub fn sched_setaffinity(
4298        pid: crate::pid_t,
4299        cpusetsize: size_t,
4300        cpuset: *const cpu_set_t,
4301    ) -> c_int;
4302    pub fn umount(target: *const c_char) -> c_int;
4303    pub fn sched_get_priority_max(policy: c_int) -> c_int;
4304    pub fn tee(fd_in: c_int, fd_out: c_int, len: size_t, flags: c_uint) -> ssize_t;
4305    pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
4306    pub fn splice(
4307        fd_in: c_int,
4308        off_in: *mut crate::loff_t,
4309        fd_out: c_int,
4310        off_out: *mut crate::loff_t,
4311        len: size_t,
4312        flags: c_uint,
4313    ) -> ssize_t;
4314    pub fn eventfd(init: c_uint, flags: c_int) -> c_int;
4315    pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int;
4316    pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int;
4317    pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;
4318    pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int;
4319    pub fn swapoff(puath: *const c_char) -> c_int;
4320    pub fn vmsplice(fd: c_int, iov: *const crate::iovec, nr_segs: size_t, flags: c_uint)
4321        -> ssize_t;
4322    pub fn mount(
4323        src: *const c_char,
4324        target: *const c_char,
4325        fstype: *const c_char,
4326        flags: c_ulong,
4327        data: *const c_void,
4328    ) -> c_int;
4329    pub fn personality(persona: c_ulong) -> c_int;
4330    pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int;
4331    pub fn ppoll(
4332        fds: *mut crate::pollfd,
4333        nfds: nfds_t,
4334        timeout: *const crate::timespec,
4335        sigmask: *const sigset_t,
4336    ) -> c_int;
4337    pub fn pthread_mutex_timedlock(
4338        lock: *mut pthread_mutex_t,
4339        abstime: *const crate::timespec,
4340    ) -> c_int;
4341    pub fn clone(
4342        cb: extern "C" fn(*mut c_void) -> c_int,
4343        child_stack: *mut c_void,
4344        flags: c_int,
4345        arg: *mut c_void,
4346        ...
4347    ) -> c_int;
4348    pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
4349    pub fn clock_nanosleep(
4350        clk_id: crate::clockid_t,
4351        flags: c_int,
4352        rqtp: *const crate::timespec,
4353        rmtp: *mut crate::timespec,
4354    ) -> c_int;
4355    pub fn pthread_attr_getguardsize(
4356        attr: *const crate::pthread_attr_t,
4357        guardsize: *mut size_t,
4358    ) -> c_int;
4359    pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
4360    pub fn sethostname(name: *const c_char, len: size_t) -> c_int;
4361    pub fn sched_get_priority_min(policy: c_int) -> c_int;
4362    pub fn umount2(target: *const c_char, flags: c_int) -> c_int;
4363    pub fn swapon(path: *const c_char, swapflags: c_int) -> c_int;
4364    pub fn sched_setscheduler(
4365        pid: crate::pid_t,
4366        policy: c_int,
4367        param: *const crate::sched_param,
4368    ) -> c_int;
4369    pub fn sigsuspend(mask: *const crate::sigset_t) -> c_int;
4370    pub fn getgrgid_r(
4371        gid: crate::gid_t,
4372        grp: *mut crate::group,
4373        buf: *mut c_char,
4374        buflen: size_t,
4375        result: *mut *mut crate::group,
4376    ) -> c_int;
4377    pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> c_int;
4378    pub fn sem_close(sem: *mut sem_t) -> c_int;
4379    pub fn getdtablesize() -> c_int;
4380    pub fn getgrnam_r(
4381        name: *const c_char,
4382        grp: *mut crate::group,
4383        buf: *mut c_char,
4384        buflen: size_t,
4385        result: *mut *mut crate::group,
4386    ) -> c_int;
4387    pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int;
4388    pub fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
4389    pub fn sem_open(name: *const c_char, oflag: c_int, ...) -> *mut sem_t;
4390    pub fn getgrnam(name: *const c_char) -> *mut crate::group;
4391    pub fn pthread_cancel(thread: crate::pthread_t) -> c_int;
4392    pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int;
4393    pub fn sem_unlink(name: *const c_char) -> c_int;
4394    pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int;
4395    pub fn getpwnam_r(
4396        name: *const c_char,
4397        pwd: *mut passwd,
4398        buf: *mut c_char,
4399        buflen: size_t,
4400        result: *mut *mut passwd,
4401    ) -> c_int;
4402    pub fn getpwuid_r(
4403        uid: crate::uid_t,
4404        pwd: *mut passwd,
4405        buf: *mut c_char,
4406        buflen: size_t,
4407        result: *mut *mut passwd,
4408    ) -> c_int;
4409    pub fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int;
4410    pub fn pthread_atfork(
4411        prepare: Option<unsafe extern "C" fn()>,
4412        parent: Option<unsafe extern "C" fn()>,
4413        child: Option<unsafe extern "C" fn()>,
4414    ) -> c_int;
4415    pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group;
4416
4417    pub fn setgrent();
4418    pub fn endgrent();
4419    pub fn getgrent() -> *mut crate::group;
4420
4421    pub fn getgrouplist(
4422        user: *const c_char,
4423        group: crate::gid_t,
4424        groups: *mut crate::gid_t,
4425        ngroups: *mut c_int,
4426    ) -> c_int;
4427    pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE;
4428    pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
4429    pub fn pthread_create(
4430        native: *mut crate::pthread_t,
4431        attr: *const crate::pthread_attr_t,
4432        f: extern "C" fn(*mut c_void) -> *mut c_void,
4433        value: *mut c_void,
4434    ) -> c_int;
4435    pub fn dl_iterate_phdr(
4436        callback: Option<
4437            unsafe extern "C" fn(
4438                info: *mut crate::dl_phdr_info,
4439                size: size_t,
4440                data: *mut c_void,
4441            ) -> c_int,
4442        >,
4443        data: *mut c_void,
4444    ) -> c_int;
4445}
4446
4447cfg_if! {
4448    if #[cfg(target_arch = "aarch64")] {
4449        mod aarch64;
4450        pub use self::aarch64::*;
4451    } else if #[cfg(any(target_arch = "x86_64"))] {
4452        mod x86_64;
4453        pub use self::x86_64::*;
4454    } else if #[cfg(any(target_arch = "riscv64"))] {
4455        mod riscv64;
4456        pub use self::riscv64::*;
4457    } else {
4458        // Unknown target_arch
4459    }
4460}