forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
4409 lines (3870 loc) · 144 KB
/
Copy pathmod.rs
File metadata and controls
4409 lines (3870 loc) · 144 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//! Linux-specific definitions for linux-like values
use crate::prelude::*;
use crate::{
sock_filter,
_IO,
_IOR,
_IOW,
_IOWR,
};
pub type dev_t = u64;
pub type socklen_t = u32;
pub type mode_t = u32;
pub type ino64_t = u64;
pub type off64_t = i64;
pub type blkcnt64_t = i64;
pub type rlim64_t = u64;
pub type mqd_t = c_int;
pub type nfds_t = c_ulong;
pub type nl_item = c_int;
pub type idtype_t = c_uint;
pub type loff_t = c_longlong;
pub type pthread_key_t = c_uint;
pub type pthread_once_t = c_int;
pub type pthread_spinlock_t = c_int;
pub type __kernel_fsid_t = __c_anonymous__kernel_fsid_t;
pub type __kernel_clockid_t = c_int;
pub type __u8 = c_uchar;
pub type __u16 = c_ushort;
pub type __s16 = c_short;
pub type __u32 = c_uint;
pub type __s32 = c_int;
// linux/sctp.h
pub type sctp_assoc_t = __s32;
pub type eventfd_t = u64;
c_enum! {
pub enum tpacket_versions {
pub TPACKET_V1,
pub TPACKET_V2,
pub TPACKET_V3,
}
pub enum pid_type {
pub PIDTYPE_PID,
pub PIDTYPE_TGID,
pub PIDTYPE_PGID,
pub PIDTYPE_SID,
pub PIDTYPE_MAX,
}
}
s! {
pub struct dqblk {
pub dqb_bhardlimit: u64,
pub dqb_bsoftlimit: u64,
pub dqb_curspace: u64,
pub dqb_ihardlimit: u64,
pub dqb_isoftlimit: u64,
pub dqb_curinodes: u64,
pub dqb_btime: u64,
pub dqb_itime: u64,
pub dqb_valid: u32,
}
pub struct signalfd_siginfo {
pub ssi_signo: u32,
pub ssi_errno: i32,
pub ssi_code: i32,
pub ssi_pid: u32,
pub ssi_uid: u32,
pub ssi_fd: i32,
pub ssi_tid: u32,
pub ssi_band: u32,
pub ssi_overrun: u32,
pub ssi_trapno: u32,
pub ssi_status: i32,
pub ssi_int: i32,
pub ssi_ptr: u64,
pub ssi_utime: u64,
pub ssi_stime: u64,
pub ssi_addr: u64,
pub ssi_addr_lsb: u16,
_pad2: Padding<u16>,
pub ssi_syscall: i32,
pub ssi_call_addr: u64,
pub ssi_arch: u32,
_pad: Padding<[u8; 28]>,
}
pub struct fanout_args {
#[cfg(target_endian = "little")]
pub id: __u16,
pub type_flags: __u16,
#[cfg(target_endian = "big")]
pub id: __u16,
pub max_num_members: __u32,
}
#[deprecated(since = "0.2.70", note = "sockaddr_ll type must be used instead")]
pub struct sockaddr_pkt {
pub spkt_family: c_ushort,
pub spkt_device: [c_uchar; 14],
pub spkt_protocol: c_ushort,
}
pub struct tpacket_auxdata {
pub tp_status: __u32,
pub tp_len: __u32,
pub tp_snaplen: __u32,
pub tp_mac: __u16,
pub tp_net: __u16,
pub tp_vlan_tci: __u16,
pub tp_vlan_tpid: __u16,
}
pub struct tpacket_hdr {
pub tp_status: c_ulong,
pub tp_len: c_uint,
pub tp_snaplen: c_uint,
pub tp_mac: c_ushort,
pub tp_net: c_ushort,
pub tp_sec: c_uint,
pub tp_usec: c_uint,
}
pub struct tpacket_hdr_variant1 {
pub tp_rxhash: __u32,
pub tp_vlan_tci: __u32,
pub tp_vlan_tpid: __u16,
pub tp_padding: __u16,
}
pub struct tpacket2_hdr {
pub tp_status: __u32,
pub tp_len: __u32,
pub tp_snaplen: __u32,
pub tp_mac: __u16,
pub tp_net: __u16,
pub tp_sec: __u32,
pub tp_nsec: __u32,
pub tp_vlan_tci: __u16,
pub tp_vlan_tpid: __u16,
pub tp_padding: [__u8; 4],
}
pub struct tpacket_req {
pub tp_block_size: c_uint,
pub tp_block_nr: c_uint,
pub tp_frame_size: c_uint,
pub tp_frame_nr: c_uint,
}
pub struct tpacket_req3 {
pub tp_block_size: c_uint,
pub tp_block_nr: c_uint,
pub tp_frame_size: c_uint,
pub tp_frame_nr: c_uint,
pub tp_retire_blk_tov: c_uint,
pub tp_sizeof_priv: c_uint,
pub tp_feature_req_word: c_uint,
}
#[repr(align(8))]
pub struct tpacket_rollover_stats {
pub tp_all: crate::__u64,
pub tp_huge: crate::__u64,
pub tp_failed: crate::__u64,
}
pub struct tpacket_stats {
pub tp_packets: c_uint,
pub tp_drops: c_uint,
}
pub struct tpacket_stats_v3 {
pub tp_packets: c_uint,
pub tp_drops: c_uint,
pub tp_freeze_q_cnt: c_uint,
}
pub struct tpacket3_hdr {
pub tp_next_offset: __u32,
pub tp_sec: __u32,
pub tp_nsec: __u32,
pub tp_snaplen: __u32,
pub tp_len: __u32,
pub tp_status: __u32,
pub tp_mac: __u16,
pub tp_net: __u16,
pub hv1: crate::tpacket_hdr_variant1,
pub tp_padding: [__u8; 8],
}
pub struct tpacket_bd_ts {
pub ts_sec: c_uint,
pub ts_usec: c_uint,
}
#[repr(align(8))]
pub struct tpacket_hdr_v1 {
pub block_status: __u32,
pub num_pkts: __u32,
pub offset_to_first_pkt: __u32,
pub blk_len: __u32,
pub seq_num: crate::__u64,
pub ts_first_pkt: crate::tpacket_bd_ts,
pub ts_last_pkt: crate::tpacket_bd_ts,
}
// System V IPC
pub struct msginfo {
pub msgpool: c_int,
pub msgmap: c_int,
pub msgmax: c_int,
pub msgmnb: c_int,
pub msgmni: c_int,
pub msgssz: c_int,
pub msgtql: c_int,
pub msgseg: c_ushort,
}
pub struct input_event {
// input_event_sec and input_event_usec are preprocessor macros in C.
// On all variants _except_ 32-bit long and 64-bit time_t they actually
// refer to members of input_event.time, a timeval struct.
// The timeval struct has two members of type time_t and suseconds_t.
#[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
pub input_event_sec: crate::time_t,
#[cfg(all(target_pointer_width = "32", linux_time_bits64))]
pub input_event_sec: c_ulong,
#[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))]
pub input_event_usec: crate::suseconds_t,
#[cfg(all(target_pointer_width = "32", linux_time_bits64))]
pub input_event_usec: c_ulong,
#[cfg(target_arch = "sparc64")]
_pad1: Padding<c_int>,
pub type_: __u16,
pub code: __u16,
pub value: __s32,
}
pub struct input_id {
pub bustype: __u16,
pub vendor: __u16,
pub product: __u16,
pub version: __u16,
}
pub struct input_absinfo {
pub value: __s32,
pub minimum: __s32,
pub maximum: __s32,
pub fuzz: __s32,
pub flat: __s32,
pub resolution: __s32,
}
pub struct input_keymap_entry {
pub flags: __u8,
pub len: __u8,
pub index: __u16,
pub keycode: __u32,
pub scancode: [__u8; 32],
}
pub struct input_mask {
pub type_: __u32,
pub codes_size: __u32,
pub codes_ptr: crate::__u64,
}
pub struct ff_replay {
pub length: __u16,
pub delay: __u16,
}
pub struct ff_trigger {
pub button: __u16,
pub interval: __u16,
}
pub struct ff_envelope {
pub attack_length: __u16,
pub attack_level: __u16,
pub fade_length: __u16,
pub fade_level: __u16,
}
pub struct ff_constant_effect {
pub level: __s16,
pub envelope: ff_envelope,
}
pub struct ff_ramp_effect {
pub start_level: __s16,
pub end_level: __s16,
pub envelope: ff_envelope,
}
pub struct ff_condition_effect {
pub right_saturation: __u16,
pub left_saturation: __u16,
pub right_coeff: __s16,
pub left_coeff: __s16,
pub deadband: __u16,
pub center: __s16,
}
pub struct ff_periodic_effect {
pub waveform: __u16,
pub period: __u16,
pub magnitude: __s16,
pub offset: __s16,
pub phase: __u16,
pub envelope: ff_envelope,
pub custom_len: __u32,
pub custom_data: *mut __s16,
}
pub struct ff_rumble_effect {
pub strong_magnitude: __u16,
pub weak_magnitude: __u16,
}
pub struct ff_effect {
pub type_: __u16,
pub id: __s16,
pub direction: __u16,
pub trigger: ff_trigger,
pub replay: ff_replay,
// FIXME(1.0): this is actually a union
#[cfg(target_pointer_width = "64")]
pub u: [u64; 4],
#[cfg(target_pointer_width = "32")]
pub u: [u32; 7],
}
pub struct uinput_ff_upload {
pub request_id: __u32,
pub retval: __s32,
pub effect: ff_effect,
pub old: ff_effect,
}
pub struct uinput_ff_erase {
pub request_id: __u32,
pub retval: __s32,
pub effect_id: __u32,
}
pub struct uinput_abs_setup {
pub code: __u16,
pub absinfo: input_absinfo,
}
pub struct __c_anonymous__kernel_fsid_t {
pub val: [c_int; 2],
}
pub struct posix_spawn_file_actions_t {
__allocated: c_int,
__used: c_int,
__actions: *mut c_int,
__pad: Padding<[c_int; 16]>,
}
pub struct posix_spawnattr_t {
__flags: c_short,
__pgrp: crate::pid_t,
__sd: crate::sigset_t,
__ss: crate::sigset_t,
#[cfg(any(target_env = "musl", target_env = "ohos"))]
__prio: c_int,
#[cfg(not(any(target_env = "musl", target_env = "ohos")))]
__sp: crate::sched_param,
__policy: c_int,
__pad: Padding<[c_int; 16]>,
}
pub struct genlmsghdr {
pub cmd: u8,
pub version: u8,
pub reserved: u16,
}
pub struct inotify_event {
pub wd: c_int,
pub mask: u32,
pub cookie: u32,
pub len: u32,
}
pub struct fanotify_response {
pub fd: c_int,
pub response: __u32,
}
pub struct fanotify_event_info_header {
pub info_type: __u8,
pub pad: __u8,
pub len: __u16,
}
pub struct fanotify_event_info_fid {
pub hdr: fanotify_event_info_header,
pub fsid: __kernel_fsid_t,
pub handle: [c_uchar; 0],
}
pub struct sockaddr_vm {
pub svm_family: crate::sa_family_t,
pub svm_reserved1: c_ushort,
pub svm_port: c_uint,
pub svm_cid: c_uint,
pub svm_flags: u8,
pub svm_zero: [u8; 3],
}
pub struct sock_extended_err {
pub ee_errno: u32,
pub ee_origin: u8,
pub ee_type: u8,
pub ee_code: u8,
pub ee_pad: u8,
pub ee_info: u32,
pub ee_data: u32,
}
// linux/seccomp.h
pub struct seccomp_data {
pub nr: c_int,
pub arch: __u32,
pub instruction_pointer: crate::__u64,
pub args: [crate::__u64; 6],
}
pub struct seccomp_notif_sizes {
pub seccomp_notif: __u16,
pub seccomp_notif_resp: __u16,
pub seccomp_data: __u16,
}
pub struct seccomp_notif {
pub id: crate::__u64,
pub pid: __u32,
pub flags: __u32,
pub data: seccomp_data,
}
pub struct seccomp_notif_resp {
pub id: crate::__u64,
pub val: crate::__s64,
pub error: __s32,
pub flags: __u32,
}
pub struct seccomp_notif_addfd {
pub id: crate::__u64,
pub flags: __u32,
pub srcfd: __u32,
pub newfd: __u32,
pub newfd_flags: __u32,
}
pub struct in6_ifreq {
pub ifr6_addr: crate::in6_addr,
pub ifr6_prefixlen: u32,
pub ifr6_ifindex: c_int,
}
// linux/openat2.h
#[non_exhaustive]
pub struct open_how {
pub flags: crate::__u64,
pub mode: crate::__u64,
pub resolve: crate::__u64,
}
// linux/ptp_clock.h
pub struct ptp_clock_time {
pub sec: crate::__s64,
pub nsec: __u32,
pub reserved: __u32,
}
pub struct ptp_extts_request {
pub index: c_uint,
pub flags: c_uint,
pub rsv: [c_uint; 2],
}
pub struct ptp_sys_offset_extended {
pub n_samples: c_uint,
pub clockid: __kernel_clockid_t,
pub rsv: [c_uint; 2],
pub ts: [[ptp_clock_time; 3]; PTP_MAX_SAMPLES as usize],
}
pub struct ptp_sys_offset_precise {
pub device: ptp_clock_time,
pub sys_realtime: ptp_clock_time,
pub sys_monoraw: ptp_clock_time,
pub rsv: [c_uint; 4],
}
pub struct ptp_extts_event {
pub t: ptp_clock_time,
index: c_uint,
flags: c_uint,
rsv: [c_uint; 2],
}
// linux/sctp.h
pub struct sctp_initmsg {
pub sinit_num_ostreams: __u16,
pub sinit_max_instreams: __u16,
pub sinit_max_attempts: __u16,
pub sinit_max_init_timeo: __u16,
}
pub struct sctp_sndrcvinfo {
pub sinfo_stream: __u16,
pub sinfo_ssn: __u16,
pub sinfo_flags: __u16,
pub sinfo_ppid: __u32,
pub sinfo_context: __u32,
pub sinfo_timetolive: __u32,
pub sinfo_tsn: __u32,
pub sinfo_cumtsn: __u32,
pub sinfo_assoc_id: crate::sctp_assoc_t,
}
pub struct sctp_sndinfo {
pub snd_sid: __u16,
pub snd_flags: __u16,
pub snd_ppid: __u32,
pub snd_context: __u32,
pub snd_assoc_id: crate::sctp_assoc_t,
}
pub struct sctp_rcvinfo {
pub rcv_sid: __u16,
pub rcv_ssn: __u16,
pub rcv_flags: __u16,
pub rcv_ppid: __u32,
pub rcv_tsn: __u32,
pub rcv_cumtsn: __u32,
pub rcv_context: __u32,
pub rcv_assoc_id: crate::sctp_assoc_t,
}
pub struct sctp_nxtinfo {
pub nxt_sid: __u16,
pub nxt_flags: __u16,
pub nxt_ppid: __u32,
pub nxt_length: __u32,
pub nxt_assoc_id: crate::sctp_assoc_t,
}
pub struct sctp_prinfo {
pub pr_policy: __u16,
pub pr_value: __u32,
}
pub struct sctp_authinfo {
pub auth_keynumber: __u16,
}
// linux/tls.h
pub struct tls_crypto_info {
pub version: __u16,
pub cipher_type: __u16,
}
pub struct tls12_crypto_info_aes_gcm_128 {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_AES_GCM_128_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_AES_GCM_128_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_AES_GCM_128_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE],
}
pub struct tls12_crypto_info_aes_gcm_256 {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_AES_GCM_256_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_AES_GCM_256_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_AES_GCM_256_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE],
}
pub struct tls12_crypto_info_aes_ccm_128 {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_AES_CCM_128_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_AES_CCM_128_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_AES_CCM_128_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE],
}
pub struct tls12_crypto_info_chacha20_poly1305 {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE],
}
pub struct tls12_crypto_info_sm4_gcm {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_SM4_GCM_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_SM4_GCM_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_SM4_GCM_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE],
}
pub struct tls12_crypto_info_sm4_ccm {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_SM4_CCM_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_SM4_CCM_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_SM4_CCM_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE],
}
pub struct tls12_crypto_info_aria_gcm_128 {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_ARIA_GCM_128_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_ARIA_GCM_128_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_ARIA_GCM_128_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE],
}
pub struct tls12_crypto_info_aria_gcm_256 {
pub info: tls_crypto_info,
pub iv: [c_uchar; TLS_CIPHER_ARIA_GCM_256_IV_SIZE],
pub key: [c_uchar; TLS_CIPHER_ARIA_GCM_256_KEY_SIZE],
pub salt: [c_uchar; TLS_CIPHER_ARIA_GCM_256_SALT_SIZE],
pub rec_seq: [c_uchar; TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE],
}
// linux/wireless.h
pub struct iw_param {
pub value: __s32,
pub fixed: __u8,
pub disabled: __u8,
pub flags: __u16,
}
pub struct iw_point {
pub pointer: *mut c_void,
pub length: __u16,
pub flags: __u16,
}
pub struct iw_freq {
pub m: __s32,
pub e: __s16,
pub i: __u8,
pub flags: __u8,
}
pub struct iw_quality {
pub qual: __u8,
pub level: __u8,
pub noise: __u8,
pub updated: __u8,
}
pub struct iw_discarded {
pub nwid: __u32,
pub code: __u32,
pub fragment: __u32,
pub retries: __u32,
pubmisc: __u32,
}
pub struct iw_missed {
pub beacon: __u32,
}
pub struct iw_scan_req {
pub scan_type: __u8,
pub essid_len: __u8,
pub num_channels: __u8,
pub flags: __u8,
pub bssid: crate::sockaddr,
pub essid: [__u8; IW_ESSID_MAX_SIZE],
pub min_channel_time: __u32,
pub max_channel_time: __u32,
pub channel_list: [iw_freq; IW_MAX_FREQUENCIES],
}
pub struct iw_encode_ext {
pub ext_flags: __u32,
pub tx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
pub rx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
pub addr: crate::sockaddr,
pub alg: __u16,
pub key_len: __u16,
pub key: [__u8; 0],
}
pub struct iw_pmksa {
pub cmd: __u32,
pub bssid: crate::sockaddr,
pub pmkid: [__u8; IW_PMKID_LEN],
}
pub struct iw_pmkid_cand {
pub flags: __u32,
pub index: __u32,
pub bssid: crate::sockaddr,
}
pub struct iw_statistics {
pub status: __u16,
pub qual: iw_quality,
pub discard: iw_discarded,
pub miss: iw_missed,
}
pub struct iw_range {
pub throughput: __u32,
pub min_nwid: __u32,
pub max_nwid: __u32,
pub old_num_channels: __u16,
pub old_num_frequency: __u8,
pub scan_capa: __u8,
pub event_capa: [__u32; 6],
pub sensitivity: __s32,
pub max_qual: iw_quality,
pub avg_qual: iw_quality,
pub num_bitrates: __u8,
pub bitrate: [__s32; IW_MAX_BITRATES],
pub min_rts: __s32,
pub max_rts: __s32,
pub min_frag: __s32,
pub max_frag: __s32,
pub min_pmp: __s32,
pub max_pmp: __s32,
pub min_pmt: __s32,
pub max_pmt: __s32,
pub pmp_flags: __u16,
pub pmt_flags: __u16,
pub pm_capa: __u16,
pub encoding_size: [__u16; IW_MAX_ENCODING_SIZES],
pub num_encoding_sizes: __u8,
pub max_encoding_tokens: __u8,
pub encoding_login_index: __u8,
pub txpower_capa: __u16,
pub num_txpower: __u8,
pub txpower: [__s32; IW_MAX_TXPOWER],
pub we_version_compiled: __u8,
pub we_version_source: __u8,
pub retry_capa: __u16,
pub retry_flags: __u16,
pub r_time_flags: __u16,
pub min_retry: __s32,
pub max_retry: __s32,
pub min_r_time: __s32,
pub max_r_time: __s32,
pub num_channels: __u16,
pub num_frequency: __u8,
pub freq: [iw_freq; IW_MAX_FREQUENCIES],
pub enc_capa: __u32,
}
pub struct iw_priv_args {
pub cmd: __u32,
pub set_args: __u16,
pub get_args: __u16,
pub name: [c_char; crate::IFNAMSIZ],
}
// #include <linux/eventpoll.h>
pub struct epoll_params {
pub busy_poll_usecs: u32,
pub busy_poll_budget: u16,
pub prefer_busy_poll: u8,
pub __pad: u8, // Must be zero
}
#[cfg_attr(
any(
target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "aarch64",
target_arch = "riscv64",
target_arch = "riscv32",
target_arch = "loongarch64"
),
repr(align(4))
)]
#[cfg_attr(
not(any(
target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "aarch64",
target_arch = "riscv64",
target_arch = "riscv32",
target_arch = "loongarch64"
)),
repr(align(8))
)]
pub struct pthread_mutexattr_t {
#[doc(hidden)]
size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T],
}
#[cfg_attr(
any(
target_env = "musl",
target_env = "ohos",
target_env = "uclibc",
target_pointer_width = "32"
),
repr(align(4))
)]
#[cfg_attr(
all(
not(target_env = "musl"),
not(target_env = "ohos"),
not(target_env = "uclibc"),
target_pointer_width = "64"
),
repr(align(8))
)]
pub struct pthread_rwlockattr_t {
#[doc(hidden)]
size: [u8; crate::__SIZEOF_PTHREAD_RWLOCKATTR_T],
}
#[repr(align(4))]
pub struct pthread_condattr_t {
#[doc(hidden)]
size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T],
}
#[repr(align(4))]
pub struct pthread_barrierattr_t {
#[doc(hidden)]
size: [u8; crate::__SIZEOF_PTHREAD_BARRIERATTR_T],
}
#[cfg(not(any(target_env = "musl", target_env = "ohos")))]
#[repr(align(8))]
pub struct fanotify_event_metadata {
pub event_len: __u32,
pub vers: __u8,
pub reserved: __u8,
pub metadata_len: __u16,
pub mask: __u64,
pub fd: c_int,
pub pid: c_int,
}
// linux/ptp_clock.h
pub struct ptp_sys_offset {
pub n_samples: c_uint,
pub rsv: [c_uint; 3],
// FIXME(garando): replace length with `2 * PTP_MAX_SAMPLES + 1` when supported
pub ts: [ptp_clock_time; 51],
}
pub struct ptp_pin_desc {
pub name: [c_char; 64],
pub index: c_uint,
pub func: c_uint,
pub chan: c_uint,
pub rsv: [c_uint; 5],
}
pub struct ptp_clock_caps {
pub max_adj: c_int,
pub n_alarm: c_int,
pub n_ext_ts: c_int,
pub n_per_out: c_int,
pub pps: c_int,
pub n_pins: c_int,
pub cross_timestamping: c_int,
pub adjust_phase: c_int,
pub max_phase_adj: c_int,
pub rsv: [c_int; 11],
}
// linux/if_xdp.h
pub struct sockaddr_xdp {
pub sxdp_family: crate::__u16,
pub sxdp_flags: crate::__u16,
pub sxdp_ifindex: crate::__u32,
pub sxdp_queue_id: crate::__u32,
pub sxdp_shared_umem_fd: crate::__u32,
}
pub struct xdp_ring_offset {
pub producer: crate::__u64,
pub consumer: crate::__u64,
pub desc: crate::__u64,
pub flags: crate::__u64,
}
pub struct xdp_mmap_offsets {
pub rx: xdp_ring_offset,
pub tx: xdp_ring_offset,
pub fr: xdp_ring_offset,
pub cr: xdp_ring_offset,
}
pub struct xdp_ring_offset_v1 {
pub producer: crate::__u64,
pub consumer: crate::__u64,
pub desc: crate::__u64,
}
pub struct xdp_mmap_offsets_v1 {
pub rx: xdp_ring_offset_v1,
pub tx: xdp_ring_offset_v1,
pub fr: xdp_ring_offset_v1,
pub cr: xdp_ring_offset_v1,
}
pub struct xdp_umem_reg {
pub addr: crate::__u64,
pub len: crate::__u64,
pub chunk_size: crate::__u32,
pub headroom: crate::__u32,
pub flags: crate::__u32,
pub tx_metadata_len: crate::__u32,
}
pub struct xdp_umem_reg_v1 {
pub addr: crate::__u64,
pub len: crate::__u64,
pub chunk_size: crate::__u32,
pub headroom: crate::__u32,
}
pub struct xdp_statistics {
pub rx_dropped: crate::__u64,
pub rx_invalid_descs: crate::__u64,
pub tx_invalid_descs: crate::__u64,
pub rx_ring_full: crate::__u64,
pub rx_fill_ring_empty_descs: crate::__u64,
pub tx_ring_empty_descs: crate::__u64,
}
pub struct xdp_statistics_v1 {
pub rx_dropped: crate::__u64,
pub rx_invalid_descs: crate::__u64,
pub tx_invalid_descs: crate::__u64,
}
pub struct xdp_options {
pub flags: crate::__u32,
}
pub struct xdp_desc {
pub addr: crate::__u64,
pub len: crate::__u32,
pub options: crate::__u32,
}
pub struct xsk_tx_metadata_completion {
pub tx_timestamp: crate::__u64,
}
pub struct xsk_tx_metadata_request {
pub csum_start: __u16,
pub csum_offset: __u16,
}
// linux/mount.h
pub struct mount_attr {
pub attr_set: crate::__u64,
pub attr_clr: crate::__u64,