libc/unix/linux_like/linux/gnu/
mod.rs

1pub type pthread_t = c_ulong;
2pub type __priority_which_t = ::c_uint;
3pub type __rlimit_resource_t = ::c_uint;
4pub type Lmid_t = ::c_long;
5pub type regoff_t = ::c_int;
6pub type __kernel_rwf_t = ::c_int;
7
8cfg_if! {
9    if #[cfg(doc)] {
10        // Used in `linux::arch` to define ioctl constants.
11        pub(crate) type Ioctl = ::c_ulong;
12    } else {
13        #[doc(hidden)]
14        pub type Ioctl = ::c_ulong;
15    }
16}
17
18s! {
19    pub struct statx {
20        pub stx_mask: u32,
21        pub stx_blksize: u32,
22        pub stx_attributes: u64,
23        pub stx_nlink: u32,
24        pub stx_uid: u32,
25        pub stx_gid: u32,
26        pub stx_mode: u16,
27        __statx_pad1: [u16; 1],
28        pub stx_ino: u64,
29        pub stx_size: u64,
30        pub stx_blocks: u64,
31        pub stx_attributes_mask: u64,
32        pub stx_atime: ::statx_timestamp,
33        pub stx_btime: ::statx_timestamp,
34        pub stx_ctime: ::statx_timestamp,
35        pub stx_mtime: ::statx_timestamp,
36        pub stx_rdev_major: u32,
37        pub stx_rdev_minor: u32,
38        pub stx_dev_major: u32,
39        pub stx_dev_minor: u32,
40        pub stx_mnt_id: u64,
41        pub stx_dio_mem_align: u32,
42        pub stx_dio_offset_align: u32,
43        __statx_pad3: [u64; 12],
44    }
45
46    pub struct statx_timestamp {
47        pub tv_sec: i64,
48        pub tv_nsec: u32,
49        pub __statx_timestamp_pad1: [i32; 1],
50    }
51
52    pub struct aiocb {
53        pub aio_fildes: ::c_int,
54        pub aio_lio_opcode: ::c_int,
55        pub aio_reqprio: ::c_int,
56        pub aio_buf: *mut ::c_void,
57        pub aio_nbytes: ::size_t,
58        pub aio_sigevent: ::sigevent,
59        __next_prio: *mut aiocb,
60        __abs_prio: ::c_int,
61        __policy: ::c_int,
62        __error_code: ::c_int,
63        __return_value: ::ssize_t,
64        pub aio_offset: off_t,
65        #[cfg(all(not(target_arch = "x86_64"), target_pointer_width = "32"))]
66        __unused1: [::c_char; 4],
67        __glibc_reserved: [::c_char; 32]
68    }
69
70    pub struct __exit_status {
71        pub e_termination: ::c_short,
72        pub e_exit: ::c_short,
73    }
74
75    pub struct __timeval {
76        pub tv_sec: i32,
77        pub tv_usec: i32,
78    }
79
80    pub struct glob64_t {
81        pub gl_pathc: ::size_t,
82        pub gl_pathv: *mut *mut ::c_char,
83        pub gl_offs: ::size_t,
84        pub gl_flags: ::c_int,
85
86        __unused1: *mut ::c_void,
87        __unused2: *mut ::c_void,
88        __unused3: *mut ::c_void,
89        __unused4: *mut ::c_void,
90        __unused5: *mut ::c_void,
91    }
92
93    pub struct msghdr {
94        pub msg_name: *mut ::c_void,
95        pub msg_namelen: ::socklen_t,
96        pub msg_iov: *mut ::iovec,
97        pub msg_iovlen: ::size_t,
98        pub msg_control: *mut ::c_void,
99        pub msg_controllen: ::size_t,
100        pub msg_flags: ::c_int,
101    }
102
103    pub struct cmsghdr {
104        pub cmsg_len: ::size_t,
105        pub cmsg_level: ::c_int,
106        pub cmsg_type: ::c_int,
107    }
108
109    pub struct termios {
110        pub c_iflag: ::tcflag_t,
111        pub c_oflag: ::tcflag_t,
112        pub c_cflag: ::tcflag_t,
113        pub c_lflag: ::tcflag_t,
114        pub c_line: ::cc_t,
115        pub c_cc: [::cc_t; ::NCCS],
116        #[cfg(not(any(
117            target_arch = "sparc",
118            target_arch = "sparc64",
119            target_arch = "mips",
120            target_arch = "mips32r6",
121            target_arch = "mips64",
122            target_arch = "mips64r6")))]
123        pub c_ispeed: ::speed_t,
124        #[cfg(not(any(
125            target_arch = "sparc",
126            target_arch = "sparc64",
127            target_arch = "mips",
128            target_arch = "mips32r6",
129            target_arch = "mips64",
130            target_arch = "mips64r6")))]
131        pub c_ospeed: ::speed_t,
132    }
133
134    pub struct mallinfo {
135        pub arena: ::c_int,
136        pub ordblks: ::c_int,
137        pub smblks: ::c_int,
138        pub hblks: ::c_int,
139        pub hblkhd: ::c_int,
140        pub usmblks: ::c_int,
141        pub fsmblks: ::c_int,
142        pub uordblks: ::c_int,
143        pub fordblks: ::c_int,
144        pub keepcost: ::c_int,
145    }
146
147    pub struct mallinfo2 {
148        pub arena: ::size_t,
149        pub ordblks: ::size_t,
150        pub smblks: ::size_t,
151        pub hblks: ::size_t,
152        pub hblkhd: ::size_t,
153        pub usmblks: ::size_t,
154        pub fsmblks: ::size_t,
155        pub uordblks: ::size_t,
156        pub fordblks: ::size_t,
157        pub keepcost: ::size_t,
158    }
159
160    pub struct nl_pktinfo {
161        pub group: u32,
162    }
163
164    pub struct nl_mmap_req {
165        pub nm_block_size: ::c_uint,
166        pub nm_block_nr: ::c_uint,
167        pub nm_frame_size: ::c_uint,
168        pub nm_frame_nr: ::c_uint,
169    }
170
171    pub struct nl_mmap_hdr {
172        pub nm_status: ::c_uint,
173        pub nm_len: ::c_uint,
174        pub nm_group: u32,
175        pub nm_pid: u32,
176        pub nm_uid: u32,
177        pub nm_gid: u32,
178    }
179
180    pub struct rtentry {
181        pub rt_pad1: ::c_ulong,
182        pub rt_dst: ::sockaddr,
183        pub rt_gateway: ::sockaddr,
184        pub rt_genmask: ::sockaddr,
185        pub rt_flags: ::c_ushort,
186        pub rt_pad2: ::c_short,
187        pub rt_pad3: ::c_ulong,
188        pub rt_tos: ::c_uchar,
189        pub rt_class: ::c_uchar,
190        #[cfg(target_pointer_width = "64")]
191        pub rt_pad4: [::c_short; 3usize],
192        #[cfg(not(target_pointer_width = "64"))]
193        pub rt_pad4: ::c_short,
194        pub rt_metric: ::c_short,
195        pub rt_dev: *mut ::c_char,
196        pub rt_mtu: ::c_ulong,
197        pub rt_window: ::c_ulong,
198        pub rt_irtt: ::c_ushort,
199    }
200
201    pub struct timex {
202        pub modes: ::c_uint,
203        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
204        pub offset: i64,
205        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
206        pub offset: ::c_long,
207        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
208        pub freq: i64,
209        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
210        pub freq: ::c_long,
211        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
212        pub maxerror: i64,
213        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
214        pub maxerror: ::c_long,
215        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
216        pub esterror: i64,
217        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
218        pub esterror: ::c_long,
219        pub status: ::c_int,
220        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
221        pub constant: i64,
222        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
223        pub constant: ::c_long,
224        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
225        pub precision: i64,
226        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
227        pub precision: ::c_long,
228        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
229        pub tolerance: i64,
230        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
231        pub tolerance: ::c_long,
232        pub time: ::timeval,
233        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
234        pub tick: i64,
235        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
236        pub tick: ::c_long,
237        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
238        pub ppsfreq: i64,
239        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
240        pub ppsfreq: ::c_long,
241        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
242        pub jitter: i64,
243        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
244        pub jitter: ::c_long,
245        pub shift: ::c_int,
246        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
247        pub stabil: i64,
248        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
249        pub stabil: ::c_long,
250        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
251        pub jitcnt: i64,
252        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
253        pub jitcnt: ::c_long,
254        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
255        pub calcnt: i64,
256        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
257        pub calcnt: ::c_long,
258        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
259        pub errcnt: i64,
260        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
261        pub errcnt: ::c_long,
262        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
263        pub stbcnt: i64,
264        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
265        pub stbcnt: ::c_long,
266        pub tai: ::c_int,
267        pub __unused1: i32,
268        pub __unused2: i32,
269        pub __unused3: i32,
270        pub __unused4: i32,
271        pub __unused5: i32,
272        pub __unused6: i32,
273        pub __unused7: i32,
274        pub __unused8: i32,
275        pub __unused9: i32,
276        pub __unused10: i32,
277        pub __unused11: i32,
278    }
279
280    pub struct ntptimeval {
281        pub time: ::timeval,
282        pub maxerror: ::c_long,
283        pub esterror: ::c_long,
284        pub tai: ::c_long,
285        pub __glibc_reserved1: ::c_long,
286        pub __glibc_reserved2: ::c_long,
287        pub __glibc_reserved3: ::c_long,
288        pub __glibc_reserved4: ::c_long,
289    }
290
291    pub struct regex_t {
292        __buffer: *mut ::c_void,
293        __allocated: ::size_t,
294        __used: ::size_t,
295        __syntax: ::c_ulong,
296        __fastmap: *mut ::c_char,
297        __translate: *mut ::c_char,
298        __re_nsub: ::size_t,
299        __bitfield: u8,
300    }
301
302    pub struct Elf64_Chdr {
303        pub ch_type: ::Elf64_Word,
304        pub ch_reserved: ::Elf64_Word,
305        pub ch_size: ::Elf64_Xword,
306        pub ch_addralign: ::Elf64_Xword,
307    }
308
309    pub struct Elf32_Chdr {
310        pub ch_type: ::Elf32_Word,
311        pub ch_size: ::Elf32_Word,
312        pub ch_addralign: ::Elf32_Word,
313    }
314
315    pub struct seminfo {
316        pub semmap: ::c_int,
317        pub semmni: ::c_int,
318        pub semmns: ::c_int,
319        pub semmnu: ::c_int,
320        pub semmsl: ::c_int,
321        pub semopm: ::c_int,
322        pub semume: ::c_int,
323        pub semusz: ::c_int,
324        pub semvmx: ::c_int,
325        pub semaem: ::c_int,
326    }
327
328    pub struct ptrace_peeksiginfo_args {
329        pub off: ::__u64,
330        pub flags: ::__u32,
331        pub nr: ::__s32,
332    }
333
334    pub struct __c_anonymous_ptrace_syscall_info_entry {
335        pub nr: ::__u64,
336        pub args: [::__u64; 6],
337    }
338
339    pub struct __c_anonymous_ptrace_syscall_info_exit {
340        pub sval: ::__s64,
341        pub is_error: ::__u8,
342    }
343
344    pub struct __c_anonymous_ptrace_syscall_info_seccomp {
345        pub nr: ::__u64,
346        pub args: [::__u64; 6],
347        pub ret_data: ::__u32,
348    }
349
350    pub struct ptrace_syscall_info {
351        pub op: ::__u8,
352        pub pad: [::__u8; 3],
353        pub arch: ::__u32,
354        pub instruction_pointer: ::__u64,
355        pub stack_pointer: ::__u64,
356        #[cfg(libc_union)]
357        pub u: __c_anonymous_ptrace_syscall_info_data,
358    }
359
360    // linux/if_xdp.h
361
362    pub struct sockaddr_xdp {
363        pub sxdp_family: ::__u16,
364        pub sxdp_flags: ::__u16,
365        pub sxdp_ifindex: ::__u32,
366        pub sxdp_queue_id: ::__u32,
367        pub sxdp_shared_umem_fd: ::__u32,
368    }
369
370    pub struct xdp_ring_offset {
371        pub producer: ::__u64,
372        pub consumer: ::__u64,
373        pub desc: ::__u64,
374        pub flags: ::__u64,
375    }
376
377    pub struct xdp_mmap_offsets {
378        pub rx: xdp_ring_offset,
379        pub tx: xdp_ring_offset,
380        pub fr: xdp_ring_offset,
381        pub cr: xdp_ring_offset,
382    }
383
384    pub struct xdp_ring_offset_v1 {
385        pub producer: ::__u64,
386        pub consumer: ::__u64,
387        pub desc: ::__u64,
388    }
389
390    pub struct xdp_mmap_offsets_v1 {
391        pub rx: xdp_ring_offset_v1,
392        pub tx: xdp_ring_offset_v1,
393        pub fr: xdp_ring_offset_v1,
394        pub cr: xdp_ring_offset_v1,
395    }
396
397    pub struct xdp_umem_reg {
398        pub addr: ::__u64,
399        pub len: ::__u64,
400        pub chunk_size: ::__u32,
401        pub headroom: ::__u32,
402        pub flags: ::__u32,
403    }
404
405    pub struct xdp_umem_reg_v1 {
406        pub addr: ::__u64,
407        pub len: ::__u64,
408        pub chunk_size: ::__u32,
409        pub headroom: ::__u32,
410    }
411
412    pub struct xdp_statistics {
413        pub rx_dropped: ::__u64,
414        pub rx_invalid_descs: ::__u64,
415        pub tx_invalid_descs: ::__u64,
416        pub rx_ring_full: ::__u64,
417        pub rx_fill_ring_empty_descs: ::__u64,
418        pub tx_ring_empty_descs: ::__u64,
419    }
420
421    pub struct xdp_statistics_v1 {
422        pub rx_dropped: ::__u64,
423        pub rx_invalid_descs: ::__u64,
424        pub tx_invalid_descs: ::__u64,
425    }
426
427    pub struct xdp_options {
428        pub flags: ::__u32,
429    }
430
431    pub struct xdp_desc {
432        pub addr: ::__u64,
433        pub len: ::__u32,
434        pub options: ::__u32,
435    }
436
437    pub struct iocb {
438        pub aio_data: ::__u64,
439        #[cfg(target_endian = "little")]
440        pub aio_key: ::__u32,
441        #[cfg(target_endian = "little")]
442        pub aio_rw_flags: ::__kernel_rwf_t,
443        #[cfg(target_endian = "big")]
444        pub aio_rw_flags: ::__kernel_rwf_t,
445        #[cfg(target_endian = "big")]
446        pub aio_key: ::__u32,
447        pub aio_lio_opcode: ::__u16,
448        pub aio_reqprio: ::__s16,
449        pub aio_fildes: ::__u32,
450        pub aio_buf: ::__u64,
451        pub aio_nbytes: ::__u64,
452        pub aio_offset: ::__s64,
453        aio_reserved2: ::__u64,
454        pub aio_flags: ::__u32,
455        pub aio_resfd: ::__u32,
456    }
457}
458
459impl siginfo_t {
460    pub unsafe fn si_addr(&self) -> *mut ::c_void {
461        #[repr(C)]
462        struct siginfo_sigfault {
463            _si_signo: ::c_int,
464            _si_errno: ::c_int,
465            _si_code: ::c_int,
466            si_addr: *mut ::c_void,
467        }
468        (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
469    }
470
471    pub unsafe fn si_value(&self) -> ::sigval {
472        #[repr(C)]
473        struct siginfo_timer {
474            _si_signo: ::c_int,
475            _si_errno: ::c_int,
476            _si_code: ::c_int,
477            _si_tid: ::c_int,
478            _si_overrun: ::c_int,
479            si_sigval: ::sigval,
480        }
481        (*(self as *const siginfo_t as *const siginfo_timer)).si_sigval
482    }
483}
484
485cfg_if! {
486    if #[cfg(libc_union)] {
487        // Internal, for casts to access union fields
488        #[repr(C)]
489        struct sifields_sigchld {
490            si_pid: ::pid_t,
491            si_uid: ::uid_t,
492            si_status: ::c_int,
493            si_utime: ::c_long,
494            si_stime: ::c_long,
495        }
496        impl ::Copy for sifields_sigchld {}
497        impl ::Clone for sifields_sigchld {
498            fn clone(&self) -> sifields_sigchld {
499                *self
500            }
501        }
502
503        // Internal, for casts to access union fields
504        #[repr(C)]
505        union sifields {
506            _align_pointer: *mut ::c_void,
507            sigchld: sifields_sigchld,
508        }
509
510        // Internal, for casts to access union fields. Note that some variants
511        // of sifields start with a pointer, which makes the alignment of
512        // sifields vary on 32-bit and 64-bit architectures.
513        #[repr(C)]
514        struct siginfo_f {
515            _siginfo_base: [::c_int; 3],
516            sifields: sifields,
517        }
518
519        impl siginfo_t {
520            unsafe fn sifields(&self) -> &sifields {
521                &(*(self as *const siginfo_t as *const siginfo_f)).sifields
522            }
523
524            pub unsafe fn si_pid(&self) -> ::pid_t {
525                self.sifields().sigchld.si_pid
526            }
527
528            pub unsafe fn si_uid(&self) -> ::uid_t {
529                self.sifields().sigchld.si_uid
530            }
531
532            pub unsafe fn si_status(&self) -> ::c_int {
533                self.sifields().sigchld.si_status
534            }
535
536            pub unsafe fn si_utime(&self) -> ::c_long {
537                self.sifields().sigchld.si_utime
538            }
539
540            pub unsafe fn si_stime(&self) -> ::c_long {
541                self.sifields().sigchld.si_stime
542            }
543        }
544
545        pub union __c_anonymous_ptrace_syscall_info_data {
546            pub entry: __c_anonymous_ptrace_syscall_info_entry,
547            pub exit: __c_anonymous_ptrace_syscall_info_exit,
548            pub seccomp: __c_anonymous_ptrace_syscall_info_seccomp,
549        }
550        impl ::Copy for __c_anonymous_ptrace_syscall_info_data {}
551        impl ::Clone for __c_anonymous_ptrace_syscall_info_data {
552            fn clone(&self) -> __c_anonymous_ptrace_syscall_info_data {
553                *self
554            }
555        }
556    }
557}
558
559s_no_extra_traits! {
560    pub struct utmpx {
561        pub ut_type: ::c_short,
562        pub ut_pid: ::pid_t,
563        pub ut_line: [::c_char; __UT_LINESIZE],
564        pub ut_id: [::c_char; 4],
565
566        pub ut_user: [::c_char; __UT_NAMESIZE],
567        pub ut_host: [::c_char; __UT_HOSTSIZE],
568        pub ut_exit: __exit_status,
569
570        #[cfg(any(target_arch = "aarch64",
571                  target_arch = "s390x",
572                  target_arch = "loongarch64",
573                  all(target_pointer_width = "32",
574                      not(target_arch = "x86_64"))))]
575        pub ut_session: ::c_long,
576        #[cfg(any(target_arch = "aarch64",
577                  target_arch = "s390x",
578                  target_arch = "loongarch64",
579                  all(target_pointer_width = "32",
580                      not(target_arch = "x86_64"))))]
581        pub ut_tv: ::timeval,
582
583        #[cfg(not(any(target_arch = "aarch64",
584                      target_arch = "s390x",
585                      target_arch = "loongarch64",
586                      all(target_pointer_width = "32",
587                          not(target_arch = "x86_64")))))]
588        pub ut_session: i32,
589        #[cfg(not(any(target_arch = "aarch64",
590                      target_arch = "s390x",
591                      target_arch = "loongarch64",
592                      all(target_pointer_width = "32",
593                          not(target_arch = "x86_64")))))]
594        pub ut_tv: __timeval,
595
596        pub ut_addr_v6: [i32; 4],
597        __glibc_reserved: [::c_char; 20],
598    }
599}
600
601cfg_if! {
602    if #[cfg(feature = "extra_traits")] {
603        impl PartialEq for utmpx {
604            fn eq(&self, other: &utmpx) -> bool {
605                self.ut_type == other.ut_type
606                    && self.ut_pid == other.ut_pid
607                    && self.ut_line == other.ut_line
608                    && self.ut_id == other.ut_id
609                    && self.ut_user == other.ut_user
610                    && self
611                    .ut_host
612                    .iter()
613                    .zip(other.ut_host.iter())
614                    .all(|(a,b)| a == b)
615                    && self.ut_exit == other.ut_exit
616                    && self.ut_session == other.ut_session
617                    && self.ut_tv == other.ut_tv
618                    && self.ut_addr_v6 == other.ut_addr_v6
619                    && self.__glibc_reserved == other.__glibc_reserved
620            }
621        }
622
623        impl Eq for utmpx {}
624
625        impl ::fmt::Debug for utmpx {
626            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
627                f.debug_struct("utmpx")
628                    .field("ut_type", &self.ut_type)
629                    .field("ut_pid", &self.ut_pid)
630                    .field("ut_line", &self.ut_line)
631                    .field("ut_id", &self.ut_id)
632                    .field("ut_user", &self.ut_user)
633                // FIXME: .field("ut_host", &self.ut_host)
634                    .field("ut_exit", &self.ut_exit)
635                    .field("ut_session", &self.ut_session)
636                    .field("ut_tv", &self.ut_tv)
637                    .field("ut_addr_v6", &self.ut_addr_v6)
638                    .field("__glibc_reserved", &self.__glibc_reserved)
639                    .finish()
640            }
641        }
642
643        impl ::hash::Hash for utmpx {
644            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
645                self.ut_type.hash(state);
646                self.ut_pid.hash(state);
647                self.ut_line.hash(state);
648                self.ut_id.hash(state);
649                self.ut_user.hash(state);
650                self.ut_host.hash(state);
651                self.ut_exit.hash(state);
652                self.ut_session.hash(state);
653                self.ut_tv.hash(state);
654                self.ut_addr_v6.hash(state);
655                self.__glibc_reserved.hash(state);
656            }
657        }
658
659        #[cfg(libc_union)]
660        impl PartialEq for __c_anonymous_ptrace_syscall_info_data {
661            fn eq(&self, other: &__c_anonymous_ptrace_syscall_info_data) -> bool {
662                unsafe {
663                self.entry == other.entry ||
664                    self.exit == other.exit ||
665                    self.seccomp == other.seccomp
666                }
667            }
668        }
669
670        #[cfg(libc_union)]
671        impl Eq for __c_anonymous_ptrace_syscall_info_data {}
672
673        #[cfg(libc_union)]
674        impl ::fmt::Debug for __c_anonymous_ptrace_syscall_info_data {
675            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
676                unsafe {
677                f.debug_struct("__c_anonymous_ptrace_syscall_info_data")
678                    .field("entry", &self.entry)
679                    .field("exit", &self.exit)
680                    .field("seccomp", &self.seccomp)
681                    .finish()
682                }
683            }
684        }
685
686        #[cfg(libc_union)]
687        impl ::hash::Hash for __c_anonymous_ptrace_syscall_info_data {
688            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
689                unsafe {
690                self.entry.hash(state);
691                self.exit.hash(state);
692                self.seccomp.hash(state);
693                }
694            }
695        }
696    }
697}
698
699// include/uapi/asm-generic/hugetlb_encode.h
700pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26;
701pub const HUGETLB_FLAG_ENCODE_MASK: ::c_int = 0x3f;
702
703pub const HUGETLB_FLAG_ENCODE_64KB: ::c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT;
704pub const HUGETLB_FLAG_ENCODE_512KB: ::c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT;
705pub const HUGETLB_FLAG_ENCODE_1MB: ::c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT;
706pub const HUGETLB_FLAG_ENCODE_2MB: ::c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT;
707pub const HUGETLB_FLAG_ENCODE_8MB: ::c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT;
708pub const HUGETLB_FLAG_ENCODE_16MB: ::c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT;
709pub const HUGETLB_FLAG_ENCODE_32MB: ::c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT;
710pub const HUGETLB_FLAG_ENCODE_256MB: ::c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT;
711pub const HUGETLB_FLAG_ENCODE_512MB: ::c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT;
712pub const HUGETLB_FLAG_ENCODE_1GB: ::c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT;
713pub const HUGETLB_FLAG_ENCODE_2GB: ::c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT;
714pub const HUGETLB_FLAG_ENCODE_16GB: ::c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT;
715
716// include/uapi/linux/mman.h
717/*
718 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
719 * size other than the default is desired.  See hugetlb_encode.h.
720 * All known huge page size encodings are provided here.  It is the
721 * responsibility of the application to know which sizes are supported on
722 * the running system.  See mmap(2) man page for details.
723 */
724pub const MAP_HUGE_SHIFT: ::c_int = HUGETLB_FLAG_ENCODE_SHIFT;
725pub const MAP_HUGE_MASK: ::c_int = HUGETLB_FLAG_ENCODE_MASK;
726
727pub const MAP_HUGE_64KB: ::c_int = HUGETLB_FLAG_ENCODE_64KB;
728pub const MAP_HUGE_512KB: ::c_int = HUGETLB_FLAG_ENCODE_512KB;
729pub const MAP_HUGE_1MB: ::c_int = HUGETLB_FLAG_ENCODE_1MB;
730pub const MAP_HUGE_2MB: ::c_int = HUGETLB_FLAG_ENCODE_2MB;
731pub const MAP_HUGE_8MB: ::c_int = HUGETLB_FLAG_ENCODE_8MB;
732pub const MAP_HUGE_16MB: ::c_int = HUGETLB_FLAG_ENCODE_16MB;
733pub const MAP_HUGE_32MB: ::c_int = HUGETLB_FLAG_ENCODE_32MB;
734pub const MAP_HUGE_256MB: ::c_int = HUGETLB_FLAG_ENCODE_256MB;
735pub const MAP_HUGE_512MB: ::c_int = HUGETLB_FLAG_ENCODE_512MB;
736pub const MAP_HUGE_1GB: ::c_int = HUGETLB_FLAG_ENCODE_1GB;
737pub const MAP_HUGE_2GB: ::c_int = HUGETLB_FLAG_ENCODE_2GB;
738pub const MAP_HUGE_16GB: ::c_int = HUGETLB_FLAG_ENCODE_16GB;
739
740pub const PRIO_PROCESS: ::__priority_which_t = 0;
741pub const PRIO_PGRP: ::__priority_which_t = 1;
742pub const PRIO_USER: ::__priority_which_t = 2;
743
744pub const MS_RMT_MASK: ::c_ulong = 0x02800051;
745
746pub const __UT_LINESIZE: usize = 32;
747pub const __UT_NAMESIZE: usize = 32;
748pub const __UT_HOSTSIZE: usize = 256;
749pub const EMPTY: ::c_short = 0;
750pub const RUN_LVL: ::c_short = 1;
751pub const BOOT_TIME: ::c_short = 2;
752pub const NEW_TIME: ::c_short = 3;
753pub const OLD_TIME: ::c_short = 4;
754pub const INIT_PROCESS: ::c_short = 5;
755pub const LOGIN_PROCESS: ::c_short = 6;
756pub const USER_PROCESS: ::c_short = 7;
757pub const DEAD_PROCESS: ::c_short = 8;
758pub const ACCOUNTING: ::c_short = 9;
759
760// dlfcn.h
761pub const LM_ID_BASE: ::c_long = 0;
762pub const LM_ID_NEWLM: ::c_long = -1;
763
764pub const RTLD_DI_LMID: ::c_int = 1;
765pub const RTLD_DI_LINKMAP: ::c_int = 2;
766pub const RTLD_DI_CONFIGADDR: ::c_int = 3;
767pub const RTLD_DI_SERINFO: ::c_int = 4;
768pub const RTLD_DI_SERINFOSIZE: ::c_int = 5;
769pub const RTLD_DI_ORIGIN: ::c_int = 6;
770pub const RTLD_DI_PROFILENAME: ::c_int = 7;
771pub const RTLD_DI_PROFILEOUT: ::c_int = 8;
772pub const RTLD_DI_TLS_MODID: ::c_int = 9;
773pub const RTLD_DI_TLS_DATA: ::c_int = 10;
774
775pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
776pub const PIDFD_NONBLOCK: ::c_uint = O_NONBLOCK as ::c_uint;
777
778pub const SOL_RXRPC: ::c_int = 272;
779pub const SOL_PPPOL2TP: ::c_int = 273;
780pub const SOL_PNPIPE: ::c_int = 275;
781pub const SOL_RDS: ::c_int = 276;
782pub const SOL_IUCV: ::c_int = 277;
783pub const SOL_CAIF: ::c_int = 278;
784pub const SOL_NFC: ::c_int = 280;
785pub const SOL_XDP: ::c_int = 283;
786
787pub const MSG_TRYHARD: ::c_int = 4;
788
789pub const LC_PAPER: ::c_int = 7;
790pub const LC_NAME: ::c_int = 8;
791pub const LC_ADDRESS: ::c_int = 9;
792pub const LC_TELEPHONE: ::c_int = 10;
793pub const LC_MEASUREMENT: ::c_int = 11;
794pub const LC_IDENTIFICATION: ::c_int = 12;
795pub const LC_PAPER_MASK: ::c_int = 1 << LC_PAPER;
796pub const LC_NAME_MASK: ::c_int = 1 << LC_NAME;
797pub const LC_ADDRESS_MASK: ::c_int = 1 << LC_ADDRESS;
798pub const LC_TELEPHONE_MASK: ::c_int = 1 << LC_TELEPHONE;
799pub const LC_MEASUREMENT_MASK: ::c_int = 1 << LC_MEASUREMENT;
800pub const LC_IDENTIFICATION_MASK: ::c_int = 1 << LC_IDENTIFICATION;
801pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
802    | ::LC_NUMERIC_MASK
803    | ::LC_TIME_MASK
804    | ::LC_COLLATE_MASK
805    | ::LC_MONETARY_MASK
806    | ::LC_MESSAGES_MASK
807    | LC_PAPER_MASK
808    | LC_NAME_MASK
809    | LC_ADDRESS_MASK
810    | LC_TELEPHONE_MASK
811    | LC_MEASUREMENT_MASK
812    | LC_IDENTIFICATION_MASK;
813
814pub const ENOTSUP: ::c_int = EOPNOTSUPP;
815
816pub const SOCK_SEQPACKET: ::c_int = 5;
817pub const SOCK_DCCP: ::c_int = 6;
818pub const SOCK_PACKET: ::c_int = 10;
819
820pub const AF_IB: ::c_int = 27;
821pub const AF_MPLS: ::c_int = 28;
822pub const AF_NFC: ::c_int = 39;
823pub const AF_VSOCK: ::c_int = 40;
824pub const AF_XDP: ::c_int = 44;
825pub const PF_IB: ::c_int = AF_IB;
826pub const PF_MPLS: ::c_int = AF_MPLS;
827pub const PF_NFC: ::c_int = AF_NFC;
828pub const PF_VSOCK: ::c_int = AF_VSOCK;
829pub const PF_XDP: ::c_int = AF_XDP;
830
831pub const SIGEV_THREAD_ID: ::c_int = 4;
832
833pub const BUFSIZ: ::c_uint = 8192;
834pub const TMP_MAX: ::c_uint = 238328;
835pub const FOPEN_MAX: ::c_uint = 16;
836pub const FILENAME_MAX: ::c_uint = 4096;
837pub const POSIX_MADV_DONTNEED: ::c_int = 4;
838pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
839pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
840pub const _SC_PII: ::c_int = 53;
841pub const _SC_PII_XTI: ::c_int = 54;
842pub const _SC_PII_SOCKET: ::c_int = 55;
843pub const _SC_PII_INTERNET: ::c_int = 56;
844pub const _SC_PII_OSI: ::c_int = 57;
845pub const _SC_POLL: ::c_int = 58;
846pub const _SC_SELECT: ::c_int = 59;
847pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
848pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
849pub const _SC_PII_OSI_COTS: ::c_int = 63;
850pub const _SC_PII_OSI_CLTS: ::c_int = 64;
851pub const _SC_PII_OSI_M: ::c_int = 65;
852pub const _SC_T_IOV_MAX: ::c_int = 66;
853pub const _SC_2_C_VERSION: ::c_int = 96;
854pub const _SC_CHAR_BIT: ::c_int = 101;
855pub const _SC_CHAR_MAX: ::c_int = 102;
856pub const _SC_CHAR_MIN: ::c_int = 103;
857pub const _SC_INT_MAX: ::c_int = 104;
858pub const _SC_INT_MIN: ::c_int = 105;
859pub const _SC_LONG_BIT: ::c_int = 106;
860pub const _SC_WORD_BIT: ::c_int = 107;
861pub const _SC_MB_LEN_MAX: ::c_int = 108;
862pub const _SC_SSIZE_MAX: ::c_int = 110;
863pub const _SC_SCHAR_MAX: ::c_int = 111;
864pub const _SC_SCHAR_MIN: ::c_int = 112;
865pub const _SC_SHRT_MAX: ::c_int = 113;
866pub const _SC_SHRT_MIN: ::c_int = 114;
867pub const _SC_UCHAR_MAX: ::c_int = 115;
868pub const _SC_UINT_MAX: ::c_int = 116;
869pub const _SC_ULONG_MAX: ::c_int = 117;
870pub const _SC_USHRT_MAX: ::c_int = 118;
871pub const _SC_NL_ARGMAX: ::c_int = 119;
872pub const _SC_NL_LANGMAX: ::c_int = 120;
873pub const _SC_NL_MSGMAX: ::c_int = 121;
874pub const _SC_NL_NMAX: ::c_int = 122;
875pub const _SC_NL_SETMAX: ::c_int = 123;
876pub const _SC_NL_TEXTMAX: ::c_int = 124;
877pub const _SC_BASE: ::c_int = 134;
878pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
879pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
880pub const _SC_DEVICE_IO: ::c_int = 140;
881pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
882pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
883pub const _SC_FD_MGMT: ::c_int = 143;
884pub const _SC_FIFO: ::c_int = 144;
885pub const _SC_PIPE: ::c_int = 145;
886pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
887pub const _SC_FILE_LOCKING: ::c_int = 147;
888pub const _SC_FILE_SYSTEM: ::c_int = 148;
889pub const _SC_MULTI_PROCESS: ::c_int = 150;
890pub const _SC_SINGLE_PROCESS: ::c_int = 151;
891pub const _SC_NETWORKING: ::c_int = 152;
892pub const _SC_REGEX_VERSION: ::c_int = 156;
893pub const _SC_SIGNALS: ::c_int = 158;
894pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
895pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
896pub const _SC_USER_GROUPS: ::c_int = 166;
897pub const _SC_USER_GROUPS_R: ::c_int = 167;
898pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
899pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
900pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
901pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
902pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
903pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
904pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
905pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
906pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
907pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
908pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
909pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
910pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
911pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
912pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
913pub const O_ACCMODE: ::c_int = 3;
914pub const ST_RELATIME: ::c_ulong = 4096;
915pub const NI_MAXHOST: ::socklen_t = 1025;
916
917// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
918// following are only available on newer Linux versions than the versions
919// currently used in CI in some configurations, so we define them here.
920cfg_if! {
921    if #[cfg(not(target_arch = "s390x"))] {
922        pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
923        pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
924    } else if #[cfg(target_arch = "s390x")] {
925        pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70;
926        pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342;
927    }
928}
929
930pub const CPU_SETSIZE: ::c_int = 0x400;
931
932pub const PTRACE_TRACEME: ::c_uint = 0;
933pub const PTRACE_PEEKTEXT: ::c_uint = 1;
934pub const PTRACE_PEEKDATA: ::c_uint = 2;
935pub const PTRACE_PEEKUSER: ::c_uint = 3;
936pub const PTRACE_POKETEXT: ::c_uint = 4;
937pub const PTRACE_POKEDATA: ::c_uint = 5;
938pub const PTRACE_POKEUSER: ::c_uint = 6;
939pub const PTRACE_CONT: ::c_uint = 7;
940pub const PTRACE_KILL: ::c_uint = 8;
941pub const PTRACE_SINGLESTEP: ::c_uint = 9;
942pub const PTRACE_ATTACH: ::c_uint = 16;
943pub const PTRACE_SYSCALL: ::c_uint = 24;
944pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
945pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
946pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
947pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
948pub const PTRACE_GETREGSET: ::c_uint = 0x4204;
949pub const PTRACE_SETREGSET: ::c_uint = 0x4205;
950pub const PTRACE_SEIZE: ::c_uint = 0x4206;
951pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
952pub const PTRACE_LISTEN: ::c_uint = 0x4208;
953pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
954pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a;
955pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b;
956pub const PTRACE_GET_SYSCALL_INFO: ::c_uint = 0x420e;
957pub const PTRACE_SYSCALL_INFO_NONE: ::__u8 = 0;
958pub const PTRACE_SYSCALL_INFO_ENTRY: ::__u8 = 1;
959pub const PTRACE_SYSCALL_INFO_EXIT: ::__u8 = 2;
960pub const PTRACE_SYSCALL_INFO_SECCOMP: ::__u8 = 3;
961
962// linux/fs.h
963
964// Flags for preadv2/pwritev2
965pub const RWF_HIPRI: ::c_int = 0x00000001;
966pub const RWF_DSYNC: ::c_int = 0x00000002;
967pub const RWF_SYNC: ::c_int = 0x00000004;
968pub const RWF_NOWAIT: ::c_int = 0x00000008;
969pub const RWF_APPEND: ::c_int = 0x00000010;
970
971// linux/rtnetlink.h
972pub const TCA_PAD: ::c_ushort = 9;
973pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10;
974pub const TCA_CHAIN: ::c_ushort = 11;
975pub const TCA_HW_OFFLOAD: ::c_ushort = 12;
976
977pub const RTM_DELNETCONF: u16 = 81;
978pub const RTM_NEWSTATS: u16 = 92;
979pub const RTM_GETSTATS: u16 = 94;
980pub const RTM_NEWCACHEREPORT: u16 = 96;
981
982pub const RTM_F_LOOKUP_TABLE: ::c_uint = 0x1000;
983pub const RTM_F_FIB_MATCH: ::c_uint = 0x2000;
984
985pub const RTA_VIA: ::c_ushort = 18;
986pub const RTA_NEWDST: ::c_ushort = 19;
987pub const RTA_PREF: ::c_ushort = 20;
988pub const RTA_ENCAP_TYPE: ::c_ushort = 21;
989pub const RTA_ENCAP: ::c_ushort = 22;
990pub const RTA_EXPIRES: ::c_ushort = 23;
991pub const RTA_PAD: ::c_ushort = 24;
992pub const RTA_UID: ::c_ushort = 25;
993pub const RTA_TTL_PROPAGATE: ::c_ushort = 26;
994
995// linux/neighbor.h
996pub const NTF_EXT_LEARNED: u8 = 0x10;
997pub const NTF_OFFLOADED: u8 = 0x20;
998
999pub const NDA_MASTER: ::c_ushort = 9;
1000pub const NDA_LINK_NETNSID: ::c_ushort = 10;
1001pub const NDA_SRC_VNI: ::c_ushort = 11;
1002
1003// linux/personality.h
1004pub const UNAME26: ::c_int = 0x0020000;
1005pub const FDPIC_FUNCPTRS: ::c_int = 0x0080000;
1006
1007// linux/if_addr.h
1008pub const IFA_FLAGS: ::c_ushort = 8;
1009
1010pub const IFA_F_MANAGETEMPADDR: u32 = 0x100;
1011pub const IFA_F_NOPREFIXROUTE: u32 = 0x200;
1012pub const IFA_F_MCAUTOJOIN: u32 = 0x400;
1013pub const IFA_F_STABLE_PRIVACY: u32 = 0x800;
1014
1015pub const MAX_LINKS: ::c_int = 32;
1016
1017pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10;
1018
1019pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1;
1020pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2;
1021
1022// linux/if_xdp.h
1023pub const XDP_SHARED_UMEM: ::__u16 = 1 << 0;
1024pub const XDP_COPY: ::__u16 = 1 << 1;
1025pub const XDP_ZEROCOPY: ::__u16 = 1 << 2;
1026pub const XDP_USE_NEED_WAKEUP: ::__u16 = 1 << 3;
1027pub const XDP_USE_SG: ::__u16 = 1 << 4;
1028
1029pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: ::__u32 = 1 << 0;
1030
1031pub const XDP_RING_NEED_WAKEUP: ::__u32 = 1 << 0;
1032
1033pub const XDP_MMAP_OFFSETS: ::c_int = 1;
1034pub const XDP_RX_RING: ::c_int = 2;
1035pub const XDP_TX_RING: ::c_int = 3;
1036pub const XDP_UMEM_REG: ::c_int = 4;
1037pub const XDP_UMEM_FILL_RING: ::c_int = 5;
1038pub const XDP_UMEM_COMPLETION_RING: ::c_int = 6;
1039pub const XDP_STATISTICS: ::c_int = 7;
1040pub const XDP_OPTIONS: ::c_int = 8;
1041
1042pub const XDP_OPTIONS_ZEROCOPY: ::__u32 = 1 << 0;
1043
1044pub const XDP_PGOFF_RX_RING: ::off_t = 0;
1045pub const XDP_PGOFF_TX_RING: ::off_t = 0x80000000;
1046pub const XDP_UMEM_PGOFF_FILL_RING: ::c_ulonglong = 0x100000000;
1047pub const XDP_UMEM_PGOFF_COMPLETION_RING: ::c_ulonglong = 0x180000000;
1048
1049pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: ::c_int = 48;
1050pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1;
1051
1052pub const XDP_PKT_CONTD: ::__u32 = 1 << 0;
1053
1054// elf.h
1055pub const NT_PRSTATUS: ::c_int = 1;
1056pub const NT_PRFPREG: ::c_int = 2;
1057pub const NT_FPREGSET: ::c_int = 2;
1058pub const NT_PRPSINFO: ::c_int = 3;
1059pub const NT_PRXREG: ::c_int = 4;
1060pub const NT_TASKSTRUCT: ::c_int = 4;
1061pub const NT_PLATFORM: ::c_int = 5;
1062pub const NT_AUXV: ::c_int = 6;
1063pub const NT_GWINDOWS: ::c_int = 7;
1064pub const NT_ASRS: ::c_int = 8;
1065pub const NT_PSTATUS: ::c_int = 10;
1066pub const NT_PSINFO: ::c_int = 13;
1067pub const NT_PRCRED: ::c_int = 14;
1068pub const NT_UTSNAME: ::c_int = 15;
1069pub const NT_LWPSTATUS: ::c_int = 16;
1070pub const NT_LWPSINFO: ::c_int = 17;
1071pub const NT_PRFPXREG: ::c_int = 20;
1072
1073pub const ELFOSABI_ARM_AEABI: u8 = 64;
1074
1075// linux/sched.h
1076pub const CLONE_NEWTIME: ::c_int = 0x80;
1077pub const CLONE_CLEAR_SIGHAND: ::c_int = 0x100000000;
1078pub const CLONE_INTO_CGROUP: ::c_int = 0x200000000;
1079
1080// linux/keyctl.h
1081pub const KEYCTL_DH_COMPUTE: u32 = 23;
1082pub const KEYCTL_PKEY_QUERY: u32 = 24;
1083pub const KEYCTL_PKEY_ENCRYPT: u32 = 25;
1084pub const KEYCTL_PKEY_DECRYPT: u32 = 26;
1085pub const KEYCTL_PKEY_SIGN: u32 = 27;
1086pub const KEYCTL_PKEY_VERIFY: u32 = 28;
1087pub const KEYCTL_RESTRICT_KEYRING: u32 = 29;
1088
1089pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01;
1090pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02;
1091pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04;
1092pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08;
1093cfg_if! {
1094    if #[cfg(not(any(target_arch = "mips",
1095                     target_arch = "mips32r6",
1096                     target_arch = "mips64",
1097                     target_arch = "mips64r6")))] {
1098        pub const KEYCTL_MOVE: u32 = 30;
1099        pub const KEYCTL_CAPABILITIES: u32 = 31;
1100
1101        pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01;
1102        pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02;
1103        pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04;
1104        pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08;
1105        pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10;
1106        pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20;
1107        pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40;
1108        pub const KEYCTL_CAPS0_MOVE: u32 = 0x80;
1109        pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01;
1110        pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02;
1111    }
1112}
1113
1114pub const M_MXFAST: ::c_int = 1;
1115pub const M_NLBLKS: ::c_int = 2;
1116pub const M_GRAIN: ::c_int = 3;
1117pub const M_KEEP: ::c_int = 4;
1118pub const M_TRIM_THRESHOLD: ::c_int = -1;
1119pub const M_TOP_PAD: ::c_int = -2;
1120pub const M_MMAP_THRESHOLD: ::c_int = -3;
1121pub const M_MMAP_MAX: ::c_int = -4;
1122pub const M_CHECK_ACTION: ::c_int = -5;
1123pub const M_PERTURB: ::c_int = -6;
1124pub const M_ARENA_TEST: ::c_int = -7;
1125pub const M_ARENA_MAX: ::c_int = -8;
1126
1127pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000;
1128pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000;
1129pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000;
1130pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000;
1131pub const STATX_TYPE: ::c_uint = 0x0001;
1132pub const STATX_MODE: ::c_uint = 0x0002;
1133pub const STATX_NLINK: ::c_uint = 0x0004;
1134pub const STATX_UID: ::c_uint = 0x0008;
1135pub const STATX_GID: ::c_uint = 0x0010;
1136pub const STATX_ATIME: ::c_uint = 0x0020;
1137pub const STATX_MTIME: ::c_uint = 0x0040;
1138pub const STATX_CTIME: ::c_uint = 0x0080;
1139pub const STATX_INO: ::c_uint = 0x0100;
1140pub const STATX_SIZE: ::c_uint = 0x0200;
1141pub const STATX_BLOCKS: ::c_uint = 0x0400;
1142pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
1143pub const STATX_BTIME: ::c_uint = 0x0800;
1144pub const STATX_MNT_ID: ::c_uint = 0x1000;
1145pub const STATX_DIOALIGN: ::c_uint = 0x2000;
1146pub const STATX_ALL: ::c_uint = 0x0fff;
1147pub const STATX__RESERVED: ::c_int = 0x80000000;
1148pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
1149pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
1150pub const STATX_ATTR_APPEND: ::c_int = 0x0020;
1151pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
1152pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
1153pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
1154pub const STATX_ATTR_MOUNT_ROOT: ::c_int = 0x2000;
1155pub const STATX_ATTR_VERITY: ::c_int = 0x00100000;
1156pub const STATX_ATTR_DAX: ::c_int = 0x00200000;
1157
1158pub const SOMAXCONN: ::c_int = 4096;
1159
1160// linux/mount.h
1161pub const MOVE_MOUNT_F_SYMLINKS: ::c_uint = 0x00000001;
1162pub const MOVE_MOUNT_F_AUTOMOUNTS: ::c_uint = 0x00000002;
1163pub const MOVE_MOUNT_F_EMPTY_PATH: ::c_uint = 0x00000004;
1164pub const MOVE_MOUNT_T_SYMLINKS: ::c_uint = 0x00000010;
1165pub const MOVE_MOUNT_T_AUTOMOUNTS: ::c_uint = 0x00000020;
1166pub const MOVE_MOUNT_T_EMPTY_PATH: ::c_uint = 0x00000040;
1167pub const MOVE_MOUNT_SET_GROUP: ::c_uint = 0x00000100;
1168pub const MOVE_MOUNT_BENEATH: ::c_uint = 0x00000200;
1169
1170// sys/timex.h
1171pub const ADJ_OFFSET: ::c_uint = 0x0001;
1172pub const ADJ_FREQUENCY: ::c_uint = 0x0002;
1173pub const ADJ_MAXERROR: ::c_uint = 0x0004;
1174pub const ADJ_ESTERROR: ::c_uint = 0x0008;
1175pub const ADJ_STATUS: ::c_uint = 0x0010;
1176pub const ADJ_TIMECONST: ::c_uint = 0x0020;
1177pub const ADJ_TAI: ::c_uint = 0x0080;
1178pub const ADJ_SETOFFSET: ::c_uint = 0x0100;
1179pub const ADJ_MICRO: ::c_uint = 0x1000;
1180pub const ADJ_NANO: ::c_uint = 0x2000;
1181pub const ADJ_TICK: ::c_uint = 0x4000;
1182pub const ADJ_OFFSET_SINGLESHOT: ::c_uint = 0x8001;
1183pub const ADJ_OFFSET_SS_READ: ::c_uint = 0xa001;
1184pub const MOD_OFFSET: ::c_uint = ADJ_OFFSET;
1185pub const MOD_FREQUENCY: ::c_uint = ADJ_FREQUENCY;
1186pub const MOD_MAXERROR: ::c_uint = ADJ_MAXERROR;
1187pub const MOD_ESTERROR: ::c_uint = ADJ_ESTERROR;
1188pub const MOD_STATUS: ::c_uint = ADJ_STATUS;
1189pub const MOD_TIMECONST: ::c_uint = ADJ_TIMECONST;
1190pub const MOD_CLKB: ::c_uint = ADJ_TICK;
1191pub const MOD_CLKA: ::c_uint = ADJ_OFFSET_SINGLESHOT;
1192pub const MOD_TAI: ::c_uint = ADJ_TAI;
1193pub const MOD_MICRO: ::c_uint = ADJ_MICRO;
1194pub const MOD_NANO: ::c_uint = ADJ_NANO;
1195pub const STA_PLL: ::c_int = 0x0001;
1196pub const STA_PPSFREQ: ::c_int = 0x0002;
1197pub const STA_PPSTIME: ::c_int = 0x0004;
1198pub const STA_FLL: ::c_int = 0x0008;
1199pub const STA_INS: ::c_int = 0x0010;
1200pub const STA_DEL: ::c_int = 0x0020;
1201pub const STA_UNSYNC: ::c_int = 0x0040;
1202pub const STA_FREQHOLD: ::c_int = 0x0080;
1203pub const STA_PPSSIGNAL: ::c_int = 0x0100;
1204pub const STA_PPSJITTER: ::c_int = 0x0200;
1205pub const STA_PPSWANDER: ::c_int = 0x0400;
1206pub const STA_PPSERROR: ::c_int = 0x0800;
1207pub const STA_CLOCKERR: ::c_int = 0x1000;
1208pub const STA_NANO: ::c_int = 0x2000;
1209pub const STA_MODE: ::c_int = 0x4000;
1210pub const STA_CLK: ::c_int = 0x8000;
1211pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
1212    | STA_PPSJITTER
1213    | STA_PPSWANDER
1214    | STA_PPSERROR
1215    | STA_CLOCKERR
1216    | STA_NANO
1217    | STA_MODE
1218    | STA_CLK;
1219pub const NTP_API: ::c_int = 4;
1220pub const TIME_OK: ::c_int = 0;
1221pub const TIME_INS: ::c_int = 1;
1222pub const TIME_DEL: ::c_int = 2;
1223pub const TIME_OOP: ::c_int = 3;
1224pub const TIME_WAIT: ::c_int = 4;
1225pub const TIME_ERROR: ::c_int = 5;
1226pub const TIME_BAD: ::c_int = TIME_ERROR;
1227pub const MAXTC: ::c_long = 6;
1228
1229// Portable GLOB_* flags are defined at the `linux_like` level.
1230// The following are GNU extensions.
1231pub const GLOB_PERIOD: ::c_int = 1 << 7;
1232pub const GLOB_ALTDIRFUNC: ::c_int = 1 << 9;
1233pub const GLOB_BRACE: ::c_int = 1 << 10;
1234pub const GLOB_NOMAGIC: ::c_int = 1 << 11;
1235pub const GLOB_TILDE: ::c_int = 1 << 12;
1236pub const GLOB_ONLYDIR: ::c_int = 1 << 13;
1237pub const GLOB_TILDE_CHECK: ::c_int = 1 << 14;
1238
1239pub const MADV_COLLAPSE: ::c_int = 25;
1240
1241cfg_if! {
1242    if #[cfg(any(
1243        target_arch = "arm",
1244        target_arch = "x86",
1245        target_arch = "x86_64",
1246        target_arch = "s390x",
1247        target_arch = "riscv64",
1248        target_arch = "riscv32"
1249    ))] {
1250        pub const PTHREAD_STACK_MIN: ::size_t = 16384;
1251    } else if #[cfg(any(
1252               target_arch = "sparc",
1253               target_arch = "sparc64"
1254           ))] {
1255        pub const PTHREAD_STACK_MIN: ::size_t = 0x6000;
1256    } else {
1257        pub const PTHREAD_STACK_MIN: ::size_t = 131072;
1258    }
1259}
1260pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3;
1261
1262pub const REG_STARTEND: ::c_int = 4;
1263
1264pub const REG_EEND: ::c_int = 14;
1265pub const REG_ESIZE: ::c_int = 15;
1266pub const REG_ERPAREN: ::c_int = 16;
1267
1268extern "C" {
1269    pub fn fgetspent_r(
1270        fp: *mut ::FILE,
1271        spbuf: *mut ::spwd,
1272        buf: *mut ::c_char,
1273        buflen: ::size_t,
1274        spbufp: *mut *mut ::spwd,
1275    ) -> ::c_int;
1276    pub fn sgetspent_r(
1277        s: *const ::c_char,
1278        spbuf: *mut ::spwd,
1279        buf: *mut ::c_char,
1280        buflen: ::size_t,
1281        spbufp: *mut *mut ::spwd,
1282    ) -> ::c_int;
1283    pub fn getspent_r(
1284        spbuf: *mut ::spwd,
1285        buf: *mut ::c_char,
1286        buflen: ::size_t,
1287        spbufp: *mut *mut ::spwd,
1288    ) -> ::c_int;
1289    pub fn qsort_r(
1290        base: *mut ::c_void,
1291        num: ::size_t,
1292        size: ::size_t,
1293        compar: ::Option<
1294            unsafe extern "C" fn(*const ::c_void, *const ::c_void, *mut ::c_void) -> ::c_int,
1295        >,
1296        arg: *mut ::c_void,
1297    );
1298    pub fn sendmmsg(
1299        sockfd: ::c_int,
1300        msgvec: *mut ::mmsghdr,
1301        vlen: ::c_uint,
1302        flags: ::c_int,
1303    ) -> ::c_int;
1304    pub fn recvmmsg(
1305        sockfd: ::c_int,
1306        msgvec: *mut ::mmsghdr,
1307        vlen: ::c_uint,
1308        flags: ::c_int,
1309        timeout: *mut ::timespec,
1310    ) -> ::c_int;
1311
1312    pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int;
1313    pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int;
1314    pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int;
1315    pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
1316    pub fn prlimit(
1317        pid: ::pid_t,
1318        resource: ::__rlimit_resource_t,
1319        new_limit: *const ::rlimit,
1320        old_limit: *mut ::rlimit,
1321    ) -> ::c_int;
1322    pub fn prlimit64(
1323        pid: ::pid_t,
1324        resource: ::__rlimit_resource_t,
1325        new_limit: *const ::rlimit64,
1326        old_limit: *mut ::rlimit64,
1327    ) -> ::c_int;
1328    pub fn utmpname(file: *const ::c_char) -> ::c_int;
1329    pub fn utmpxname(file: *const ::c_char) -> ::c_int;
1330    pub fn getutxent() -> *mut utmpx;
1331    pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
1332    pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
1333    pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
1334    pub fn setutxent();
1335    pub fn endutxent();
1336    pub fn getpt() -> ::c_int;
1337    pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int;
1338    pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
1339    pub fn statx(
1340        dirfd: ::c_int,
1341        pathname: *const c_char,
1342        flags: ::c_int,
1343        mask: ::c_uint,
1344        statxbuf: *mut statx,
1345    ) -> ::c_int;
1346    pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
1347    pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
1348    pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
1349
1350    pub fn adjtimex(buf: *mut timex) -> ::c_int;
1351    pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
1352    #[link_name = "ntp_gettimex"]
1353    pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
1354    pub fn clock_adjtime(clk_id: ::clockid_t, buf: *mut ::timex) -> ::c_int;
1355
1356    pub fn fanotify_mark(
1357        fd: ::c_int,
1358        flags: ::c_uint,
1359        mask: u64,
1360        dirfd: ::c_int,
1361        path: *const ::c_char,
1362    ) -> ::c_int;
1363    pub fn preadv2(
1364        fd: ::c_int,
1365        iov: *const ::iovec,
1366        iovcnt: ::c_int,
1367        offset: ::off_t,
1368        flags: ::c_int,
1369    ) -> ::ssize_t;
1370    pub fn pwritev2(
1371        fd: ::c_int,
1372        iov: *const ::iovec,
1373        iovcnt: ::c_int,
1374        offset: ::off_t,
1375        flags: ::c_int,
1376    ) -> ::ssize_t;
1377    pub fn preadv64v2(
1378        fd: ::c_int,
1379        iov: *const ::iovec,
1380        iovcnt: ::c_int,
1381        offset: ::off64_t,
1382        flags: ::c_int,
1383    ) -> ::ssize_t;
1384    pub fn pwritev64v2(
1385        fd: ::c_int,
1386        iov: *const ::iovec,
1387        iovcnt: ::c_int,
1388        offset: ::off64_t,
1389        flags: ::c_int,
1390    ) -> ::ssize_t;
1391    pub fn renameat2(
1392        olddirfd: ::c_int,
1393        oldpath: *const ::c_char,
1394        newdirfd: ::c_int,
1395        newpath: *const ::c_char,
1396        flags: ::c_uint,
1397    ) -> ::c_int;
1398
1399    // Added in `glibc` 2.25
1400    pub fn explicit_bzero(s: *mut ::c_void, len: ::size_t);
1401    // Added in `glibc` 2.29
1402    pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
1403
1404    pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;
1405    pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
1406    pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
1407    pub fn glob64(
1408        pattern: *const ::c_char,
1409        flags: ::c_int,
1410        errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
1411        pglob: *mut glob64_t,
1412    ) -> ::c_int;
1413    pub fn globfree64(pglob: *mut glob64_t);
1414    pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
1415    pub fn pthread_attr_getaffinity_np(
1416        attr: *const ::pthread_attr_t,
1417        cpusetsize: ::size_t,
1418        cpuset: *mut ::cpu_set_t,
1419    ) -> ::c_int;
1420    pub fn pthread_attr_setaffinity_np(
1421        attr: *mut ::pthread_attr_t,
1422        cpusetsize: ::size_t,
1423        cpuset: *const ::cpu_set_t,
1424    ) -> ::c_int;
1425    pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
1426    pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
1427    pub fn pthread_rwlockattr_getkind_np(
1428        attr: *const ::pthread_rwlockattr_t,
1429        val: *mut ::c_int,
1430    ) -> ::c_int;
1431    pub fn pthread_rwlockattr_setkind_np(
1432        attr: *mut ::pthread_rwlockattr_t,
1433        val: ::c_int,
1434    ) -> ::c_int;
1435    pub fn pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::c_int;
1436    pub fn mallinfo() -> ::mallinfo;
1437    pub fn mallinfo2() -> ::mallinfo2;
1438    pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int;
1439    pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
1440    pub fn getpwent_r(
1441        pwd: *mut ::passwd,
1442        buf: *mut ::c_char,
1443        buflen: ::size_t,
1444        result: *mut *mut ::passwd,
1445    ) -> ::c_int;
1446    pub fn getgrent_r(
1447        grp: *mut ::group,
1448        buf: *mut ::c_char,
1449        buflen: ::size_t,
1450        result: *mut *mut ::group,
1451    ) -> ::c_int;
1452    pub fn fgetpwent_r(
1453        stream: *mut ::FILE,
1454        pwd: *mut ::passwd,
1455        buf: *mut ::c_char,
1456        buflen: ::size_t,
1457        result: *mut *mut ::passwd,
1458    ) -> ::c_int;
1459    pub fn fgetgrent_r(
1460        stream: *mut ::FILE,
1461        grp: *mut ::group,
1462        buf: *mut ::c_char,
1463        buflen: ::size_t,
1464        result: *mut *mut ::group,
1465    ) -> ::c_int;
1466
1467    pub fn putpwent(p: *const ::passwd, stream: *mut ::FILE) -> ::c_int;
1468    pub fn putgrent(grp: *const ::group, stream: *mut ::FILE) -> ::c_int;
1469
1470    pub fn sethostid(hostid: ::c_long) -> ::c_int;
1471
1472    pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
1473    pub fn mlock2(addr: *const ::c_void, len: ::size_t, flags: ::c_uint) -> ::c_int;
1474
1475    pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
1476    pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
1477
1478    pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char;
1479    pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char;
1480
1481    pub fn strftime(
1482        s: *mut ::c_char,
1483        max: ::size_t,
1484        format: *const ::c_char,
1485        tm: *const ::tm,
1486    ) -> ::size_t;
1487    pub fn strftime_l(
1488        s: *mut ::c_char,
1489        max: ::size_t,
1490        format: *const ::c_char,
1491        tm: *const ::tm,
1492        locale: ::locale_t,
1493    ) -> ::size_t;
1494    pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char;
1495
1496    pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
1497    /// POSIX version of `basename(3)`, defined in `libgen.h`.
1498    #[link_name = "__xpg_basename"]
1499    pub fn posix_basename(path: *mut ::c_char) -> *mut ::c_char;
1500    /// GNU version of `basename(3)`, defined in `string.h`.
1501    #[link_name = "basename"]
1502    pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char;
1503    pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
1504    pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int;
1505    pub fn dladdr1(
1506        addr: *const ::c_void,
1507        info: *mut ::Dl_info,
1508        extra_info: *mut *mut ::c_void,
1509        flags: ::c_int,
1510    ) -> ::c_int;
1511    pub fn malloc_trim(__pad: ::size_t) -> ::c_int;
1512    pub fn gnu_get_libc_release() -> *const ::c_char;
1513    pub fn gnu_get_libc_version() -> *const ::c_char;
1514
1515    // posix/spawn.h
1516    // Added in `glibc` 2.29
1517    pub fn posix_spawn_file_actions_addchdir_np(
1518        actions: *mut ::posix_spawn_file_actions_t,
1519        path: *const ::c_char,
1520    ) -> ::c_int;
1521    // Added in `glibc` 2.29
1522    pub fn posix_spawn_file_actions_addfchdir_np(
1523        actions: *mut ::posix_spawn_file_actions_t,
1524        fd: ::c_int,
1525    ) -> ::c_int;
1526    // Added in `glibc` 2.34
1527    pub fn posix_spawn_file_actions_addclosefrom_np(
1528        actions: *mut ::posix_spawn_file_actions_t,
1529        from: ::c_int,
1530    ) -> ::c_int;
1531    // Added in `glibc` 2.35
1532    pub fn posix_spawn_file_actions_addtcsetpgrp_np(
1533        actions: *mut ::posix_spawn_file_actions_t,
1534        tcfd: ::c_int,
1535    ) -> ::c_int;
1536
1537    // mntent.h
1538    pub fn getmntent_r(
1539        stream: *mut ::FILE,
1540        mntbuf: *mut ::mntent,
1541        buf: *mut ::c_char,
1542        buflen: ::c_int,
1543    ) -> *mut ::mntent;
1544
1545    pub fn execveat(
1546        dirfd: ::c_int,
1547        pathname: *const ::c_char,
1548        argv: *const *mut c_char,
1549        envp: *const *mut c_char,
1550        flags: ::c_int,
1551    ) -> ::c_int;
1552
1553    // Added in `glibc` 2.34
1554    pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int;
1555}
1556
1557cfg_if! {
1558    if #[cfg(any(target_arch = "x86",
1559                 target_arch = "arm",
1560                 target_arch = "m68k",
1561                 target_arch = "csky",
1562                 target_arch = "mips",
1563                 target_arch = "mips32r6",
1564                 target_arch = "powerpc",
1565                 target_arch = "sparc",
1566                 target_arch = "riscv32"))] {
1567        mod b32;
1568        pub use self::b32::*;
1569    } else if #[cfg(any(target_arch = "x86_64",
1570                        target_arch = "aarch64",
1571                        target_arch = "powerpc64",
1572                        target_arch = "mips64",
1573                        target_arch = "mips64r6",
1574                        target_arch = "s390x",
1575                        target_arch = "sparc64",
1576                        target_arch = "riscv64",
1577                        target_arch = "loongarch64"))] {
1578        mod b64;
1579        pub use self::b64::*;
1580    } else {
1581        // Unknown target_arch
1582    }
1583}
1584
1585cfg_if! {
1586    if #[cfg(libc_align)] {
1587        mod align;
1588        pub use self::align::*;
1589    } else {
1590        mod no_align;
1591        pub use self::no_align::*;
1592    }
1593}