Skip to main content

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