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