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