forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.rs
4468 lines (3989 loc) · 149 KB
/
mod.rs
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
pub type useconds_t = u32;
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_spinlock_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;
pub type Elf32_Half = u16;
pub type Elf32_Word = u32;
pub type Elf32_Off = u32;
pub type Elf32_Addr = u32;
pub type Elf64_Half = u16;
pub type Elf64_Word = u32;
pub type Elf64_Off = u64;
pub type Elf64_Addr = u64;
pub type Elf64_Xword = u64;
pub type Elf64_Sxword = i64;
pub type Elf32_Section = u16;
pub type Elf64_Section = u16;
// linux/can.h
pub type canid_t = u32;
// linux/can/j1939.h
pub type can_err_mask_t = u32;
pub type pgn_t = u32;
pub type priority_t = u8;
pub type name_t = u64;
pub type iconv_t = *mut ::c_void;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos64_t {}
impl ::Clone for fpos64_t {
fn clone(&self) -> fpos64_t {
*self
}
}
s! {
pub struct rlimit64 {
pub rlim_cur: rlim64_t,
pub rlim_max: rlim64_t,
}
pub struct glob_t {
pub gl_pathc: ::size_t,
pub gl_pathv: *mut *mut c_char,
pub gl_offs: ::size_t,
pub gl_flags: ::c_int,
__unused1: *mut ::c_void,
__unused2: *mut ::c_void,
__unused3: *mut ::c_void,
__unused4: *mut ::c_void,
__unused5: *mut ::c_void,
}
pub struct passwd {
pub pw_name: *mut ::c_char,
pub pw_passwd: *mut ::c_char,
pub pw_uid: ::uid_t,
pub pw_gid: ::gid_t,
pub pw_gecos: *mut ::c_char,
pub pw_dir: *mut ::c_char,
pub pw_shell: *mut ::c_char,
}
pub struct spwd {
pub sp_namp: *mut ::c_char,
pub sp_pwdp: *mut ::c_char,
pub sp_lstchg: ::c_long,
pub sp_min: ::c_long,
pub sp_max: ::c_long,
pub sp_warn: ::c_long,
pub sp_inact: ::c_long,
pub sp_expire: ::c_long,
pub sp_flag: ::c_ulong,
}
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: u16,
pub ssi_syscall: i32,
pub ssi_call_addr: u64,
pub ssi_arch: u32,
_pad: [u8; 28],
}
pub struct itimerspec {
pub it_interval: ::timespec,
pub it_value: ::timespec,
}
pub struct fsid_t {
__val: [::c_int; 2],
}
pub struct packet_mreq {
pub mr_ifindex: ::c_int,
pub mr_type: ::c_ushort,
pub mr_alen: ::c_ushort,
pub mr_address: [::c_uchar; 8],
}
pub struct cpu_set_t {
#[cfg(all(target_pointer_width = "32",
not(target_arch = "x86_64")))]
bits: [u32; 32],
#[cfg(not(all(target_pointer_width = "32",
not(target_arch = "x86_64"))))]
bits: [u64; 16],
}
pub struct if_nameindex {
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}
// 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 sembuf {
pub sem_num: ::c_ushort,
pub sem_op: ::c_short,
pub sem_flg: ::c_short,
}
pub struct input_event {
pub time: ::timeval,
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: ::__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 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 dl_phdr_info {
#[cfg(target_pointer_width = "64")]
pub dlpi_addr: Elf64_Addr,
#[cfg(target_pointer_width = "32")]
pub dlpi_addr: Elf32_Addr,
pub dlpi_name: *const ::c_char,
#[cfg(target_pointer_width = "64")]
pub dlpi_phdr: *const Elf64_Phdr,
#[cfg(target_pointer_width = "32")]
pub dlpi_phdr: *const Elf32_Phdr,
#[cfg(target_pointer_width = "64")]
pub dlpi_phnum: Elf64_Half,
#[cfg(target_pointer_width = "32")]
pub dlpi_phnum: Elf32_Half,
// As of uClibc 1.0.36, the following fields are
// gated behind a "#if 0" block which always evaluates
// to false. So I'm just removing these, and if uClibc changes
// the #if block in the future to include the following fields, these
// will probably need including here. tsidea, skrap
#[cfg(not(target_env = "uclibc"))]
pub dlpi_adds: ::c_ulonglong,
#[cfg(not(target_env = "uclibc"))]
pub dlpi_subs: ::c_ulonglong,
#[cfg(not(target_env = "uclibc"))]
pub dlpi_tls_modid: ::size_t,
#[cfg(not(target_env = "uclibc"))]
pub dlpi_tls_data: *mut ::c_void,
}
pub struct Elf32_Ehdr {
pub e_ident: [::c_uchar; 16],
pub e_type: Elf32_Half,
pub e_machine: Elf32_Half,
pub e_version: Elf32_Word,
pub e_entry: Elf32_Addr,
pub e_phoff: Elf32_Off,
pub e_shoff: Elf32_Off,
pub e_flags: Elf32_Word,
pub e_ehsize: Elf32_Half,
pub e_phentsize: Elf32_Half,
pub e_phnum: Elf32_Half,
pub e_shentsize: Elf32_Half,
pub e_shnum: Elf32_Half,
pub e_shstrndx: Elf32_Half,
}
pub struct Elf64_Ehdr {
pub e_ident: [::c_uchar; 16],
pub e_type: Elf64_Half,
pub e_machine: Elf64_Half,
pub e_version: Elf64_Word,
pub e_entry: Elf64_Addr,
pub e_phoff: Elf64_Off,
pub e_shoff: Elf64_Off,
pub e_flags: Elf64_Word,
pub e_ehsize: Elf64_Half,
pub e_phentsize: Elf64_Half,
pub e_phnum: Elf64_Half,
pub e_shentsize: Elf64_Half,
pub e_shnum: Elf64_Half,
pub e_shstrndx: Elf64_Half,
}
pub struct Elf32_Sym {
pub st_name: Elf32_Word,
pub st_value: Elf32_Addr,
pub st_size: Elf32_Word,
pub st_info: ::c_uchar,
pub st_other: ::c_uchar,
pub st_shndx: Elf32_Section,
}
pub struct Elf64_Sym {
pub st_name: Elf64_Word,
pub st_info: ::c_uchar,
pub st_other: ::c_uchar,
pub st_shndx: Elf64_Section,
pub st_value: Elf64_Addr,
pub st_size: Elf64_Xword,
}
pub struct Elf32_Phdr {
pub p_type: Elf32_Word,
pub p_offset: Elf32_Off,
pub p_vaddr: Elf32_Addr,
pub p_paddr: Elf32_Addr,
pub p_filesz: Elf32_Word,
pub p_memsz: Elf32_Word,
pub p_flags: Elf32_Word,
pub p_align: Elf32_Word,
}
pub struct Elf64_Phdr {
pub p_type: Elf64_Word,
pub p_flags: Elf64_Word,
pub p_offset: Elf64_Off,
pub p_vaddr: Elf64_Addr,
pub p_paddr: Elf64_Addr,
pub p_filesz: Elf64_Xword,
pub p_memsz: Elf64_Xword,
pub p_align: Elf64_Xword,
}
pub struct Elf32_Shdr {
pub sh_name: Elf32_Word,
pub sh_type: Elf32_Word,
pub sh_flags: Elf32_Word,
pub sh_addr: Elf32_Addr,
pub sh_offset: Elf32_Off,
pub sh_size: Elf32_Word,
pub sh_link: Elf32_Word,
pub sh_info: Elf32_Word,
pub sh_addralign: Elf32_Word,
pub sh_entsize: Elf32_Word,
}
pub struct Elf64_Shdr {
pub sh_name: Elf64_Word,
pub sh_type: Elf64_Word,
pub sh_flags: Elf64_Xword,
pub sh_addr: Elf64_Addr,
pub sh_offset: Elf64_Off,
pub sh_size: Elf64_Xword,
pub sh_link: Elf64_Word,
pub sh_info: Elf64_Word,
pub sh_addralign: Elf64_Xword,
pub sh_entsize: Elf64_Xword,
}
pub struct ucred {
pub pid: ::pid_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
}
pub struct mntent {
pub mnt_fsname: *mut ::c_char,
pub mnt_dir: *mut ::c_char,
pub mnt_type: *mut ::c_char,
pub mnt_opts: *mut ::c_char,
pub mnt_freq: ::c_int,
pub mnt_passno: ::c_int,
}
pub struct posix_spawn_file_actions_t {
__allocated: ::c_int,
__used: ::c_int,
__actions: *mut ::c_int,
__pad: [::c_int; 16],
}
pub struct posix_spawnattr_t {
__flags: ::c_short,
__pgrp: ::pid_t,
__sd: ::sigset_t,
__ss: ::sigset_t,
#[cfg(target_env = "musl")]
__prio: ::c_int,
#[cfg(not(target_env = "musl"))]
__sp: ::sched_param,
__policy: ::c_int,
__pad: [::c_int; 16],
}
pub struct genlmsghdr {
pub cmd: u8,
pub version: u8,
pub reserved: u16,
}
pub struct in6_pktinfo {
pub ipi6_addr: ::in6_addr,
pub ipi6_ifindex: ::c_uint,
}
pub struct arpd_request {
pub req: ::c_ushort,
pub ip: u32,
pub dev: ::c_ulong,
pub stamp: ::c_ulong,
pub updated: ::c_ulong,
pub ha: [::c_uchar; ::MAX_ADDR_LEN],
}
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 sockaddr_vm {
pub svm_family: ::sa_family_t,
pub svm_reserved1: ::c_ushort,
pub svm_port: ::c_uint,
pub svm_cid: ::c_uint,
pub svm_zero: [u8; 4]
}
pub struct regmatch_t {
pub rm_so: regoff_t,
pub rm_eo: regoff_t,
}
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/can.h
pub struct __c_anonymous_sockaddr_can_tp {
pub rx_id: canid_t,
pub tx_id: canid_t,
}
pub struct __c_anonymous_sockaddr_can_j1939 {
pub name: u64,
pub pgn: u32,
pub addr: u8,
}
pub struct can_filter {
pub can_id: canid_t,
pub can_mask: canid_t,
}
// linux/can/j1939.h
pub struct j1939_filter {
pub name: name_t,
pub name_mask: name_t,
pub pgn: pgn_t,
pub pgn_mask: pgn_t,
pub addr: u8,
pub addr_mask: u8,
}
// linux/filter.h
pub struct sock_filter {
pub code: ::__u16,
pub jt: ::__u8,
pub jf: ::__u8,
pub k: ::__u32,
}
pub struct sock_fprog {
pub len: ::c_ushort,
pub filter: *mut sock_filter,
}
// linux/seccomp.h
pub struct seccomp_data {
pub nr: ::c_int,
pub arch: ::__u32,
pub instruction_pointer: ::__u64,
pub args: [::__u64; 6],
}
pub struct nlmsghdr {
pub nlmsg_len: u32,
pub nlmsg_type: u16,
pub nlmsg_flags: u16,
pub nlmsg_seq: u32,
pub nlmsg_pid: u32,
}
pub struct nlmsgerr {
pub error: ::c_int,
pub msg: nlmsghdr,
}
pub struct nlattr {
pub nla_len: u16,
pub nla_type: u16,
}
pub struct file_clone_range {
pub src_fd: ::__s64,
pub src_offset: ::__u64,
pub src_length: ::__u64,
pub dest_offset: ::__u64,
}
pub struct __c_anonymous_ifru_map {
pub mem_start: ::c_ulong,
pub mem_end: ::c_ulong,
pub base_addr: ::c_ushort,
pub irq: ::c_uchar,
pub dma: ::c_uchar,
pub port: ::c_uchar,
}
pub struct in6_ifreq {
pub ifr6_addr: ::in6_addr,
pub ifr6_prefixlen: u32,
pub ifr6_ifindex: ::c_int,
}
}
s_no_extra_traits! {
pub struct sockaddr_nl {
pub nl_family: ::sa_family_t,
nl_pad: ::c_ushort,
pub nl_pid: u32,
pub nl_groups: u32
}
pub struct dirent {
pub d_ino: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}
pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}
pub struct sockaddr_alg {
pub salg_family: ::sa_family_t,
pub salg_type: [::c_uchar; 14],
pub salg_feat: u32,
pub salg_mask: u32,
pub salg_name: [::c_uchar; 64],
}
pub struct uinput_setup {
pub id: input_id,
pub name: [::c_char; UINPUT_MAX_NAME_SIZE],
pub ff_effects_max: ::__u32,
}
pub struct uinput_user_dev {
pub name: [::c_char; UINPUT_MAX_NAME_SIZE],
pub id: input_id,
pub ff_effects_max: ::__u32,
pub absmax: [::__s32; ABS_CNT],
pub absmin: [::__s32; ABS_CNT],
pub absfuzz: [::__s32; ABS_CNT],
pub absflat: [::__s32; ABS_CNT],
}
/// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this
/// type are unsound and will be removed in the future.
#[deprecated(
note = "this struct has unsafe trait implementations that will be \
removed in the future",
since = "0.2.80"
)]
pub struct af_alg_iv {
pub ivlen: u32,
pub iv: [::c_uchar; 0],
}
// x32 compatibility
// See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
pub struct mq_attr {
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_flags: i64,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_maxmsg: i64,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_msgsize: i64,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_curmsgs: i64,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pad: [i64; 4],
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_flags: ::c_long,
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_maxmsg: ::c_long,
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_msgsize: ::c_long,
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_curmsgs: ::c_long,
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pad: [::c_long; 4],
}
#[cfg(libc_union)]
pub union __c_anonymous_ifr_ifru {
pub ifru_addr: ::sockaddr,
pub ifru_dstaddr: ::sockaddr,
pub ifru_broadaddr: ::sockaddr,
pub ifru_netmask: ::sockaddr,
pub ifru_hwaddr: ::sockaddr,
pub ifru_flags: ::c_short,
pub ifru_ifindex: ::c_int,
pub ifru_metric: ::c_int,
pub ifru_mtu: ::c_int,
pub ifru_map: __c_anonymous_ifru_map,
pub ifru_slave: [::c_char; ::IFNAMSIZ],
pub ifru_newname: [::c_char; ::IFNAMSIZ],
pub ifru_data: *mut ::c_char,
}
pub struct ifreq {
/// interface name, e.g. "en0"
pub ifr_name: [::c_char; ::IFNAMSIZ],
#[cfg(libc_union)]
pub ifr_ifru: __c_anonymous_ifr_ifru,
#[cfg(not(libc_union))]
pub ifr_ifru: ::sockaddr,
}
}
s_no_extra_traits! {
// linux/net_tstamp.h
#[allow(missing_debug_implementations)]
pub struct sock_txtime {
pub clockid: ::clockid_t,
pub flags: ::__u32,
}
}
cfg_if! {
if #[cfg(libc_union)] {
s_no_extra_traits! {
// linux/can.h
#[allow(missing_debug_implementations)]
pub union __c_anonymous_sockaddr_can_can_addr {
pub tp: __c_anonymous_sockaddr_can_tp,
pub j1939: __c_anonymous_sockaddr_can_j1939,
}
#[allow(missing_debug_implementations)]
pub struct sockaddr_can {
pub can_family: ::sa_family_t,
pub can_ifindex: ::c_int,
pub can_addr: __c_anonymous_sockaddr_can_can_addr,
}
}
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for sockaddr_nl {
fn eq(&self, other: &sockaddr_nl) -> bool {
self.nl_family == other.nl_family &&
self.nl_pid == other.nl_pid &&
self.nl_groups == other.nl_groups
}
}
impl Eq for sockaddr_nl {}
impl ::fmt::Debug for sockaddr_nl {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_nl")
.field("nl_family", &self.nl_family)
.field("nl_pid", &self.nl_pid)
.field("nl_groups", &self.nl_groups)
.finish()
}
}
impl ::hash::Hash for sockaddr_nl {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.nl_family.hash(state);
self.nl_pid.hash(state);
self.nl_groups.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_ino == other.d_ino
&& self.d_off == other.d_off
&& self.d_reclen == other.d_reclen
&& self.d_type == other.d_type
&& self
.d_name
.iter()
.zip(other.d_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for dirent {}
impl ::fmt::Debug for dirent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("dirent")
.field("d_ino", &self.d_ino)
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
// FIXME: .field("d_name", &self.d_name)
.finish()
}
}
impl ::hash::Hash for dirent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.d_ino.hash(state);
self.d_off.hash(state);
self.d_reclen.hash(state);
self.d_type.hash(state);
self.d_name.hash(state);
}
}
impl PartialEq for dirent64 {
fn eq(&self, other: &dirent64) -> bool {
self.d_ino == other.d_ino
&& self.d_off == other.d_off
&& self.d_reclen == other.d_reclen
&& self.d_type == other.d_type
&& self
.d_name
.iter()
.zip(other.d_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for dirent64 {}
impl ::fmt::Debug for dirent64 {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("dirent64")
.field("d_ino", &self.d_ino)
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
// FIXME: .field("d_name", &self.d_name)
.finish()
}
}
impl ::hash::Hash for dirent64 {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.d_ino.hash(state);
self.d_off.hash(state);
self.d_reclen.hash(state);
self.d_type.hash(state);
self.d_name.hash(state);
}
}
impl PartialEq for pthread_cond_t {
fn eq(&self, other: &pthread_cond_t) -> bool {
self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b)
}
}
impl Eq for pthread_cond_t {}
impl ::fmt::Debug for pthread_cond_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_cond_t")
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_cond_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.size.hash(state);
}
}
impl PartialEq for pthread_mutex_t {
fn eq(&self, other: &pthread_mutex_t) -> bool {
self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b)
}
}
impl Eq for pthread_mutex_t {}
impl ::fmt::Debug for pthread_mutex_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_mutex_t")
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_mutex_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.size.hash(state);
}
}
impl PartialEq for pthread_rwlock_t {
fn eq(&self, other: &pthread_rwlock_t) -> bool {
self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b)
}
}
impl Eq for pthread_rwlock_t {}
impl ::fmt::Debug for pthread_rwlock_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_rwlock_t")
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_rwlock_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.size.hash(state);
}
}
impl PartialEq for sockaddr_alg {
fn eq(&self, other: &sockaddr_alg) -> bool {
self.salg_family == other.salg_family
&& self
.salg_type
.iter()
.zip(other.salg_type.iter())
.all(|(a, b)| a == b)
&& self.salg_feat == other.salg_feat
&& self.salg_mask == other.salg_mask
&& self
.salg_name
.iter()
.zip(other.salg_name.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for sockaddr_alg {}
impl ::fmt::Debug for sockaddr_alg {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_alg")
.field("salg_family", &self.salg_family)
.field("salg_type", &self.salg_type)
.field("salg_feat", &self.salg_feat)
.field("salg_mask", &self.salg_mask)
.field("salg_name", &&self.salg_name[..])
.finish()
}
}
impl ::hash::Hash for sockaddr_alg {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.salg_family.hash(state);
self.salg_type.hash(state);
self.salg_feat.hash(state);
self.salg_mask.hash(state);
self.salg_name.hash(state);
}
}
impl PartialEq for uinput_setup {
fn eq(&self, other: &uinput_setup) -> bool {
self.id == other.id
&& self.name[..] == other.name[..]
&& self.ff_effects_max == other.ff_effects_max
}
}
impl Eq for uinput_setup {}
impl ::fmt::Debug for uinput_setup {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("uinput_setup")
.field("id", &self.id)
.field("name", &&self.name[..])
.field("ff_effects_max", &self.ff_effects_max)
.finish()
}
}
impl ::hash::Hash for uinput_setup {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.id.hash(state);
self.name.hash(state);
self.ff_effects_max.hash(state);
}