libc/unix/linux_like/linux/
mod.rs

1//! Linux-specific definitions for linux-like values
2
3use crate::prelude::*;
4use crate::{sock_filter, _IO, _IOR, _IOW, _IOWR};
5
6pub type useconds_t = u32;
7pub type dev_t = u64;
8pub type socklen_t = u32;
9pub type mode_t = u32;
10pub type ino64_t = u64;
11pub type off64_t = i64;
12pub type blkcnt64_t = i64;
13pub type rlim64_t = u64;
14pub type mqd_t = c_int;
15pub type nfds_t = c_ulong;
16pub type nl_item = c_int;
17pub type idtype_t = c_uint;
18pub type loff_t = c_longlong;
19pub type pthread_key_t = c_uint;
20pub type pthread_once_t = c_int;
21pub type pthread_spinlock_t = c_int;
22pub type __kernel_fsid_t = __c_anonymous__kernel_fsid_t;
23pub type __kernel_clockid_t = c_int;
24
25pub type __u8 = c_uchar;
26pub type __u16 = c_ushort;
27pub type __s16 = c_short;
28pub type __u32 = c_uint;
29pub type __s32 = c_int;
30
31pub type Elf32_Half = u16;
32pub type Elf32_Word = u32;
33pub type Elf32_Off = u32;
34pub type Elf32_Addr = u32;
35pub type Elf32_Xword = u64;
36pub type Elf32_Sword = i32;
37
38pub type Elf64_Half = u16;
39pub type Elf64_Word = u32;
40pub type Elf64_Off = u64;
41pub type Elf64_Addr = u64;
42pub type Elf64_Xword = u64;
43pub type Elf64_Sxword = i64;
44pub type Elf64_Sword = i32;
45
46pub type Elf32_Section = u16;
47pub type Elf64_Section = u16;
48
49pub type Elf32_Relr = Elf32_Word;
50pub type Elf64_Relr = Elf32_Xword;
51pub type Elf32_Rel = __c_anonymous_elf32_rel;
52pub type Elf64_Rel = __c_anonymous_elf64_rel;
53
54cfg_if! {
55    if #[cfg(not(target_arch = "sparc64"))] {
56        pub type Elf32_Rela = __c_anonymous_elf32_rela;
57        pub type Elf64_Rela = __c_anonymous_elf64_rela;
58    }
59}
60
61pub type iconv_t = *mut c_void;
62
63// linux/sctp.h
64pub type sctp_assoc_t = __s32;
65
66pub type eventfd_t = u64;
67
68cfg_if! {
69    if #[cfg(not(target_env = "gnu"))] {
70        missing! {
71            #[cfg_attr(feature = "extra_traits", derive(Debug))]
72            pub enum fpos64_t {} // FIXME(linux): fill this out with a struct
73        }
74    }
75}
76
77e! {
78    #[repr(u32)]
79    pub enum tpacket_versions {
80        TPACKET_V1,
81        TPACKET_V2,
82        TPACKET_V3,
83    }
84}
85
86c_enum! {
87    pub enum pid_type {
88        PIDTYPE_PID,
89        PIDTYPE_TGID,
90        PIDTYPE_PGID,
91        PIDTYPE_SID,
92        PIDTYPE_MAX,
93    }
94}
95
96s! {
97    pub struct glob_t {
98        pub gl_pathc: size_t,
99        pub gl_pathv: *mut *mut c_char,
100        pub gl_offs: size_t,
101        pub gl_flags: c_int,
102
103        __unused1: *mut c_void,
104        __unused2: *mut c_void,
105        __unused3: *mut c_void,
106        __unused4: *mut c_void,
107        __unused5: *mut c_void,
108    }
109
110    pub struct passwd {
111        pub pw_name: *mut c_char,
112        pub pw_passwd: *mut c_char,
113        pub pw_uid: crate::uid_t,
114        pub pw_gid: crate::gid_t,
115        pub pw_gecos: *mut c_char,
116        pub pw_dir: *mut c_char,
117        pub pw_shell: *mut c_char,
118    }
119
120    pub struct spwd {
121        pub sp_namp: *mut c_char,
122        pub sp_pwdp: *mut c_char,
123        pub sp_lstchg: c_long,
124        pub sp_min: c_long,
125        pub sp_max: c_long,
126        pub sp_warn: c_long,
127        pub sp_inact: c_long,
128        pub sp_expire: c_long,
129        pub sp_flag: c_ulong,
130    }
131
132    pub struct dqblk {
133        pub dqb_bhardlimit: u64,
134        pub dqb_bsoftlimit: u64,
135        pub dqb_curspace: u64,
136        pub dqb_ihardlimit: u64,
137        pub dqb_isoftlimit: u64,
138        pub dqb_curinodes: u64,
139        pub dqb_btime: u64,
140        pub dqb_itime: u64,
141        pub dqb_valid: u32,
142    }
143
144    pub struct signalfd_siginfo {
145        pub ssi_signo: u32,
146        pub ssi_errno: i32,
147        pub ssi_code: i32,
148        pub ssi_pid: u32,
149        pub ssi_uid: u32,
150        pub ssi_fd: i32,
151        pub ssi_tid: u32,
152        pub ssi_band: u32,
153        pub ssi_overrun: u32,
154        pub ssi_trapno: u32,
155        pub ssi_status: i32,
156        pub ssi_int: i32,
157        pub ssi_ptr: u64,
158        pub ssi_utime: u64,
159        pub ssi_stime: u64,
160        pub ssi_addr: u64,
161        pub ssi_addr_lsb: u16,
162        _pad2: u16,
163        pub ssi_syscall: i32,
164        pub ssi_call_addr: u64,
165        pub ssi_arch: u32,
166        _pad: [u8; 28],
167    }
168
169    pub struct itimerspec {
170        pub it_interval: crate::timespec,
171        pub it_value: crate::timespec,
172    }
173
174    pub struct fsid_t {
175        __val: [c_int; 2],
176    }
177
178    pub struct fanout_args {
179        #[cfg(target_endian = "little")]
180        pub id: __u16,
181        pub type_flags: __u16,
182        #[cfg(target_endian = "big")]
183        pub id: __u16,
184        pub max_num_members: __u32,
185    }
186
187    pub struct packet_mreq {
188        pub mr_ifindex: c_int,
189        pub mr_type: c_ushort,
190        pub mr_alen: c_ushort,
191        pub mr_address: [c_uchar; 8],
192    }
193
194    #[deprecated(since = "0.2.70", note = "sockaddr_ll type must be used instead")]
195    pub struct sockaddr_pkt {
196        pub spkt_family: c_ushort,
197        pub spkt_device: [c_uchar; 14],
198        pub spkt_protocol: c_ushort,
199    }
200
201    pub struct tpacket_auxdata {
202        pub tp_status: __u32,
203        pub tp_len: __u32,
204        pub tp_snaplen: __u32,
205        pub tp_mac: __u16,
206        pub tp_net: __u16,
207        pub tp_vlan_tci: __u16,
208        pub tp_vlan_tpid: __u16,
209    }
210
211    pub struct tpacket_hdr {
212        pub tp_status: c_ulong,
213        pub tp_len: c_uint,
214        pub tp_snaplen: c_uint,
215        pub tp_mac: c_ushort,
216        pub tp_net: c_ushort,
217        pub tp_sec: c_uint,
218        pub tp_usec: c_uint,
219    }
220
221    pub struct tpacket_hdr_variant1 {
222        pub tp_rxhash: __u32,
223        pub tp_vlan_tci: __u32,
224        pub tp_vlan_tpid: __u16,
225        pub tp_padding: __u16,
226    }
227
228    pub struct tpacket2_hdr {
229        pub tp_status: __u32,
230        pub tp_len: __u32,
231        pub tp_snaplen: __u32,
232        pub tp_mac: __u16,
233        pub tp_net: __u16,
234        pub tp_sec: __u32,
235        pub tp_nsec: __u32,
236        pub tp_vlan_tci: __u16,
237        pub tp_vlan_tpid: __u16,
238        pub tp_padding: [__u8; 4],
239    }
240
241    pub struct tpacket_req {
242        pub tp_block_size: c_uint,
243        pub tp_block_nr: c_uint,
244        pub tp_frame_size: c_uint,
245        pub tp_frame_nr: c_uint,
246    }
247
248    pub struct tpacket_req3 {
249        pub tp_block_size: c_uint,
250        pub tp_block_nr: c_uint,
251        pub tp_frame_size: c_uint,
252        pub tp_frame_nr: c_uint,
253        pub tp_retire_blk_tov: c_uint,
254        pub tp_sizeof_priv: c_uint,
255        pub tp_feature_req_word: c_uint,
256    }
257
258    #[repr(align(8))]
259    pub struct tpacket_rollover_stats {
260        pub tp_all: crate::__u64,
261        pub tp_huge: crate::__u64,
262        pub tp_failed: crate::__u64,
263    }
264
265    pub struct tpacket_stats {
266        pub tp_packets: c_uint,
267        pub tp_drops: c_uint,
268    }
269
270    pub struct tpacket_stats_v3 {
271        pub tp_packets: c_uint,
272        pub tp_drops: c_uint,
273        pub tp_freeze_q_cnt: c_uint,
274    }
275
276    pub struct tpacket3_hdr {
277        pub tp_next_offset: __u32,
278        pub tp_sec: __u32,
279        pub tp_nsec: __u32,
280        pub tp_snaplen: __u32,
281        pub tp_len: __u32,
282        pub tp_status: __u32,
283        pub tp_mac: __u16,
284        pub tp_net: __u16,
285        pub hv1: crate::tpacket_hdr_variant1,
286        pub tp_padding: [__u8; 8],
287    }
288
289    pub struct tpacket_bd_ts {
290        pub ts_sec: c_uint,
291        pub ts_usec: c_uint,
292    }
293
294    #[repr(align(8))]
295    pub struct tpacket_hdr_v1 {
296        pub block_status: __u32,
297        pub num_pkts: __u32,
298        pub offset_to_first_pkt: __u32,
299        pub blk_len: __u32,
300        pub seq_num: crate::__u64,
301        pub ts_first_pkt: crate::tpacket_bd_ts,
302        pub ts_last_pkt: crate::tpacket_bd_ts,
303    }
304
305    pub struct cpu_set_t {
306        #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
307        bits: [u32; 32],
308        #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))]
309        bits: [u64; 16],
310    }
311
312    pub struct if_nameindex {
313        pub if_index: c_uint,
314        pub if_name: *mut c_char,
315    }
316
317    // System V IPC
318    pub struct msginfo {
319        pub msgpool: c_int,
320        pub msgmap: c_int,
321        pub msgmax: c_int,
322        pub msgmnb: c_int,
323        pub msgmni: c_int,
324        pub msgssz: c_int,
325        pub msgtql: c_int,
326        pub msgseg: c_ushort,
327    }
328
329    pub struct sembuf {
330        pub sem_num: c_ushort,
331        pub sem_op: c_short,
332        pub sem_flg: c_short,
333    }
334
335    pub struct input_event {
336        // FIXME(1.0): Change to the commented variant, see https://github.com/rust-lang/libc/pull/4148#discussion_r1857511742
337        #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
338        pub time: crate::timeval,
339        // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
340        // pub input_event_sec: time_t,
341        // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
342        // pub input_event_usec: suseconds_t,
343        // #[cfg(target_arch = "sparc64")]
344        // _pad1: c_int,
345        #[cfg(all(target_pointer_width = "32", linux_time_bits64))]
346        pub input_event_sec: c_ulong,
347
348        #[cfg(all(target_pointer_width = "32", linux_time_bits64))]
349        pub input_event_usec: c_ulong,
350
351        pub type_: __u16,
352        pub code: __u16,
353        pub value: __s32,
354    }
355
356    pub struct input_id {
357        pub bustype: __u16,
358        pub vendor: __u16,
359        pub product: __u16,
360        pub version: __u16,
361    }
362
363    pub struct input_absinfo {
364        pub value: __s32,
365        pub minimum: __s32,
366        pub maximum: __s32,
367        pub fuzz: __s32,
368        pub flat: __s32,
369        pub resolution: __s32,
370    }
371
372    pub struct input_keymap_entry {
373        pub flags: __u8,
374        pub len: __u8,
375        pub index: __u16,
376        pub keycode: __u32,
377        pub scancode: [__u8; 32],
378    }
379
380    pub struct input_mask {
381        pub type_: __u32,
382        pub codes_size: __u32,
383        pub codes_ptr: crate::__u64,
384    }
385
386    pub struct ff_replay {
387        pub length: __u16,
388        pub delay: __u16,
389    }
390
391    pub struct ff_trigger {
392        pub button: __u16,
393        pub interval: __u16,
394    }
395
396    pub struct ff_envelope {
397        pub attack_length: __u16,
398        pub attack_level: __u16,
399        pub fade_length: __u16,
400        pub fade_level: __u16,
401    }
402
403    pub struct ff_constant_effect {
404        pub level: __s16,
405        pub envelope: ff_envelope,
406    }
407
408    pub struct ff_ramp_effect {
409        pub start_level: __s16,
410        pub end_level: __s16,
411        pub envelope: ff_envelope,
412    }
413
414    pub struct ff_condition_effect {
415        pub right_saturation: __u16,
416        pub left_saturation: __u16,
417
418        pub right_coeff: __s16,
419        pub left_coeff: __s16,
420
421        pub deadband: __u16,
422        pub center: __s16,
423    }
424
425    pub struct ff_periodic_effect {
426        pub waveform: __u16,
427        pub period: __u16,
428        pub magnitude: __s16,
429        pub offset: __s16,
430        pub phase: __u16,
431
432        pub envelope: ff_envelope,
433
434        pub custom_len: __u32,
435        pub custom_data: *mut __s16,
436    }
437
438    pub struct ff_rumble_effect {
439        pub strong_magnitude: __u16,
440        pub weak_magnitude: __u16,
441    }
442
443    pub struct ff_effect {
444        pub type_: __u16,
445        pub id: __s16,
446        pub direction: __u16,
447        pub trigger: ff_trigger,
448        pub replay: ff_replay,
449        // FIXME(1.0): this is actually a union
450        #[cfg(target_pointer_width = "64")]
451        pub u: [u64; 4],
452        #[cfg(target_pointer_width = "32")]
453        pub u: [u32; 7],
454    }
455
456    pub struct uinput_ff_upload {
457        pub request_id: __u32,
458        pub retval: __s32,
459        pub effect: ff_effect,
460        pub old: ff_effect,
461    }
462
463    pub struct uinput_ff_erase {
464        pub request_id: __u32,
465        pub retval: __s32,
466        pub effect_id: __u32,
467    }
468
469    pub struct uinput_abs_setup {
470        pub code: __u16,
471        pub absinfo: input_absinfo,
472    }
473
474    pub struct dl_phdr_info {
475        #[cfg(target_pointer_width = "64")]
476        pub dlpi_addr: Elf64_Addr,
477        #[cfg(target_pointer_width = "32")]
478        pub dlpi_addr: Elf32_Addr,
479
480        pub dlpi_name: *const c_char,
481
482        #[cfg(target_pointer_width = "64")]
483        pub dlpi_phdr: *const Elf64_Phdr,
484        #[cfg(target_pointer_width = "32")]
485        pub dlpi_phdr: *const Elf32_Phdr,
486
487        #[cfg(target_pointer_width = "64")]
488        pub dlpi_phnum: Elf64_Half,
489        #[cfg(target_pointer_width = "32")]
490        pub dlpi_phnum: Elf32_Half,
491
492        // As of uClibc 1.0.36, the following fields are
493        // gated behind a "#if 0" block which always evaluates
494        // to false. So I'm just removing these, and if uClibc changes
495        // the #if block in the future to include the following fields, these
496        // will probably need including here. tsidea, skrap
497        // QNX (NTO) platform does not define these fields
498        #[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
499        pub dlpi_adds: c_ulonglong,
500        #[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
501        pub dlpi_subs: c_ulonglong,
502        #[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
503        pub dlpi_tls_modid: size_t,
504        #[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
505        pub dlpi_tls_data: *mut c_void,
506    }
507
508    pub struct Elf32_Ehdr {
509        pub e_ident: [c_uchar; 16],
510        pub e_type: Elf32_Half,
511        pub e_machine: Elf32_Half,
512        pub e_version: Elf32_Word,
513        pub e_entry: Elf32_Addr,
514        pub e_phoff: Elf32_Off,
515        pub e_shoff: Elf32_Off,
516        pub e_flags: Elf32_Word,
517        pub e_ehsize: Elf32_Half,
518        pub e_phentsize: Elf32_Half,
519        pub e_phnum: Elf32_Half,
520        pub e_shentsize: Elf32_Half,
521        pub e_shnum: Elf32_Half,
522        pub e_shstrndx: Elf32_Half,
523    }
524
525    pub struct Elf64_Ehdr {
526        pub e_ident: [c_uchar; 16],
527        pub e_type: Elf64_Half,
528        pub e_machine: Elf64_Half,
529        pub e_version: Elf64_Word,
530        pub e_entry: Elf64_Addr,
531        pub e_phoff: Elf64_Off,
532        pub e_shoff: Elf64_Off,
533        pub e_flags: Elf64_Word,
534        pub e_ehsize: Elf64_Half,
535        pub e_phentsize: Elf64_Half,
536        pub e_phnum: Elf64_Half,
537        pub e_shentsize: Elf64_Half,
538        pub e_shnum: Elf64_Half,
539        pub e_shstrndx: Elf64_Half,
540    }
541
542    pub struct Elf32_Sym {
543        pub st_name: Elf32_Word,
544        pub st_value: Elf32_Addr,
545        pub st_size: Elf32_Word,
546        pub st_info: c_uchar,
547        pub st_other: c_uchar,
548        pub st_shndx: Elf32_Section,
549    }
550
551    pub struct Elf64_Sym {
552        pub st_name: Elf64_Word,
553        pub st_info: c_uchar,
554        pub st_other: c_uchar,
555        pub st_shndx: Elf64_Section,
556        pub st_value: Elf64_Addr,
557        pub st_size: Elf64_Xword,
558    }
559
560    pub struct Elf32_Phdr {
561        pub p_type: Elf32_Word,
562        pub p_offset: Elf32_Off,
563        pub p_vaddr: Elf32_Addr,
564        pub p_paddr: Elf32_Addr,
565        pub p_filesz: Elf32_Word,
566        pub p_memsz: Elf32_Word,
567        pub p_flags: Elf32_Word,
568        pub p_align: Elf32_Word,
569    }
570
571    pub struct Elf64_Phdr {
572        pub p_type: Elf64_Word,
573        pub p_flags: Elf64_Word,
574        pub p_offset: Elf64_Off,
575        pub p_vaddr: Elf64_Addr,
576        pub p_paddr: Elf64_Addr,
577        pub p_filesz: Elf64_Xword,
578        pub p_memsz: Elf64_Xword,
579        pub p_align: Elf64_Xword,
580    }
581
582    pub struct Elf32_Shdr {
583        pub sh_name: Elf32_Word,
584        pub sh_type: Elf32_Word,
585        pub sh_flags: Elf32_Word,
586        pub sh_addr: Elf32_Addr,
587        pub sh_offset: Elf32_Off,
588        pub sh_size: Elf32_Word,
589        pub sh_link: Elf32_Word,
590        pub sh_info: Elf32_Word,
591        pub sh_addralign: Elf32_Word,
592        pub sh_entsize: Elf32_Word,
593    }
594
595    pub struct Elf64_Shdr {
596        pub sh_name: Elf64_Word,
597        pub sh_type: Elf64_Word,
598        pub sh_flags: Elf64_Xword,
599        pub sh_addr: Elf64_Addr,
600        pub sh_offset: Elf64_Off,
601        pub sh_size: Elf64_Xword,
602        pub sh_link: Elf64_Word,
603        pub sh_info: Elf64_Word,
604        pub sh_addralign: Elf64_Xword,
605        pub sh_entsize: Elf64_Xword,
606    }
607
608    pub struct __c_anonymous_elf32_rel {
609        pub r_offset: Elf32_Addr,
610        pub r_info: Elf32_Word,
611    }
612
613    pub struct __c_anonymous_elf64_rel {
614        pub r_offset: Elf64_Addr,
615        pub r_info: Elf64_Xword,
616    }
617
618    pub struct __c_anonymous__kernel_fsid_t {
619        pub val: [c_int; 2],
620    }
621
622    pub struct ucred {
623        pub pid: crate::pid_t,
624        pub uid: crate::uid_t,
625        pub gid: crate::gid_t,
626    }
627
628    pub struct mntent {
629        pub mnt_fsname: *mut c_char,
630        pub mnt_dir: *mut c_char,
631        pub mnt_type: *mut c_char,
632        pub mnt_opts: *mut c_char,
633        pub mnt_freq: c_int,
634        pub mnt_passno: c_int,
635    }
636
637    pub struct posix_spawn_file_actions_t {
638        __allocated: c_int,
639        __used: c_int,
640        __actions: *mut c_int,
641        __pad: [c_int; 16],
642    }
643
644    pub struct posix_spawnattr_t {
645        __flags: c_short,
646        __pgrp: crate::pid_t,
647        __sd: crate::sigset_t,
648        __ss: crate::sigset_t,
649        #[cfg(any(target_env = "musl", target_env = "ohos"))]
650        __prio: c_int,
651        #[cfg(not(any(target_env = "musl", target_env = "ohos")))]
652        __sp: crate::sched_param,
653        __policy: c_int,
654        __pad: [c_int; 16],
655    }
656
657    pub struct genlmsghdr {
658        pub cmd: u8,
659        pub version: u8,
660        pub reserved: u16,
661    }
662
663    pub struct in6_pktinfo {
664        pub ipi6_addr: crate::in6_addr,
665        pub ipi6_ifindex: c_uint,
666    }
667
668    pub struct arpd_request {
669        pub req: c_ushort,
670        pub ip: u32,
671        pub dev: c_ulong,
672        pub stamp: c_ulong,
673        pub updated: c_ulong,
674        pub ha: [c_uchar; crate::MAX_ADDR_LEN],
675    }
676
677    pub struct inotify_event {
678        pub wd: c_int,
679        pub mask: u32,
680        pub cookie: u32,
681        pub len: u32,
682    }
683
684    pub struct fanotify_response {
685        pub fd: c_int,
686        pub response: __u32,
687    }
688
689    pub struct fanotify_event_info_header {
690        pub info_type: __u8,
691        pub pad: __u8,
692        pub len: __u16,
693    }
694
695    pub struct fanotify_event_info_fid {
696        pub hdr: fanotify_event_info_header,
697        pub fsid: crate::__kernel_fsid_t,
698        pub handle: [c_uchar; 0],
699    }
700
701    pub struct sockaddr_vm {
702        pub svm_family: crate::sa_family_t,
703        pub svm_reserved1: c_ushort,
704        pub svm_port: c_uint,
705        pub svm_cid: c_uint,
706        pub svm_zero: [u8; 4],
707    }
708
709    pub struct regmatch_t {
710        pub rm_so: regoff_t,
711        pub rm_eo: regoff_t,
712    }
713
714    pub struct sock_extended_err {
715        pub ee_errno: u32,
716        pub ee_origin: u8,
717        pub ee_type: u8,
718        pub ee_code: u8,
719        pub ee_pad: u8,
720        pub ee_info: u32,
721        pub ee_data: u32,
722    }
723
724    // linux/seccomp.h
725    pub struct seccomp_data {
726        pub nr: c_int,
727        pub arch: __u32,
728        pub instruction_pointer: crate::__u64,
729        pub args: [crate::__u64; 6],
730    }
731
732    pub struct seccomp_notif_sizes {
733        pub seccomp_notif: __u16,
734        pub seccomp_notif_resp: __u16,
735        pub seccomp_data: __u16,
736    }
737
738    pub struct seccomp_notif {
739        pub id: crate::__u64,
740        pub pid: __u32,
741        pub flags: __u32,
742        pub data: seccomp_data,
743    }
744
745    pub struct seccomp_notif_resp {
746        pub id: crate::__u64,
747        pub val: crate::__s64,
748        pub error: __s32,
749        pub flags: __u32,
750    }
751
752    pub struct seccomp_notif_addfd {
753        pub id: crate::__u64,
754        pub flags: __u32,
755        pub srcfd: __u32,
756        pub newfd: __u32,
757        pub newfd_flags: __u32,
758    }
759
760    pub struct nlmsghdr {
761        pub nlmsg_len: u32,
762        pub nlmsg_type: u16,
763        pub nlmsg_flags: u16,
764        pub nlmsg_seq: u32,
765        pub nlmsg_pid: u32,
766    }
767
768    pub struct nlmsgerr {
769        pub error: c_int,
770        pub msg: nlmsghdr,
771    }
772
773    pub struct nlattr {
774        pub nla_len: u16,
775        pub nla_type: u16,
776    }
777
778    pub struct __c_anonymous_ifru_map {
779        pub mem_start: c_ulong,
780        pub mem_end: c_ulong,
781        pub base_addr: c_ushort,
782        pub irq: c_uchar,
783        pub dma: c_uchar,
784        pub port: c_uchar,
785    }
786
787    pub struct in6_ifreq {
788        pub ifr6_addr: crate::in6_addr,
789        pub ifr6_prefixlen: u32,
790        pub ifr6_ifindex: c_int,
791    }
792
793    pub struct option {
794        pub name: *const c_char,
795        pub has_arg: c_int,
796        pub flag: *mut c_int,
797        pub val: c_int,
798    }
799
800    // linux/openat2.h
801    #[non_exhaustive]
802    pub struct open_how {
803        pub flags: crate::__u64,
804        pub mode: crate::__u64,
805        pub resolve: crate::__u64,
806    }
807
808    // linux/ptp_clock.h
809    pub struct ptp_clock_time {
810        pub sec: crate::__s64,
811        pub nsec: __u32,
812        pub reserved: __u32,
813    }
814
815    pub struct ptp_extts_request {
816        pub index: c_uint,
817        pub flags: c_uint,
818        pub rsv: [c_uint; 2],
819    }
820
821    pub struct ptp_sys_offset_extended {
822        pub n_samples: c_uint,
823        pub clockid: __kernel_clockid_t,
824        pub rsv: [c_uint; 2],
825        pub ts: [[ptp_clock_time; 3]; PTP_MAX_SAMPLES as usize],
826    }
827
828    pub struct ptp_sys_offset_precise {
829        pub device: ptp_clock_time,
830        pub sys_realtime: ptp_clock_time,
831        pub sys_monoraw: ptp_clock_time,
832        pub rsv: [c_uint; 4],
833    }
834
835    pub struct ptp_extts_event {
836        pub t: ptp_clock_time,
837        index: c_uint,
838        flags: c_uint,
839        rsv: [c_uint; 2],
840    }
841
842    // linux/sctp.h
843
844    pub struct sctp_initmsg {
845        pub sinit_num_ostreams: __u16,
846        pub sinit_max_instreams: __u16,
847        pub sinit_max_attempts: __u16,
848        pub sinit_max_init_timeo: __u16,
849    }
850
851    pub struct sctp_sndrcvinfo {
852        pub sinfo_stream: __u16,
853        pub sinfo_ssn: __u16,
854        pub sinfo_flags: __u16,
855        pub sinfo_ppid: __u32,
856        pub sinfo_context: __u32,
857        pub sinfo_timetolive: __u32,
858        pub sinfo_tsn: __u32,
859        pub sinfo_cumtsn: __u32,
860        pub sinfo_assoc_id: crate::sctp_assoc_t,
861    }
862
863    pub struct sctp_sndinfo {
864        pub snd_sid: __u16,
865        pub snd_flags: __u16,
866        pub snd_ppid: __u32,
867        pub snd_context: __u32,
868        pub snd_assoc_id: crate::sctp_assoc_t,
869    }
870
871    pub struct sctp_rcvinfo {
872        pub rcv_sid: __u16,
873        pub rcv_ssn: __u16,
874        pub rcv_flags: __u16,
875        pub rcv_ppid: __u32,
876        pub rcv_tsn: __u32,
877        pub rcv_cumtsn: __u32,
878        pub rcv_context: __u32,
879        pub rcv_assoc_id: crate::sctp_assoc_t,
880    }
881
882    pub struct sctp_nxtinfo {
883        pub nxt_sid: __u16,
884        pub nxt_flags: __u16,
885        pub nxt_ppid: __u32,
886        pub nxt_length: __u32,
887        pub nxt_assoc_id: crate::sctp_assoc_t,
888    }
889
890    pub struct sctp_prinfo {
891        pub pr_policy: __u16,
892        pub pr_value: __u32,
893    }
894
895    pub struct sctp_authinfo {
896        pub auth_keynumber: __u16,
897    }
898
899    pub struct rlimit64 {
900        pub rlim_cur: rlim64_t,
901        pub rlim_max: rlim64_t,
902    }
903
904    // linux/tls.h
905
906    pub struct tls_crypto_info {
907        pub version: __u16,
908        pub cipher_type: __u16,
909    }
910
911    pub struct tls12_crypto_info_aes_gcm_128 {
912        pub info: tls_crypto_info,
913        pub iv: [c_uchar; TLS_CIPHER_AES_GCM_128_IV_SIZE],
914        pub key: [c_uchar; TLS_CIPHER_AES_GCM_128_KEY_SIZE],
915        pub salt: [c_uchar; TLS_CIPHER_AES_GCM_128_SALT_SIZE],
916        pub rec_seq: [c_uchar; TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE],
917    }
918
919    pub struct tls12_crypto_info_aes_gcm_256 {
920        pub info: tls_crypto_info,
921        pub iv: [c_uchar; TLS_CIPHER_AES_GCM_256_IV_SIZE],
922        pub key: [c_uchar; TLS_CIPHER_AES_GCM_256_KEY_SIZE],
923        pub salt: [c_uchar; TLS_CIPHER_AES_GCM_256_SALT_SIZE],
924        pub rec_seq: [c_uchar; TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE],
925    }
926
927    pub struct tls12_crypto_info_aes_ccm_128 {
928        pub info: tls_crypto_info,
929        pub iv: [c_uchar; TLS_CIPHER_AES_CCM_128_IV_SIZE],
930        pub key: [c_uchar; TLS_CIPHER_AES_CCM_128_KEY_SIZE],
931        pub salt: [c_uchar; TLS_CIPHER_AES_CCM_128_SALT_SIZE],
932        pub rec_seq: [c_uchar; TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE],
933    }
934
935    pub struct tls12_crypto_info_chacha20_poly1305 {
936        pub info: tls_crypto_info,
937        pub iv: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE],
938        pub key: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE],
939        pub salt: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE],
940        pub rec_seq: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE],
941    }
942
943    pub struct tls12_crypto_info_sm4_gcm {
944        pub info: tls_crypto_info,
945        pub iv: [c_uchar; TLS_CIPHER_SM4_GCM_IV_SIZE],
946        pub key: [c_uchar; TLS_CIPHER_SM4_GCM_KEY_SIZE],
947        pub salt: [c_uchar; TLS_CIPHER_SM4_GCM_SALT_SIZE],
948        pub rec_seq: [c_uchar; TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE],
949    }
950
951    pub struct tls12_crypto_info_sm4_ccm {
952        pub info: tls_crypto_info,
953        pub iv: [c_uchar; TLS_CIPHER_SM4_CCM_IV_SIZE],
954        pub key: [c_uchar; TLS_CIPHER_SM4_CCM_KEY_SIZE],
955        pub salt: [c_uchar; TLS_CIPHER_SM4_CCM_SALT_SIZE],
956        pub rec_seq: [c_uchar; TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE],
957    }
958
959    pub struct tls12_crypto_info_aria_gcm_128 {
960        pub info: tls_crypto_info,
961        pub iv: [c_uchar; TLS_CIPHER_ARIA_GCM_128_IV_SIZE],
962        pub key: [c_uchar; TLS_CIPHER_ARIA_GCM_128_KEY_SIZE],
963        pub salt: [c_uchar; TLS_CIPHER_ARIA_GCM_128_SALT_SIZE],
964        pub rec_seq: [c_uchar; TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE],
965    }
966
967    pub struct tls12_crypto_info_aria_gcm_256 {
968        pub info: tls_crypto_info,
969        pub iv: [c_uchar; TLS_CIPHER_ARIA_GCM_256_IV_SIZE],
970        pub key: [c_uchar; TLS_CIPHER_ARIA_GCM_256_KEY_SIZE],
971        pub salt: [c_uchar; TLS_CIPHER_ARIA_GCM_256_SALT_SIZE],
972        pub rec_seq: [c_uchar; TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE],
973    }
974
975    // linux/wireless.h
976
977    pub struct iw_param {
978        pub value: __s32,
979        pub fixed: __u8,
980        pub disabled: __u8,
981        pub flags: __u16,
982    }
983
984    pub struct iw_point {
985        pub pointer: *mut c_void,
986        pub length: __u16,
987        pub flags: __u16,
988    }
989
990    pub struct iw_freq {
991        pub m: __s32,
992        pub e: __s16,
993        pub i: __u8,
994        pub flags: __u8,
995    }
996
997    pub struct iw_quality {
998        pub qual: __u8,
999        pub level: __u8,
1000        pub noise: __u8,
1001        pub updated: __u8,
1002    }
1003
1004    pub struct iw_discarded {
1005        pub nwid: __u32,
1006        pub code: __u32,
1007        pub fragment: __u32,
1008        pub retries: __u32,
1009        pubmisc: __u32,
1010    }
1011
1012    pub struct iw_missed {
1013        pub beacon: __u32,
1014    }
1015
1016    pub struct iw_scan_req {
1017        pub scan_type: __u8,
1018        pub essid_len: __u8,
1019        pub num_channels: __u8,
1020        pub flags: __u8,
1021        pub bssid: crate::sockaddr,
1022        pub essid: [__u8; IW_ESSID_MAX_SIZE],
1023        pub min_channel_time: __u32,
1024        pub max_channel_time: __u32,
1025        pub channel_list: [iw_freq; IW_MAX_FREQUENCIES],
1026    }
1027
1028    pub struct iw_encode_ext {
1029        pub ext_flags: __u32,
1030        pub tx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
1031        pub rx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
1032        pub addr: crate::sockaddr,
1033        pub alg: __u16,
1034        pub key_len: __u16,
1035        pub key: [__u8; 0],
1036    }
1037
1038    pub struct iw_pmksa {
1039        pub cmd: __u32,
1040        pub bssid: crate::sockaddr,
1041        pub pmkid: [__u8; IW_PMKID_LEN],
1042    }
1043
1044    pub struct iw_pmkid_cand {
1045        pub flags: __u32,
1046        pub index: __u32,
1047        pub bssid: crate::sockaddr,
1048    }
1049
1050    pub struct iw_statistics {
1051        pub status: __u16,
1052        pub qual: iw_quality,
1053        pub discard: iw_discarded,
1054        pub miss: iw_missed,
1055    }
1056
1057    pub struct iw_range {
1058        pub throughput: __u32,
1059        pub min_nwid: __u32,
1060        pub max_nwid: __u32,
1061        pub old_num_channels: __u16,
1062        pub old_num_frequency: __u8,
1063        pub scan_capa: __u8,
1064        pub event_capa: [__u32; 6],
1065        pub sensitivity: __s32,
1066        pub max_qual: iw_quality,
1067        pub avg_qual: iw_quality,
1068        pub num_bitrates: __u8,
1069        pub bitrate: [__s32; IW_MAX_BITRATES],
1070        pub min_rts: __s32,
1071        pub max_rts: __s32,
1072        pub min_frag: __s32,
1073        pub max_frag: __s32,
1074        pub min_pmp: __s32,
1075        pub max_pmp: __s32,
1076        pub min_pmt: __s32,
1077        pub max_pmt: __s32,
1078        pub pmp_flags: __u16,
1079        pub pmt_flags: __u16,
1080        pub pm_capa: __u16,
1081        pub encoding_size: [__u16; IW_MAX_ENCODING_SIZES],
1082        pub num_encoding_sizes: __u8,
1083        pub max_encoding_tokens: __u8,
1084        pub encoding_login_index: __u8,
1085        pub txpower_capa: __u16,
1086        pub num_txpower: __u8,
1087        pub txpower: [__s32; IW_MAX_TXPOWER],
1088        pub we_version_compiled: __u8,
1089        pub we_version_source: __u8,
1090        pub retry_capa: __u16,
1091        pub retry_flags: __u16,
1092        pub r_time_flags: __u16,
1093        pub min_retry: __s32,
1094        pub max_retry: __s32,
1095        pub min_r_time: __s32,
1096        pub max_r_time: __s32,
1097        pub num_channels: __u16,
1098        pub num_frequency: __u8,
1099        pub freq: [iw_freq; IW_MAX_FREQUENCIES],
1100        pub enc_capa: __u32,
1101    }
1102
1103    pub struct iw_priv_args {
1104        pub cmd: __u32,
1105        pub set_args: __u16,
1106        pub get_args: __u16,
1107        pub name: [c_char; crate::IFNAMSIZ],
1108    }
1109
1110    // #include <linux/eventpoll.h>
1111
1112    pub struct epoll_params {
1113        pub busy_poll_usecs: u32,
1114        pub busy_poll_budget: u16,
1115        pub prefer_busy_poll: u8,
1116        pub __pad: u8, // Must be zero
1117    }
1118
1119    #[cfg_attr(
1120        any(
1121            target_pointer_width = "32",
1122            target_arch = "x86_64",
1123            target_arch = "powerpc64",
1124            target_arch = "mips64",
1125            target_arch = "mips64r6",
1126            target_arch = "s390x",
1127            target_arch = "sparc64",
1128            target_arch = "aarch64",
1129            target_arch = "riscv64",
1130            target_arch = "riscv32",
1131            target_arch = "loongarch64"
1132        ),
1133        repr(align(4))
1134    )]
1135    #[cfg_attr(
1136        not(any(
1137            target_pointer_width = "32",
1138            target_arch = "x86_64",
1139            target_arch = "powerpc64",
1140            target_arch = "mips64",
1141            target_arch = "mips64r6",
1142            target_arch = "s390x",
1143            target_arch = "sparc64",
1144            target_arch = "aarch64",
1145            target_arch = "riscv64",
1146            target_arch = "riscv32",
1147            target_arch = "loongarch64"
1148        )),
1149        repr(align(8))
1150    )]
1151    pub struct pthread_mutexattr_t {
1152        #[doc(hidden)]
1153        size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T],
1154    }
1155
1156    #[cfg_attr(
1157        any(target_env = "musl", target_env = "ohos", target_pointer_width = "32"),
1158        repr(align(4))
1159    )]
1160    #[cfg_attr(
1161        all(
1162            not(target_env = "musl"),
1163            not(target_env = "ohos"),
1164            target_pointer_width = "64"
1165        ),
1166        repr(align(8))
1167    )]
1168    pub struct pthread_rwlockattr_t {
1169        #[doc(hidden)]
1170        size: [u8; crate::__SIZEOF_PTHREAD_RWLOCKATTR_T],
1171    }
1172
1173    #[repr(align(4))]
1174    pub struct pthread_condattr_t {
1175        #[doc(hidden)]
1176        size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T],
1177    }
1178
1179    #[repr(align(4))]
1180    pub struct pthread_barrierattr_t {
1181        #[doc(hidden)]
1182        size: [u8; crate::__SIZEOF_PTHREAD_BARRIERATTR_T],
1183    }
1184
1185    #[cfg(not(target_env = "musl"))]
1186    #[repr(align(8))]
1187    pub struct fanotify_event_metadata {
1188        pub event_len: __u32,
1189        pub vers: __u8,
1190        pub reserved: __u8,
1191        pub metadata_len: __u16,
1192        pub mask: __u64,
1193        pub fd: c_int,
1194        pub pid: c_int,
1195    }
1196
1197    // linux/ptp_clock.h
1198
1199    pub struct ptp_sys_offset {
1200        pub n_samples: c_uint,
1201        pub rsv: [c_uint; 3],
1202        // FIXME(garando): replace length with `2 * PTP_MAX_SAMPLES + 1` when supported
1203        pub ts: [ptp_clock_time; 51],
1204    }
1205
1206    pub struct ptp_pin_desc {
1207        pub name: [c_char; 64],
1208        pub index: c_uint,
1209        pub func: c_uint,
1210        pub chan: c_uint,
1211        pub rsv: [c_uint; 5],
1212    }
1213
1214    pub struct ptp_clock_caps {
1215        pub max_adj: c_int,
1216        pub n_alarm: c_int,
1217        pub n_ext_ts: c_int,
1218        pub n_per_out: c_int,
1219        pub pps: c_int,
1220        pub n_pins: c_int,
1221        pub cross_timestamping: c_int,
1222        pub adjust_phase: c_int,
1223        pub max_phase_adj: c_int,
1224        pub rsv: [c_int; 11],
1225    }
1226
1227    // linux/if_xdp.h
1228
1229    pub struct sockaddr_xdp {
1230        pub sxdp_family: crate::__u16,
1231        pub sxdp_flags: crate::__u16,
1232        pub sxdp_ifindex: crate::__u32,
1233        pub sxdp_queue_id: crate::__u32,
1234        pub sxdp_shared_umem_fd: crate::__u32,
1235    }
1236
1237    pub struct xdp_ring_offset {
1238        pub producer: crate::__u64,
1239        pub consumer: crate::__u64,
1240        pub desc: crate::__u64,
1241        pub flags: crate::__u64,
1242    }
1243
1244    pub struct xdp_mmap_offsets {
1245        pub rx: xdp_ring_offset,
1246        pub tx: xdp_ring_offset,
1247        pub fr: xdp_ring_offset,
1248        pub cr: xdp_ring_offset,
1249    }
1250
1251    pub struct xdp_ring_offset_v1 {
1252        pub producer: crate::__u64,
1253        pub consumer: crate::__u64,
1254        pub desc: crate::__u64,
1255    }
1256
1257    pub struct xdp_mmap_offsets_v1 {
1258        pub rx: xdp_ring_offset_v1,
1259        pub tx: xdp_ring_offset_v1,
1260        pub fr: xdp_ring_offset_v1,
1261        pub cr: xdp_ring_offset_v1,
1262    }
1263
1264    pub struct xdp_umem_reg {
1265        pub addr: crate::__u64,
1266        pub len: crate::__u64,
1267        pub chunk_size: crate::__u32,
1268        pub headroom: crate::__u32,
1269        pub flags: crate::__u32,
1270        pub tx_metadata_len: crate::__u32,
1271    }
1272
1273    pub struct xdp_umem_reg_v1 {
1274        pub addr: crate::__u64,
1275        pub len: crate::__u64,
1276        pub chunk_size: crate::__u32,
1277        pub headroom: crate::__u32,
1278    }
1279
1280    pub struct xdp_statistics {
1281        pub rx_dropped: crate::__u64,
1282        pub rx_invalid_descs: crate::__u64,
1283        pub tx_invalid_descs: crate::__u64,
1284        pub rx_ring_full: crate::__u64,
1285        pub rx_fill_ring_empty_descs: crate::__u64,
1286        pub tx_ring_empty_descs: crate::__u64,
1287    }
1288
1289    pub struct xdp_statistics_v1 {
1290        pub rx_dropped: crate::__u64,
1291        pub rx_invalid_descs: crate::__u64,
1292        pub tx_invalid_descs: crate::__u64,
1293    }
1294
1295    pub struct xdp_options {
1296        pub flags: crate::__u32,
1297    }
1298
1299    pub struct xdp_desc {
1300        pub addr: crate::__u64,
1301        pub len: crate::__u32,
1302        pub options: crate::__u32,
1303    }
1304
1305    pub struct xsk_tx_metadata_completion {
1306        pub tx_timestamp: crate::__u64,
1307    }
1308
1309    pub struct xsk_tx_metadata_request {
1310        pub csum_start: __u16,
1311        pub csum_offset: __u16,
1312    }
1313
1314    // linux/mount.h
1315
1316    pub struct mount_attr {
1317        pub attr_set: crate::__u64,
1318        pub attr_clr: crate::__u64,
1319        pub propagation: crate::__u64,
1320        pub userns_fd: crate::__u64,
1321    }
1322
1323    // linux/nsfs.h
1324    pub struct mnt_ns_info {
1325        pub size: crate::__u32,
1326        pub nr_mounts: crate::__u32,
1327        pub mnt_ns_id: crate::__u64,
1328    }
1329
1330    // linux/pidfd.h
1331
1332    #[non_exhaustive]
1333    pub struct pidfd_info {
1334        pub mask: crate::__u64,
1335        pub cgroupid: crate::__u64,
1336        pub pid: crate::__u32,
1337        pub tgid: crate::__u32,
1338        pub ppid: crate::__u32,
1339        pub ruid: crate::__u32,
1340        pub rgid: crate::__u32,
1341        pub euid: crate::__u32,
1342        pub egid: crate::__u32,
1343        pub suid: crate::__u32,
1344        pub sgid: crate::__u32,
1345        pub fsuid: crate::__u32,
1346        pub fsgid: crate::__u32,
1347        pub exit_code: crate::__s32,
1348    }
1349
1350    // linux/uio.h
1351
1352    pub struct dmabuf_cmsg {
1353        pub frag_offset: crate::__u64,
1354        pub frag_size: crate::__u32,
1355        pub frag_token: crate::__u32,
1356        pub dmabuf_id: crate::__u32,
1357        pub flags: crate::__u32,
1358    }
1359
1360    pub struct dmabuf_token {
1361        pub token_start: crate::__u32,
1362        pub token_count: crate::__u32,
1363    }
1364}
1365
1366cfg_if! {
1367    if #[cfg(not(target_arch = "sparc64"))] {
1368        s! {
1369            pub struct iw_thrspy {
1370                pub addr: crate::sockaddr,
1371                pub qual: iw_quality,
1372                pub low: iw_quality,
1373                pub high: iw_quality,
1374            }
1375
1376            pub struct iw_mlme {
1377                pub cmd: __u16,
1378                pub reason_code: __u16,
1379                pub addr: crate::sockaddr,
1380            }
1381
1382            pub struct iw_michaelmicfailure {
1383                pub flags: __u32,
1384                pub src_addr: crate::sockaddr,
1385                pub tsc: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
1386            }
1387
1388            pub struct __c_anonymous_elf32_rela {
1389                pub r_offset: Elf32_Addr,
1390                pub r_info: Elf32_Word,
1391                pub r_addend: Elf32_Sword,
1392            }
1393
1394            pub struct __c_anonymous_elf64_rela {
1395                pub r_offset: Elf64_Addr,
1396                pub r_info: Elf64_Xword,
1397                pub r_addend: Elf64_Sxword,
1398            }
1399        }
1400    }
1401}
1402
1403s_no_extra_traits! {
1404    pub struct sockaddr_nl {
1405        pub nl_family: crate::sa_family_t,
1406        nl_pad: c_ushort,
1407        pub nl_pid: u32,
1408        pub nl_groups: u32,
1409    }
1410
1411    pub struct dirent {
1412        pub d_ino: crate::ino_t,
1413        pub d_off: off_t,
1414        pub d_reclen: c_ushort,
1415        pub d_type: c_uchar,
1416        pub d_name: [c_char; 256],
1417    }
1418
1419    pub struct sockaddr_alg {
1420        pub salg_family: crate::sa_family_t,
1421        pub salg_type: [c_uchar; 14],
1422        pub salg_feat: u32,
1423        pub salg_mask: u32,
1424        pub salg_name: [c_uchar; 64],
1425    }
1426
1427    pub struct uinput_setup {
1428        pub id: input_id,
1429        pub name: [c_char; UINPUT_MAX_NAME_SIZE],
1430        pub ff_effects_max: __u32,
1431    }
1432
1433    pub struct uinput_user_dev {
1434        pub name: [c_char; UINPUT_MAX_NAME_SIZE],
1435        pub id: input_id,
1436        pub ff_effects_max: __u32,
1437        pub absmax: [__s32; ABS_CNT],
1438        pub absmin: [__s32; ABS_CNT],
1439        pub absfuzz: [__s32; ABS_CNT],
1440        pub absflat: [__s32; ABS_CNT],
1441    }
1442
1443    /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this
1444    /// type are unsound and will be removed in the future.
1445    #[deprecated(
1446        note = "this struct has unsafe trait implementations that will be \
1447                removed in the future",
1448        since = "0.2.80"
1449    )]
1450    pub struct af_alg_iv {
1451        pub ivlen: u32,
1452        pub iv: [c_uchar; 0],
1453    }
1454
1455    // x32 compatibility
1456    // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
1457    pub struct mq_attr {
1458        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
1459        pub mq_flags: i64,
1460        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
1461        pub mq_maxmsg: i64,
1462        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
1463        pub mq_msgsize: i64,
1464        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
1465        pub mq_curmsgs: i64,
1466        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
1467        pad: [i64; 4],
1468
1469        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
1470        pub mq_flags: c_long,
1471        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
1472        pub mq_maxmsg: c_long,
1473        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
1474        pub mq_msgsize: c_long,
1475        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
1476        pub mq_curmsgs: c_long,
1477        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
1478        pad: [c_long; 4],
1479    }
1480
1481    pub union __c_anonymous_ifr_ifru {
1482        pub ifru_addr: crate::sockaddr,
1483        pub ifru_dstaddr: crate::sockaddr,
1484        pub ifru_broadaddr: crate::sockaddr,
1485        pub ifru_netmask: crate::sockaddr,
1486        pub ifru_hwaddr: crate::sockaddr,
1487        pub ifru_flags: c_short,
1488        pub ifru_ifindex: c_int,
1489        pub ifru_metric: c_int,
1490        pub ifru_mtu: c_int,
1491        pub ifru_map: __c_anonymous_ifru_map,
1492        pub ifru_slave: [c_char; crate::IFNAMSIZ],
1493        pub ifru_newname: [c_char; crate::IFNAMSIZ],
1494        pub ifru_data: *mut c_char,
1495    }
1496
1497    pub struct ifreq {
1498        /// interface name, e.g. "en0"
1499        pub ifr_name: [c_char; crate::IFNAMSIZ],
1500        pub ifr_ifru: __c_anonymous_ifr_ifru,
1501    }
1502
1503    pub union __c_anonymous_ifc_ifcu {
1504        pub ifcu_buf: *mut c_char,
1505        pub ifcu_req: *mut crate::ifreq,
1506    }
1507
1508    /// Structure used in SIOCGIFCONF request.  Used to retrieve interface configuration for
1509    /// machine (useful for programs which must know all networks accessible).
1510    pub struct ifconf {
1511        /// Size of buffer
1512        pub ifc_len: c_int,
1513        pub ifc_ifcu: __c_anonymous_ifc_ifcu,
1514    }
1515
1516    pub struct hwtstamp_config {
1517        pub flags: c_int,
1518        pub tx_type: c_int,
1519        pub rx_filter: c_int,
1520    }
1521
1522    pub struct dirent64 {
1523        pub d_ino: crate::ino64_t,
1524        pub d_off: off64_t,
1525        pub d_reclen: c_ushort,
1526        pub d_type: c_uchar,
1527        pub d_name: [c_char; 256],
1528    }
1529
1530    pub struct sched_attr {
1531        pub size: __u32,
1532        pub sched_policy: __u32,
1533        pub sched_flags: crate::__u64,
1534        pub sched_nice: __s32,
1535        pub sched_priority: __u32,
1536        pub sched_runtime: crate::__u64,
1537        pub sched_deadline: crate::__u64,
1538        pub sched_period: crate::__u64,
1539    }
1540
1541    pub union tpacket_req_u {
1542        pub req: crate::tpacket_req,
1543        pub req3: crate::tpacket_req3,
1544    }
1545
1546    pub union tpacket_bd_header_u {
1547        pub bh1: crate::tpacket_hdr_v1,
1548    }
1549
1550    pub struct tpacket_block_desc {
1551        pub version: __u32,
1552        pub offset_to_priv: __u32,
1553        pub hdr: crate::tpacket_bd_header_u,
1554    }
1555
1556    #[cfg_attr(
1557        all(
1558            any(target_env = "musl", target_env = "ohos"),
1559            target_pointer_width = "32"
1560        ),
1561        repr(align(4))
1562    )]
1563    #[cfg_attr(
1564        all(
1565            any(target_env = "musl", target_env = "ohos"),
1566            target_pointer_width = "64"
1567        ),
1568        repr(align(8))
1569    )]
1570    #[cfg_attr(
1571        all(
1572            not(any(target_env = "musl", target_env = "ohos")),
1573            target_arch = "x86"
1574        ),
1575        repr(align(4))
1576    )]
1577    #[cfg_attr(
1578        all(
1579            not(any(target_env = "musl", target_env = "ohos")),
1580            not(target_arch = "x86")
1581        ),
1582        repr(align(8))
1583    )]
1584    pub struct pthread_cond_t {
1585        #[doc(hidden)]
1586        size: [u8; crate::__SIZEOF_PTHREAD_COND_T],
1587    }
1588
1589    #[cfg_attr(
1590        all(
1591            target_pointer_width = "32",
1592            any(
1593                target_arch = "mips",
1594                target_arch = "mips32r6",
1595                target_arch = "arm",
1596                target_arch = "hexagon",
1597                target_arch = "m68k",
1598                target_arch = "csky",
1599                target_arch = "powerpc",
1600                target_arch = "sparc",
1601                target_arch = "x86_64",
1602                target_arch = "x86"
1603            )
1604        ),
1605        repr(align(4))
1606    )]
1607    #[cfg_attr(
1608        any(
1609            target_pointer_width = "64",
1610            not(any(
1611                target_arch = "mips",
1612                target_arch = "mips32r6",
1613                target_arch = "arm",
1614                target_arch = "hexagon",
1615                target_arch = "m68k",
1616                target_arch = "csky",
1617                target_arch = "powerpc",
1618                target_arch = "sparc",
1619                target_arch = "x86_64",
1620                target_arch = "x86"
1621            ))
1622        ),
1623        repr(align(8))
1624    )]
1625    pub struct pthread_mutex_t {
1626        #[doc(hidden)]
1627        size: [u8; crate::__SIZEOF_PTHREAD_MUTEX_T],
1628    }
1629
1630    #[cfg_attr(
1631        all(
1632            target_pointer_width = "32",
1633            any(
1634                target_arch = "mips",
1635                target_arch = "mips32r6",
1636                target_arch = "arm",
1637                target_arch = "hexagon",
1638                target_arch = "m68k",
1639                target_arch = "csky",
1640                target_arch = "powerpc",
1641                target_arch = "sparc",
1642                target_arch = "x86_64",
1643                target_arch = "x86"
1644            )
1645        ),
1646        repr(align(4))
1647    )]
1648    #[cfg_attr(
1649        any(
1650            target_pointer_width = "64",
1651            not(any(
1652                target_arch = "mips",
1653                target_arch = "mips32r6",
1654                target_arch = "arm",
1655                target_arch = "hexagon",
1656                target_arch = "m68k",
1657                target_arch = "powerpc",
1658                target_arch = "sparc",
1659                target_arch = "x86_64",
1660                target_arch = "x86"
1661            ))
1662        ),
1663        repr(align(8))
1664    )]
1665    pub struct pthread_rwlock_t {
1666        size: [u8; crate::__SIZEOF_PTHREAD_RWLOCK_T],
1667    }
1668
1669    #[cfg_attr(
1670        all(
1671            target_pointer_width = "32",
1672            any(
1673                target_arch = "mips",
1674                target_arch = "mips32r6",
1675                target_arch = "arm",
1676                target_arch = "hexagon",
1677                target_arch = "m68k",
1678                target_arch = "csky",
1679                target_arch = "powerpc",
1680                target_arch = "sparc",
1681                target_arch = "x86_64",
1682                target_arch = "x86"
1683            )
1684        ),
1685        repr(align(4))
1686    )]
1687    #[cfg_attr(
1688        any(
1689            target_pointer_width = "64",
1690            not(any(
1691                target_arch = "mips",
1692                target_arch = "mips32r6",
1693                target_arch = "arm",
1694                target_arch = "hexagon",
1695                target_arch = "m68k",
1696                target_arch = "csky",
1697                target_arch = "powerpc",
1698                target_arch = "sparc",
1699                target_arch = "x86_64",
1700                target_arch = "x86"
1701            ))
1702        ),
1703        repr(align(8))
1704    )]
1705    pub struct pthread_barrier_t {
1706        size: [u8; crate::__SIZEOF_PTHREAD_BARRIER_T],
1707    }
1708
1709    // linux/net_tstamp.h
1710    pub struct sock_txtime {
1711        pub clockid: crate::clockid_t,
1712        pub flags: __u32,
1713    }
1714
1715    // linux/wireless.h
1716    pub union iwreq_data {
1717        pub name: [c_char; crate::IFNAMSIZ],
1718        pub essid: iw_point,
1719        pub nwid: iw_param,
1720        pub freq: iw_freq,
1721        pub sens: iw_param,
1722        pub bitrate: iw_param,
1723        pub txpower: iw_param,
1724        pub rts: iw_param,
1725        pub frag: iw_param,
1726        pub mode: __u32,
1727        pub retry: iw_param,
1728        pub encoding: iw_point,
1729        pub power: iw_param,
1730        pub qual: iw_quality,
1731        pub ap_addr: crate::sockaddr,
1732        pub addr: crate::sockaddr,
1733        pub param: iw_param,
1734        pub data: iw_point,
1735    }
1736
1737    pub struct iw_event {
1738        pub len: __u16,
1739        pub cmd: __u16,
1740        pub u: iwreq_data,
1741    }
1742
1743    pub union __c_anonymous_iwreq {
1744        pub ifrn_name: [c_char; crate::IFNAMSIZ],
1745    }
1746
1747    pub struct iwreq {
1748        pub ifr_ifrn: __c_anonymous_iwreq,
1749        pub u: iwreq_data,
1750    }
1751
1752    // linux/ptp_clock.h
1753    pub union __c_anonymous_ptp_perout_request_1 {
1754        pub start: ptp_clock_time,
1755        pub phase: ptp_clock_time,
1756    }
1757
1758    pub union __c_anonymous_ptp_perout_request_2 {
1759        pub on: ptp_clock_time,
1760        pub rsv: [c_uint; 4],
1761    }
1762
1763    pub struct ptp_perout_request {
1764        pub anonymous_1: __c_anonymous_ptp_perout_request_1,
1765        pub period: ptp_clock_time,
1766        pub index: c_uint,
1767        pub flags: c_uint,
1768        pub anonymous_2: __c_anonymous_ptp_perout_request_2,
1769    }
1770
1771    // linux/if_xdp.h
1772    pub struct xsk_tx_metadata {
1773        pub flags: crate::__u64,
1774        pub xsk_tx_metadata_union: __c_anonymous_xsk_tx_metadata_union,
1775    }
1776
1777    pub union __c_anonymous_xsk_tx_metadata_union {
1778        pub request: xsk_tx_metadata_request,
1779        pub completion: xsk_tx_metadata_completion,
1780    }
1781}
1782
1783cfg_if! {
1784    if #[cfg(feature = "extra_traits")] {
1785        impl PartialEq for sockaddr_nl {
1786            fn eq(&self, other: &sockaddr_nl) -> bool {
1787                self.nl_family == other.nl_family
1788                    && self.nl_pid == other.nl_pid
1789                    && self.nl_groups == other.nl_groups
1790            }
1791        }
1792        impl Eq for sockaddr_nl {}
1793        impl hash::Hash for sockaddr_nl {
1794            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1795                self.nl_family.hash(state);
1796                self.nl_pid.hash(state);
1797                self.nl_groups.hash(state);
1798            }
1799        }
1800
1801        impl PartialEq for dirent {
1802            fn eq(&self, other: &dirent) -> bool {
1803                self.d_ino == other.d_ino
1804                    && self.d_off == other.d_off
1805                    && self.d_reclen == other.d_reclen
1806                    && self.d_type == other.d_type
1807                    && self
1808                        .d_name
1809                        .iter()
1810                        .zip(other.d_name.iter())
1811                        .all(|(a, b)| a == b)
1812            }
1813        }
1814
1815        impl Eq for dirent {}
1816
1817        impl hash::Hash for dirent {
1818            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1819                self.d_ino.hash(state);
1820                self.d_off.hash(state);
1821                self.d_reclen.hash(state);
1822                self.d_type.hash(state);
1823                self.d_name.hash(state);
1824            }
1825        }
1826
1827        impl PartialEq for dirent64 {
1828            fn eq(&self, other: &dirent64) -> bool {
1829                self.d_ino == other.d_ino
1830                    && self.d_off == other.d_off
1831                    && self.d_reclen == other.d_reclen
1832                    && self.d_type == other.d_type
1833                    && self
1834                        .d_name
1835                        .iter()
1836                        .zip(other.d_name.iter())
1837                        .all(|(a, b)| a == b)
1838            }
1839        }
1840
1841        impl Eq for dirent64 {}
1842
1843        impl hash::Hash for dirent64 {
1844            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1845                self.d_ino.hash(state);
1846                self.d_off.hash(state);
1847                self.d_reclen.hash(state);
1848                self.d_type.hash(state);
1849                self.d_name.hash(state);
1850            }
1851        }
1852
1853        impl PartialEq for pthread_cond_t {
1854            fn eq(&self, other: &pthread_cond_t) -> bool {
1855                self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
1856            }
1857        }
1858
1859        impl Eq for pthread_cond_t {}
1860
1861        impl hash::Hash for pthread_cond_t {
1862            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1863                self.size.hash(state);
1864            }
1865        }
1866
1867        impl PartialEq for pthread_mutex_t {
1868            fn eq(&self, other: &pthread_mutex_t) -> bool {
1869                self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
1870            }
1871        }
1872
1873        impl Eq for pthread_mutex_t {}
1874
1875        impl hash::Hash for pthread_mutex_t {
1876            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1877                self.size.hash(state);
1878            }
1879        }
1880
1881        impl PartialEq for pthread_rwlock_t {
1882            fn eq(&self, other: &pthread_rwlock_t) -> bool {
1883                self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
1884            }
1885        }
1886
1887        impl Eq for pthread_rwlock_t {}
1888
1889        impl hash::Hash for pthread_rwlock_t {
1890            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1891                self.size.hash(state);
1892            }
1893        }
1894
1895        impl PartialEq for pthread_barrier_t {
1896            fn eq(&self, other: &pthread_barrier_t) -> bool {
1897                self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
1898            }
1899        }
1900
1901        impl Eq for pthread_barrier_t {}
1902
1903        impl hash::Hash for pthread_barrier_t {
1904            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1905                self.size.hash(state);
1906            }
1907        }
1908
1909        impl PartialEq for sockaddr_alg {
1910            fn eq(&self, other: &sockaddr_alg) -> bool {
1911                self.salg_family == other.salg_family
1912                    && self
1913                        .salg_type
1914                        .iter()
1915                        .zip(other.salg_type.iter())
1916                        .all(|(a, b)| a == b)
1917                    && self.salg_feat == other.salg_feat
1918                    && self.salg_mask == other.salg_mask
1919                    && self
1920                        .salg_name
1921                        .iter()
1922                        .zip(other.salg_name.iter())
1923                        .all(|(a, b)| a == b)
1924            }
1925        }
1926
1927        impl Eq for sockaddr_alg {}
1928
1929        impl hash::Hash for sockaddr_alg {
1930            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1931                self.salg_family.hash(state);
1932                self.salg_type.hash(state);
1933                self.salg_feat.hash(state);
1934                self.salg_mask.hash(state);
1935                self.salg_name.hash(state);
1936            }
1937        }
1938
1939        impl PartialEq for uinput_setup {
1940            fn eq(&self, other: &uinput_setup) -> bool {
1941                self.id == other.id
1942                    && self.name[..] == other.name[..]
1943                    && self.ff_effects_max == other.ff_effects_max
1944            }
1945        }
1946        impl Eq for uinput_setup {}
1947
1948        impl hash::Hash for uinput_setup {
1949            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1950                self.id.hash(state);
1951                self.name.hash(state);
1952                self.ff_effects_max.hash(state);
1953            }
1954        }
1955
1956        impl PartialEq for uinput_user_dev {
1957            fn eq(&self, other: &uinput_user_dev) -> bool {
1958                self.name[..] == other.name[..]
1959                    && self.id == other.id
1960                    && self.ff_effects_max == other.ff_effects_max
1961                    && self.absmax[..] == other.absmax[..]
1962                    && self.absmin[..] == other.absmin[..]
1963                    && self.absfuzz[..] == other.absfuzz[..]
1964                    && self.absflat[..] == other.absflat[..]
1965            }
1966        }
1967        impl Eq for uinput_user_dev {}
1968
1969        impl hash::Hash for uinput_user_dev {
1970            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1971                self.name.hash(state);
1972                self.id.hash(state);
1973                self.ff_effects_max.hash(state);
1974                self.absmax.hash(state);
1975                self.absmin.hash(state);
1976                self.absfuzz.hash(state);
1977                self.absflat.hash(state);
1978            }
1979        }
1980
1981        #[allow(deprecated)]
1982        impl af_alg_iv {
1983            fn as_slice(&self) -> &[u8] {
1984                unsafe { ::core::slice::from_raw_parts(self.iv.as_ptr(), self.ivlen as usize) }
1985            }
1986        }
1987
1988        #[allow(deprecated)]
1989        impl PartialEq for af_alg_iv {
1990            fn eq(&self, other: &af_alg_iv) -> bool {
1991                *self.as_slice() == *other.as_slice()
1992            }
1993        }
1994
1995        #[allow(deprecated)]
1996        impl Eq for af_alg_iv {}
1997
1998        #[allow(deprecated)]
1999        impl hash::Hash for af_alg_iv {
2000            fn hash<H: hash::Hasher>(&self, state: &mut H) {
2001                self.as_slice().hash(state);
2002            }
2003        }
2004
2005        impl PartialEq for mq_attr {
2006            fn eq(&self, other: &mq_attr) -> bool {
2007                self.mq_flags == other.mq_flags
2008                    && self.mq_maxmsg == other.mq_maxmsg
2009                    && self.mq_msgsize == other.mq_msgsize
2010                    && self.mq_curmsgs == other.mq_curmsgs
2011            }
2012        }
2013        impl Eq for mq_attr {}
2014        impl hash::Hash for mq_attr {
2015            fn hash<H: hash::Hasher>(&self, state: &mut H) {
2016                self.mq_flags.hash(state);
2017                self.mq_maxmsg.hash(state);
2018                self.mq_msgsize.hash(state);
2019                self.mq_curmsgs.hash(state);
2020            }
2021        }
2022        impl PartialEq for hwtstamp_config {
2023            fn eq(&self, other: &hwtstamp_config) -> bool {
2024                self.flags == other.flags
2025                    && self.tx_type == other.tx_type
2026                    && self.rx_filter == other.rx_filter
2027            }
2028        }
2029        impl Eq for hwtstamp_config {}
2030        impl hash::Hash for hwtstamp_config {
2031            fn hash<H: hash::Hasher>(&self, state: &mut H) {
2032                self.flags.hash(state);
2033                self.tx_type.hash(state);
2034                self.rx_filter.hash(state);
2035            }
2036        }
2037
2038        impl PartialEq for sched_attr {
2039            fn eq(&self, other: &sched_attr) -> bool {
2040                self.size == other.size
2041                    && self.sched_policy == other.sched_policy
2042                    && self.sched_flags == other.sched_flags
2043                    && self.sched_nice == other.sched_nice
2044                    && self.sched_priority == other.sched_priority
2045                    && self.sched_runtime == other.sched_runtime
2046                    && self.sched_deadline == other.sched_deadline
2047                    && self.sched_period == other.sched_period
2048            }
2049        }
2050        impl Eq for sched_attr {}
2051        impl hash::Hash for sched_attr {
2052            fn hash<H: hash::Hasher>(&self, state: &mut H) {
2053                self.size.hash(state);
2054                self.sched_policy.hash(state);
2055                self.sched_flags.hash(state);
2056                self.sched_nice.hash(state);
2057                self.sched_priority.hash(state);
2058                self.sched_runtime.hash(state);
2059                self.sched_deadline.hash(state);
2060                self.sched_period.hash(state);
2061            }
2062        }
2063    }
2064}
2065
2066cfg_if! {
2067    if #[cfg(any(
2068        target_env = "gnu",
2069        target_env = "musl",
2070        target_env = "ohos"
2071    ))] {
2072        pub const ABDAY_1: crate::nl_item = 0x20000;
2073        pub const ABDAY_2: crate::nl_item = 0x20001;
2074        pub const ABDAY_3: crate::nl_item = 0x20002;
2075        pub const ABDAY_4: crate::nl_item = 0x20003;
2076        pub const ABDAY_5: crate::nl_item = 0x20004;
2077        pub const ABDAY_6: crate::nl_item = 0x20005;
2078        pub const ABDAY_7: crate::nl_item = 0x20006;
2079
2080        pub const DAY_1: crate::nl_item = 0x20007;
2081        pub const DAY_2: crate::nl_item = 0x20008;
2082        pub const DAY_3: crate::nl_item = 0x20009;
2083        pub const DAY_4: crate::nl_item = 0x2000A;
2084        pub const DAY_5: crate::nl_item = 0x2000B;
2085        pub const DAY_6: crate::nl_item = 0x2000C;
2086        pub const DAY_7: crate::nl_item = 0x2000D;
2087
2088        pub const ABMON_1: crate::nl_item = 0x2000E;
2089        pub const ABMON_2: crate::nl_item = 0x2000F;
2090        pub const ABMON_3: crate::nl_item = 0x20010;
2091        pub const ABMON_4: crate::nl_item = 0x20011;
2092        pub const ABMON_5: crate::nl_item = 0x20012;
2093        pub const ABMON_6: crate::nl_item = 0x20013;
2094        pub const ABMON_7: crate::nl_item = 0x20014;
2095        pub const ABMON_8: crate::nl_item = 0x20015;
2096        pub const ABMON_9: crate::nl_item = 0x20016;
2097        pub const ABMON_10: crate::nl_item = 0x20017;
2098        pub const ABMON_11: crate::nl_item = 0x20018;
2099        pub const ABMON_12: crate::nl_item = 0x20019;
2100
2101        pub const MON_1: crate::nl_item = 0x2001A;
2102        pub const MON_2: crate::nl_item = 0x2001B;
2103        pub const MON_3: crate::nl_item = 0x2001C;
2104        pub const MON_4: crate::nl_item = 0x2001D;
2105        pub const MON_5: crate::nl_item = 0x2001E;
2106        pub const MON_6: crate::nl_item = 0x2001F;
2107        pub const MON_7: crate::nl_item = 0x20020;
2108        pub const MON_8: crate::nl_item = 0x20021;
2109        pub const MON_9: crate::nl_item = 0x20022;
2110        pub const MON_10: crate::nl_item = 0x20023;
2111        pub const MON_11: crate::nl_item = 0x20024;
2112        pub const MON_12: crate::nl_item = 0x20025;
2113
2114        pub const AM_STR: crate::nl_item = 0x20026;
2115        pub const PM_STR: crate::nl_item = 0x20027;
2116
2117        pub const D_T_FMT: crate::nl_item = 0x20028;
2118        pub const D_FMT: crate::nl_item = 0x20029;
2119        pub const T_FMT: crate::nl_item = 0x2002A;
2120        pub const T_FMT_AMPM: crate::nl_item = 0x2002B;
2121
2122        pub const ERA: crate::nl_item = 0x2002C;
2123        pub const ERA_D_FMT: crate::nl_item = 0x2002E;
2124        pub const ALT_DIGITS: crate::nl_item = 0x2002F;
2125        pub const ERA_D_T_FMT: crate::nl_item = 0x20030;
2126        pub const ERA_T_FMT: crate::nl_item = 0x20031;
2127
2128        pub const CODESET: crate::nl_item = 14;
2129        pub const CRNCYSTR: crate::nl_item = 0x4000F;
2130        pub const RADIXCHAR: crate::nl_item = 0x10000;
2131        pub const THOUSEP: crate::nl_item = 0x10001;
2132        pub const YESEXPR: crate::nl_item = 0x50000;
2133        pub const NOEXPR: crate::nl_item = 0x50001;
2134        pub const YESSTR: crate::nl_item = 0x50002;
2135        pub const NOSTR: crate::nl_item = 0x50003;
2136    }
2137}
2138
2139pub const RUSAGE_CHILDREN: c_int = -1;
2140pub const L_tmpnam: c_uint = 20;
2141pub const _PC_LINK_MAX: c_int = 0;
2142pub const _PC_MAX_CANON: c_int = 1;
2143pub const _PC_MAX_INPUT: c_int = 2;
2144pub const _PC_NAME_MAX: c_int = 3;
2145pub const _PC_PATH_MAX: c_int = 4;
2146pub const _PC_PIPE_BUF: c_int = 5;
2147pub const _PC_CHOWN_RESTRICTED: c_int = 6;
2148pub const _PC_NO_TRUNC: c_int = 7;
2149pub const _PC_VDISABLE: c_int = 8;
2150pub const _PC_SYNC_IO: c_int = 9;
2151pub const _PC_ASYNC_IO: c_int = 10;
2152pub const _PC_PRIO_IO: c_int = 11;
2153pub const _PC_SOCK_MAXBUF: c_int = 12;
2154pub const _PC_FILESIZEBITS: c_int = 13;
2155pub const _PC_REC_INCR_XFER_SIZE: c_int = 14;
2156pub const _PC_REC_MAX_XFER_SIZE: c_int = 15;
2157pub const _PC_REC_MIN_XFER_SIZE: c_int = 16;
2158pub const _PC_REC_XFER_ALIGN: c_int = 17;
2159pub const _PC_ALLOC_SIZE_MIN: c_int = 18;
2160pub const _PC_SYMLINK_MAX: c_int = 19;
2161pub const _PC_2_SYMLINKS: c_int = 20;
2162
2163pub const MS_NOUSER: c_ulong = 0xffffffff80000000;
2164
2165pub const _SC_ARG_MAX: c_int = 0;
2166pub const _SC_CHILD_MAX: c_int = 1;
2167pub const _SC_CLK_TCK: c_int = 2;
2168pub const _SC_NGROUPS_MAX: c_int = 3;
2169pub const _SC_OPEN_MAX: c_int = 4;
2170pub const _SC_STREAM_MAX: c_int = 5;
2171pub const _SC_TZNAME_MAX: c_int = 6;
2172pub const _SC_JOB_CONTROL: c_int = 7;
2173pub const _SC_SAVED_IDS: c_int = 8;
2174pub const _SC_REALTIME_SIGNALS: c_int = 9;
2175pub const _SC_PRIORITY_SCHEDULING: c_int = 10;
2176pub const _SC_TIMERS: c_int = 11;
2177pub const _SC_ASYNCHRONOUS_IO: c_int = 12;
2178pub const _SC_PRIORITIZED_IO: c_int = 13;
2179pub const _SC_SYNCHRONIZED_IO: c_int = 14;
2180pub const _SC_FSYNC: c_int = 15;
2181pub const _SC_MAPPED_FILES: c_int = 16;
2182pub const _SC_MEMLOCK: c_int = 17;
2183pub const _SC_MEMLOCK_RANGE: c_int = 18;
2184pub const _SC_MEMORY_PROTECTION: c_int = 19;
2185pub const _SC_MESSAGE_PASSING: c_int = 20;
2186pub const _SC_SEMAPHORES: c_int = 21;
2187pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 22;
2188pub const _SC_AIO_LISTIO_MAX: c_int = 23;
2189pub const _SC_AIO_MAX: c_int = 24;
2190pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 25;
2191pub const _SC_DELAYTIMER_MAX: c_int = 26;
2192pub const _SC_MQ_OPEN_MAX: c_int = 27;
2193pub const _SC_MQ_PRIO_MAX: c_int = 28;
2194pub const _SC_VERSION: c_int = 29;
2195pub const _SC_PAGESIZE: c_int = 30;
2196pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
2197pub const _SC_RTSIG_MAX: c_int = 31;
2198pub const _SC_SEM_NSEMS_MAX: c_int = 32;
2199pub const _SC_SEM_VALUE_MAX: c_int = 33;
2200pub const _SC_SIGQUEUE_MAX: c_int = 34;
2201pub const _SC_TIMER_MAX: c_int = 35;
2202pub const _SC_BC_BASE_MAX: c_int = 36;
2203pub const _SC_BC_DIM_MAX: c_int = 37;
2204pub const _SC_BC_SCALE_MAX: c_int = 38;
2205pub const _SC_BC_STRING_MAX: c_int = 39;
2206pub const _SC_COLL_WEIGHTS_MAX: c_int = 40;
2207pub const _SC_EXPR_NEST_MAX: c_int = 42;
2208pub const _SC_LINE_MAX: c_int = 43;
2209pub const _SC_RE_DUP_MAX: c_int = 44;
2210pub const _SC_2_VERSION: c_int = 46;
2211pub const _SC_2_C_BIND: c_int = 47;
2212pub const _SC_2_C_DEV: c_int = 48;
2213pub const _SC_2_FORT_DEV: c_int = 49;
2214pub const _SC_2_FORT_RUN: c_int = 50;
2215pub const _SC_2_SW_DEV: c_int = 51;
2216pub const _SC_2_LOCALEDEF: c_int = 52;
2217pub const _SC_UIO_MAXIOV: c_int = 60;
2218pub const _SC_IOV_MAX: c_int = 60;
2219pub const _SC_THREADS: c_int = 67;
2220pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 68;
2221pub const _SC_GETGR_R_SIZE_MAX: c_int = 69;
2222pub const _SC_GETPW_R_SIZE_MAX: c_int = 70;
2223pub const _SC_LOGIN_NAME_MAX: c_int = 71;
2224pub const _SC_TTY_NAME_MAX: c_int = 72;
2225pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 73;
2226pub const _SC_THREAD_KEYS_MAX: c_int = 74;
2227pub const _SC_THREAD_STACK_MIN: c_int = 75;
2228pub const _SC_THREAD_THREADS_MAX: c_int = 76;
2229pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77;
2230pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78;
2231pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 79;
2232pub const _SC_THREAD_PRIO_INHERIT: c_int = 80;
2233pub const _SC_THREAD_PRIO_PROTECT: c_int = 81;
2234pub const _SC_THREAD_PROCESS_SHARED: c_int = 82;
2235pub const _SC_NPROCESSORS_CONF: c_int = 83;
2236pub const _SC_NPROCESSORS_ONLN: c_int = 84;
2237pub const _SC_PHYS_PAGES: c_int = 85;
2238pub const _SC_AVPHYS_PAGES: c_int = 86;
2239pub const _SC_ATEXIT_MAX: c_int = 87;
2240pub const _SC_PASS_MAX: c_int = 88;
2241pub const _SC_XOPEN_VERSION: c_int = 89;
2242pub const _SC_XOPEN_XCU_VERSION: c_int = 90;
2243pub const _SC_XOPEN_UNIX: c_int = 91;
2244pub const _SC_XOPEN_CRYPT: c_int = 92;
2245pub const _SC_XOPEN_ENH_I18N: c_int = 93;
2246pub const _SC_XOPEN_SHM: c_int = 94;
2247pub const _SC_2_CHAR_TERM: c_int = 95;
2248pub const _SC_2_UPE: c_int = 97;
2249pub const _SC_XOPEN_XPG2: c_int = 98;
2250pub const _SC_XOPEN_XPG3: c_int = 99;
2251pub const _SC_XOPEN_XPG4: c_int = 100;
2252pub const _SC_NZERO: c_int = 109;
2253pub const _SC_XBS5_ILP32_OFF32: c_int = 125;
2254pub const _SC_XBS5_ILP32_OFFBIG: c_int = 126;
2255pub const _SC_XBS5_LP64_OFF64: c_int = 127;
2256pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 128;
2257pub const _SC_XOPEN_LEGACY: c_int = 129;
2258pub const _SC_XOPEN_REALTIME: c_int = 130;
2259pub const _SC_XOPEN_REALTIME_THREADS: c_int = 131;
2260pub const _SC_ADVISORY_INFO: c_int = 132;
2261pub const _SC_BARRIERS: c_int = 133;
2262pub const _SC_CLOCK_SELECTION: c_int = 137;
2263pub const _SC_CPUTIME: c_int = 138;
2264pub const _SC_THREAD_CPUTIME: c_int = 139;
2265pub const _SC_MONOTONIC_CLOCK: c_int = 149;
2266pub const _SC_READER_WRITER_LOCKS: c_int = 153;
2267pub const _SC_SPIN_LOCKS: c_int = 154;
2268pub const _SC_REGEXP: c_int = 155;
2269pub const _SC_SHELL: c_int = 157;
2270pub const _SC_SPAWN: c_int = 159;
2271pub const _SC_SPORADIC_SERVER: c_int = 160;
2272pub const _SC_THREAD_SPORADIC_SERVER: c_int = 161;
2273pub const _SC_TIMEOUTS: c_int = 164;
2274pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 165;
2275pub const _SC_2_PBS: c_int = 168;
2276pub const _SC_2_PBS_ACCOUNTING: c_int = 169;
2277pub const _SC_2_PBS_LOCATE: c_int = 170;
2278pub const _SC_2_PBS_MESSAGE: c_int = 171;
2279pub const _SC_2_PBS_TRACK: c_int = 172;
2280pub const _SC_SYMLOOP_MAX: c_int = 173;
2281pub const _SC_STREAMS: c_int = 174;
2282pub const _SC_2_PBS_CHECKPOINT: c_int = 175;
2283pub const _SC_V6_ILP32_OFF32: c_int = 176;
2284pub const _SC_V6_ILP32_OFFBIG: c_int = 177;
2285pub const _SC_V6_LP64_OFF64: c_int = 178;
2286pub const _SC_V6_LPBIG_OFFBIG: c_int = 179;
2287pub const _SC_HOST_NAME_MAX: c_int = 180;
2288pub const _SC_TRACE: c_int = 181;
2289pub const _SC_TRACE_EVENT_FILTER: c_int = 182;
2290pub const _SC_TRACE_INHERIT: c_int = 183;
2291pub const _SC_TRACE_LOG: c_int = 184;
2292pub const _SC_IPV6: c_int = 235;
2293pub const _SC_RAW_SOCKETS: c_int = 236;
2294pub const _SC_V7_ILP32_OFF32: c_int = 237;
2295pub const _SC_V7_ILP32_OFFBIG: c_int = 238;
2296pub const _SC_V7_LP64_OFF64: c_int = 239;
2297pub const _SC_V7_LPBIG_OFFBIG: c_int = 240;
2298pub const _SC_SS_REPL_MAX: c_int = 241;
2299pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 242;
2300pub const _SC_TRACE_NAME_MAX: c_int = 243;
2301pub const _SC_TRACE_SYS_MAX: c_int = 244;
2302pub const _SC_TRACE_USER_EVENT_MAX: c_int = 245;
2303pub const _SC_XOPEN_STREAMS: c_int = 246;
2304pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 247;
2305pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 248;
2306
2307pub const _CS_PATH: c_int = 0;
2308pub const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS: c_int = 1;
2309pub const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS: c_int = 4;
2310pub const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS: c_int = 5;
2311pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: c_int = 1116;
2312pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: c_int = 1117;
2313pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: c_int = 1118;
2314pub const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: c_int = 1119;
2315pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: c_int = 1120;
2316pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: c_int = 1121;
2317pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: c_int = 1122;
2318pub const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: c_int = 1123;
2319pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: c_int = 1124;
2320pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: c_int = 1125;
2321pub const _CS_POSIX_V6_LP64_OFF64_LIBS: c_int = 1126;
2322pub const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: c_int = 1127;
2323pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: c_int = 1128;
2324pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: c_int = 1129;
2325pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: c_int = 1130;
2326pub const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: c_int = 1131;
2327pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: c_int = 1132;
2328pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: c_int = 1133;
2329pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: c_int = 1134;
2330pub const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS: c_int = 1135;
2331pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: c_int = 1136;
2332pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: c_int = 1137;
2333pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: c_int = 1138;
2334pub const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS: c_int = 1139;
2335pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: c_int = 1140;
2336pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: c_int = 1141;
2337pub const _CS_POSIX_V7_LP64_OFF64_LIBS: c_int = 1142;
2338pub const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS: c_int = 1143;
2339pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: c_int = 1144;
2340pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: c_int = 1145;
2341pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: c_int = 1146;
2342pub const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS: c_int = 1147;
2343
2344pub const RLIM_SAVED_MAX: crate::rlim_t = RLIM_INFINITY;
2345pub const RLIM_SAVED_CUR: crate::rlim_t = RLIM_INFINITY;
2346
2347// elf.h - Fields in the e_ident array.
2348pub const EI_NIDENT: usize = 16;
2349
2350pub const EI_MAG0: usize = 0;
2351pub const ELFMAG0: u8 = 0x7f;
2352pub const EI_MAG1: usize = 1;
2353pub const ELFMAG1: u8 = b'E';
2354pub const EI_MAG2: usize = 2;
2355pub const ELFMAG2: u8 = b'L';
2356pub const EI_MAG3: usize = 3;
2357pub const ELFMAG3: u8 = b'F';
2358pub const SELFMAG: usize = 4;
2359
2360pub const EI_CLASS: usize = 4;
2361pub const ELFCLASSNONE: u8 = 0;
2362pub const ELFCLASS32: u8 = 1;
2363pub const ELFCLASS64: u8 = 2;
2364pub const ELFCLASSNUM: usize = 3;
2365
2366pub const EI_DATA: usize = 5;
2367pub const ELFDATANONE: u8 = 0;
2368pub const ELFDATA2LSB: u8 = 1;
2369pub const ELFDATA2MSB: u8 = 2;
2370pub const ELFDATANUM: usize = 3;
2371
2372pub const EI_VERSION: usize = 6;
2373
2374pub const EI_OSABI: usize = 7;
2375pub const ELFOSABI_NONE: u8 = 0;
2376pub const ELFOSABI_SYSV: u8 = 0;
2377pub const ELFOSABI_HPUX: u8 = 1;
2378pub const ELFOSABI_NETBSD: u8 = 2;
2379pub const ELFOSABI_GNU: u8 = 3;
2380pub const ELFOSABI_LINUX: u8 = ELFOSABI_GNU;
2381pub const ELFOSABI_SOLARIS: u8 = 6;
2382pub const ELFOSABI_AIX: u8 = 7;
2383pub const ELFOSABI_IRIX: u8 = 8;
2384pub const ELFOSABI_FREEBSD: u8 = 9;
2385pub const ELFOSABI_TRU64: u8 = 10;
2386pub const ELFOSABI_MODESTO: u8 = 11;
2387pub const ELFOSABI_OPENBSD: u8 = 12;
2388pub const ELFOSABI_ARM: u8 = 97;
2389pub const ELFOSABI_STANDALONE: u8 = 255;
2390
2391pub const EI_ABIVERSION: usize = 8;
2392
2393pub const EI_PAD: usize = 9;
2394
2395// elf.h - Legal values for e_type (object file type).
2396pub const ET_NONE: u16 = 0;
2397pub const ET_REL: u16 = 1;
2398pub const ET_EXEC: u16 = 2;
2399pub const ET_DYN: u16 = 3;
2400pub const ET_CORE: u16 = 4;
2401pub const ET_NUM: u16 = 5;
2402pub const ET_LOOS: u16 = 0xfe00;
2403pub const ET_HIOS: u16 = 0xfeff;
2404pub const ET_LOPROC: u16 = 0xff00;
2405pub const ET_HIPROC: u16 = 0xffff;
2406
2407// elf.h - Legal values for e_machine (architecture).
2408pub const EM_NONE: u16 = 0;
2409pub const EM_M32: u16 = 1;
2410pub const EM_SPARC: u16 = 2;
2411pub const EM_386: u16 = 3;
2412pub const EM_68K: u16 = 4;
2413pub const EM_88K: u16 = 5;
2414pub const EM_860: u16 = 7;
2415pub const EM_MIPS: u16 = 8;
2416pub const EM_S370: u16 = 9;
2417pub const EM_MIPS_RS3_LE: u16 = 10;
2418pub const EM_PARISC: u16 = 15;
2419pub const EM_VPP500: u16 = 17;
2420pub const EM_SPARC32PLUS: u16 = 18;
2421pub const EM_960: u16 = 19;
2422pub const EM_PPC: u16 = 20;
2423pub const EM_PPC64: u16 = 21;
2424pub const EM_S390: u16 = 22;
2425pub const EM_V800: u16 = 36;
2426pub const EM_FR20: u16 = 37;
2427pub const EM_RH32: u16 = 38;
2428pub const EM_RCE: u16 = 39;
2429pub const EM_ARM: u16 = 40;
2430pub const EM_FAKE_ALPHA: u16 = 41;
2431pub const EM_SH: u16 = 42;
2432pub const EM_SPARCV9: u16 = 43;
2433pub const EM_TRICORE: u16 = 44;
2434pub const EM_ARC: u16 = 45;
2435pub const EM_H8_300: u16 = 46;
2436pub const EM_H8_300H: u16 = 47;
2437pub const EM_H8S: u16 = 48;
2438pub const EM_H8_500: u16 = 49;
2439pub const EM_IA_64: u16 = 50;
2440pub const EM_MIPS_X: u16 = 51;
2441pub const EM_COLDFIRE: u16 = 52;
2442pub const EM_68HC12: u16 = 53;
2443pub const EM_MMA: u16 = 54;
2444pub const EM_PCP: u16 = 55;
2445pub const EM_NCPU: u16 = 56;
2446pub const EM_NDR1: u16 = 57;
2447pub const EM_STARCORE: u16 = 58;
2448pub const EM_ME16: u16 = 59;
2449pub const EM_ST100: u16 = 60;
2450pub const EM_TINYJ: u16 = 61;
2451pub const EM_X86_64: u16 = 62;
2452pub const EM_PDSP: u16 = 63;
2453pub const EM_FX66: u16 = 66;
2454pub const EM_ST9PLUS: u16 = 67;
2455pub const EM_ST7: u16 = 68;
2456pub const EM_68HC16: u16 = 69;
2457pub const EM_68HC11: u16 = 70;
2458pub const EM_68HC08: u16 = 71;
2459pub const EM_68HC05: u16 = 72;
2460pub const EM_SVX: u16 = 73;
2461pub const EM_ST19: u16 = 74;
2462pub const EM_VAX: u16 = 75;
2463pub const EM_CRIS: u16 = 76;
2464pub const EM_JAVELIN: u16 = 77;
2465pub const EM_FIREPATH: u16 = 78;
2466pub const EM_ZSP: u16 = 79;
2467pub const EM_MMIX: u16 = 80;
2468pub const EM_HUANY: u16 = 81;
2469pub const EM_PRISM: u16 = 82;
2470pub const EM_AVR: u16 = 83;
2471pub const EM_FR30: u16 = 84;
2472pub const EM_D10V: u16 = 85;
2473pub const EM_D30V: u16 = 86;
2474pub const EM_V850: u16 = 87;
2475pub const EM_M32R: u16 = 88;
2476pub const EM_MN10300: u16 = 89;
2477pub const EM_MN10200: u16 = 90;
2478pub const EM_PJ: u16 = 91;
2479pub const EM_OPENRISC: u16 = 92;
2480pub const EM_ARC_A5: u16 = 93;
2481pub const EM_XTENSA: u16 = 94;
2482pub const EM_AARCH64: u16 = 183;
2483pub const EM_TILEPRO: u16 = 188;
2484pub const EM_TILEGX: u16 = 191;
2485pub const EM_ALPHA: u16 = 0x9026;
2486
2487// elf.h - Legal values for e_version (version).
2488pub const EV_NONE: u32 = 0;
2489pub const EV_CURRENT: u32 = 1;
2490pub const EV_NUM: u32 = 2;
2491
2492// elf.h - Legal values for p_type (segment type).
2493pub const PT_NULL: u32 = 0;
2494pub const PT_LOAD: u32 = 1;
2495pub const PT_DYNAMIC: u32 = 2;
2496pub const PT_INTERP: u32 = 3;
2497pub const PT_NOTE: u32 = 4;
2498pub const PT_SHLIB: u32 = 5;
2499pub const PT_PHDR: u32 = 6;
2500pub const PT_TLS: u32 = 7;
2501pub const PT_NUM: u32 = 8;
2502pub const PT_LOOS: u32 = 0x60000000;
2503pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
2504pub const PT_GNU_STACK: u32 = 0x6474e551;
2505pub const PT_GNU_RELRO: u32 = 0x6474e552;
2506pub const PT_LOSUNW: u32 = 0x6ffffffa;
2507pub const PT_SUNWBSS: u32 = 0x6ffffffa;
2508pub const PT_SUNWSTACK: u32 = 0x6ffffffb;
2509pub const PT_HISUNW: u32 = 0x6fffffff;
2510pub const PT_HIOS: u32 = 0x6fffffff;
2511pub const PT_LOPROC: u32 = 0x70000000;
2512pub const PT_HIPROC: u32 = 0x7fffffff;
2513
2514// Legal values for p_flags (segment flags).
2515pub const PF_X: u32 = 1 << 0;
2516pub const PF_W: u32 = 1 << 1;
2517pub const PF_R: u32 = 1 << 2;
2518pub const PF_MASKOS: u32 = 0x0ff00000;
2519pub const PF_MASKPROC: u32 = 0xf0000000;
2520
2521// elf.h - Legal values for a_type (entry type).
2522pub const AT_NULL: c_ulong = 0;
2523pub const AT_IGNORE: c_ulong = 1;
2524pub const AT_EXECFD: c_ulong = 2;
2525pub const AT_PHDR: c_ulong = 3;
2526pub const AT_PHENT: c_ulong = 4;
2527pub const AT_PHNUM: c_ulong = 5;
2528pub const AT_PAGESZ: c_ulong = 6;
2529pub const AT_BASE: c_ulong = 7;
2530pub const AT_FLAGS: c_ulong = 8;
2531pub const AT_ENTRY: c_ulong = 9;
2532pub const AT_NOTELF: c_ulong = 10;
2533pub const AT_UID: c_ulong = 11;
2534pub const AT_EUID: c_ulong = 12;
2535pub const AT_GID: c_ulong = 13;
2536pub const AT_EGID: c_ulong = 14;
2537pub const AT_PLATFORM: c_ulong = 15;
2538pub const AT_HWCAP: c_ulong = 16;
2539pub const AT_CLKTCK: c_ulong = 17;
2540
2541pub const AT_SECURE: c_ulong = 23;
2542pub const AT_BASE_PLATFORM: c_ulong = 24;
2543pub const AT_RANDOM: c_ulong = 25;
2544pub const AT_HWCAP2: c_ulong = 26;
2545
2546pub const AT_EXECFN: c_ulong = 31;
2547
2548// defined in arch/<arch>/include/uapi/asm/auxvec.h but has the same value
2549// wherever it is defined.
2550pub const AT_SYSINFO_EHDR: c_ulong = 33;
2551pub const AT_MINSIGSTKSZ: c_ulong = 51;
2552
2553pub const GLOB_ERR: c_int = 1 << 0;
2554pub const GLOB_MARK: c_int = 1 << 1;
2555pub const GLOB_NOSORT: c_int = 1 << 2;
2556pub const GLOB_DOOFFS: c_int = 1 << 3;
2557pub const GLOB_NOCHECK: c_int = 1 << 4;
2558pub const GLOB_APPEND: c_int = 1 << 5;
2559pub const GLOB_NOESCAPE: c_int = 1 << 6;
2560
2561pub const GLOB_NOSPACE: c_int = 1;
2562pub const GLOB_ABORTED: c_int = 2;
2563pub const GLOB_NOMATCH: c_int = 3;
2564
2565pub const POSIX_MADV_NORMAL: c_int = 0;
2566pub const POSIX_MADV_RANDOM: c_int = 1;
2567pub const POSIX_MADV_SEQUENTIAL: c_int = 2;
2568pub const POSIX_MADV_WILLNEED: c_int = 3;
2569pub const POSIX_SPAWN_USEVFORK: c_int = 64;
2570pub const POSIX_SPAWN_SETSID: c_int = 128;
2571
2572pub const S_IEXEC: mode_t = 0o0100;
2573pub const S_IWRITE: mode_t = 0o0200;
2574pub const S_IREAD: mode_t = 0o0400;
2575
2576pub const F_LOCK: c_int = 1;
2577pub const F_TEST: c_int = 3;
2578pub const F_TLOCK: c_int = 2;
2579pub const F_ULOCK: c_int = 0;
2580
2581pub const F_SEAL_FUTURE_WRITE: c_int = 0x0010;
2582pub const F_SEAL_EXEC: c_int = 0x0020;
2583
2584pub const IFF_LOWER_UP: c_int = 0x10000;
2585pub const IFF_DORMANT: c_int = 0x20000;
2586pub const IFF_ECHO: c_int = 0x40000;
2587
2588// linux/if_addr.h
2589pub const IFA_UNSPEC: c_ushort = 0;
2590pub const IFA_ADDRESS: c_ushort = 1;
2591pub const IFA_LOCAL: c_ushort = 2;
2592pub const IFA_LABEL: c_ushort = 3;
2593pub const IFA_BROADCAST: c_ushort = 4;
2594pub const IFA_ANYCAST: c_ushort = 5;
2595pub const IFA_CACHEINFO: c_ushort = 6;
2596pub const IFA_MULTICAST: c_ushort = 7;
2597pub const IFA_FLAGS: c_ushort = 8;
2598
2599pub const IFA_F_SECONDARY: u32 = 0x01;
2600pub const IFA_F_TEMPORARY: u32 = 0x01;
2601pub const IFA_F_NODAD: u32 = 0x02;
2602pub const IFA_F_OPTIMISTIC: u32 = 0x04;
2603pub const IFA_F_DADFAILED: u32 = 0x08;
2604pub const IFA_F_HOMEADDRESS: u32 = 0x10;
2605pub const IFA_F_DEPRECATED: u32 = 0x20;
2606pub const IFA_F_TENTATIVE: u32 = 0x40;
2607pub const IFA_F_PERMANENT: u32 = 0x80;
2608pub const IFA_F_MANAGETEMPADDR: u32 = 0x100;
2609pub const IFA_F_NOPREFIXROUTE: u32 = 0x200;
2610pub const IFA_F_MCAUTOJOIN: u32 = 0x400;
2611pub const IFA_F_STABLE_PRIVACY: u32 = 0x800;
2612
2613// linux/fs.h
2614
2615// Flags for preadv2/pwritev2
2616pub const RWF_HIPRI: c_int = 0x00000001;
2617pub const RWF_DSYNC: c_int = 0x00000002;
2618pub const RWF_SYNC: c_int = 0x00000004;
2619pub const RWF_NOWAIT: c_int = 0x00000008;
2620pub const RWF_APPEND: c_int = 0x00000010;
2621pub const RWF_NOAPPEND: c_int = 0x00000020;
2622pub const RWF_ATOMIC: c_int = 0x00000040;
2623pub const RWF_DONTCACHE: c_int = 0x00000080;
2624
2625// linux/if_link.h
2626pub const IFLA_UNSPEC: c_ushort = 0;
2627pub const IFLA_ADDRESS: c_ushort = 1;
2628pub const IFLA_BROADCAST: c_ushort = 2;
2629pub const IFLA_IFNAME: c_ushort = 3;
2630pub const IFLA_MTU: c_ushort = 4;
2631pub const IFLA_LINK: c_ushort = 5;
2632pub const IFLA_QDISC: c_ushort = 6;
2633pub const IFLA_STATS: c_ushort = 7;
2634pub const IFLA_COST: c_ushort = 8;
2635pub const IFLA_PRIORITY: c_ushort = 9;
2636pub const IFLA_MASTER: c_ushort = 10;
2637pub const IFLA_WIRELESS: c_ushort = 11;
2638pub const IFLA_PROTINFO: c_ushort = 12;
2639pub const IFLA_TXQLEN: c_ushort = 13;
2640pub const IFLA_MAP: c_ushort = 14;
2641pub const IFLA_WEIGHT: c_ushort = 15;
2642pub const IFLA_OPERSTATE: c_ushort = 16;
2643pub const IFLA_LINKMODE: c_ushort = 17;
2644pub const IFLA_LINKINFO: c_ushort = 18;
2645pub const IFLA_NET_NS_PID: c_ushort = 19;
2646pub const IFLA_IFALIAS: c_ushort = 20;
2647pub const IFLA_NUM_VF: c_ushort = 21;
2648pub const IFLA_VFINFO_LIST: c_ushort = 22;
2649pub const IFLA_STATS64: c_ushort = 23;
2650pub const IFLA_VF_PORTS: c_ushort = 24;
2651pub const IFLA_PORT_SELF: c_ushort = 25;
2652pub const IFLA_AF_SPEC: c_ushort = 26;
2653pub const IFLA_GROUP: c_ushort = 27;
2654pub const IFLA_NET_NS_FD: c_ushort = 28;
2655pub const IFLA_EXT_MASK: c_ushort = 29;
2656pub const IFLA_PROMISCUITY: c_ushort = 30;
2657pub const IFLA_NUM_TX_QUEUES: c_ushort = 31;
2658pub const IFLA_NUM_RX_QUEUES: c_ushort = 32;
2659pub const IFLA_CARRIER: c_ushort = 33;
2660pub const IFLA_PHYS_PORT_ID: c_ushort = 34;
2661pub const IFLA_CARRIER_CHANGES: c_ushort = 35;
2662pub const IFLA_PHYS_SWITCH_ID: c_ushort = 36;
2663pub const IFLA_LINK_NETNSID: c_ushort = 37;
2664pub const IFLA_PHYS_PORT_NAME: c_ushort = 38;
2665pub const IFLA_PROTO_DOWN: c_ushort = 39;
2666pub const IFLA_GSO_MAX_SEGS: c_ushort = 40;
2667pub const IFLA_GSO_MAX_SIZE: c_ushort = 41;
2668pub const IFLA_PAD: c_ushort = 42;
2669pub const IFLA_XDP: c_ushort = 43;
2670pub const IFLA_EVENT: c_ushort = 44;
2671pub const IFLA_NEW_NETNSID: c_ushort = 45;
2672pub const IFLA_IF_NETNSID: c_ushort = 46;
2673pub const IFLA_TARGET_NETNSID: c_ushort = IFLA_IF_NETNSID;
2674pub const IFLA_CARRIER_UP_COUNT: c_ushort = 47;
2675pub const IFLA_CARRIER_DOWN_COUNT: c_ushort = 48;
2676pub const IFLA_NEW_IFINDEX: c_ushort = 49;
2677pub const IFLA_MIN_MTU: c_ushort = 50;
2678pub const IFLA_MAX_MTU: c_ushort = 51;
2679pub const IFLA_PROP_LIST: c_ushort = 52;
2680pub const IFLA_ALT_IFNAME: c_ushort = 53;
2681pub const IFLA_PERM_ADDRESS: c_ushort = 54;
2682pub const IFLA_PROTO_DOWN_REASON: c_ushort = 55;
2683pub const IFLA_PARENT_DEV_NAME: c_ushort = 56;
2684pub const IFLA_PARENT_DEV_BUS_NAME: c_ushort = 57;
2685pub const IFLA_GRO_MAX_SIZE: c_ushort = 58;
2686pub const IFLA_TSO_MAX_SIZE: c_ushort = 59;
2687pub const IFLA_TSO_MAX_SEGS: c_ushort = 60;
2688pub const IFLA_ALLMULTI: c_ushort = 61;
2689
2690pub const IFLA_INFO_UNSPEC: c_ushort = 0;
2691pub const IFLA_INFO_KIND: c_ushort = 1;
2692pub const IFLA_INFO_DATA: c_ushort = 2;
2693pub const IFLA_INFO_XSTATS: c_ushort = 3;
2694pub const IFLA_INFO_SLAVE_KIND: c_ushort = 4;
2695pub const IFLA_INFO_SLAVE_DATA: c_ushort = 5;
2696
2697// Since Linux 3.1
2698pub const SEEK_DATA: c_int = 3;
2699pub const SEEK_HOLE: c_int = 4;
2700
2701pub const ST_RDONLY: c_ulong = 1;
2702pub const ST_NOSUID: c_ulong = 2;
2703pub const ST_NODEV: c_ulong = 4;
2704pub const ST_NOEXEC: c_ulong = 8;
2705pub const ST_SYNCHRONOUS: c_ulong = 16;
2706pub const ST_MANDLOCK: c_ulong = 64;
2707pub const ST_WRITE: c_ulong = 128;
2708pub const ST_APPEND: c_ulong = 256;
2709pub const ST_IMMUTABLE: c_ulong = 512;
2710pub const ST_NOATIME: c_ulong = 1024;
2711pub const ST_NODIRATIME: c_ulong = 2048;
2712
2713pub const RTLD_NEXT: *mut c_void = -1i64 as *mut c_void;
2714pub const RTLD_DEFAULT: *mut c_void = 0i64 as *mut c_void;
2715pub const RTLD_NODELETE: c_int = 0x1000;
2716pub const RTLD_NOW: c_int = 0x2;
2717
2718pub const AT_EACCESS: c_int = 0x200;
2719
2720// linux/mempolicy.h
2721pub const MPOL_DEFAULT: c_int = 0;
2722pub const MPOL_PREFERRED: c_int = 1;
2723pub const MPOL_BIND: c_int = 2;
2724pub const MPOL_INTERLEAVE: c_int = 3;
2725pub const MPOL_LOCAL: c_int = 4;
2726pub const MPOL_F_NUMA_BALANCING: c_int = 1 << 13;
2727pub const MPOL_F_RELATIVE_NODES: c_int = 1 << 14;
2728pub const MPOL_F_STATIC_NODES: c_int = 1 << 15;
2729
2730// linux/membarrier.h
2731pub const MEMBARRIER_CMD_QUERY: c_int = 0;
2732pub const MEMBARRIER_CMD_GLOBAL: c_int = 1 << 0;
2733pub const MEMBARRIER_CMD_GLOBAL_EXPEDITED: c_int = 1 << 1;
2734pub const MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED: c_int = 1 << 2;
2735pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED: c_int = 1 << 3;
2736pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED: c_int = 1 << 4;
2737pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE: c_int = 1 << 5;
2738pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE: c_int = 1 << 6;
2739pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ: c_int = 1 << 7;
2740pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ: c_int = 1 << 8;
2741
2742pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2743    size: [0; __SIZEOF_PTHREAD_MUTEX_T],
2744};
2745pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2746    size: [0; __SIZEOF_PTHREAD_COND_T],
2747};
2748pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2749    size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
2750};
2751
2752pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1;
2753pub const PTHREAD_ONCE_INIT: pthread_once_t = 0;
2754pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
2755pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1;
2756pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2;
2757pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
2758pub const PTHREAD_MUTEX_STALLED: c_int = 0;
2759pub const PTHREAD_MUTEX_ROBUST: c_int = 1;
2760pub const PTHREAD_PRIO_NONE: c_int = 0;
2761pub const PTHREAD_PRIO_INHERIT: c_int = 1;
2762pub const PTHREAD_PRIO_PROTECT: c_int = 2;
2763pub const PTHREAD_PROCESS_PRIVATE: c_int = 0;
2764pub const PTHREAD_PROCESS_SHARED: c_int = 1;
2765pub const PTHREAD_INHERIT_SCHED: c_int = 0;
2766pub const PTHREAD_EXPLICIT_SCHED: c_int = 1;
2767pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
2768
2769pub const RENAME_NOREPLACE: c_uint = 1;
2770pub const RENAME_EXCHANGE: c_uint = 2;
2771pub const RENAME_WHITEOUT: c_uint = 4;
2772
2773// netinet/in.h
2774// NOTE: These are in addition to the constants defined in src/unix/mod.rs
2775
2776#[deprecated(
2777    since = "0.2.80",
2778    note = "This value was increased in the newer kernel \
2779            and we'll change this following upstream in the future release. \
2780            See #1896 for more info."
2781)]
2782pub const IPPROTO_MAX: c_int = 256;
2783
2784// System V IPC
2785pub const IPC_PRIVATE: crate::key_t = 0;
2786
2787pub const IPC_CREAT: c_int = 0o1000;
2788pub const IPC_EXCL: c_int = 0o2000;
2789pub const IPC_NOWAIT: c_int = 0o4000;
2790
2791pub const IPC_RMID: c_int = 0;
2792pub const IPC_SET: c_int = 1;
2793pub const IPC_STAT: c_int = 2;
2794pub const IPC_INFO: c_int = 3;
2795pub const MSG_STAT: c_int = 11;
2796pub const MSG_INFO: c_int = 12;
2797pub const MSG_NOTIFICATION: c_int = 0x8000;
2798
2799pub const MSG_NOERROR: c_int = 0o10000;
2800pub const MSG_EXCEPT: c_int = 0o20000;
2801pub const MSG_ZEROCOPY: c_int = 0x4000000;
2802
2803pub const SEM_UNDO: c_int = 0x1000;
2804
2805pub const GETPID: c_int = 11;
2806pub const GETVAL: c_int = 12;
2807pub const GETALL: c_int = 13;
2808pub const GETNCNT: c_int = 14;
2809pub const GETZCNT: c_int = 15;
2810pub const SETVAL: c_int = 16;
2811pub const SETALL: c_int = 17;
2812pub const SEM_STAT: c_int = 18;
2813pub const SEM_INFO: c_int = 19;
2814pub const SEM_STAT_ANY: c_int = 20;
2815
2816pub const SHM_R: c_int = 0o400;
2817pub const SHM_W: c_int = 0o200;
2818
2819pub const SHM_RDONLY: c_int = 0o10000;
2820pub const SHM_RND: c_int = 0o20000;
2821pub const SHM_REMAP: c_int = 0o40000;
2822
2823pub const SHM_LOCK: c_int = 11;
2824pub const SHM_UNLOCK: c_int = 12;
2825
2826pub const SHM_HUGETLB: c_int = 0o4000;
2827#[cfg(not(all(target_env = "uclibc", target_arch = "mips")))]
2828pub const SHM_NORESERVE: c_int = 0o10000;
2829
2830pub const QFMT_VFS_OLD: c_int = 1;
2831pub const QFMT_VFS_V0: c_int = 2;
2832pub const QFMT_VFS_V1: c_int = 4;
2833
2834pub const EFD_SEMAPHORE: c_int = 0x1;
2835
2836pub const LOG_NFACILITIES: c_int = 24;
2837
2838pub const SEM_FAILED: *mut crate::sem_t = 0 as *mut sem_t;
2839
2840pub const RB_AUTOBOOT: c_int = 0x01234567u32 as i32;
2841pub const RB_HALT_SYSTEM: c_int = 0xcdef0123u32 as i32;
2842pub const RB_ENABLE_CAD: c_int = 0x89abcdefu32 as i32;
2843pub const RB_DISABLE_CAD: c_int = 0x00000000u32 as i32;
2844pub const RB_POWER_OFF: c_int = 0x4321fedcu32 as i32;
2845pub const RB_SW_SUSPEND: c_int = 0xd000fce2u32 as i32;
2846pub const RB_KEXEC: c_int = 0x45584543u32 as i32;
2847
2848pub const AI_PASSIVE: c_int = 0x0001;
2849pub const AI_CANONNAME: c_int = 0x0002;
2850pub const AI_NUMERICHOST: c_int = 0x0004;
2851pub const AI_V4MAPPED: c_int = 0x0008;
2852pub const AI_ALL: c_int = 0x0010;
2853pub const AI_ADDRCONFIG: c_int = 0x0020;
2854
2855pub const AI_NUMERICSERV: c_int = 0x0400;
2856
2857pub const EAI_BADFLAGS: c_int = -1;
2858pub const EAI_NONAME: c_int = -2;
2859pub const EAI_AGAIN: c_int = -3;
2860pub const EAI_FAIL: c_int = -4;
2861pub const EAI_NODATA: c_int = -5;
2862pub const EAI_FAMILY: c_int = -6;
2863pub const EAI_SOCKTYPE: c_int = -7;
2864pub const EAI_SERVICE: c_int = -8;
2865pub const EAI_MEMORY: c_int = -10;
2866pub const EAI_SYSTEM: c_int = -11;
2867pub const EAI_OVERFLOW: c_int = -12;
2868
2869pub const NI_NUMERICHOST: c_int = 1;
2870pub const NI_NUMERICSERV: c_int = 2;
2871pub const NI_NOFQDN: c_int = 4;
2872pub const NI_NAMEREQD: c_int = 8;
2873pub const NI_DGRAM: c_int = 16;
2874pub const NI_IDN: c_int = 32;
2875
2876pub const SYNC_FILE_RANGE_WAIT_BEFORE: c_uint = 1;
2877pub const SYNC_FILE_RANGE_WRITE: c_uint = 2;
2878pub const SYNC_FILE_RANGE_WAIT_AFTER: c_uint = 4;
2879
2880cfg_if! {
2881    if #[cfg(not(target_env = "uclibc"))] {
2882        pub const AIO_CANCELED: c_int = 0;
2883        pub const AIO_NOTCANCELED: c_int = 1;
2884        pub const AIO_ALLDONE: c_int = 2;
2885        pub const LIO_READ: c_int = 0;
2886        pub const LIO_WRITE: c_int = 1;
2887        pub const LIO_NOP: c_int = 2;
2888        pub const LIO_WAIT: c_int = 0;
2889        pub const LIO_NOWAIT: c_int = 1;
2890        pub const RUSAGE_THREAD: c_int = 1;
2891        pub const MSG_COPY: c_int = 0o40000;
2892        pub const SHM_EXEC: c_int = 0o100000;
2893        pub const IPV6_MULTICAST_ALL: c_int = 29;
2894        pub const IPV6_ROUTER_ALERT_ISOLATE: c_int = 30;
2895        pub const PACKET_MR_UNICAST: c_int = 3;
2896        pub const PTRACE_EVENT_STOP: c_int = 128;
2897        pub const UDP_SEGMENT: c_int = 103;
2898        pub const UDP_GRO: c_int = 104;
2899    }
2900}
2901
2902pub const MREMAP_MAYMOVE: c_int = 1;
2903pub const MREMAP_FIXED: c_int = 2;
2904pub const MREMAP_DONTUNMAP: c_int = 4;
2905
2906// linux/nsfs.h
2907const NSIO: c_uint = 0xb7;
2908
2909pub const NS_GET_USERNS: Ioctl = _IO(NSIO, 0x1);
2910pub const NS_GET_PARENT: Ioctl = _IO(NSIO, 0x2);
2911pub const NS_GET_NSTYPE: Ioctl = _IO(NSIO, 0x3);
2912pub const NS_GET_OWNER_UID: Ioctl = _IO(NSIO, 0x4);
2913
2914pub const NS_GET_MNTNS_ID: Ioctl = _IOR::<__u64>(NSIO, 0x5);
2915
2916pub const NS_GET_PID_FROM_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x6);
2917pub const NS_GET_TGID_FROM_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x7);
2918pub const NS_GET_PID_IN_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x8);
2919pub const NS_GET_TGID_IN_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x9);
2920
2921pub const MNT_NS_INFO_SIZE_VER0: Ioctl = 16;
2922
2923pub const NS_MNT_GET_INFO: Ioctl = _IOR::<mnt_ns_info>(NSIO, 10);
2924pub const NS_MNT_GET_NEXT: Ioctl = _IOR::<mnt_ns_info>(NSIO, 11);
2925pub const NS_MNT_GET_PREV: Ioctl = _IOR::<mnt_ns_info>(NSIO, 12);
2926
2927// linux/pidfd.h
2928pub const PIDFD_NONBLOCK: c_uint = O_NONBLOCK as c_uint;
2929pub const PIDFD_THREAD: c_uint = O_EXCL as c_uint;
2930
2931pub const PIDFD_SIGNAL_THREAD: c_uint = 1 << 0;
2932pub const PIDFD_SIGNAL_THREAD_GROUP: c_uint = 1 << 1;
2933pub const PIDFD_SIGNAL_PROCESS_GROUP: c_uint = 1 << 2;
2934
2935pub const PIDFD_INFO_PID: c_uint = 1 << 0;
2936pub const PIDFD_INFO_CREDS: c_uint = 1 << 1;
2937pub const PIDFD_INFO_CGROUPID: c_uint = 1 << 2;
2938pub const PIDFD_INFO_EXIT: c_uint = 1 << 3;
2939
2940pub const PIDFD_INFO_SIZE_VER0: c_uint = 64;
2941
2942const PIDFS_IOCTL_MAGIC: c_uint = 0xFF;
2943pub const PIDFD_GET_CGROUP_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 1);
2944pub const PIDFD_GET_IPC_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 2);
2945pub const PIDFD_GET_MNT_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 3);
2946pub const PIDFD_GET_NET_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 4);
2947pub const PIDFD_GET_PID_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 5);
2948pub const PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 6);
2949pub const PIDFD_GET_TIME_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 7);
2950pub const PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 8);
2951pub const PIDFD_GET_USER_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 9);
2952pub const PIDFD_GET_UTS_NAMESPACE: Ioctl = _IO(PIDFS_IOCTL_MAGIC, 10);
2953pub const PIDFD_GET_INFO: Ioctl = _IOWR::<pidfd_info>(PIDFS_IOCTL_MAGIC, 11);
2954
2955// linux/prctl.h
2956pub const PR_SET_PDEATHSIG: c_int = 1;
2957pub const PR_GET_PDEATHSIG: c_int = 2;
2958
2959pub const PR_GET_DUMPABLE: c_int = 3;
2960pub const PR_SET_DUMPABLE: c_int = 4;
2961
2962pub const PR_GET_UNALIGN: c_int = 5;
2963pub const PR_SET_UNALIGN: c_int = 6;
2964pub const PR_UNALIGN_NOPRINT: c_int = 1;
2965pub const PR_UNALIGN_SIGBUS: c_int = 2;
2966
2967pub const PR_GET_KEEPCAPS: c_int = 7;
2968pub const PR_SET_KEEPCAPS: c_int = 8;
2969
2970pub const PR_GET_FPEMU: c_int = 9;
2971pub const PR_SET_FPEMU: c_int = 10;
2972pub const PR_FPEMU_NOPRINT: c_int = 1;
2973pub const PR_FPEMU_SIGFPE: c_int = 2;
2974
2975pub const PR_GET_FPEXC: c_int = 11;
2976pub const PR_SET_FPEXC: c_int = 12;
2977pub const PR_FP_EXC_SW_ENABLE: c_int = 0x80;
2978pub const PR_FP_EXC_DIV: c_int = 0x010000;
2979pub const PR_FP_EXC_OVF: c_int = 0x020000;
2980pub const PR_FP_EXC_UND: c_int = 0x040000;
2981pub const PR_FP_EXC_RES: c_int = 0x080000;
2982pub const PR_FP_EXC_INV: c_int = 0x100000;
2983pub const PR_FP_EXC_DISABLED: c_int = 0;
2984pub const PR_FP_EXC_NONRECOV: c_int = 1;
2985pub const PR_FP_EXC_ASYNC: c_int = 2;
2986pub const PR_FP_EXC_PRECISE: c_int = 3;
2987
2988pub const PR_GET_TIMING: c_int = 13;
2989pub const PR_SET_TIMING: c_int = 14;
2990pub const PR_TIMING_STATISTICAL: c_int = 0;
2991pub const PR_TIMING_TIMESTAMP: c_int = 1;
2992
2993pub const PR_SET_NAME: c_int = 15;
2994pub const PR_GET_NAME: c_int = 16;
2995
2996pub const PR_GET_ENDIAN: c_int = 19;
2997pub const PR_SET_ENDIAN: c_int = 20;
2998pub const PR_ENDIAN_BIG: c_int = 0;
2999pub const PR_ENDIAN_LITTLE: c_int = 1;
3000pub const PR_ENDIAN_PPC_LITTLE: c_int = 2;
3001
3002pub const PR_GET_SECCOMP: c_int = 21;
3003pub const PR_SET_SECCOMP: c_int = 22;
3004
3005pub const PR_CAPBSET_READ: c_int = 23;
3006pub const PR_CAPBSET_DROP: c_int = 24;
3007
3008pub const PR_GET_TSC: c_int = 25;
3009pub const PR_SET_TSC: c_int = 26;
3010pub const PR_TSC_ENABLE: c_int = 1;
3011pub const PR_TSC_SIGSEGV: c_int = 2;
3012
3013pub const PR_GET_SECUREBITS: c_int = 27;
3014pub const PR_SET_SECUREBITS: c_int = 28;
3015
3016pub const PR_SET_TIMERSLACK: c_int = 29;
3017pub const PR_GET_TIMERSLACK: c_int = 30;
3018
3019pub const PR_TASK_PERF_EVENTS_DISABLE: c_int = 31;
3020pub const PR_TASK_PERF_EVENTS_ENABLE: c_int = 32;
3021
3022pub const PR_MCE_KILL: c_int = 33;
3023pub const PR_MCE_KILL_CLEAR: c_int = 0;
3024pub const PR_MCE_KILL_SET: c_int = 1;
3025
3026pub const PR_MCE_KILL_LATE: c_int = 0;
3027pub const PR_MCE_KILL_EARLY: c_int = 1;
3028pub const PR_MCE_KILL_DEFAULT: c_int = 2;
3029
3030pub const PR_MCE_KILL_GET: c_int = 34;
3031
3032pub const PR_SET_MM: c_int = 35;
3033pub const PR_SET_MM_START_CODE: c_int = 1;
3034pub const PR_SET_MM_END_CODE: c_int = 2;
3035pub const PR_SET_MM_START_DATA: c_int = 3;
3036pub const PR_SET_MM_END_DATA: c_int = 4;
3037pub const PR_SET_MM_START_STACK: c_int = 5;
3038pub const PR_SET_MM_START_BRK: c_int = 6;
3039pub const PR_SET_MM_BRK: c_int = 7;
3040pub const PR_SET_MM_ARG_START: c_int = 8;
3041pub const PR_SET_MM_ARG_END: c_int = 9;
3042pub const PR_SET_MM_ENV_START: c_int = 10;
3043pub const PR_SET_MM_ENV_END: c_int = 11;
3044pub const PR_SET_MM_AUXV: c_int = 12;
3045pub const PR_SET_MM_EXE_FILE: c_int = 13;
3046pub const PR_SET_MM_MAP: c_int = 14;
3047pub const PR_SET_MM_MAP_SIZE: c_int = 15;
3048
3049pub const PR_SET_PTRACER: c_int = 0x59616d61;
3050pub const PR_SET_PTRACER_ANY: c_ulong = 0xffffffffffffffff;
3051
3052pub const PR_SET_CHILD_SUBREAPER: c_int = 36;
3053pub const PR_GET_CHILD_SUBREAPER: c_int = 37;
3054
3055pub const PR_SET_NO_NEW_PRIVS: c_int = 38;
3056pub const PR_GET_NO_NEW_PRIVS: c_int = 39;
3057
3058pub const PR_SET_MDWE: c_int = 65;
3059pub const PR_GET_MDWE: c_int = 66;
3060pub const PR_MDWE_REFUSE_EXEC_GAIN: c_uint = 1 << 0;
3061pub const PR_MDWE_NO_INHERIT: c_uint = 1 << 1;
3062
3063pub const PR_GET_TID_ADDRESS: c_int = 40;
3064
3065pub const PR_SET_THP_DISABLE: c_int = 41;
3066pub const PR_GET_THP_DISABLE: c_int = 42;
3067
3068pub const PR_MPX_ENABLE_MANAGEMENT: c_int = 43;
3069pub const PR_MPX_DISABLE_MANAGEMENT: c_int = 44;
3070
3071pub const PR_SET_FP_MODE: c_int = 45;
3072pub const PR_GET_FP_MODE: c_int = 46;
3073pub const PR_FP_MODE_FR: c_int = 1 << 0;
3074pub const PR_FP_MODE_FRE: c_int = 1 << 1;
3075
3076pub const PR_CAP_AMBIENT: c_int = 47;
3077pub const PR_CAP_AMBIENT_IS_SET: c_int = 1;
3078pub const PR_CAP_AMBIENT_RAISE: c_int = 2;
3079pub const PR_CAP_AMBIENT_LOWER: c_int = 3;
3080pub const PR_CAP_AMBIENT_CLEAR_ALL: c_int = 4;
3081
3082pub const PR_SET_VMA: c_int = 0x53564d41;
3083pub const PR_SET_VMA_ANON_NAME: c_int = 0;
3084
3085pub const PR_SCHED_CORE: c_int = 62;
3086pub const PR_SCHED_CORE_GET: c_int = 0;
3087pub const PR_SCHED_CORE_CREATE: c_int = 1;
3088pub const PR_SCHED_CORE_SHARE_TO: c_int = 2;
3089pub const PR_SCHED_CORE_SHARE_FROM: c_int = 3;
3090pub const PR_SCHED_CORE_MAX: c_int = 4;
3091pub const PR_SCHED_CORE_SCOPE_THREAD: c_int = 0;
3092pub const PR_SCHED_CORE_SCOPE_THREAD_GROUP: c_int = 1;
3093pub const PR_SCHED_CORE_SCOPE_PROCESS_GROUP: c_int = 2;
3094
3095pub const GRND_NONBLOCK: c_uint = 0x0001;
3096pub const GRND_RANDOM: c_uint = 0x0002;
3097pub const GRND_INSECURE: c_uint = 0x0004;
3098
3099// <linux/seccomp.h>
3100pub const SECCOMP_MODE_DISABLED: c_uint = 0;
3101pub const SECCOMP_MODE_STRICT: c_uint = 1;
3102pub const SECCOMP_MODE_FILTER: c_uint = 2;
3103
3104pub const SECCOMP_SET_MODE_STRICT: c_uint = 0;
3105pub const SECCOMP_SET_MODE_FILTER: c_uint = 1;
3106pub const SECCOMP_GET_ACTION_AVAIL: c_uint = 2;
3107pub const SECCOMP_GET_NOTIF_SIZES: c_uint = 3;
3108
3109pub const SECCOMP_FILTER_FLAG_TSYNC: c_ulong = 1 << 0;
3110pub const SECCOMP_FILTER_FLAG_LOG: c_ulong = 1 << 1;
3111pub const SECCOMP_FILTER_FLAG_SPEC_ALLOW: c_ulong = 1 << 2;
3112pub const SECCOMP_FILTER_FLAG_NEW_LISTENER: c_ulong = 1 << 3;
3113pub const SECCOMP_FILTER_FLAG_TSYNC_ESRCH: c_ulong = 1 << 4;
3114pub const SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV: c_ulong = 1 << 5;
3115
3116pub const SECCOMP_RET_KILL_PROCESS: c_uint = 0x80000000;
3117pub const SECCOMP_RET_KILL_THREAD: c_uint = 0x00000000;
3118pub const SECCOMP_RET_KILL: c_uint = SECCOMP_RET_KILL_THREAD;
3119pub const SECCOMP_RET_TRAP: c_uint = 0x00030000;
3120pub const SECCOMP_RET_ERRNO: c_uint = 0x00050000;
3121pub const SECCOMP_RET_USER_NOTIF: c_uint = 0x7fc00000;
3122pub const SECCOMP_RET_TRACE: c_uint = 0x7ff00000;
3123pub const SECCOMP_RET_LOG: c_uint = 0x7ffc0000;
3124pub const SECCOMP_RET_ALLOW: c_uint = 0x7fff0000;
3125
3126pub const SECCOMP_RET_ACTION_FULL: c_uint = 0xffff0000;
3127pub const SECCOMP_RET_ACTION: c_uint = 0x7fff0000;
3128pub const SECCOMP_RET_DATA: c_uint = 0x0000ffff;
3129
3130pub const SECCOMP_USER_NOTIF_FLAG_CONTINUE: c_ulong = 1;
3131
3132pub const SECCOMP_ADDFD_FLAG_SETFD: c_ulong = 1;
3133pub const SECCOMP_ADDFD_FLAG_SEND: c_ulong = 2;
3134
3135pub const ITIMER_REAL: c_int = 0;
3136pub const ITIMER_VIRTUAL: c_int = 1;
3137pub const ITIMER_PROF: c_int = 2;
3138
3139pub const TFD_CLOEXEC: c_int = O_CLOEXEC;
3140pub const TFD_NONBLOCK: c_int = O_NONBLOCK;
3141pub const TFD_TIMER_ABSTIME: c_int = 1;
3142pub const TFD_TIMER_CANCEL_ON_SET: c_int = 2;
3143
3144pub const _POSIX_VDISABLE: crate::cc_t = 0;
3145
3146pub const FALLOC_FL_KEEP_SIZE: c_int = 0x01;
3147pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x02;
3148pub const FALLOC_FL_COLLAPSE_RANGE: c_int = 0x08;
3149pub const FALLOC_FL_ZERO_RANGE: c_int = 0x10;
3150pub const FALLOC_FL_INSERT_RANGE: c_int = 0x20;
3151pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x40;
3152
3153#[deprecated(
3154    since = "0.2.55",
3155    note = "ENOATTR is not available on Linux; use ENODATA instead"
3156)]
3157pub const ENOATTR: c_int = crate::ENODATA;
3158
3159pub const SO_ORIGINAL_DST: c_int = 80;
3160
3161pub const IP_RECVFRAGSIZE: c_int = 25;
3162
3163pub const IPV6_FLOWINFO: c_int = 11;
3164pub const IPV6_FLOWLABEL_MGR: c_int = 32;
3165pub const IPV6_FLOWINFO_SEND: c_int = 33;
3166pub const IPV6_RECVFRAGSIZE: c_int = 77;
3167pub const IPV6_FREEBIND: c_int = 78;
3168pub const IPV6_FLOWINFO_FLOWLABEL: c_int = 0x000fffff;
3169pub const IPV6_FLOWINFO_PRIORITY: c_int = 0x0ff00000;
3170
3171pub const IPV6_RTHDR_LOOSE: c_int = 0;
3172pub const IPV6_RTHDR_STRICT: c_int = 1;
3173
3174// SO_MEMINFO offsets
3175pub const SK_MEMINFO_RMEM_ALLOC: c_int = 0;
3176pub const SK_MEMINFO_RCVBUF: c_int = 1;
3177pub const SK_MEMINFO_WMEM_ALLOC: c_int = 2;
3178pub const SK_MEMINFO_SNDBUF: c_int = 3;
3179pub const SK_MEMINFO_FWD_ALLOC: c_int = 4;
3180pub const SK_MEMINFO_WMEM_QUEUED: c_int = 5;
3181pub const SK_MEMINFO_OPTMEM: c_int = 6;
3182pub const SK_MEMINFO_BACKLOG: c_int = 7;
3183pub const SK_MEMINFO_DROPS: c_int = 8;
3184
3185pub const IUTF8: crate::tcflag_t = 0x00004000;
3186#[cfg(not(all(target_env = "uclibc", target_arch = "mips")))]
3187pub const CMSPAR: crate::tcflag_t = 0o10000000000;
3188
3189pub const MFD_CLOEXEC: c_uint = 0x0001;
3190pub const MFD_ALLOW_SEALING: c_uint = 0x0002;
3191pub const MFD_HUGETLB: c_uint = 0x0004;
3192pub const MFD_NOEXEC_SEAL: c_uint = 0x0008;
3193pub const MFD_EXEC: c_uint = 0x0010;
3194pub const MFD_HUGE_64KB: c_uint = 0x40000000;
3195pub const MFD_HUGE_512KB: c_uint = 0x4c000000;
3196pub const MFD_HUGE_1MB: c_uint = 0x50000000;
3197pub const MFD_HUGE_2MB: c_uint = 0x54000000;
3198pub const MFD_HUGE_8MB: c_uint = 0x5c000000;
3199pub const MFD_HUGE_16MB: c_uint = 0x60000000;
3200pub const MFD_HUGE_32MB: c_uint = 0x64000000;
3201pub const MFD_HUGE_256MB: c_uint = 0x70000000;
3202pub const MFD_HUGE_512MB: c_uint = 0x74000000;
3203pub const MFD_HUGE_1GB: c_uint = 0x78000000;
3204pub const MFD_HUGE_2GB: c_uint = 0x7c000000;
3205pub const MFD_HUGE_16GB: c_uint = 0x88000000;
3206pub const MFD_HUGE_MASK: c_uint = 63;
3207pub const MFD_HUGE_SHIFT: c_uint = 26;
3208
3209// linux/close_range.h
3210pub const CLOSE_RANGE_UNSHARE: c_uint = 1 << 1;
3211pub const CLOSE_RANGE_CLOEXEC: c_uint = 1 << 2;
3212
3213// linux/filter.h
3214pub const SKF_AD_OFF: c_int = -0x1000;
3215pub const SKF_AD_PROTOCOL: c_int = 0;
3216pub const SKF_AD_PKTTYPE: c_int = 4;
3217pub const SKF_AD_IFINDEX: c_int = 8;
3218pub const SKF_AD_NLATTR: c_int = 12;
3219pub const SKF_AD_NLATTR_NEST: c_int = 16;
3220pub const SKF_AD_MARK: c_int = 20;
3221pub const SKF_AD_QUEUE: c_int = 24;
3222pub const SKF_AD_HATYPE: c_int = 28;
3223pub const SKF_AD_RXHASH: c_int = 32;
3224pub const SKF_AD_CPU: c_int = 36;
3225pub const SKF_AD_ALU_XOR_X: c_int = 40;
3226pub const SKF_AD_VLAN_TAG: c_int = 44;
3227pub const SKF_AD_VLAN_TAG_PRESENT: c_int = 48;
3228pub const SKF_AD_PAY_OFFSET: c_int = 52;
3229pub const SKF_AD_RANDOM: c_int = 56;
3230pub const SKF_AD_VLAN_TPID: c_int = 60;
3231pub const SKF_AD_MAX: c_int = 64;
3232pub const SKF_NET_OFF: c_int = -0x100000;
3233pub const SKF_LL_OFF: c_int = -0x200000;
3234pub const BPF_NET_OFF: c_int = SKF_NET_OFF;
3235pub const BPF_LL_OFF: c_int = SKF_LL_OFF;
3236pub const BPF_MEMWORDS: c_int = 16;
3237pub const BPF_MAXINSNS: c_int = 4096;
3238
3239// linux/bpf_common.h
3240pub const BPF_LD: __u32 = 0x00;
3241pub const BPF_LDX: __u32 = 0x01;
3242pub const BPF_ST: __u32 = 0x02;
3243pub const BPF_STX: __u32 = 0x03;
3244pub const BPF_ALU: __u32 = 0x04;
3245pub const BPF_JMP: __u32 = 0x05;
3246pub const BPF_RET: __u32 = 0x06;
3247pub const BPF_MISC: __u32 = 0x07;
3248pub const BPF_W: __u32 = 0x00;
3249pub const BPF_H: __u32 = 0x08;
3250pub const BPF_B: __u32 = 0x10;
3251pub const BPF_IMM: __u32 = 0x00;
3252pub const BPF_ABS: __u32 = 0x20;
3253pub const BPF_IND: __u32 = 0x40;
3254pub const BPF_MEM: __u32 = 0x60;
3255pub const BPF_LEN: __u32 = 0x80;
3256pub const BPF_MSH: __u32 = 0xa0;
3257pub const BPF_ADD: __u32 = 0x00;
3258pub const BPF_SUB: __u32 = 0x10;
3259pub const BPF_MUL: __u32 = 0x20;
3260pub const BPF_DIV: __u32 = 0x30;
3261pub const BPF_OR: __u32 = 0x40;
3262pub const BPF_AND: __u32 = 0x50;
3263pub const BPF_LSH: __u32 = 0x60;
3264pub const BPF_RSH: __u32 = 0x70;
3265pub const BPF_NEG: __u32 = 0x80;
3266pub const BPF_MOD: __u32 = 0x90;
3267pub const BPF_XOR: __u32 = 0xa0;
3268pub const BPF_JA: __u32 = 0x00;
3269pub const BPF_JEQ: __u32 = 0x10;
3270pub const BPF_JGT: __u32 = 0x20;
3271pub const BPF_JGE: __u32 = 0x30;
3272pub const BPF_JSET: __u32 = 0x40;
3273pub const BPF_K: __u32 = 0x00;
3274pub const BPF_X: __u32 = 0x08;
3275
3276// linux/filter.h
3277
3278pub const BPF_A: __u32 = 0x10;
3279pub const BPF_TAX: __u32 = 0x00;
3280pub const BPF_TXA: __u32 = 0x80;
3281
3282// linux/openat2.h
3283pub const RESOLVE_NO_XDEV: crate::__u64 = 0x01;
3284pub const RESOLVE_NO_MAGICLINKS: crate::__u64 = 0x02;
3285pub const RESOLVE_NO_SYMLINKS: crate::__u64 = 0x04;
3286pub const RESOLVE_BENEATH: crate::__u64 = 0x08;
3287pub const RESOLVE_IN_ROOT: crate::__u64 = 0x10;
3288pub const RESOLVE_CACHED: crate::__u64 = 0x20;
3289
3290// linux/if_ether.h
3291pub const ETH_ALEN: c_int = 6;
3292pub const ETH_HLEN: c_int = 14;
3293pub const ETH_ZLEN: c_int = 60;
3294pub const ETH_DATA_LEN: c_int = 1500;
3295pub const ETH_FRAME_LEN: c_int = 1514;
3296pub const ETH_FCS_LEN: c_int = 4;
3297
3298// These are the defined Ethernet Protocol ID's.
3299pub const ETH_P_LOOP: c_int = 0x0060;
3300pub const ETH_P_PUP: c_int = 0x0200;
3301pub const ETH_P_PUPAT: c_int = 0x0201;
3302pub const ETH_P_IP: c_int = 0x0800;
3303pub const ETH_P_X25: c_int = 0x0805;
3304pub const ETH_P_ARP: c_int = 0x0806;
3305pub const ETH_P_BPQ: c_int = 0x08FF;
3306pub const ETH_P_IEEEPUP: c_int = 0x0a00;
3307pub const ETH_P_IEEEPUPAT: c_int = 0x0a01;
3308pub const ETH_P_BATMAN: c_int = 0x4305;
3309pub const ETH_P_DEC: c_int = 0x6000;
3310pub const ETH_P_DNA_DL: c_int = 0x6001;
3311pub const ETH_P_DNA_RC: c_int = 0x6002;
3312pub const ETH_P_DNA_RT: c_int = 0x6003;
3313pub const ETH_P_LAT: c_int = 0x6004;
3314pub const ETH_P_DIAG: c_int = 0x6005;
3315pub const ETH_P_CUST: c_int = 0x6006;
3316pub const ETH_P_SCA: c_int = 0x6007;
3317pub const ETH_P_TEB: c_int = 0x6558;
3318pub const ETH_P_RARP: c_int = 0x8035;
3319pub const ETH_P_ATALK: c_int = 0x809B;
3320pub const ETH_P_AARP: c_int = 0x80F3;
3321pub const ETH_P_8021Q: c_int = 0x8100;
3322pub const ETH_P_IPX: c_int = 0x8137;
3323pub const ETH_P_IPV6: c_int = 0x86DD;
3324pub const ETH_P_PAUSE: c_int = 0x8808;
3325pub const ETH_P_SLOW: c_int = 0x8809;
3326pub const ETH_P_WCCP: c_int = 0x883E;
3327pub const ETH_P_MPLS_UC: c_int = 0x8847;
3328pub const ETH_P_MPLS_MC: c_int = 0x8848;
3329pub const ETH_P_ATMMPOA: c_int = 0x884c;
3330pub const ETH_P_PPP_DISC: c_int = 0x8863;
3331pub const ETH_P_PPP_SES: c_int = 0x8864;
3332pub const ETH_P_LINK_CTL: c_int = 0x886c;
3333pub const ETH_P_ATMFATE: c_int = 0x8884;
3334pub const ETH_P_PAE: c_int = 0x888E;
3335pub const ETH_P_AOE: c_int = 0x88A2;
3336pub const ETH_P_8021AD: c_int = 0x88A8;
3337pub const ETH_P_802_EX1: c_int = 0x88B5;
3338pub const ETH_P_TIPC: c_int = 0x88CA;
3339pub const ETH_P_MACSEC: c_int = 0x88E5;
3340pub const ETH_P_8021AH: c_int = 0x88E7;
3341pub const ETH_P_MVRP: c_int = 0x88F5;
3342pub const ETH_P_1588: c_int = 0x88F7;
3343pub const ETH_P_PRP: c_int = 0x88FB;
3344pub const ETH_P_FCOE: c_int = 0x8906;
3345pub const ETH_P_TDLS: c_int = 0x890D;
3346pub const ETH_P_FIP: c_int = 0x8914;
3347pub const ETH_P_80221: c_int = 0x8917;
3348pub const ETH_P_LOOPBACK: c_int = 0x9000;
3349pub const ETH_P_QINQ1: c_int = 0x9100;
3350pub const ETH_P_QINQ2: c_int = 0x9200;
3351pub const ETH_P_QINQ3: c_int = 0x9300;
3352pub const ETH_P_EDSA: c_int = 0xDADA;
3353pub const ETH_P_AF_IUCV: c_int = 0xFBFB;
3354
3355pub const ETH_P_802_3_MIN: c_int = 0x0600;
3356
3357// Non DIX types. Won't clash for 1500 types.
3358pub const ETH_P_802_3: c_int = 0x0001;
3359pub const ETH_P_AX25: c_int = 0x0002;
3360pub const ETH_P_ALL: c_int = 0x0003;
3361pub const ETH_P_802_2: c_int = 0x0004;
3362pub const ETH_P_SNAP: c_int = 0x0005;
3363pub const ETH_P_DDCMP: c_int = 0x0006;
3364pub const ETH_P_WAN_PPP: c_int = 0x0007;
3365pub const ETH_P_PPP_MP: c_int = 0x0008;
3366pub const ETH_P_LOCALTALK: c_int = 0x0009;
3367pub const ETH_P_CANFD: c_int = 0x000D;
3368pub const ETH_P_PPPTALK: c_int = 0x0010;
3369pub const ETH_P_TR_802_2: c_int = 0x0011;
3370pub const ETH_P_MOBITEX: c_int = 0x0015;
3371pub const ETH_P_CONTROL: c_int = 0x0016;
3372pub const ETH_P_IRDA: c_int = 0x0017;
3373pub const ETH_P_ECONET: c_int = 0x0018;
3374pub const ETH_P_HDLC: c_int = 0x0019;
3375pub const ETH_P_ARCNET: c_int = 0x001A;
3376pub const ETH_P_DSA: c_int = 0x001B;
3377pub const ETH_P_TRAILER: c_int = 0x001C;
3378pub const ETH_P_PHONET: c_int = 0x00F5;
3379pub const ETH_P_IEEE802154: c_int = 0x00F6;
3380pub const ETH_P_CAIF: c_int = 0x00F7;
3381
3382// DIFF(main): changed to `c_short` in f62eb023ab
3383pub const POSIX_SPAWN_RESETIDS: c_int = 0x01;
3384pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02;
3385pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x04;
3386pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x08;
3387pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x10;
3388pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x20;
3389
3390pub const NLMSG_NOOP: c_int = 0x1;
3391pub const NLMSG_ERROR: c_int = 0x2;
3392pub const NLMSG_DONE: c_int = 0x3;
3393pub const NLMSG_OVERRUN: c_int = 0x4;
3394pub const NLMSG_MIN_TYPE: c_int = 0x10;
3395
3396// linux/netfilter/nfnetlink.h
3397pub const NFNLGRP_NONE: c_int = 0;
3398pub const NFNLGRP_CONNTRACK_NEW: c_int = 1;
3399pub const NFNLGRP_CONNTRACK_UPDATE: c_int = 2;
3400pub const NFNLGRP_CONNTRACK_DESTROY: c_int = 3;
3401pub const NFNLGRP_CONNTRACK_EXP_NEW: c_int = 4;
3402pub const NFNLGRP_CONNTRACK_EXP_UPDATE: c_int = 5;
3403pub const NFNLGRP_CONNTRACK_EXP_DESTROY: c_int = 6;
3404pub const NFNLGRP_NFTABLES: c_int = 7;
3405pub const NFNLGRP_ACCT_QUOTA: c_int = 8;
3406pub const NFNLGRP_NFTRACE: c_int = 9;
3407
3408pub const NFNETLINK_V0: c_int = 0;
3409
3410pub const NFNL_SUBSYS_NONE: c_int = 0;
3411pub const NFNL_SUBSYS_CTNETLINK: c_int = 1;
3412pub const NFNL_SUBSYS_CTNETLINK_EXP: c_int = 2;
3413pub const NFNL_SUBSYS_QUEUE: c_int = 3;
3414pub const NFNL_SUBSYS_ULOG: c_int = 4;
3415pub const NFNL_SUBSYS_OSF: c_int = 5;
3416pub const NFNL_SUBSYS_IPSET: c_int = 6;
3417pub const NFNL_SUBSYS_ACCT: c_int = 7;
3418pub const NFNL_SUBSYS_CTNETLINK_TIMEOUT: c_int = 8;
3419pub const NFNL_SUBSYS_CTHELPER: c_int = 9;
3420pub const NFNL_SUBSYS_NFTABLES: c_int = 10;
3421pub const NFNL_SUBSYS_NFT_COMPAT: c_int = 11;
3422pub const NFNL_SUBSYS_HOOK: c_int = 12;
3423pub const NFNL_SUBSYS_COUNT: c_int = 13;
3424
3425pub const NFNL_MSG_BATCH_BEGIN: c_int = NLMSG_MIN_TYPE;
3426pub const NFNL_MSG_BATCH_END: c_int = NLMSG_MIN_TYPE + 1;
3427
3428pub const NFNL_BATCH_UNSPEC: c_int = 0;
3429pub const NFNL_BATCH_GENID: c_int = 1;
3430
3431// linux/netfilter/nfnetlink_log.h
3432pub const NFULNL_MSG_PACKET: c_int = 0;
3433pub const NFULNL_MSG_CONFIG: c_int = 1;
3434
3435pub const NFULA_VLAN_UNSPEC: c_int = 0;
3436pub const NFULA_VLAN_PROTO: c_int = 1;
3437pub const NFULA_VLAN_TCI: c_int = 2;
3438
3439pub const NFULA_UNSPEC: c_int = 0;
3440pub const NFULA_PACKET_HDR: c_int = 1;
3441pub const NFULA_MARK: c_int = 2;
3442pub const NFULA_TIMESTAMP: c_int = 3;
3443pub const NFULA_IFINDEX_INDEV: c_int = 4;
3444pub const NFULA_IFINDEX_OUTDEV: c_int = 5;
3445pub const NFULA_IFINDEX_PHYSINDEV: c_int = 6;
3446pub const NFULA_IFINDEX_PHYSOUTDEV: c_int = 7;
3447pub const NFULA_HWADDR: c_int = 8;
3448pub const NFULA_PAYLOAD: c_int = 9;
3449pub const NFULA_PREFIX: c_int = 10;
3450pub const NFULA_UID: c_int = 11;
3451pub const NFULA_SEQ: c_int = 12;
3452pub const NFULA_SEQ_GLOBAL: c_int = 13;
3453pub const NFULA_GID: c_int = 14;
3454pub const NFULA_HWTYPE: c_int = 15;
3455pub const NFULA_HWHEADER: c_int = 16;
3456pub const NFULA_HWLEN: c_int = 17;
3457pub const NFULA_CT: c_int = 18;
3458pub const NFULA_CT_INFO: c_int = 19;
3459pub const NFULA_VLAN: c_int = 20;
3460pub const NFULA_L2HDR: c_int = 21;
3461
3462pub const NFULNL_CFG_CMD_NONE: c_int = 0;
3463pub const NFULNL_CFG_CMD_BIND: c_int = 1;
3464pub const NFULNL_CFG_CMD_UNBIND: c_int = 2;
3465pub const NFULNL_CFG_CMD_PF_BIND: c_int = 3;
3466pub const NFULNL_CFG_CMD_PF_UNBIND: c_int = 4;
3467
3468pub const NFULA_CFG_UNSPEC: c_int = 0;
3469pub const NFULA_CFG_CMD: c_int = 1;
3470pub const NFULA_CFG_MODE: c_int = 2;
3471pub const NFULA_CFG_NLBUFSIZ: c_int = 3;
3472pub const NFULA_CFG_TIMEOUT: c_int = 4;
3473pub const NFULA_CFG_QTHRESH: c_int = 5;
3474pub const NFULA_CFG_FLAGS: c_int = 6;
3475
3476pub const NFULNL_COPY_NONE: c_int = 0x00;
3477pub const NFULNL_COPY_META: c_int = 0x01;
3478pub const NFULNL_COPY_PACKET: c_int = 0x02;
3479
3480pub const NFULNL_CFG_F_SEQ: c_int = 0x0001;
3481pub const NFULNL_CFG_F_SEQ_GLOBAL: c_int = 0x0002;
3482pub const NFULNL_CFG_F_CONNTRACK: c_int = 0x0004;
3483
3484// linux/netfilter/nfnetlink_queue.h
3485pub const NFQNL_MSG_PACKET: c_int = 0;
3486pub const NFQNL_MSG_VERDICT: c_int = 1;
3487pub const NFQNL_MSG_CONFIG: c_int = 2;
3488pub const NFQNL_MSG_VERDICT_BATCH: c_int = 3;
3489
3490pub const NFQA_UNSPEC: c_int = 0;
3491pub const NFQA_PACKET_HDR: c_int = 1;
3492pub const NFQA_VERDICT_HDR: c_int = 2;
3493pub const NFQA_MARK: c_int = 3;
3494pub const NFQA_TIMESTAMP: c_int = 4;
3495pub const NFQA_IFINDEX_INDEV: c_int = 5;
3496pub const NFQA_IFINDEX_OUTDEV: c_int = 6;
3497pub const NFQA_IFINDEX_PHYSINDEV: c_int = 7;
3498pub const NFQA_IFINDEX_PHYSOUTDEV: c_int = 8;
3499pub const NFQA_HWADDR: c_int = 9;
3500pub const NFQA_PAYLOAD: c_int = 10;
3501pub const NFQA_CT: c_int = 11;
3502pub const NFQA_CT_INFO: c_int = 12;
3503pub const NFQA_CAP_LEN: c_int = 13;
3504pub const NFQA_SKB_INFO: c_int = 14;
3505pub const NFQA_EXP: c_int = 15;
3506pub const NFQA_UID: c_int = 16;
3507pub const NFQA_GID: c_int = 17;
3508pub const NFQA_SECCTX: c_int = 18;
3509pub const NFQA_VLAN: c_int = 19;
3510pub const NFQA_L2HDR: c_int = 20;
3511pub const NFQA_PRIORITY: c_int = 21;
3512
3513pub const NFQA_VLAN_UNSPEC: c_int = 0;
3514pub const NFQA_VLAN_PROTO: c_int = 1;
3515pub const NFQA_VLAN_TCI: c_int = 2;
3516
3517pub const NFQNL_CFG_CMD_NONE: c_int = 0;
3518pub const NFQNL_CFG_CMD_BIND: c_int = 1;
3519pub const NFQNL_CFG_CMD_UNBIND: c_int = 2;
3520pub const NFQNL_CFG_CMD_PF_BIND: c_int = 3;
3521pub const NFQNL_CFG_CMD_PF_UNBIND: c_int = 4;
3522
3523pub const NFQNL_COPY_NONE: c_int = 0;
3524pub const NFQNL_COPY_META: c_int = 1;
3525pub const NFQNL_COPY_PACKET: c_int = 2;
3526
3527pub const NFQA_CFG_UNSPEC: c_int = 0;
3528pub const NFQA_CFG_CMD: c_int = 1;
3529pub const NFQA_CFG_PARAMS: c_int = 2;
3530pub const NFQA_CFG_QUEUE_MAXLEN: c_int = 3;
3531pub const NFQA_CFG_MASK: c_int = 4;
3532pub const NFQA_CFG_FLAGS: c_int = 5;
3533
3534pub const NFQA_CFG_F_FAIL_OPEN: c_int = 0x0001;
3535pub const NFQA_CFG_F_CONNTRACK: c_int = 0x0002;
3536pub const NFQA_CFG_F_GSO: c_int = 0x0004;
3537pub const NFQA_CFG_F_UID_GID: c_int = 0x0008;
3538pub const NFQA_CFG_F_SECCTX: c_int = 0x0010;
3539pub const NFQA_CFG_F_MAX: c_int = 0x0020;
3540
3541pub const NFQA_SKB_CSUMNOTREADY: c_int = 0x0001;
3542pub const NFQA_SKB_GSO: c_int = 0x0002;
3543pub const NFQA_SKB_CSUM_NOTVERIFIED: c_int = 0x0004;
3544
3545// linux/genetlink.h
3546
3547pub const GENL_NAMSIZ: c_int = 16;
3548
3549pub const GENL_MIN_ID: c_int = NLMSG_MIN_TYPE;
3550pub const GENL_MAX_ID: c_int = 1023;
3551
3552pub const GENL_ADMIN_PERM: c_int = 0x01;
3553pub const GENL_CMD_CAP_DO: c_int = 0x02;
3554pub const GENL_CMD_CAP_DUMP: c_int = 0x04;
3555pub const GENL_CMD_CAP_HASPOL: c_int = 0x08;
3556
3557pub const GENL_ID_CTRL: c_int = NLMSG_MIN_TYPE;
3558
3559pub const CTRL_CMD_UNSPEC: c_int = 0;
3560pub const CTRL_CMD_NEWFAMILY: c_int = 1;
3561pub const CTRL_CMD_DELFAMILY: c_int = 2;
3562pub const CTRL_CMD_GETFAMILY: c_int = 3;
3563pub const CTRL_CMD_NEWOPS: c_int = 4;
3564pub const CTRL_CMD_DELOPS: c_int = 5;
3565pub const CTRL_CMD_GETOPS: c_int = 6;
3566pub const CTRL_CMD_NEWMCAST_GRP: c_int = 7;
3567pub const CTRL_CMD_DELMCAST_GRP: c_int = 8;
3568pub const CTRL_CMD_GETMCAST_GRP: c_int = 9;
3569
3570pub const CTRL_ATTR_UNSPEC: c_int = 0;
3571pub const CTRL_ATTR_FAMILY_ID: c_int = 1;
3572pub const CTRL_ATTR_FAMILY_NAME: c_int = 2;
3573pub const CTRL_ATTR_VERSION: c_int = 3;
3574pub const CTRL_ATTR_HDRSIZE: c_int = 4;
3575pub const CTRL_ATTR_MAXATTR: c_int = 5;
3576pub const CTRL_ATTR_OPS: c_int = 6;
3577pub const CTRL_ATTR_MCAST_GROUPS: c_int = 7;
3578
3579pub const CTRL_ATTR_OP_UNSPEC: c_int = 0;
3580pub const CTRL_ATTR_OP_ID: c_int = 1;
3581pub const CTRL_ATTR_OP_FLAGS: c_int = 2;
3582
3583pub const CTRL_ATTR_MCAST_GRP_UNSPEC: c_int = 0;
3584pub const CTRL_ATTR_MCAST_GRP_NAME: c_int = 1;
3585pub const CTRL_ATTR_MCAST_GRP_ID: c_int = 2;
3586
3587// linux/if_packet.h
3588pub const PACKET_HOST: c_uchar = 0;
3589pub const PACKET_BROADCAST: c_uchar = 1;
3590pub const PACKET_MULTICAST: c_uchar = 2;
3591pub const PACKET_OTHERHOST: c_uchar = 3;
3592pub const PACKET_OUTGOING: c_uchar = 4;
3593pub const PACKET_LOOPBACK: c_uchar = 5;
3594pub const PACKET_USER: c_uchar = 6;
3595pub const PACKET_KERNEL: c_uchar = 7;
3596
3597pub const PACKET_ADD_MEMBERSHIP: c_int = 1;
3598pub const PACKET_DROP_MEMBERSHIP: c_int = 2;
3599pub const PACKET_RX_RING: c_int = 5;
3600pub const PACKET_STATISTICS: c_int = 6;
3601pub const PACKET_AUXDATA: c_int = 8;
3602pub const PACKET_VERSION: c_int = 10;
3603pub const PACKET_RESERVE: c_int = 12;
3604pub const PACKET_TX_RING: c_int = 13;
3605pub const PACKET_LOSS: c_int = 14;
3606pub const PACKET_TIMESTAMP: c_int = 17;
3607pub const PACKET_FANOUT: c_int = 18;
3608pub const PACKET_QDISC_BYPASS: c_int = 20;
3609pub const PACKET_IGNORE_OUTGOING: c_int = 23;
3610
3611pub const PACKET_FANOUT_HASH: c_uint = 0;
3612pub const PACKET_FANOUT_LB: c_uint = 1;
3613pub const PACKET_FANOUT_CPU: c_uint = 2;
3614pub const PACKET_FANOUT_ROLLOVER: c_uint = 3;
3615pub const PACKET_FANOUT_RND: c_uint = 4;
3616pub const PACKET_FANOUT_QM: c_uint = 5;
3617pub const PACKET_FANOUT_CBPF: c_uint = 6;
3618pub const PACKET_FANOUT_EBPF: c_uint = 7;
3619pub const PACKET_FANOUT_FLAG_ROLLOVER: c_uint = 0x1000;
3620pub const PACKET_FANOUT_FLAG_UNIQUEID: c_uint = 0x2000;
3621pub const PACKET_FANOUT_FLAG_DEFRAG: c_uint = 0x8000;
3622
3623pub const PACKET_MR_MULTICAST: c_int = 0;
3624pub const PACKET_MR_PROMISC: c_int = 1;
3625pub const PACKET_MR_ALLMULTI: c_int = 2;
3626
3627pub const TP_STATUS_KERNEL: __u32 = 0;
3628pub const TP_STATUS_USER: __u32 = 1 << 0;
3629pub const TP_STATUS_COPY: __u32 = 1 << 1;
3630pub const TP_STATUS_LOSING: __u32 = 1 << 2;
3631pub const TP_STATUS_CSUMNOTREADY: __u32 = 1 << 3;
3632pub const TP_STATUS_VLAN_VALID: __u32 = 1 << 4;
3633pub const TP_STATUS_BLK_TMO: __u32 = 1 << 5;
3634pub const TP_STATUS_VLAN_TPID_VALID: __u32 = 1 << 6;
3635pub const TP_STATUS_CSUM_VALID: __u32 = 1 << 7;
3636
3637pub const TP_STATUS_AVAILABLE: __u32 = 0;
3638pub const TP_STATUS_SEND_REQUEST: __u32 = 1 << 0;
3639pub const TP_STATUS_SENDING: __u32 = 1 << 1;
3640pub const TP_STATUS_WRONG_FORMAT: __u32 = 1 << 2;
3641
3642pub const TP_STATUS_TS_SOFTWARE: __u32 = 1 << 29;
3643pub const TP_STATUS_TS_SYS_HARDWARE: __u32 = 1 << 30;
3644pub const TP_STATUS_TS_RAW_HARDWARE: __u32 = 1 << 31;
3645
3646pub const TP_FT_REQ_FILL_RXHASH: __u32 = 1;
3647
3648pub const TPACKET_ALIGNMENT: usize = 16;
3649
3650pub const TPACKET_HDRLEN: usize = ((size_of::<crate::tpacket_hdr>() + TPACKET_ALIGNMENT - 1)
3651    & !(TPACKET_ALIGNMENT - 1))
3652    + size_of::<crate::sockaddr_ll>();
3653pub const TPACKET2_HDRLEN: usize = ((size_of::<crate::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1)
3654    & !(TPACKET_ALIGNMENT - 1))
3655    + size_of::<crate::sockaddr_ll>();
3656pub const TPACKET3_HDRLEN: usize = ((size_of::<crate::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1)
3657    & !(TPACKET_ALIGNMENT - 1))
3658    + size_of::<crate::sockaddr_ll>();
3659
3660// linux/netfilter.h
3661pub const NF_DROP: c_int = 0;
3662pub const NF_ACCEPT: c_int = 1;
3663pub const NF_STOLEN: c_int = 2;
3664pub const NF_QUEUE: c_int = 3;
3665pub const NF_REPEAT: c_int = 4;
3666pub const NF_STOP: c_int = 5;
3667pub const NF_MAX_VERDICT: c_int = NF_STOP;
3668
3669pub const NF_VERDICT_MASK: c_int = 0x000000ff;
3670pub const NF_VERDICT_FLAG_QUEUE_BYPASS: c_int = 0x00008000;
3671
3672pub const NF_VERDICT_QMASK: c_int = 0xffff0000;
3673pub const NF_VERDICT_QBITS: c_int = 16;
3674
3675pub const NF_VERDICT_BITS: c_int = 16;
3676
3677pub const NF_INET_PRE_ROUTING: c_int = 0;
3678pub const NF_INET_LOCAL_IN: c_int = 1;
3679pub const NF_INET_FORWARD: c_int = 2;
3680pub const NF_INET_LOCAL_OUT: c_int = 3;
3681pub const NF_INET_POST_ROUTING: c_int = 4;
3682pub const NF_INET_NUMHOOKS: c_int = 5;
3683pub const NF_INET_INGRESS: c_int = NF_INET_NUMHOOKS;
3684
3685pub const NF_NETDEV_INGRESS: c_int = 0;
3686pub const NF_NETDEV_EGRESS: c_int = 1;
3687pub const NF_NETDEV_NUMHOOKS: c_int = 2;
3688
3689// Some NFPROTO are not compatible with musl and are defined in submodules.
3690pub const NFPROTO_UNSPEC: c_int = 0;
3691pub const NFPROTO_INET: c_int = 1;
3692pub const NFPROTO_IPV4: c_int = 2;
3693pub const NFPROTO_ARP: c_int = 3;
3694pub const NFPROTO_NETDEV: c_int = 5;
3695pub const NFPROTO_BRIDGE: c_int = 7;
3696pub const NFPROTO_IPV6: c_int = 10;
3697pub const NFPROTO_DECNET: c_int = 12;
3698pub const NFPROTO_NUMPROTO: c_int = 13;
3699
3700// linux/netfilter_arp.h
3701pub const NF_ARP: c_int = 0;
3702pub const NF_ARP_IN: c_int = 0;
3703pub const NF_ARP_OUT: c_int = 1;
3704pub const NF_ARP_FORWARD: c_int = 2;
3705pub const NF_ARP_NUMHOOKS: c_int = 3;
3706
3707// linux/netfilter_bridge.h
3708pub const NF_BR_PRE_ROUTING: c_int = 0;
3709pub const NF_BR_LOCAL_IN: c_int = 1;
3710pub const NF_BR_FORWARD: c_int = 2;
3711pub const NF_BR_LOCAL_OUT: c_int = 3;
3712pub const NF_BR_POST_ROUTING: c_int = 4;
3713pub const NF_BR_BROUTING: c_int = 5;
3714pub const NF_BR_NUMHOOKS: c_int = 6;
3715
3716pub const NF_BR_PRI_FIRST: c_int = crate::INT_MIN;
3717pub const NF_BR_PRI_NAT_DST_BRIDGED: c_int = -300;
3718pub const NF_BR_PRI_FILTER_BRIDGED: c_int = -200;
3719pub const NF_BR_PRI_BRNF: c_int = 0;
3720pub const NF_BR_PRI_NAT_DST_OTHER: c_int = 100;
3721pub const NF_BR_PRI_FILTER_OTHER: c_int = 200;
3722pub const NF_BR_PRI_NAT_SRC: c_int = 300;
3723pub const NF_BR_PRI_LAST: c_int = crate::INT_MAX;
3724
3725// linux/netfilter_ipv4.h
3726pub const NF_IP_PRE_ROUTING: c_int = 0;
3727pub const NF_IP_LOCAL_IN: c_int = 1;
3728pub const NF_IP_FORWARD: c_int = 2;
3729pub const NF_IP_LOCAL_OUT: c_int = 3;
3730pub const NF_IP_POST_ROUTING: c_int = 4;
3731pub const NF_IP_NUMHOOKS: c_int = 5;
3732
3733pub const NF_IP_PRI_FIRST: c_int = crate::INT_MIN;
3734pub const NF_IP_PRI_RAW_BEFORE_DEFRAG: c_int = -450;
3735pub const NF_IP_PRI_CONNTRACK_DEFRAG: c_int = -400;
3736pub const NF_IP_PRI_RAW: c_int = -300;
3737pub const NF_IP_PRI_SELINUX_FIRST: c_int = -225;
3738pub const NF_IP_PRI_CONNTRACK: c_int = -200;
3739pub const NF_IP_PRI_MANGLE: c_int = -150;
3740pub const NF_IP_PRI_NAT_DST: c_int = -100;
3741pub const NF_IP_PRI_FILTER: c_int = 0;
3742pub const NF_IP_PRI_SECURITY: c_int = 50;
3743pub const NF_IP_PRI_NAT_SRC: c_int = 100;
3744pub const NF_IP_PRI_SELINUX_LAST: c_int = 225;
3745pub const NF_IP_PRI_CONNTRACK_HELPER: c_int = 300;
3746pub const NF_IP_PRI_CONNTRACK_CONFIRM: c_int = crate::INT_MAX;
3747pub const NF_IP_PRI_LAST: c_int = crate::INT_MAX;
3748
3749// linux/netfilter_ipv6.h
3750pub const NF_IP6_PRE_ROUTING: c_int = 0;
3751pub const NF_IP6_LOCAL_IN: c_int = 1;
3752pub const NF_IP6_FORWARD: c_int = 2;
3753pub const NF_IP6_LOCAL_OUT: c_int = 3;
3754pub const NF_IP6_POST_ROUTING: c_int = 4;
3755pub const NF_IP6_NUMHOOKS: c_int = 5;
3756
3757pub const NF_IP6_PRI_FIRST: c_int = crate::INT_MIN;
3758pub const NF_IP6_PRI_RAW_BEFORE_DEFRAG: c_int = -450;
3759pub const NF_IP6_PRI_CONNTRACK_DEFRAG: c_int = -400;
3760pub const NF_IP6_PRI_RAW: c_int = -300;
3761pub const NF_IP6_PRI_SELINUX_FIRST: c_int = -225;
3762pub const NF_IP6_PRI_CONNTRACK: c_int = -200;
3763pub const NF_IP6_PRI_MANGLE: c_int = -150;
3764pub const NF_IP6_PRI_NAT_DST: c_int = -100;
3765pub const NF_IP6_PRI_FILTER: c_int = 0;
3766pub const NF_IP6_PRI_SECURITY: c_int = 50;
3767pub const NF_IP6_PRI_NAT_SRC: c_int = 100;
3768pub const NF_IP6_PRI_SELINUX_LAST: c_int = 225;
3769pub const NF_IP6_PRI_CONNTRACK_HELPER: c_int = 300;
3770pub const NF_IP6_PRI_LAST: c_int = crate::INT_MAX;
3771
3772// linux/netfilter_ipv6/ip6_tables.h
3773pub const IP6T_SO_ORIGINAL_DST: c_int = 80;
3774
3775pub const SIOCADDRT: c_ulong = 0x0000890B;
3776pub const SIOCDELRT: c_ulong = 0x0000890C;
3777pub const SIOCGIFNAME: c_ulong = 0x00008910;
3778pub const SIOCSIFLINK: c_ulong = 0x00008911;
3779pub const SIOCGIFCONF: c_ulong = 0x00008912;
3780pub const SIOCGIFFLAGS: c_ulong = 0x00008913;
3781pub const SIOCSIFFLAGS: c_ulong = 0x00008914;
3782pub const SIOCGIFADDR: c_ulong = 0x00008915;
3783pub const SIOCSIFADDR: c_ulong = 0x00008916;
3784pub const SIOCGIFDSTADDR: c_ulong = 0x00008917;
3785pub const SIOCSIFDSTADDR: c_ulong = 0x00008918;
3786pub const SIOCGIFBRDADDR: c_ulong = 0x00008919;
3787pub const SIOCSIFBRDADDR: c_ulong = 0x0000891A;
3788pub const SIOCGIFNETMASK: c_ulong = 0x0000891B;
3789pub const SIOCSIFNETMASK: c_ulong = 0x0000891C;
3790pub const SIOCGIFMETRIC: c_ulong = 0x0000891D;
3791pub const SIOCSIFMETRIC: c_ulong = 0x0000891E;
3792pub const SIOCGIFMEM: c_ulong = 0x0000891F;
3793pub const SIOCSIFMEM: c_ulong = 0x00008920;
3794pub const SIOCGIFMTU: c_ulong = 0x00008921;
3795pub const SIOCSIFMTU: c_ulong = 0x00008922;
3796pub const SIOCSIFNAME: c_ulong = 0x00008923;
3797pub const SIOCSIFHWADDR: c_ulong = 0x00008924;
3798pub const SIOCGIFENCAP: c_ulong = 0x00008925;
3799pub const SIOCSIFENCAP: c_ulong = 0x00008926;
3800pub const SIOCGIFHWADDR: c_ulong = 0x00008927;
3801pub const SIOCGIFSLAVE: c_ulong = 0x00008929;
3802pub const SIOCSIFSLAVE: c_ulong = 0x00008930;
3803pub const SIOCADDMULTI: c_ulong = 0x00008931;
3804pub const SIOCDELMULTI: c_ulong = 0x00008932;
3805pub const SIOCGIFINDEX: c_ulong = 0x00008933;
3806pub const SIOGIFINDEX: c_ulong = SIOCGIFINDEX;
3807pub const SIOCSIFPFLAGS: c_ulong = 0x00008934;
3808pub const SIOCGIFPFLAGS: c_ulong = 0x00008935;
3809pub const SIOCDIFADDR: c_ulong = 0x00008936;
3810pub const SIOCSIFHWBROADCAST: c_ulong = 0x00008937;
3811pub const SIOCGIFCOUNT: c_ulong = 0x00008938;
3812pub const SIOCGIFBR: c_ulong = 0x00008940;
3813pub const SIOCSIFBR: c_ulong = 0x00008941;
3814pub const SIOCGIFTXQLEN: c_ulong = 0x00008942;
3815pub const SIOCSIFTXQLEN: c_ulong = 0x00008943;
3816pub const SIOCETHTOOL: c_ulong = 0x00008946;
3817pub const SIOCGMIIPHY: c_ulong = 0x00008947;
3818pub const SIOCGMIIREG: c_ulong = 0x00008948;
3819pub const SIOCSMIIREG: c_ulong = 0x00008949;
3820pub const SIOCWANDEV: c_ulong = 0x0000894A;
3821pub const SIOCOUTQNSD: c_ulong = 0x0000894B;
3822pub const SIOCGSKNS: c_ulong = 0x0000894C;
3823pub const SIOCDARP: c_ulong = 0x00008953;
3824pub const SIOCGARP: c_ulong = 0x00008954;
3825pub const SIOCSARP: c_ulong = 0x00008955;
3826pub const SIOCDRARP: c_ulong = 0x00008960;
3827pub const SIOCGRARP: c_ulong = 0x00008961;
3828pub const SIOCSRARP: c_ulong = 0x00008962;
3829pub const SIOCGIFMAP: c_ulong = 0x00008970;
3830pub const SIOCSIFMAP: c_ulong = 0x00008971;
3831pub const SIOCSHWTSTAMP: c_ulong = 0x000089b0;
3832pub const SIOCGHWTSTAMP: c_ulong = 0x000089b1;
3833
3834// wireless.h
3835pub const WIRELESS_EXT: c_ulong = 0x16;
3836
3837pub const SIOCSIWCOMMIT: c_ulong = 0x8B00;
3838pub const SIOCGIWNAME: c_ulong = 0x8B01;
3839
3840pub const SIOCSIWNWID: c_ulong = 0x8B02;
3841pub const SIOCGIWNWID: c_ulong = 0x8B03;
3842pub const SIOCSIWFREQ: c_ulong = 0x8B04;
3843pub const SIOCGIWFREQ: c_ulong = 0x8B05;
3844pub const SIOCSIWMODE: c_ulong = 0x8B06;
3845pub const SIOCGIWMODE: c_ulong = 0x8B07;
3846pub const SIOCSIWSENS: c_ulong = 0x8B08;
3847pub const SIOCGIWSENS: c_ulong = 0x8B09;
3848
3849pub const SIOCSIWRANGE: c_ulong = 0x8B0A;
3850pub const SIOCGIWRANGE: c_ulong = 0x8B0B;
3851pub const SIOCSIWPRIV: c_ulong = 0x8B0C;
3852pub const SIOCGIWPRIV: c_ulong = 0x8B0D;
3853pub const SIOCSIWSTATS: c_ulong = 0x8B0E;
3854pub const SIOCGIWSTATS: c_ulong = 0x8B0F;
3855
3856pub const SIOCSIWSPY: c_ulong = 0x8B10;
3857pub const SIOCGIWSPY: c_ulong = 0x8B11;
3858pub const SIOCSIWTHRSPY: c_ulong = 0x8B12;
3859pub const SIOCGIWTHRSPY: c_ulong = 0x8B13;
3860
3861pub const SIOCSIWAP: c_ulong = 0x8B14;
3862pub const SIOCGIWAP: c_ulong = 0x8B15;
3863pub const SIOCGIWAPLIST: c_ulong = 0x8B17;
3864pub const SIOCSIWSCAN: c_ulong = 0x8B18;
3865pub const SIOCGIWSCAN: c_ulong = 0x8B19;
3866
3867pub const SIOCSIWESSID: c_ulong = 0x8B1A;
3868pub const SIOCGIWESSID: c_ulong = 0x8B1B;
3869pub const SIOCSIWNICKN: c_ulong = 0x8B1C;
3870pub const SIOCGIWNICKN: c_ulong = 0x8B1D;
3871
3872pub const SIOCSIWRATE: c_ulong = 0x8B20;
3873pub const SIOCGIWRATE: c_ulong = 0x8B21;
3874pub const SIOCSIWRTS: c_ulong = 0x8B22;
3875pub const SIOCGIWRTS: c_ulong = 0x8B23;
3876pub const SIOCSIWFRAG: c_ulong = 0x8B24;
3877pub const SIOCGIWFRAG: c_ulong = 0x8B25;
3878pub const SIOCSIWTXPOW: c_ulong = 0x8B26;
3879pub const SIOCGIWTXPOW: c_ulong = 0x8B27;
3880pub const SIOCSIWRETRY: c_ulong = 0x8B28;
3881pub const SIOCGIWRETRY: c_ulong = 0x8B29;
3882
3883pub const SIOCSIWENCODE: c_ulong = 0x8B2A;
3884pub const SIOCGIWENCODE: c_ulong = 0x8B2B;
3885
3886pub const SIOCSIWPOWER: c_ulong = 0x8B2C;
3887pub const SIOCGIWPOWER: c_ulong = 0x8B2D;
3888
3889pub const SIOCSIWGENIE: c_ulong = 0x8B30;
3890pub const SIOCGIWGENIE: c_ulong = 0x8B31;
3891
3892pub const SIOCSIWMLME: c_ulong = 0x8B16;
3893
3894pub const SIOCSIWAUTH: c_ulong = 0x8B32;
3895pub const SIOCGIWAUTH: c_ulong = 0x8B33;
3896
3897pub const SIOCSIWENCODEEXT: c_ulong = 0x8B34;
3898pub const SIOCGIWENCODEEXT: c_ulong = 0x8B35;
3899
3900pub const SIOCSIWPMKSA: c_ulong = 0x8B36;
3901
3902pub const SIOCIWFIRSTPRIV: c_ulong = 0x8BE0;
3903pub const SIOCIWLASTPRIV: c_ulong = 0x8BFF;
3904
3905pub const SIOCIWFIRST: c_ulong = 0x8B00;
3906pub const SIOCIWLAST: c_ulong = SIOCIWLASTPRIV;
3907
3908pub const IWEVTXDROP: c_ulong = 0x8C00;
3909pub const IWEVQUAL: c_ulong = 0x8C01;
3910pub const IWEVCUSTOM: c_ulong = 0x8C02;
3911pub const IWEVREGISTERED: c_ulong = 0x8C03;
3912pub const IWEVEXPIRED: c_ulong = 0x8C04;
3913pub const IWEVGENIE: c_ulong = 0x8C05;
3914pub const IWEVMICHAELMICFAILURE: c_ulong = 0x8C06;
3915pub const IWEVASSOCREQIE: c_ulong = 0x8C07;
3916pub const IWEVASSOCRESPIE: c_ulong = 0x8C08;
3917pub const IWEVPMKIDCAND: c_ulong = 0x8C09;
3918pub const IWEVFIRST: c_ulong = 0x8C00;
3919
3920pub const IW_PRIV_TYPE_MASK: c_ulong = 0x7000;
3921pub const IW_PRIV_TYPE_NONE: c_ulong = 0x0000;
3922pub const IW_PRIV_TYPE_BYTE: c_ulong = 0x1000;
3923pub const IW_PRIV_TYPE_CHAR: c_ulong = 0x2000;
3924pub const IW_PRIV_TYPE_INT: c_ulong = 0x4000;
3925pub const IW_PRIV_TYPE_FLOAT: c_ulong = 0x5000;
3926pub const IW_PRIV_TYPE_ADDR: c_ulong = 0x6000;
3927
3928pub const IW_PRIV_SIZE_FIXED: c_ulong = 0x0800;
3929
3930pub const IW_PRIV_SIZE_MASK: c_ulong = 0x07FF;
3931
3932pub const IW_MAX_FREQUENCIES: usize = 32;
3933pub const IW_MAX_BITRATES: usize = 32;
3934pub const IW_MAX_TXPOWER: usize = 8;
3935pub const IW_MAX_SPY: usize = 8;
3936pub const IW_MAX_AP: usize = 64;
3937pub const IW_ESSID_MAX_SIZE: usize = 32;
3938
3939pub const IW_MODE_AUTO: usize = 0;
3940pub const IW_MODE_ADHOC: usize = 1;
3941pub const IW_MODE_INFRA: usize = 2;
3942pub const IW_MODE_MASTER: usize = 3;
3943pub const IW_MODE_REPEAT: usize = 4;
3944pub const IW_MODE_SECOND: usize = 5;
3945pub const IW_MODE_MONITOR: usize = 6;
3946pub const IW_MODE_MESH: usize = 7;
3947
3948pub const IW_QUAL_QUAL_UPDATED: c_ulong = 0x01;
3949pub const IW_QUAL_LEVEL_UPDATED: c_ulong = 0x02;
3950pub const IW_QUAL_NOISE_UPDATED: c_ulong = 0x04;
3951pub const IW_QUAL_ALL_UPDATED: c_ulong = 0x07;
3952pub const IW_QUAL_DBM: c_ulong = 0x08;
3953pub const IW_QUAL_QUAL_INVALID: c_ulong = 0x10;
3954pub const IW_QUAL_LEVEL_INVALID: c_ulong = 0x20;
3955pub const IW_QUAL_NOISE_INVALID: c_ulong = 0x40;
3956pub const IW_QUAL_RCPI: c_ulong = 0x80;
3957pub const IW_QUAL_ALL_INVALID: c_ulong = 0x70;
3958
3959pub const IW_FREQ_AUTO: c_ulong = 0x00;
3960pub const IW_FREQ_FIXED: c_ulong = 0x01;
3961
3962pub const IW_MAX_ENCODING_SIZES: usize = 8;
3963pub const IW_ENCODING_TOKEN_MAX: usize = 64;
3964
3965pub const IW_ENCODE_INDEX: c_ulong = 0x00FF;
3966pub const IW_ENCODE_FLAGS: c_ulong = 0xFF00;
3967pub const IW_ENCODE_MODE: c_ulong = 0xF000;
3968pub const IW_ENCODE_DISABLED: c_ulong = 0x8000;
3969pub const IW_ENCODE_ENABLED: c_ulong = 0x0000;
3970pub const IW_ENCODE_RESTRICTED: c_ulong = 0x4000;
3971pub const IW_ENCODE_OPEN: c_ulong = 0x2000;
3972pub const IW_ENCODE_NOKEY: c_ulong = 0x0800;
3973pub const IW_ENCODE_TEMP: c_ulong = 0x0400;
3974
3975pub const IW_POWER_ON: c_ulong = 0x0000;
3976pub const IW_POWER_TYPE: c_ulong = 0xF000;
3977pub const IW_POWER_PERIOD: c_ulong = 0x1000;
3978pub const IW_POWER_TIMEOUT: c_ulong = 0x2000;
3979pub const IW_POWER_MODE: c_ulong = 0x0F00;
3980pub const IW_POWER_UNICAST_R: c_ulong = 0x0100;
3981pub const IW_POWER_MULTICAST_R: c_ulong = 0x0200;
3982pub const IW_POWER_ALL_R: c_ulong = 0x0300;
3983pub const IW_POWER_FORCE_S: c_ulong = 0x0400;
3984pub const IW_POWER_REPEATER: c_ulong = 0x0800;
3985pub const IW_POWER_MODIFIER: c_ulong = 0x000F;
3986pub const IW_POWER_MIN: c_ulong = 0x0001;
3987pub const IW_POWER_MAX: c_ulong = 0x0002;
3988pub const IW_POWER_RELATIVE: c_ulong = 0x0004;
3989
3990pub const IW_TXPOW_TYPE: c_ulong = 0x00FF;
3991pub const IW_TXPOW_DBM: c_ulong = 0x0000;
3992pub const IW_TXPOW_MWATT: c_ulong = 0x0001;
3993pub const IW_TXPOW_RELATIVE: c_ulong = 0x0002;
3994pub const IW_TXPOW_RANGE: c_ulong = 0x1000;
3995
3996pub const IW_RETRY_ON: c_ulong = 0x0000;
3997pub const IW_RETRY_TYPE: c_ulong = 0xF000;
3998pub const IW_RETRY_LIMIT: c_ulong = 0x1000;
3999pub const IW_RETRY_LIFETIME: c_ulong = 0x2000;
4000pub const IW_RETRY_MODIFIER: c_ulong = 0x00FF;
4001pub const IW_RETRY_MIN: c_ulong = 0x0001;
4002pub const IW_RETRY_MAX: c_ulong = 0x0002;
4003pub const IW_RETRY_RELATIVE: c_ulong = 0x0004;
4004pub const IW_RETRY_SHORT: c_ulong = 0x0010;
4005pub const IW_RETRY_LONG: c_ulong = 0x0020;
4006
4007pub const IW_SCAN_DEFAULT: c_ulong = 0x0000;
4008pub const IW_SCAN_ALL_ESSID: c_ulong = 0x0001;
4009pub const IW_SCAN_THIS_ESSID: c_ulong = 0x0002;
4010pub const IW_SCAN_ALL_FREQ: c_ulong = 0x0004;
4011pub const IW_SCAN_THIS_FREQ: c_ulong = 0x0008;
4012pub const IW_SCAN_ALL_MODE: c_ulong = 0x0010;
4013pub const IW_SCAN_THIS_MODE: c_ulong = 0x0020;
4014pub const IW_SCAN_ALL_RATE: c_ulong = 0x0040;
4015pub const IW_SCAN_THIS_RATE: c_ulong = 0x0080;
4016
4017pub const IW_SCAN_TYPE_ACTIVE: usize = 0;
4018pub const IW_SCAN_TYPE_PASSIVE: usize = 1;
4019
4020pub const IW_SCAN_MAX_DATA: usize = 4096;
4021
4022pub const IW_SCAN_CAPA_NONE: c_ulong = 0x00;
4023pub const IW_SCAN_CAPA_ESSID: c_ulong = 0x01;
4024pub const IW_SCAN_CAPA_BSSID: c_ulong = 0x02;
4025pub const IW_SCAN_CAPA_CHANNEL: c_ulong = 0x04;
4026pub const IW_SCAN_CAPA_MODE: c_ulong = 0x08;
4027pub const IW_SCAN_CAPA_RATE: c_ulong = 0x10;
4028pub const IW_SCAN_CAPA_TYPE: c_ulong = 0x20;
4029pub const IW_SCAN_CAPA_TIME: c_ulong = 0x40;
4030
4031pub const IW_CUSTOM_MAX: c_ulong = 256;
4032
4033pub const IW_GENERIC_IE_MAX: c_ulong = 1024;
4034
4035pub const IW_MLME_DEAUTH: c_ulong = 0;
4036pub const IW_MLME_DISASSOC: c_ulong = 1;
4037pub const IW_MLME_AUTH: c_ulong = 2;
4038pub const IW_MLME_ASSOC: c_ulong = 3;
4039
4040pub const IW_AUTH_INDEX: c_ulong = 0x0FFF;
4041pub const IW_AUTH_FLAGS: c_ulong = 0xF000;
4042
4043pub const IW_AUTH_WPA_VERSION: usize = 0;
4044pub const IW_AUTH_CIPHER_PAIRWISE: usize = 1;
4045pub const IW_AUTH_CIPHER_GROUP: usize = 2;
4046pub const IW_AUTH_KEY_MGMT: usize = 3;
4047pub const IW_AUTH_TKIP_COUNTERMEASURES: usize = 4;
4048pub const IW_AUTH_DROP_UNENCRYPTED: usize = 5;
4049pub const IW_AUTH_80211_AUTH_ALG: usize = 6;
4050pub const IW_AUTH_WPA_ENABLED: usize = 7;
4051pub const IW_AUTH_RX_UNENCRYPTED_EAPOL: usize = 8;
4052pub const IW_AUTH_ROAMING_CONTROL: usize = 9;
4053pub const IW_AUTH_PRIVACY_INVOKED: usize = 10;
4054pub const IW_AUTH_CIPHER_GROUP_MGMT: usize = 11;
4055pub const IW_AUTH_MFP: usize = 12;
4056
4057pub const IW_AUTH_WPA_VERSION_DISABLED: c_ulong = 0x00000001;
4058pub const IW_AUTH_WPA_VERSION_WPA: c_ulong = 0x00000002;
4059pub const IW_AUTH_WPA_VERSION_WPA2: c_ulong = 0x00000004;
4060
4061pub const IW_AUTH_CIPHER_NONE: c_ulong = 0x00000001;
4062pub const IW_AUTH_CIPHER_WEP40: c_ulong = 0x00000002;
4063pub const IW_AUTH_CIPHER_TKIP: c_ulong = 0x00000004;
4064pub const IW_AUTH_CIPHER_CCMP: c_ulong = 0x00000008;
4065pub const IW_AUTH_CIPHER_WEP104: c_ulong = 0x00000010;
4066pub const IW_AUTH_CIPHER_AES_CMAC: c_ulong = 0x00000020;
4067
4068pub const IW_AUTH_KEY_MGMT_802_1X: usize = 1;
4069pub const IW_AUTH_KEY_MGMT_PSK: usize = 2;
4070
4071pub const IW_AUTH_ALG_OPEN_SYSTEM: c_ulong = 0x00000001;
4072pub const IW_AUTH_ALG_SHARED_KEY: c_ulong = 0x00000002;
4073pub const IW_AUTH_ALG_LEAP: c_ulong = 0x00000004;
4074
4075pub const IW_AUTH_ROAMING_ENABLE: usize = 0;
4076pub const IW_AUTH_ROAMING_DISABLE: usize = 1;
4077
4078pub const IW_AUTH_MFP_DISABLED: usize = 0;
4079pub const IW_AUTH_MFP_OPTIONAL: usize = 1;
4080pub const IW_AUTH_MFP_REQUIRED: usize = 2;
4081
4082pub const IW_ENCODE_SEQ_MAX_SIZE: usize = 8;
4083
4084pub const IW_ENCODE_ALG_NONE: usize = 0;
4085pub const IW_ENCODE_ALG_WEP: usize = 1;
4086pub const IW_ENCODE_ALG_TKIP: usize = 2;
4087pub const IW_ENCODE_ALG_CCMP: usize = 3;
4088pub const IW_ENCODE_ALG_PMK: usize = 4;
4089pub const IW_ENCODE_ALG_AES_CMAC: usize = 5;
4090
4091pub const IW_ENCODE_EXT_TX_SEQ_VALID: c_ulong = 0x00000001;
4092pub const IW_ENCODE_EXT_RX_SEQ_VALID: c_ulong = 0x00000002;
4093pub const IW_ENCODE_EXT_GROUP_KEY: c_ulong = 0x00000004;
4094pub const IW_ENCODE_EXT_SET_TX_KEY: c_ulong = 0x00000008;
4095
4096pub const IW_MICFAILURE_KEY_ID: c_ulong = 0x00000003;
4097pub const IW_MICFAILURE_GROUP: c_ulong = 0x00000004;
4098pub const IW_MICFAILURE_PAIRWISE: c_ulong = 0x00000008;
4099pub const IW_MICFAILURE_STAKEY: c_ulong = 0x00000010;
4100pub const IW_MICFAILURE_COUNT: c_ulong = 0x00000060;
4101
4102pub const IW_ENC_CAPA_WPA: c_ulong = 0x00000001;
4103pub const IW_ENC_CAPA_WPA2: c_ulong = 0x00000002;
4104pub const IW_ENC_CAPA_CIPHER_TKIP: c_ulong = 0x00000004;
4105pub const IW_ENC_CAPA_CIPHER_CCMP: c_ulong = 0x00000008;
4106pub const IW_ENC_CAPA_4WAY_HANDSHAKE: c_ulong = 0x00000010;
4107
4108pub const IW_EVENT_CAPA_K_0: c_ulong = 0x4000050; //   IW_EVENT_CAPA_MASK(0x8B04) | IW_EVENT_CAPA_MASK(0x8B06) | IW_EVENT_CAPA_MASK(0x8B1A);
4109pub const IW_EVENT_CAPA_K_1: c_ulong = 0x400; //   W_EVENT_CAPA_MASK(0x8B2A);
4110
4111pub const IW_PMKSA_ADD: usize = 1;
4112pub const IW_PMKSA_REMOVE: usize = 2;
4113pub const IW_PMKSA_FLUSH: usize = 3;
4114
4115pub const IW_PMKID_LEN: usize = 16;
4116
4117pub const IW_PMKID_CAND_PREAUTH: c_ulong = 0x00000001;
4118
4119pub const IW_EV_LCP_PK_LEN: usize = 4;
4120
4121pub const IW_EV_CHAR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + crate::IFNAMSIZ;
4122pub const IW_EV_UINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::<u32>();
4123pub const IW_EV_FREQ_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::<iw_freq>();
4124pub const IW_EV_PARAM_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::<iw_param>();
4125pub const IW_EV_ADDR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + size_of::<crate::sockaddr>();
4126pub const IW_EV_QUAL_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::<iw_quality>();
4127pub const IW_EV_POINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + 4;
4128
4129pub const IPTOS_TOS_MASK: u8 = 0x1E;
4130pub const IPTOS_PREC_MASK: u8 = 0xE0;
4131
4132pub const IPTOS_ECN_NOT_ECT: u8 = 0x00;
4133
4134pub const RTF_UP: c_ushort = 0x0001;
4135pub const RTF_GATEWAY: c_ushort = 0x0002;
4136
4137pub const RTF_HOST: c_ushort = 0x0004;
4138pub const RTF_REINSTATE: c_ushort = 0x0008;
4139pub const RTF_DYNAMIC: c_ushort = 0x0010;
4140pub const RTF_MODIFIED: c_ushort = 0x0020;
4141pub const RTF_MTU: c_ushort = 0x0040;
4142pub const RTF_MSS: c_ushort = RTF_MTU;
4143pub const RTF_WINDOW: c_ushort = 0x0080;
4144pub const RTF_IRTT: c_ushort = 0x0100;
4145pub const RTF_REJECT: c_ushort = 0x0200;
4146pub const RTF_STATIC: c_ushort = 0x0400;
4147pub const RTF_XRESOLVE: c_ushort = 0x0800;
4148pub const RTF_NOFORWARD: c_ushort = 0x1000;
4149pub const RTF_THROW: c_ushort = 0x2000;
4150pub const RTF_NOPMTUDISC: c_ushort = 0x4000;
4151
4152pub const RTF_DEFAULT: u32 = 0x00010000;
4153pub const RTF_ALLONLINK: u32 = 0x00020000;
4154pub const RTF_ADDRCONF: u32 = 0x00040000;
4155pub const RTF_LINKRT: u32 = 0x00100000;
4156pub const RTF_NONEXTHOP: u32 = 0x00200000;
4157pub const RTF_CACHE: u32 = 0x01000000;
4158pub const RTF_FLOW: u32 = 0x02000000;
4159pub const RTF_POLICY: u32 = 0x04000000;
4160
4161pub const RTCF_VALVE: u32 = 0x00200000;
4162pub const RTCF_MASQ: u32 = 0x00400000;
4163pub const RTCF_NAT: u32 = 0x00800000;
4164pub const RTCF_DOREDIRECT: u32 = 0x01000000;
4165pub const RTCF_LOG: u32 = 0x02000000;
4166pub const RTCF_DIRECTSRC: u32 = 0x04000000;
4167
4168pub const RTF_LOCAL: u32 = 0x80000000;
4169pub const RTF_INTERFACE: u32 = 0x40000000;
4170pub const RTF_MULTICAST: u32 = 0x20000000;
4171pub const RTF_BROADCAST: u32 = 0x10000000;
4172pub const RTF_NAT: u32 = 0x08000000;
4173pub const RTF_ADDRCLASSMASK: u32 = 0xF8000000;
4174
4175pub const RT_CLASS_UNSPEC: u8 = 0;
4176pub const RT_CLASS_DEFAULT: u8 = 253;
4177pub const RT_CLASS_MAIN: u8 = 254;
4178pub const RT_CLASS_LOCAL: u8 = 255;
4179pub const RT_CLASS_MAX: u8 = 255;
4180
4181// linux/neighbor.h
4182pub const NUD_NONE: u16 = 0x00;
4183pub const NUD_INCOMPLETE: u16 = 0x01;
4184pub const NUD_REACHABLE: u16 = 0x02;
4185pub const NUD_STALE: u16 = 0x04;
4186pub const NUD_DELAY: u16 = 0x08;
4187pub const NUD_PROBE: u16 = 0x10;
4188pub const NUD_FAILED: u16 = 0x20;
4189pub const NUD_NOARP: u16 = 0x40;
4190pub const NUD_PERMANENT: u16 = 0x80;
4191
4192pub const NTF_USE: u8 = 0x01;
4193pub const NTF_SELF: u8 = 0x02;
4194pub const NTF_MASTER: u8 = 0x04;
4195pub const NTF_PROXY: u8 = 0x08;
4196pub const NTF_ROUTER: u8 = 0x80;
4197
4198pub const NDA_UNSPEC: c_ushort = 0;
4199pub const NDA_DST: c_ushort = 1;
4200pub const NDA_LLADDR: c_ushort = 2;
4201pub const NDA_CACHEINFO: c_ushort = 3;
4202pub const NDA_PROBES: c_ushort = 4;
4203pub const NDA_VLAN: c_ushort = 5;
4204pub const NDA_PORT: c_ushort = 6;
4205pub const NDA_VNI: c_ushort = 7;
4206pub const NDA_IFINDEX: c_ushort = 8;
4207
4208// linux/netlink.h
4209pub const NLA_ALIGNTO: c_int = 4;
4210
4211pub const NETLINK_ROUTE: c_int = 0;
4212pub const NETLINK_UNUSED: c_int = 1;
4213pub const NETLINK_USERSOCK: c_int = 2;
4214pub const NETLINK_FIREWALL: c_int = 3;
4215pub const NETLINK_SOCK_DIAG: c_int = 4;
4216pub const NETLINK_NFLOG: c_int = 5;
4217pub const NETLINK_XFRM: c_int = 6;
4218pub const NETLINK_SELINUX: c_int = 7;
4219pub const NETLINK_ISCSI: c_int = 8;
4220pub const NETLINK_AUDIT: c_int = 9;
4221pub const NETLINK_FIB_LOOKUP: c_int = 10;
4222pub const NETLINK_CONNECTOR: c_int = 11;
4223pub const NETLINK_NETFILTER: c_int = 12;
4224pub const NETLINK_IP6_FW: c_int = 13;
4225pub const NETLINK_DNRTMSG: c_int = 14;
4226pub const NETLINK_KOBJECT_UEVENT: c_int = 15;
4227pub const NETLINK_GENERIC: c_int = 16;
4228pub const NETLINK_SCSITRANSPORT: c_int = 18;
4229pub const NETLINK_ECRYPTFS: c_int = 19;
4230pub const NETLINK_RDMA: c_int = 20;
4231pub const NETLINK_CRYPTO: c_int = 21;
4232pub const NETLINK_INET_DIAG: c_int = NETLINK_SOCK_DIAG;
4233
4234pub const NLM_F_REQUEST: c_int = 1;
4235pub const NLM_F_MULTI: c_int = 2;
4236pub const NLM_F_ACK: c_int = 4;
4237pub const NLM_F_ECHO: c_int = 8;
4238pub const NLM_F_DUMP_INTR: c_int = 16;
4239pub const NLM_F_DUMP_FILTERED: c_int = 32;
4240
4241pub const NLM_F_ROOT: c_int = 0x100;
4242pub const NLM_F_MATCH: c_int = 0x200;
4243pub const NLM_F_ATOMIC: c_int = 0x400;
4244pub const NLM_F_DUMP: c_int = NLM_F_ROOT | NLM_F_MATCH;
4245
4246pub const NLM_F_REPLACE: c_int = 0x100;
4247pub const NLM_F_EXCL: c_int = 0x200;
4248pub const NLM_F_CREATE: c_int = 0x400;
4249pub const NLM_F_APPEND: c_int = 0x800;
4250
4251pub const NLM_F_NONREC: c_int = 0x100;
4252pub const NLM_F_BULK: c_int = 0x200;
4253
4254pub const NLM_F_CAPPED: c_int = 0x100;
4255pub const NLM_F_ACK_TLVS: c_int = 0x200;
4256
4257pub const NETLINK_ADD_MEMBERSHIP: c_int = 1;
4258pub const NETLINK_DROP_MEMBERSHIP: c_int = 2;
4259pub const NETLINK_PKTINFO: c_int = 3;
4260pub const NETLINK_BROADCAST_ERROR: c_int = 4;
4261pub const NETLINK_NO_ENOBUFS: c_int = 5;
4262pub const NETLINK_RX_RING: c_int = 6;
4263pub const NETLINK_TX_RING: c_int = 7;
4264pub const NETLINK_LISTEN_ALL_NSID: c_int = 8;
4265pub const NETLINK_LIST_MEMBERSHIPS: c_int = 9;
4266pub const NETLINK_CAP_ACK: c_int = 10;
4267pub const NETLINK_EXT_ACK: c_int = 11;
4268pub const NETLINK_GET_STRICT_CHK: c_int = 12;
4269
4270pub const NLA_F_NESTED: c_int = 1 << 15;
4271pub const NLA_F_NET_BYTEORDER: c_int = 1 << 14;
4272pub const NLA_TYPE_MASK: c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
4273
4274// linux/rtnetlink.h
4275pub const TCA_UNSPEC: c_ushort = 0;
4276pub const TCA_KIND: c_ushort = 1;
4277pub const TCA_OPTIONS: c_ushort = 2;
4278pub const TCA_STATS: c_ushort = 3;
4279pub const TCA_XSTATS: c_ushort = 4;
4280pub const TCA_RATE: c_ushort = 5;
4281pub const TCA_FCNT: c_ushort = 6;
4282pub const TCA_STATS2: c_ushort = 7;
4283pub const TCA_STAB: c_ushort = 8;
4284
4285pub const RTM_NEWLINK: u16 = 16;
4286pub const RTM_DELLINK: u16 = 17;
4287pub const RTM_GETLINK: u16 = 18;
4288pub const RTM_SETLINK: u16 = 19;
4289pub const RTM_NEWADDR: u16 = 20;
4290pub const RTM_DELADDR: u16 = 21;
4291pub const RTM_GETADDR: u16 = 22;
4292pub const RTM_NEWROUTE: u16 = 24;
4293pub const RTM_DELROUTE: u16 = 25;
4294pub const RTM_GETROUTE: u16 = 26;
4295pub const RTM_NEWNEIGH: u16 = 28;
4296pub const RTM_DELNEIGH: u16 = 29;
4297pub const RTM_GETNEIGH: u16 = 30;
4298pub const RTM_NEWRULE: u16 = 32;
4299pub const RTM_DELRULE: u16 = 33;
4300pub const RTM_GETRULE: u16 = 34;
4301pub const RTM_NEWQDISC: u16 = 36;
4302pub const RTM_DELQDISC: u16 = 37;
4303pub const RTM_GETQDISC: u16 = 38;
4304pub const RTM_NEWTCLASS: u16 = 40;
4305pub const RTM_DELTCLASS: u16 = 41;
4306pub const RTM_GETTCLASS: u16 = 42;
4307pub const RTM_NEWTFILTER: u16 = 44;
4308pub const RTM_DELTFILTER: u16 = 45;
4309pub const RTM_GETTFILTER: u16 = 46;
4310pub const RTM_NEWACTION: u16 = 48;
4311pub const RTM_DELACTION: u16 = 49;
4312pub const RTM_GETACTION: u16 = 50;
4313pub const RTM_NEWPREFIX: u16 = 52;
4314pub const RTM_GETMULTICAST: u16 = 58;
4315pub const RTM_GETANYCAST: u16 = 62;
4316pub const RTM_NEWNEIGHTBL: u16 = 64;
4317pub const RTM_GETNEIGHTBL: u16 = 66;
4318pub const RTM_SETNEIGHTBL: u16 = 67;
4319pub const RTM_NEWNDUSEROPT: u16 = 68;
4320pub const RTM_NEWADDRLABEL: u16 = 72;
4321pub const RTM_DELADDRLABEL: u16 = 73;
4322pub const RTM_GETADDRLABEL: u16 = 74;
4323pub const RTM_GETDCB: u16 = 78;
4324pub const RTM_SETDCB: u16 = 79;
4325pub const RTM_NEWNETCONF: u16 = 80;
4326pub const RTM_GETNETCONF: u16 = 82;
4327pub const RTM_NEWMDB: u16 = 84;
4328pub const RTM_DELMDB: u16 = 85;
4329pub const RTM_GETMDB: u16 = 86;
4330pub const RTM_NEWNSID: u16 = 88;
4331pub const RTM_DELNSID: u16 = 89;
4332pub const RTM_GETNSID: u16 = 90;
4333
4334pub const RTM_F_NOTIFY: c_uint = 0x100;
4335pub const RTM_F_CLONED: c_uint = 0x200;
4336pub const RTM_F_EQUALIZE: c_uint = 0x400;
4337pub const RTM_F_PREFIX: c_uint = 0x800;
4338
4339pub const RTA_UNSPEC: c_ushort = 0;
4340pub const RTA_DST: c_ushort = 1;
4341pub const RTA_SRC: c_ushort = 2;
4342pub const RTA_IIF: c_ushort = 3;
4343pub const RTA_OIF: c_ushort = 4;
4344pub const RTA_GATEWAY: c_ushort = 5;
4345pub const RTA_PRIORITY: c_ushort = 6;
4346pub const RTA_PREFSRC: c_ushort = 7;
4347pub const RTA_METRICS: c_ushort = 8;
4348pub const RTA_MULTIPATH: c_ushort = 9;
4349pub const RTA_PROTOINFO: c_ushort = 10; // No longer used
4350pub const RTA_FLOW: c_ushort = 11;
4351pub const RTA_CACHEINFO: c_ushort = 12;
4352pub const RTA_SESSION: c_ushort = 13; // No longer used
4353pub const RTA_MP_ALGO: c_ushort = 14; // No longer used
4354pub const RTA_TABLE: c_ushort = 15;
4355pub const RTA_MARK: c_ushort = 16;
4356pub const RTA_MFC_STATS: c_ushort = 17;
4357
4358pub const RTN_UNSPEC: c_uchar = 0;
4359pub const RTN_UNICAST: c_uchar = 1;
4360pub const RTN_LOCAL: c_uchar = 2;
4361pub const RTN_BROADCAST: c_uchar = 3;
4362pub const RTN_ANYCAST: c_uchar = 4;
4363pub const RTN_MULTICAST: c_uchar = 5;
4364pub const RTN_BLACKHOLE: c_uchar = 6;
4365pub const RTN_UNREACHABLE: c_uchar = 7;
4366pub const RTN_PROHIBIT: c_uchar = 8;
4367pub const RTN_THROW: c_uchar = 9;
4368pub const RTN_NAT: c_uchar = 10;
4369pub const RTN_XRESOLVE: c_uchar = 11;
4370
4371pub const RTPROT_UNSPEC: c_uchar = 0;
4372pub const RTPROT_REDIRECT: c_uchar = 1;
4373pub const RTPROT_KERNEL: c_uchar = 2;
4374pub const RTPROT_BOOT: c_uchar = 3;
4375pub const RTPROT_STATIC: c_uchar = 4;
4376
4377pub const RT_SCOPE_UNIVERSE: c_uchar = 0;
4378pub const RT_SCOPE_SITE: c_uchar = 200;
4379pub const RT_SCOPE_LINK: c_uchar = 253;
4380pub const RT_SCOPE_HOST: c_uchar = 254;
4381pub const RT_SCOPE_NOWHERE: c_uchar = 255;
4382
4383pub const RT_TABLE_UNSPEC: c_uchar = 0;
4384pub const RT_TABLE_COMPAT: c_uchar = 252;
4385pub const RT_TABLE_DEFAULT: c_uchar = 253;
4386pub const RT_TABLE_MAIN: c_uchar = 254;
4387pub const RT_TABLE_LOCAL: c_uchar = 255;
4388
4389pub const RTMSG_OVERRUN: u32 = crate::NLMSG_OVERRUN as u32;
4390pub const RTMSG_NEWDEVICE: u32 = 0x11;
4391pub const RTMSG_DELDEVICE: u32 = 0x12;
4392pub const RTMSG_NEWROUTE: u32 = 0x21;
4393pub const RTMSG_DELROUTE: u32 = 0x22;
4394pub const RTMSG_NEWRULE: u32 = 0x31;
4395pub const RTMSG_DELRULE: u32 = 0x32;
4396pub const RTMSG_CONTROL: u32 = 0x40;
4397pub const RTMSG_AR_FAILED: u32 = 0x51;
4398
4399pub const MAX_ADDR_LEN: usize = 7;
4400pub const ARPD_UPDATE: c_ushort = 0x01;
4401pub const ARPD_LOOKUP: c_ushort = 0x02;
4402pub const ARPD_FLUSH: c_ushort = 0x03;
4403pub const ATF_MAGIC: c_int = 0x80;
4404
4405pub const RTEXT_FILTER_VF: c_int = 1 << 0;
4406pub const RTEXT_FILTER_BRVLAN: c_int = 1 << 1;
4407pub const RTEXT_FILTER_BRVLAN_COMPRESSED: c_int = 1 << 2;
4408pub const RTEXT_FILTER_SKIP_STATS: c_int = 1 << 3;
4409pub const RTEXT_FILTER_MRP: c_int = 1 << 4;
4410pub const RTEXT_FILTER_CFM_CONFIG: c_int = 1 << 5;
4411pub const RTEXT_FILTER_CFM_STATUS: c_int = 1 << 6;
4412
4413// userspace compat definitions for RTNLGRP_*
4414pub const RTMGRP_LINK: c_int = 0x00001;
4415pub const RTMGRP_NOTIFY: c_int = 0x00002;
4416pub const RTMGRP_NEIGH: c_int = 0x00004;
4417pub const RTMGRP_TC: c_int = 0x00008;
4418pub const RTMGRP_IPV4_IFADDR: c_int = 0x00010;
4419pub const RTMGRP_IPV4_MROUTE: c_int = 0x00020;
4420pub const RTMGRP_IPV4_ROUTE: c_int = 0x00040;
4421pub const RTMGRP_IPV4_RULE: c_int = 0x00080;
4422pub const RTMGRP_IPV6_IFADDR: c_int = 0x00100;
4423pub const RTMGRP_IPV6_MROUTE: c_int = 0x00200;
4424pub const RTMGRP_IPV6_ROUTE: c_int = 0x00400;
4425pub const RTMGRP_IPV6_IFINFO: c_int = 0x00800;
4426pub const RTMGRP_DECnet_IFADDR: c_int = 0x01000;
4427pub const RTMGRP_DECnet_ROUTE: c_int = 0x04000;
4428pub const RTMGRP_IPV6_PREFIX: c_int = 0x20000;
4429
4430// enum rtnetlink_groups
4431pub const RTNLGRP_NONE: c_uint = 0x00;
4432pub const RTNLGRP_LINK: c_uint = 0x01;
4433pub const RTNLGRP_NOTIFY: c_uint = 0x02;
4434pub const RTNLGRP_NEIGH: c_uint = 0x03;
4435pub const RTNLGRP_TC: c_uint = 0x04;
4436pub const RTNLGRP_IPV4_IFADDR: c_uint = 0x05;
4437pub const RTNLGRP_IPV4_MROUTE: c_uint = 0x06;
4438pub const RTNLGRP_IPV4_ROUTE: c_uint = 0x07;
4439pub const RTNLGRP_IPV4_RULE: c_uint = 0x08;
4440pub const RTNLGRP_IPV6_IFADDR: c_uint = 0x09;
4441pub const RTNLGRP_IPV6_MROUTE: c_uint = 0x0a;
4442pub const RTNLGRP_IPV6_ROUTE: c_uint = 0x0b;
4443pub const RTNLGRP_IPV6_IFINFO: c_uint = 0x0c;
4444pub const RTNLGRP_DECnet_IFADDR: c_uint = 0x0d;
4445pub const RTNLGRP_NOP2: c_uint = 0x0e;
4446pub const RTNLGRP_DECnet_ROUTE: c_uint = 0x0f;
4447pub const RTNLGRP_DECnet_RULE: c_uint = 0x10;
4448pub const RTNLGRP_NOP4: c_uint = 0x11;
4449pub const RTNLGRP_IPV6_PREFIX: c_uint = 0x12;
4450pub const RTNLGRP_IPV6_RULE: c_uint = 0x13;
4451pub const RTNLGRP_ND_USEROPT: c_uint = 0x14;
4452pub const RTNLGRP_PHONET_IFADDR: c_uint = 0x15;
4453pub const RTNLGRP_PHONET_ROUTE: c_uint = 0x16;
4454pub const RTNLGRP_DCB: c_uint = 0x17;
4455pub const RTNLGRP_IPV4_NETCONF: c_uint = 0x18;
4456pub const RTNLGRP_IPV6_NETCONF: c_uint = 0x19;
4457pub const RTNLGRP_MDB: c_uint = 0x1a;
4458pub const RTNLGRP_MPLS_ROUTE: c_uint = 0x1b;
4459pub const RTNLGRP_NSID: c_uint = 0x1c;
4460pub const RTNLGRP_MPLS_NETCONF: c_uint = 0x1d;
4461pub const RTNLGRP_IPV4_MROUTE_R: c_uint = 0x1e;
4462pub const RTNLGRP_IPV6_MROUTE_R: c_uint = 0x1f;
4463pub const RTNLGRP_NEXTHOP: c_uint = 0x20;
4464pub const RTNLGRP_BRVLAN: c_uint = 0x21;
4465pub const RTNLGRP_MCTP_IFADDR: c_uint = 0x22;
4466pub const RTNLGRP_TUNNEL: c_uint = 0x23;
4467pub const RTNLGRP_STATS: c_uint = 0x24;
4468
4469// linux/cn_proc.h
4470c_enum! {
4471    pub enum proc_cn_mcast_op {
4472        PROC_CN_MCAST_LISTEN = 1,
4473        PROC_CN_MCAST_IGNORE = 2,
4474    }
4475
4476    pub enum proc_cn_event {
4477        PROC_EVENT_NONE = 0x00000000,
4478        PROC_EVENT_FORK = 0x00000001,
4479        PROC_EVENT_EXEC = 0x00000002,
4480        PROC_EVENT_UID = 0x00000004,
4481        PROC_EVENT_GID = 0x00000040,
4482        PROC_EVENT_SID = 0x00000080,
4483        PROC_EVENT_PTRACE = 0x00000100,
4484        PROC_EVENT_COMM = 0x00000200,
4485        PROC_EVENT_NONZERO_EXIT = 0x20000000,
4486        PROC_EVENT_COREDUMP = 0x40000000,
4487        PROC_EVENT_EXIT = 0x80000000,
4488    }
4489}
4490
4491// linux/connector.h
4492pub const CN_IDX_PROC: c_uint = 0x1;
4493pub const CN_VAL_PROC: c_uint = 0x1;
4494pub const CN_IDX_CIFS: c_uint = 0x2;
4495pub const CN_VAL_CIFS: c_uint = 0x1;
4496pub const CN_W1_IDX: c_uint = 0x3;
4497pub const CN_W1_VAL: c_uint = 0x1;
4498pub const CN_IDX_V86D: c_uint = 0x4;
4499pub const CN_VAL_V86D_UVESAFB: c_uint = 0x1;
4500pub const CN_IDX_BB: c_uint = 0x5;
4501pub const CN_DST_IDX: c_uint = 0x6;
4502pub const CN_DST_VAL: c_uint = 0x1;
4503pub const CN_IDX_DM: c_uint = 0x7;
4504pub const CN_VAL_DM_USERSPACE_LOG: c_uint = 0x1;
4505pub const CN_IDX_DRBD: c_uint = 0x8;
4506pub const CN_VAL_DRBD: c_uint = 0x1;
4507pub const CN_KVP_IDX: c_uint = 0x9;
4508pub const CN_KVP_VAL: c_uint = 0x1;
4509pub const CN_VSS_IDX: c_uint = 0xA;
4510pub const CN_VSS_VAL: c_uint = 0x1;
4511
4512// linux/module.h
4513pub const MODULE_INIT_IGNORE_MODVERSIONS: c_uint = 0x0001;
4514pub const MODULE_INIT_IGNORE_VERMAGIC: c_uint = 0x0002;
4515
4516// linux/net_tstamp.h
4517pub const SOF_TIMESTAMPING_TX_HARDWARE: c_uint = 1 << 0;
4518pub const SOF_TIMESTAMPING_TX_SOFTWARE: c_uint = 1 << 1;
4519pub const SOF_TIMESTAMPING_RX_HARDWARE: c_uint = 1 << 2;
4520pub const SOF_TIMESTAMPING_RX_SOFTWARE: c_uint = 1 << 3;
4521pub const SOF_TIMESTAMPING_SOFTWARE: c_uint = 1 << 4;
4522pub const SOF_TIMESTAMPING_SYS_HARDWARE: c_uint = 1 << 5;
4523pub const SOF_TIMESTAMPING_RAW_HARDWARE: c_uint = 1 << 6;
4524pub const SOF_TIMESTAMPING_OPT_ID: c_uint = 1 << 7;
4525pub const SOF_TIMESTAMPING_TX_SCHED: c_uint = 1 << 8;
4526pub const SOF_TIMESTAMPING_TX_ACK: c_uint = 1 << 9;
4527pub const SOF_TIMESTAMPING_OPT_CMSG: c_uint = 1 << 10;
4528pub const SOF_TIMESTAMPING_OPT_TSONLY: c_uint = 1 << 11;
4529pub const SOF_TIMESTAMPING_OPT_STATS: c_uint = 1 << 12;
4530pub const SOF_TIMESTAMPING_OPT_PKTINFO: c_uint = 1 << 13;
4531pub const SOF_TIMESTAMPING_OPT_TX_SWHW: c_uint = 1 << 14;
4532pub const SOF_TIMESTAMPING_BIND_PHC: c_uint = 1 << 15;
4533pub const SOF_TIMESTAMPING_OPT_ID_TCP: c_uint = 1 << 16;
4534pub const SOF_TIMESTAMPING_OPT_RX_FILTER: c_uint = 1 << 17;
4535pub const SOF_TXTIME_DEADLINE_MODE: u32 = 1 << 0;
4536pub const SOF_TXTIME_REPORT_ERRORS: u32 = 1 << 1;
4537
4538pub const HWTSTAMP_TX_OFF: c_uint = 0;
4539pub const HWTSTAMP_TX_ON: c_uint = 1;
4540pub const HWTSTAMP_TX_ONESTEP_SYNC: c_uint = 2;
4541pub const HWTSTAMP_TX_ONESTEP_P2P: c_uint = 3;
4542
4543pub const HWTSTAMP_FILTER_NONE: c_uint = 0;
4544pub const HWTSTAMP_FILTER_ALL: c_uint = 1;
4545pub const HWTSTAMP_FILTER_SOME: c_uint = 2;
4546pub const HWTSTAMP_FILTER_PTP_V1_L4_EVENT: c_uint = 3;
4547pub const HWTSTAMP_FILTER_PTP_V1_L4_SYNC: c_uint = 4;
4548pub const HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: c_uint = 5;
4549pub const HWTSTAMP_FILTER_PTP_V2_L4_EVENT: c_uint = 6;
4550pub const HWTSTAMP_FILTER_PTP_V2_L4_SYNC: c_uint = 7;
4551pub const HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: c_uint = 8;
4552pub const HWTSTAMP_FILTER_PTP_V2_L2_EVENT: c_uint = 9;
4553pub const HWTSTAMP_FILTER_PTP_V2_L2_SYNC: c_uint = 10;
4554pub const HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: c_uint = 11;
4555pub const HWTSTAMP_FILTER_PTP_V2_EVENT: c_uint = 12;
4556pub const HWTSTAMP_FILTER_PTP_V2_SYNC: c_uint = 13;
4557pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: c_uint = 14;
4558pub const HWTSTAMP_FILTER_NTP_ALL: c_uint = 15;
4559
4560// linux/ptp_clock.h
4561pub const PTP_MAX_SAMPLES: c_uint = 25; // Maximum allowed offset measurement samples.
4562
4563const PTP_CLK_MAGIC: u32 = b'=' as u32;
4564
4565pub const PTP_CLOCK_GETCAPS: Ioctl = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 1);
4566pub const PTP_EXTTS_REQUEST: Ioctl = _IOW::<ptp_extts_request>(PTP_CLK_MAGIC, 2);
4567pub const PTP_PEROUT_REQUEST: Ioctl = _IOW::<ptp_perout_request>(PTP_CLK_MAGIC, 3);
4568pub const PTP_ENABLE_PPS: Ioctl = _IOW::<c_int>(PTP_CLK_MAGIC, 4);
4569pub const PTP_SYS_OFFSET: Ioctl = _IOW::<ptp_sys_offset>(PTP_CLK_MAGIC, 5);
4570pub const PTP_PIN_GETFUNC: Ioctl = _IOWR::<ptp_pin_desc>(PTP_CLK_MAGIC, 6);
4571pub const PTP_PIN_SETFUNC: Ioctl = _IOW::<ptp_pin_desc>(PTP_CLK_MAGIC, 7);
4572pub const PTP_SYS_OFFSET_PRECISE: Ioctl = _IOWR::<ptp_sys_offset_precise>(PTP_CLK_MAGIC, 8);
4573pub const PTP_SYS_OFFSET_EXTENDED: Ioctl = _IOWR::<ptp_sys_offset_extended>(PTP_CLK_MAGIC, 9);
4574
4575pub const PTP_CLOCK_GETCAPS2: Ioctl = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 10);
4576pub const PTP_EXTTS_REQUEST2: Ioctl = _IOW::<ptp_extts_request>(PTP_CLK_MAGIC, 11);
4577pub const PTP_PEROUT_REQUEST2: Ioctl = _IOW::<ptp_perout_request>(PTP_CLK_MAGIC, 12);
4578pub const PTP_ENABLE_PPS2: Ioctl = _IOW::<c_int>(PTP_CLK_MAGIC, 13);
4579pub const PTP_SYS_OFFSET2: Ioctl = _IOW::<ptp_sys_offset>(PTP_CLK_MAGIC, 14);
4580pub const PTP_PIN_GETFUNC2: Ioctl = _IOWR::<ptp_pin_desc>(PTP_CLK_MAGIC, 15);
4581pub const PTP_PIN_SETFUNC2: Ioctl = _IOW::<ptp_pin_desc>(PTP_CLK_MAGIC, 16);
4582pub const PTP_SYS_OFFSET_PRECISE2: Ioctl = _IOWR::<ptp_sys_offset_precise>(PTP_CLK_MAGIC, 17);
4583pub const PTP_SYS_OFFSET_EXTENDED2: Ioctl = _IOWR::<ptp_sys_offset_extended>(PTP_CLK_MAGIC, 18);
4584
4585// enum ptp_pin_function
4586pub const PTP_PF_NONE: c_uint = 0;
4587pub const PTP_PF_EXTTS: c_uint = 1;
4588pub const PTP_PF_PEROUT: c_uint = 2;
4589pub const PTP_PF_PHYSYNC: c_uint = 3;
4590
4591// linux/tls.h
4592pub const TLS_TX: c_int = 1;
4593pub const TLS_RX: c_int = 2;
4594
4595pub const TLS_TX_ZEROCOPY_RO: c_int = 3;
4596pub const TLS_RX_EXPECT_NO_PAD: c_int = 4;
4597
4598pub const TLS_1_2_VERSION_MAJOR: __u8 = 0x3;
4599pub const TLS_1_2_VERSION_MINOR: __u8 = 0x3;
4600pub const TLS_1_2_VERSION: __u16 =
4601    ((TLS_1_2_VERSION_MAJOR as __u16) << 8) | (TLS_1_2_VERSION_MINOR as __u16);
4602
4603pub const TLS_1_3_VERSION_MAJOR: __u8 = 0x3;
4604pub const TLS_1_3_VERSION_MINOR: __u8 = 0x4;
4605pub const TLS_1_3_VERSION: __u16 =
4606    ((TLS_1_3_VERSION_MAJOR as __u16) << 8) | (TLS_1_3_VERSION_MINOR as __u16);
4607
4608pub const TLS_CIPHER_AES_GCM_128: __u16 = 51;
4609pub const TLS_CIPHER_AES_GCM_128_IV_SIZE: usize = 8;
4610pub const TLS_CIPHER_AES_GCM_128_KEY_SIZE: usize = 16;
4611pub const TLS_CIPHER_AES_GCM_128_SALT_SIZE: usize = 4;
4612pub const TLS_CIPHER_AES_GCM_128_TAG_SIZE: usize = 16;
4613pub const TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE: usize = 8;
4614
4615pub const TLS_CIPHER_AES_GCM_256: __u16 = 52;
4616pub const TLS_CIPHER_AES_GCM_256_IV_SIZE: usize = 8;
4617pub const TLS_CIPHER_AES_GCM_256_KEY_SIZE: usize = 32;
4618pub const TLS_CIPHER_AES_GCM_256_SALT_SIZE: usize = 4;
4619pub const TLS_CIPHER_AES_GCM_256_TAG_SIZE: usize = 16;
4620pub const TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE: usize = 8;
4621
4622pub const TLS_CIPHER_AES_CCM_128: __u16 = 53;
4623pub const TLS_CIPHER_AES_CCM_128_IV_SIZE: usize = 8;
4624pub const TLS_CIPHER_AES_CCM_128_KEY_SIZE: usize = 16;
4625pub const TLS_CIPHER_AES_CCM_128_SALT_SIZE: usize = 4;
4626pub const TLS_CIPHER_AES_CCM_128_TAG_SIZE: usize = 16;
4627pub const TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE: usize = 8;
4628
4629pub const TLS_CIPHER_CHACHA20_POLY1305: __u16 = 54;
4630pub const TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE: usize = 12;
4631pub const TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE: usize = 32;
4632pub const TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE: usize = 0;
4633pub const TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE: usize = 16;
4634pub const TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE: usize = 8;
4635
4636pub const TLS_CIPHER_SM4_GCM: __u16 = 55;
4637pub const TLS_CIPHER_SM4_GCM_IV_SIZE: usize = 8;
4638pub const TLS_CIPHER_SM4_GCM_KEY_SIZE: usize = 16;
4639pub const TLS_CIPHER_SM4_GCM_SALT_SIZE: usize = 4;
4640pub const TLS_CIPHER_SM4_GCM_TAG_SIZE: usize = 16;
4641pub const TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE: usize = 8;
4642
4643pub const TLS_CIPHER_SM4_CCM: __u16 = 56;
4644pub const TLS_CIPHER_SM4_CCM_IV_SIZE: usize = 8;
4645pub const TLS_CIPHER_SM4_CCM_KEY_SIZE: usize = 16;
4646pub const TLS_CIPHER_SM4_CCM_SALT_SIZE: usize = 4;
4647pub const TLS_CIPHER_SM4_CCM_TAG_SIZE: usize = 16;
4648pub const TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE: usize = 8;
4649
4650pub const TLS_CIPHER_ARIA_GCM_128: __u16 = 57;
4651pub const TLS_CIPHER_ARIA_GCM_128_IV_SIZE: usize = 8;
4652pub const TLS_CIPHER_ARIA_GCM_128_KEY_SIZE: usize = 16;
4653pub const TLS_CIPHER_ARIA_GCM_128_SALT_SIZE: usize = 4;
4654pub const TLS_CIPHER_ARIA_GCM_128_TAG_SIZE: usize = 16;
4655pub const TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE: usize = 8;
4656
4657pub const TLS_CIPHER_ARIA_GCM_256: __u16 = 58;
4658pub const TLS_CIPHER_ARIA_GCM_256_IV_SIZE: usize = 8;
4659pub const TLS_CIPHER_ARIA_GCM_256_KEY_SIZE: usize = 32;
4660pub const TLS_CIPHER_ARIA_GCM_256_SALT_SIZE: usize = 4;
4661pub const TLS_CIPHER_ARIA_GCM_256_TAG_SIZE: usize = 16;
4662pub const TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE: usize = 8;
4663
4664pub const TLS_SET_RECORD_TYPE: c_int = 1;
4665pub const TLS_GET_RECORD_TYPE: c_int = 2;
4666
4667pub const SOL_TLS: c_int = 282;
4668
4669// enum
4670pub const TLS_INFO_UNSPEC: c_int = 0x00;
4671pub const TLS_INFO_VERSION: c_int = 0x01;
4672pub const TLS_INFO_CIPHER: c_int = 0x02;
4673pub const TLS_INFO_TXCONF: c_int = 0x03;
4674pub const TLS_INFO_RXCONF: c_int = 0x04;
4675pub const TLS_INFO_ZC_RO_TX: c_int = 0x05;
4676pub const TLS_INFO_RX_NO_PAD: c_int = 0x06;
4677
4678pub const TLS_CONF_BASE: c_int = 1;
4679pub const TLS_CONF_SW: c_int = 2;
4680pub const TLS_CONF_HW: c_int = 3;
4681pub const TLS_CONF_HW_RECORD: c_int = 4;
4682
4683// linux/if_alg.h
4684pub const ALG_SET_KEY: c_int = 1;
4685pub const ALG_SET_IV: c_int = 2;
4686pub const ALG_SET_OP: c_int = 3;
4687pub const ALG_SET_AEAD_ASSOCLEN: c_int = 4;
4688pub const ALG_SET_AEAD_AUTHSIZE: c_int = 5;
4689pub const ALG_SET_DRBG_ENTROPY: c_int = 6;
4690pub const ALG_SET_KEY_BY_KEY_SERIAL: c_int = 7;
4691
4692pub const ALG_OP_DECRYPT: c_int = 0;
4693pub const ALG_OP_ENCRYPT: c_int = 1;
4694
4695// include/uapi/linux/if.h
4696pub const IF_OPER_UNKNOWN: c_int = 0;
4697pub const IF_OPER_NOTPRESENT: c_int = 1;
4698pub const IF_OPER_DOWN: c_int = 2;
4699pub const IF_OPER_LOWERLAYERDOWN: c_int = 3;
4700pub const IF_OPER_TESTING: c_int = 4;
4701pub const IF_OPER_DORMANT: c_int = 5;
4702pub const IF_OPER_UP: c_int = 6;
4703
4704pub const IF_LINK_MODE_DEFAULT: c_int = 0;
4705pub const IF_LINK_MODE_DORMANT: c_int = 1;
4706pub const IF_LINK_MODE_TESTING: c_int = 2;
4707
4708// include/uapi/linux/udp.h
4709pub const UDP_CORK: c_int = 1;
4710pub const UDP_ENCAP: c_int = 100;
4711pub const UDP_NO_CHECK6_TX: c_int = 101;
4712pub const UDP_NO_CHECK6_RX: c_int = 102;
4713
4714// include/uapi/linux/mman.h
4715pub const MAP_SHARED_VALIDATE: c_int = 0x3;
4716pub const MAP_DROPPABLE: c_int = 0x8;
4717
4718// include/uapi/asm-generic/mman-common.h
4719pub const MAP_FIXED_NOREPLACE: c_int = 0x100000;
4720pub const MLOCK_ONFAULT: c_uint = 0x01;
4721
4722// uapi/linux/vm_sockets.h
4723pub const VMADDR_CID_ANY: c_uint = 0xFFFFFFFF;
4724pub const VMADDR_CID_HYPERVISOR: c_uint = 0;
4725#[deprecated(
4726    since = "0.2.74",
4727    note = "VMADDR_CID_RESERVED is removed since Linux v5.6 and \
4728            replaced with VMADDR_CID_LOCAL"
4729)]
4730pub const VMADDR_CID_RESERVED: c_uint = 1;
4731pub const VMADDR_CID_LOCAL: c_uint = 1;
4732pub const VMADDR_CID_HOST: c_uint = 2;
4733pub const VMADDR_PORT_ANY: c_uint = 0xFFFFFFFF;
4734
4735// uapi/linux/inotify.h
4736pub const IN_ACCESS: u32 = 0x0000_0001;
4737pub const IN_MODIFY: u32 = 0x0000_0002;
4738pub const IN_ATTRIB: u32 = 0x0000_0004;
4739pub const IN_CLOSE_WRITE: u32 = 0x0000_0008;
4740pub const IN_CLOSE_NOWRITE: u32 = 0x0000_0010;
4741pub const IN_CLOSE: u32 = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE;
4742pub const IN_OPEN: u32 = 0x0000_0020;
4743pub const IN_MOVED_FROM: u32 = 0x0000_0040;
4744pub const IN_MOVED_TO: u32 = 0x0000_0080;
4745pub const IN_MOVE: u32 = IN_MOVED_FROM | IN_MOVED_TO;
4746pub const IN_CREATE: u32 = 0x0000_0100;
4747pub const IN_DELETE: u32 = 0x0000_0200;
4748pub const IN_DELETE_SELF: u32 = 0x0000_0400;
4749pub const IN_MOVE_SELF: u32 = 0x0000_0800;
4750pub const IN_UNMOUNT: u32 = 0x0000_2000;
4751pub const IN_Q_OVERFLOW: u32 = 0x0000_4000;
4752pub const IN_IGNORED: u32 = 0x0000_8000;
4753pub const IN_ONLYDIR: u32 = 0x0100_0000;
4754pub const IN_DONT_FOLLOW: u32 = 0x0200_0000;
4755pub const IN_EXCL_UNLINK: u32 = 0x0400_0000;
4756
4757// uapi/linux/securebits.h
4758const SECURE_NOROOT: c_int = 0;
4759const SECURE_NOROOT_LOCKED: c_int = 1;
4760
4761pub const SECBIT_NOROOT: c_int = issecure_mask(SECURE_NOROOT);
4762pub const SECBIT_NOROOT_LOCKED: c_int = issecure_mask(SECURE_NOROOT_LOCKED);
4763
4764const SECURE_NO_SETUID_FIXUP: c_int = 2;
4765const SECURE_NO_SETUID_FIXUP_LOCKED: c_int = 3;
4766
4767pub const SECBIT_NO_SETUID_FIXUP: c_int = issecure_mask(SECURE_NO_SETUID_FIXUP);
4768pub const SECBIT_NO_SETUID_FIXUP_LOCKED: c_int = issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED);
4769
4770const SECURE_KEEP_CAPS: c_int = 4;
4771const SECURE_KEEP_CAPS_LOCKED: c_int = 5;
4772
4773pub const SECBIT_KEEP_CAPS: c_int = issecure_mask(SECURE_KEEP_CAPS);
4774pub const SECBIT_KEEP_CAPS_LOCKED: c_int = issecure_mask(SECURE_KEEP_CAPS_LOCKED);
4775
4776const SECURE_NO_CAP_AMBIENT_RAISE: c_int = 6;
4777const SECURE_NO_CAP_AMBIENT_RAISE_LOCKED: c_int = 7;
4778
4779pub const SECBIT_NO_CAP_AMBIENT_RAISE: c_int = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE);
4780pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED: c_int =
4781    issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED);
4782
4783const SECURE_EXEC_RESTRICT_FILE: c_int = 8;
4784const SECURE_EXEC_RESTRICT_FILE_LOCKED: c_int = 9;
4785
4786pub const SECBIT_EXEC_RESTRICT_FILE: c_int = issecure_mask(SECURE_EXEC_RESTRICT_FILE);
4787pub const SECBIT_EXEC_RESTRICT_FILE_LOCKED: c_int = issecure_mask(SECURE_EXEC_RESTRICT_FILE_LOCKED);
4788
4789const SECURE_EXEC_DENY_INTERACTIVE: c_int = 10;
4790const SECURE_EXEC_DENY_INTERACTIVE_LOCKED: c_int = 11;
4791
4792pub const SECBIT_EXEC_DENY_INTERACTIVE: c_int = issecure_mask(SECURE_EXEC_DENY_INTERACTIVE);
4793pub const SECBIT_EXEC_DENY_INTERACTIVE_LOCKED: c_int =
4794    issecure_mask(SECURE_EXEC_DENY_INTERACTIVE_LOCKED);
4795
4796pub const SECUREBITS_DEFAULT: c_int = 0x00000000;
4797pub const SECURE_ALL_BITS: c_int = SECBIT_NOROOT
4798    | SECBIT_NO_SETUID_FIXUP
4799    | SECBIT_KEEP_CAPS
4800    | SECBIT_NO_CAP_AMBIENT_RAISE
4801    | SECBIT_EXEC_RESTRICT_FILE
4802    | SECBIT_EXEC_DENY_INTERACTIVE;
4803pub const SECURE_ALL_LOCKS: c_int = SECURE_ALL_BITS << 1;
4804
4805pub const SECURE_ALL_UNPRIVILEGED: c_int =
4806    issecure_mask(SECURE_EXEC_RESTRICT_FILE) | issecure_mask(SECURE_EXEC_DENY_INTERACTIVE);
4807
4808const fn issecure_mask(x: c_int) -> c_int {
4809    1 << x
4810}
4811
4812// linux/keyctl.h
4813pub const KEY_SPEC_THREAD_KEYRING: i32 = -1;
4814pub const KEY_SPEC_PROCESS_KEYRING: i32 = -2;
4815pub const KEY_SPEC_SESSION_KEYRING: i32 = -3;
4816pub const KEY_SPEC_USER_KEYRING: i32 = -4;
4817pub const KEY_SPEC_USER_SESSION_KEYRING: i32 = -5;
4818pub const KEY_SPEC_GROUP_KEYRING: i32 = -6;
4819pub const KEY_SPEC_REQKEY_AUTH_KEY: i32 = -7;
4820pub const KEY_SPEC_REQUESTOR_KEYRING: i32 = -8;
4821
4822pub const KEY_REQKEY_DEFL_NO_CHANGE: i32 = -1;
4823pub const KEY_REQKEY_DEFL_DEFAULT: i32 = 0;
4824pub const KEY_REQKEY_DEFL_THREAD_KEYRING: i32 = 1;
4825pub const KEY_REQKEY_DEFL_PROCESS_KEYRING: i32 = 2;
4826pub const KEY_REQKEY_DEFL_SESSION_KEYRING: i32 = 3;
4827pub const KEY_REQKEY_DEFL_USER_KEYRING: i32 = 4;
4828pub const KEY_REQKEY_DEFL_USER_SESSION_KEYRING: i32 = 5;
4829pub const KEY_REQKEY_DEFL_GROUP_KEYRING: i32 = 6;
4830pub const KEY_REQKEY_DEFL_REQUESTOR_KEYRING: i32 = 7;
4831
4832pub const KEYCTL_GET_KEYRING_ID: u32 = 0;
4833pub const KEYCTL_JOIN_SESSION_KEYRING: u32 = 1;
4834pub const KEYCTL_UPDATE: u32 = 2;
4835pub const KEYCTL_REVOKE: u32 = 3;
4836pub const KEYCTL_CHOWN: u32 = 4;
4837pub const KEYCTL_SETPERM: u32 = 5;
4838pub const KEYCTL_DESCRIBE: u32 = 6;
4839pub const KEYCTL_CLEAR: u32 = 7;
4840pub const KEYCTL_LINK: u32 = 8;
4841pub const KEYCTL_UNLINK: u32 = 9;
4842pub const KEYCTL_SEARCH: u32 = 10;
4843pub const KEYCTL_READ: u32 = 11;
4844pub const KEYCTL_INSTANTIATE: u32 = 12;
4845pub const KEYCTL_NEGATE: u32 = 13;
4846pub const KEYCTL_SET_REQKEY_KEYRING: u32 = 14;
4847pub const KEYCTL_SET_TIMEOUT: u32 = 15;
4848pub const KEYCTL_ASSUME_AUTHORITY: u32 = 16;
4849pub const KEYCTL_GET_SECURITY: u32 = 17;
4850pub const KEYCTL_SESSION_TO_PARENT: u32 = 18;
4851pub const KEYCTL_REJECT: u32 = 19;
4852pub const KEYCTL_INSTANTIATE_IOV: u32 = 20;
4853pub const KEYCTL_INVALIDATE: u32 = 21;
4854pub const KEYCTL_GET_PERSISTENT: u32 = 22;
4855
4856pub const IN_MASK_CREATE: u32 = 0x1000_0000;
4857pub const IN_MASK_ADD: u32 = 0x2000_0000;
4858pub const IN_ISDIR: u32 = 0x4000_0000;
4859pub const IN_ONESHOT: u32 = 0x8000_0000;
4860
4861pub const IN_ALL_EVENTS: u32 = IN_ACCESS
4862    | IN_MODIFY
4863    | IN_ATTRIB
4864    | IN_CLOSE_WRITE
4865    | IN_CLOSE_NOWRITE
4866    | IN_OPEN
4867    | IN_MOVED_FROM
4868    | IN_MOVED_TO
4869    | IN_DELETE
4870    | IN_CREATE
4871    | IN_DELETE_SELF
4872    | IN_MOVE_SELF;
4873
4874pub const IN_CLOEXEC: c_int = O_CLOEXEC;
4875pub const IN_NONBLOCK: c_int = O_NONBLOCK;
4876
4877// uapi/linux/mount.h
4878pub const OPEN_TREE_CLONE: c_uint = 0x01;
4879pub const OPEN_TREE_CLOEXEC: c_uint = O_CLOEXEC as c_uint;
4880
4881// uapi/linux/netfilter/nf_tables.h
4882pub const NFT_TABLE_MAXNAMELEN: c_int = 256;
4883pub const NFT_CHAIN_MAXNAMELEN: c_int = 256;
4884pub const NFT_SET_MAXNAMELEN: c_int = 256;
4885pub const NFT_OBJ_MAXNAMELEN: c_int = 256;
4886pub const NFT_USERDATA_MAXLEN: c_int = 256;
4887
4888pub const NFT_REG_VERDICT: c_int = 0;
4889pub const NFT_REG_1: c_int = 1;
4890pub const NFT_REG_2: c_int = 2;
4891pub const NFT_REG_3: c_int = 3;
4892pub const NFT_REG_4: c_int = 4;
4893pub const __NFT_REG_MAX: c_int = 5;
4894pub const NFT_REG32_00: c_int = 8;
4895pub const NFT_REG32_01: c_int = 9;
4896pub const NFT_REG32_02: c_int = 10;
4897pub const NFT_REG32_03: c_int = 11;
4898pub const NFT_REG32_04: c_int = 12;
4899pub const NFT_REG32_05: c_int = 13;
4900pub const NFT_REG32_06: c_int = 14;
4901pub const NFT_REG32_07: c_int = 15;
4902pub const NFT_REG32_08: c_int = 16;
4903pub const NFT_REG32_09: c_int = 17;
4904pub const NFT_REG32_10: c_int = 18;
4905pub const NFT_REG32_11: c_int = 19;
4906pub const NFT_REG32_12: c_int = 20;
4907pub const NFT_REG32_13: c_int = 21;
4908pub const NFT_REG32_14: c_int = 22;
4909pub const NFT_REG32_15: c_int = 23;
4910
4911pub const NFT_REG_SIZE: c_int = 16;
4912pub const NFT_REG32_SIZE: c_int = 4;
4913
4914pub const NFT_CONTINUE: c_int = -1;
4915pub const NFT_BREAK: c_int = -2;
4916pub const NFT_JUMP: c_int = -3;
4917pub const NFT_GOTO: c_int = -4;
4918pub const NFT_RETURN: c_int = -5;
4919
4920pub const NFT_MSG_NEWTABLE: c_int = 0;
4921pub const NFT_MSG_GETTABLE: c_int = 1;
4922pub const NFT_MSG_DELTABLE: c_int = 2;
4923pub const NFT_MSG_NEWCHAIN: c_int = 3;
4924pub const NFT_MSG_GETCHAIN: c_int = 4;
4925pub const NFT_MSG_DELCHAIN: c_int = 5;
4926pub const NFT_MSG_NEWRULE: c_int = 6;
4927pub const NFT_MSG_GETRULE: c_int = 7;
4928pub const NFT_MSG_DELRULE: c_int = 8;
4929pub const NFT_MSG_NEWSET: c_int = 9;
4930pub const NFT_MSG_GETSET: c_int = 10;
4931pub const NFT_MSG_DELSET: c_int = 11;
4932pub const NFT_MSG_NEWSETELEM: c_int = 12;
4933pub const NFT_MSG_GETSETELEM: c_int = 13;
4934pub const NFT_MSG_DELSETELEM: c_int = 14;
4935pub const NFT_MSG_NEWGEN: c_int = 15;
4936pub const NFT_MSG_GETGEN: c_int = 16;
4937pub const NFT_MSG_TRACE: c_int = 17;
4938cfg_if! {
4939    if #[cfg(not(target_arch = "sparc64"))] {
4940        pub const NFT_MSG_NEWOBJ: c_int = 18;
4941        pub const NFT_MSG_GETOBJ: c_int = 19;
4942        pub const NFT_MSG_DELOBJ: c_int = 20;
4943        pub const NFT_MSG_GETOBJ_RESET: c_int = 21;
4944    }
4945}
4946pub const NFT_MSG_MAX: c_int = 25;
4947
4948pub const NFT_SET_ANONYMOUS: c_int = 0x1;
4949pub const NFT_SET_CONSTANT: c_int = 0x2;
4950pub const NFT_SET_INTERVAL: c_int = 0x4;
4951pub const NFT_SET_MAP: c_int = 0x8;
4952pub const NFT_SET_TIMEOUT: c_int = 0x10;
4953pub const NFT_SET_EVAL: c_int = 0x20;
4954
4955pub const NFT_SET_POL_PERFORMANCE: c_int = 0;
4956pub const NFT_SET_POL_MEMORY: c_int = 1;
4957
4958pub const NFT_SET_ELEM_INTERVAL_END: c_int = 0x1;
4959
4960pub const NFT_DATA_VALUE: c_uint = 0;
4961pub const NFT_DATA_VERDICT: c_uint = 0xffffff00;
4962
4963pub const NFT_DATA_RESERVED_MASK: c_uint = 0xffffff00;
4964
4965pub const NFT_DATA_VALUE_MAXLEN: c_int = 64;
4966
4967pub const NFT_BYTEORDER_NTOH: c_int = 0;
4968pub const NFT_BYTEORDER_HTON: c_int = 1;
4969
4970pub const NFT_CMP_EQ: c_int = 0;
4971pub const NFT_CMP_NEQ: c_int = 1;
4972pub const NFT_CMP_LT: c_int = 2;
4973pub const NFT_CMP_LTE: c_int = 3;
4974pub const NFT_CMP_GT: c_int = 4;
4975pub const NFT_CMP_GTE: c_int = 5;
4976
4977pub const NFT_RANGE_EQ: c_int = 0;
4978pub const NFT_RANGE_NEQ: c_int = 1;
4979
4980pub const NFT_LOOKUP_F_INV: c_int = 1 << 0;
4981
4982pub const NFT_DYNSET_OP_ADD: c_int = 0;
4983pub const NFT_DYNSET_OP_UPDATE: c_int = 1;
4984
4985pub const NFT_DYNSET_F_INV: c_int = 1 << 0;
4986
4987pub const NFT_PAYLOAD_LL_HEADER: c_int = 0;
4988pub const NFT_PAYLOAD_NETWORK_HEADER: c_int = 1;
4989pub const NFT_PAYLOAD_TRANSPORT_HEADER: c_int = 2;
4990
4991pub const NFT_PAYLOAD_CSUM_NONE: c_int = 0;
4992pub const NFT_PAYLOAD_CSUM_INET: c_int = 1;
4993
4994pub const NFT_META_LEN: c_int = 0;
4995pub const NFT_META_PROTOCOL: c_int = 1;
4996pub const NFT_META_PRIORITY: c_int = 2;
4997pub const NFT_META_MARK: c_int = 3;
4998pub const NFT_META_IIF: c_int = 4;
4999pub const NFT_META_OIF: c_int = 5;
5000pub const NFT_META_IIFNAME: c_int = 6;
5001pub const NFT_META_OIFNAME: c_int = 7;
5002pub const NFT_META_IIFTYPE: c_int = 8;
5003pub const NFT_META_OIFTYPE: c_int = 9;
5004pub const NFT_META_SKUID: c_int = 10;
5005pub const NFT_META_SKGID: c_int = 11;
5006pub const NFT_META_NFTRACE: c_int = 12;
5007pub const NFT_META_RTCLASSID: c_int = 13;
5008pub const NFT_META_SECMARK: c_int = 14;
5009pub const NFT_META_NFPROTO: c_int = 15;
5010pub const NFT_META_L4PROTO: c_int = 16;
5011pub const NFT_META_BRI_IIFNAME: c_int = 17;
5012pub const NFT_META_BRI_OIFNAME: c_int = 18;
5013pub const NFT_META_PKTTYPE: c_int = 19;
5014pub const NFT_META_CPU: c_int = 20;
5015pub const NFT_META_IIFGROUP: c_int = 21;
5016pub const NFT_META_OIFGROUP: c_int = 22;
5017pub const NFT_META_CGROUP: c_int = 23;
5018pub const NFT_META_PRANDOM: c_int = 24;
5019
5020pub const NFT_CT_STATE: c_int = 0;
5021pub const NFT_CT_DIRECTION: c_int = 1;
5022pub const NFT_CT_STATUS: c_int = 2;
5023pub const NFT_CT_MARK: c_int = 3;
5024pub const NFT_CT_SECMARK: c_int = 4;
5025pub const NFT_CT_EXPIRATION: c_int = 5;
5026pub const NFT_CT_HELPER: c_int = 6;
5027pub const NFT_CT_L3PROTOCOL: c_int = 7;
5028pub const NFT_CT_SRC: c_int = 8;
5029pub const NFT_CT_DST: c_int = 9;
5030pub const NFT_CT_PROTOCOL: c_int = 10;
5031pub const NFT_CT_PROTO_SRC: c_int = 11;
5032pub const NFT_CT_PROTO_DST: c_int = 12;
5033pub const NFT_CT_LABELS: c_int = 13;
5034pub const NFT_CT_PKTS: c_int = 14;
5035pub const NFT_CT_BYTES: c_int = 15;
5036pub const NFT_CT_AVGPKT: c_int = 16;
5037pub const NFT_CT_ZONE: c_int = 17;
5038pub const NFT_CT_EVENTMASK: c_int = 18;
5039pub const NFT_CT_SRC_IP: c_int = 19;
5040pub const NFT_CT_DST_IP: c_int = 20;
5041pub const NFT_CT_SRC_IP6: c_int = 21;
5042pub const NFT_CT_DST_IP6: c_int = 22;
5043
5044pub const NFT_LIMIT_PKTS: c_int = 0;
5045pub const NFT_LIMIT_PKT_BYTES: c_int = 1;
5046
5047pub const NFT_LIMIT_F_INV: c_int = 1 << 0;
5048
5049pub const NFT_QUEUE_FLAG_BYPASS: c_int = 0x01;
5050pub const NFT_QUEUE_FLAG_CPU_FANOUT: c_int = 0x02;
5051pub const NFT_QUEUE_FLAG_MASK: c_int = 0x03;
5052
5053pub const NFT_QUOTA_F_INV: c_int = 1 << 0;
5054
5055pub const NFT_REJECT_ICMP_UNREACH: c_int = 0;
5056pub const NFT_REJECT_TCP_RST: c_int = 1;
5057pub const NFT_REJECT_ICMPX_UNREACH: c_int = 2;
5058
5059pub const NFT_REJECT_ICMPX_NO_ROUTE: c_int = 0;
5060pub const NFT_REJECT_ICMPX_PORT_UNREACH: c_int = 1;
5061pub const NFT_REJECT_ICMPX_HOST_UNREACH: c_int = 2;
5062pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: c_int = 3;
5063
5064pub const NFT_NAT_SNAT: c_int = 0;
5065pub const NFT_NAT_DNAT: c_int = 1;
5066
5067pub const NFT_TRACETYPE_UNSPEC: c_int = 0;
5068pub const NFT_TRACETYPE_POLICY: c_int = 1;
5069pub const NFT_TRACETYPE_RETURN: c_int = 2;
5070pub const NFT_TRACETYPE_RULE: c_int = 3;
5071
5072pub const NFT_NG_INCREMENTAL: c_int = 0;
5073pub const NFT_NG_RANDOM: c_int = 1;
5074
5075// linux/input.h
5076pub const FF_MAX: __u16 = 0x7f;
5077pub const FF_CNT: usize = FF_MAX as usize + 1;
5078
5079// linux/input-event-codes.h
5080pub const INPUT_PROP_POINTER: __u16 = 0x00;
5081pub const INPUT_PROP_DIRECT: __u16 = 0x01;
5082pub const INPUT_PROP_BUTTONPAD: __u16 = 0x02;
5083pub const INPUT_PROP_SEMI_MT: __u16 = 0x03;
5084pub const INPUT_PROP_TOPBUTTONPAD: __u16 = 0x04;
5085pub const INPUT_PROP_POINTING_STICK: __u16 = 0x05;
5086pub const INPUT_PROP_ACCELEROMETER: __u16 = 0x06;
5087pub const INPUT_PROP_MAX: __u16 = 0x1f;
5088pub const INPUT_PROP_CNT: usize = INPUT_PROP_MAX as usize + 1;
5089pub const EV_MAX: __u16 = 0x1f;
5090pub const EV_CNT: usize = EV_MAX as usize + 1;
5091pub const SYN_MAX: __u16 = 0xf;
5092pub const SYN_CNT: usize = SYN_MAX as usize + 1;
5093pub const KEY_MAX: __u16 = 0x2ff;
5094pub const KEY_CNT: usize = KEY_MAX as usize + 1;
5095pub const REL_MAX: __u16 = 0x0f;
5096pub const REL_CNT: usize = REL_MAX as usize + 1;
5097pub const ABS_MAX: __u16 = 0x3f;
5098pub const ABS_CNT: usize = ABS_MAX as usize + 1;
5099pub const SW_MAX: __u16 = 0x10;
5100pub const SW_CNT: usize = SW_MAX as usize + 1;
5101pub const MSC_MAX: __u16 = 0x07;
5102pub const MSC_CNT: usize = MSC_MAX as usize + 1;
5103pub const LED_MAX: __u16 = 0x0f;
5104pub const LED_CNT: usize = LED_MAX as usize + 1;
5105pub const REP_MAX: __u16 = 0x01;
5106pub const REP_CNT: usize = REP_MAX as usize + 1;
5107pub const SND_MAX: __u16 = 0x07;
5108pub const SND_CNT: usize = SND_MAX as usize + 1;
5109
5110// linux/uinput.h
5111pub const UINPUT_VERSION: c_uint = 5;
5112pub const UINPUT_MAX_NAME_SIZE: usize = 80;
5113
5114// uapi/linux/fanotify.h
5115pub const FAN_ACCESS: u64 = 0x0000_0001;
5116pub const FAN_MODIFY: u64 = 0x0000_0002;
5117pub const FAN_ATTRIB: u64 = 0x0000_0004;
5118pub const FAN_CLOSE_WRITE: u64 = 0x0000_0008;
5119pub const FAN_CLOSE_NOWRITE: u64 = 0x0000_0010;
5120pub const FAN_OPEN: u64 = 0x0000_0020;
5121pub const FAN_MOVED_FROM: u64 = 0x0000_0040;
5122pub const FAN_MOVED_TO: u64 = 0x0000_0080;
5123pub const FAN_CREATE: u64 = 0x0000_0100;
5124pub const FAN_DELETE: u64 = 0x0000_0200;
5125pub const FAN_DELETE_SELF: u64 = 0x0000_0400;
5126pub const FAN_MOVE_SELF: u64 = 0x0000_0800;
5127pub const FAN_OPEN_EXEC: u64 = 0x0000_1000;
5128
5129pub const FAN_Q_OVERFLOW: u64 = 0x0000_4000;
5130pub const FAN_FS_ERROR: u64 = 0x0000_8000;
5131
5132pub const FAN_OPEN_PERM: u64 = 0x0001_0000;
5133pub const FAN_ACCESS_PERM: u64 = 0x0002_0000;
5134pub const FAN_OPEN_EXEC_PERM: u64 = 0x0004_0000;
5135
5136pub const FAN_EVENT_ON_CHILD: u64 = 0x0800_0000;
5137
5138pub const FAN_RENAME: u64 = 0x1000_0000;
5139
5140pub const FAN_ONDIR: u64 = 0x4000_0000;
5141
5142pub const FAN_CLOSE: u64 = FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE;
5143pub const FAN_MOVE: u64 = FAN_MOVED_FROM | FAN_MOVED_TO;
5144
5145pub const FAN_CLOEXEC: c_uint = 0x0000_0001;
5146pub const FAN_NONBLOCK: c_uint = 0x0000_0002;
5147
5148pub const FAN_CLASS_NOTIF: c_uint = 0x0000_0000;
5149pub const FAN_CLASS_CONTENT: c_uint = 0x0000_0004;
5150pub const FAN_CLASS_PRE_CONTENT: c_uint = 0x0000_0008;
5151
5152pub const FAN_UNLIMITED_QUEUE: c_uint = 0x0000_0010;
5153pub const FAN_UNLIMITED_MARKS: c_uint = 0x0000_0020;
5154pub const FAN_ENABLE_AUDIT: c_uint = 0x0000_0040;
5155
5156pub const FAN_REPORT_PIDFD: c_uint = 0x0000_0080;
5157pub const FAN_REPORT_TID: c_uint = 0x0000_0100;
5158pub const FAN_REPORT_FID: c_uint = 0x0000_0200;
5159pub const FAN_REPORT_DIR_FID: c_uint = 0x0000_0400;
5160pub const FAN_REPORT_NAME: c_uint = 0x0000_0800;
5161pub const FAN_REPORT_TARGET_FID: c_uint = 0x0000_1000;
5162
5163pub const FAN_REPORT_DFID_NAME: c_uint = FAN_REPORT_DIR_FID | FAN_REPORT_NAME;
5164pub const FAN_REPORT_DFID_NAME_TARGET: c_uint =
5165    FAN_REPORT_DFID_NAME | FAN_REPORT_FID | FAN_REPORT_TARGET_FID;
5166
5167pub const FAN_MARK_ADD: c_uint = 0x0000_0001;
5168pub const FAN_MARK_REMOVE: c_uint = 0x0000_0002;
5169pub const FAN_MARK_DONT_FOLLOW: c_uint = 0x0000_0004;
5170pub const FAN_MARK_ONLYDIR: c_uint = 0x0000_0008;
5171pub const FAN_MARK_IGNORED_MASK: c_uint = 0x0000_0020;
5172pub const FAN_MARK_IGNORED_SURV_MODIFY: c_uint = 0x0000_0040;
5173pub const FAN_MARK_FLUSH: c_uint = 0x0000_0080;
5174pub const FAN_MARK_EVICTABLE: c_uint = 0x0000_0200;
5175pub const FAN_MARK_IGNORE: c_uint = 0x0000_0400;
5176
5177pub const FAN_MARK_INODE: c_uint = 0x0000_0000;
5178pub const FAN_MARK_MOUNT: c_uint = 0x0000_0010;
5179pub const FAN_MARK_FILESYSTEM: c_uint = 0x0000_0100;
5180
5181pub const FAN_MARK_IGNORE_SURV: c_uint = FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY;
5182
5183pub const FANOTIFY_METADATA_VERSION: u8 = 3;
5184
5185pub const FAN_EVENT_INFO_TYPE_FID: u8 = 1;
5186pub const FAN_EVENT_INFO_TYPE_DFID_NAME: u8 = 2;
5187pub const FAN_EVENT_INFO_TYPE_DFID: u8 = 3;
5188pub const FAN_EVENT_INFO_TYPE_PIDFD: u8 = 4;
5189pub const FAN_EVENT_INFO_TYPE_ERROR: u8 = 5;
5190
5191pub const FAN_EVENT_INFO_TYPE_OLD_DFID_NAME: u8 = 10;
5192pub const FAN_EVENT_INFO_TYPE_NEW_DFID_NAME: u8 = 12;
5193
5194pub const FAN_RESPONSE_INFO_NONE: u8 = 0;
5195pub const FAN_RESPONSE_INFO_AUDIT_RULE: u8 = 1;
5196
5197pub const FAN_ALLOW: u32 = 0x01;
5198pub const FAN_DENY: u32 = 0x02;
5199pub const FAN_AUDIT: u32 = 0x10;
5200pub const FAN_INFO: u32 = 0x20;
5201
5202pub const FAN_NOFD: c_int = -1;
5203pub const FAN_NOPIDFD: c_int = FAN_NOFD;
5204pub const FAN_EPIDFD: c_int = -2;
5205
5206// linux/futex.h
5207pub const FUTEX_WAIT: c_int = 0;
5208pub const FUTEX_WAKE: c_int = 1;
5209pub const FUTEX_FD: c_int = 2;
5210pub const FUTEX_REQUEUE: c_int = 3;
5211pub const FUTEX_CMP_REQUEUE: c_int = 4;
5212pub const FUTEX_WAKE_OP: c_int = 5;
5213pub const FUTEX_LOCK_PI: c_int = 6;
5214pub const FUTEX_UNLOCK_PI: c_int = 7;
5215pub const FUTEX_TRYLOCK_PI: c_int = 8;
5216pub const FUTEX_WAIT_BITSET: c_int = 9;
5217pub const FUTEX_WAKE_BITSET: c_int = 10;
5218pub const FUTEX_WAIT_REQUEUE_PI: c_int = 11;
5219pub const FUTEX_CMP_REQUEUE_PI: c_int = 12;
5220pub const FUTEX_LOCK_PI2: c_int = 13;
5221
5222pub const FUTEX_PRIVATE_FLAG: c_int = 128;
5223pub const FUTEX_CLOCK_REALTIME: c_int = 256;
5224pub const FUTEX_CMD_MASK: c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
5225
5226pub const FUTEX_WAITERS: u32 = 0x80000000;
5227pub const FUTEX_OWNER_DIED: u32 = 0x40000000;
5228pub const FUTEX_TID_MASK: u32 = 0x3fffffff;
5229
5230pub const FUTEX_BITSET_MATCH_ANY: c_int = 0xffffffff;
5231
5232pub const FUTEX_OP_SET: c_int = 0;
5233pub const FUTEX_OP_ADD: c_int = 1;
5234pub const FUTEX_OP_OR: c_int = 2;
5235pub const FUTEX_OP_ANDN: c_int = 3;
5236pub const FUTEX_OP_XOR: c_int = 4;
5237
5238pub const FUTEX_OP_OPARG_SHIFT: c_int = 8;
5239
5240pub const FUTEX_OP_CMP_EQ: c_int = 0;
5241pub const FUTEX_OP_CMP_NE: c_int = 1;
5242pub const FUTEX_OP_CMP_LT: c_int = 2;
5243pub const FUTEX_OP_CMP_LE: c_int = 3;
5244pub const FUTEX_OP_CMP_GT: c_int = 4;
5245pub const FUTEX_OP_CMP_GE: c_int = 5;
5246
5247pub fn FUTEX_OP(op: c_int, oparg: c_int, cmp: c_int, cmparg: c_int) -> c_int {
5248    ((op & 0xf) << 28) | ((cmp & 0xf) << 24) | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)
5249}
5250
5251// linux/kexec.h
5252pub const KEXEC_ON_CRASH: c_int = 0x00000001;
5253pub const KEXEC_PRESERVE_CONTEXT: c_int = 0x00000002;
5254pub const KEXEC_ARCH_MASK: c_int = 0xffff0000;
5255pub const KEXEC_FILE_UNLOAD: c_int = 0x00000001;
5256pub const KEXEC_FILE_ON_CRASH: c_int = 0x00000002;
5257pub const KEXEC_FILE_NO_INITRAMFS: c_int = 0x00000004;
5258
5259// linux/reboot.h
5260pub const LINUX_REBOOT_MAGIC1: c_int = 0xfee1dead;
5261pub const LINUX_REBOOT_MAGIC2: c_int = 672274793;
5262pub const LINUX_REBOOT_MAGIC2A: c_int = 85072278;
5263pub const LINUX_REBOOT_MAGIC2B: c_int = 369367448;
5264pub const LINUX_REBOOT_MAGIC2C: c_int = 537993216;
5265
5266pub const LINUX_REBOOT_CMD_RESTART: c_int = 0x01234567;
5267pub const LINUX_REBOOT_CMD_HALT: c_int = 0xCDEF0123;
5268pub const LINUX_REBOOT_CMD_CAD_ON: c_int = 0x89ABCDEF;
5269pub const LINUX_REBOOT_CMD_CAD_OFF: c_int = 0x00000000;
5270pub const LINUX_REBOOT_CMD_POWER_OFF: c_int = 0x4321FEDC;
5271pub const LINUX_REBOOT_CMD_RESTART2: c_int = 0xA1B2C3D4;
5272pub const LINUX_REBOOT_CMD_SW_SUSPEND: c_int = 0xD000FCE2;
5273pub const LINUX_REBOOT_CMD_KEXEC: c_int = 0x45584543;
5274
5275pub const REG_EXTENDED: c_int = 1;
5276pub const REG_ICASE: c_int = 2;
5277pub const REG_NEWLINE: c_int = 4;
5278pub const REG_NOSUB: c_int = 8;
5279
5280pub const REG_NOTBOL: c_int = 1;
5281pub const REG_NOTEOL: c_int = 2;
5282
5283pub const REG_ENOSYS: c_int = -1;
5284pub const REG_NOMATCH: c_int = 1;
5285pub const REG_BADPAT: c_int = 2;
5286pub const REG_ECOLLATE: c_int = 3;
5287pub const REG_ECTYPE: c_int = 4;
5288pub const REG_EESCAPE: c_int = 5;
5289pub const REG_ESUBREG: c_int = 6;
5290pub const REG_EBRACK: c_int = 7;
5291pub const REG_EPAREN: c_int = 8;
5292pub const REG_EBRACE: c_int = 9;
5293pub const REG_BADBR: c_int = 10;
5294pub const REG_ERANGE: c_int = 11;
5295pub const REG_ESPACE: c_int = 12;
5296pub const REG_BADRPT: c_int = 13;
5297
5298// linux/errqueue.h
5299pub const SO_EE_ORIGIN_NONE: u8 = 0;
5300pub const SO_EE_ORIGIN_LOCAL: u8 = 1;
5301pub const SO_EE_ORIGIN_ICMP: u8 = 2;
5302pub const SO_EE_ORIGIN_ICMP6: u8 = 3;
5303pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4;
5304pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS;
5305
5306// errno.h
5307pub const EPERM: c_int = 1;
5308pub const ENOENT: c_int = 2;
5309pub const ESRCH: c_int = 3;
5310pub const EINTR: c_int = 4;
5311pub const EIO: c_int = 5;
5312pub const ENXIO: c_int = 6;
5313pub const E2BIG: c_int = 7;
5314pub const ENOEXEC: c_int = 8;
5315pub const EBADF: c_int = 9;
5316pub const ECHILD: c_int = 10;
5317pub const EAGAIN: c_int = 11;
5318pub const ENOMEM: c_int = 12;
5319pub const EACCES: c_int = 13;
5320pub const EFAULT: c_int = 14;
5321pub const ENOTBLK: c_int = 15;
5322pub const EBUSY: c_int = 16;
5323pub const EEXIST: c_int = 17;
5324pub const EXDEV: c_int = 18;
5325pub const ENODEV: c_int = 19;
5326pub const ENOTDIR: c_int = 20;
5327pub const EISDIR: c_int = 21;
5328pub const EINVAL: c_int = 22;
5329pub const ENFILE: c_int = 23;
5330pub const EMFILE: c_int = 24;
5331pub const ENOTTY: c_int = 25;
5332pub const ETXTBSY: c_int = 26;
5333pub const EFBIG: c_int = 27;
5334pub const ENOSPC: c_int = 28;
5335pub const ESPIPE: c_int = 29;
5336pub const EROFS: c_int = 30;
5337pub const EMLINK: c_int = 31;
5338pub const EPIPE: c_int = 32;
5339pub const EDOM: c_int = 33;
5340pub const ERANGE: c_int = 34;
5341pub const EWOULDBLOCK: c_int = EAGAIN;
5342
5343// linux/sctp.h
5344pub const SCTP_FUTURE_ASSOC: c_int = 0;
5345pub const SCTP_CURRENT_ASSOC: c_int = 1;
5346pub const SCTP_ALL_ASSOC: c_int = 2;
5347pub const SCTP_RTOINFO: c_int = 0;
5348pub const SCTP_ASSOCINFO: c_int = 1;
5349pub const SCTP_INITMSG: c_int = 2;
5350pub const SCTP_NODELAY: c_int = 3;
5351pub const SCTP_AUTOCLOSE: c_int = 4;
5352pub const SCTP_SET_PEER_PRIMARY_ADDR: c_int = 5;
5353pub const SCTP_PRIMARY_ADDR: c_int = 6;
5354pub const SCTP_ADAPTATION_LAYER: c_int = 7;
5355pub const SCTP_DISABLE_FRAGMENTS: c_int = 8;
5356pub const SCTP_PEER_ADDR_PARAMS: c_int = 9;
5357pub const SCTP_DEFAULT_SEND_PARAM: c_int = 10;
5358pub const SCTP_EVENTS: c_int = 11;
5359pub const SCTP_I_WANT_MAPPED_V4_ADDR: c_int = 12;
5360pub const SCTP_MAXSEG: c_int = 13;
5361pub const SCTP_STATUS: c_int = 14;
5362pub const SCTP_GET_PEER_ADDR_INFO: c_int = 15;
5363pub const SCTP_DELAYED_ACK_TIME: c_int = 16;
5364pub const SCTP_DELAYED_ACK: c_int = SCTP_DELAYED_ACK_TIME;
5365pub const SCTP_DELAYED_SACK: c_int = SCTP_DELAYED_ACK_TIME;
5366pub const SCTP_CONTEXT: c_int = 17;
5367pub const SCTP_FRAGMENT_INTERLEAVE: c_int = 18;
5368pub const SCTP_PARTIAL_DELIVERY_POINT: c_int = 19;
5369pub const SCTP_MAX_BURST: c_int = 20;
5370pub const SCTP_AUTH_CHUNK: c_int = 21;
5371pub const SCTP_HMAC_IDENT: c_int = 22;
5372pub const SCTP_AUTH_KEY: c_int = 23;
5373pub const SCTP_AUTH_ACTIVE_KEY: c_int = 24;
5374pub const SCTP_AUTH_DELETE_KEY: c_int = 25;
5375pub const SCTP_PEER_AUTH_CHUNKS: c_int = 26;
5376pub const SCTP_LOCAL_AUTH_CHUNKS: c_int = 27;
5377pub const SCTP_GET_ASSOC_NUMBER: c_int = 28;
5378pub const SCTP_GET_ASSOC_ID_LIST: c_int = 29;
5379pub const SCTP_AUTO_ASCONF: c_int = 30;
5380pub const SCTP_PEER_ADDR_THLDS: c_int = 31;
5381pub const SCTP_RECVRCVINFO: c_int = 32;
5382pub const SCTP_RECVNXTINFO: c_int = 33;
5383pub const SCTP_DEFAULT_SNDINFO: c_int = 34;
5384pub const SCTP_AUTH_DEACTIVATE_KEY: c_int = 35;
5385pub const SCTP_REUSE_PORT: c_int = 36;
5386pub const SCTP_PEER_ADDR_THLDS_V2: c_int = 37;
5387pub const SCTP_PR_SCTP_NONE: c_int = 0x0000;
5388pub const SCTP_PR_SCTP_TTL: c_int = 0x0010;
5389pub const SCTP_PR_SCTP_RTX: c_int = 0x0020;
5390pub const SCTP_PR_SCTP_PRIO: c_int = 0x0030;
5391pub const SCTP_PR_SCTP_MAX: c_int = SCTP_PR_SCTP_PRIO;
5392pub const SCTP_PR_SCTP_MASK: c_int = 0x0030;
5393pub const SCTP_ENABLE_RESET_STREAM_REQ: c_int = 0x01;
5394pub const SCTP_ENABLE_RESET_ASSOC_REQ: c_int = 0x02;
5395pub const SCTP_ENABLE_CHANGE_ASSOC_REQ: c_int = 0x04;
5396pub const SCTP_ENABLE_STRRESET_MASK: c_int = 0x07;
5397pub const SCTP_STREAM_RESET_INCOMING: c_int = 0x01;
5398pub const SCTP_STREAM_RESET_OUTGOING: c_int = 0x02;
5399
5400pub const SCTP_INIT: c_int = 0;
5401pub const SCTP_SNDRCV: c_int = 1;
5402pub const SCTP_SNDINFO: c_int = 2;
5403pub const SCTP_RCVINFO: c_int = 3;
5404pub const SCTP_NXTINFO: c_int = 4;
5405pub const SCTP_PRINFO: c_int = 5;
5406pub const SCTP_AUTHINFO: c_int = 6;
5407pub const SCTP_DSTADDRV4: c_int = 7;
5408pub const SCTP_DSTADDRV6: c_int = 8;
5409
5410pub const SCTP_UNORDERED: c_int = 1 << 0;
5411pub const SCTP_ADDR_OVER: c_int = 1 << 1;
5412pub const SCTP_ABORT: c_int = 1 << 2;
5413pub const SCTP_SACK_IMMEDIATELY: c_int = 1 << 3;
5414pub const SCTP_SENDALL: c_int = 1 << 6;
5415pub const SCTP_PR_SCTP_ALL: c_int = 1 << 7;
5416pub const SCTP_NOTIFICATION: c_int = MSG_NOTIFICATION;
5417pub const SCTP_EOF: c_int = crate::MSG_FIN;
5418
5419/* DCCP socket options */
5420pub const DCCP_SOCKOPT_PACKET_SIZE: c_int = 1;
5421pub const DCCP_SOCKOPT_SERVICE: c_int = 2;
5422pub const DCCP_SOCKOPT_CHANGE_L: c_int = 3;
5423pub const DCCP_SOCKOPT_CHANGE_R: c_int = 4;
5424pub const DCCP_SOCKOPT_GET_CUR_MPS: c_int = 5;
5425pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: c_int = 6;
5426pub const DCCP_SOCKOPT_SEND_CSCOV: c_int = 10;
5427pub const DCCP_SOCKOPT_RECV_CSCOV: c_int = 11;
5428pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: c_int = 12;
5429pub const DCCP_SOCKOPT_CCID: c_int = 13;
5430pub const DCCP_SOCKOPT_TX_CCID: c_int = 14;
5431pub const DCCP_SOCKOPT_RX_CCID: c_int = 15;
5432pub const DCCP_SOCKOPT_QPOLICY_ID: c_int = 16;
5433pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: c_int = 17;
5434pub const DCCP_SOCKOPT_CCID_RX_INFO: c_int = 128;
5435pub const DCCP_SOCKOPT_CCID_TX_INFO: c_int = 192;
5436
5437/// maximum number of services provided on the same listening port
5438pub const DCCP_SERVICE_LIST_MAX_LEN: c_int = 32;
5439
5440pub const CTL_KERN: c_int = 1;
5441pub const CTL_VM: c_int = 2;
5442pub const CTL_NET: c_int = 3;
5443pub const CTL_FS: c_int = 5;
5444pub const CTL_DEBUG: c_int = 6;
5445pub const CTL_DEV: c_int = 7;
5446pub const CTL_BUS: c_int = 8;
5447pub const CTL_ABI: c_int = 9;
5448pub const CTL_CPU: c_int = 10;
5449
5450pub const CTL_BUS_ISA: c_int = 1;
5451
5452pub const INOTIFY_MAX_USER_INSTANCES: c_int = 1;
5453pub const INOTIFY_MAX_USER_WATCHES: c_int = 2;
5454pub const INOTIFY_MAX_QUEUED_EVENTS: c_int = 3;
5455
5456pub const KERN_OSTYPE: c_int = 1;
5457pub const KERN_OSRELEASE: c_int = 2;
5458pub const KERN_OSREV: c_int = 3;
5459pub const KERN_VERSION: c_int = 4;
5460pub const KERN_SECUREMASK: c_int = 5;
5461pub const KERN_PROF: c_int = 6;
5462pub const KERN_NODENAME: c_int = 7;
5463pub const KERN_DOMAINNAME: c_int = 8;
5464pub const KERN_PANIC: c_int = 15;
5465pub const KERN_REALROOTDEV: c_int = 16;
5466pub const KERN_SPARC_REBOOT: c_int = 21;
5467pub const KERN_CTLALTDEL: c_int = 22;
5468pub const KERN_PRINTK: c_int = 23;
5469pub const KERN_NAMETRANS: c_int = 24;
5470pub const KERN_PPC_HTABRECLAIM: c_int = 25;
5471pub const KERN_PPC_ZEROPAGED: c_int = 26;
5472pub const KERN_PPC_POWERSAVE_NAP: c_int = 27;
5473pub const KERN_MODPROBE: c_int = 28;
5474pub const KERN_SG_BIG_BUFF: c_int = 29;
5475pub const KERN_ACCT: c_int = 30;
5476pub const KERN_PPC_L2CR: c_int = 31;
5477pub const KERN_RTSIGNR: c_int = 32;
5478pub const KERN_RTSIGMAX: c_int = 33;
5479pub const KERN_SHMMAX: c_int = 34;
5480pub const KERN_MSGMAX: c_int = 35;
5481pub const KERN_MSGMNB: c_int = 36;
5482pub const KERN_MSGPOOL: c_int = 37;
5483pub const KERN_SYSRQ: c_int = 38;
5484pub const KERN_MAX_THREADS: c_int = 39;
5485pub const KERN_RANDOM: c_int = 40;
5486pub const KERN_SHMALL: c_int = 41;
5487pub const KERN_MSGMNI: c_int = 42;
5488pub const KERN_SEM: c_int = 43;
5489pub const KERN_SPARC_STOP_A: c_int = 44;
5490pub const KERN_SHMMNI: c_int = 45;
5491pub const KERN_OVERFLOWUID: c_int = 46;
5492pub const KERN_OVERFLOWGID: c_int = 47;
5493pub const KERN_SHMPATH: c_int = 48;
5494pub const KERN_HOTPLUG: c_int = 49;
5495pub const KERN_IEEE_EMULATION_WARNINGS: c_int = 50;
5496pub const KERN_S390_USER_DEBUG_LOGGING: c_int = 51;
5497pub const KERN_CORE_USES_PID: c_int = 52;
5498pub const KERN_TAINTED: c_int = 53;
5499pub const KERN_CADPID: c_int = 54;
5500pub const KERN_PIDMAX: c_int = 55;
5501pub const KERN_CORE_PATTERN: c_int = 56;
5502pub const KERN_PANIC_ON_OOPS: c_int = 57;
5503pub const KERN_HPPA_PWRSW: c_int = 58;
5504pub const KERN_HPPA_UNALIGNED: c_int = 59;
5505pub const KERN_PRINTK_RATELIMIT: c_int = 60;
5506pub const KERN_PRINTK_RATELIMIT_BURST: c_int = 61;
5507pub const KERN_PTY: c_int = 62;
5508pub const KERN_NGROUPS_MAX: c_int = 63;
5509pub const KERN_SPARC_SCONS_PWROFF: c_int = 64;
5510pub const KERN_HZ_TIMER: c_int = 65;
5511pub const KERN_UNKNOWN_NMI_PANIC: c_int = 66;
5512pub const KERN_BOOTLOADER_TYPE: c_int = 67;
5513pub const KERN_RANDOMIZE: c_int = 68;
5514pub const KERN_SETUID_DUMPABLE: c_int = 69;
5515pub const KERN_SPIN_RETRY: c_int = 70;
5516pub const KERN_ACPI_VIDEO_FLAGS: c_int = 71;
5517pub const KERN_IA64_UNALIGNED: c_int = 72;
5518pub const KERN_COMPAT_LOG: c_int = 73;
5519pub const KERN_MAX_LOCK_DEPTH: c_int = 74;
5520pub const KERN_NMI_WATCHDOG: c_int = 75;
5521pub const KERN_PANIC_ON_NMI: c_int = 76;
5522
5523pub const VM_OVERCOMMIT_MEMORY: c_int = 5;
5524pub const VM_PAGE_CLUSTER: c_int = 10;
5525pub const VM_DIRTY_BACKGROUND: c_int = 11;
5526pub const VM_DIRTY_RATIO: c_int = 12;
5527pub const VM_DIRTY_WB_CS: c_int = 13;
5528pub const VM_DIRTY_EXPIRE_CS: c_int = 14;
5529pub const VM_NR_PDFLUSH_THREADS: c_int = 15;
5530pub const VM_OVERCOMMIT_RATIO: c_int = 16;
5531pub const VM_PAGEBUF: c_int = 17;
5532pub const VM_HUGETLB_PAGES: c_int = 18;
5533pub const VM_SWAPPINESS: c_int = 19;
5534pub const VM_LOWMEM_RESERVE_RATIO: c_int = 20;
5535pub const VM_MIN_FREE_KBYTES: c_int = 21;
5536pub const VM_MAX_MAP_COUNT: c_int = 22;
5537pub const VM_LAPTOP_MODE: c_int = 23;
5538pub const VM_BLOCK_DUMP: c_int = 24;
5539pub const VM_HUGETLB_GROUP: c_int = 25;
5540pub const VM_VFS_CACHE_PRESSURE: c_int = 26;
5541pub const VM_LEGACY_VA_LAYOUT: c_int = 27;
5542pub const VM_SWAP_TOKEN_TIMEOUT: c_int = 28;
5543pub const VM_DROP_PAGECACHE: c_int = 29;
5544pub const VM_PERCPU_PAGELIST_FRACTION: c_int = 30;
5545pub const VM_ZONE_RECLAIM_MODE: c_int = 31;
5546pub const VM_MIN_UNMAPPED: c_int = 32;
5547pub const VM_PANIC_ON_OOM: c_int = 33;
5548pub const VM_VDSO_ENABLED: c_int = 34;
5549pub const VM_MIN_SLAB: c_int = 35;
5550
5551pub const NET_CORE: c_int = 1;
5552pub const NET_ETHER: c_int = 2;
5553pub const NET_802: c_int = 3;
5554pub const NET_UNIX: c_int = 4;
5555pub const NET_IPV4: c_int = 5;
5556pub const NET_IPX: c_int = 6;
5557pub const NET_ATALK: c_int = 7;
5558pub const NET_NETROM: c_int = 8;
5559pub const NET_AX25: c_int = 9;
5560pub const NET_BRIDGE: c_int = 10;
5561pub const NET_ROSE: c_int = 11;
5562pub const NET_IPV6: c_int = 12;
5563pub const NET_X25: c_int = 13;
5564pub const NET_TR: c_int = 14;
5565pub const NET_DECNET: c_int = 15;
5566pub const NET_ECONET: c_int = 16;
5567pub const NET_SCTP: c_int = 17;
5568pub const NET_LLC: c_int = 18;
5569pub const NET_NETFILTER: c_int = 19;
5570pub const NET_DCCP: c_int = 20;
5571pub const NET_IRDA: c_int = 412;
5572
5573// include/linux/sched.h
5574/// I'm a virtual CPU.
5575pub const PF_VCPU: c_int = 0x00000001;
5576/// I am an IDLE thread.
5577pub const PF_IDLE: c_int = 0x00000002;
5578/// Getting shut down.
5579pub const PF_EXITING: c_int = 0x00000004;
5580/// Coredumps should ignore this task.
5581pub const PF_POSTCOREDUMP: c_int = 0x00000008;
5582/// Task is an IO worker.
5583pub const PF_IO_WORKER: c_int = 0x00000010;
5584/// I'm a workqueue worker.
5585pub const PF_WQ_WORKER: c_int = 0x00000020;
5586/// Forked but didn't exec.
5587pub const PF_FORKNOEXEC: c_int = 0x00000040;
5588/// Process policy on mce errors.
5589pub const PF_MCE_PROCESS: c_int = 0x00000080;
5590/// Used super-user privileges.
5591pub const PF_SUPERPRIV: c_int = 0x00000100;
5592/// Dumped core.
5593pub const PF_DUMPCORE: c_int = 0x00000200;
5594/// Killed by a signal.
5595pub const PF_SIGNALED: c_int = 0x00000400;
5596/// Allocating memory to free memory.
5597///
5598/// See `memalloc_noreclaim_save()`.
5599pub const PF_MEMALLOC: c_int = 0x00000800;
5600/// `set_user()` noticed that `RLIMIT_NPROC` was exceeded.
5601pub const PF_NPROC_EXCEEDED: c_int = 0x00001000;
5602/// If unset the fpu must be initialized before use.
5603pub const PF_USED_MATH: c_int = 0x00002000;
5604/// Kernel thread cloned from userspace thread.
5605pub const PF_USER_WORKER: c_int = 0x00004000;
5606/// This thread should not be frozen.
5607pub const PF_NOFREEZE: c_int = 0x00008000;
5608/// I am `kswapd`.
5609pub const PF_KSWAPD: c_int = 0x00020000;
5610/// All allocations inherit `GFP_NOFS`.
5611///
5612/// See `memalloc_nfs_save()`.
5613pub const PF_MEMALLOC_NOFS: c_int = 0x00040000;
5614/// All allocations inherit `GFP_NOIO`.
5615///
5616/// See `memalloc_noio_save()`.
5617pub const PF_MEMALLOC_NOIO: c_int = 0x00080000;
5618/// Throttle writes only against the bdi I write to, I am cleaning
5619/// dirty pages from some other bdi.
5620pub const PF_LOCAL_THROTTLE: c_int = 0x00100000;
5621/// I am a kernel thread.
5622pub const PF_KTHREAD: c_int = 0x00200000;
5623/// Randomize virtual address space.
5624pub const PF_RANDOMIZE: c_int = 0x00400000;
5625/// Userland is not allowed to meddle with `cpus_mask`.
5626pub const PF_NO_SETAFFINITY: c_int = 0x04000000;
5627/// Early kill for mce process policy.
5628pub const PF_MCE_EARLY: c_int = 0x08000000;
5629/// Allocations constrained to zones which allow long term pinning.
5630///
5631/// See `memalloc_pin_save()`.
5632pub const PF_MEMALLOC_PIN: c_int = 0x10000000;
5633/// Plug has ts that needs updating.
5634pub const PF_BLOCK_TS: c_int = 0x20000000;
5635/// This thread called `freeze_processes()` and should not be frozen.
5636pub const PF_SUSPEND_TASK: c_int = PF_SUSPEND_TASK_UINT as _;
5637// The used value is the highest possible bit fitting on 32 bits, so directly
5638// defining it as a signed integer causes the compiler to report an overflow.
5639// Use instead a private intermediary that assuringly has the correct type and
5640// cast it where necessary to the wanted final type, which preserves the
5641// desired information as-is in terms of integer representation.
5642const PF_SUSPEND_TASK_UINT: c_uint = 0x80000000;
5643
5644pub const CSIGNAL: c_int = 0x000000ff;
5645
5646pub const SCHED_NORMAL: c_int = 0;
5647pub const SCHED_OTHER: c_int = 0;
5648pub const SCHED_FIFO: c_int = 1;
5649pub const SCHED_RR: c_int = 2;
5650pub const SCHED_BATCH: c_int = 3;
5651pub const SCHED_IDLE: c_int = 5;
5652pub const SCHED_DEADLINE: c_int = 6;
5653
5654pub const SCHED_RESET_ON_FORK: c_int = 0x40000000;
5655
5656pub const CLONE_PIDFD: c_int = 0x1000;
5657
5658pub const SCHED_FLAG_RESET_ON_FORK: c_int = 0x01;
5659pub const SCHED_FLAG_RECLAIM: c_int = 0x02;
5660pub const SCHED_FLAG_DL_OVERRUN: c_int = 0x04;
5661pub const SCHED_FLAG_KEEP_POLICY: c_int = 0x08;
5662pub const SCHED_FLAG_KEEP_PARAMS: c_int = 0x10;
5663pub const SCHED_FLAG_UTIL_CLAMP_MIN: c_int = 0x20;
5664pub const SCHED_FLAG_UTIL_CLAMP_MAX: c_int = 0x40;
5665
5666// linux/if_xdp.h
5667pub const XDP_SHARED_UMEM: crate::__u16 = 1 << 0;
5668pub const XDP_COPY: crate::__u16 = 1 << 1;
5669pub const XDP_ZEROCOPY: crate::__u16 = 1 << 2;
5670pub const XDP_USE_NEED_WAKEUP: crate::__u16 = 1 << 3;
5671pub const XDP_USE_SG: crate::__u16 = 1 << 4;
5672
5673pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: crate::__u32 = 1 << 0;
5674
5675pub const XDP_RING_NEED_WAKEUP: crate::__u32 = 1 << 0;
5676
5677pub const XDP_MMAP_OFFSETS: c_int = 1;
5678pub const XDP_RX_RING: c_int = 2;
5679pub const XDP_TX_RING: c_int = 3;
5680pub const XDP_UMEM_REG: c_int = 4;
5681pub const XDP_UMEM_FILL_RING: c_int = 5;
5682pub const XDP_UMEM_COMPLETION_RING: c_int = 6;
5683pub const XDP_STATISTICS: c_int = 7;
5684pub const XDP_OPTIONS: c_int = 8;
5685
5686pub const XDP_OPTIONS_ZEROCOPY: crate::__u32 = 1 << 0;
5687
5688pub const XDP_PGOFF_RX_RING: crate::off_t = 0;
5689pub const XDP_PGOFF_TX_RING: crate::off_t = 0x80000000;
5690pub const XDP_UMEM_PGOFF_FILL_RING: crate::c_ulonglong = 0x100000000;
5691pub const XDP_UMEM_PGOFF_COMPLETION_RING: crate::c_ulonglong = 0x180000000;
5692
5693pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: crate::c_int = 48;
5694pub const XSK_UNALIGNED_BUF_ADDR_MASK: crate::c_ulonglong =
5695    (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1;
5696
5697pub const XDP_PKT_CONTD: crate::__u32 = 1 << 0;
5698
5699pub const XDP_UMEM_TX_SW_CSUM: crate::__u32 = 1 << 1;
5700pub const XDP_UMEM_TX_METADATA_LEN: crate::__u32 = 1 << 2;
5701
5702pub const XDP_TXMD_FLAGS_TIMESTAMP: crate::__u32 = 1 << 0;
5703pub const XDP_TXMD_FLAGS_CHECKSUM: crate::__u32 = 1 << 1;
5704
5705pub const XDP_TX_METADATA: crate::__u32 = 1 << 1;
5706
5707pub const SOL_XDP: c_int = 283;
5708
5709// linux/mount.h
5710pub const MOUNT_ATTR_RDONLY: crate::__u64 = 0x00000001;
5711pub const MOUNT_ATTR_NOSUID: crate::__u64 = 0x00000002;
5712pub const MOUNT_ATTR_NODEV: crate::__u64 = 0x00000004;
5713pub const MOUNT_ATTR_NOEXEC: crate::__u64 = 0x00000008;
5714pub const MOUNT_ATTR__ATIME: crate::__u64 = 0x00000070;
5715pub const MOUNT_ATTR_RELATIME: crate::__u64 = 0x00000000;
5716pub const MOUNT_ATTR_NOATIME: crate::__u64 = 0x00000010;
5717pub const MOUNT_ATTR_STRICTATIME: crate::__u64 = 0x00000020;
5718pub const MOUNT_ATTR_NODIRATIME: crate::__u64 = 0x00000080;
5719pub const MOUNT_ATTR_IDMAP: crate::__u64 = 0x00100000;
5720pub const MOUNT_ATTR_NOSYMFOLLOW: crate::__u64 = 0x00200000;
5721
5722pub const MOUNT_ATTR_SIZE_VER0: c_int = 32;
5723
5724// elf.h
5725pub const NT_PRSTATUS: c_int = 1;
5726pub const NT_PRFPREG: c_int = 2;
5727pub const NT_FPREGSET: c_int = 2;
5728pub const NT_PRPSINFO: c_int = 3;
5729pub const NT_PRXREG: c_int = 4;
5730pub const NT_TASKSTRUCT: c_int = 4;
5731pub const NT_PLATFORM: c_int = 5;
5732pub const NT_AUXV: c_int = 6;
5733pub const NT_GWINDOWS: c_int = 7;
5734pub const NT_ASRS: c_int = 8;
5735pub const NT_PSTATUS: c_int = 10;
5736pub const NT_PSINFO: c_int = 13;
5737pub const NT_PRCRED: c_int = 14;
5738pub const NT_UTSNAME: c_int = 15;
5739pub const NT_LWPSTATUS: c_int = 16;
5740pub const NT_LWPSINFO: c_int = 17;
5741pub const NT_PRFPXREG: c_int = 20;
5742
5743pub const SCHED_FLAG_KEEP_ALL: c_int = SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS;
5744
5745pub const SCHED_FLAG_UTIL_CLAMP: c_int = SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX;
5746
5747pub const SCHED_FLAG_ALL: c_int = SCHED_FLAG_RESET_ON_FORK
5748    | SCHED_FLAG_RECLAIM
5749    | SCHED_FLAG_DL_OVERRUN
5750    | SCHED_FLAG_KEEP_ALL
5751    | SCHED_FLAG_UTIL_CLAMP;
5752
5753// ioctl_eventpoll: added in Linux 6.9
5754pub const EPIOCSPARAMS: Ioctl = 0x40088a01;
5755pub const EPIOCGPARAMS: Ioctl = 0x80088a02;
5756
5757// siginfo.h
5758pub const SI_DETHREAD: c_int = -7;
5759pub const TRAP_PERF: c_int = 6;
5760
5761f! {
5762    pub fn NLA_ALIGN(len: c_int) -> c_int {
5763        return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1);
5764    }
5765
5766    pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
5767        if ((*cmsg).cmsg_len as usize) < size_of::<cmsghdr>() {
5768            return core::ptr::null_mut::<cmsghdr>();
5769        }
5770        let next = (cmsg as usize + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
5771        let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
5772        if (next.wrapping_offset(1)) as usize > max
5773            || next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max
5774        {
5775            core::ptr::null_mut::<cmsghdr>()
5776        } else {
5777            next
5778        }
5779    }
5780
5781    pub fn CPU_ALLOC_SIZE(count: c_int) -> size_t {
5782        let _dummy: cpu_set_t = mem::zeroed();
5783        let size_in_bits = 8 * size_of_val(&_dummy.bits[0]);
5784        ((count as size_t + size_in_bits - 1) / 8) as size_t
5785    }
5786
5787    pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
5788        for slot in &mut cpuset.bits {
5789            *slot = 0;
5790        }
5791    }
5792
5793    pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
5794        let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc
5795        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
5796        cpuset.bits[idx] |= 1 << offset;
5797    }
5798
5799    pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
5800        let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc
5801        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
5802        cpuset.bits[idx] &= !(1 << offset);
5803    }
5804
5805    pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
5806        let size_in_bits = 8 * size_of_val(&cpuset.bits[0]);
5807        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
5808        0 != (cpuset.bits[idx] & (1 << offset))
5809    }
5810
5811    pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int {
5812        let mut s: u32 = 0;
5813        let size_of_mask = size_of_val(&cpuset.bits[0]);
5814        for i in &cpuset.bits[..(size / size_of_mask)] {
5815            s += i.count_ones();
5816        }
5817        s as c_int
5818    }
5819
5820    pub fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int {
5821        CPU_COUNT_S(size_of::<cpu_set_t>(), cpuset)
5822    }
5823
5824    pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
5825        set1.bits == set2.bits
5826    }
5827
5828    pub fn SCTP_PR_INDEX(policy: c_int) -> c_int {
5829        policy >> (4 - 1)
5830    }
5831
5832    pub fn SCTP_PR_POLICY(policy: c_int) -> c_int {
5833        policy & SCTP_PR_SCTP_MASK
5834    }
5835
5836    pub fn SCTP_PR_SET_POLICY(flags: &mut c_int, policy: c_int) -> () {
5837        *flags &= !SCTP_PR_SCTP_MASK;
5838        *flags |= policy;
5839    }
5840
5841    pub fn IPTOS_TOS(tos: u8) -> u8 {
5842        tos & IPTOS_TOS_MASK
5843    }
5844
5845    pub fn IPTOS_PREC(tos: u8) -> u8 {
5846        tos & IPTOS_PREC_MASK
5847    }
5848
5849    pub fn RT_TOS(tos: u8) -> u8 {
5850        tos & crate::IPTOS_TOS_MASK
5851    }
5852
5853    pub fn RT_ADDRCLASS(flags: u32) -> u32 {
5854        flags >> 23
5855    }
5856
5857    pub fn RT_LOCALADDR(flags: u32) -> bool {
5858        (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE)
5859    }
5860
5861    pub fn SO_EE_OFFENDER(ee: *const crate::sock_extended_err) -> *mut crate::sockaddr {
5862        ee.offset(1) as *mut crate::sockaddr
5863    }
5864
5865    pub fn TPACKET_ALIGN(x: usize) -> usize {
5866        (x + TPACKET_ALIGNMENT - 1) & !(TPACKET_ALIGNMENT - 1)
5867    }
5868
5869    pub fn BPF_CLASS(code: __u32) -> __u32 {
5870        code & 0x07
5871    }
5872
5873    pub fn BPF_SIZE(code: __u32) -> __u32 {
5874        code & 0x18
5875    }
5876
5877    pub fn BPF_MODE(code: __u32) -> __u32 {
5878        code & 0xe0
5879    }
5880
5881    pub fn BPF_OP(code: __u32) -> __u32 {
5882        code & 0xf0
5883    }
5884
5885    pub fn BPF_SRC(code: __u32) -> __u32 {
5886        code & 0x08
5887    }
5888
5889    pub fn BPF_RVAL(code: __u32) -> __u32 {
5890        code & 0x18
5891    }
5892
5893    pub fn BPF_MISCOP(code: __u32) -> __u32 {
5894        code & 0xf8
5895    }
5896
5897    pub fn BPF_STMT(code: __u16, k: __u32) -> sock_filter {
5898        sock_filter {
5899            code,
5900            jt: 0,
5901            jf: 0,
5902            k,
5903        }
5904    }
5905
5906    pub fn BPF_JUMP(code: __u16, k: __u32, jt: __u8, jf: __u8) -> sock_filter {
5907        sock_filter { code, jt, jf, k }
5908    }
5909
5910    pub fn ELF32_R_SYM(val: Elf32_Word) -> Elf32_Word {
5911        val >> 8
5912    }
5913
5914    pub fn ELF32_R_TYPE(val: Elf32_Word) -> Elf32_Word {
5915        val & 0xff
5916    }
5917
5918    pub fn ELF32_R_INFO(sym: Elf32_Word, t: Elf32_Word) -> Elf32_Word {
5919        sym << (8 + t) & 0xff
5920    }
5921
5922    pub fn ELF64_R_SYM(val: Elf64_Xword) -> Elf64_Xword {
5923        val >> 32
5924    }
5925
5926    pub fn ELF64_R_TYPE(val: Elf64_Xword) -> Elf64_Xword {
5927        val & 0xffffffff
5928    }
5929
5930    pub fn ELF64_R_INFO(sym: Elf64_Xword, t: Elf64_Xword) -> Elf64_Xword {
5931        sym << (32 + t)
5932    }
5933}
5934
5935safe_f! {
5936    pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t {
5937        let major = major as crate::dev_t;
5938        let minor = minor as crate::dev_t;
5939        let mut dev = 0;
5940        dev |= (major & 0x00000fff) << 8;
5941        dev |= (major & 0xfffff000) << 32;
5942        dev |= (minor & 0x000000ff) << 0;
5943        dev |= (minor & 0xffffff00) << 12;
5944        dev
5945    }
5946
5947    pub {const} fn major(dev: crate::dev_t) -> c_uint {
5948        let mut major = 0;
5949        major |= (dev & 0x00000000000fff00) >> 8;
5950        major |= (dev & 0xfffff00000000000) >> 32;
5951        major as c_uint
5952    }
5953
5954    pub {const} fn minor(dev: crate::dev_t) -> c_uint {
5955        let mut minor = 0;
5956        minor |= (dev & 0x00000000000000ff) >> 0;
5957        minor |= (dev & 0x00000ffffff00000) >> 12;
5958        minor as c_uint
5959    }
5960
5961    pub {const} fn SCTP_PR_TTL_ENABLED(policy: c_int) -> bool {
5962        policy == SCTP_PR_SCTP_TTL
5963    }
5964
5965    pub {const} fn SCTP_PR_RTX_ENABLED(policy: c_int) -> bool {
5966        policy == SCTP_PR_SCTP_RTX
5967    }
5968
5969    pub {const} fn SCTP_PR_PRIO_ENABLED(policy: c_int) -> bool {
5970        policy == SCTP_PR_SCTP_PRIO
5971    }
5972}
5973
5974cfg_if! {
5975    if #[cfg(all(
5976        any(target_env = "gnu", target_env = "musl", target_env = "ohos"),
5977        any(target_arch = "x86_64", target_arch = "x86")
5978    ))] {
5979        extern "C" {
5980            pub fn iopl(level: c_int) -> c_int;
5981            pub fn ioperm(from: c_ulong, num: c_ulong, turn_on: c_int) -> c_int;
5982        }
5983    }
5984}
5985
5986cfg_if! {
5987    if #[cfg(all(not(target_env = "uclibc"), not(target_env = "ohos")))] {
5988        extern "C" {
5989            #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_read64")]
5990            pub fn aio_read(aiocbp: *mut aiocb) -> c_int;
5991            #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_write64")]
5992            pub fn aio_write(aiocbp: *mut aiocb) -> c_int;
5993            pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int;
5994            #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_error64")]
5995            pub fn aio_error(aiocbp: *const aiocb) -> c_int;
5996            #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_return64")]
5997            pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t;
5998            #[cfg_attr(gnu_time_bits64, link_name = "__aio_suspend_time64")]
5999            pub fn aio_suspend(
6000                aiocb_list: *const *const aiocb,
6001                nitems: c_int,
6002                timeout: *const crate::timespec,
6003            ) -> c_int;
6004            #[cfg_attr(gnu_file_offset_bits64, link_name = "aio_cancel64")]
6005            pub fn aio_cancel(fd: c_int, aiocbp: *mut aiocb) -> c_int;
6006            #[cfg_attr(gnu_file_offset_bits64, link_name = "lio_listio64")]
6007            pub fn lio_listio(
6008                mode: c_int,
6009                aiocb_list: *const *mut aiocb,
6010                nitems: c_int,
6011                sevp: *mut crate::sigevent,
6012            ) -> c_int;
6013        }
6014    }
6015}
6016
6017cfg_if! {
6018    if #[cfg(not(target_env = "uclibc"))] {
6019        extern "C" {
6020            #[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64")]
6021            pub fn pwritev(
6022                fd: c_int,
6023                iov: *const crate::iovec,
6024                iovcnt: c_int,
6025                offset: off_t,
6026            ) -> ssize_t;
6027            #[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64")]
6028            pub fn preadv(
6029                fd: c_int,
6030                iov: *const crate::iovec,
6031                iovcnt: c_int,
6032                offset: off_t,
6033            ) -> ssize_t;
6034            pub fn getnameinfo(
6035                sa: *const crate::sockaddr,
6036                salen: crate::socklen_t,
6037                host: *mut c_char,
6038                hostlen: crate::socklen_t,
6039                serv: *mut c_char,
6040                servlen: crate::socklen_t,
6041                flags: c_int,
6042            ) -> c_int;
6043            pub fn getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int;
6044            pub fn process_vm_readv(
6045                pid: crate::pid_t,
6046                local_iov: *const crate::iovec,
6047                liovcnt: c_ulong,
6048                remote_iov: *const crate::iovec,
6049                riovcnt: c_ulong,
6050                flags: c_ulong,
6051            ) -> isize;
6052            pub fn process_vm_writev(
6053                pid: crate::pid_t,
6054                local_iov: *const crate::iovec,
6055                liovcnt: c_ulong,
6056                remote_iov: *const crate::iovec,
6057                riovcnt: c_ulong,
6058                flags: c_ulong,
6059            ) -> isize;
6060            #[cfg_attr(gnu_time_bits64, link_name = "__futimes64")]
6061            pub fn futimes(fd: c_int, times: *const crate::timeval) -> c_int;
6062        }
6063    }
6064}
6065
6066// These functions are not available on OpenHarmony
6067cfg_if! {
6068    if #[cfg(not(target_env = "ohos"))] {
6069        extern "C" {
6070            // Only `getspnam_r` is implemented for musl, out of all of the reenterant
6071            // functions from `shadow.h`.
6072            // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h
6073            pub fn getspnam_r(
6074                name: *const c_char,
6075                spbuf: *mut spwd,
6076                buf: *mut c_char,
6077                buflen: size_t,
6078                spbufp: *mut *mut spwd,
6079            ) -> c_int;
6080
6081            pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t;
6082            pub fn mq_close(mqd: crate::mqd_t) -> c_int;
6083            pub fn mq_unlink(name: *const c_char) -> c_int;
6084            pub fn mq_receive(
6085                mqd: crate::mqd_t,
6086                msg_ptr: *mut c_char,
6087                msg_len: size_t,
6088                msg_prio: *mut c_uint,
6089            ) -> ssize_t;
6090            #[cfg_attr(gnu_time_bits64, link_name = "__mq_timedreceive_time64")]
6091            pub fn mq_timedreceive(
6092                mqd: crate::mqd_t,
6093                msg_ptr: *mut c_char,
6094                msg_len: size_t,
6095                msg_prio: *mut c_uint,
6096                abs_timeout: *const crate::timespec,
6097            ) -> ssize_t;
6098            pub fn mq_send(
6099                mqd: crate::mqd_t,
6100                msg_ptr: *const c_char,
6101                msg_len: size_t,
6102                msg_prio: c_uint,
6103            ) -> c_int;
6104            #[cfg_attr(gnu_time_bits64, link_name = "__mq_timedsend_time64")]
6105            pub fn mq_timedsend(
6106                mqd: crate::mqd_t,
6107                msg_ptr: *const c_char,
6108                msg_len: size_t,
6109                msg_prio: c_uint,
6110                abs_timeout: *const crate::timespec,
6111            ) -> c_int;
6112            pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
6113            pub fn mq_setattr(
6114                mqd: crate::mqd_t,
6115                newattr: *const crate::mq_attr,
6116                oldattr: *mut crate::mq_attr,
6117            ) -> c_int;
6118
6119            pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> c_int;
6120            pub fn pthread_cancel(thread: crate::pthread_t) -> c_int;
6121            pub fn pthread_mutexattr_getrobust(
6122                attr: *const pthread_mutexattr_t,
6123                robustness: *mut c_int,
6124            ) -> c_int;
6125            pub fn pthread_mutexattr_setrobust(
6126                attr: *mut pthread_mutexattr_t,
6127                robustness: c_int,
6128            ) -> c_int;
6129        }
6130    }
6131}
6132
6133extern "C" {
6134    #[cfg_attr(
6135        not(any(target_env = "musl", target_env = "ohos")),
6136        link_name = "__xpg_strerror_r"
6137    )]
6138    pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
6139
6140    pub fn abs(i: c_int) -> c_int;
6141    pub fn labs(i: c_long) -> c_long;
6142    pub fn rand() -> c_int;
6143    pub fn srand(seed: c_uint);
6144
6145    pub fn drand48() -> c_double;
6146    pub fn erand48(xseed: *mut c_ushort) -> c_double;
6147    pub fn lrand48() -> c_long;
6148    pub fn nrand48(xseed: *mut c_ushort) -> c_long;
6149    pub fn mrand48() -> c_long;
6150    pub fn jrand48(xseed: *mut c_ushort) -> c_long;
6151    pub fn srand48(seed: c_long);
6152    pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort;
6153    pub fn lcong48(p: *mut c_ushort);
6154
6155    #[cfg_attr(gnu_time_bits64, link_name = "__lutimes64")]
6156    pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
6157
6158    pub fn setpwent();
6159    pub fn endpwent();
6160    pub fn getpwent() -> *mut passwd;
6161    pub fn setgrent();
6162    pub fn endgrent();
6163    pub fn getgrent() -> *mut crate::group;
6164    pub fn setspent();
6165    pub fn endspent();
6166    pub fn getspent() -> *mut spwd;
6167
6168    pub fn getspnam(name: *const c_char) -> *mut spwd;
6169
6170    pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
6171    pub fn shm_unlink(name: *const c_char) -> c_int;
6172
6173    // System V IPC
6174    pub fn shmget(key: crate::key_t, size: size_t, shmflg: c_int) -> c_int;
6175    pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void;
6176    pub fn shmdt(shmaddr: *const c_void) -> c_int;
6177    #[cfg_attr(gnu_time_bits64, link_name = "__shmctl64")]
6178    pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int;
6179    pub fn ftok(pathname: *const c_char, proj_id: c_int) -> crate::key_t;
6180    pub fn semget(key: crate::key_t, nsems: c_int, semflag: c_int) -> c_int;
6181    pub fn semop(semid: c_int, sops: *mut crate::sembuf, nsops: size_t) -> c_int;
6182    #[cfg_attr(gnu_time_bits64, link_name = "__semctl64")]
6183    pub fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) -> c_int;
6184    #[cfg_attr(gnu_time_bits64, link_name = "__msgctl64")]
6185    pub fn msgctl(msqid: c_int, cmd: c_int, buf: *mut msqid_ds) -> c_int;
6186    pub fn msgget(key: crate::key_t, msgflg: c_int) -> c_int;
6187    pub fn msgrcv(
6188        msqid: c_int,
6189        msgp: *mut c_void,
6190        msgsz: size_t,
6191        msgtyp: c_long,
6192        msgflg: c_int,
6193    ) -> ssize_t;
6194    pub fn msgsnd(msqid: c_int, msgp: *const c_void, msgsz: size_t, msgflg: c_int) -> c_int;
6195
6196    pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
6197    pub fn __errno_location() -> *mut c_int;
6198
6199    #[cfg_attr(gnu_file_offset_bits64, link_name = "fallocate64")]
6200    pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int;
6201    #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")]
6202    pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
6203    pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t;
6204    pub fn getxattr(
6205        path: *const c_char,
6206        name: *const c_char,
6207        value: *mut c_void,
6208        size: size_t,
6209    ) -> ssize_t;
6210    pub fn lgetxattr(
6211        path: *const c_char,
6212        name: *const c_char,
6213        value: *mut c_void,
6214        size: size_t,
6215    ) -> ssize_t;
6216    pub fn fgetxattr(
6217        filedes: c_int,
6218        name: *const c_char,
6219        value: *mut c_void,
6220        size: size_t,
6221    ) -> ssize_t;
6222    pub fn setxattr(
6223        path: *const c_char,
6224        name: *const c_char,
6225        value: *const c_void,
6226        size: size_t,
6227        flags: c_int,
6228    ) -> c_int;
6229    pub fn lsetxattr(
6230        path: *const c_char,
6231        name: *const c_char,
6232        value: *const c_void,
6233        size: size_t,
6234        flags: c_int,
6235    ) -> c_int;
6236    pub fn fsetxattr(
6237        filedes: c_int,
6238        name: *const c_char,
6239        value: *const c_void,
6240        size: size_t,
6241        flags: c_int,
6242    ) -> c_int;
6243    pub fn listxattr(path: *const c_char, list: *mut c_char, size: size_t) -> ssize_t;
6244    pub fn llistxattr(path: *const c_char, list: *mut c_char, size: size_t) -> ssize_t;
6245    pub fn flistxattr(filedes: c_int, list: *mut c_char, size: size_t) -> ssize_t;
6246    pub fn removexattr(path: *const c_char, name: *const c_char) -> c_int;
6247    pub fn lremovexattr(path: *const c_char, name: *const c_char) -> c_int;
6248    pub fn fremovexattr(filedes: c_int, name: *const c_char) -> c_int;
6249    pub fn signalfd(fd: c_int, mask: *const crate::sigset_t, flags: c_int) -> c_int;
6250    pub fn timerfd_create(clockid: crate::clockid_t, flags: c_int) -> c_int;
6251    #[cfg_attr(gnu_time_bits64, link_name = "__timerfd_gettime64")]
6252    pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int;
6253    #[cfg_attr(gnu_time_bits64, link_name = "__timerfd_settime64")]
6254    pub fn timerfd_settime(
6255        fd: c_int,
6256        flags: c_int,
6257        new_value: *const itimerspec,
6258        old_value: *mut itimerspec,
6259    ) -> c_int;
6260    pub fn quotactl(cmd: c_int, special: *const c_char, id: c_int, data: *mut c_char) -> c_int;
6261    pub fn epoll_pwait(
6262        epfd: c_int,
6263        events: *mut crate::epoll_event,
6264        maxevents: c_int,
6265        timeout: c_int,
6266        sigmask: *const crate::sigset_t,
6267    ) -> c_int;
6268    pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int;
6269    #[cfg_attr(gnu_time_bits64, link_name = "__sigtimedwait64")]
6270    pub fn sigtimedwait(
6271        set: *const sigset_t,
6272        info: *mut siginfo_t,
6273        timeout: *const crate::timespec,
6274    ) -> c_int;
6275    pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
6276    pub fn nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char;
6277    pub fn accept4(
6278        fd: c_int,
6279        addr: *mut crate::sockaddr,
6280        len: *mut crate::socklen_t,
6281        flg: c_int,
6282    ) -> c_int;
6283    pub fn pthread_getaffinity_np(
6284        thread: crate::pthread_t,
6285        cpusetsize: size_t,
6286        cpuset: *mut crate::cpu_set_t,
6287    ) -> c_int;
6288    pub fn pthread_setaffinity_np(
6289        thread: crate::pthread_t,
6290        cpusetsize: size_t,
6291        cpuset: *const crate::cpu_set_t,
6292    ) -> c_int;
6293    pub fn pthread_setschedprio(native: crate::pthread_t, priority: c_int) -> c_int;
6294    pub fn reboot(how_to: c_int) -> c_int;
6295    pub fn setfsgid(gid: crate::gid_t) -> c_int;
6296    pub fn setfsuid(uid: crate::uid_t) -> c_int;
6297
6298    // Not available now on Android
6299    pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
6300    pub fn if_nameindex() -> *mut if_nameindex;
6301    pub fn if_freenameindex(ptr: *mut if_nameindex);
6302    pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int;
6303    pub fn mremap(
6304        addr: *mut c_void,
6305        len: size_t,
6306        new_len: size_t,
6307        flags: c_int,
6308        ...
6309    ) -> *mut c_void;
6310
6311    #[cfg_attr(gnu_time_bits64, link_name = "__glob64_time64")]
6312    #[cfg_attr(
6313        all(not(gnu_time_bits64), gnu_file_offset_bits64),
6314        link_name = "glob64"
6315    )]
6316    pub fn glob(
6317        pattern: *const c_char,
6318        flags: c_int,
6319        errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>,
6320        pglob: *mut crate::glob_t,
6321    ) -> c_int;
6322    #[cfg_attr(gnu_time_bits64, link_name = "__globfree64_time64")]
6323    #[cfg_attr(
6324        all(not(gnu_time_bits64), gnu_file_offset_bits64),
6325        link_name = "globfree64"
6326    )]
6327    pub fn globfree(pglob: *mut crate::glob_t);
6328
6329    pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
6330
6331    pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
6332
6333    pub fn telldir(dirp: *mut crate::DIR) -> c_long;
6334    pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
6335
6336    pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
6337    pub fn remap_file_pages(
6338        addr: *mut c_void,
6339        size: size_t,
6340        prot: c_int,
6341        pgoff: size_t,
6342        flags: c_int,
6343    ) -> c_int;
6344    pub fn recvfrom(
6345        socket: c_int,
6346        buf: *mut c_void,
6347        len: size_t,
6348        flags: c_int,
6349        addr: *mut crate::sockaddr,
6350        addrlen: *mut crate::socklen_t,
6351    ) -> ssize_t;
6352    #[cfg_attr(gnu_file_offset_bits64, link_name = "mkstemps64")]
6353    pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int;
6354
6355    pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char;
6356
6357    pub fn vhangup() -> c_int;
6358    pub fn sync();
6359    pub fn syncfs(fd: c_int) -> c_int;
6360    pub fn syscall(num: c_long, ...) -> c_long;
6361    pub fn sched_getaffinity(
6362        pid: crate::pid_t,
6363        cpusetsize: size_t,
6364        cpuset: *mut cpu_set_t,
6365    ) -> c_int;
6366    pub fn sched_setaffinity(
6367        pid: crate::pid_t,
6368        cpusetsize: size_t,
6369        cpuset: *const cpu_set_t,
6370    ) -> c_int;
6371    pub fn epoll_create(size: c_int) -> c_int;
6372    pub fn epoll_create1(flags: c_int) -> c_int;
6373    pub fn epoll_wait(
6374        epfd: c_int,
6375        events: *mut crate::epoll_event,
6376        maxevents: c_int,
6377        timeout: c_int,
6378    ) -> c_int;
6379    pub fn epoll_ctl(epfd: c_int, op: c_int, fd: c_int, event: *mut crate::epoll_event) -> c_int;
6380    pub fn pthread_getschedparam(
6381        native: crate::pthread_t,
6382        policy: *mut c_int,
6383        param: *mut crate::sched_param,
6384    ) -> c_int;
6385    pub fn unshare(flags: c_int) -> c_int;
6386    pub fn umount(target: *const c_char) -> c_int;
6387    pub fn sched_get_priority_max(policy: c_int) -> c_int;
6388    pub fn tee(fd_in: c_int, fd_out: c_int, len: size_t, flags: c_uint) -> ssize_t;
6389    #[cfg_attr(gnu_time_bits64, link_name = "__settimeofday64")]
6390    pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
6391    pub fn splice(
6392        fd_in: c_int,
6393        off_in: *mut crate::loff_t,
6394        fd_out: c_int,
6395        off_out: *mut crate::loff_t,
6396        len: size_t,
6397        flags: c_uint,
6398    ) -> ssize_t;
6399    pub fn eventfd(init: c_uint, flags: c_int) -> c_int;
6400    pub fn eventfd_read(fd: c_int, value: *mut eventfd_t) -> c_int;
6401    pub fn eventfd_write(fd: c_int, value: eventfd_t) -> c_int;
6402
6403    #[cfg_attr(gnu_time_bits64, link_name = "__sched_rr_get_interval64")]
6404    pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int;
6405    #[cfg_attr(gnu_time_bits64, link_name = "__sem_timedwait64")]
6406    pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int;
6407    pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;
6408    pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int;
6409    pub fn setns(fd: c_int, nstype: c_int) -> c_int;
6410    pub fn swapoff(path: *const c_char) -> c_int;
6411    pub fn vmsplice(fd: c_int, iov: *const crate::iovec, nr_segs: size_t, flags: c_uint)
6412        -> ssize_t;
6413    pub fn mount(
6414        src: *const c_char,
6415        target: *const c_char,
6416        fstype: *const c_char,
6417        flags: c_ulong,
6418        data: *const c_void,
6419    ) -> c_int;
6420    pub fn personality(persona: c_ulong) -> c_int;
6421    #[cfg_attr(gnu_time_bits64, link_name = "__prctl_time64")]
6422    pub fn prctl(option: c_int, ...) -> c_int;
6423    pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int;
6424    #[cfg_attr(gnu_time_bits64, link_name = "__ppoll64")]
6425    pub fn ppoll(
6426        fds: *mut crate::pollfd,
6427        nfds: nfds_t,
6428        timeout: *const crate::timespec,
6429        sigmask: *const sigset_t,
6430    ) -> c_int;
6431    pub fn pthread_mutexattr_getprotocol(
6432        attr: *const pthread_mutexattr_t,
6433        protocol: *mut c_int,
6434    ) -> c_int;
6435    pub fn pthread_mutexattr_setprotocol(attr: *mut pthread_mutexattr_t, protocol: c_int) -> c_int;
6436
6437    #[cfg_attr(gnu_time_bits64, link_name = "__pthread_mutex_timedlock64")]
6438    pub fn pthread_mutex_timedlock(
6439        lock: *mut pthread_mutex_t,
6440        abstime: *const crate::timespec,
6441    ) -> c_int;
6442    pub fn pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int;
6443    pub fn pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int;
6444    pub fn pthread_barrierattr_getpshared(
6445        attr: *const crate::pthread_barrierattr_t,
6446        shared: *mut c_int,
6447    ) -> c_int;
6448    pub fn pthread_barrierattr_setpshared(
6449        attr: *mut crate::pthread_barrierattr_t,
6450        shared: c_int,
6451    ) -> c_int;
6452    pub fn pthread_barrier_init(
6453        barrier: *mut pthread_barrier_t,
6454        attr: *const crate::pthread_barrierattr_t,
6455        count: c_uint,
6456    ) -> c_int;
6457    pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int;
6458    pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int;
6459    pub fn pthread_spin_init(lock: *mut crate::pthread_spinlock_t, pshared: c_int) -> c_int;
6460    pub fn pthread_spin_destroy(lock: *mut crate::pthread_spinlock_t) -> c_int;
6461    pub fn pthread_spin_lock(lock: *mut crate::pthread_spinlock_t) -> c_int;
6462    pub fn pthread_spin_trylock(lock: *mut crate::pthread_spinlock_t) -> c_int;
6463    pub fn pthread_spin_unlock(lock: *mut crate::pthread_spinlock_t) -> c_int;
6464    pub fn clone(
6465        cb: extern "C" fn(*mut c_void) -> c_int,
6466        child_stack: *mut c_void,
6467        flags: c_int,
6468        arg: *mut c_void,
6469        ...
6470    ) -> c_int;
6471    pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
6472    #[cfg_attr(gnu_time_bits64, link_name = "__clock_nanosleep_time64")]
6473    pub fn clock_nanosleep(
6474        clk_id: crate::clockid_t,
6475        flags: c_int,
6476        rqtp: *const crate::timespec,
6477        rmtp: *mut crate::timespec,
6478    ) -> c_int;
6479    pub fn pthread_attr_getguardsize(
6480        attr: *const crate::pthread_attr_t,
6481        guardsize: *mut size_t,
6482    ) -> c_int;
6483    pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
6484    pub fn pthread_attr_getinheritsched(
6485        attr: *const crate::pthread_attr_t,
6486        inheritsched: *mut c_int,
6487    ) -> c_int;
6488    pub fn pthread_attr_setinheritsched(
6489        attr: *mut crate::pthread_attr_t,
6490        inheritsched: c_int,
6491    ) -> c_int;
6492    pub fn pthread_attr_getschedpolicy(
6493        attr: *const crate::pthread_attr_t,
6494        policy: *mut c_int,
6495    ) -> c_int;
6496    pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int;
6497    pub fn pthread_attr_getschedparam(
6498        attr: *const crate::pthread_attr_t,
6499        param: *mut crate::sched_param,
6500    ) -> c_int;
6501    pub fn pthread_attr_setschedparam(
6502        attr: *mut crate::pthread_attr_t,
6503        param: *const crate::sched_param,
6504    ) -> c_int;
6505    pub fn sethostname(name: *const c_char, len: size_t) -> c_int;
6506    pub fn sched_get_priority_min(policy: c_int) -> c_int;
6507    pub fn pthread_condattr_getpshared(
6508        attr: *const pthread_condattr_t,
6509        pshared: *mut c_int,
6510    ) -> c_int;
6511    pub fn sysinfo(info: *mut crate::sysinfo) -> c_int;
6512    pub fn umount2(target: *const c_char, flags: c_int) -> c_int;
6513    pub fn pthread_setschedparam(
6514        native: crate::pthread_t,
6515        policy: c_int,
6516        param: *const crate::sched_param,
6517    ) -> c_int;
6518    pub fn swapon(path: *const c_char, swapflags: c_int) -> c_int;
6519    pub fn sched_setscheduler(
6520        pid: crate::pid_t,
6521        policy: c_int,
6522        param: *const crate::sched_param,
6523    ) -> c_int;
6524    #[cfg_attr(gnu_file_offset_bits64, link_name = "sendfile64")]
6525    pub fn sendfile(out_fd: c_int, in_fd: c_int, offset: *mut off_t, count: size_t) -> ssize_t;
6526    pub fn sigsuspend(mask: *const crate::sigset_t) -> c_int;
6527    pub fn getgrgid_r(
6528        gid: crate::gid_t,
6529        grp: *mut crate::group,
6530        buf: *mut c_char,
6531        buflen: size_t,
6532        result: *mut *mut crate::group,
6533    ) -> c_int;
6534    pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> c_int;
6535    pub fn sem_close(sem: *mut sem_t) -> c_int;
6536    pub fn getdtablesize() -> c_int;
6537    pub fn getgrnam_r(
6538        name: *const c_char,
6539        grp: *mut crate::group,
6540        buf: *mut c_char,
6541        buflen: size_t,
6542        result: *mut *mut crate::group,
6543    ) -> c_int;
6544    pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int;
6545    pub fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
6546    pub fn sem_open(name: *const c_char, oflag: c_int, ...) -> *mut sem_t;
6547    pub fn getgrnam(name: *const c_char) -> *mut crate::group;
6548    pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int;
6549    pub fn sem_unlink(name: *const c_char) -> c_int;
6550    pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int;
6551    pub fn getpwnam_r(
6552        name: *const c_char,
6553        pwd: *mut passwd,
6554        buf: *mut c_char,
6555        buflen: size_t,
6556        result: *mut *mut passwd,
6557    ) -> c_int;
6558    pub fn getpwuid_r(
6559        uid: crate::uid_t,
6560        pwd: *mut passwd,
6561        buf: *mut c_char,
6562        buflen: size_t,
6563        result: *mut *mut passwd,
6564    ) -> c_int;
6565    pub fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int;
6566    pub fn pthread_atfork(
6567        prepare: Option<unsafe extern "C" fn()>,
6568        parent: Option<unsafe extern "C" fn()>,
6569        child: Option<unsafe extern "C" fn()>,
6570    ) -> c_int;
6571    pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group;
6572    pub fn getgrouplist(
6573        user: *const c_char,
6574        group: crate::gid_t,
6575        groups: *mut crate::gid_t,
6576        ngroups: *mut c_int,
6577    ) -> c_int;
6578    pub fn pthread_mutexattr_getpshared(
6579        attr: *const pthread_mutexattr_t,
6580        pshared: *mut c_int,
6581    ) -> c_int;
6582    pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE;
6583    pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
6584    pub fn pthread_create(
6585        native: *mut crate::pthread_t,
6586        attr: *const crate::pthread_attr_t,
6587        f: extern "C" fn(*mut c_void) -> *mut c_void,
6588        value: *mut c_void,
6589    ) -> c_int;
6590    pub fn dl_iterate_phdr(
6591        callback: Option<
6592            unsafe extern "C" fn(
6593                info: *mut crate::dl_phdr_info,
6594                size: size_t,
6595                data: *mut c_void,
6596            ) -> c_int,
6597        >,
6598        data: *mut c_void,
6599    ) -> c_int;
6600
6601    pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE;
6602    pub fn getmntent(stream: *mut crate::FILE) -> *mut crate::mntent;
6603    pub fn addmntent(stream: *mut crate::FILE, mnt: *const crate::mntent) -> c_int;
6604    pub fn endmntent(streamp: *mut crate::FILE) -> c_int;
6605    pub fn hasmntopt(mnt: *const crate::mntent, opt: *const c_char) -> *mut c_char;
6606
6607    pub fn posix_spawn(
6608        pid: *mut crate::pid_t,
6609        path: *const c_char,
6610        file_actions: *const crate::posix_spawn_file_actions_t,
6611        attrp: *const crate::posix_spawnattr_t,
6612        argv: *const *mut c_char,
6613        envp: *const *mut c_char,
6614    ) -> c_int;
6615    pub fn posix_spawnp(
6616        pid: *mut crate::pid_t,
6617        file: *const c_char,
6618        file_actions: *const crate::posix_spawn_file_actions_t,
6619        attrp: *const crate::posix_spawnattr_t,
6620        argv: *const *mut c_char,
6621        envp: *const *mut c_char,
6622    ) -> c_int;
6623    pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
6624    pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
6625    pub fn posix_spawnattr_getsigdefault(
6626        attr: *const posix_spawnattr_t,
6627        default: *mut crate::sigset_t,
6628    ) -> c_int;
6629    pub fn posix_spawnattr_setsigdefault(
6630        attr: *mut posix_spawnattr_t,
6631        default: *const crate::sigset_t,
6632    ) -> c_int;
6633    pub fn posix_spawnattr_getsigmask(
6634        attr: *const posix_spawnattr_t,
6635        default: *mut crate::sigset_t,
6636    ) -> c_int;
6637    pub fn posix_spawnattr_setsigmask(
6638        attr: *mut posix_spawnattr_t,
6639        default: *const crate::sigset_t,
6640    ) -> c_int;
6641    pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
6642    pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
6643    pub fn posix_spawnattr_getpgroup(
6644        attr: *const posix_spawnattr_t,
6645        flags: *mut crate::pid_t,
6646    ) -> c_int;
6647    pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int;
6648    pub fn posix_spawnattr_getschedpolicy(
6649        attr: *const posix_spawnattr_t,
6650        flags: *mut c_int,
6651    ) -> c_int;
6652    pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int;
6653    pub fn posix_spawnattr_getschedparam(
6654        attr: *const posix_spawnattr_t,
6655        param: *mut crate::sched_param,
6656    ) -> c_int;
6657    pub fn posix_spawnattr_setschedparam(
6658        attr: *mut posix_spawnattr_t,
6659        param: *const crate::sched_param,
6660    ) -> c_int;
6661
6662    pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
6663    pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
6664    pub fn posix_spawn_file_actions_addopen(
6665        actions: *mut posix_spawn_file_actions_t,
6666        fd: c_int,
6667        path: *const c_char,
6668        oflag: c_int,
6669        mode: mode_t,
6670    ) -> c_int;
6671    pub fn posix_spawn_file_actions_addclose(
6672        actions: *mut posix_spawn_file_actions_t,
6673        fd: c_int,
6674    ) -> c_int;
6675    pub fn posix_spawn_file_actions_adddup2(
6676        actions: *mut posix_spawn_file_actions_t,
6677        fd: c_int,
6678        newfd: c_int,
6679    ) -> c_int;
6680    pub fn fread_unlocked(
6681        buf: *mut c_void,
6682        size: size_t,
6683        nobj: size_t,
6684        stream: *mut crate::FILE,
6685    ) -> size_t;
6686    pub fn inotify_rm_watch(fd: c_int, wd: c_int) -> c_int;
6687    pub fn inotify_init() -> c_int;
6688    pub fn inotify_init1(flags: c_int) -> c_int;
6689    pub fn inotify_add_watch(fd: c_int, path: *const c_char, mask: u32) -> c_int;
6690    pub fn fanotify_init(flags: c_uint, event_f_flags: c_uint) -> c_int;
6691
6692    pub fn regcomp(preg: *mut crate::regex_t, pattern: *const c_char, cflags: c_int) -> c_int;
6693
6694    pub fn regexec(
6695        preg: *const crate::regex_t,
6696        input: *const c_char,
6697        nmatch: size_t,
6698        pmatch: *mut regmatch_t,
6699        eflags: c_int,
6700    ) -> c_int;
6701
6702    pub fn regerror(
6703        errcode: c_int,
6704        preg: *const crate::regex_t,
6705        errbuf: *mut c_char,
6706        errbuf_size: size_t,
6707    ) -> size_t;
6708
6709    pub fn regfree(preg: *mut crate::regex_t);
6710
6711    pub fn iconv_open(tocode: *const c_char, fromcode: *const c_char) -> iconv_t;
6712    pub fn iconv(
6713        cd: iconv_t,
6714        inbuf: *mut *mut c_char,
6715        inbytesleft: *mut size_t,
6716        outbuf: *mut *mut c_char,
6717        outbytesleft: *mut size_t,
6718    ) -> size_t;
6719    pub fn iconv_close(cd: iconv_t) -> c_int;
6720
6721    pub fn gettid() -> crate::pid_t;
6722
6723    pub fn timer_create(
6724        clockid: crate::clockid_t,
6725        sevp: *mut crate::sigevent,
6726        timerid: *mut crate::timer_t,
6727    ) -> c_int;
6728    pub fn timer_delete(timerid: crate::timer_t) -> c_int;
6729    pub fn timer_getoverrun(timerid: crate::timer_t) -> c_int;
6730    #[cfg_attr(gnu_time_bits64, link_name = "__timer_gettime64")]
6731    pub fn timer_gettime(timerid: crate::timer_t, curr_value: *mut crate::itimerspec) -> c_int;
6732    #[cfg_attr(gnu_time_bits64, link_name = "__timer_settime64")]
6733    pub fn timer_settime(
6734        timerid: crate::timer_t,
6735        flags: c_int,
6736        new_value: *const crate::itimerspec,
6737        old_value: *mut crate::itimerspec,
6738    ) -> c_int;
6739
6740    pub fn gethostid() -> c_long;
6741
6742    pub fn pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int;
6743    pub fn memmem(
6744        haystack: *const c_void,
6745        haystacklen: size_t,
6746        needle: *const c_void,
6747        needlelen: size_t,
6748    ) -> *mut c_void;
6749    pub fn sched_getcpu() -> c_int;
6750
6751    pub fn pthread_getname_np(thread: crate::pthread_t, name: *mut c_char, len: size_t) -> c_int;
6752    pub fn pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int;
6753    pub fn getopt_long(
6754        argc: c_int,
6755        argv: *const *mut c_char,
6756        optstring: *const c_char,
6757        longopts: *const option,
6758        longindex: *mut c_int,
6759    ) -> c_int;
6760
6761    pub fn pthread_once(control: *mut pthread_once_t, routine: extern "C" fn()) -> c_int;
6762
6763    pub fn copy_file_range(
6764        fd_in: c_int,
6765        off_in: *mut off64_t,
6766        fd_out: c_int,
6767        off_out: *mut off64_t,
6768        len: size_t,
6769        flags: c_uint,
6770    ) -> ssize_t;
6771
6772    pub fn klogctl(syslog_type: c_int, bufp: *mut c_char, len: c_int) -> c_int;
6773}
6774
6775// LFS64 extensions
6776//
6777// * musl has 64-bit versions only so aliases the LFS64 symbols to the standard ones
6778cfg_if! {
6779    if #[cfg(not(target_env = "musl"))] {
6780        extern "C" {
6781            pub fn fallocate64(fd: c_int, mode: c_int, offset: off64_t, len: off64_t) -> c_int;
6782            pub fn fgetpos64(stream: *mut crate::FILE, ptr: *mut fpos64_t) -> c_int;
6783            pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut crate::FILE;
6784            pub fn freopen64(
6785                filename: *const c_char,
6786                mode: *const c_char,
6787                file: *mut crate::FILE,
6788            ) -> *mut crate::FILE;
6789            pub fn fseeko64(stream: *mut crate::FILE, offset: off64_t, whence: c_int) -> c_int;
6790            pub fn fsetpos64(stream: *mut crate::FILE, ptr: *const fpos64_t) -> c_int;
6791            pub fn ftello64(stream: *mut crate::FILE) -> off64_t;
6792            pub fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int;
6793            pub fn sendfile64(
6794                out_fd: c_int,
6795                in_fd: c_int,
6796                offset: *mut off64_t,
6797                count: size_t,
6798            ) -> ssize_t;
6799            pub fn tmpfile64() -> *mut crate::FILE;
6800        }
6801    }
6802}
6803
6804cfg_if! {
6805    if #[cfg(target_env = "uclibc")] {
6806        mod uclibc;
6807        pub use self::uclibc::*;
6808    } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
6809        mod musl;
6810        pub use self::musl::*;
6811    } else if #[cfg(target_env = "gnu")] {
6812        mod gnu;
6813        pub use self::gnu::*;
6814    }
6815}
6816
6817mod arch;
6818pub use self::arch::*;