Debian Codegraph @

vendor/libc/src/unix/linux_like/linux/mod.rs

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