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