Skip to main content

libc/unix/linux_like/linux/
mod.rs

1//! Linux-specific definitions for linux-like values
2use crate::prelude::*;
3use crate::{
4    __s16,
5    __s32,
6    __u16,
7    __u32,
8    __u64,
9    __u8,
10    sock_filter,
11    _IO,
12    _IOR,
13    _IOW,
14    _IOWR,
15};
16
17pub type dev_t = u64;
18pub type socklen_t = u32;
19pub type mode_t = u32;
20pub type ino64_t = u64;
21pub type off64_t = i64;
22pub type blkcnt64_t = i64;
23pub type rlim64_t = u64;
24pub type mqd_t = c_int;
25pub type nfds_t = c_ulong;
26pub type nl_item = c_int;
27pub type idtype_t = c_uint;
28pub type loff_t = c_longlong;
29pub type pthread_key_t = c_uint;
30pub type pthread_once_t = c_int;
31pub type pthread_spinlock_t = c_int;
32pub type __kernel_fsid_t = __c_anonymous__kernel_fsid_t;
33pub type __kernel_clockid_t = c_int;
34
35pub type eventfd_t = u64;
36
37pub type pid_type = crate::prelude::CEnumRepr;
pub const PIDTYPE_PID: pid_type =
    {
        #[allow(unused_variables)]
        let r = 0;
        r
    };
pub const PIDTYPE_TGID: pid_type =
    {
        #[allow(unused_variables)]
        let r = PIDTYPE_PID + 1;
        r
    };
pub const PIDTYPE_PGID: pid_type =
    {
        #[allow(unused_variables)]
        let r = PIDTYPE_TGID + 1;
        r
    };
pub const PIDTYPE_SID: pid_type =
    {
        #[allow(unused_variables)]
        let r = PIDTYPE_PGID + 1;
        r
    };
pub const PIDTYPE_MAX: pid_type =
    {
        #[allow(unused_variables)]
        let r = PIDTYPE_SID + 1;
        r
    };c_enum! {
38    pub enum pid_type {
39        pub PIDTYPE_PID,
40        pub PIDTYPE_TGID,
41        pub PIDTYPE_PGID,
42        pub PIDTYPE_SID,
43        pub PIDTYPE_MAX,
44    }
45}
46
47#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for netent {
    #[inline]
    fn clone(&self) -> netent {
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut *mut c_char>;
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<u32>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for netent { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for netent {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "netent",
            "n_name", &self.n_name, "n_aliases", &self.n_aliases,
            "n_addrtype", &self.n_addrtype, "n_net", &&self.n_net)
    }
}s! {
48    pub struct dqblk {
49        pub dqb_bhardlimit: u64,
50        pub dqb_bsoftlimit: u64,
51        pub dqb_curspace: u64,
52        pub dqb_ihardlimit: u64,
53        pub dqb_isoftlimit: u64,
54        pub dqb_curinodes: u64,
55        pub dqb_btime: u64,
56        pub dqb_itime: u64,
57        pub dqb_valid: u32,
58    }
59
60    pub struct signalfd_siginfo {
61        pub ssi_signo: u32,
62        pub ssi_errno: i32,
63        pub ssi_code: i32,
64        pub ssi_pid: u32,
65        pub ssi_uid: u32,
66        pub ssi_fd: i32,
67        pub ssi_tid: u32,
68        pub ssi_band: u32,
69        pub ssi_overrun: u32,
70        pub ssi_trapno: u32,
71        pub ssi_status: i32,
72        pub ssi_int: i32,
73        pub ssi_ptr: u64,
74        pub ssi_utime: u64,
75        pub ssi_stime: u64,
76        pub ssi_addr: u64,
77        pub ssi_addr_lsb: u16,
78        _pad2: Padding<u16>,
79        pub ssi_syscall: i32,
80        pub ssi_call_addr: u64,
81        pub ssi_arch: u32,
82        _pad: Padding<[u8; 28]>,
83    }
84
85    // System V IPC
86    pub struct msginfo {
87        pub msgpool: c_int,
88        pub msgmap: c_int,
89        pub msgmax: c_int,
90        pub msgmnb: c_int,
91        pub msgmni: c_int,
92        pub msgssz: c_int,
93        pub msgtql: c_int,
94        pub msgseg: c_ushort,
95    }
96
97    pub struct input_event {
98        // FIXME(1.0): Change to the commented variant, see https://github.com/rust-lang/libc/pull/4148#discussion_r1857511742
99        #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
100        pub time: crate::timeval,
101        // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
102        // pub input_event_sec: time_t,
103        // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
104        // pub input_event_usec: suseconds_t,
105        // #[cfg(target_arch = "sparc64")]
106        // _pad1: c_int,
107        #[cfg(all(target_pointer_width = "32", linux_time_bits64))]
108        pub input_event_sec: c_ulong,
109
110        #[cfg(all(target_pointer_width = "32", linux_time_bits64))]
111        pub input_event_usec: c_ulong,
112
113        pub type_: __u16,
114        pub code: __u16,
115        pub value: __s32,
116    }
117
118    pub struct input_id {
119        pub bustype: __u16,
120        pub vendor: __u16,
121        pub product: __u16,
122        pub version: __u16,
123    }
124
125    pub struct input_absinfo {
126        pub value: __s32,
127        pub minimum: __s32,
128        pub maximum: __s32,
129        pub fuzz: __s32,
130        pub flat: __s32,
131        pub resolution: __s32,
132    }
133
134    pub struct input_keymap_entry {
135        pub flags: __u8,
136        pub len: __u8,
137        pub index: __u16,
138        pub keycode: __u32,
139        pub scancode: [__u8; 32],
140    }
141
142    pub struct input_mask {
143        pub type_: __u32,
144        pub codes_size: __u32,
145        pub codes_ptr: crate::__u64,
146    }
147
148    pub struct ff_replay {
149        pub length: __u16,
150        pub delay: __u16,
151    }
152
153    pub struct ff_trigger {
154        pub button: __u16,
155        pub interval: __u16,
156    }
157
158    pub struct ff_envelope {
159        pub attack_length: __u16,
160        pub attack_level: __u16,
161        pub fade_length: __u16,
162        pub fade_level: __u16,
163    }
164
165    pub struct ff_constant_effect {
166        pub level: __s16,
167        pub envelope: ff_envelope,
168    }
169
170    pub struct ff_ramp_effect {
171        pub start_level: __s16,
172        pub end_level: __s16,
173        pub envelope: ff_envelope,
174    }
175
176    pub struct ff_condition_effect {
177        pub right_saturation: __u16,
178        pub left_saturation: __u16,
179
180        pub right_coeff: __s16,
181        pub left_coeff: __s16,
182
183        pub deadband: __u16,
184        pub center: __s16,
185    }
186
187    pub struct ff_periodic_effect {
188        pub waveform: __u16,
189        pub period: __u16,
190        pub magnitude: __s16,
191        pub offset: __s16,
192        pub phase: __u16,
193
194        pub envelope: ff_envelope,
195
196        pub custom_len: __u32,
197        pub custom_data: *mut __s16,
198    }
199
200    pub struct ff_rumble_effect {
201        pub strong_magnitude: __u16,
202        pub weak_magnitude: __u16,
203    }
204
205    pub struct ff_effect {
206        pub type_: __u16,
207        pub id: __s16,
208        pub direction: __u16,
209        pub trigger: ff_trigger,
210        pub replay: ff_replay,
211        // FIXME(1.0): this is actually a union
212        #[cfg(target_pointer_width = "64")]
213        pub u: [u64; 4],
214        #[cfg(target_pointer_width = "32")]
215        pub u: [u32; 7],
216    }
217
218    pub struct uinput_ff_upload {
219        pub request_id: __u32,
220        pub retval: __s32,
221        pub effect: ff_effect,
222        pub old: ff_effect,
223    }
224
225    pub struct uinput_ff_erase {
226        pub request_id: __u32,
227        pub retval: __s32,
228        pub effect_id: __u32,
229    }
230
231    pub struct uinput_abs_setup {
232        pub code: __u16,
233        pub absinfo: input_absinfo,
234    }
235
236    pub struct __c_anonymous__kernel_fsid_t {
237        pub val: [c_int; 2],
238    }
239
240    pub struct posix_spawn_file_actions_t {
241        __allocated: c_int,
242        __used: c_int,
243        __actions: *mut c_int,
244        __pad: Padding<[c_int; 16]>,
245    }
246
247    pub struct posix_spawnattr_t {
248        __flags: c_short,
249        __pgrp: crate::pid_t,
250        __sd: crate::sigset_t,
251        __ss: crate::sigset_t,
252        #[cfg(any(target_env = "musl", target_env = "ohos"))]
253        __prio: c_int,
254        #[cfg(not(any(target_env = "musl", target_env = "ohos")))]
255        __sp: crate::sched_param,
256        __policy: c_int,
257        __pad: Padding<[c_int; 16]>,
258    }
259
260    pub struct genlmsghdr {
261        pub cmd: u8,
262        pub version: u8,
263        pub reserved: u16,
264    }
265
266    pub struct inotify_event {
267        pub wd: c_int,
268        pub mask: u32,
269        pub cookie: u32,
270        pub len: u32,
271    }
272
273    pub struct fanotify_response {
274        pub fd: c_int,
275        pub response: __u32,
276    }
277
278    pub struct fanotify_event_info_header {
279        pub info_type: __u8,
280        pub pad: __u8,
281        pub len: __u16,
282    }
283
284    pub struct fanotify_event_info_fid {
285        pub hdr: fanotify_event_info_header,
286        pub fsid: __kernel_fsid_t,
287        pub handle: [c_uchar; 0],
288    }
289
290    pub struct sockaddr_vm {
291        pub svm_family: crate::sa_family_t,
292        pub svm_reserved1: c_ushort,
293        pub svm_port: c_uint,
294        pub svm_cid: c_uint,
295        pub svm_zero: [u8; 4],
296    }
297
298    pub struct sock_extended_err {
299        pub ee_errno: u32,
300        pub ee_origin: u8,
301        pub ee_type: u8,
302        pub ee_code: u8,
303        pub ee_pad: u8,
304        pub ee_info: u32,
305        pub ee_data: u32,
306    }
307
308    // linux/seccomp.h
309    pub struct seccomp_data {
310        pub nr: c_int,
311        pub arch: __u32,
312        pub instruction_pointer: crate::__u64,
313        pub args: [crate::__u64; 6],
314    }
315
316    pub struct seccomp_notif_sizes {
317        pub seccomp_notif: __u16,
318        pub seccomp_notif_resp: __u16,
319        pub seccomp_data: __u16,
320    }
321
322    pub struct seccomp_notif {
323        pub id: crate::__u64,
324        pub pid: __u32,
325        pub flags: __u32,
326        pub data: seccomp_data,
327    }
328
329    pub struct seccomp_notif_resp {
330        pub id: crate::__u64,
331        pub val: crate::__s64,
332        pub error: __s32,
333        pub flags: __u32,
334    }
335
336    pub struct seccomp_notif_addfd {
337        pub id: crate::__u64,
338        pub flags: __u32,
339        pub srcfd: __u32,
340        pub newfd: __u32,
341        pub newfd_flags: __u32,
342    }
343
344    pub struct in6_ifreq {
345        pub ifr6_addr: crate::in6_addr,
346        pub ifr6_prefixlen: u32,
347        pub ifr6_ifindex: c_int,
348    }
349
350    // linux/openat2.h
351    #[non_exhaustive]
352    pub struct open_how {
353        pub flags: crate::__u64,
354        pub mode: crate::__u64,
355        pub resolve: crate::__u64,
356    }
357
358    // linux/ptp_clock.h
359    pub struct ptp_clock_time {
360        pub sec: crate::__s64,
361        pub nsec: __u32,
362        pub reserved: __u32,
363    }
364
365    pub struct ptp_extts_request {
366        pub index: c_uint,
367        pub flags: c_uint,
368        pub rsv: [c_uint; 2],
369    }
370
371    pub struct ptp_sys_offset_extended {
372        pub n_samples: c_uint,
373        pub clockid: __kernel_clockid_t,
374        pub rsv: [c_uint; 2],
375        pub ts: [[ptp_clock_time; 3]; PTP_MAX_SAMPLES as usize],
376    }
377
378    pub struct ptp_sys_offset_precise {
379        pub device: ptp_clock_time,
380        pub sys_realtime: ptp_clock_time,
381        pub sys_monoraw: ptp_clock_time,
382        pub rsv: [c_uint; 4],
383    }
384
385    pub struct ptp_extts_event {
386        pub t: ptp_clock_time,
387        index: c_uint,
388        flags: c_uint,
389        rsv: [c_uint; 2],
390    }
391
392    // linux/wireless.h
393
394    pub struct iw_param {
395        pub value: __s32,
396        pub fixed: __u8,
397        pub disabled: __u8,
398        pub flags: __u16,
399    }
400
401    pub struct iw_point {
402        pub pointer: *mut c_void,
403        pub length: __u16,
404        pub flags: __u16,
405    }
406
407    pub struct iw_freq {
408        pub m: __s32,
409        pub e: __s16,
410        pub i: __u8,
411        pub flags: __u8,
412    }
413
414    pub struct iw_quality {
415        pub qual: __u8,
416        pub level: __u8,
417        pub noise: __u8,
418        pub updated: __u8,
419    }
420
421    pub struct iw_discarded {
422        pub nwid: __u32,
423        pub code: __u32,
424        pub fragment: __u32,
425        pub retries: __u32,
426        pubmisc: __u32,
427    }
428
429    pub struct iw_missed {
430        pub beacon: __u32,
431    }
432
433    pub struct iw_scan_req {
434        pub scan_type: __u8,
435        pub essid_len: __u8,
436        pub num_channels: __u8,
437        pub flags: __u8,
438        pub bssid: crate::sockaddr,
439        pub essid: [__u8; IW_ESSID_MAX_SIZE],
440        pub min_channel_time: __u32,
441        pub max_channel_time: __u32,
442        pub channel_list: [iw_freq; IW_MAX_FREQUENCIES],
443    }
444
445    pub struct iw_encode_ext {
446        pub ext_flags: __u32,
447        pub tx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
448        pub rx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
449        pub addr: crate::sockaddr,
450        pub alg: __u16,
451        pub key_len: __u16,
452        pub key: [__u8; 0],
453    }
454
455    pub struct iw_pmksa {
456        pub cmd: __u32,
457        pub bssid: crate::sockaddr,
458        pub pmkid: [__u8; IW_PMKID_LEN],
459    }
460
461    pub struct iw_pmkid_cand {
462        pub flags: __u32,
463        pub index: __u32,
464        pub bssid: crate::sockaddr,
465    }
466
467    pub struct iw_statistics {
468        pub status: __u16,
469        pub qual: iw_quality,
470        pub discard: iw_discarded,
471        pub miss: iw_missed,
472    }
473
474    pub struct iw_range {
475        pub throughput: __u32,
476        pub min_nwid: __u32,
477        pub max_nwid: __u32,
478        pub old_num_channels: __u16,
479        pub old_num_frequency: __u8,
480        pub scan_capa: __u8,
481        pub event_capa: [__u32; 6],
482        pub sensitivity: __s32,
483        pub max_qual: iw_quality,
484        pub avg_qual: iw_quality,
485        pub num_bitrates: __u8,
486        pub bitrate: [__s32; IW_MAX_BITRATES],
487        pub min_rts: __s32,
488        pub max_rts: __s32,
489        pub min_frag: __s32,
490        pub max_frag: __s32,
491        pub min_pmp: __s32,
492        pub max_pmp: __s32,
493        pub min_pmt: __s32,
494        pub max_pmt: __s32,
495        pub pmp_flags: __u16,
496        pub pmt_flags: __u16,
497        pub pm_capa: __u16,
498        pub encoding_size: [__u16; IW_MAX_ENCODING_SIZES],
499        pub num_encoding_sizes: __u8,
500        pub max_encoding_tokens: __u8,
501        pub encoding_login_index: __u8,
502        pub txpower_capa: __u16,
503        pub num_txpower: __u8,
504        pub txpower: [__s32; IW_MAX_TXPOWER],
505        pub we_version_compiled: __u8,
506        pub we_version_source: __u8,
507        pub retry_capa: __u16,
508        pub retry_flags: __u16,
509        pub r_time_flags: __u16,
510        pub min_retry: __s32,
511        pub max_retry: __s32,
512        pub min_r_time: __s32,
513        pub max_r_time: __s32,
514        pub num_channels: __u16,
515        pub num_frequency: __u8,
516        pub freq: [iw_freq; IW_MAX_FREQUENCIES],
517        pub enc_capa: __u32,
518    }
519
520    pub struct iw_priv_args {
521        pub cmd: __u32,
522        pub set_args: __u16,
523        pub get_args: __u16,
524        pub name: [c_char; crate::IFNAMSIZ],
525    }
526
527    // #include <linux/eventpoll.h>
528
529    pub struct epoll_params {
530        pub busy_poll_usecs: u32,
531        pub busy_poll_budget: u16,
532        pub prefer_busy_poll: u8,
533        pub __pad: u8, // Must be zero
534    }
535
536    #[cfg_attr(
537        any(
538            target_pointer_width = "32",
539            target_arch = "x86_64",
540            target_arch = "powerpc64",
541            target_arch = "mips64",
542            target_arch = "mips64r6",
543            target_arch = "s390x",
544            target_arch = "sparc64",
545            target_arch = "aarch64",
546            target_arch = "riscv64",
547            target_arch = "riscv32",
548            target_arch = "loongarch64"
549        ),
550        repr(align(4))
551    )]
552    #[cfg_attr(
553        not(any(
554            target_pointer_width = "32",
555            target_arch = "x86_64",
556            target_arch = "powerpc64",
557            target_arch = "mips64",
558            target_arch = "mips64r6",
559            target_arch = "s390x",
560            target_arch = "sparc64",
561            target_arch = "aarch64",
562            target_arch = "riscv64",
563            target_arch = "riscv32",
564            target_arch = "loongarch64"
565        )),
566        repr(align(8))
567    )]
568    pub struct pthread_mutexattr_t {
569        #[doc(hidden)]
570        size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T],
571    }
572
573    #[cfg_attr(
574        any(
575            target_env = "musl",
576            target_env = "ohos",
577            target_env = "uclibc",
578            target_pointer_width = "32"
579        ),
580        repr(align(4))
581    )]
582    #[cfg_attr(
583        all(
584            not(target_env = "musl"),
585            not(target_env = "ohos"),
586            not(target_env = "uclibc"),
587            target_pointer_width = "64"
588        ),
589        repr(align(8))
590    )]
591    pub struct pthread_rwlockattr_t {
592        #[doc(hidden)]
593        size: [u8; crate::__SIZEOF_PTHREAD_RWLOCKATTR_T],
594    }
595
596    #[repr(align(4))]
597    pub struct pthread_condattr_t {
598        #[doc(hidden)]
599        size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T],
600    }
601
602    #[repr(align(4))]
603    pub struct pthread_barrierattr_t {
604        #[doc(hidden)]
605        size: [u8; crate::__SIZEOF_PTHREAD_BARRIERATTR_T],
606    }
607
608    #[cfg(not(any(target_env = "musl", target_env = "ohos")))]
609    #[repr(align(8))]
610    pub struct fanotify_event_metadata {
611        pub event_len: __u32,
612        pub vers: __u8,
613        pub reserved: __u8,
614        pub metadata_len: __u16,
615        pub mask: __u64,
616        pub fd: c_int,
617        pub pid: c_int,
618    }
619
620    // linux/ptp_clock.h
621
622    pub struct ptp_sys_offset {
623        pub n_samples: c_uint,
624        pub rsv: [c_uint; 3],
625        // FIXME(garando): replace length with `2 * PTP_MAX_SAMPLES + 1` when supported
626        pub ts: [ptp_clock_time; 51],
627    }
628
629    pub struct ptp_pin_desc {
630        pub name: [c_char; 64],
631        pub index: c_uint,
632        pub func: c_uint,
633        pub chan: c_uint,
634        pub rsv: [c_uint; 5],
635    }
636
637    pub struct ptp_clock_caps {
638        pub max_adj: c_int,
639        pub n_alarm: c_int,
640        pub n_ext_ts: c_int,
641        pub n_per_out: c_int,
642        pub pps: c_int,
643        pub n_pins: c_int,
644        pub cross_timestamping: c_int,
645        pub adjust_phase: c_int,
646        pub max_phase_adj: c_int,
647        pub rsv: [c_int; 11],
648    }
649
650    // linux/if_xdp.h
651
652    pub struct sockaddr_xdp {
653        pub sxdp_family: crate::__u16,
654        pub sxdp_flags: crate::__u16,
655        pub sxdp_ifindex: crate::__u32,
656        pub sxdp_queue_id: crate::__u32,
657        pub sxdp_shared_umem_fd: crate::__u32,
658    }
659
660    pub struct xdp_ring_offset {
661        pub producer: crate::__u64,
662        pub consumer: crate::__u64,
663        pub desc: crate::__u64,
664        pub flags: crate::__u64,
665    }
666
667    pub struct xdp_mmap_offsets {
668        pub rx: xdp_ring_offset,
669        pub tx: xdp_ring_offset,
670        pub fr: xdp_ring_offset,
671        pub cr: xdp_ring_offset,
672    }
673
674    pub struct xdp_ring_offset_v1 {
675        pub producer: crate::__u64,
676        pub consumer: crate::__u64,
677        pub desc: crate::__u64,
678    }
679
680    pub struct xdp_mmap_offsets_v1 {
681        pub rx: xdp_ring_offset_v1,
682        pub tx: xdp_ring_offset_v1,
683        pub fr: xdp_ring_offset_v1,
684        pub cr: xdp_ring_offset_v1,
685    }
686
687    pub struct xdp_umem_reg {
688        pub addr: crate::__u64,
689        pub len: crate::__u64,
690        pub chunk_size: crate::__u32,
691        pub headroom: crate::__u32,
692        pub flags: crate::__u32,
693        pub tx_metadata_len: crate::__u32,
694    }
695
696    pub struct xdp_umem_reg_v1 {
697        pub addr: crate::__u64,
698        pub len: crate::__u64,
699        pub chunk_size: crate::__u32,
700        pub headroom: crate::__u32,
701    }
702
703    pub struct xdp_statistics {
704        pub rx_dropped: crate::__u64,
705        pub rx_invalid_descs: crate::__u64,
706        pub tx_invalid_descs: crate::__u64,
707        pub rx_ring_full: crate::__u64,
708        pub rx_fill_ring_empty_descs: crate::__u64,
709        pub tx_ring_empty_descs: crate::__u64,
710    }
711
712    pub struct xdp_statistics_v1 {
713        pub rx_dropped: crate::__u64,
714        pub rx_invalid_descs: crate::__u64,
715        pub tx_invalid_descs: crate::__u64,
716    }
717
718    pub struct xdp_options {
719        pub flags: crate::__u32,
720    }
721
722    pub struct xdp_desc {
723        pub addr: crate::__u64,
724        pub len: crate::__u32,
725        pub options: crate::__u32,
726    }
727
728    pub struct xsk_tx_metadata_completion {
729        pub tx_timestamp: crate::__u64,
730    }
731
732    pub struct xsk_tx_metadata_request {
733        pub csum_start: __u16,
734        pub csum_offset: __u16,
735    }
736
737    // linux/nsfs.h
738    pub struct mnt_ns_info {
739        pub size: crate::__u32,
740        pub nr_mounts: crate::__u32,
741        pub mnt_ns_id: crate::__u64,
742    }
743
744    // linux/pidfd.h
745
746    // linux/uio.h
747
748    pub struct dmabuf_cmsg {
749        pub frag_offset: crate::__u64,
750        pub frag_size: crate::__u32,
751        pub frag_token: crate::__u32,
752        pub dmabuf_id: crate::__u32,
753        pub flags: crate::__u32,
754    }
755
756    pub struct dmabuf_token {
757        pub token_start: crate::__u32,
758        pub token_count: crate::__u32,
759    }
760
761    pub struct sockaddr_alg {
762        pub salg_family: crate::sa_family_t,
763        pub salg_type: [c_uchar; 14],
764        pub salg_feat: u32,
765        pub salg_mask: u32,
766        pub salg_name: [c_uchar; 64],
767    }
768
769    #[cfg_attr(
770        all(
771            any(target_env = "musl", target_env = "ohos"),
772            target_pointer_width = "32"
773        ),
774        repr(align(4))
775    )]
776    #[cfg_attr(
777        all(
778            any(target_env = "musl", target_env = "ohos"),
779            target_pointer_width = "64"
780        ),
781        repr(align(8))
782    )]
783    #[cfg_attr(
784        all(
785            not(any(target_env = "musl", target_env = "ohos")),
786            target_arch = "x86"
787        ),
788        repr(align(4))
789    )]
790    #[cfg_attr(
791        all(
792            not(any(target_env = "musl", target_env = "ohos")),
793            not(target_arch = "x86")
794        ),
795        repr(align(8))
796    )]
797    pub struct pthread_cond_t {
798        #[doc(hidden)]
799        size: [u8; crate::__SIZEOF_PTHREAD_COND_T],
800    }
801
802    #[cfg_attr(
803        all(
804            target_pointer_width = "32",
805            any(
806                target_arch = "mips",
807                target_arch = "mips32r6",
808                target_arch = "arm",
809                target_arch = "hexagon",
810                target_arch = "m68k",
811                target_arch = "csky",
812                target_arch = "powerpc",
813                target_arch = "sparc",
814                target_arch = "x86_64",
815                target_arch = "x86",
816            )
817        ),
818        repr(align(4))
819    )]
820    #[cfg_attr(
821        any(
822            target_pointer_width = "64",
823            not(any(
824                target_arch = "mips",
825                target_arch = "mips32r6",
826                target_arch = "arm",
827                target_arch = "hexagon",
828                target_arch = "m68k",
829                target_arch = "csky",
830                target_arch = "powerpc",
831                target_arch = "sparc",
832                target_arch = "x86_64",
833                target_arch = "x86",
834            ))
835        ),
836        repr(align(8))
837    )]
838    pub struct pthread_mutex_t {
839        pub(crate) size: [c_char; crate::__SIZEOF_PTHREAD_MUTEX_T],
840    }
841
842    #[cfg_attr(
843        all(
844            target_pointer_width = "32",
845            any(
846                target_arch = "mips",
847                target_arch = "mips32r6",
848                target_arch = "arm",
849                target_arch = "hexagon",
850                target_arch = "m68k",
851                target_arch = "csky",
852                target_arch = "powerpc",
853                target_arch = "sparc",
854                target_arch = "x86_64",
855                target_arch = "x86"
856            )
857        ),
858        repr(align(4))
859    )]
860    #[cfg_attr(
861        any(
862            target_pointer_width = "64",
863            not(any(
864                target_arch = "mips",
865                target_arch = "mips32r6",
866                target_arch = "arm",
867                target_arch = "hexagon",
868                target_arch = "m68k",
869                target_arch = "powerpc",
870                target_arch = "sparc",
871                target_arch = "x86_64",
872                target_arch = "x86"
873            ))
874        ),
875        repr(align(8))
876    )]
877    pub struct pthread_rwlock_t {
878        size: [u8; crate::__SIZEOF_PTHREAD_RWLOCK_T],
879    }
880
881    #[cfg_attr(
882        all(
883            target_pointer_width = "32",
884            any(
885                target_arch = "mips",
886                target_arch = "mips32r6",
887                target_arch = "arm",
888                target_arch = "hexagon",
889                target_arch = "m68k",
890                target_arch = "csky",
891                target_arch = "powerpc",
892                target_arch = "sparc",
893                target_arch = "x86_64",
894                target_arch = "x86"
895            )
896        ),
897        repr(align(4))
898    )]
899    #[cfg_attr(
900        any(
901            target_pointer_width = "64",
902            not(any(
903                target_arch = "mips",
904                target_arch = "mips32r6",
905                target_arch = "arm",
906                target_arch = "hexagon",
907                target_arch = "m68k",
908                target_arch = "csky",
909                target_arch = "powerpc",
910                target_arch = "sparc",
911                target_arch = "x86_64",
912                target_arch = "x86"
913            ))
914        ),
915        repr(align(8))
916    )]
917    pub struct pthread_barrier_t {
918        size: [u8; crate::__SIZEOF_PTHREAD_BARRIER_T],
919    }
920
921    pub struct uinput_setup {
922        pub id: input_id,
923        pub name: [c_char; UINPUT_MAX_NAME_SIZE],
924        pub ff_effects_max: __u32,
925    }
926
927    pub struct uinput_user_dev {
928        pub name: [c_char; UINPUT_MAX_NAME_SIZE],
929        pub id: input_id,
930        pub ff_effects_max: __u32,
931        pub absmax: [__s32; ABS_CNT],
932        pub absmin: [__s32; ABS_CNT],
933        pub absfuzz: [__s32; ABS_CNT],
934        pub absflat: [__s32; ABS_CNT],
935    }
936
937    // x32 compatibility
938    // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
939    pub struct mq_attr {
940        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
941        pub mq_flags: i64,
942        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
943        pub mq_maxmsg: i64,
944        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
945        pub mq_msgsize: i64,
946        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
947        pub mq_curmsgs: i64,
948        #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
949        pad: Padding<[i64; 4]>,
950
951        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
952        pub mq_flags: c_long,
953        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
954        pub mq_maxmsg: c_long,
955        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
956        pub mq_msgsize: c_long,
957        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
958        pub mq_curmsgs: c_long,
959        #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
960        pad: Padding<[c_long; 4]>,
961    }
962
963    pub struct hwtstamp_config {
964        pub flags: c_int,
965        pub tx_type: c_int,
966        pub rx_filter: c_int,
967    }
968
969    pub struct sched_attr {
970        pub size: __u32,
971        pub sched_policy: __u32,
972        pub sched_flags: crate::__u64,
973        pub sched_nice: __s32,
974        pub sched_priority: __u32,
975        pub sched_runtime: crate::__u64,
976        pub sched_deadline: crate::__u64,
977        pub sched_period: crate::__u64,
978    }
979
980    // linux/fcntl.h
981
982    pub struct file_handle {
983        pub handle_bytes: c_uint,
984        pub handle_type: c_int,
985        pub f_handle: [c_uchar; 0],
986    }
987
988    // include/uapi/linux/rtnetlink.h
989    pub struct ifinfomsg {
990        pub ifi_family: c_uchar,
991        __ifi_pad: Padding<c_uchar>,
992        pub ifi_type: c_ushort,
993        pub ifi_index: c_int,
994        pub ifi_flags: c_uint,
995        pub ifi_change: c_uint,
996    }
997
998    pub struct rtattr {
999        pub rta_len: c_ushort,
1000        pub rta_type: c_ushort,
1001    }
1002
1003    // netdb.h
1004    pub struct netent {
1005        pub n_name: *mut c_char,
1006        pub n_aliases: *mut *mut c_char,
1007        pub n_addrtype: c_int,
1008        pub n_net: u32,
1009    }
1010}
1011
1012cfg_if! {
1013    if #[cfg(not(target_env = "gnu"))] {
1014        extern_ty! {
1015            pub type fpos64_t; // FIXME(linux): fill this out with a struct
1016        }
1017    }
1018}
1019
1020cfg_if! {
1021    if #[cfg(not(target_arch = "sparc64"))] {
1022        #[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for iw_michaelmicfailure {
    #[inline]
    fn clone(&self) -> iw_michaelmicfailure {
        let _: ::core::clone::AssertParamIsClone<__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr>;
        let _:
                ::core::clone::AssertParamIsClone<[__u8; IW_ENCODE_SEQ_MAX_SIZE]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for iw_michaelmicfailure { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for iw_michaelmicfailure {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "iw_michaelmicfailure", "flags", &self.flags, "src_addr",
            &self.src_addr, "tsc", &&self.tsc)
    }
}s! {
1023            pub struct iw_thrspy {
1024                pub addr: crate::sockaddr,
1025                pub qual: iw_quality,
1026                pub low: iw_quality,
1027                pub high: iw_quality,
1028            }
1029
1030            pub struct iw_mlme {
1031                pub cmd: __u16,
1032                pub reason_code: __u16,
1033                pub addr: crate::sockaddr,
1034            }
1035
1036            pub struct iw_michaelmicfailure {
1037                pub flags: __u32,
1038                pub src_addr: crate::sockaddr,
1039                pub tsc: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
1040            }
1041        }
1042    }
1043}
1044
1045#[automatically_derived]
impl ::core::clone::Clone for __c_anonymous_xsk_tx_metadata_union {
    #[inline]
    fn clone(&self) -> __c_anonymous_xsk_tx_metadata_union {
        let _: ::core::clone::AssertParamIsCopy<Self>;
        *self
    }
}
#[automatically_derived]
impl ::core::marker::Copy for __c_anonymous_xsk_tx_metadata_union { }
impl ::core::fmt::Debug for __c_anonymous_xsk_tx_metadata_union {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("__c_anonymous_xsk_tx_metadata_union").finish_non_exhaustive()
    }
}s_no_extra_traits! {
1046    /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this
1047    /// type are unsound and will be removed in the future.
1048    #[deprecated(
1049        note = "this struct has unsafe trait implementations that will be \
1050                removed in the future",
1051        since = "0.2.80"
1052    )]
1053    pub struct af_alg_iv {
1054        pub ivlen: u32,
1055        pub iv: [c_uchar; 0],
1056    }
1057
1058    // linux/net_tstamp.h
1059    pub struct sock_txtime {
1060        pub clockid: crate::clockid_t,
1061        pub flags: __u32,
1062    }
1063
1064    // linux/wireless.h
1065    pub union iwreq_data {
1066        pub name: [c_char; crate::IFNAMSIZ],
1067        pub essid: iw_point,
1068        pub nwid: iw_param,
1069        pub freq: iw_freq,
1070        pub sens: iw_param,
1071        pub bitrate: iw_param,
1072        pub txpower: iw_param,
1073        pub rts: iw_param,
1074        pub frag: iw_param,
1075        pub mode: __u32,
1076        pub retry: iw_param,
1077        pub encoding: iw_point,
1078        pub power: iw_param,
1079        pub qual: iw_quality,
1080        pub ap_addr: crate::sockaddr,
1081        pub addr: crate::sockaddr,
1082        pub param: iw_param,
1083        pub data: iw_point,
1084    }
1085
1086    pub struct iw_event {
1087        pub len: __u16,
1088        pub cmd: __u16,
1089        pub u: iwreq_data,
1090    }
1091
1092    pub union __c_anonymous_iwreq {
1093        pub ifrn_name: [c_char; crate::IFNAMSIZ],
1094    }
1095
1096    pub struct iwreq {
1097        pub ifr_ifrn: __c_anonymous_iwreq,
1098        pub u: iwreq_data,
1099    }
1100
1101    // linux/ptp_clock.h
1102    pub union __c_anonymous_ptp_perout_request_1 {
1103        pub start: ptp_clock_time,
1104        pub phase: ptp_clock_time,
1105    }
1106
1107    pub union __c_anonymous_ptp_perout_request_2 {
1108        pub on: ptp_clock_time,
1109        pub rsv: [c_uint; 4],
1110    }
1111
1112    pub struct ptp_perout_request {
1113        pub anonymous_1: __c_anonymous_ptp_perout_request_1,
1114        pub period: ptp_clock_time,
1115        pub index: c_uint,
1116        pub flags: c_uint,
1117        pub anonymous_2: __c_anonymous_ptp_perout_request_2,
1118    }
1119
1120    // linux/if_xdp.h
1121    pub struct xsk_tx_metadata {
1122        pub flags: crate::__u64,
1123        pub xsk_tx_metadata_union: __c_anonymous_xsk_tx_metadata_union,
1124    }
1125
1126    pub union __c_anonymous_xsk_tx_metadata_union {
1127        pub request: xsk_tx_metadata_request,
1128        pub completion: xsk_tx_metadata_completion,
1129    }
1130}
1131
1132cfg_if! {
1133    if #[cfg(feature = "extra_traits")] {
1134        #[allow(deprecated)]
1135        impl af_alg_iv {
1136            fn as_slice(&self) -> &[u8] {
1137                unsafe { ::core::slice::from_raw_parts(self.iv.as_ptr(), self.ivlen as usize) }
1138            }
1139        }
1140
1141        #[allow(deprecated)]
1142        impl PartialEq for af_alg_iv {
1143            fn eq(&self, other: &af_alg_iv) -> bool {
1144                *self.as_slice() == *other.as_slice()
1145            }
1146        }
1147
1148        #[allow(deprecated)]
1149        impl Eq for af_alg_iv {}
1150
1151        #[allow(deprecated)]
1152        impl hash::Hash for af_alg_iv {
1153            fn hash<H: hash::Hasher>(&self, state: &mut H) {
1154                self.as_slice().hash(state);
1155            }
1156        }
1157    }
1158}
1159
1160pub const POSIX_SPAWN_USEVFORK: c_short = 64;
1161#[cfg(not(target_env = "uclibc"))]
1162pub const POSIX_SPAWN_SETSID: c_short = 128;
1163
1164pub const F_SEAL_FUTURE_WRITE: c_int = 0x0010;
1165pub const F_SEAL_EXEC: c_int = 0x0020;
1166
1167pub const IFF_LOWER_UP: c_int = 0x10000;
1168pub const IFF_DORMANT: c_int = 0x20000;
1169pub const IFF_ECHO: c_int = 0x40000;
1170
1171// linux/fcntl.h
1172pub const AT_EXECVE_CHECK: c_int = 0x10000;
1173
1174pub const MAX_HANDLE_SZ: c_int = 128;
1175pub const AT_HANDLE_FID: c_int = 0x200;
1176pub const AT_HANDLE_MNT_ID_UNIQUE: c_int = 0x001;
1177pub const AT_HANDLE_CONNECTABLE: c_int = 0x002;
1178
1179// linux/fs.h
1180
1181// Flags for preadv2/pwritev2
1182pub const RWF_HIPRI: c_int = 0x00000001;
1183pub const RWF_DSYNC: c_int = 0x00000002;
1184pub const RWF_SYNC: c_int = 0x00000004;
1185pub const RWF_NOWAIT: c_int = 0x00000008;
1186pub const RWF_APPEND: c_int = 0x00000010;
1187pub const RWF_NOAPPEND: c_int = 0x00000020;
1188pub const RWF_ATOMIC: c_int = 0x00000040;
1189pub const RWF_DONTCACHE: c_int = 0x00000080;
1190
1191// Since Linux 3.1
1192pub const SEEK_DATA: c_int = 3;
1193pub const SEEK_HOLE: c_int = 4;
1194
1195// linux/mempolicy.h
1196pub const MPOL_DEFAULT: c_int = 0;
1197pub const MPOL_PREFERRED: c_int = 1;
1198pub const MPOL_BIND: c_int = 2;
1199pub const MPOL_INTERLEAVE: c_int = 3;
1200pub const MPOL_LOCAL: c_int = 4;
1201pub const MPOL_F_NUMA_BALANCING: c_int = 1 << 13;
1202pub const MPOL_F_RELATIVE_NODES: c_int = 1 << 14;
1203pub const MPOL_F_STATIC_NODES: c_int = 1 << 15;
1204
1205#[cfg(not(target_env = "gnu"))] // defined in `new/glibc`
1206pub const PTHREAD_MUTEX_INITIALIZER: crate::pthread_mutex_t = crate::pthread_mutex_t {
1207    size: [0; crate::__SIZEOF_PTHREAD_MUTEX_T],
1208};
1209pub const PTHREAD_COND_INITIALIZER: crate::pthread_cond_t = crate::pthread_cond_t {
1210    size: [0; crate::__SIZEOF_PTHREAD_COND_T],
1211};
1212pub const PTHREAD_RWLOCK_INITIALIZER: crate::pthread_rwlock_t = crate::pthread_rwlock_t {
1213    size: [0; crate::__SIZEOF_PTHREAD_RWLOCK_T],
1214};
1215
1216pub const RENAME_NOREPLACE: c_uint = 1;
1217pub const RENAME_EXCHANGE: c_uint = 2;
1218pub const RENAME_WHITEOUT: c_uint = 4;
1219
1220pub const MSG_STAT: c_int = 11 | (crate::IPC_STAT & 0x100);
1221pub const MSG_INFO: c_int = 12;
1222
1223pub const MSG_NOERROR: c_int = 0o10000;
1224pub const MSG_EXCEPT: c_int = 0o20000;
1225pub const MSG_ZEROCOPY: c_int = 0x4000000;
1226
1227pub const SEM_UNDO: c_int = 0x1000;
1228
1229pub const GETPID: c_int = 11;
1230pub const GETVAL: c_int = 12;
1231pub const GETALL: c_int = 13;
1232pub const GETNCNT: c_int = 14;
1233pub const GETZCNT: c_int = 15;
1234pub const SETVAL: c_int = 16;
1235pub const SETALL: c_int = 17;
1236pub const SEM_STAT: c_int = 18 | (crate::IPC_STAT & 0x100);
1237pub const SEM_INFO: c_int = 19;
1238pub const SEM_STAT_ANY: c_int = 20 | (crate::IPC_STAT & 0x100);
1239
1240pub const QFMT_VFS_OLD: c_int = 1;
1241pub const QFMT_VFS_V0: c_int = 2;
1242pub const QFMT_VFS_V1: c_int = 4;
1243
1244pub const EFD_SEMAPHORE: c_int = 0x1;
1245
1246pub const RB_AUTOBOOT: c_int = 0x01234567u32 as i32;
1247pub const RB_HALT_SYSTEM: c_int = 0xcdef0123u32 as i32;
1248pub const RB_ENABLE_CAD: c_int = 0x89abcdefu32 as i32;
1249pub const RB_DISABLE_CAD: c_int = 0x00000000u32 as i32;
1250pub const RB_POWER_OFF: c_int = 0x4321fedcu32 as i32;
1251pub const RB_SW_SUSPEND: c_int = 0xd000fce2u32 as i32;
1252pub const RB_KEXEC: c_int = 0x45584543u32 as i32;
1253
1254pub const SYNC_FILE_RANGE_WAIT_BEFORE: c_uint = 1;
1255pub const SYNC_FILE_RANGE_WRITE: c_uint = 2;
1256pub const SYNC_FILE_RANGE_WAIT_AFTER: c_uint = 4;
1257
1258pub const MREMAP_MAYMOVE: c_int = 1;
1259pub const MREMAP_FIXED: c_int = 2;
1260pub const MREMAP_DONTUNMAP: c_int = 4;
1261
1262// linux/nsfs.h
1263const NSIO: c_uint = 0xb7;
1264
1265pub const NS_GET_USERNS: Ioctl = _IO(NSIO, 0x1);
1266pub const NS_GET_PARENT: Ioctl = _IO(NSIO, 0x2);
1267pub const NS_GET_NSTYPE: Ioctl = _IO(NSIO, 0x3);
1268pub const NS_GET_OWNER_UID: Ioctl = _IO(NSIO, 0x4);
1269
1270pub const NS_GET_MNTNS_ID: Ioctl = _IOR::<__u64>(NSIO, 0x5);
1271
1272pub const NS_GET_PID_FROM_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x6);
1273pub const NS_GET_TGID_FROM_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x7);
1274pub const NS_GET_PID_IN_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x8);
1275pub const NS_GET_TGID_IN_PIDNS: Ioctl = _IOR::<c_int>(NSIO, 0x9);
1276
1277pub const MNT_NS_INFO_SIZE_VER0: Ioctl = 16;
1278
1279pub const NS_MNT_GET_INFO: Ioctl = _IOR::<mnt_ns_info>(NSIO, 10);
1280pub const NS_MNT_GET_NEXT: Ioctl = _IOR::<mnt_ns_info>(NSIO, 11);
1281pub const NS_MNT_GET_PREV: Ioctl = _IOR::<mnt_ns_info>(NSIO, 12);
1282
1283pub const PR_SET_MDWE: c_int = 65;
1284pub const PR_GET_MDWE: c_int = 66;
1285pub const PR_MDWE_REFUSE_EXEC_GAIN: c_uint = 1 << 0;
1286pub const PR_MDWE_NO_INHERIT: c_uint = 1 << 1;
1287pub const PR_SET_MEMORY_MERGE: c_int = 67;
1288pub const PR_GET_MEMORY_MERGE: c_int = 68;
1289
1290pub const GRND_NONBLOCK: c_uint = 0x0001;
1291pub const GRND_RANDOM: c_uint = 0x0002;
1292pub const GRND_INSECURE: c_uint = 0x0004;
1293
1294// <linux/seccomp.h>
1295pub const SECCOMP_MODE_DISABLED: c_uint = 0;
1296pub const SECCOMP_MODE_STRICT: c_uint = 1;
1297pub const SECCOMP_MODE_FILTER: c_uint = 2;
1298
1299pub const SECCOMP_SET_MODE_STRICT: c_uint = 0;
1300pub const SECCOMP_SET_MODE_FILTER: c_uint = 1;
1301pub const SECCOMP_GET_ACTION_AVAIL: c_uint = 2;
1302pub const SECCOMP_GET_NOTIF_SIZES: c_uint = 3;
1303
1304pub const SECCOMP_FILTER_FLAG_TSYNC: c_ulong = 1 << 0;
1305pub const SECCOMP_FILTER_FLAG_LOG: c_ulong = 1 << 1;
1306pub const SECCOMP_FILTER_FLAG_SPEC_ALLOW: c_ulong = 1 << 2;
1307pub const SECCOMP_FILTER_FLAG_NEW_LISTENER: c_ulong = 1 << 3;
1308pub const SECCOMP_FILTER_FLAG_TSYNC_ESRCH: c_ulong = 1 << 4;
1309pub const SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV: c_ulong = 1 << 5;
1310
1311pub const SECCOMP_RET_KILL_PROCESS: c_uint = 0x80000000;
1312pub const SECCOMP_RET_KILL_THREAD: c_uint = 0x00000000;
1313pub const SECCOMP_RET_KILL: c_uint = SECCOMP_RET_KILL_THREAD;
1314pub const SECCOMP_RET_TRAP: c_uint = 0x00030000;
1315pub const SECCOMP_RET_ERRNO: c_uint = 0x00050000;
1316pub const SECCOMP_RET_USER_NOTIF: c_uint = 0x7fc00000;
1317pub const SECCOMP_RET_TRACE: c_uint = 0x7ff00000;
1318pub const SECCOMP_RET_LOG: c_uint = 0x7ffc0000;
1319pub const SECCOMP_RET_ALLOW: c_uint = 0x7fff0000;
1320
1321pub const SECCOMP_RET_ACTION_FULL: c_uint = 0xffff0000;
1322pub const SECCOMP_RET_ACTION: c_uint = 0x7fff0000;
1323pub const SECCOMP_RET_DATA: c_uint = 0x0000ffff;
1324
1325pub const SECCOMP_USER_NOTIF_FLAG_CONTINUE: c_ulong = 1;
1326
1327pub const SECCOMP_ADDFD_FLAG_SETFD: c_ulong = 1;
1328pub const SECCOMP_ADDFD_FLAG_SEND: c_ulong = 2;
1329
1330const SECCOMP_IOC_MAGIC: u32 = b'!' as u32;
1331
1332pub const SECCOMP_IOCTL_NOTIF_RECV: Ioctl = _IOWR::<seccomp_notif>(SECCOMP_IOC_MAGIC, 0);
1333pub const SECCOMP_IOCTL_NOTIF_SEND: Ioctl = _IOWR::<seccomp_notif_resp>(SECCOMP_IOC_MAGIC, 1);
1334pub const SECCOMP_IOCTL_NOTIF_ID_VALID: Ioctl = _IOW::<u64>(SECCOMP_IOC_MAGIC, 2);
1335pub const SECCOMP_IOCTL_NOTIF_ADDFD: Ioctl = _IOW::<seccomp_notif_addfd>(SECCOMP_IOC_MAGIC, 3);
1336pub const SECCOMP_IOCTL_NOTIF_SET_FLAGS: Ioctl = _IOW::<u64>(SECCOMP_IOC_MAGIC, 4);
1337
1338pub const TFD_CLOEXEC: c_int = O_CLOEXEC;
1339pub const TFD_NONBLOCK: c_int = O_NONBLOCK;
1340pub const TFD_TIMER_ABSTIME: c_int = 1;
1341pub const TFD_TIMER_CANCEL_ON_SET: c_int = 2;
1342
1343pub const FALLOC_FL_KEEP_SIZE: c_int = 0x01;
1344pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x02;
1345pub const FALLOC_FL_COLLAPSE_RANGE: c_int = 0x08;
1346pub const FALLOC_FL_ZERO_RANGE: c_int = 0x10;
1347pub const FALLOC_FL_INSERT_RANGE: c_int = 0x20;
1348pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x40;
1349
1350#[deprecated(
1351    since = "0.2.55",
1352    note = "ENOATTR is not available on Linux; use ENODATA instead"
1353)]
1354pub const ENOATTR: c_int = crate::ENODATA;
1355
1356pub const SO_ORIGINAL_DST: c_int = 80;
1357
1358pub const IP_RECVFRAGSIZE: c_int = 25;
1359
1360pub const IPV6_FLOWINFO: c_int = 11;
1361pub const IPV6_FLOWLABEL_MGR: c_int = 32;
1362pub const IPV6_FLOWINFO_SEND: c_int = 33;
1363pub const IPV6_RECVFRAGSIZE: c_int = 77;
1364pub const IPV6_FREEBIND: c_int = 78;
1365pub const IPV6_FLOWINFO_FLOWLABEL: c_int = 0x000fffff;
1366pub const IPV6_FLOWINFO_PRIORITY: c_int = 0x0ff00000;
1367
1368// SO_MEMINFO offsets
1369pub const SK_MEMINFO_RMEM_ALLOC: c_int = 0;
1370pub const SK_MEMINFO_RCVBUF: c_int = 1;
1371pub const SK_MEMINFO_WMEM_ALLOC: c_int = 2;
1372pub const SK_MEMINFO_SNDBUF: c_int = 3;
1373pub const SK_MEMINFO_FWD_ALLOC: c_int = 4;
1374pub const SK_MEMINFO_WMEM_QUEUED: c_int = 5;
1375pub const SK_MEMINFO_OPTMEM: c_int = 6;
1376pub const SK_MEMINFO_BACKLOG: c_int = 7;
1377pub const SK_MEMINFO_DROPS: c_int = 8;
1378
1379// linux/close_range.h
1380pub const CLOSE_RANGE_UNSHARE: c_uint = 1 << 1;
1381pub const CLOSE_RANGE_CLOEXEC: c_uint = 1 << 2;
1382
1383// linux/filter.h
1384pub const SKF_AD_OFF: c_int = -0x1000;
1385pub const SKF_AD_PROTOCOL: c_int = 0;
1386pub const SKF_AD_PKTTYPE: c_int = 4;
1387pub const SKF_AD_IFINDEX: c_int = 8;
1388pub const SKF_AD_NLATTR: c_int = 12;
1389pub const SKF_AD_NLATTR_NEST: c_int = 16;
1390pub const SKF_AD_MARK: c_int = 20;
1391pub const SKF_AD_QUEUE: c_int = 24;
1392pub const SKF_AD_HATYPE: c_int = 28;
1393pub const SKF_AD_RXHASH: c_int = 32;
1394pub const SKF_AD_CPU: c_int = 36;
1395pub const SKF_AD_ALU_XOR_X: c_int = 40;
1396pub const SKF_AD_VLAN_TAG: c_int = 44;
1397pub const SKF_AD_VLAN_TAG_PRESENT: c_int = 48;
1398pub const SKF_AD_PAY_OFFSET: c_int = 52;
1399pub const SKF_AD_RANDOM: c_int = 56;
1400pub const SKF_AD_VLAN_TPID: c_int = 60;
1401
1402/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1403/// for details.
1404pub const SKF_AD_MAX: c_int = 64;
1405
1406pub const SKF_NET_OFF: c_int = -0x100000;
1407pub const SKF_LL_OFF: c_int = -0x200000;
1408pub const BPF_NET_OFF: c_int = SKF_NET_OFF;
1409pub const BPF_LL_OFF: c_int = SKF_LL_OFF;
1410pub const BPF_MEMWORDS: c_int = 16;
1411pub const BPF_MAXINSNS: c_int = 4096;
1412
1413// linux/bpf_common.h
1414pub const BPF_LD: __u32 = 0x00;
1415pub const BPF_LDX: __u32 = 0x01;
1416pub const BPF_ST: __u32 = 0x02;
1417pub const BPF_STX: __u32 = 0x03;
1418pub const BPF_ALU: __u32 = 0x04;
1419pub const BPF_JMP: __u32 = 0x05;
1420pub const BPF_RET: __u32 = 0x06;
1421pub const BPF_MISC: __u32 = 0x07;
1422pub const BPF_W: __u32 = 0x00;
1423pub const BPF_H: __u32 = 0x08;
1424pub const BPF_B: __u32 = 0x10;
1425pub const BPF_IMM: __u32 = 0x00;
1426pub const BPF_ABS: __u32 = 0x20;
1427pub const BPF_IND: __u32 = 0x40;
1428pub const BPF_MEM: __u32 = 0x60;
1429pub const BPF_LEN: __u32 = 0x80;
1430pub const BPF_MSH: __u32 = 0xa0;
1431pub const BPF_ADD: __u32 = 0x00;
1432pub const BPF_SUB: __u32 = 0x10;
1433pub const BPF_MUL: __u32 = 0x20;
1434pub const BPF_DIV: __u32 = 0x30;
1435pub const BPF_OR: __u32 = 0x40;
1436pub const BPF_AND: __u32 = 0x50;
1437pub const BPF_LSH: __u32 = 0x60;
1438pub const BPF_RSH: __u32 = 0x70;
1439pub const BPF_NEG: __u32 = 0x80;
1440pub const BPF_MOD: __u32 = 0x90;
1441pub const BPF_XOR: __u32 = 0xa0;
1442pub const BPF_JA: __u32 = 0x00;
1443pub const BPF_JEQ: __u32 = 0x10;
1444pub const BPF_JGT: __u32 = 0x20;
1445pub const BPF_JGE: __u32 = 0x30;
1446pub const BPF_JSET: __u32 = 0x40;
1447pub const BPF_K: __u32 = 0x00;
1448pub const BPF_X: __u32 = 0x08;
1449
1450// linux/filter.h
1451
1452pub const BPF_A: __u32 = 0x10;
1453pub const BPF_TAX: __u32 = 0x00;
1454pub const BPF_TXA: __u32 = 0x80;
1455
1456// linux/openat2.h
1457pub const RESOLVE_NO_XDEV: crate::__u64 = 0x01;
1458pub const RESOLVE_NO_MAGICLINKS: crate::__u64 = 0x02;
1459pub const RESOLVE_NO_SYMLINKS: crate::__u64 = 0x04;
1460pub const RESOLVE_BENEATH: crate::__u64 = 0x08;
1461pub const RESOLVE_IN_ROOT: crate::__u64 = 0x10;
1462pub const RESOLVE_CACHED: crate::__u64 = 0x20;
1463
1464// linux/if_ether.h
1465pub const ETH_ALEN: c_int = 6;
1466pub const ETH_HLEN: c_int = 14;
1467pub const ETH_ZLEN: c_int = 60;
1468pub const ETH_DATA_LEN: c_int = 1500;
1469pub const ETH_FRAME_LEN: c_int = 1514;
1470pub const ETH_FCS_LEN: c_int = 4;
1471
1472// These are the defined Ethernet Protocol ID's.
1473pub const ETH_P_LOOP: c_int = 0x0060;
1474pub const ETH_P_PUP: c_int = 0x0200;
1475pub const ETH_P_PUPAT: c_int = 0x0201;
1476pub const ETH_P_IP: c_int = 0x0800;
1477pub const ETH_P_X25: c_int = 0x0805;
1478pub const ETH_P_ARP: c_int = 0x0806;
1479pub const ETH_P_BPQ: c_int = 0x08FF;
1480pub const ETH_P_IEEEPUP: c_int = 0x0a00;
1481pub const ETH_P_IEEEPUPAT: c_int = 0x0a01;
1482pub const ETH_P_BATMAN: c_int = 0x4305;
1483pub const ETH_P_DEC: c_int = 0x6000;
1484pub const ETH_P_DNA_DL: c_int = 0x6001;
1485pub const ETH_P_DNA_RC: c_int = 0x6002;
1486pub const ETH_P_DNA_RT: c_int = 0x6003;
1487pub const ETH_P_LAT: c_int = 0x6004;
1488pub const ETH_P_DIAG: c_int = 0x6005;
1489pub const ETH_P_CUST: c_int = 0x6006;
1490pub const ETH_P_SCA: c_int = 0x6007;
1491pub const ETH_P_TEB: c_int = 0x6558;
1492pub const ETH_P_RARP: c_int = 0x8035;
1493pub const ETH_P_ATALK: c_int = 0x809B;
1494pub const ETH_P_AARP: c_int = 0x80F3;
1495pub const ETH_P_8021Q: c_int = 0x8100;
1496pub const ETH_P_IPX: c_int = 0x8137;
1497pub const ETH_P_IPV6: c_int = 0x86DD;
1498pub const ETH_P_PAUSE: c_int = 0x8808;
1499pub const ETH_P_SLOW: c_int = 0x8809;
1500pub const ETH_P_WCCP: c_int = 0x883E;
1501pub const ETH_P_MPLS_UC: c_int = 0x8847;
1502pub const ETH_P_MPLS_MC: c_int = 0x8848;
1503pub const ETH_P_ATMMPOA: c_int = 0x884c;
1504pub const ETH_P_PPP_DISC: c_int = 0x8863;
1505pub const ETH_P_PPP_SES: c_int = 0x8864;
1506pub const ETH_P_LINK_CTL: c_int = 0x886c;
1507pub const ETH_P_ATMFATE: c_int = 0x8884;
1508pub const ETH_P_PAE: c_int = 0x888E;
1509pub const ETH_P_AOE: c_int = 0x88A2;
1510pub const ETH_P_8021AD: c_int = 0x88A8;
1511pub const ETH_P_802_EX1: c_int = 0x88B5;
1512pub const ETH_P_TIPC: c_int = 0x88CA;
1513pub const ETH_P_MACSEC: c_int = 0x88E5;
1514pub const ETH_P_8021AH: c_int = 0x88E7;
1515pub const ETH_P_MVRP: c_int = 0x88F5;
1516pub const ETH_P_1588: c_int = 0x88F7;
1517pub const ETH_P_PRP: c_int = 0x88FB;
1518pub const ETH_P_FCOE: c_int = 0x8906;
1519pub const ETH_P_TDLS: c_int = 0x890D;
1520pub const ETH_P_FIP: c_int = 0x8914;
1521pub const ETH_P_80221: c_int = 0x8917;
1522pub const ETH_P_LOOPBACK: c_int = 0x9000;
1523pub const ETH_P_QINQ1: c_int = 0x9100;
1524pub const ETH_P_QINQ2: c_int = 0x9200;
1525pub const ETH_P_QINQ3: c_int = 0x9300;
1526pub const ETH_P_EDSA: c_int = 0xDADA;
1527pub const ETH_P_AF_IUCV: c_int = 0xFBFB;
1528
1529pub const ETH_P_802_3_MIN: c_int = 0x0600;
1530
1531// Non DIX types. Won't clash for 1500 types.
1532pub const ETH_P_802_3: c_int = 0x0001;
1533pub const ETH_P_AX25: c_int = 0x0002;
1534pub const ETH_P_ALL: c_int = 0x0003;
1535pub const ETH_P_802_2: c_int = 0x0004;
1536pub const ETH_P_SNAP: c_int = 0x0005;
1537pub const ETH_P_DDCMP: c_int = 0x0006;
1538pub const ETH_P_WAN_PPP: c_int = 0x0007;
1539pub const ETH_P_PPP_MP: c_int = 0x0008;
1540pub const ETH_P_LOCALTALK: c_int = 0x0009;
1541pub const ETH_P_CANFD: c_int = 0x000D;
1542pub const ETH_P_PPPTALK: c_int = 0x0010;
1543pub const ETH_P_TR_802_2: c_int = 0x0011;
1544pub const ETH_P_MOBITEX: c_int = 0x0015;
1545pub const ETH_P_CONTROL: c_int = 0x0016;
1546pub const ETH_P_IRDA: c_int = 0x0017;
1547pub const ETH_P_ECONET: c_int = 0x0018;
1548pub const ETH_P_HDLC: c_int = 0x0019;
1549pub const ETH_P_ARCNET: c_int = 0x001A;
1550pub const ETH_P_DSA: c_int = 0x001B;
1551pub const ETH_P_TRAILER: c_int = 0x001C;
1552pub const ETH_P_PHONET: c_int = 0x00F5;
1553pub const ETH_P_IEEE802154: c_int = 0x00F6;
1554pub const ETH_P_CAIF: c_int = 0x00F7;
1555
1556// DIFF(main): changed to `c_short` in f62eb023ab
1557pub const POSIX_SPAWN_RESETIDS: c_int = 0x01;
1558pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02;
1559pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x04;
1560pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x08;
1561pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x10;
1562pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x20;
1563
1564// linux/netfilter/nfnetlink.h
1565pub const NFNLGRP_NONE: c_int = 0;
1566pub const NFNLGRP_CONNTRACK_NEW: c_int = 1;
1567pub const NFNLGRP_CONNTRACK_UPDATE: c_int = 2;
1568pub const NFNLGRP_CONNTRACK_DESTROY: c_int = 3;
1569pub const NFNLGRP_CONNTRACK_EXP_NEW: c_int = 4;
1570pub const NFNLGRP_CONNTRACK_EXP_UPDATE: c_int = 5;
1571pub const NFNLGRP_CONNTRACK_EXP_DESTROY: c_int = 6;
1572pub const NFNLGRP_NFTABLES: c_int = 7;
1573pub const NFNLGRP_ACCT_QUOTA: c_int = 8;
1574pub const NFNLGRP_NFTRACE: c_int = 9;
1575
1576pub const NFNETLINK_V0: c_int = 0;
1577
1578pub const NFNL_SUBSYS_NONE: c_int = 0;
1579pub const NFNL_SUBSYS_CTNETLINK: c_int = 1;
1580pub const NFNL_SUBSYS_CTNETLINK_EXP: c_int = 2;
1581pub const NFNL_SUBSYS_QUEUE: c_int = 3;
1582pub const NFNL_SUBSYS_ULOG: c_int = 4;
1583pub const NFNL_SUBSYS_OSF: c_int = 5;
1584pub const NFNL_SUBSYS_IPSET: c_int = 6;
1585pub const NFNL_SUBSYS_ACCT: c_int = 7;
1586pub const NFNL_SUBSYS_CTNETLINK_TIMEOUT: c_int = 8;
1587pub const NFNL_SUBSYS_CTHELPER: c_int = 9;
1588pub const NFNL_SUBSYS_NFTABLES: c_int = 10;
1589pub const NFNL_SUBSYS_NFT_COMPAT: c_int = 11;
1590pub const NFNL_SUBSYS_HOOK: c_int = 12;
1591
1592/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1593/// for details.
1594pub const NFNL_SUBSYS_COUNT: c_int = 13;
1595
1596pub const NFNL_MSG_BATCH_BEGIN: c_int = crate::NLMSG_MIN_TYPE;
1597pub const NFNL_MSG_BATCH_END: c_int = crate::NLMSG_MIN_TYPE + 1;
1598
1599pub const NFNL_BATCH_UNSPEC: c_int = 0;
1600pub const NFNL_BATCH_GENID: c_int = 1;
1601
1602// linux/netfilter/nfnetlink_log.h
1603pub const NFULNL_MSG_PACKET: c_int = 0;
1604pub const NFULNL_MSG_CONFIG: c_int = 1;
1605
1606pub const NFULA_VLAN_UNSPEC: c_int = 0;
1607pub const NFULA_VLAN_PROTO: c_int = 1;
1608pub const NFULA_VLAN_TCI: c_int = 2;
1609
1610pub const NFULA_UNSPEC: c_int = 0;
1611pub const NFULA_PACKET_HDR: c_int = 1;
1612pub const NFULA_MARK: c_int = 2;
1613pub const NFULA_TIMESTAMP: c_int = 3;
1614pub const NFULA_IFINDEX_INDEV: c_int = 4;
1615pub const NFULA_IFINDEX_OUTDEV: c_int = 5;
1616pub const NFULA_IFINDEX_PHYSINDEV: c_int = 6;
1617pub const NFULA_IFINDEX_PHYSOUTDEV: c_int = 7;
1618pub const NFULA_HWADDR: c_int = 8;
1619pub const NFULA_PAYLOAD: c_int = 9;
1620pub const NFULA_PREFIX: c_int = 10;
1621pub const NFULA_UID: c_int = 11;
1622pub const NFULA_SEQ: c_int = 12;
1623pub const NFULA_SEQ_GLOBAL: c_int = 13;
1624pub const NFULA_GID: c_int = 14;
1625pub const NFULA_HWTYPE: c_int = 15;
1626pub const NFULA_HWHEADER: c_int = 16;
1627pub const NFULA_HWLEN: c_int = 17;
1628pub const NFULA_CT: c_int = 18;
1629pub const NFULA_CT_INFO: c_int = 19;
1630pub const NFULA_VLAN: c_int = 20;
1631pub const NFULA_L2HDR: c_int = 21;
1632
1633pub const NFULNL_CFG_CMD_NONE: c_int = 0;
1634pub const NFULNL_CFG_CMD_BIND: c_int = 1;
1635pub const NFULNL_CFG_CMD_UNBIND: c_int = 2;
1636pub const NFULNL_CFG_CMD_PF_BIND: c_int = 3;
1637pub const NFULNL_CFG_CMD_PF_UNBIND: c_int = 4;
1638
1639pub const NFULA_CFG_UNSPEC: c_int = 0;
1640pub const NFULA_CFG_CMD: c_int = 1;
1641pub const NFULA_CFG_MODE: c_int = 2;
1642pub const NFULA_CFG_NLBUFSIZ: c_int = 3;
1643pub const NFULA_CFG_TIMEOUT: c_int = 4;
1644pub const NFULA_CFG_QTHRESH: c_int = 5;
1645pub const NFULA_CFG_FLAGS: c_int = 6;
1646
1647pub const NFULNL_COPY_NONE: c_int = 0x00;
1648pub const NFULNL_COPY_META: c_int = 0x01;
1649pub const NFULNL_COPY_PACKET: c_int = 0x02;
1650
1651pub const NFULNL_CFG_F_SEQ: c_int = 0x0001;
1652pub const NFULNL_CFG_F_SEQ_GLOBAL: c_int = 0x0002;
1653pub const NFULNL_CFG_F_CONNTRACK: c_int = 0x0004;
1654
1655// linux/netfilter/nfnetlink_queue.h
1656pub const NFQNL_MSG_PACKET: c_int = 0;
1657pub const NFQNL_MSG_VERDICT: c_int = 1;
1658pub const NFQNL_MSG_CONFIG: c_int = 2;
1659pub const NFQNL_MSG_VERDICT_BATCH: c_int = 3;
1660
1661pub const NFQA_UNSPEC: c_int = 0;
1662pub const NFQA_PACKET_HDR: c_int = 1;
1663pub const NFQA_VERDICT_HDR: c_int = 2;
1664pub const NFQA_MARK: c_int = 3;
1665pub const NFQA_TIMESTAMP: c_int = 4;
1666pub const NFQA_IFINDEX_INDEV: c_int = 5;
1667pub const NFQA_IFINDEX_OUTDEV: c_int = 6;
1668pub const NFQA_IFINDEX_PHYSINDEV: c_int = 7;
1669pub const NFQA_IFINDEX_PHYSOUTDEV: c_int = 8;
1670pub const NFQA_HWADDR: c_int = 9;
1671pub const NFQA_PAYLOAD: c_int = 10;
1672pub const NFQA_CT: c_int = 11;
1673pub const NFQA_CT_INFO: c_int = 12;
1674pub const NFQA_CAP_LEN: c_int = 13;
1675pub const NFQA_SKB_INFO: c_int = 14;
1676pub const NFQA_EXP: c_int = 15;
1677pub const NFQA_UID: c_int = 16;
1678pub const NFQA_GID: c_int = 17;
1679pub const NFQA_SECCTX: c_int = 18;
1680pub const NFQA_VLAN: c_int = 19;
1681pub const NFQA_L2HDR: c_int = 20;
1682pub const NFQA_PRIORITY: c_int = 21;
1683
1684pub const NFQA_VLAN_UNSPEC: c_int = 0;
1685pub const NFQA_VLAN_PROTO: c_int = 1;
1686pub const NFQA_VLAN_TCI: c_int = 2;
1687
1688pub const NFQNL_CFG_CMD_NONE: c_int = 0;
1689pub const NFQNL_CFG_CMD_BIND: c_int = 1;
1690pub const NFQNL_CFG_CMD_UNBIND: c_int = 2;
1691pub const NFQNL_CFG_CMD_PF_BIND: c_int = 3;
1692pub const NFQNL_CFG_CMD_PF_UNBIND: c_int = 4;
1693
1694pub const NFQNL_COPY_NONE: c_int = 0;
1695pub const NFQNL_COPY_META: c_int = 1;
1696pub const NFQNL_COPY_PACKET: c_int = 2;
1697
1698pub const NFQA_CFG_UNSPEC: c_int = 0;
1699pub const NFQA_CFG_CMD: c_int = 1;
1700pub const NFQA_CFG_PARAMS: c_int = 2;
1701pub const NFQA_CFG_QUEUE_MAXLEN: c_int = 3;
1702pub const NFQA_CFG_MASK: c_int = 4;
1703pub const NFQA_CFG_FLAGS: c_int = 5;
1704
1705pub const NFQA_CFG_F_FAIL_OPEN: c_int = 0x0001;
1706pub const NFQA_CFG_F_CONNTRACK: c_int = 0x0002;
1707pub const NFQA_CFG_F_GSO: c_int = 0x0004;
1708pub const NFQA_CFG_F_UID_GID: c_int = 0x0008;
1709pub const NFQA_CFG_F_SECCTX: c_int = 0x0010;
1710
1711/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1712/// for details.
1713pub const NFQA_CFG_F_MAX: c_int = 0x0020;
1714
1715pub const NFQA_SKB_CSUMNOTREADY: c_int = 0x0001;
1716pub const NFQA_SKB_GSO: c_int = 0x0002;
1717pub const NFQA_SKB_CSUM_NOTVERIFIED: c_int = 0x0004;
1718
1719// linux/genetlink.h
1720
1721pub const GENL_NAMSIZ: c_int = 16;
1722
1723pub const GENL_MIN_ID: c_int = crate::NLMSG_MIN_TYPE;
1724pub const GENL_MAX_ID: c_int = 1023;
1725
1726pub const GENL_ADMIN_PERM: c_int = 0x01;
1727pub const GENL_CMD_CAP_DO: c_int = 0x02;
1728pub const GENL_CMD_CAP_DUMP: c_int = 0x04;
1729pub const GENL_CMD_CAP_HASPOL: c_int = 0x08;
1730
1731pub const GENL_ID_CTRL: c_int = crate::NLMSG_MIN_TYPE;
1732
1733pub const CTRL_CMD_UNSPEC: c_int = 0;
1734pub const CTRL_CMD_NEWFAMILY: c_int = 1;
1735pub const CTRL_CMD_DELFAMILY: c_int = 2;
1736pub const CTRL_CMD_GETFAMILY: c_int = 3;
1737pub const CTRL_CMD_NEWOPS: c_int = 4;
1738pub const CTRL_CMD_DELOPS: c_int = 5;
1739pub const CTRL_CMD_GETOPS: c_int = 6;
1740pub const CTRL_CMD_NEWMCAST_GRP: c_int = 7;
1741pub const CTRL_CMD_DELMCAST_GRP: c_int = 8;
1742pub const CTRL_CMD_GETMCAST_GRP: c_int = 9;
1743
1744pub const CTRL_ATTR_UNSPEC: c_int = 0;
1745pub const CTRL_ATTR_FAMILY_ID: c_int = 1;
1746pub const CTRL_ATTR_FAMILY_NAME: c_int = 2;
1747pub const CTRL_ATTR_VERSION: c_int = 3;
1748pub const CTRL_ATTR_HDRSIZE: c_int = 4;
1749pub const CTRL_ATTR_MAXATTR: c_int = 5;
1750pub const CTRL_ATTR_OPS: c_int = 6;
1751pub const CTRL_ATTR_MCAST_GROUPS: c_int = 7;
1752
1753pub const CTRL_ATTR_OP_UNSPEC: c_int = 0;
1754pub const CTRL_ATTR_OP_ID: c_int = 1;
1755pub const CTRL_ATTR_OP_FLAGS: c_int = 2;
1756
1757pub const CTRL_ATTR_MCAST_GRP_UNSPEC: c_int = 0;
1758pub const CTRL_ATTR_MCAST_GRP_NAME: c_int = 1;
1759pub const CTRL_ATTR_MCAST_GRP_ID: c_int = 2;
1760
1761// linux/netfilter.h
1762pub const NF_DROP: c_int = 0;
1763pub const NF_ACCEPT: c_int = 1;
1764pub const NF_STOLEN: c_int = 2;
1765pub const NF_QUEUE: c_int = 3;
1766pub const NF_REPEAT: c_int = 4;
1767pub const NF_STOP: c_int = 5;
1768pub const NF_MAX_VERDICT: c_int = NF_STOP;
1769
1770pub const NF_VERDICT_MASK: c_int = 0x000000ff;
1771pub const NF_VERDICT_FLAG_QUEUE_BYPASS: c_int = 0x00008000;
1772
1773pub const NF_VERDICT_QMASK: c_int = u32_cast_int(0xffff0000);
1774pub const NF_VERDICT_QBITS: c_int = 16;
1775
1776pub const NF_VERDICT_BITS: c_int = 16;
1777
1778pub const NF_INET_PRE_ROUTING: c_int = 0;
1779pub const NF_INET_LOCAL_IN: c_int = 1;
1780pub const NF_INET_FORWARD: c_int = 2;
1781pub const NF_INET_LOCAL_OUT: c_int = 3;
1782pub const NF_INET_POST_ROUTING: c_int = 4;
1783pub const NF_INET_NUMHOOKS: c_int = 5;
1784pub const NF_INET_INGRESS: c_int = NF_INET_NUMHOOKS;
1785
1786pub const NF_NETDEV_INGRESS: c_int = 0;
1787pub const NF_NETDEV_EGRESS: c_int = 1;
1788pub const NF_NETDEV_NUMHOOKS: c_int = 2;
1789
1790// Some NFPROTO are not compatible with musl and are defined in submodules.
1791pub const NFPROTO_UNSPEC: c_int = 0;
1792pub const NFPROTO_INET: c_int = 1;
1793pub const NFPROTO_IPV4: c_int = 2;
1794pub const NFPROTO_ARP: c_int = 3;
1795pub const NFPROTO_NETDEV: c_int = 5;
1796pub const NFPROTO_BRIDGE: c_int = 7;
1797pub const NFPROTO_IPV6: c_int = 10;
1798pub const NFPROTO_DECNET: c_int = 12;
1799pub const NFPROTO_NUMPROTO: c_int = 13;
1800
1801// linux/netfilter_arp.h
1802pub const NF_ARP: c_int = 0;
1803pub const NF_ARP_IN: c_int = 0;
1804pub const NF_ARP_OUT: c_int = 1;
1805pub const NF_ARP_FORWARD: c_int = 2;
1806pub const NF_ARP_NUMHOOKS: c_int = 3;
1807
1808// linux/netfilter_bridge.h
1809pub const NF_BR_PRE_ROUTING: c_int = 0;
1810pub const NF_BR_LOCAL_IN: c_int = 1;
1811pub const NF_BR_FORWARD: c_int = 2;
1812pub const NF_BR_LOCAL_OUT: c_int = 3;
1813pub const NF_BR_POST_ROUTING: c_int = 4;
1814pub const NF_BR_BROUTING: c_int = 5;
1815pub const NF_BR_NUMHOOKS: c_int = 6;
1816
1817pub const NF_BR_PRI_FIRST: c_int = crate::INT_MIN;
1818pub const NF_BR_PRI_NAT_DST_BRIDGED: c_int = -300;
1819pub const NF_BR_PRI_FILTER_BRIDGED: c_int = -200;
1820pub const NF_BR_PRI_BRNF: c_int = 0;
1821pub const NF_BR_PRI_NAT_DST_OTHER: c_int = 100;
1822pub const NF_BR_PRI_FILTER_OTHER: c_int = 200;
1823pub const NF_BR_PRI_NAT_SRC: c_int = 300;
1824
1825/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1826/// for details.
1827pub const NF_BR_PRI_LAST: c_int = crate::INT_MAX;
1828
1829// linux/netfilter_ipv4.h
1830pub const NF_IP_PRE_ROUTING: c_int = 0;
1831pub const NF_IP_LOCAL_IN: c_int = 1;
1832pub const NF_IP_FORWARD: c_int = 2;
1833pub const NF_IP_LOCAL_OUT: c_int = 3;
1834pub const NF_IP_POST_ROUTING: c_int = 4;
1835pub const NF_IP_NUMHOOKS: c_int = 5;
1836
1837pub const NF_IP_PRI_FIRST: c_int = crate::INT_MIN;
1838pub const NF_IP_PRI_RAW_BEFORE_DEFRAG: c_int = -450;
1839pub const NF_IP_PRI_CONNTRACK_DEFRAG: c_int = -400;
1840pub const NF_IP_PRI_RAW: c_int = -300;
1841pub const NF_IP_PRI_SELINUX_FIRST: c_int = -225;
1842pub const NF_IP_PRI_CONNTRACK: c_int = -200;
1843pub const NF_IP_PRI_MANGLE: c_int = -150;
1844pub const NF_IP_PRI_NAT_DST: c_int = -100;
1845pub const NF_IP_PRI_FILTER: c_int = 0;
1846pub const NF_IP_PRI_SECURITY: c_int = 50;
1847pub const NF_IP_PRI_NAT_SRC: c_int = 100;
1848pub const NF_IP_PRI_SELINUX_LAST: c_int = 225;
1849pub const NF_IP_PRI_CONNTRACK_HELPER: c_int = 300;
1850pub const NF_IP_PRI_CONNTRACK_CONFIRM: c_int = crate::INT_MAX;
1851
1852/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1853/// for details.
1854pub const NF_IP_PRI_LAST: c_int = crate::INT_MAX;
1855
1856// linux/netfilter_ipv6.h
1857pub const NF_IP6_PRE_ROUTING: c_int = 0;
1858pub const NF_IP6_LOCAL_IN: c_int = 1;
1859pub const NF_IP6_FORWARD: c_int = 2;
1860pub const NF_IP6_LOCAL_OUT: c_int = 3;
1861pub const NF_IP6_POST_ROUTING: c_int = 4;
1862pub const NF_IP6_NUMHOOKS: c_int = 5;
1863
1864pub const NF_IP6_PRI_FIRST: c_int = crate::INT_MIN;
1865pub const NF_IP6_PRI_RAW_BEFORE_DEFRAG: c_int = -450;
1866pub const NF_IP6_PRI_CONNTRACK_DEFRAG: c_int = -400;
1867pub const NF_IP6_PRI_RAW: c_int = -300;
1868pub const NF_IP6_PRI_SELINUX_FIRST: c_int = -225;
1869pub const NF_IP6_PRI_CONNTRACK: c_int = -200;
1870pub const NF_IP6_PRI_MANGLE: c_int = -150;
1871pub const NF_IP6_PRI_NAT_DST: c_int = -100;
1872pub const NF_IP6_PRI_FILTER: c_int = 0;
1873pub const NF_IP6_PRI_SECURITY: c_int = 50;
1874pub const NF_IP6_PRI_NAT_SRC: c_int = 100;
1875pub const NF_IP6_PRI_SELINUX_LAST: c_int = 225;
1876pub const NF_IP6_PRI_CONNTRACK_HELPER: c_int = 300;
1877
1878/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1879/// for details.
1880pub const NF_IP6_PRI_LAST: c_int = crate::INT_MAX;
1881
1882// linux/netfilter_ipv6/ip6_tables.h
1883pub const IP6T_SO_ORIGINAL_DST: c_int = 80;
1884
1885pub const SIOCSHWTSTAMP: c_ulong = 0x000089b0;
1886pub const SIOCGHWTSTAMP: c_ulong = 0x000089b1;
1887
1888// wireless.h
1889pub const WIRELESS_EXT: c_ulong = 0x16;
1890
1891pub const SIOCSIWCOMMIT: c_ulong = 0x8B00;
1892pub const SIOCGIWNAME: c_ulong = 0x8B01;
1893
1894pub const SIOCSIWNWID: c_ulong = 0x8B02;
1895pub const SIOCGIWNWID: c_ulong = 0x8B03;
1896pub const SIOCSIWFREQ: c_ulong = 0x8B04;
1897pub const SIOCGIWFREQ: c_ulong = 0x8B05;
1898pub const SIOCSIWMODE: c_ulong = 0x8B06;
1899pub const SIOCGIWMODE: c_ulong = 0x8B07;
1900pub const SIOCSIWSENS: c_ulong = 0x8B08;
1901pub const SIOCGIWSENS: c_ulong = 0x8B09;
1902
1903pub const SIOCSIWRANGE: c_ulong = 0x8B0A;
1904pub const SIOCGIWRANGE: c_ulong = 0x8B0B;
1905pub const SIOCSIWPRIV: c_ulong = 0x8B0C;
1906pub const SIOCGIWPRIV: c_ulong = 0x8B0D;
1907pub const SIOCSIWSTATS: c_ulong = 0x8B0E;
1908pub const SIOCGIWSTATS: c_ulong = 0x8B0F;
1909
1910pub const SIOCSIWSPY: c_ulong = 0x8B10;
1911pub const SIOCGIWSPY: c_ulong = 0x8B11;
1912pub const SIOCSIWTHRSPY: c_ulong = 0x8B12;
1913pub const SIOCGIWTHRSPY: c_ulong = 0x8B13;
1914
1915pub const SIOCSIWAP: c_ulong = 0x8B14;
1916pub const SIOCGIWAP: c_ulong = 0x8B15;
1917pub const SIOCGIWAPLIST: c_ulong = 0x8B17;
1918pub const SIOCSIWSCAN: c_ulong = 0x8B18;
1919pub const SIOCGIWSCAN: c_ulong = 0x8B19;
1920
1921pub const SIOCSIWESSID: c_ulong = 0x8B1A;
1922pub const SIOCGIWESSID: c_ulong = 0x8B1B;
1923pub const SIOCSIWNICKN: c_ulong = 0x8B1C;
1924pub const SIOCGIWNICKN: c_ulong = 0x8B1D;
1925
1926pub const SIOCSIWRATE: c_ulong = 0x8B20;
1927pub const SIOCGIWRATE: c_ulong = 0x8B21;
1928pub const SIOCSIWRTS: c_ulong = 0x8B22;
1929pub const SIOCGIWRTS: c_ulong = 0x8B23;
1930pub const SIOCSIWFRAG: c_ulong = 0x8B24;
1931pub const SIOCGIWFRAG: c_ulong = 0x8B25;
1932pub const SIOCSIWTXPOW: c_ulong = 0x8B26;
1933pub const SIOCGIWTXPOW: c_ulong = 0x8B27;
1934pub const SIOCSIWRETRY: c_ulong = 0x8B28;
1935pub const SIOCGIWRETRY: c_ulong = 0x8B29;
1936
1937pub const SIOCSIWENCODE: c_ulong = 0x8B2A;
1938pub const SIOCGIWENCODE: c_ulong = 0x8B2B;
1939
1940pub const SIOCSIWPOWER: c_ulong = 0x8B2C;
1941pub const SIOCGIWPOWER: c_ulong = 0x8B2D;
1942
1943pub const SIOCSIWGENIE: c_ulong = 0x8B30;
1944pub const SIOCGIWGENIE: c_ulong = 0x8B31;
1945
1946pub const SIOCSIWMLME: c_ulong = 0x8B16;
1947
1948pub const SIOCSIWAUTH: c_ulong = 0x8B32;
1949pub const SIOCGIWAUTH: c_ulong = 0x8B33;
1950
1951pub const SIOCSIWENCODEEXT: c_ulong = 0x8B34;
1952pub const SIOCGIWENCODEEXT: c_ulong = 0x8B35;
1953
1954pub const SIOCSIWPMKSA: c_ulong = 0x8B36;
1955
1956pub const SIOCIWFIRSTPRIV: c_ulong = 0x8BE0;
1957
1958/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1959/// for details.
1960pub const SIOCIWLASTPRIV: c_ulong = 0x8BFF;
1961
1962pub const SIOCIWFIRST: c_ulong = 0x8B00;
1963
1964/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1965/// for details.
1966pub const SIOCIWLAST: c_ulong = SIOCIWLASTPRIV;
1967
1968pub const IWEVTXDROP: c_ulong = 0x8C00;
1969pub const IWEVQUAL: c_ulong = 0x8C01;
1970pub const IWEVCUSTOM: c_ulong = 0x8C02;
1971pub const IWEVREGISTERED: c_ulong = 0x8C03;
1972pub const IWEVEXPIRED: c_ulong = 0x8C04;
1973pub const IWEVGENIE: c_ulong = 0x8C05;
1974pub const IWEVMICHAELMICFAILURE: c_ulong = 0x8C06;
1975pub const IWEVASSOCREQIE: c_ulong = 0x8C07;
1976pub const IWEVASSOCRESPIE: c_ulong = 0x8C08;
1977pub const IWEVPMKIDCAND: c_ulong = 0x8C09;
1978pub const IWEVFIRST: c_ulong = 0x8C00;
1979
1980pub const IW_PRIV_TYPE_MASK: c_ulong = 0x7000;
1981pub const IW_PRIV_TYPE_NONE: c_ulong = 0x0000;
1982pub const IW_PRIV_TYPE_BYTE: c_ulong = 0x1000;
1983pub const IW_PRIV_TYPE_CHAR: c_ulong = 0x2000;
1984pub const IW_PRIV_TYPE_INT: c_ulong = 0x4000;
1985pub const IW_PRIV_TYPE_FLOAT: c_ulong = 0x5000;
1986pub const IW_PRIV_TYPE_ADDR: c_ulong = 0x6000;
1987
1988pub const IW_PRIV_SIZE_FIXED: c_ulong = 0x0800;
1989
1990pub const IW_PRIV_SIZE_MASK: c_ulong = 0x07FF;
1991
1992pub const IW_MAX_FREQUENCIES: usize = 32;
1993pub const IW_MAX_BITRATES: usize = 32;
1994pub const IW_MAX_TXPOWER: usize = 8;
1995pub const IW_MAX_SPY: usize = 8;
1996pub const IW_MAX_AP: usize = 64;
1997pub const IW_ESSID_MAX_SIZE: usize = 32;
1998
1999pub const IW_MODE_AUTO: usize = 0;
2000pub const IW_MODE_ADHOC: usize = 1;
2001pub const IW_MODE_INFRA: usize = 2;
2002pub const IW_MODE_MASTER: usize = 3;
2003pub const IW_MODE_REPEAT: usize = 4;
2004pub const IW_MODE_SECOND: usize = 5;
2005pub const IW_MODE_MONITOR: usize = 6;
2006pub const IW_MODE_MESH: usize = 7;
2007
2008pub const IW_QUAL_QUAL_UPDATED: c_ulong = 0x01;
2009pub const IW_QUAL_LEVEL_UPDATED: c_ulong = 0x02;
2010pub const IW_QUAL_NOISE_UPDATED: c_ulong = 0x04;
2011pub const IW_QUAL_ALL_UPDATED: c_ulong = 0x07;
2012pub const IW_QUAL_DBM: c_ulong = 0x08;
2013pub const IW_QUAL_QUAL_INVALID: c_ulong = 0x10;
2014pub const IW_QUAL_LEVEL_INVALID: c_ulong = 0x20;
2015pub const IW_QUAL_NOISE_INVALID: c_ulong = 0x40;
2016pub const IW_QUAL_RCPI: c_ulong = 0x80;
2017pub const IW_QUAL_ALL_INVALID: c_ulong = 0x70;
2018
2019pub const IW_FREQ_AUTO: c_ulong = 0x00;
2020pub const IW_FREQ_FIXED: c_ulong = 0x01;
2021
2022pub const IW_MAX_ENCODING_SIZES: usize = 8;
2023pub const IW_ENCODING_TOKEN_MAX: usize = 64;
2024
2025pub const IW_ENCODE_INDEX: c_ulong = 0x00FF;
2026pub const IW_ENCODE_FLAGS: c_ulong = 0xFF00;
2027pub const IW_ENCODE_MODE: c_ulong = 0xF000;
2028pub const IW_ENCODE_DISABLED: c_ulong = 0x8000;
2029pub const IW_ENCODE_ENABLED: c_ulong = 0x0000;
2030pub const IW_ENCODE_RESTRICTED: c_ulong = 0x4000;
2031pub const IW_ENCODE_OPEN: c_ulong = 0x2000;
2032pub const IW_ENCODE_NOKEY: c_ulong = 0x0800;
2033pub const IW_ENCODE_TEMP: c_ulong = 0x0400;
2034
2035pub const IW_POWER_ON: c_ulong = 0x0000;
2036pub const IW_POWER_TYPE: c_ulong = 0xF000;
2037pub const IW_POWER_PERIOD: c_ulong = 0x1000;
2038pub const IW_POWER_TIMEOUT: c_ulong = 0x2000;
2039pub const IW_POWER_MODE: c_ulong = 0x0F00;
2040pub const IW_POWER_UNICAST_R: c_ulong = 0x0100;
2041pub const IW_POWER_MULTICAST_R: c_ulong = 0x0200;
2042pub const IW_POWER_ALL_R: c_ulong = 0x0300;
2043pub const IW_POWER_FORCE_S: c_ulong = 0x0400;
2044pub const IW_POWER_REPEATER: c_ulong = 0x0800;
2045pub const IW_POWER_MODIFIER: c_ulong = 0x000F;
2046pub const IW_POWER_MIN: c_ulong = 0x0001;
2047pub const IW_POWER_MAX: c_ulong = 0x0002;
2048pub const IW_POWER_RELATIVE: c_ulong = 0x0004;
2049
2050pub const IW_TXPOW_TYPE: c_ulong = 0x00FF;
2051pub const IW_TXPOW_DBM: c_ulong = 0x0000;
2052pub const IW_TXPOW_MWATT: c_ulong = 0x0001;
2053pub const IW_TXPOW_RELATIVE: c_ulong = 0x0002;
2054pub const IW_TXPOW_RANGE: c_ulong = 0x1000;
2055
2056pub const IW_RETRY_ON: c_ulong = 0x0000;
2057pub const IW_RETRY_TYPE: c_ulong = 0xF000;
2058pub const IW_RETRY_LIMIT: c_ulong = 0x1000;
2059pub const IW_RETRY_LIFETIME: c_ulong = 0x2000;
2060pub const IW_RETRY_MODIFIER: c_ulong = 0x00FF;
2061pub const IW_RETRY_MIN: c_ulong = 0x0001;
2062pub const IW_RETRY_MAX: c_ulong = 0x0002;
2063pub const IW_RETRY_RELATIVE: c_ulong = 0x0004;
2064pub const IW_RETRY_SHORT: c_ulong = 0x0010;
2065pub const IW_RETRY_LONG: c_ulong = 0x0020;
2066
2067pub const IW_SCAN_DEFAULT: c_ulong = 0x0000;
2068pub const IW_SCAN_ALL_ESSID: c_ulong = 0x0001;
2069pub const IW_SCAN_THIS_ESSID: c_ulong = 0x0002;
2070pub const IW_SCAN_ALL_FREQ: c_ulong = 0x0004;
2071pub const IW_SCAN_THIS_FREQ: c_ulong = 0x0008;
2072pub const IW_SCAN_ALL_MODE: c_ulong = 0x0010;
2073pub const IW_SCAN_THIS_MODE: c_ulong = 0x0020;
2074pub const IW_SCAN_ALL_RATE: c_ulong = 0x0040;
2075pub const IW_SCAN_THIS_RATE: c_ulong = 0x0080;
2076
2077pub const IW_SCAN_TYPE_ACTIVE: usize = 0;
2078pub const IW_SCAN_TYPE_PASSIVE: usize = 1;
2079
2080pub const IW_SCAN_MAX_DATA: usize = 4096;
2081
2082pub const IW_SCAN_CAPA_NONE: c_ulong = 0x00;
2083pub const IW_SCAN_CAPA_ESSID: c_ulong = 0x01;
2084pub const IW_SCAN_CAPA_BSSID: c_ulong = 0x02;
2085pub const IW_SCAN_CAPA_CHANNEL: c_ulong = 0x04;
2086pub const IW_SCAN_CAPA_MODE: c_ulong = 0x08;
2087pub const IW_SCAN_CAPA_RATE: c_ulong = 0x10;
2088pub const IW_SCAN_CAPA_TYPE: c_ulong = 0x20;
2089pub const IW_SCAN_CAPA_TIME: c_ulong = 0x40;
2090
2091pub const IW_CUSTOM_MAX: c_ulong = 256;
2092
2093pub const IW_GENERIC_IE_MAX: c_ulong = 1024;
2094
2095pub const IW_MLME_DEAUTH: c_ulong = 0;
2096pub const IW_MLME_DISASSOC: c_ulong = 1;
2097pub const IW_MLME_AUTH: c_ulong = 2;
2098pub const IW_MLME_ASSOC: c_ulong = 3;
2099
2100pub const IW_AUTH_INDEX: c_ulong = 0x0FFF;
2101pub const IW_AUTH_FLAGS: c_ulong = 0xF000;
2102
2103pub const IW_AUTH_WPA_VERSION: usize = 0;
2104pub const IW_AUTH_CIPHER_PAIRWISE: usize = 1;
2105pub const IW_AUTH_CIPHER_GROUP: usize = 2;
2106pub const IW_AUTH_KEY_MGMT: usize = 3;
2107pub const IW_AUTH_TKIP_COUNTERMEASURES: usize = 4;
2108pub const IW_AUTH_DROP_UNENCRYPTED: usize = 5;
2109pub const IW_AUTH_80211_AUTH_ALG: usize = 6;
2110pub const IW_AUTH_WPA_ENABLED: usize = 7;
2111pub const IW_AUTH_RX_UNENCRYPTED_EAPOL: usize = 8;
2112pub const IW_AUTH_ROAMING_CONTROL: usize = 9;
2113pub const IW_AUTH_PRIVACY_INVOKED: usize = 10;
2114pub const IW_AUTH_CIPHER_GROUP_MGMT: usize = 11;
2115pub const IW_AUTH_MFP: usize = 12;
2116
2117pub const IW_AUTH_WPA_VERSION_DISABLED: c_ulong = 0x00000001;
2118pub const IW_AUTH_WPA_VERSION_WPA: c_ulong = 0x00000002;
2119pub const IW_AUTH_WPA_VERSION_WPA2: c_ulong = 0x00000004;
2120
2121pub const IW_AUTH_CIPHER_NONE: c_ulong = 0x00000001;
2122pub const IW_AUTH_CIPHER_WEP40: c_ulong = 0x00000002;
2123pub const IW_AUTH_CIPHER_TKIP: c_ulong = 0x00000004;
2124pub const IW_AUTH_CIPHER_CCMP: c_ulong = 0x00000008;
2125pub const IW_AUTH_CIPHER_WEP104: c_ulong = 0x00000010;
2126pub const IW_AUTH_CIPHER_AES_CMAC: c_ulong = 0x00000020;
2127
2128pub const IW_AUTH_KEY_MGMT_802_1X: usize = 1;
2129pub const IW_AUTH_KEY_MGMT_PSK: usize = 2;
2130
2131pub const IW_AUTH_ALG_OPEN_SYSTEM: c_ulong = 0x00000001;
2132pub const IW_AUTH_ALG_SHARED_KEY: c_ulong = 0x00000002;
2133pub const IW_AUTH_ALG_LEAP: c_ulong = 0x00000004;
2134
2135pub const IW_AUTH_ROAMING_ENABLE: usize = 0;
2136pub const IW_AUTH_ROAMING_DISABLE: usize = 1;
2137
2138pub const IW_AUTH_MFP_DISABLED: usize = 0;
2139pub const IW_AUTH_MFP_OPTIONAL: usize = 1;
2140pub const IW_AUTH_MFP_REQUIRED: usize = 2;
2141
2142pub const IW_ENCODE_SEQ_MAX_SIZE: usize = 8;
2143
2144pub const IW_ENCODE_ALG_NONE: usize = 0;
2145pub const IW_ENCODE_ALG_WEP: usize = 1;
2146pub const IW_ENCODE_ALG_TKIP: usize = 2;
2147pub const IW_ENCODE_ALG_CCMP: usize = 3;
2148pub const IW_ENCODE_ALG_PMK: usize = 4;
2149pub const IW_ENCODE_ALG_AES_CMAC: usize = 5;
2150
2151pub const IW_ENCODE_EXT_TX_SEQ_VALID: c_ulong = 0x00000001;
2152pub const IW_ENCODE_EXT_RX_SEQ_VALID: c_ulong = 0x00000002;
2153pub const IW_ENCODE_EXT_GROUP_KEY: c_ulong = 0x00000004;
2154pub const IW_ENCODE_EXT_SET_TX_KEY: c_ulong = 0x00000008;
2155
2156pub const IW_MICFAILURE_KEY_ID: c_ulong = 0x00000003;
2157pub const IW_MICFAILURE_GROUP: c_ulong = 0x00000004;
2158pub const IW_MICFAILURE_PAIRWISE: c_ulong = 0x00000008;
2159pub const IW_MICFAILURE_STAKEY: c_ulong = 0x00000010;
2160pub const IW_MICFAILURE_COUNT: c_ulong = 0x00000060;
2161
2162pub const IW_ENC_CAPA_WPA: c_ulong = 0x00000001;
2163pub const IW_ENC_CAPA_WPA2: c_ulong = 0x00000002;
2164pub const IW_ENC_CAPA_CIPHER_TKIP: c_ulong = 0x00000004;
2165pub const IW_ENC_CAPA_CIPHER_CCMP: c_ulong = 0x00000008;
2166pub const IW_ENC_CAPA_4WAY_HANDSHAKE: c_ulong = 0x00000010;
2167
2168pub const IW_EVENT_CAPA_K_0: c_ulong = 0x4000050; //   IW_EVENT_CAPA_MASK(0x8B04) | IW_EVENT_CAPA_MASK(0x8B06) | IW_EVENT_CAPA_MASK(0x8B1A);
2169pub const IW_EVENT_CAPA_K_1: c_ulong = 0x400; //   W_EVENT_CAPA_MASK(0x8B2A);
2170
2171pub const IW_PMKSA_ADD: usize = 1;
2172pub const IW_PMKSA_REMOVE: usize = 2;
2173pub const IW_PMKSA_FLUSH: usize = 3;
2174
2175pub const IW_PMKID_LEN: usize = 16;
2176
2177pub const IW_PMKID_CAND_PREAUTH: c_ulong = 0x00000001;
2178
2179pub const IW_EV_LCP_PK_LEN: usize = 4;
2180
2181pub const IW_EV_CHAR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + crate::IFNAMSIZ;
2182pub const IW_EV_UINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::<u32>();
2183pub const IW_EV_FREQ_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::<iw_freq>();
2184pub const IW_EV_PARAM_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::<iw_param>();
2185pub const IW_EV_ADDR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + size_of::<crate::sockaddr>();
2186pub const IW_EV_QUAL_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::<iw_quality>();
2187pub const IW_EV_POINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + 4;
2188
2189// linux/neighbor.h
2190pub const NUD_NONE: u16 = 0x00;
2191pub const NUD_INCOMPLETE: u16 = 0x01;
2192pub const NUD_REACHABLE: u16 = 0x02;
2193pub const NUD_STALE: u16 = 0x04;
2194pub const NUD_DELAY: u16 = 0x08;
2195pub const NUD_PROBE: u16 = 0x10;
2196pub const NUD_FAILED: u16 = 0x20;
2197pub const NUD_NOARP: u16 = 0x40;
2198pub const NUD_PERMANENT: u16 = 0x80;
2199
2200pub const NTF_USE: u8 = 0x01;
2201pub const NTF_SELF: u8 = 0x02;
2202pub const NTF_MASTER: u8 = 0x04;
2203pub const NTF_PROXY: u8 = 0x08;
2204pub const NTF_ROUTER: u8 = 0x80;
2205
2206pub const NDA_UNSPEC: c_ushort = 0;
2207pub const NDA_DST: c_ushort = 1;
2208pub const NDA_LLADDR: c_ushort = 2;
2209pub const NDA_CACHEINFO: c_ushort = 3;
2210pub const NDA_PROBES: c_ushort = 4;
2211pub const NDA_VLAN: c_ushort = 5;
2212pub const NDA_PORT: c_ushort = 6;
2213pub const NDA_VNI: c_ushort = 7;
2214pub const NDA_IFINDEX: c_ushort = 8;
2215
2216// linux/netlink.h
2217
2218pub const NLM_F_BULK: c_int = 0x200;
2219
2220// linux/rtnetlink.h
2221pub const TCA_UNSPEC: c_ushort = 0;
2222pub const TCA_KIND: c_ushort = 1;
2223pub const TCA_OPTIONS: c_ushort = 2;
2224pub const TCA_STATS: c_ushort = 3;
2225pub const TCA_XSTATS: c_ushort = 4;
2226pub const TCA_RATE: c_ushort = 5;
2227pub const TCA_FCNT: c_ushort = 6;
2228pub const TCA_STATS2: c_ushort = 7;
2229pub const TCA_STAB: c_ushort = 8;
2230
2231pub const RTM_NEWLINK: u16 = 16;
2232pub const RTM_DELLINK: u16 = 17;
2233pub const RTM_GETLINK: u16 = 18;
2234pub const RTM_SETLINK: u16 = 19;
2235pub const RTM_NEWADDR: u16 = 20;
2236pub const RTM_DELADDR: u16 = 21;
2237pub const RTM_GETADDR: u16 = 22;
2238pub const RTM_NEWROUTE: u16 = 24;
2239pub const RTM_DELROUTE: u16 = 25;
2240pub const RTM_GETROUTE: u16 = 26;
2241pub const RTM_NEWNEIGH: u16 = 28;
2242pub const RTM_DELNEIGH: u16 = 29;
2243pub const RTM_GETNEIGH: u16 = 30;
2244pub const RTM_NEWRULE: u16 = 32;
2245pub const RTM_DELRULE: u16 = 33;
2246pub const RTM_GETRULE: u16 = 34;
2247pub const RTM_NEWQDISC: u16 = 36;
2248pub const RTM_DELQDISC: u16 = 37;
2249pub const RTM_GETQDISC: u16 = 38;
2250pub const RTM_NEWTCLASS: u16 = 40;
2251pub const RTM_DELTCLASS: u16 = 41;
2252pub const RTM_GETTCLASS: u16 = 42;
2253pub const RTM_NEWTFILTER: u16 = 44;
2254pub const RTM_DELTFILTER: u16 = 45;
2255pub const RTM_GETTFILTER: u16 = 46;
2256pub const RTM_NEWACTION: u16 = 48;
2257pub const RTM_DELACTION: u16 = 49;
2258pub const RTM_GETACTION: u16 = 50;
2259pub const RTM_NEWPREFIX: u16 = 52;
2260pub const RTM_GETMULTICAST: u16 = 58;
2261pub const RTM_GETANYCAST: u16 = 62;
2262pub const RTM_NEWNEIGHTBL: u16 = 64;
2263pub const RTM_GETNEIGHTBL: u16 = 66;
2264pub const RTM_SETNEIGHTBL: u16 = 67;
2265pub const RTM_NEWNDUSEROPT: u16 = 68;
2266pub const RTM_NEWADDRLABEL: u16 = 72;
2267pub const RTM_DELADDRLABEL: u16 = 73;
2268pub const RTM_GETADDRLABEL: u16 = 74;
2269pub const RTM_GETDCB: u16 = 78;
2270pub const RTM_SETDCB: u16 = 79;
2271pub const RTM_NEWNETCONF: u16 = 80;
2272pub const RTM_GETNETCONF: u16 = 82;
2273pub const RTM_NEWMDB: u16 = 84;
2274pub const RTM_DELMDB: u16 = 85;
2275pub const RTM_GETMDB: u16 = 86;
2276pub const RTM_NEWNSID: u16 = 88;
2277pub const RTM_DELNSID: u16 = 89;
2278pub const RTM_GETNSID: u16 = 90;
2279
2280pub const RTM_F_NOTIFY: c_uint = 0x100;
2281pub const RTM_F_CLONED: c_uint = 0x200;
2282pub const RTM_F_EQUALIZE: c_uint = 0x400;
2283pub const RTM_F_PREFIX: c_uint = 0x800;
2284
2285pub const RTA_UNSPEC: c_ushort = 0;
2286pub const RTA_DST: c_ushort = 1;
2287pub const RTA_SRC: c_ushort = 2;
2288pub const RTA_IIF: c_ushort = 3;
2289pub const RTA_OIF: c_ushort = 4;
2290pub const RTA_GATEWAY: c_ushort = 5;
2291pub const RTA_PRIORITY: c_ushort = 6;
2292pub const RTA_PREFSRC: c_ushort = 7;
2293pub const RTA_METRICS: c_ushort = 8;
2294pub const RTA_MULTIPATH: c_ushort = 9;
2295pub const RTA_PROTOINFO: c_ushort = 10; // No longer used
2296pub const RTA_FLOW: c_ushort = 11;
2297pub const RTA_CACHEINFO: c_ushort = 12;
2298pub const RTA_SESSION: c_ushort = 13; // No longer used
2299pub const RTA_MP_ALGO: c_ushort = 14; // No longer used
2300pub const RTA_TABLE: c_ushort = 15;
2301pub const RTA_MARK: c_ushort = 16;
2302pub const RTA_MFC_STATS: c_ushort = 17;
2303
2304pub const RTN_UNSPEC: c_uchar = 0;
2305pub const RTN_UNICAST: c_uchar = 1;
2306pub const RTN_LOCAL: c_uchar = 2;
2307pub const RTN_BROADCAST: c_uchar = 3;
2308pub const RTN_ANYCAST: c_uchar = 4;
2309pub const RTN_MULTICAST: c_uchar = 5;
2310pub const RTN_BLACKHOLE: c_uchar = 6;
2311pub const RTN_UNREACHABLE: c_uchar = 7;
2312pub const RTN_PROHIBIT: c_uchar = 8;
2313pub const RTN_THROW: c_uchar = 9;
2314pub const RTN_NAT: c_uchar = 10;
2315pub const RTN_XRESOLVE: c_uchar = 11;
2316
2317pub const RTPROT_UNSPEC: c_uchar = 0;
2318pub const RTPROT_REDIRECT: c_uchar = 1;
2319pub const RTPROT_KERNEL: c_uchar = 2;
2320pub const RTPROT_BOOT: c_uchar = 3;
2321pub const RTPROT_STATIC: c_uchar = 4;
2322
2323pub const RT_SCOPE_UNIVERSE: c_uchar = 0;
2324pub const RT_SCOPE_SITE: c_uchar = 200;
2325pub const RT_SCOPE_LINK: c_uchar = 253;
2326pub const RT_SCOPE_HOST: c_uchar = 254;
2327pub const RT_SCOPE_NOWHERE: c_uchar = 255;
2328
2329pub const RT_TABLE_UNSPEC: c_uchar = 0;
2330pub const RT_TABLE_COMPAT: c_uchar = 252;
2331pub const RT_TABLE_DEFAULT: c_uchar = 253;
2332pub const RT_TABLE_MAIN: c_uchar = 254;
2333pub const RT_TABLE_LOCAL: c_uchar = 255;
2334
2335pub const RTMSG_OVERRUN: u32 = crate::NLMSG_OVERRUN as u32;
2336pub const RTMSG_NEWDEVICE: u32 = 0x11;
2337pub const RTMSG_DELDEVICE: u32 = 0x12;
2338pub const RTMSG_NEWROUTE: u32 = 0x21;
2339pub const RTMSG_DELROUTE: u32 = 0x22;
2340pub const RTMSG_NEWRULE: u32 = 0x31;
2341pub const RTMSG_DELRULE: u32 = 0x32;
2342pub const RTMSG_CONTROL: u32 = 0x40;
2343pub const RTMSG_AR_FAILED: u32 = 0x51;
2344
2345pub const RTEXT_FILTER_VF: c_int = 1 << 0;
2346pub const RTEXT_FILTER_BRVLAN: c_int = 1 << 1;
2347pub const RTEXT_FILTER_BRVLAN_COMPRESSED: c_int = 1 << 2;
2348pub const RTEXT_FILTER_SKIP_STATS: c_int = 1 << 3;
2349pub const RTEXT_FILTER_MRP: c_int = 1 << 4;
2350pub const RTEXT_FILTER_CFM_CONFIG: c_int = 1 << 5;
2351pub const RTEXT_FILTER_CFM_STATUS: c_int = 1 << 6;
2352
2353// userspace compat definitions for RTNLGRP_*
2354pub const RTMGRP_LINK: c_int = 0x00001;
2355pub const RTMGRP_NOTIFY: c_int = 0x00002;
2356pub const RTMGRP_NEIGH: c_int = 0x00004;
2357pub const RTMGRP_TC: c_int = 0x00008;
2358pub const RTMGRP_IPV4_IFADDR: c_int = 0x00010;
2359pub const RTMGRP_IPV4_MROUTE: c_int = 0x00020;
2360pub const RTMGRP_IPV4_ROUTE: c_int = 0x00040;
2361pub const RTMGRP_IPV4_RULE: c_int = 0x00080;
2362pub const RTMGRP_IPV6_IFADDR: c_int = 0x00100;
2363pub const RTMGRP_IPV6_MROUTE: c_int = 0x00200;
2364pub const RTMGRP_IPV6_ROUTE: c_int = 0x00400;
2365pub const RTMGRP_IPV6_IFINFO: c_int = 0x00800;
2366pub const RTMGRP_DECnet_IFADDR: c_int = 0x01000;
2367pub const RTMGRP_DECnet_ROUTE: c_int = 0x04000;
2368pub const RTMGRP_IPV6_PREFIX: c_int = 0x20000;
2369
2370// enum rtnetlink_groups
2371pub const RTNLGRP_NONE: c_uint = 0x00;
2372pub const RTNLGRP_LINK: c_uint = 0x01;
2373pub const RTNLGRP_NOTIFY: c_uint = 0x02;
2374pub const RTNLGRP_NEIGH: c_uint = 0x03;
2375pub const RTNLGRP_TC: c_uint = 0x04;
2376pub const RTNLGRP_IPV4_IFADDR: c_uint = 0x05;
2377pub const RTNLGRP_IPV4_MROUTE: c_uint = 0x06;
2378pub const RTNLGRP_IPV4_ROUTE: c_uint = 0x07;
2379pub const RTNLGRP_IPV4_RULE: c_uint = 0x08;
2380pub const RTNLGRP_IPV6_IFADDR: c_uint = 0x09;
2381pub const RTNLGRP_IPV6_MROUTE: c_uint = 0x0a;
2382pub const RTNLGRP_IPV6_ROUTE: c_uint = 0x0b;
2383pub const RTNLGRP_IPV6_IFINFO: c_uint = 0x0c;
2384pub const RTNLGRP_DECnet_IFADDR: c_uint = 0x0d;
2385pub const RTNLGRP_NOP2: c_uint = 0x0e;
2386pub const RTNLGRP_DECnet_ROUTE: c_uint = 0x0f;
2387pub const RTNLGRP_DECnet_RULE: c_uint = 0x10;
2388pub const RTNLGRP_NOP4: c_uint = 0x11;
2389pub const RTNLGRP_IPV6_PREFIX: c_uint = 0x12;
2390pub const RTNLGRP_IPV6_RULE: c_uint = 0x13;
2391pub const RTNLGRP_ND_USEROPT: c_uint = 0x14;
2392pub const RTNLGRP_PHONET_IFADDR: c_uint = 0x15;
2393pub const RTNLGRP_PHONET_ROUTE: c_uint = 0x16;
2394pub const RTNLGRP_DCB: c_uint = 0x17;
2395pub const RTNLGRP_IPV4_NETCONF: c_uint = 0x18;
2396pub const RTNLGRP_IPV6_NETCONF: c_uint = 0x19;
2397pub const RTNLGRP_MDB: c_uint = 0x1a;
2398pub const RTNLGRP_MPLS_ROUTE: c_uint = 0x1b;
2399pub const RTNLGRP_NSID: c_uint = 0x1c;
2400pub const RTNLGRP_MPLS_NETCONF: c_uint = 0x1d;
2401pub const RTNLGRP_IPV4_MROUTE_R: c_uint = 0x1e;
2402pub const RTNLGRP_IPV6_MROUTE_R: c_uint = 0x1f;
2403pub const RTNLGRP_NEXTHOP: c_uint = 0x20;
2404pub const RTNLGRP_BRVLAN: c_uint = 0x21;
2405pub const RTNLGRP_MCTP_IFADDR: c_uint = 0x22;
2406pub const RTNLGRP_TUNNEL: c_uint = 0x23;
2407pub const RTNLGRP_STATS: c_uint = 0x24;
2408
2409// linux/cn_proc.h
2410pub type proc_cn_event = crate::prelude::CEnumRepr;
pub const PROC_EVENT_NONE: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = 0;
        let r = 0x00000000;
        r
    };
pub const PROC_EVENT_FORK: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_NONE + 1;
        let r = 0x00000001;
        r
    };
pub const PROC_EVENT_EXEC: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_FORK + 1;
        let r = 0x00000002;
        r
    };
pub const PROC_EVENT_UID: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_EXEC + 1;
        let r = 0x00000004;
        r
    };
pub const PROC_EVENT_GID: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_UID + 1;
        let r = 0x00000040;
        r
    };
pub const PROC_EVENT_SID: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_GID + 1;
        let r = 0x00000080;
        r
    };
pub const PROC_EVENT_PTRACE: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_SID + 1;
        let r = 0x00000100;
        r
    };
pub const PROC_EVENT_COMM: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_PTRACE + 1;
        let r = 0x00000200;
        r
    };
pub const PROC_EVENT_NONZERO_EXIT: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_COMM + 1;
        let r = 0x20000000;
        r
    };
pub const PROC_EVENT_COREDUMP: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_NONZERO_EXIT + 1;
        let r = 0x40000000;
        r
    };
pub const PROC_EVENT_EXIT: proc_cn_event =
    {
        #[allow(unused_variables)]
        let r = PROC_EVENT_COREDUMP + 1;
        let r = 0x80000000;
        r
    };c_enum! {
2411    pub enum proc_cn_mcast_op {
2412        pub PROC_CN_MCAST_LISTEN = 1,
2413        pub PROC_CN_MCAST_IGNORE = 2,
2414    }
2415
2416    pub enum proc_cn_event {
2417        pub PROC_EVENT_NONE = 0x00000000,
2418        pub PROC_EVENT_FORK = 0x00000001,
2419        pub PROC_EVENT_EXEC = 0x00000002,
2420        pub PROC_EVENT_UID = 0x00000004,
2421        pub PROC_EVENT_GID = 0x00000040,
2422        pub PROC_EVENT_SID = 0x00000080,
2423        pub PROC_EVENT_PTRACE = 0x00000100,
2424        pub PROC_EVENT_COMM = 0x00000200,
2425        pub PROC_EVENT_NONZERO_EXIT = 0x20000000,
2426        pub PROC_EVENT_COREDUMP = 0x40000000,
2427        pub PROC_EVENT_EXIT = 0x80000000,
2428    }
2429}
2430
2431// linux/connector.h
2432pub const CN_IDX_PROC: c_uint = 0x1;
2433pub const CN_VAL_PROC: c_uint = 0x1;
2434pub const CN_IDX_CIFS: c_uint = 0x2;
2435pub const CN_VAL_CIFS: c_uint = 0x1;
2436pub const CN_W1_IDX: c_uint = 0x3;
2437pub const CN_W1_VAL: c_uint = 0x1;
2438pub const CN_IDX_V86D: c_uint = 0x4;
2439pub const CN_VAL_V86D_UVESAFB: c_uint = 0x1;
2440pub const CN_IDX_BB: c_uint = 0x5;
2441pub const CN_DST_IDX: c_uint = 0x6;
2442pub const CN_DST_VAL: c_uint = 0x1;
2443pub const CN_IDX_DM: c_uint = 0x7;
2444pub const CN_VAL_DM_USERSPACE_LOG: c_uint = 0x1;
2445pub const CN_IDX_DRBD: c_uint = 0x8;
2446pub const CN_VAL_DRBD: c_uint = 0x1;
2447pub const CN_KVP_IDX: c_uint = 0x9;
2448pub const CN_KVP_VAL: c_uint = 0x1;
2449pub const CN_VSS_IDX: c_uint = 0xA;
2450pub const CN_VSS_VAL: c_uint = 0x1;
2451
2452// linux/module.h
2453pub const MODULE_INIT_IGNORE_MODVERSIONS: c_uint = 0x0001;
2454pub const MODULE_INIT_IGNORE_VERMAGIC: c_uint = 0x0002;
2455
2456// linux/net_tstamp.h
2457pub const SOF_TIMESTAMPING_TX_HARDWARE: c_uint = 1 << 0;
2458pub const SOF_TIMESTAMPING_TX_SOFTWARE: c_uint = 1 << 1;
2459pub const SOF_TIMESTAMPING_RX_HARDWARE: c_uint = 1 << 2;
2460pub const SOF_TIMESTAMPING_RX_SOFTWARE: c_uint = 1 << 3;
2461pub const SOF_TIMESTAMPING_SOFTWARE: c_uint = 1 << 4;
2462pub const SOF_TIMESTAMPING_SYS_HARDWARE: c_uint = 1 << 5;
2463pub const SOF_TIMESTAMPING_RAW_HARDWARE: c_uint = 1 << 6;
2464pub const SOF_TIMESTAMPING_OPT_ID: c_uint = 1 << 7;
2465pub const SOF_TIMESTAMPING_TX_SCHED: c_uint = 1 << 8;
2466pub const SOF_TIMESTAMPING_TX_ACK: c_uint = 1 << 9;
2467pub const SOF_TIMESTAMPING_OPT_CMSG: c_uint = 1 << 10;
2468pub const SOF_TIMESTAMPING_OPT_TSONLY: c_uint = 1 << 11;
2469pub const SOF_TIMESTAMPING_OPT_STATS: c_uint = 1 << 12;
2470pub const SOF_TIMESTAMPING_OPT_PKTINFO: c_uint = 1 << 13;
2471pub const SOF_TIMESTAMPING_OPT_TX_SWHW: c_uint = 1 << 14;
2472pub const SOF_TIMESTAMPING_BIND_PHC: c_uint = 1 << 15;
2473pub const SOF_TIMESTAMPING_OPT_ID_TCP: c_uint = 1 << 16;
2474pub const SOF_TIMESTAMPING_OPT_RX_FILTER: c_uint = 1 << 17;
2475pub const SOF_TXTIME_DEADLINE_MODE: u32 = 1 << 0;
2476pub const SOF_TXTIME_REPORT_ERRORS: u32 = 1 << 1;
2477
2478pub const HWTSTAMP_TX_OFF: c_uint = 0;
2479pub const HWTSTAMP_TX_ON: c_uint = 1;
2480pub const HWTSTAMP_TX_ONESTEP_SYNC: c_uint = 2;
2481pub const HWTSTAMP_TX_ONESTEP_P2P: c_uint = 3;
2482
2483pub const HWTSTAMP_FILTER_NONE: c_uint = 0;
2484pub const HWTSTAMP_FILTER_ALL: c_uint = 1;
2485pub const HWTSTAMP_FILTER_SOME: c_uint = 2;
2486pub const HWTSTAMP_FILTER_PTP_V1_L4_EVENT: c_uint = 3;
2487pub const HWTSTAMP_FILTER_PTP_V1_L4_SYNC: c_uint = 4;
2488pub const HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: c_uint = 5;
2489pub const HWTSTAMP_FILTER_PTP_V2_L4_EVENT: c_uint = 6;
2490pub const HWTSTAMP_FILTER_PTP_V2_L4_SYNC: c_uint = 7;
2491pub const HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: c_uint = 8;
2492pub const HWTSTAMP_FILTER_PTP_V2_L2_EVENT: c_uint = 9;
2493pub const HWTSTAMP_FILTER_PTP_V2_L2_SYNC: c_uint = 10;
2494pub const HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: c_uint = 11;
2495pub const HWTSTAMP_FILTER_PTP_V2_EVENT: c_uint = 12;
2496pub const HWTSTAMP_FILTER_PTP_V2_SYNC: c_uint = 13;
2497pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: c_uint = 14;
2498pub const HWTSTAMP_FILTER_NTP_ALL: c_uint = 15;
2499
2500// linux/ptp_clock.h
2501pub const PTP_MAX_SAMPLES: c_uint = 25; // Maximum allowed offset measurement samples.
2502
2503const PTP_CLK_MAGIC: u32 = b'=' as u32;
2504
2505pub const PTP_CLOCK_GETCAPS: Ioctl = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 1);
2506pub const PTP_EXTTS_REQUEST: Ioctl = _IOW::<ptp_extts_request>(PTP_CLK_MAGIC, 2);
2507pub const PTP_PEROUT_REQUEST: Ioctl = _IOW::<ptp_perout_request>(PTP_CLK_MAGIC, 3);
2508pub const PTP_ENABLE_PPS: Ioctl = _IOW::<c_int>(PTP_CLK_MAGIC, 4);
2509pub const PTP_SYS_OFFSET: Ioctl = _IOW::<ptp_sys_offset>(PTP_CLK_MAGIC, 5);
2510pub const PTP_PIN_GETFUNC: Ioctl = _IOWR::<ptp_pin_desc>(PTP_CLK_MAGIC, 6);
2511pub const PTP_PIN_SETFUNC: Ioctl = _IOW::<ptp_pin_desc>(PTP_CLK_MAGIC, 7);
2512pub const PTP_SYS_OFFSET_PRECISE: Ioctl = _IOWR::<ptp_sys_offset_precise>(PTP_CLK_MAGIC, 8);
2513pub const PTP_SYS_OFFSET_EXTENDED: Ioctl = _IOWR::<ptp_sys_offset_extended>(PTP_CLK_MAGIC, 9);
2514
2515pub const PTP_CLOCK_GETCAPS2: Ioctl = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 10);
2516pub const PTP_EXTTS_REQUEST2: Ioctl = _IOW::<ptp_extts_request>(PTP_CLK_MAGIC, 11);
2517pub const PTP_PEROUT_REQUEST2: Ioctl = _IOW::<ptp_perout_request>(PTP_CLK_MAGIC, 12);
2518pub const PTP_ENABLE_PPS2: Ioctl = _IOW::<c_int>(PTP_CLK_MAGIC, 13);
2519pub const PTP_SYS_OFFSET2: Ioctl = _IOW::<ptp_sys_offset>(PTP_CLK_MAGIC, 14);
2520pub const PTP_PIN_GETFUNC2: Ioctl = _IOWR::<ptp_pin_desc>(PTP_CLK_MAGIC, 15);
2521pub const PTP_PIN_SETFUNC2: Ioctl = _IOW::<ptp_pin_desc>(PTP_CLK_MAGIC, 16);
2522pub const PTP_SYS_OFFSET_PRECISE2: Ioctl = _IOWR::<ptp_sys_offset_precise>(PTP_CLK_MAGIC, 17);
2523pub const PTP_SYS_OFFSET_EXTENDED2: Ioctl = _IOWR::<ptp_sys_offset_extended>(PTP_CLK_MAGIC, 18);
2524
2525// enum ptp_pin_function
2526pub const PTP_PF_NONE: c_uint = 0;
2527pub const PTP_PF_EXTTS: c_uint = 1;
2528pub const PTP_PF_PEROUT: c_uint = 2;
2529pub const PTP_PF_PHYSYNC: c_uint = 3;
2530
2531// linux/socket.h
2532
2533pub const SOL_TLS: c_int = 282;
2534
2535// linux/if_alg.h
2536pub const ALG_SET_KEY: c_int = 1;
2537pub const ALG_SET_IV: c_int = 2;
2538pub const ALG_SET_OP: c_int = 3;
2539pub const ALG_SET_AEAD_ASSOCLEN: c_int = 4;
2540pub const ALG_SET_AEAD_AUTHSIZE: c_int = 5;
2541pub const ALG_SET_DRBG_ENTROPY: c_int = 6;
2542pub const ALG_SET_KEY_BY_KEY_SERIAL: c_int = 7;
2543
2544pub const ALG_OP_DECRYPT: c_int = 0;
2545pub const ALG_OP_ENCRYPT: c_int = 1;
2546
2547// include/uapi/linux/if.h
2548pub const IF_OPER_UNKNOWN: c_int = 0;
2549pub const IF_OPER_NOTPRESENT: c_int = 1;
2550pub const IF_OPER_DOWN: c_int = 2;
2551pub const IF_OPER_LOWERLAYERDOWN: c_int = 3;
2552pub const IF_OPER_TESTING: c_int = 4;
2553pub const IF_OPER_DORMANT: c_int = 5;
2554pub const IF_OPER_UP: c_int = 6;
2555
2556pub const IF_LINK_MODE_DEFAULT: c_int = 0;
2557pub const IF_LINK_MODE_DORMANT: c_int = 1;
2558pub const IF_LINK_MODE_TESTING: c_int = 2;
2559
2560// include/uapi/linux/mman.h
2561pub const MAP_SHARED_VALIDATE: c_int = 0x3;
2562pub const MAP_DROPPABLE: c_int = 0x8;
2563
2564// uapi/linux/vm_sockets.h
2565pub const VMADDR_CID_ANY: c_uint = 0xFFFFFFFF;
2566pub const VMADDR_CID_HYPERVISOR: c_uint = 0;
2567#[deprecated(
2568    since = "0.2.74",
2569    note = "VMADDR_CID_RESERVED is removed since Linux v5.6 and \
2570            replaced with VMADDR_CID_LOCAL"
2571)]
2572pub const VMADDR_CID_RESERVED: c_uint = 1;
2573pub const VMADDR_CID_LOCAL: c_uint = 1;
2574pub const VMADDR_CID_HOST: c_uint = 2;
2575pub const VMADDR_PORT_ANY: c_uint = 0xFFFFFFFF;
2576
2577// uapi/linux/inotify.h
2578pub const IN_ACCESS: u32 = 0x0000_0001;
2579pub const IN_MODIFY: u32 = 0x0000_0002;
2580pub const IN_ATTRIB: u32 = 0x0000_0004;
2581pub const IN_CLOSE_WRITE: u32 = 0x0000_0008;
2582pub const IN_CLOSE_NOWRITE: u32 = 0x0000_0010;
2583pub const IN_CLOSE: u32 = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE;
2584pub const IN_OPEN: u32 = 0x0000_0020;
2585pub const IN_MOVED_FROM: u32 = 0x0000_0040;
2586pub const IN_MOVED_TO: u32 = 0x0000_0080;
2587pub const IN_MOVE: u32 = IN_MOVED_FROM | IN_MOVED_TO;
2588pub const IN_CREATE: u32 = 0x0000_0100;
2589pub const IN_DELETE: u32 = 0x0000_0200;
2590pub const IN_DELETE_SELF: u32 = 0x0000_0400;
2591pub const IN_MOVE_SELF: u32 = 0x0000_0800;
2592pub const IN_UNMOUNT: u32 = 0x0000_2000;
2593pub const IN_Q_OVERFLOW: u32 = 0x0000_4000;
2594pub const IN_IGNORED: u32 = 0x0000_8000;
2595pub const IN_ONLYDIR: u32 = 0x0100_0000;
2596pub const IN_DONT_FOLLOW: u32 = 0x0200_0000;
2597pub const IN_EXCL_UNLINK: u32 = 0x0400_0000;
2598
2599// uapi/linux/securebits.h
2600const SECURE_NOROOT: c_int = 0;
2601const SECURE_NOROOT_LOCKED: c_int = 1;
2602
2603pub const SECBIT_NOROOT: c_int = issecure_mask(SECURE_NOROOT);
2604pub const SECBIT_NOROOT_LOCKED: c_int = issecure_mask(SECURE_NOROOT_LOCKED);
2605
2606const SECURE_NO_SETUID_FIXUP: c_int = 2;
2607const SECURE_NO_SETUID_FIXUP_LOCKED: c_int = 3;
2608
2609pub const SECBIT_NO_SETUID_FIXUP: c_int = issecure_mask(SECURE_NO_SETUID_FIXUP);
2610pub const SECBIT_NO_SETUID_FIXUP_LOCKED: c_int = issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED);
2611
2612const SECURE_KEEP_CAPS: c_int = 4;
2613const SECURE_KEEP_CAPS_LOCKED: c_int = 5;
2614
2615pub const SECBIT_KEEP_CAPS: c_int = issecure_mask(SECURE_KEEP_CAPS);
2616pub const SECBIT_KEEP_CAPS_LOCKED: c_int = issecure_mask(SECURE_KEEP_CAPS_LOCKED);
2617
2618const SECURE_NO_CAP_AMBIENT_RAISE: c_int = 6;
2619const SECURE_NO_CAP_AMBIENT_RAISE_LOCKED: c_int = 7;
2620
2621pub const SECBIT_NO_CAP_AMBIENT_RAISE: c_int = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE);
2622pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED: c_int =
2623    issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED);
2624
2625const SECURE_EXEC_RESTRICT_FILE: c_int = 8;
2626const SECURE_EXEC_RESTRICT_FILE_LOCKED: c_int = 9;
2627
2628pub const SECBIT_EXEC_RESTRICT_FILE: c_int = issecure_mask(SECURE_EXEC_RESTRICT_FILE);
2629pub const SECBIT_EXEC_RESTRICT_FILE_LOCKED: c_int = issecure_mask(SECURE_EXEC_RESTRICT_FILE_LOCKED);
2630
2631const SECURE_EXEC_DENY_INTERACTIVE: c_int = 10;
2632const SECURE_EXEC_DENY_INTERACTIVE_LOCKED: c_int = 11;
2633
2634pub const SECBIT_EXEC_DENY_INTERACTIVE: c_int = issecure_mask(SECURE_EXEC_DENY_INTERACTIVE);
2635pub const SECBIT_EXEC_DENY_INTERACTIVE_LOCKED: c_int =
2636    issecure_mask(SECURE_EXEC_DENY_INTERACTIVE_LOCKED);
2637
2638pub const SECUREBITS_DEFAULT: c_int = 0x00000000;
2639pub const SECURE_ALL_BITS: c_int = SECBIT_NOROOT
2640    | SECBIT_NO_SETUID_FIXUP
2641    | SECBIT_KEEP_CAPS
2642    | SECBIT_NO_CAP_AMBIENT_RAISE
2643    | SECBIT_EXEC_RESTRICT_FILE
2644    | SECBIT_EXEC_DENY_INTERACTIVE;
2645pub const SECURE_ALL_LOCKS: c_int = SECURE_ALL_BITS << 1;
2646
2647pub const SECURE_ALL_UNPRIVILEGED: c_int =
2648    issecure_mask(SECURE_EXEC_RESTRICT_FILE) | issecure_mask(SECURE_EXEC_DENY_INTERACTIVE);
2649
2650const fn issecure_mask(x: c_int) -> c_int {
2651    1 << x
2652}
2653
2654pub const IN_MASK_CREATE: u32 = 0x1000_0000;
2655pub const IN_MASK_ADD: u32 = 0x2000_0000;
2656pub const IN_ISDIR: u32 = 0x4000_0000;
2657pub const IN_ONESHOT: u32 = 0x8000_0000;
2658
2659pub const IN_ALL_EVENTS: u32 = IN_ACCESS
2660    | IN_MODIFY
2661    | IN_ATTRIB
2662    | IN_CLOSE_WRITE
2663    | IN_CLOSE_NOWRITE
2664    | IN_OPEN
2665    | IN_MOVED_FROM
2666    | IN_MOVED_TO
2667    | IN_DELETE
2668    | IN_CREATE
2669    | IN_DELETE_SELF
2670    | IN_MOVE_SELF;
2671
2672pub const IN_CLOEXEC: c_int = O_CLOEXEC;
2673pub const IN_NONBLOCK: c_int = O_NONBLOCK;
2674
2675// uapi/linux/netfilter/nf_tables.h
2676pub const NFT_TABLE_MAXNAMELEN: c_int = 256;
2677pub const NFT_CHAIN_MAXNAMELEN: c_int = 256;
2678pub const NFT_SET_MAXNAMELEN: c_int = 256;
2679pub const NFT_OBJ_MAXNAMELEN: c_int = 256;
2680pub const NFT_USERDATA_MAXLEN: c_int = 256;
2681
2682pub const NFT_REG_VERDICT: c_int = 0;
2683pub const NFT_REG_1: c_int = 1;
2684pub const NFT_REG_2: c_int = 2;
2685pub const NFT_REG_3: c_int = 3;
2686pub const NFT_REG_4: c_int = 4;
2687
2688/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2689/// for details.
2690pub const __NFT_REG_MAX: c_int = 5;
2691
2692pub const NFT_REG32_00: c_int = 8;
2693pub const NFT_REG32_01: c_int = 9;
2694pub const NFT_REG32_02: c_int = 10;
2695pub const NFT_REG32_03: c_int = 11;
2696pub const NFT_REG32_04: c_int = 12;
2697pub const NFT_REG32_05: c_int = 13;
2698pub const NFT_REG32_06: c_int = 14;
2699pub const NFT_REG32_07: c_int = 15;
2700pub const NFT_REG32_08: c_int = 16;
2701pub const NFT_REG32_09: c_int = 17;
2702pub const NFT_REG32_10: c_int = 18;
2703pub const NFT_REG32_11: c_int = 19;
2704pub const NFT_REG32_12: c_int = 20;
2705pub const NFT_REG32_13: c_int = 21;
2706pub const NFT_REG32_14: c_int = 22;
2707pub const NFT_REG32_15: c_int = 23;
2708
2709pub const NFT_REG_SIZE: c_int = 16;
2710pub const NFT_REG32_SIZE: c_int = 4;
2711
2712pub const NFT_CONTINUE: c_int = -1;
2713pub const NFT_BREAK: c_int = -2;
2714pub const NFT_JUMP: c_int = -3;
2715pub const NFT_GOTO: c_int = -4;
2716pub const NFT_RETURN: c_int = -5;
2717
2718pub const NFT_MSG_NEWTABLE: c_int = 0;
2719pub const NFT_MSG_GETTABLE: c_int = 1;
2720pub const NFT_MSG_DELTABLE: c_int = 2;
2721pub const NFT_MSG_NEWCHAIN: c_int = 3;
2722pub const NFT_MSG_GETCHAIN: c_int = 4;
2723pub const NFT_MSG_DELCHAIN: c_int = 5;
2724pub const NFT_MSG_NEWRULE: c_int = 6;
2725pub const NFT_MSG_GETRULE: c_int = 7;
2726pub const NFT_MSG_DELRULE: c_int = 8;
2727pub const NFT_MSG_NEWSET: c_int = 9;
2728pub const NFT_MSG_GETSET: c_int = 10;
2729pub const NFT_MSG_DELSET: c_int = 11;
2730pub const NFT_MSG_NEWSETELEM: c_int = 12;
2731pub const NFT_MSG_GETSETELEM: c_int = 13;
2732pub const NFT_MSG_DELSETELEM: c_int = 14;
2733pub const NFT_MSG_NEWGEN: c_int = 15;
2734pub const NFT_MSG_GETGEN: c_int = 16;
2735pub const NFT_MSG_TRACE: c_int = 17;
2736cfg_if! {
2737    if #[cfg(not(target_arch = "sparc64"))] {
2738        pub const NFT_MSG_NEWOBJ: c_int = 18;
2739        pub const NFT_MSG_GETOBJ: c_int = 19;
2740        pub const NFT_MSG_DELOBJ: c_int = 20;
2741        pub const NFT_MSG_GETOBJ_RESET: c_int = 21;
2742    }
2743}
2744
2745/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2746/// for details.
2747pub const NFT_MSG_MAX: c_int = 34;
2748
2749pub const NFT_SET_ANONYMOUS: c_int = 0x1;
2750pub const NFT_SET_CONSTANT: c_int = 0x2;
2751pub const NFT_SET_INTERVAL: c_int = 0x4;
2752pub const NFT_SET_MAP: c_int = 0x8;
2753pub const NFT_SET_TIMEOUT: c_int = 0x10;
2754pub const NFT_SET_EVAL: c_int = 0x20;
2755
2756pub const NFT_SET_POL_PERFORMANCE: c_int = 0;
2757pub const NFT_SET_POL_MEMORY: c_int = 1;
2758
2759pub const NFT_SET_ELEM_INTERVAL_END: c_int = 0x1;
2760
2761pub const NFT_DATA_VALUE: c_uint = 0;
2762pub const NFT_DATA_VERDICT: c_uint = 0xffffff00;
2763
2764pub const NFT_DATA_RESERVED_MASK: c_uint = 0xffffff00;
2765
2766pub const NFT_DATA_VALUE_MAXLEN: c_int = 64;
2767
2768pub const NFT_BYTEORDER_NTOH: c_int = 0;
2769pub const NFT_BYTEORDER_HTON: c_int = 1;
2770
2771pub const NFT_CMP_EQ: c_int = 0;
2772pub const NFT_CMP_NEQ: c_int = 1;
2773pub const NFT_CMP_LT: c_int = 2;
2774pub const NFT_CMP_LTE: c_int = 3;
2775pub const NFT_CMP_GT: c_int = 4;
2776pub const NFT_CMP_GTE: c_int = 5;
2777
2778pub const NFT_RANGE_EQ: c_int = 0;
2779pub const NFT_RANGE_NEQ: c_int = 1;
2780
2781pub const NFT_LOOKUP_F_INV: c_int = 1 << 0;
2782
2783pub const NFT_DYNSET_OP_ADD: c_int = 0;
2784pub const NFT_DYNSET_OP_UPDATE: c_int = 1;
2785
2786pub const NFT_DYNSET_F_INV: c_int = 1 << 0;
2787
2788pub const NFT_PAYLOAD_LL_HEADER: c_int = 0;
2789pub const NFT_PAYLOAD_NETWORK_HEADER: c_int = 1;
2790pub const NFT_PAYLOAD_TRANSPORT_HEADER: c_int = 2;
2791
2792pub const NFT_PAYLOAD_CSUM_NONE: c_int = 0;
2793pub const NFT_PAYLOAD_CSUM_INET: c_int = 1;
2794
2795pub const NFT_META_LEN: c_int = 0;
2796pub const NFT_META_PROTOCOL: c_int = 1;
2797pub const NFT_META_PRIORITY: c_int = 2;
2798pub const NFT_META_MARK: c_int = 3;
2799pub const NFT_META_IIF: c_int = 4;
2800pub const NFT_META_OIF: c_int = 5;
2801pub const NFT_META_IIFNAME: c_int = 6;
2802pub const NFT_META_OIFNAME: c_int = 7;
2803pub const NFT_META_IIFTYPE: c_int = 8;
2804pub const NFT_META_OIFTYPE: c_int = 9;
2805pub const NFT_META_SKUID: c_int = 10;
2806pub const NFT_META_SKGID: c_int = 11;
2807pub const NFT_META_NFTRACE: c_int = 12;
2808pub const NFT_META_RTCLASSID: c_int = 13;
2809pub const NFT_META_SECMARK: c_int = 14;
2810pub const NFT_META_NFPROTO: c_int = 15;
2811pub const NFT_META_L4PROTO: c_int = 16;
2812pub const NFT_META_BRI_IIFNAME: c_int = 17;
2813pub const NFT_META_BRI_OIFNAME: c_int = 18;
2814pub const NFT_META_PKTTYPE: c_int = 19;
2815pub const NFT_META_CPU: c_int = 20;
2816pub const NFT_META_IIFGROUP: c_int = 21;
2817pub const NFT_META_OIFGROUP: c_int = 22;
2818pub const NFT_META_CGROUP: c_int = 23;
2819pub const NFT_META_PRANDOM: c_int = 24;
2820
2821pub const NFT_CT_STATE: c_int = 0;
2822pub const NFT_CT_DIRECTION: c_int = 1;
2823pub const NFT_CT_STATUS: c_int = 2;
2824pub const NFT_CT_MARK: c_int = 3;
2825pub const NFT_CT_SECMARK: c_int = 4;
2826pub const NFT_CT_EXPIRATION: c_int = 5;
2827pub const NFT_CT_HELPER: c_int = 6;
2828pub const NFT_CT_L3PROTOCOL: c_int = 7;
2829pub const NFT_CT_SRC: c_int = 8;
2830pub const NFT_CT_DST: c_int = 9;
2831pub const NFT_CT_PROTOCOL: c_int = 10;
2832pub const NFT_CT_PROTO_SRC: c_int = 11;
2833pub const NFT_CT_PROTO_DST: c_int = 12;
2834pub const NFT_CT_LABELS: c_int = 13;
2835pub const NFT_CT_PKTS: c_int = 14;
2836pub const NFT_CT_BYTES: c_int = 15;
2837pub const NFT_CT_AVGPKT: c_int = 16;
2838pub const NFT_CT_ZONE: c_int = 17;
2839pub const NFT_CT_EVENTMASK: c_int = 18;
2840pub const NFT_CT_SRC_IP: c_int = 19;
2841pub const NFT_CT_DST_IP: c_int = 20;
2842pub const NFT_CT_SRC_IP6: c_int = 21;
2843pub const NFT_CT_DST_IP6: c_int = 22;
2844
2845pub const NFT_LIMIT_PKTS: c_int = 0;
2846pub const NFT_LIMIT_PKT_BYTES: c_int = 1;
2847
2848pub const NFT_LIMIT_F_INV: c_int = 1 << 0;
2849
2850pub const NFT_QUEUE_FLAG_BYPASS: c_int = 0x01;
2851pub const NFT_QUEUE_FLAG_CPU_FANOUT: c_int = 0x02;
2852pub const NFT_QUEUE_FLAG_MASK: c_int = 0x03;
2853
2854pub const NFT_QUOTA_F_INV: c_int = 1 << 0;
2855
2856pub const NFT_REJECT_ICMP_UNREACH: c_int = 0;
2857pub const NFT_REJECT_TCP_RST: c_int = 1;
2858pub const NFT_REJECT_ICMPX_UNREACH: c_int = 2;
2859
2860pub const NFT_REJECT_ICMPX_NO_ROUTE: c_int = 0;
2861pub const NFT_REJECT_ICMPX_PORT_UNREACH: c_int = 1;
2862pub const NFT_REJECT_ICMPX_HOST_UNREACH: c_int = 2;
2863pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: c_int = 3;
2864
2865pub const NFT_NAT_SNAT: c_int = 0;
2866pub const NFT_NAT_DNAT: c_int = 1;
2867
2868pub const NFT_TRACETYPE_UNSPEC: c_int = 0;
2869pub const NFT_TRACETYPE_POLICY: c_int = 1;
2870pub const NFT_TRACETYPE_RETURN: c_int = 2;
2871pub const NFT_TRACETYPE_RULE: c_int = 3;
2872
2873pub const NFT_NG_INCREMENTAL: c_int = 0;
2874pub const NFT_NG_RANDOM: c_int = 1;
2875
2876// linux/input.h
2877/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2878/// for details.
2879pub const FF_MAX: __u16 = 0x7f;
2880pub const FF_CNT: usize = FF_MAX as usize + 1;
2881
2882// linux/input-event-codes.h
2883pub const INPUT_PROP_POINTER: __u16 = 0x00;
2884pub const INPUT_PROP_DIRECT: __u16 = 0x01;
2885pub const INPUT_PROP_BUTTONPAD: __u16 = 0x02;
2886pub const INPUT_PROP_SEMI_MT: __u16 = 0x03;
2887pub const INPUT_PROP_TOPBUTTONPAD: __u16 = 0x04;
2888pub const INPUT_PROP_POINTING_STICK: __u16 = 0x05;
2889pub const INPUT_PROP_ACCELEROMETER: __u16 = 0x06;
2890
2891/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2892/// for details.
2893pub const INPUT_PROP_MAX: __u16 = 0x1f;
2894
2895pub const INPUT_PROP_CNT: usize = INPUT_PROP_MAX as usize + 1;
2896
2897/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2898/// for details.
2899pub const EV_MAX: __u16 = 0x1f;
2900pub const EV_CNT: usize = EV_MAX as usize + 1;
2901
2902/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2903/// for details.
2904pub const SYN_MAX: __u16 = 0xf;
2905pub const SYN_CNT: usize = SYN_MAX as usize + 1;
2906
2907/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2908/// for details.
2909pub const KEY_MAX: __u16 = 0x2ff;
2910pub const KEY_CNT: usize = KEY_MAX as usize + 1;
2911
2912/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2913/// for details.
2914pub const REL_MAX: __u16 = 0x0f;
2915pub const REL_CNT: usize = REL_MAX as usize + 1;
2916
2917/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2918/// for details.
2919pub const ABS_MAX: __u16 = 0x3f;
2920pub const ABS_CNT: usize = ABS_MAX as usize + 1;
2921
2922/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2923/// for details.
2924pub const SW_MAX: __u16 = 0x11;
2925pub const SW_CNT: usize = SW_MAX as usize + 1;
2926
2927/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2928/// for details.
2929pub const MSC_MAX: __u16 = 0x07;
2930pub const MSC_CNT: usize = MSC_MAX as usize + 1;
2931
2932/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2933/// for details.
2934pub const LED_MAX: __u16 = 0x0f;
2935pub const LED_CNT: usize = LED_MAX as usize + 1;
2936
2937/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2938/// for details.
2939pub const REP_MAX: __u16 = 0x01;
2940pub const REP_CNT: usize = REP_MAX as usize + 1;
2941
2942/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2943/// for details.
2944pub const SND_MAX: __u16 = 0x07;
2945pub const SND_CNT: usize = SND_MAX as usize + 1;
2946
2947// linux/uinput.h
2948pub const UINPUT_VERSION: c_uint = 5;
2949pub const UINPUT_MAX_NAME_SIZE: usize = 80;
2950
2951// uapi/linux/fanotify.h
2952pub const FAN_ACCESS: u64 = 0x0000_0001;
2953pub const FAN_MODIFY: u64 = 0x0000_0002;
2954pub const FAN_ATTRIB: u64 = 0x0000_0004;
2955pub const FAN_CLOSE_WRITE: u64 = 0x0000_0008;
2956pub const FAN_CLOSE_NOWRITE: u64 = 0x0000_0010;
2957pub const FAN_OPEN: u64 = 0x0000_0020;
2958pub const FAN_MOVED_FROM: u64 = 0x0000_0040;
2959pub const FAN_MOVED_TO: u64 = 0x0000_0080;
2960pub const FAN_CREATE: u64 = 0x0000_0100;
2961pub const FAN_DELETE: u64 = 0x0000_0200;
2962pub const FAN_DELETE_SELF: u64 = 0x0000_0400;
2963pub const FAN_MOVE_SELF: u64 = 0x0000_0800;
2964pub const FAN_OPEN_EXEC: u64 = 0x0000_1000;
2965
2966pub const FAN_Q_OVERFLOW: u64 = 0x0000_4000;
2967pub const FAN_FS_ERROR: u64 = 0x0000_8000;
2968
2969pub const FAN_OPEN_PERM: u64 = 0x0001_0000;
2970pub const FAN_ACCESS_PERM: u64 = 0x0002_0000;
2971pub const FAN_OPEN_EXEC_PERM: u64 = 0x0004_0000;
2972
2973pub const FAN_EVENT_ON_CHILD: u64 = 0x0800_0000;
2974
2975pub const FAN_RENAME: u64 = 0x1000_0000;
2976
2977pub const FAN_ONDIR: u64 = 0x4000_0000;
2978
2979pub const FAN_CLOSE: u64 = FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE;
2980pub const FAN_MOVE: u64 = FAN_MOVED_FROM | FAN_MOVED_TO;
2981
2982pub const FAN_CLOEXEC: c_uint = 0x0000_0001;
2983pub const FAN_NONBLOCK: c_uint = 0x0000_0002;
2984
2985pub const FAN_CLASS_NOTIF: c_uint = 0x0000_0000;
2986pub const FAN_CLASS_CONTENT: c_uint = 0x0000_0004;
2987pub const FAN_CLASS_PRE_CONTENT: c_uint = 0x0000_0008;
2988
2989pub const FAN_UNLIMITED_QUEUE: c_uint = 0x0000_0010;
2990pub const FAN_UNLIMITED_MARKS: c_uint = 0x0000_0020;
2991pub const FAN_ENABLE_AUDIT: c_uint = 0x0000_0040;
2992
2993pub const FAN_REPORT_PIDFD: c_uint = 0x0000_0080;
2994pub const FAN_REPORT_TID: c_uint = 0x0000_0100;
2995pub const FAN_REPORT_FID: c_uint = 0x0000_0200;
2996pub const FAN_REPORT_DIR_FID: c_uint = 0x0000_0400;
2997pub const FAN_REPORT_NAME: c_uint = 0x0000_0800;
2998pub const FAN_REPORT_TARGET_FID: c_uint = 0x0000_1000;
2999
3000pub const FAN_REPORT_DFID_NAME: c_uint = FAN_REPORT_DIR_FID | FAN_REPORT_NAME;
3001pub const FAN_REPORT_DFID_NAME_TARGET: c_uint =
3002    FAN_REPORT_DFID_NAME | FAN_REPORT_FID | FAN_REPORT_TARGET_FID;
3003
3004pub const FAN_MARK_ADD: c_uint = 0x0000_0001;
3005pub const FAN_MARK_REMOVE: c_uint = 0x0000_0002;
3006pub const FAN_MARK_DONT_FOLLOW: c_uint = 0x0000_0004;
3007pub const FAN_MARK_ONLYDIR: c_uint = 0x0000_0008;
3008pub const FAN_MARK_IGNORED_MASK: c_uint = 0x0000_0020;
3009pub const FAN_MARK_IGNORED_SURV_MODIFY: c_uint = 0x0000_0040;
3010pub const FAN_MARK_FLUSH: c_uint = 0x0000_0080;
3011pub const FAN_MARK_EVICTABLE: c_uint = 0x0000_0200;
3012pub const FAN_MARK_IGNORE: c_uint = 0x0000_0400;
3013
3014pub const FAN_MARK_INODE: c_uint = 0x0000_0000;
3015pub const FAN_MARK_MOUNT: c_uint = 0x0000_0010;
3016pub const FAN_MARK_FILESYSTEM: c_uint = 0x0000_0100;
3017
3018pub const FAN_MARK_IGNORE_SURV: c_uint = FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY;
3019
3020pub const FANOTIFY_METADATA_VERSION: u8 = 3;
3021
3022pub const FAN_EVENT_INFO_TYPE_FID: u8 = 1;
3023pub const FAN_EVENT_INFO_TYPE_DFID_NAME: u8 = 2;
3024pub const FAN_EVENT_INFO_TYPE_DFID: u8 = 3;
3025pub const FAN_EVENT_INFO_TYPE_PIDFD: u8 = 4;
3026pub const FAN_EVENT_INFO_TYPE_ERROR: u8 = 5;
3027
3028pub const FAN_EVENT_INFO_TYPE_OLD_DFID_NAME: u8 = 10;
3029pub const FAN_EVENT_INFO_TYPE_NEW_DFID_NAME: u8 = 12;
3030
3031pub const FAN_RESPONSE_INFO_NONE: u8 = 0;
3032pub const FAN_RESPONSE_INFO_AUDIT_RULE: u8 = 1;
3033
3034pub const FAN_ALLOW: u32 = 0x01;
3035pub const FAN_DENY: u32 = 0x02;
3036pub const FAN_AUDIT: u32 = 0x10;
3037pub const FAN_INFO: u32 = 0x20;
3038
3039pub const FAN_NOFD: c_int = -1;
3040pub const FAN_NOPIDFD: c_int = FAN_NOFD;
3041pub const FAN_EPIDFD: c_int = -2;
3042
3043// linux/kexec.h
3044pub const KEXEC_ON_CRASH: c_int = 0x00000001;
3045pub const KEXEC_PRESERVE_CONTEXT: c_int = 0x00000002;
3046pub const KEXEC_ARCH_MASK: c_int = u32_cast_int(0xffff0000);
3047pub const KEXEC_FILE_UNLOAD: c_int = 0x00000001;
3048pub const KEXEC_FILE_ON_CRASH: c_int = 0x00000002;
3049pub const KEXEC_FILE_NO_INITRAMFS: c_int = 0x00000004;
3050
3051// linux/reboot.h
3052pub const LINUX_REBOOT_MAGIC1: c_int = u32_cast_int(0xfee1dead);
3053pub const LINUX_REBOOT_MAGIC2: c_int = 672274793;
3054pub const LINUX_REBOOT_MAGIC2A: c_int = 85072278;
3055pub const LINUX_REBOOT_MAGIC2B: c_int = 369367448;
3056pub const LINUX_REBOOT_MAGIC2C: c_int = 537993216;
3057
3058pub const LINUX_REBOOT_CMD_RESTART: c_int = 0x01234567;
3059pub const LINUX_REBOOT_CMD_HALT: c_int = u32_cast_int(0xCDEF0123);
3060pub const LINUX_REBOOT_CMD_CAD_ON: c_int = u32_cast_int(0x89ABCDEF);
3061pub const LINUX_REBOOT_CMD_CAD_OFF: c_int = 0x00000000;
3062pub const LINUX_REBOOT_CMD_POWER_OFF: c_int = 0x4321FEDC;
3063pub const LINUX_REBOOT_CMD_RESTART2: c_int = u32_cast_int(0xA1B2C3D4);
3064pub const LINUX_REBOOT_CMD_SW_SUSPEND: c_int = u32_cast_int(0xD000FCE2);
3065pub const LINUX_REBOOT_CMD_KEXEC: c_int = 0x45584543;
3066
3067// linux/errqueue.h
3068pub const SO_EE_ORIGIN_NONE: u8 = 0;
3069pub const SO_EE_ORIGIN_LOCAL: u8 = 1;
3070pub const SO_EE_ORIGIN_ICMP: u8 = 2;
3071pub const SO_EE_ORIGIN_ICMP6: u8 = 3;
3072pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4;
3073pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS;
3074
3075/* DCCP socket options */
3076pub const DCCP_SOCKOPT_PACKET_SIZE: c_int = 1;
3077pub const DCCP_SOCKOPT_SERVICE: c_int = 2;
3078pub const DCCP_SOCKOPT_CHANGE_L: c_int = 3;
3079pub const DCCP_SOCKOPT_CHANGE_R: c_int = 4;
3080pub const DCCP_SOCKOPT_GET_CUR_MPS: c_int = 5;
3081pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: c_int = 6;
3082pub const DCCP_SOCKOPT_SEND_CSCOV: c_int = 10;
3083pub const DCCP_SOCKOPT_RECV_CSCOV: c_int = 11;
3084pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: c_int = 12;
3085pub const DCCP_SOCKOPT_CCID: c_int = 13;
3086pub const DCCP_SOCKOPT_TX_CCID: c_int = 14;
3087pub const DCCP_SOCKOPT_RX_CCID: c_int = 15;
3088pub const DCCP_SOCKOPT_QPOLICY_ID: c_int = 16;
3089pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: c_int = 17;
3090pub const DCCP_SOCKOPT_CCID_RX_INFO: c_int = 128;
3091pub const DCCP_SOCKOPT_CCID_TX_INFO: c_int = 192;
3092
3093/// maximum number of services provided on the same listening port
3094pub const DCCP_SERVICE_LIST_MAX_LEN: c_int = 32;
3095
3096pub const CTL_KERN: c_int = 1;
3097pub const CTL_VM: c_int = 2;
3098pub const CTL_NET: c_int = 3;
3099pub const CTL_FS: c_int = 5;
3100pub const CTL_DEBUG: c_int = 6;
3101pub const CTL_DEV: c_int = 7;
3102pub const CTL_BUS: c_int = 8;
3103pub const CTL_ABI: c_int = 9;
3104pub const CTL_CPU: c_int = 10;
3105
3106pub const CTL_BUS_ISA: c_int = 1;
3107
3108pub const INOTIFY_MAX_USER_INSTANCES: c_int = 1;
3109pub const INOTIFY_MAX_USER_WATCHES: c_int = 2;
3110pub const INOTIFY_MAX_QUEUED_EVENTS: c_int = 3;
3111
3112pub const KERN_OSTYPE: c_int = 1;
3113pub const KERN_OSRELEASE: c_int = 2;
3114pub const KERN_OSREV: c_int = 3;
3115pub const KERN_VERSION: c_int = 4;
3116pub const KERN_SECUREMASK: c_int = 5;
3117pub const KERN_PROF: c_int = 6;
3118pub const KERN_NODENAME: c_int = 7;
3119pub const KERN_DOMAINNAME: c_int = 8;
3120pub const KERN_PANIC: c_int = 15;
3121pub const KERN_SPARC_REBOOT: c_int = 21;
3122pub const KERN_CTLALTDEL: c_int = 22;
3123pub const KERN_PRINTK: c_int = 23;
3124pub const KERN_NAMETRANS: c_int = 24;
3125pub const KERN_PPC_HTABRECLAIM: c_int = 25;
3126pub const KERN_PPC_ZEROPAGED: c_int = 26;
3127pub const KERN_PPC_POWERSAVE_NAP: c_int = 27;
3128pub const KERN_MODPROBE: c_int = 28;
3129pub const KERN_SG_BIG_BUFF: c_int = 29;
3130pub const KERN_ACCT: c_int = 30;
3131pub const KERN_PPC_L2CR: c_int = 31;
3132pub const KERN_RTSIGNR: c_int = 32;
3133pub const KERN_RTSIGMAX: c_int = 33;
3134pub const KERN_SHMMAX: c_int = 34;
3135pub const KERN_MSGMAX: c_int = 35;
3136pub const KERN_MSGMNB: c_int = 36;
3137pub const KERN_MSGPOOL: c_int = 37;
3138pub const KERN_SYSRQ: c_int = 38;
3139pub const KERN_MAX_THREADS: c_int = 39;
3140pub const KERN_RANDOM: c_int = 40;
3141pub const KERN_SHMALL: c_int = 41;
3142pub const KERN_MSGMNI: c_int = 42;
3143pub const KERN_SEM: c_int = 43;
3144pub const KERN_SPARC_STOP_A: c_int = 44;
3145pub const KERN_SHMMNI: c_int = 45;
3146pub const KERN_OVERFLOWUID: c_int = 46;
3147pub const KERN_OVERFLOWGID: c_int = 47;
3148pub const KERN_SHMPATH: c_int = 48;
3149pub const KERN_HOTPLUG: c_int = 49;
3150pub const KERN_IEEE_EMULATION_WARNINGS: c_int = 50;
3151pub const KERN_S390_USER_DEBUG_LOGGING: c_int = 51;
3152pub const KERN_CORE_USES_PID: c_int = 52;
3153pub const KERN_TAINTED: c_int = 53;
3154pub const KERN_CADPID: c_int = 54;
3155
3156/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
3157/// for details.
3158pub const KERN_PIDMAX: c_int = 55;
3159
3160pub const KERN_CORE_PATTERN: c_int = 56;
3161pub const KERN_PANIC_ON_OOPS: c_int = 57;
3162pub const KERN_HPPA_PWRSW: c_int = 58;
3163pub const KERN_HPPA_UNALIGNED: c_int = 59;
3164pub const KERN_PRINTK_RATELIMIT: c_int = 60;
3165pub const KERN_PRINTK_RATELIMIT_BURST: c_int = 61;
3166pub const KERN_PTY: c_int = 62;
3167
3168/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
3169/// for details.
3170pub const KERN_NGROUPS_MAX: c_int = 63;
3171
3172pub const KERN_SPARC_SCONS_PWROFF: c_int = 64;
3173pub const KERN_HZ_TIMER: c_int = 65;
3174pub const KERN_UNKNOWN_NMI_PANIC: c_int = 66;
3175pub const KERN_BOOTLOADER_TYPE: c_int = 67;
3176pub const KERN_RANDOMIZE: c_int = 68;
3177pub const KERN_SETUID_DUMPABLE: c_int = 69;
3178pub const KERN_SPIN_RETRY: c_int = 70;
3179pub const KERN_ACPI_VIDEO_FLAGS: c_int = 71;
3180pub const KERN_IA64_UNALIGNED: c_int = 72;
3181pub const KERN_COMPAT_LOG: c_int = 73;
3182pub const KERN_MAX_LOCK_DEPTH: c_int = 74;
3183pub const KERN_NMI_WATCHDOG: c_int = 75;
3184pub const KERN_PANIC_ON_NMI: c_int = 76;
3185
3186pub const VM_OVERCOMMIT_MEMORY: c_int = 5;
3187pub const VM_PAGE_CLUSTER: c_int = 10;
3188pub const VM_DIRTY_BACKGROUND: c_int = 11;
3189pub const VM_DIRTY_RATIO: c_int = 12;
3190pub const VM_DIRTY_WB_CS: c_int = 13;
3191pub const VM_DIRTY_EXPIRE_CS: c_int = 14;
3192pub const VM_NR_PDFLUSH_THREADS: c_int = 15;
3193pub const VM_OVERCOMMIT_RATIO: c_int = 16;
3194pub const VM_PAGEBUF: c_int = 17;
3195pub const VM_HUGETLB_PAGES: c_int = 18;
3196pub const VM_SWAPPINESS: c_int = 19;
3197pub const VM_LOWMEM_RESERVE_RATIO: c_int = 20;
3198pub const VM_MIN_FREE_KBYTES: c_int = 21;
3199pub const VM_MAX_MAP_COUNT: c_int = 22;
3200pub const VM_BLOCK_DUMP: c_int = 24;
3201pub const VM_HUGETLB_GROUP: c_int = 25;
3202pub const VM_VFS_CACHE_PRESSURE: c_int = 26;
3203pub const VM_LEGACY_VA_LAYOUT: c_int = 27;
3204pub const VM_SWAP_TOKEN_TIMEOUT: c_int = 28;
3205pub const VM_DROP_PAGECACHE: c_int = 29;
3206pub const VM_PERCPU_PAGELIST_FRACTION: c_int = 30;
3207pub const VM_ZONE_RECLAIM_MODE: c_int = 31;
3208pub const VM_MIN_UNMAPPED: c_int = 32;
3209pub const VM_PANIC_ON_OOM: c_int = 33;
3210pub const VM_VDSO_ENABLED: c_int = 34;
3211pub const VM_MIN_SLAB: c_int = 35;
3212
3213pub const NET_CORE: c_int = 1;
3214pub const NET_ETHER: c_int = 2;
3215pub const NET_802: c_int = 3;
3216pub const NET_UNIX: c_int = 4;
3217pub const NET_IPV4: c_int = 5;
3218pub const NET_IPX: c_int = 6;
3219pub const NET_ATALK: c_int = 7;
3220pub const NET_NETROM: c_int = 8;
3221pub const NET_AX25: c_int = 9;
3222pub const NET_BRIDGE: c_int = 10;
3223pub const NET_ROSE: c_int = 11;
3224pub const NET_IPV6: c_int = 12;
3225pub const NET_X25: c_int = 13;
3226pub const NET_TR: c_int = 14;
3227pub const NET_DECNET: c_int = 15;
3228pub const NET_ECONET: c_int = 16;
3229pub const NET_SCTP: c_int = 17;
3230pub const NET_LLC: c_int = 18;
3231pub const NET_NETFILTER: c_int = 19;
3232pub const NET_DCCP: c_int = 20;
3233pub const NET_IRDA: c_int = 412;
3234
3235// include/linux/sched.h
3236/// I'm a virtual CPU.
3237pub const PF_VCPU: c_int = 0x00000001;
3238/// I am an IDLE thread.
3239pub const PF_IDLE: c_int = 0x00000002;
3240/// Getting shut down.
3241pub const PF_EXITING: c_int = 0x00000004;
3242/// Coredumps should ignore this task.
3243pub const PF_POSTCOREDUMP: c_int = 0x00000008;
3244/// Task is an IO worker.
3245pub const PF_IO_WORKER: c_int = 0x00000010;
3246/// I'm a workqueue worker.
3247pub const PF_WQ_WORKER: c_int = 0x00000020;
3248/// Forked but didn't exec.
3249pub const PF_FORKNOEXEC: c_int = 0x00000040;
3250/// Process policy on mce errors.
3251pub const PF_MCE_PROCESS: c_int = 0x00000080;
3252/// Used super-user privileges.
3253pub const PF_SUPERPRIV: c_int = 0x00000100;
3254/// Dumped core.
3255pub const PF_DUMPCORE: c_int = 0x00000200;
3256/// Killed by a signal.
3257pub const PF_SIGNALED: c_int = 0x00000400;
3258/// Allocating memory to free memory.
3259///
3260/// See `memalloc_noreclaim_save()`.
3261pub const PF_MEMALLOC: c_int = 0x00000800;
3262/// `set_user()` noticed that `RLIMIT_NPROC` was exceeded.
3263pub const PF_NPROC_EXCEEDED: c_int = 0x00001000;
3264/// If unset the fpu must be initialized before use.
3265pub const PF_USED_MATH: c_int = 0x00002000;
3266/// Kernel thread cloned from userspace thread.
3267pub const PF_USER_WORKER: c_int = 0x00004000;
3268/// This thread should not be frozen.
3269pub const PF_NOFREEZE: c_int = 0x00008000;
3270/// I am `kswapd`.
3271pub const PF_KSWAPD: c_int = 0x00020000;
3272/// All allocations inherit `GFP_NOFS`.
3273///
3274/// See `memalloc_nfs_save()`.
3275pub const PF_MEMALLOC_NOFS: c_int = 0x00040000;
3276/// All allocations inherit `GFP_NOIO`.
3277///
3278/// See `memalloc_noio_save()`.
3279pub const PF_MEMALLOC_NOIO: c_int = 0x00080000;
3280/// Throttle writes only against the bdi I write to, I am cleaning
3281/// dirty pages from some other bdi.
3282pub const PF_LOCAL_THROTTLE: c_int = 0x00100000;
3283/// I am a kernel thread.
3284pub const PF_KTHREAD: c_int = 0x00200000;
3285/// Randomize virtual address space.
3286pub const PF_RANDOMIZE: c_int = 0x00400000;
3287/// Userland is not allowed to meddle with `cpus_mask`.
3288pub const PF_NO_SETAFFINITY: c_int = 0x04000000;
3289/// Early kill for mce process policy.
3290pub const PF_MCE_EARLY: c_int = 0x08000000;
3291/// Allocations constrained to zones which allow long term pinning.
3292///
3293/// See `memalloc_pin_save()`.
3294pub const PF_MEMALLOC_PIN: c_int = 0x10000000;
3295/// Plug has ts that needs updating.
3296pub const PF_BLOCK_TS: c_int = 0x20000000;
3297/// This thread called `freeze_processes()` and should not be frozen.
3298pub const PF_SUSPEND_TASK: c_int = u32_cast_int(PF_SUSPEND_TASK_UINT);
3299// The used value is the highest possible bit fitting on 32 bits, so directly
3300// defining it as a signed integer causes the compiler to report an overflow.
3301// Use instead a private intermediary that assuringly has the correct type and
3302// cast it where necessary to the wanted final type, which preserves the
3303// desired information as-is in terms of integer representation.
3304const PF_SUSPEND_TASK_UINT: c_uint = 0x80000000;
3305
3306pub const CLONE_PIDFD: c_int = 0x1000;
3307
3308pub const SCHED_FLAG_RESET_ON_FORK: c_int = 0x01;
3309pub const SCHED_FLAG_RECLAIM: c_int = 0x02;
3310pub const SCHED_FLAG_DL_OVERRUN: c_int = 0x04;
3311pub const SCHED_FLAG_KEEP_POLICY: c_int = 0x08;
3312pub const SCHED_FLAG_KEEP_PARAMS: c_int = 0x10;
3313pub const SCHED_FLAG_UTIL_CLAMP_MIN: c_int = 0x20;
3314pub const SCHED_FLAG_UTIL_CLAMP_MAX: c_int = 0x40;
3315
3316// linux/if_xdp.h
3317pub const XDP_SHARED_UMEM: crate::__u16 = 1 << 0;
3318pub const XDP_COPY: crate::__u16 = 1 << 1;
3319pub const XDP_ZEROCOPY: crate::__u16 = 1 << 2;
3320pub const XDP_USE_NEED_WAKEUP: crate::__u16 = 1 << 3;
3321pub const XDP_USE_SG: crate::__u16 = 1 << 4;
3322
3323pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: crate::__u32 = 1 << 0;
3324
3325pub const XDP_RING_NEED_WAKEUP: crate::__u32 = 1 << 0;
3326
3327pub const XDP_MMAP_OFFSETS: c_int = 1;
3328pub const XDP_RX_RING: c_int = 2;
3329pub const XDP_TX_RING: c_int = 3;
3330pub const XDP_UMEM_REG: c_int = 4;
3331pub const XDP_UMEM_FILL_RING: c_int = 5;
3332pub const XDP_UMEM_COMPLETION_RING: c_int = 6;
3333pub const XDP_STATISTICS: c_int = 7;
3334pub const XDP_OPTIONS: c_int = 8;
3335
3336pub const XDP_OPTIONS_ZEROCOPY: crate::__u32 = 1 << 0;
3337
3338pub const XDP_PGOFF_RX_RING: crate::off_t = 0;
3339pub const XDP_PGOFF_TX_RING: crate::off_t = 0x80000000u32 as crate::off_t;
3340pub const XDP_UMEM_PGOFF_FILL_RING: crate::c_ulonglong = 0x100000000;
3341pub const XDP_UMEM_PGOFF_COMPLETION_RING: crate::c_ulonglong = 0x180000000;
3342
3343pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: crate::c_int = 48;
3344pub const XSK_UNALIGNED_BUF_ADDR_MASK: crate::c_ulonglong =
3345    (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1;
3346
3347pub const XDP_PKT_CONTD: crate::__u32 = 1 << 0;
3348
3349pub const XDP_UMEM_TX_SW_CSUM: crate::__u32 = 1 << 1;
3350pub const XDP_UMEM_TX_METADATA_LEN: crate::__u32 = 1 << 2;
3351
3352pub const XDP_TXMD_FLAGS_TIMESTAMP: crate::__u32 = 1 << 0;
3353pub const XDP_TXMD_FLAGS_CHECKSUM: crate::__u32 = 1 << 1;
3354
3355pub const XDP_TX_METADATA: crate::__u32 = 1 << 1;
3356
3357pub const SOL_XDP: c_int = 283;
3358
3359pub const SCHED_FLAG_KEEP_ALL: c_int = SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS;
3360
3361pub const SCHED_FLAG_UTIL_CLAMP: c_int = SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX;
3362
3363pub const SCHED_FLAG_ALL: c_int = SCHED_FLAG_RESET_ON_FORK
3364    | SCHED_FLAG_RECLAIM
3365    | SCHED_FLAG_DL_OVERRUN
3366    | SCHED_FLAG_KEEP_ALL
3367    | SCHED_FLAG_UTIL_CLAMP;
3368
3369// ioctl_eventpoll: added in Linux 6.9
3370const EPOLL_IOC_TYPE: u32 = 0x8A;
3371pub const EPIOCSPARAMS: Ioctl = _IOW::<epoll_params>(EPOLL_IOC_TYPE, 0x01);
3372pub const EPIOCGPARAMS: Ioctl = _IOR::<epoll_params>(EPOLL_IOC_TYPE, 0x02);
3373
3374// siginfo.h
3375pub const SI_DETHREAD: c_int = -7;
3376pub const TRAP_PERF: c_int = 6;
3377
3378#[inline]
pub unsafe extern "C" fn SUN_LEN(s: crate::sockaddr_un) -> usize {
    ({
            #[allow(clippy :: unneeded_wildcard_pattern)]
            let crate::sockaddr_un { sun_path: _, .. };
            let data = core::mem::MaybeUninit::<crate::sockaddr_un>::uninit();
            let ptr = data.as_ptr();
            #[allow(unused_unsafe)]
            let fptr = unsafe { &raw const (*ptr).sun_path };
            let off = (fptr as usize).checked_sub(ptr as usize).unwrap();
            if !(off <= core::mem::size_of::<crate::sockaddr_un>()) {
                ::core::panicking::panic("assertion failed: off <= core::mem::size_of::<crate::sockaddr_un>()")
            };
            off
        }) + crate::strlen(s.sun_path.as_ptr())
}f! {
3379    pub unsafe fn SO_EE_OFFENDER(ee: *const crate::sock_extended_err) -> *mut crate::sockaddr {
3380        ee.offset(1) as *mut crate::sockaddr
3381    }
3382
3383    pub unsafe fn BPF_CLASS(code: __u32) -> __u32 {
3384        code & 0x07
3385    }
3386
3387    pub unsafe fn BPF_SIZE(code: __u32) -> __u32 {
3388        code & 0x18
3389    }
3390
3391    pub unsafe fn BPF_MODE(code: __u32) -> __u32 {
3392        code & 0xe0
3393    }
3394
3395    pub unsafe fn BPF_OP(code: __u32) -> __u32 {
3396        code & 0xf0
3397    }
3398
3399    pub unsafe fn BPF_SRC(code: __u32) -> __u32 {
3400        code & 0x08
3401    }
3402
3403    pub unsafe fn BPF_RVAL(code: __u32) -> __u32 {
3404        code & 0x18
3405    }
3406
3407    pub unsafe fn BPF_MISCOP(code: __u32) -> __u32 {
3408        code & 0xf8
3409    }
3410
3411    pub unsafe fn BPF_STMT(code: __u16, k: __u32) -> sock_filter {
3412        sock_filter {
3413            code,
3414            jt: 0,
3415            jf: 0,
3416            k,
3417        }
3418    }
3419
3420    pub unsafe fn BPF_JUMP(code: __u16, k: __u32, jt: __u8, jf: __u8) -> sock_filter {
3421        sock_filter { code, jt, jf, k }
3422    }
3423
3424    #[cfg(target_env = "gnu")]
3425    pub unsafe fn SUN_LEN(s: crate::sockaddr_un) -> usize {
3426        offset_of!(crate::sockaddr_un, sun_path) + crate::strlen(s.sun_path.as_ptr())
3427    }
3428
3429    #[cfg(target_env = "musl")]
3430    pub unsafe fn SUN_LEN(s: crate::sockaddr_un) -> usize {
3431        2 * crate::strlen(s.sun_path.as_ptr())
3432    }
3433}
3434
3435// These functions are not available on OpenHarmony
3436cfg_if! {
3437    if #[cfg(not(target_env = "ohos"))] {
3438        extern "C" {
3439            // Only `getspnam_r` is implemented for musl, out of all of the reenterant
3440            // functions from `shadow.h`.
3441            // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h
3442            pub fn getspnam_r(
3443                name: *const c_char,
3444                spbuf: *mut crate::spwd,
3445                buf: *mut c_char,
3446                buflen: size_t,
3447                spbufp: *mut *mut crate::spwd,
3448            ) -> c_int;
3449
3450            pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> mqd_t;
3451            pub fn mq_close(mqd: mqd_t) -> c_int;
3452            pub fn mq_unlink(name: *const c_char) -> c_int;
3453            pub fn mq_receive(
3454                mqd: mqd_t,
3455                msg_ptr: *mut c_char,
3456                msg_len: size_t,
3457                msg_prio: *mut c_uint,
3458            ) -> ssize_t;
3459            #[cfg_attr(
3460                any(gnu_time_bits64, musl_redir_time64),
3461                link_name = "__mq_timedreceive_time64"
3462            )]
3463            pub fn mq_timedreceive(
3464                mqd: mqd_t,
3465                msg_ptr: *mut c_char,
3466                msg_len: size_t,
3467                msg_prio: *mut c_uint,
3468                abs_timeout: *const crate::timespec,
3469            ) -> ssize_t;
3470            pub fn mq_send(
3471                mqd: mqd_t,
3472                msg_ptr: *const c_char,
3473                msg_len: size_t,
3474                msg_prio: c_uint,
3475            ) -> c_int;
3476            #[cfg_attr(
3477                any(gnu_time_bits64, musl_redir_time64),
3478                link_name = "__mq_timedsend_time64"
3479            )]
3480            pub fn mq_timedsend(
3481                mqd: mqd_t,
3482                msg_ptr: *const c_char,
3483                msg_len: size_t,
3484                msg_prio: c_uint,
3485                abs_timeout: *const crate::timespec,
3486            ) -> c_int;
3487            pub fn mq_getattr(mqd: mqd_t, attr: *mut crate::mq_attr) -> c_int;
3488            pub fn mq_setattr(
3489                mqd: mqd_t,
3490                newattr: *const crate::mq_attr,
3491                oldattr: *mut crate::mq_attr,
3492            ) -> c_int;
3493        }
3494    }
3495}
3496
3497extern "C" {
3498    pub fn mrand48() -> c_long;
3499    pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort;
3500    pub fn lcong48(p: *mut c_ushort);
3501
3502    #[cfg_attr(gnu_time_bits64, link_name = "__lutimes64")]
3503    #[cfg_attr(musl_redir_time64, link_name = "__lutimes_time64")]
3504    pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
3505
3506    pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
3507    pub fn shm_unlink(name: *const c_char) -> c_int;
3508
3509    // System V IPC
3510    pub fn ftok(pathname: *const c_char, proj_id: c_int) -> crate::key_t;
3511    pub fn semget(key: crate::key_t, nsems: c_int, semflag: c_int) -> c_int;
3512    pub fn semop(semid: c_int, sops: *mut crate::sembuf, nsops: size_t) -> c_int;
3513    #[cfg_attr(gnu_time_bits64, link_name = "__semctl64")]
3514    pub fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) -> c_int;
3515    #[cfg_attr(gnu_time_bits64, link_name = "__msgctl64")]
3516    pub fn msgctl(msqid: c_int, cmd: c_int, buf: *mut msqid_ds) -> c_int;
3517    pub fn msgget(key: crate::key_t, msgflg: c_int) -> c_int;
3518    pub fn msgrcv(
3519        msqid: c_int,
3520        msgp: *mut c_void,
3521        msgsz: size_t,
3522        msgtyp: c_long,
3523        msgflg: c_int,
3524    ) -> ssize_t;
3525    pub fn msgsnd(msqid: c_int, msgp: *const c_void, msgsz: size_t, msgflg: c_int) -> c_int;
3526
3527    #[cfg_attr(gnu_file_offset_bits64, link_name = "fallocate64")]
3528    pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int;
3529    #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")]
3530    pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
3531    pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t;
3532    pub fn getxattr(
3533        path: *const c_char,
3534        name: *const c_char,
3535        value: *mut c_void,
3536        size: size_t,
3537    ) -> ssize_t;
3538    pub fn lgetxattr(
3539        path: *const c_char,
3540        name: *const c_char,
3541        value: *mut c_void,
3542        size: size_t,
3543    ) -> ssize_t;
3544    pub fn fgetxattr(
3545        filedes: c_int,
3546        name: *const c_char,
3547        value: *mut c_void,
3548        size: size_t,
3549    ) -> ssize_t;
3550    pub fn setxattr(
3551        path: *const c_char,
3552        name: *const c_char,
3553        value: *const c_void,
3554        size: size_t,
3555        flags: c_int,
3556    ) -> c_int;
3557    pub fn lsetxattr(
3558        path: *const c_char,
3559        name: *const c_char,
3560        value: *const c_void,
3561        size: size_t,
3562        flags: c_int,
3563    ) -> c_int;
3564    pub fn fsetxattr(
3565        filedes: c_int,
3566        name: *const c_char,
3567        value: *const c_void,
3568        size: size_t,
3569        flags: c_int,
3570    ) -> c_int;
3571    pub fn listxattr(path: *const c_char, list: *mut c_char, size: size_t) -> ssize_t;
3572    pub fn llistxattr(path: *const c_char, list: *mut c_char, size: size_t) -> ssize_t;
3573    pub fn flistxattr(filedes: c_int, list: *mut c_char, size: size_t) -> ssize_t;
3574    pub fn removexattr(path: *const c_char, name: *const c_char) -> c_int;
3575    pub fn lremovexattr(path: *const c_char, name: *const c_char) -> c_int;
3576    pub fn fremovexattr(filedes: c_int, name: *const c_char) -> c_int;
3577    pub fn signalfd(fd: c_int, mask: *const crate::sigset_t, flags: c_int) -> c_int;
3578    pub fn timerfd_create(clockid: crate::clockid_t, flags: c_int) -> c_int;
3579    #[cfg_attr(
3580        any(gnu_time_bits64, musl_redir_time64),
3581        link_name = "__timerfd_gettime64"
3582    )]
3583    pub fn timerfd_gettime(fd: c_int, curr_value: *mut crate::itimerspec) -> c_int;
3584    #[cfg_attr(
3585        any(gnu_time_bits64, musl_redir_time64),
3586        link_name = "__timerfd_settime64"
3587    )]
3588    pub fn timerfd_settime(
3589        fd: c_int,
3590        flags: c_int,
3591        new_value: *const crate::itimerspec,
3592        old_value: *mut crate::itimerspec,
3593    ) -> c_int;
3594    pub fn quotactl(cmd: c_int, special: *const c_char, id: c_int, data: *mut c_char) -> c_int;
3595    pub fn epoll_pwait(
3596        epfd: c_int,
3597        events: *mut crate::epoll_event,
3598        maxevents: c_int,
3599        timeout: c_int,
3600        sigmask: *const crate::sigset_t,
3601    ) -> c_int;
3602    pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int;
3603    #[cfg_attr(gnu_time_bits64, link_name = "__sigtimedwait64")]
3604    #[cfg_attr(musl_redir_time64, link_name = "__sigtimedwait_time64")]
3605    pub fn sigtimedwait(
3606        set: *const sigset_t,
3607        info: *mut siginfo_t,
3608        timeout: *const crate::timespec,
3609    ) -> c_int;
3610    pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
3611    pub fn accept4(fd: c_int, addr: *mut crate::sockaddr, len: *mut socklen_t, flg: c_int)
3612        -> c_int;
3613    pub fn reboot(how_to: c_int) -> c_int;
3614    pub fn setfsgid(gid: crate::gid_t) -> c_int;
3615    pub fn setfsuid(uid: crate::uid_t) -> c_int;
3616
3617    // Not available now on Android
3618    pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
3619    pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int;
3620
3621    pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
3622
3623    pub fn mremap(
3624        addr: *mut c_void,
3625        len: size_t,
3626        new_len: size_t,
3627        flags: c_int,
3628        ...
3629    ) -> *mut c_void;
3630    pub fn remap_file_pages(
3631        addr: *mut c_void,
3632        size: size_t,
3633        prot: c_int,
3634        pgoff: size_t,
3635        flags: c_int,
3636    ) -> c_int;
3637    #[cfg_attr(gnu_file_offset_bits64, link_name = "mkstemps64")]
3638    pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int;
3639
3640    pub fn vhangup() -> c_int;
3641    pub fn sync();
3642    pub fn syncfs(fd: c_int) -> c_int;
3643    pub fn syscall(num: c_long, ...) -> c_long;
3644    pub fn sched_setaffinity(
3645        pid: crate::pid_t,
3646        cpusetsize: size_t,
3647        cpuset: *const crate::cpu_set_t,
3648    ) -> c_int;
3649    pub fn epoll_create(size: c_int) -> c_int;
3650    pub fn epoll_create1(flags: c_int) -> c_int;
3651    pub fn epoll_wait(
3652        epfd: c_int,
3653        events: *mut crate::epoll_event,
3654        maxevents: c_int,
3655        timeout: c_int,
3656    ) -> c_int;
3657    pub fn epoll_ctl(epfd: c_int, op: c_int, fd: c_int, event: *mut crate::epoll_event) -> c_int;
3658    pub fn unshare(flags: c_int) -> c_int;
3659    pub fn umount(target: *const c_char) -> c_int;
3660    pub fn tee(fd_in: c_int, fd_out: c_int, len: size_t, flags: c_uint) -> ssize_t;
3661    pub fn splice(
3662        fd_in: c_int,
3663        off_in: *mut loff_t,
3664        fd_out: c_int,
3665        off_out: *mut loff_t,
3666        len: size_t,
3667        flags: c_uint,
3668    ) -> ssize_t;
3669    pub fn eventfd(initval: c_uint, flags: c_int) -> c_int;
3670    pub fn eventfd_read(fd: c_int, value: *mut eventfd_t) -> c_int;
3671    pub fn eventfd_write(fd: c_int, value: eventfd_t) -> c_int;
3672
3673    #[cfg_attr(gnu_time_bits64, link_name = "__sched_rr_get_interval64")]
3674    #[cfg_attr(musl_redir_time64, link_name = "__sched_rr_get_interval_time64")]
3675    pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int;
3676    pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int;
3677    pub fn setns(fd: c_int, nstype: c_int) -> c_int;
3678    pub fn swapoff(path: *const c_char) -> c_int;
3679    pub fn vmsplice(fd: c_int, iov: *const crate::iovec, nr_segs: size_t, flags: c_uint)
3680        -> ssize_t;
3681    pub fn personality(persona: c_ulong) -> c_int;
3682    pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int;
3683    pub fn clone(
3684        cb: extern "C" fn(*mut c_void) -> c_int,
3685        child_stack: *mut c_void,
3686        flags: c_int,
3687        arg: *mut c_void,
3688        ...
3689    ) -> c_int;
3690    pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
3691    #[cfg_attr(
3692        any(gnu_time_bits64, musl_redir_time64),
3693        link_name = "__clock_nanosleep_time64"
3694    )]
3695    pub fn clock_nanosleep(
3696        clk_id: crate::clockid_t,
3697        flags: c_int,
3698        rqtp: *const crate::timespec,
3699        rmtp: *mut crate::timespec,
3700    ) -> c_int;
3701    pub fn umount2(target: *const c_char, flags: c_int) -> c_int;
3702    pub fn swapon(path: *const c_char, swapflags: c_int) -> c_int;
3703    pub fn sched_setscheduler(
3704        pid: crate::pid_t,
3705        policy: c_int,
3706        param: *const crate::sched_param,
3707    ) -> c_int;
3708    #[cfg_attr(gnu_file_offset_bits64, link_name = "sendfile64")]
3709    pub fn sendfile(out_fd: c_int, in_fd: c_int, offset: *mut off_t, count: size_t) -> ssize_t;
3710    pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> c_int;
3711    pub fn getdtablesize() -> c_int;
3712    pub fn getgrouplist(
3713        user: *const c_char,
3714        group: crate::gid_t,
3715        groups: *mut crate::gid_t,
3716        ngroups: *mut c_int,
3717    ) -> c_int;
3718    pub fn posix_spawn(
3719        pid: *mut crate::pid_t,
3720        path: *const c_char,
3721        file_actions: *const crate::posix_spawn_file_actions_t,
3722        attrp: *const crate::posix_spawnattr_t,
3723        argv: *const *mut c_char,
3724        envp: *const *mut c_char,
3725    ) -> c_int;
3726    pub fn posix_spawnp(
3727        pid: *mut crate::pid_t,
3728        file: *const c_char,
3729        file_actions: *const crate::posix_spawn_file_actions_t,
3730        attrp: *const crate::posix_spawnattr_t,
3731        argv: *const *mut c_char,
3732        envp: *const *mut c_char,
3733    ) -> c_int;
3734    pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
3735    pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
3736    pub fn posix_spawnattr_getsigdefault(
3737        attr: *const posix_spawnattr_t,
3738        default: *mut crate::sigset_t,
3739    ) -> c_int;
3740    pub fn posix_spawnattr_setsigdefault(
3741        attr: *mut posix_spawnattr_t,
3742        default: *const crate::sigset_t,
3743    ) -> c_int;
3744    pub fn posix_spawnattr_getsigmask(
3745        attr: *const posix_spawnattr_t,
3746        default: *mut crate::sigset_t,
3747    ) -> c_int;
3748    pub fn posix_spawnattr_setsigmask(
3749        attr: *mut posix_spawnattr_t,
3750        default: *const crate::sigset_t,
3751    ) -> c_int;
3752    pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
3753    pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
3754    pub fn posix_spawnattr_getpgroup(
3755        attr: *const posix_spawnattr_t,
3756        flags: *mut crate::pid_t,
3757    ) -> c_int;
3758    pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int;
3759    pub fn posix_spawnattr_getschedpolicy(
3760        attr: *const posix_spawnattr_t,
3761        flags: *mut c_int,
3762    ) -> c_int;
3763    pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int;
3764    pub fn posix_spawnattr_getschedparam(
3765        attr: *const posix_spawnattr_t,
3766        param: *mut crate::sched_param,
3767    ) -> c_int;
3768    pub fn posix_spawnattr_setschedparam(
3769        attr: *mut posix_spawnattr_t,
3770        param: *const crate::sched_param,
3771    ) -> c_int;
3772
3773    pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
3774    pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
3775    pub fn posix_spawn_file_actions_addopen(
3776        actions: *mut posix_spawn_file_actions_t,
3777        fd: c_int,
3778        path: *const c_char,
3779        oflag: c_int,
3780        mode: mode_t,
3781    ) -> c_int;
3782    pub fn posix_spawn_file_actions_addclose(
3783        actions: *mut posix_spawn_file_actions_t,
3784        fd: c_int,
3785    ) -> c_int;
3786    pub fn posix_spawn_file_actions_adddup2(
3787        actions: *mut posix_spawn_file_actions_t,
3788        fd: c_int,
3789        newfd: c_int,
3790    ) -> c_int;
3791    pub fn fread_unlocked(
3792        buf: *mut c_void,
3793        size: size_t,
3794        nobj: size_t,
3795        stream: *mut crate::FILE,
3796    ) -> size_t;
3797    pub fn inotify_rm_watch(fd: c_int, wd: c_int) -> c_int;
3798    pub fn inotify_init() -> c_int;
3799    pub fn inotify_init1(flags: c_int) -> c_int;
3800    pub fn inotify_add_watch(fd: c_int, path: *const c_char, mask: u32) -> c_int;
3801    pub fn fanotify_init(flags: c_uint, event_f_flags: c_uint) -> c_int;
3802
3803    pub fn gethostid() -> c_long;
3804
3805    pub fn klogctl(syslog_type: c_int, bufp: *mut c_char, len: c_int) -> c_int;
3806
3807    pub fn name_to_handle_at(
3808        dirfd: c_int,
3809        path: *const c_char,
3810        handle: *mut file_handle,
3811        mount_id: *mut c_int,
3812        flags: c_int,
3813    ) -> c_int;
3814    pub fn open_by_handle_at(mount_fd: c_int, handle: *mut file_handle, flags: c_int) -> c_int;
3815    pub fn getnetbyname(name: *const c_char) -> *mut netent;
3816    pub fn getnetbyaddr(net: u32, type_: c_int) -> *mut netent;
3817    pub fn getnetent() -> *mut netent;
3818    pub fn setnetent(stayopen: c_int);
3819    pub fn endnetent();
3820}
3821
3822// LFS64 extensions
3823//
3824// * musl has 64-bit versions only so aliases the LFS64 symbols to the standard ones
3825cfg_if! {
3826    if #[cfg(not(any(target_env = "musl", target_env = "ohos")))] {
3827        extern "C" {
3828            pub fn fallocate64(fd: c_int, mode: c_int, offset: off64_t, len: off64_t) -> c_int;
3829            pub fn fgetpos64(stream: *mut crate::FILE, ptr: *mut crate::fpos64_t) -> c_int;
3830            pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut crate::FILE;
3831            pub fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int;
3832            pub fn sendfile64(
3833                out_fd: c_int,
3834                in_fd: c_int,
3835                offset: *mut off64_t,
3836                count: size_t,
3837            ) -> ssize_t;
3838            pub fn tmpfile64() -> *mut crate::FILE;
3839        }
3840    }
3841}
3842
3843cfg_if! {
3844    if #[cfg(target_env = "uclibc")] {
3845        mod uclibc;
3846        pub use self::uclibc::*;
3847    } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
3848        mod musl;
3849        pub use self::musl::*;
3850    } else if #[cfg(target_env = "gnu")] {
3851        mod gnu;
3852        pub use self::gnu::*;
3853    }
3854}
3855
3856mod arch;
3857pub use self::arch::*;