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    // netinet/tcp.h
459
460    pub struct tcp_info {
461        pub tcpi_state: u8,
462        pub tcpi_ca_state: u8,
463        pub tcpi_retransmits: u8,
464        pub tcpi_probes: u8,
465        pub tcpi_backoff: u8,
466        pub tcpi_options: u8,
467        /// This contains the bitfields `tcpi_snd_wscale` and `tcpi_rcv_wscale`.
468        /// Each is 4 bits.
469        pub tcpi_snd_rcv_wscale: u8,
470        pub tcpi_rto: u32,
471        pub tcpi_ato: u32,
472        pub tcpi_snd_mss: u32,
473        pub tcpi_rcv_mss: u32,
474        pub tcpi_unacked: u32,
475        pub tcpi_sacked: u32,
476        pub tcpi_lost: u32,
477        pub tcpi_retrans: u32,
478        pub tcpi_fackets: u32,
479        pub tcpi_last_data_sent: u32,
480        pub tcpi_last_ack_sent: u32,
481        pub tcpi_last_data_recv: u32,
482        pub tcpi_last_ack_recv: u32,
483        pub tcpi_pmtu: u32,
484        pub tcpi_rcv_ssthresh: u32,
485        pub tcpi_rtt: u32,
486        pub tcpi_rttvar: u32,
487        pub tcpi_snd_ssthresh: u32,
488        pub tcpi_snd_cwnd: u32,
489        pub tcpi_advmss: u32,
490        pub tcpi_reordering: u32,
491        pub tcpi_rcv_rtt: u32,
492        pub tcpi_rcv_space: u32,
493        pub tcpi_total_retrans: u32,
494    }
495
496    pub struct fanotify_event_info_pidfd {
497        pub hdr: ::fanotify_event_info_header,
498        pub pidfd: ::__s32,
499    }
500
501    pub struct fanotify_event_info_error {
502        pub hdr: ::fanotify_event_info_header,
503        pub error: ::__s32,
504        pub error_count: ::__u32,
505    }
506}
507
508impl siginfo_t {
509    pub unsafe fn si_addr(&self) -> *mut ::c_void {
510        #[repr(C)]
511        struct siginfo_sigfault {
512            _si_signo: ::c_int,
513            _si_errno: ::c_int,
514            _si_code: ::c_int,
515            si_addr: *mut ::c_void,
516        }
517        (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
518    }
519
520    pub unsafe fn si_value(&self) -> ::sigval {
521        #[repr(C)]
522        struct siginfo_timer {
523            _si_signo: ::c_int,
524            _si_errno: ::c_int,
525            _si_code: ::c_int,
526            _si_tid: ::c_int,
527            _si_overrun: ::c_int,
528            si_sigval: ::sigval,
529        }
530        (*(self as *const siginfo_t as *const siginfo_timer)).si_sigval
531    }
532}
533
534cfg_if! {
535    if #[cfg(libc_union)] {
536        // Internal, for casts to access union fields
537        #[repr(C)]
538        struct sifields_sigchld {
539            si_pid: ::pid_t,
540            si_uid: ::uid_t,
541            si_status: ::c_int,
542            si_utime: ::c_long,
543            si_stime: ::c_long,
544        }
545        impl ::Copy for sifields_sigchld {}
546        impl ::Clone for sifields_sigchld {
547            fn clone(&self) -> sifields_sigchld {
548                *self
549            }
550        }
551
552        // Internal, for casts to access union fields
553        #[repr(C)]
554        union sifields {
555            _align_pointer: *mut ::c_void,
556            sigchld: sifields_sigchld,
557        }
558
559        // Internal, for casts to access union fields. Note that some variants
560        // of sifields start with a pointer, which makes the alignment of
561        // sifields vary on 32-bit and 64-bit architectures.
562        #[repr(C)]
563        struct siginfo_f {
564            _siginfo_base: [::c_int; 3],
565            sifields: sifields,
566        }
567
568        impl siginfo_t {
569            unsafe fn sifields(&self) -> &sifields {
570                &(*(self as *const siginfo_t as *const siginfo_f)).sifields
571            }
572
573            pub unsafe fn si_pid(&self) -> ::pid_t {
574                self.sifields().sigchld.si_pid
575            }
576
577            pub unsafe fn si_uid(&self) -> ::uid_t {
578                self.sifields().sigchld.si_uid
579            }
580
581            pub unsafe fn si_status(&self) -> ::c_int {
582                self.sifields().sigchld.si_status
583            }
584
585            pub unsafe fn si_utime(&self) -> ::c_long {
586                self.sifields().sigchld.si_utime
587            }
588
589            pub unsafe fn si_stime(&self) -> ::c_long {
590                self.sifields().sigchld.si_stime
591            }
592        }
593
594        pub union __c_anonymous_ptrace_syscall_info_data {
595            pub entry: __c_anonymous_ptrace_syscall_info_entry,
596            pub exit: __c_anonymous_ptrace_syscall_info_exit,
597            pub seccomp: __c_anonymous_ptrace_syscall_info_seccomp,
598        }
599        impl ::Copy for __c_anonymous_ptrace_syscall_info_data {}
600        impl ::Clone for __c_anonymous_ptrace_syscall_info_data {
601            fn clone(&self) -> __c_anonymous_ptrace_syscall_info_data {
602                *self
603            }
604        }
605    }
606}
607
608s_no_extra_traits! {
609    pub struct utmpx {
610        pub ut_type: ::c_short,
611        pub ut_pid: ::pid_t,
612        pub ut_line: [::c_char; __UT_LINESIZE],
613        pub ut_id: [::c_char; 4],
614
615        pub ut_user: [::c_char; __UT_NAMESIZE],
616        pub ut_host: [::c_char; __UT_HOSTSIZE],
617        pub ut_exit: __exit_status,
618
619        #[cfg(any(target_arch = "aarch64",
620                  target_arch = "s390x",
621                  target_arch = "loongarch64",
622                  all(target_pointer_width = "32",
623                      not(target_arch = "x86_64"))))]
624        pub ut_session: ::c_long,
625        #[cfg(any(target_arch = "aarch64",
626                  target_arch = "s390x",
627                  target_arch = "loongarch64",
628                  all(target_pointer_width = "32",
629                      not(target_arch = "x86_64"))))]
630        pub ut_tv: ::timeval,
631
632        #[cfg(not(any(target_arch = "aarch64",
633                      target_arch = "s390x",
634                      target_arch = "loongarch64",
635                      all(target_pointer_width = "32",
636                          not(target_arch = "x86_64")))))]
637        pub ut_session: i32,
638        #[cfg(not(any(target_arch = "aarch64",
639                      target_arch = "s390x",
640                      target_arch = "loongarch64",
641                      all(target_pointer_width = "32",
642                          not(target_arch = "x86_64")))))]
643        pub ut_tv: __timeval,
644
645        pub ut_addr_v6: [i32; 4],
646        __glibc_reserved: [::c_char; 20],
647    }
648}
649
650cfg_if! {
651    if #[cfg(feature = "extra_traits")] {
652        impl PartialEq for utmpx {
653            fn eq(&self, other: &utmpx) -> bool {
654                self.ut_type == other.ut_type
655                    && self.ut_pid == other.ut_pid
656                    && self.ut_line == other.ut_line
657                    && self.ut_id == other.ut_id
658                    && self.ut_user == other.ut_user
659                    && self
660                    .ut_host
661                    .iter()
662                    .zip(other.ut_host.iter())
663                    .all(|(a,b)| a == b)
664                    && self.ut_exit == other.ut_exit
665                    && self.ut_session == other.ut_session
666                    && self.ut_tv == other.ut_tv
667                    && self.ut_addr_v6 == other.ut_addr_v6
668                    && self.__glibc_reserved == other.__glibc_reserved
669            }
670        }
671
672        impl Eq for utmpx {}
673
674        impl ::fmt::Debug for utmpx {
675            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
676                f.debug_struct("utmpx")
677                    .field("ut_type", &self.ut_type)
678                    .field("ut_pid", &self.ut_pid)
679                    .field("ut_line", &self.ut_line)
680                    .field("ut_id", &self.ut_id)
681                    .field("ut_user", &self.ut_user)
682                // FIXME: .field("ut_host", &self.ut_host)
683                    .field("ut_exit", &self.ut_exit)
684                    .field("ut_session", &self.ut_session)
685                    .field("ut_tv", &self.ut_tv)
686                    .field("ut_addr_v6", &self.ut_addr_v6)
687                    .field("__glibc_reserved", &self.__glibc_reserved)
688                    .finish()
689            }
690        }
691
692        impl ::hash::Hash for utmpx {
693            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
694                self.ut_type.hash(state);
695                self.ut_pid.hash(state);
696                self.ut_line.hash(state);
697                self.ut_id.hash(state);
698                self.ut_user.hash(state);
699                self.ut_host.hash(state);
700                self.ut_exit.hash(state);
701                self.ut_session.hash(state);
702                self.ut_tv.hash(state);
703                self.ut_addr_v6.hash(state);
704                self.__glibc_reserved.hash(state);
705            }
706        }
707
708        #[cfg(libc_union)]
709        impl PartialEq for __c_anonymous_ptrace_syscall_info_data {
710            fn eq(&self, other: &__c_anonymous_ptrace_syscall_info_data) -> bool {
711                unsafe {
712                self.entry == other.entry ||
713                    self.exit == other.exit ||
714                    self.seccomp == other.seccomp
715                }
716            }
717        }
718
719        #[cfg(libc_union)]
720        impl Eq for __c_anonymous_ptrace_syscall_info_data {}
721
722        #[cfg(libc_union)]
723        impl ::fmt::Debug for __c_anonymous_ptrace_syscall_info_data {
724            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
725                unsafe {
726                f.debug_struct("__c_anonymous_ptrace_syscall_info_data")
727                    .field("entry", &self.entry)
728                    .field("exit", &self.exit)
729                    .field("seccomp", &self.seccomp)
730                    .finish()
731                }
732            }
733        }
734
735        #[cfg(libc_union)]
736        impl ::hash::Hash for __c_anonymous_ptrace_syscall_info_data {
737            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
738                unsafe {
739                self.entry.hash(state);
740                self.exit.hash(state);
741                self.seccomp.hash(state);
742                }
743            }
744        }
745    }
746}
747
748// include/uapi/asm-generic/hugetlb_encode.h
749pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26;
750pub const HUGETLB_FLAG_ENCODE_MASK: ::c_int = 0x3f;
751
752pub const HUGETLB_FLAG_ENCODE_64KB: ::c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT;
753pub const HUGETLB_FLAG_ENCODE_512KB: ::c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT;
754pub const HUGETLB_FLAG_ENCODE_1MB: ::c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT;
755pub const HUGETLB_FLAG_ENCODE_2MB: ::c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT;
756pub const HUGETLB_FLAG_ENCODE_8MB: ::c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT;
757pub const HUGETLB_FLAG_ENCODE_16MB: ::c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT;
758pub const HUGETLB_FLAG_ENCODE_32MB: ::c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT;
759pub const HUGETLB_FLAG_ENCODE_256MB: ::c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT;
760pub const HUGETLB_FLAG_ENCODE_512MB: ::c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT;
761pub const HUGETLB_FLAG_ENCODE_1GB: ::c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT;
762pub const HUGETLB_FLAG_ENCODE_2GB: ::c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT;
763pub const HUGETLB_FLAG_ENCODE_16GB: ::c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT;
764
765// include/uapi/linux/mman.h
766/*
767 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
768 * size other than the default is desired.  See hugetlb_encode.h.
769 * All known huge page size encodings are provided here.  It is the
770 * responsibility of the application to know which sizes are supported on
771 * the running system.  See mmap(2) man page for details.
772 */
773pub const MAP_HUGE_SHIFT: ::c_int = HUGETLB_FLAG_ENCODE_SHIFT;
774pub const MAP_HUGE_MASK: ::c_int = HUGETLB_FLAG_ENCODE_MASK;
775
776pub const MAP_HUGE_64KB: ::c_int = HUGETLB_FLAG_ENCODE_64KB;
777pub const MAP_HUGE_512KB: ::c_int = HUGETLB_FLAG_ENCODE_512KB;
778pub const MAP_HUGE_1MB: ::c_int = HUGETLB_FLAG_ENCODE_1MB;
779pub const MAP_HUGE_2MB: ::c_int = HUGETLB_FLAG_ENCODE_2MB;
780pub const MAP_HUGE_8MB: ::c_int = HUGETLB_FLAG_ENCODE_8MB;
781pub const MAP_HUGE_16MB: ::c_int = HUGETLB_FLAG_ENCODE_16MB;
782pub const MAP_HUGE_32MB: ::c_int = HUGETLB_FLAG_ENCODE_32MB;
783pub const MAP_HUGE_256MB: ::c_int = HUGETLB_FLAG_ENCODE_256MB;
784pub const MAP_HUGE_512MB: ::c_int = HUGETLB_FLAG_ENCODE_512MB;
785pub const MAP_HUGE_1GB: ::c_int = HUGETLB_FLAG_ENCODE_1GB;
786pub const MAP_HUGE_2GB: ::c_int = HUGETLB_FLAG_ENCODE_2GB;
787pub const MAP_HUGE_16GB: ::c_int = HUGETLB_FLAG_ENCODE_16GB;
788
789pub const PRIO_PROCESS: ::__priority_which_t = 0;
790pub const PRIO_PGRP: ::__priority_which_t = 1;
791pub const PRIO_USER: ::__priority_which_t = 2;
792
793pub const MS_RMT_MASK: ::c_ulong = 0x02800051;
794
795pub const __UT_LINESIZE: usize = 32;
796pub const __UT_NAMESIZE: usize = 32;
797pub const __UT_HOSTSIZE: usize = 256;
798pub const EMPTY: ::c_short = 0;
799pub const RUN_LVL: ::c_short = 1;
800pub const BOOT_TIME: ::c_short = 2;
801pub const NEW_TIME: ::c_short = 3;
802pub const OLD_TIME: ::c_short = 4;
803pub const INIT_PROCESS: ::c_short = 5;
804pub const LOGIN_PROCESS: ::c_short = 6;
805pub const USER_PROCESS: ::c_short = 7;
806pub const DEAD_PROCESS: ::c_short = 8;
807pub const ACCOUNTING: ::c_short = 9;
808
809// dlfcn.h
810pub const LM_ID_BASE: ::c_long = 0;
811pub const LM_ID_NEWLM: ::c_long = -1;
812
813pub const RTLD_DI_LMID: ::c_int = 1;
814pub const RTLD_DI_LINKMAP: ::c_int = 2;
815pub const RTLD_DI_CONFIGADDR: ::c_int = 3;
816pub const RTLD_DI_SERINFO: ::c_int = 4;
817pub const RTLD_DI_SERINFOSIZE: ::c_int = 5;
818pub const RTLD_DI_ORIGIN: ::c_int = 6;
819pub const RTLD_DI_PROFILENAME: ::c_int = 7;
820pub const RTLD_DI_PROFILEOUT: ::c_int = 8;
821pub const RTLD_DI_TLS_MODID: ::c_int = 9;
822pub const RTLD_DI_TLS_DATA: ::c_int = 10;
823
824pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
825pub const PIDFD_NONBLOCK: ::c_uint = O_NONBLOCK as ::c_uint;
826
827pub const SOL_RXRPC: ::c_int = 272;
828pub const SOL_PPPOL2TP: ::c_int = 273;
829pub const SOL_PNPIPE: ::c_int = 275;
830pub const SOL_RDS: ::c_int = 276;
831pub const SOL_IUCV: ::c_int = 277;
832pub const SOL_CAIF: ::c_int = 278;
833pub const SOL_NFC: ::c_int = 280;
834pub const SOL_XDP: ::c_int = 283;
835
836pub const MSG_TRYHARD: ::c_int = 4;
837
838pub const LC_PAPER: ::c_int = 7;
839pub const LC_NAME: ::c_int = 8;
840pub const LC_ADDRESS: ::c_int = 9;
841pub const LC_TELEPHONE: ::c_int = 10;
842pub const LC_MEASUREMENT: ::c_int = 11;
843pub const LC_IDENTIFICATION: ::c_int = 12;
844pub const LC_PAPER_MASK: ::c_int = 1 << LC_PAPER;
845pub const LC_NAME_MASK: ::c_int = 1 << LC_NAME;
846pub const LC_ADDRESS_MASK: ::c_int = 1 << LC_ADDRESS;
847pub const LC_TELEPHONE_MASK: ::c_int = 1 << LC_TELEPHONE;
848pub const LC_MEASUREMENT_MASK: ::c_int = 1 << LC_MEASUREMENT;
849pub const LC_IDENTIFICATION_MASK: ::c_int = 1 << LC_IDENTIFICATION;
850pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
851    | ::LC_NUMERIC_MASK
852    | ::LC_TIME_MASK
853    | ::LC_COLLATE_MASK
854    | ::LC_MONETARY_MASK
855    | ::LC_MESSAGES_MASK
856    | LC_PAPER_MASK
857    | LC_NAME_MASK
858    | LC_ADDRESS_MASK
859    | LC_TELEPHONE_MASK
860    | LC_MEASUREMENT_MASK
861    | LC_IDENTIFICATION_MASK;
862
863pub const ENOTSUP: ::c_int = EOPNOTSUPP;
864
865pub const SOCK_SEQPACKET: ::c_int = 5;
866pub const SOCK_DCCP: ::c_int = 6;
867pub const SOCK_PACKET: ::c_int = 10;
868
869pub const AF_IB: ::c_int = 27;
870pub const AF_MPLS: ::c_int = 28;
871pub const AF_NFC: ::c_int = 39;
872pub const AF_VSOCK: ::c_int = 40;
873pub const AF_XDP: ::c_int = 44;
874pub const PF_IB: ::c_int = AF_IB;
875pub const PF_MPLS: ::c_int = AF_MPLS;
876pub const PF_NFC: ::c_int = AF_NFC;
877pub const PF_VSOCK: ::c_int = AF_VSOCK;
878pub const PF_XDP: ::c_int = AF_XDP;
879
880pub const SIGEV_THREAD_ID: ::c_int = 4;
881
882pub const BUFSIZ: ::c_uint = 8192;
883pub const TMP_MAX: ::c_uint = 238328;
884pub const FOPEN_MAX: ::c_uint = 16;
885pub const FILENAME_MAX: ::c_uint = 4096;
886pub const POSIX_MADV_DONTNEED: ::c_int = 4;
887pub const _CS_GNU_LIBC_VERSION: ::c_int = 2;
888pub const _CS_GNU_LIBPTHREAD_VERSION: ::c_int = 3;
889pub const _CS_V6_ENV: ::c_int = 1148;
890pub const _CS_V7_ENV: ::c_int = 1149;
891pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
892pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
893pub const _SC_PII: ::c_int = 53;
894pub const _SC_PII_XTI: ::c_int = 54;
895pub const _SC_PII_SOCKET: ::c_int = 55;
896pub const _SC_PII_INTERNET: ::c_int = 56;
897pub const _SC_PII_OSI: ::c_int = 57;
898pub const _SC_POLL: ::c_int = 58;
899pub const _SC_SELECT: ::c_int = 59;
900pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
901pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
902pub const _SC_PII_OSI_COTS: ::c_int = 63;
903pub const _SC_PII_OSI_CLTS: ::c_int = 64;
904pub const _SC_PII_OSI_M: ::c_int = 65;
905pub const _SC_T_IOV_MAX: ::c_int = 66;
906pub const _SC_2_C_VERSION: ::c_int = 96;
907pub const _SC_CHAR_BIT: ::c_int = 101;
908pub const _SC_CHAR_MAX: ::c_int = 102;
909pub const _SC_CHAR_MIN: ::c_int = 103;
910pub const _SC_INT_MAX: ::c_int = 104;
911pub const _SC_INT_MIN: ::c_int = 105;
912pub const _SC_LONG_BIT: ::c_int = 106;
913pub const _SC_WORD_BIT: ::c_int = 107;
914pub const _SC_MB_LEN_MAX: ::c_int = 108;
915pub const _SC_SSIZE_MAX: ::c_int = 110;
916pub const _SC_SCHAR_MAX: ::c_int = 111;
917pub const _SC_SCHAR_MIN: ::c_int = 112;
918pub const _SC_SHRT_MAX: ::c_int = 113;
919pub const _SC_SHRT_MIN: ::c_int = 114;
920pub const _SC_UCHAR_MAX: ::c_int = 115;
921pub const _SC_UINT_MAX: ::c_int = 116;
922pub const _SC_ULONG_MAX: ::c_int = 117;
923pub const _SC_USHRT_MAX: ::c_int = 118;
924pub const _SC_NL_ARGMAX: ::c_int = 119;
925pub const _SC_NL_LANGMAX: ::c_int = 120;
926pub const _SC_NL_MSGMAX: ::c_int = 121;
927pub const _SC_NL_NMAX: ::c_int = 122;
928pub const _SC_NL_SETMAX: ::c_int = 123;
929pub const _SC_NL_TEXTMAX: ::c_int = 124;
930pub const _SC_BASE: ::c_int = 134;
931pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
932pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
933pub const _SC_DEVICE_IO: ::c_int = 140;
934pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
935pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
936pub const _SC_FD_MGMT: ::c_int = 143;
937pub const _SC_FIFO: ::c_int = 144;
938pub const _SC_PIPE: ::c_int = 145;
939pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
940pub const _SC_FILE_LOCKING: ::c_int = 147;
941pub const _SC_FILE_SYSTEM: ::c_int = 148;
942pub const _SC_MULTI_PROCESS: ::c_int = 150;
943pub const _SC_SINGLE_PROCESS: ::c_int = 151;
944pub const _SC_NETWORKING: ::c_int = 152;
945pub const _SC_REGEX_VERSION: ::c_int = 156;
946pub const _SC_SIGNALS: ::c_int = 158;
947pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
948pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
949pub const _SC_USER_GROUPS: ::c_int = 166;
950pub const _SC_USER_GROUPS_R: ::c_int = 167;
951pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
952pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
953pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
954pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
955pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
956pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
957pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
958pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
959pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
960pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
961pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
962pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
963pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
964pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
965pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
966pub const O_ACCMODE: ::c_int = 3;
967pub const ST_RELATIME: ::c_ulong = 4096;
968pub const NI_MAXHOST: ::socklen_t = 1025;
969
970// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
971// following are only available on newer Linux versions than the versions
972// currently used in CI in some configurations, so we define them here.
973cfg_if! {
974    if #[cfg(not(target_arch = "s390x"))] {
975        pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
976        pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
977    } else if #[cfg(target_arch = "s390x")] {
978        pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70;
979        pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342;
980    }
981}
982
983pub const CPU_SETSIZE: ::c_int = 0x400;
984
985pub const PTRACE_TRACEME: ::c_uint = 0;
986pub const PTRACE_PEEKTEXT: ::c_uint = 1;
987pub const PTRACE_PEEKDATA: ::c_uint = 2;
988pub const PTRACE_PEEKUSER: ::c_uint = 3;
989pub const PTRACE_POKETEXT: ::c_uint = 4;
990pub const PTRACE_POKEDATA: ::c_uint = 5;
991pub const PTRACE_POKEUSER: ::c_uint = 6;
992pub const PTRACE_CONT: ::c_uint = 7;
993pub const PTRACE_KILL: ::c_uint = 8;
994pub const PTRACE_SINGLESTEP: ::c_uint = 9;
995pub const PTRACE_ATTACH: ::c_uint = 16;
996pub const PTRACE_SYSCALL: ::c_uint = 24;
997pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
998pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
999pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
1000pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
1001pub const PTRACE_GETREGSET: ::c_uint = 0x4204;
1002pub const PTRACE_SETREGSET: ::c_uint = 0x4205;
1003pub const PTRACE_SEIZE: ::c_uint = 0x4206;
1004pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
1005pub const PTRACE_LISTEN: ::c_uint = 0x4208;
1006pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
1007pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a;
1008pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b;
1009pub const PTRACE_GET_SYSCALL_INFO: ::c_uint = 0x420e;
1010pub const PTRACE_SYSCALL_INFO_NONE: ::__u8 = 0;
1011pub const PTRACE_SYSCALL_INFO_ENTRY: ::__u8 = 1;
1012pub const PTRACE_SYSCALL_INFO_EXIT: ::__u8 = 2;
1013pub const PTRACE_SYSCALL_INFO_SECCOMP: ::__u8 = 3;
1014
1015// linux/fs.h
1016
1017// Flags for preadv2/pwritev2
1018pub const RWF_HIPRI: ::c_int = 0x00000001;
1019pub const RWF_DSYNC: ::c_int = 0x00000002;
1020pub const RWF_SYNC: ::c_int = 0x00000004;
1021pub const RWF_NOWAIT: ::c_int = 0x00000008;
1022pub const RWF_APPEND: ::c_int = 0x00000010;
1023
1024// linux/rtnetlink.h
1025pub const TCA_PAD: ::c_ushort = 9;
1026pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10;
1027pub const TCA_CHAIN: ::c_ushort = 11;
1028pub const TCA_HW_OFFLOAD: ::c_ushort = 12;
1029
1030pub const RTM_DELNETCONF: u16 = 81;
1031pub const RTM_NEWSTATS: u16 = 92;
1032pub const RTM_GETSTATS: u16 = 94;
1033pub const RTM_NEWCACHEREPORT: u16 = 96;
1034
1035pub const RTM_F_LOOKUP_TABLE: ::c_uint = 0x1000;
1036pub const RTM_F_FIB_MATCH: ::c_uint = 0x2000;
1037
1038pub const RTA_VIA: ::c_ushort = 18;
1039pub const RTA_NEWDST: ::c_ushort = 19;
1040pub const RTA_PREF: ::c_ushort = 20;
1041pub const RTA_ENCAP_TYPE: ::c_ushort = 21;
1042pub const RTA_ENCAP: ::c_ushort = 22;
1043pub const RTA_EXPIRES: ::c_ushort = 23;
1044pub const RTA_PAD: ::c_ushort = 24;
1045pub const RTA_UID: ::c_ushort = 25;
1046pub const RTA_TTL_PROPAGATE: ::c_ushort = 26;
1047
1048// linux/neighbor.h
1049pub const NTF_EXT_LEARNED: u8 = 0x10;
1050pub const NTF_OFFLOADED: u8 = 0x20;
1051
1052pub const NDA_MASTER: ::c_ushort = 9;
1053pub const NDA_LINK_NETNSID: ::c_ushort = 10;
1054pub const NDA_SRC_VNI: ::c_ushort = 11;
1055
1056// linux/personality.h
1057pub const UNAME26: ::c_int = 0x0020000;
1058pub const FDPIC_FUNCPTRS: ::c_int = 0x0080000;
1059
1060// linux/if_addr.h
1061pub const IFA_FLAGS: ::c_ushort = 8;
1062
1063pub const IFA_F_MANAGETEMPADDR: u32 = 0x100;
1064pub const IFA_F_NOPREFIXROUTE: u32 = 0x200;
1065pub const IFA_F_MCAUTOJOIN: u32 = 0x400;
1066pub const IFA_F_STABLE_PRIVACY: u32 = 0x800;
1067
1068pub const MAX_LINKS: ::c_int = 32;
1069
1070pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10;
1071
1072pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1;
1073pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2;
1074
1075// linux/if_xdp.h
1076pub const XDP_SHARED_UMEM: ::__u16 = 1 << 0;
1077pub const XDP_COPY: ::__u16 = 1 << 1;
1078pub const XDP_ZEROCOPY: ::__u16 = 1 << 2;
1079pub const XDP_USE_NEED_WAKEUP: ::__u16 = 1 << 3;
1080pub const XDP_USE_SG: ::__u16 = 1 << 4;
1081
1082pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: ::__u32 = 1 << 0;
1083
1084pub const XDP_RING_NEED_WAKEUP: ::__u32 = 1 << 0;
1085
1086pub const XDP_MMAP_OFFSETS: ::c_int = 1;
1087pub const XDP_RX_RING: ::c_int = 2;
1088pub const XDP_TX_RING: ::c_int = 3;
1089pub const XDP_UMEM_REG: ::c_int = 4;
1090pub const XDP_UMEM_FILL_RING: ::c_int = 5;
1091pub const XDP_UMEM_COMPLETION_RING: ::c_int = 6;
1092pub const XDP_STATISTICS: ::c_int = 7;
1093pub const XDP_OPTIONS: ::c_int = 8;
1094
1095pub const XDP_OPTIONS_ZEROCOPY: ::__u32 = 1 << 0;
1096
1097pub const XDP_PGOFF_RX_RING: ::off_t = 0;
1098pub const XDP_PGOFF_TX_RING: ::off_t = 0x80000000;
1099pub const XDP_UMEM_PGOFF_FILL_RING: ::c_ulonglong = 0x100000000;
1100pub const XDP_UMEM_PGOFF_COMPLETION_RING: ::c_ulonglong = 0x180000000;
1101
1102pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: ::c_int = 48;
1103pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1;
1104
1105pub const XDP_PKT_CONTD: ::__u32 = 1 << 0;
1106
1107pub const ELFOSABI_ARM_AEABI: u8 = 64;
1108
1109// linux/sched.h
1110pub const CLONE_NEWTIME: ::c_int = 0x80;
1111pub const CLONE_CLEAR_SIGHAND: ::c_int = 0x100000000;
1112pub const CLONE_INTO_CGROUP: ::c_int = 0x200000000;
1113
1114// linux/keyctl.h
1115pub const KEYCTL_DH_COMPUTE: u32 = 23;
1116pub const KEYCTL_PKEY_QUERY: u32 = 24;
1117pub const KEYCTL_PKEY_ENCRYPT: u32 = 25;
1118pub const KEYCTL_PKEY_DECRYPT: u32 = 26;
1119pub const KEYCTL_PKEY_SIGN: u32 = 27;
1120pub const KEYCTL_PKEY_VERIFY: u32 = 28;
1121pub const KEYCTL_RESTRICT_KEYRING: u32 = 29;
1122
1123pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01;
1124pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02;
1125pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04;
1126pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08;
1127cfg_if! {
1128    if #[cfg(not(any(target_arch = "mips",
1129                     target_arch = "mips32r6",
1130                     target_arch = "mips64",
1131                     target_arch = "mips64r6")))] {
1132        pub const KEYCTL_MOVE: u32 = 30;
1133        pub const KEYCTL_CAPABILITIES: u32 = 31;
1134
1135        pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01;
1136        pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02;
1137        pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04;
1138        pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08;
1139        pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10;
1140        pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20;
1141        pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40;
1142        pub const KEYCTL_CAPS0_MOVE: u32 = 0x80;
1143        pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01;
1144        pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02;
1145    }
1146}
1147
1148pub const M_MXFAST: ::c_int = 1;
1149pub const M_NLBLKS: ::c_int = 2;
1150pub const M_GRAIN: ::c_int = 3;
1151pub const M_KEEP: ::c_int = 4;
1152pub const M_TRIM_THRESHOLD: ::c_int = -1;
1153pub const M_TOP_PAD: ::c_int = -2;
1154pub const M_MMAP_THRESHOLD: ::c_int = -3;
1155pub const M_MMAP_MAX: ::c_int = -4;
1156pub const M_CHECK_ACTION: ::c_int = -5;
1157pub const M_PERTURB: ::c_int = -6;
1158pub const M_ARENA_TEST: ::c_int = -7;
1159pub const M_ARENA_MAX: ::c_int = -8;
1160
1161pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000;
1162pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000;
1163pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000;
1164pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000;
1165pub const STATX_TYPE: ::c_uint = 0x0001;
1166pub const STATX_MODE: ::c_uint = 0x0002;
1167pub const STATX_NLINK: ::c_uint = 0x0004;
1168pub const STATX_UID: ::c_uint = 0x0008;
1169pub const STATX_GID: ::c_uint = 0x0010;
1170pub const STATX_ATIME: ::c_uint = 0x0020;
1171pub const STATX_MTIME: ::c_uint = 0x0040;
1172pub const STATX_CTIME: ::c_uint = 0x0080;
1173pub const STATX_INO: ::c_uint = 0x0100;
1174pub const STATX_SIZE: ::c_uint = 0x0200;
1175pub const STATX_BLOCKS: ::c_uint = 0x0400;
1176pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
1177pub const STATX_BTIME: ::c_uint = 0x0800;
1178pub const STATX_MNT_ID: ::c_uint = 0x1000;
1179pub const STATX_DIOALIGN: ::c_uint = 0x2000;
1180pub const STATX_ALL: ::c_uint = 0x0fff;
1181pub const STATX__RESERVED: ::c_int = 0x80000000;
1182pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
1183pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
1184pub const STATX_ATTR_APPEND: ::c_int = 0x0020;
1185pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
1186pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
1187pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
1188pub const STATX_ATTR_MOUNT_ROOT: ::c_int = 0x2000;
1189pub const STATX_ATTR_VERITY: ::c_int = 0x00100000;
1190pub const STATX_ATTR_DAX: ::c_int = 0x00200000;
1191
1192pub const SOMAXCONN: ::c_int = 4096;
1193
1194// linux/mount.h
1195pub const MOVE_MOUNT_F_SYMLINKS: ::c_uint = 0x00000001;
1196pub const MOVE_MOUNT_F_AUTOMOUNTS: ::c_uint = 0x00000002;
1197pub const MOVE_MOUNT_F_EMPTY_PATH: ::c_uint = 0x00000004;
1198pub const MOVE_MOUNT_T_SYMLINKS: ::c_uint = 0x00000010;
1199pub const MOVE_MOUNT_T_AUTOMOUNTS: ::c_uint = 0x00000020;
1200pub const MOVE_MOUNT_T_EMPTY_PATH: ::c_uint = 0x00000040;
1201pub const MOVE_MOUNT_SET_GROUP: ::c_uint = 0x00000100;
1202pub const MOVE_MOUNT_BENEATH: ::c_uint = 0x00000200;
1203
1204// sys/timex.h
1205pub const ADJ_OFFSET: ::c_uint = 0x0001;
1206pub const ADJ_FREQUENCY: ::c_uint = 0x0002;
1207pub const ADJ_MAXERROR: ::c_uint = 0x0004;
1208pub const ADJ_ESTERROR: ::c_uint = 0x0008;
1209pub const ADJ_STATUS: ::c_uint = 0x0010;
1210pub const ADJ_TIMECONST: ::c_uint = 0x0020;
1211pub const ADJ_TAI: ::c_uint = 0x0080;
1212pub const ADJ_SETOFFSET: ::c_uint = 0x0100;
1213pub const ADJ_MICRO: ::c_uint = 0x1000;
1214pub const ADJ_NANO: ::c_uint = 0x2000;
1215pub const ADJ_TICK: ::c_uint = 0x4000;
1216pub const ADJ_OFFSET_SINGLESHOT: ::c_uint = 0x8001;
1217pub const ADJ_OFFSET_SS_READ: ::c_uint = 0xa001;
1218pub const MOD_OFFSET: ::c_uint = ADJ_OFFSET;
1219pub const MOD_FREQUENCY: ::c_uint = ADJ_FREQUENCY;
1220pub const MOD_MAXERROR: ::c_uint = ADJ_MAXERROR;
1221pub const MOD_ESTERROR: ::c_uint = ADJ_ESTERROR;
1222pub const MOD_STATUS: ::c_uint = ADJ_STATUS;
1223pub const MOD_TIMECONST: ::c_uint = ADJ_TIMECONST;
1224pub const MOD_CLKB: ::c_uint = ADJ_TICK;
1225pub const MOD_CLKA: ::c_uint = ADJ_OFFSET_SINGLESHOT;
1226pub const MOD_TAI: ::c_uint = ADJ_TAI;
1227pub const MOD_MICRO: ::c_uint = ADJ_MICRO;
1228pub const MOD_NANO: ::c_uint = ADJ_NANO;
1229pub const STA_PLL: ::c_int = 0x0001;
1230pub const STA_PPSFREQ: ::c_int = 0x0002;
1231pub const STA_PPSTIME: ::c_int = 0x0004;
1232pub const STA_FLL: ::c_int = 0x0008;
1233pub const STA_INS: ::c_int = 0x0010;
1234pub const STA_DEL: ::c_int = 0x0020;
1235pub const STA_UNSYNC: ::c_int = 0x0040;
1236pub const STA_FREQHOLD: ::c_int = 0x0080;
1237pub const STA_PPSSIGNAL: ::c_int = 0x0100;
1238pub const STA_PPSJITTER: ::c_int = 0x0200;
1239pub const STA_PPSWANDER: ::c_int = 0x0400;
1240pub const STA_PPSERROR: ::c_int = 0x0800;
1241pub const STA_CLOCKERR: ::c_int = 0x1000;
1242pub const STA_NANO: ::c_int = 0x2000;
1243pub const STA_MODE: ::c_int = 0x4000;
1244pub const STA_CLK: ::c_int = 0x8000;
1245pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
1246    | STA_PPSJITTER
1247    | STA_PPSWANDER
1248    | STA_PPSERROR
1249    | STA_CLOCKERR
1250    | STA_NANO
1251    | STA_MODE
1252    | STA_CLK;
1253pub const NTP_API: ::c_int = 4;
1254pub const TIME_OK: ::c_int = 0;
1255pub const TIME_INS: ::c_int = 1;
1256pub const TIME_DEL: ::c_int = 2;
1257pub const TIME_OOP: ::c_int = 3;
1258pub const TIME_WAIT: ::c_int = 4;
1259pub const TIME_ERROR: ::c_int = 5;
1260pub const TIME_BAD: ::c_int = TIME_ERROR;
1261pub const MAXTC: ::c_long = 6;
1262
1263// Portable GLOB_* flags are defined at the `linux_like` level.
1264// The following are GNU extensions.
1265pub const GLOB_PERIOD: ::c_int = 1 << 7;
1266pub const GLOB_ALTDIRFUNC: ::c_int = 1 << 9;
1267pub const GLOB_BRACE: ::c_int = 1 << 10;
1268pub const GLOB_NOMAGIC: ::c_int = 1 << 11;
1269pub const GLOB_TILDE: ::c_int = 1 << 12;
1270pub const GLOB_ONLYDIR: ::c_int = 1 << 13;
1271pub const GLOB_TILDE_CHECK: ::c_int = 1 << 14;
1272
1273pub const MADV_COLLAPSE: ::c_int = 25;
1274
1275cfg_if! {
1276    if #[cfg(any(
1277        target_arch = "arm",
1278        target_arch = "x86",
1279        target_arch = "x86_64",
1280        target_arch = "s390x",
1281        target_arch = "riscv64",
1282        target_arch = "riscv32"
1283    ))] {
1284        pub const PTHREAD_STACK_MIN: ::size_t = 16384;
1285    } else if #[cfg(any(
1286               target_arch = "sparc",
1287               target_arch = "sparc64"
1288           ))] {
1289        pub const PTHREAD_STACK_MIN: ::size_t = 0x6000;
1290    } else {
1291        pub const PTHREAD_STACK_MIN: ::size_t = 131072;
1292    }
1293}
1294pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3;
1295
1296pub const REG_STARTEND: ::c_int = 4;
1297
1298pub const REG_EEND: ::c_int = 14;
1299pub const REG_ESIZE: ::c_int = 15;
1300pub const REG_ERPAREN: ::c_int = 16;
1301
1302cfg_if! {
1303    if #[cfg(any(target_arch = "x86",
1304                 target_arch = "x86_64",
1305                 target_arch = "arm",
1306                 target_arch = "aarch64",
1307                 target_arch = "loongarch64",
1308                 target_arch = "riscv64",
1309                 target_arch = "s390x"))] {
1310        pub const TUNSETCARRIER: ::Ioctl = 0x400454e2;
1311        pub const TUNGETDEVNETNS: ::Ioctl = 0x54e3;
1312    } else if #[cfg(any(target_arch = "mips",
1313                        target_arch = "mips64",
1314                        target_arch = "powerpc",
1315                        target_arch = "powerpc64",
1316                        target_arch = "sparc",
1317                        target_arch = "sparc64"))] {
1318        pub const TUNSETCARRIER: ::Ioctl = 0x800454e2;
1319        pub const TUNGETDEVNETNS: ::Ioctl = 0x200054e3;
1320    } else {
1321        // Unknown target_arch
1322    }
1323}
1324
1325extern "C" {
1326    pub fn fgetspent_r(
1327        fp: *mut ::FILE,
1328        spbuf: *mut ::spwd,
1329        buf: *mut ::c_char,
1330        buflen: ::size_t,
1331        spbufp: *mut *mut ::spwd,
1332    ) -> ::c_int;
1333    pub fn sgetspent_r(
1334        s: *const ::c_char,
1335        spbuf: *mut ::spwd,
1336        buf: *mut ::c_char,
1337        buflen: ::size_t,
1338        spbufp: *mut *mut ::spwd,
1339    ) -> ::c_int;
1340    pub fn getspent_r(
1341        spbuf: *mut ::spwd,
1342        buf: *mut ::c_char,
1343        buflen: ::size_t,
1344        spbufp: *mut *mut ::spwd,
1345    ) -> ::c_int;
1346    pub fn qsort_r(
1347        base: *mut ::c_void,
1348        num: ::size_t,
1349        size: ::size_t,
1350        compar: ::Option<
1351            unsafe extern "C" fn(*const ::c_void, *const ::c_void, *mut ::c_void) -> ::c_int,
1352        >,
1353        arg: *mut ::c_void,
1354    );
1355    pub fn sendmmsg(
1356        sockfd: ::c_int,
1357        msgvec: *mut ::mmsghdr,
1358        vlen: ::c_uint,
1359        flags: ::c_int,
1360    ) -> ::c_int;
1361    pub fn recvmmsg(
1362        sockfd: ::c_int,
1363        msgvec: *mut ::mmsghdr,
1364        vlen: ::c_uint,
1365        flags: ::c_int,
1366        timeout: *mut ::timespec,
1367    ) -> ::c_int;
1368
1369    pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int;
1370    pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int;
1371    pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int;
1372    pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
1373    pub fn prlimit(
1374        pid: ::pid_t,
1375        resource: ::__rlimit_resource_t,
1376        new_limit: *const ::rlimit,
1377        old_limit: *mut ::rlimit,
1378    ) -> ::c_int;
1379    pub fn prlimit64(
1380        pid: ::pid_t,
1381        resource: ::__rlimit_resource_t,
1382        new_limit: *const ::rlimit64,
1383        old_limit: *mut ::rlimit64,
1384    ) -> ::c_int;
1385    pub fn utmpname(file: *const ::c_char) -> ::c_int;
1386    pub fn utmpxname(file: *const ::c_char) -> ::c_int;
1387    pub fn getutxent() -> *mut utmpx;
1388    pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
1389    pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
1390    pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
1391    pub fn setutxent();
1392    pub fn endutxent();
1393    pub fn getpt() -> ::c_int;
1394    pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int;
1395    pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
1396    pub fn statx(
1397        dirfd: ::c_int,
1398        pathname: *const c_char,
1399        flags: ::c_int,
1400        mask: ::c_uint,
1401        statxbuf: *mut statx,
1402    ) -> ::c_int;
1403    pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
1404    pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
1405    pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
1406
1407    pub fn adjtimex(buf: *mut timex) -> ::c_int;
1408    pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
1409    #[link_name = "ntp_gettimex"]
1410    pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
1411    pub fn clock_adjtime(clk_id: ::clockid_t, buf: *mut ::timex) -> ::c_int;
1412
1413    pub fn fanotify_mark(
1414        fd: ::c_int,
1415        flags: ::c_uint,
1416        mask: u64,
1417        dirfd: ::c_int,
1418        path: *const ::c_char,
1419    ) -> ::c_int;
1420    pub fn preadv2(
1421        fd: ::c_int,
1422        iov: *const ::iovec,
1423        iovcnt: ::c_int,
1424        offset: ::off_t,
1425        flags: ::c_int,
1426    ) -> ::ssize_t;
1427    pub fn pwritev2(
1428        fd: ::c_int,
1429        iov: *const ::iovec,
1430        iovcnt: ::c_int,
1431        offset: ::off_t,
1432        flags: ::c_int,
1433    ) -> ::ssize_t;
1434    pub fn preadv64v2(
1435        fd: ::c_int,
1436        iov: *const ::iovec,
1437        iovcnt: ::c_int,
1438        offset: ::off64_t,
1439        flags: ::c_int,
1440    ) -> ::ssize_t;
1441    pub fn pwritev64v2(
1442        fd: ::c_int,
1443        iov: *const ::iovec,
1444        iovcnt: ::c_int,
1445        offset: ::off64_t,
1446        flags: ::c_int,
1447    ) -> ::ssize_t;
1448    pub fn renameat2(
1449        olddirfd: ::c_int,
1450        oldpath: *const ::c_char,
1451        newdirfd: ::c_int,
1452        newpath: *const ::c_char,
1453        flags: ::c_uint,
1454    ) -> ::c_int;
1455
1456    // Added in `glibc` 2.25
1457    pub fn explicit_bzero(s: *mut ::c_void, len: ::size_t);
1458    // Added in `glibc` 2.29
1459    pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
1460
1461    pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;
1462    pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
1463    pub fn glob64(
1464        pattern: *const ::c_char,
1465        flags: ::c_int,
1466        errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
1467        pglob: *mut glob64_t,
1468    ) -> ::c_int;
1469    pub fn globfree64(pglob: *mut glob64_t);
1470    pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
1471    pub fn pthread_attr_getaffinity_np(
1472        attr: *const ::pthread_attr_t,
1473        cpusetsize: ::size_t,
1474        cpuset: *mut ::cpu_set_t,
1475    ) -> ::c_int;
1476    pub fn pthread_attr_setaffinity_np(
1477        attr: *mut ::pthread_attr_t,
1478        cpusetsize: ::size_t,
1479        cpuset: *const ::cpu_set_t,
1480    ) -> ::c_int;
1481    pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
1482    pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
1483    pub fn pthread_rwlockattr_getkind_np(
1484        attr: *const ::pthread_rwlockattr_t,
1485        val: *mut ::c_int,
1486    ) -> ::c_int;
1487    pub fn pthread_rwlockattr_setkind_np(
1488        attr: *mut ::pthread_rwlockattr_t,
1489        val: ::c_int,
1490    ) -> ::c_int;
1491    pub fn pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::c_int;
1492    pub fn mallinfo() -> ::mallinfo;
1493    pub fn mallinfo2() -> ::mallinfo2;
1494    pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int;
1495    pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
1496    pub fn getpwent_r(
1497        pwd: *mut ::passwd,
1498        buf: *mut ::c_char,
1499        buflen: ::size_t,
1500        result: *mut *mut ::passwd,
1501    ) -> ::c_int;
1502    pub fn getgrent_r(
1503        grp: *mut ::group,
1504        buf: *mut ::c_char,
1505        buflen: ::size_t,
1506        result: *mut *mut ::group,
1507    ) -> ::c_int;
1508    pub fn fgetpwent_r(
1509        stream: *mut ::FILE,
1510        pwd: *mut ::passwd,
1511        buf: *mut ::c_char,
1512        buflen: ::size_t,
1513        result: *mut *mut ::passwd,
1514    ) -> ::c_int;
1515    pub fn fgetgrent_r(
1516        stream: *mut ::FILE,
1517        grp: *mut ::group,
1518        buf: *mut ::c_char,
1519        buflen: ::size_t,
1520        result: *mut *mut ::group,
1521    ) -> ::c_int;
1522
1523    pub fn putpwent(p: *const ::passwd, stream: *mut ::FILE) -> ::c_int;
1524    pub fn putgrent(grp: *const ::group, stream: *mut ::FILE) -> ::c_int;
1525
1526    pub fn sethostid(hostid: ::c_long) -> ::c_int;
1527
1528    pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
1529    pub fn mlock2(addr: *const ::c_void, len: ::size_t, flags: ::c_uint) -> ::c_int;
1530
1531    pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
1532    pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
1533
1534    pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char;
1535    pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char;
1536
1537    pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
1538    /// POSIX version of `basename(3)`, defined in `libgen.h`.
1539    #[link_name = "__xpg_basename"]
1540    pub fn posix_basename(path: *mut ::c_char) -> *mut ::c_char;
1541    /// GNU version of `basename(3)`, defined in `string.h`.
1542    #[link_name = "basename"]
1543    pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char;
1544    pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
1545    pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int;
1546    pub fn dladdr1(
1547        addr: *const ::c_void,
1548        info: *mut ::Dl_info,
1549        extra_info: *mut *mut ::c_void,
1550        flags: ::c_int,
1551    ) -> ::c_int;
1552    pub fn malloc_trim(__pad: ::size_t) -> ::c_int;
1553    pub fn gnu_get_libc_release() -> *const ::c_char;
1554    pub fn gnu_get_libc_version() -> *const ::c_char;
1555
1556    // posix/spawn.h
1557    // Added in `glibc` 2.29
1558    pub fn posix_spawn_file_actions_addchdir_np(
1559        actions: *mut ::posix_spawn_file_actions_t,
1560        path: *const ::c_char,
1561    ) -> ::c_int;
1562    // Added in `glibc` 2.29
1563    pub fn posix_spawn_file_actions_addfchdir_np(
1564        actions: *mut ::posix_spawn_file_actions_t,
1565        fd: ::c_int,
1566    ) -> ::c_int;
1567    // Added in `glibc` 2.34
1568    pub fn posix_spawn_file_actions_addclosefrom_np(
1569        actions: *mut ::posix_spawn_file_actions_t,
1570        from: ::c_int,
1571    ) -> ::c_int;
1572    // Added in `glibc` 2.35
1573    pub fn posix_spawn_file_actions_addtcsetpgrp_np(
1574        actions: *mut ::posix_spawn_file_actions_t,
1575        tcfd: ::c_int,
1576    ) -> ::c_int;
1577
1578    // mntent.h
1579    pub fn getmntent_r(
1580        stream: *mut ::FILE,
1581        mntbuf: *mut ::mntent,
1582        buf: *mut ::c_char,
1583        buflen: ::c_int,
1584    ) -> *mut ::mntent;
1585
1586    pub fn execveat(
1587        dirfd: ::c_int,
1588        pathname: *const ::c_char,
1589        argv: *const *mut c_char,
1590        envp: *const *mut c_char,
1591        flags: ::c_int,
1592    ) -> ::c_int;
1593
1594    // Added in `glibc` 2.34
1595    pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int;
1596
1597    pub fn mq_notify(mqdes: ::mqd_t, sevp: *const ::sigevent) -> ::c_int;
1598
1599    pub fn epoll_pwait2(
1600        epfd: ::c_int,
1601        events: *mut ::epoll_event,
1602        maxevents: ::c_int,
1603        timeout: *const ::timespec,
1604        sigmask: *const ::sigset_t,
1605    ) -> ::c_int;
1606}
1607
1608cfg_if! {
1609    if #[cfg(any(target_arch = "x86",
1610                 target_arch = "arm",
1611                 target_arch = "m68k",
1612                 target_arch = "csky",
1613                 target_arch = "mips",
1614                 target_arch = "mips32r6",
1615                 target_arch = "powerpc",
1616                 target_arch = "sparc",
1617                 target_arch = "riscv32"))] {
1618        mod b32;
1619        pub use self::b32::*;
1620    } else if #[cfg(any(target_arch = "x86_64",
1621                        target_arch = "aarch64",
1622                        target_arch = "powerpc64",
1623                        target_arch = "mips64",
1624                        target_arch = "mips64r6",
1625                        target_arch = "s390x",
1626                        target_arch = "sparc64",
1627                        target_arch = "riscv64",
1628                        target_arch = "loongarch64"))] {
1629        mod b64;
1630        pub use self::b64::*;
1631    } else {
1632        // Unknown target_arch
1633    }
1634}
1635
1636cfg_if! {
1637    if #[cfg(libc_align)] {
1638        mod align;
1639        pub use self::align::*;
1640    } else {
1641        mod no_align;
1642        pub use self::no_align::*;
1643    }
1644}