-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
mod.rs
3729 lines (3473 loc) · 125 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
//! Apple (ios/darwin)-specific definitions
//!
//! This covers *-apple-* triples currently
pub type c_char = i8;
pub type wchar_t = i32;
pub type clock_t = c_ulong;
pub type time_t = c_long;
pub type suseconds_t = i32;
pub type dev_t = i32;
pub type ino_t = u64;
pub type mode_t = u16;
pub type nlink_t = u16;
pub type blksize_t = i32;
pub type rlim_t = u64;
pub type pthread_key_t = c_ulong;
pub type sigset_t = u32;
pub type clockid_t = ::c_uint;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub type speed_t = ::c_ulong;
pub type tcflag_t = ::c_ulong;
pub type nl_item = ::c_int;
pub type id_t = ::c_uint;
pub type sem_t = ::c_int;
pub type idtype_t = ::c_uint;
pub type integer_t = ::c_int;
pub type cpu_type_t = integer_t;
pub type cpu_subtype_t = integer_t;
pub type posix_spawnattr_t = *mut ::c_void;
pub type posix_spawn_file_actions_t = *mut ::c_void;
pub type key_t = ::c_int;
pub type shmatt_t = ::c_ushort;
pub type sae_associd_t = u32;
pub type sae_connid_t = u32;
pub type mach_port_t = ::c_uint;
deprecated_mach! {
pub type vm_prot_t = ::c_int;
pub type vm_size_t = ::uintptr_t;
pub type mach_timebase_info_data_t = mach_timebase_info;
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
impl ::Clone for timezone {
fn clone(&self) -> timezone {
*self
}
}
s! {
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
pub struct aiocb {
pub aio_fildes: ::c_int,
pub aio_offset: ::off_t,
pub aio_buf: *mut ::c_void,
pub aio_nbytes: ::size_t,
pub aio_reqprio: ::c_int,
pub aio_sigevent: sigevent,
pub aio_lio_opcode: ::c_int
}
pub struct glob_t {
pub gl_pathc: ::size_t,
__unused1: ::c_int,
pub gl_offs: ::size_t,
__unused2: ::c_int,
pub gl_pathv: *mut *mut ::c_char,
__unused3: *mut ::c_void,
__unused4: *mut ::c_void,
__unused5: *mut ::c_void,
__unused6: *mut ::c_void,
__unused7: *mut ::c_void,
__unused8: *mut ::c_void,
}
pub struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
pub ai_socktype: ::c_int,
pub ai_protocol: ::c_int,
pub ai_addrlen: ::socklen_t,
pub ai_canonname: *mut ::c_char,
pub ai_addr: *mut ::sockaddr,
pub ai_next: *mut addrinfo,
}
#[deprecated(
since = "0.2.55",
note = "Use the `mach` crate instead",
)]
pub struct mach_timebase_info {
pub numer: u32,
pub denom: u32,
}
pub struct stat {
pub st_dev: dev_t,
pub st_mode: mode_t,
pub st_nlink: nlink_t,
pub st_ino: ino_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: dev_t,
pub st_atime: time_t,
pub st_atime_nsec: c_long,
pub st_mtime: time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: time_t,
pub st_ctime_nsec: c_long,
pub st_birthtime: time_t,
pub st_birthtime_nsec: c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: blksize_t,
pub st_flags: u32,
pub st_gen: u32,
pub st_lspare: i32,
pub st_qspare: [i64; 2],
}
pub struct pthread_mutexattr_t {
__sig: ::c_long,
__opaque: [u8; 8],
}
pub struct pthread_condattr_t {
__sig: ::c_long,
__opaque: [u8; __PTHREAD_CONDATTR_SIZE__],
}
pub struct pthread_rwlockattr_t {
__sig: ::c_long,
__opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
}
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
pub si_code: ::c_int,
pub si_pid: ::pid_t,
pub si_uid: ::uid_t,
pub si_status: ::c_int,
pub si_addr: *mut ::c_void,
//Requires it to be union for tests
//pub si_value: ::sigval,
_pad: [usize; 9],
}
pub struct sigaction {
// FIXME: this field is actually a union
pub sa_sigaction: ::sighandler_t,
pub sa_mask: sigset_t,
pub sa_flags: ::c_int,
}
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_size: ::size_t,
pub ss_flags: ::c_int,
}
pub struct fstore_t {
pub fst_flags: ::c_uint,
pub fst_posmode: ::c_int,
pub fst_offset: ::off_t,
pub fst_length: ::off_t,
pub fst_bytesalloc: ::off_t,
}
pub struct radvisory {
pub ra_offset: ::off_t,
pub ra_count: ::c_int,
}
pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
}
pub struct Dl_info {
pub dli_fname: *const ::c_char,
pub dli_fbase: *mut ::c_void,
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
pub struct sockaddr_in {
pub sin_len: u8,
pub sin_family: ::sa_family_t,
pub sin_port: ::in_port_t,
pub sin_addr: ::in_addr,
pub sin_zero: [::c_char; 8],
}
pub struct kevent64_s {
pub ident: u64,
pub filter: i16,
pub flags: u16,
pub fflags: u32,
pub data: i64,
pub udata: u64,
pub ext: [u64; 2],
}
pub struct dqblk {
pub dqb_bhardlimit: u64,
pub dqb_bsoftlimit: u64,
pub dqb_curbytes: u64,
pub dqb_ihardlimit: u32,
pub dqb_isoftlimit: u32,
pub dqb_curinodes: u32,
pub dqb_btime: u32,
pub dqb_itime: u32,
pub dqb_id: u32,
pub dqb_spare: [u32; 4],
}
pub struct if_msghdr {
pub ifm_msglen: ::c_ushort,
pub ifm_version: ::c_uchar,
pub ifm_type: ::c_uchar,
pub ifm_addrs: ::c_int,
pub ifm_flags: ::c_int,
pub ifm_index: ::c_ushort,
pub ifm_data: if_data,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
pub struct flock {
pub l_start: ::off_t,
pub l_len: ::off_t,
pub l_pid: ::pid_t,
pub l_type: ::c_short,
pub l_whence: ::c_short,
}
pub struct sf_hdtr {
pub headers: *mut ::iovec,
pub hdr_cnt: ::c_int,
pub trailers: *mut ::iovec,
pub trl_cnt: ::c_int,
}
pub struct lconv {
pub decimal_point: *mut ::c_char,
pub thousands_sep: *mut ::c_char,
pub grouping: *mut ::c_char,
pub int_curr_symbol: *mut ::c_char,
pub currency_symbol: *mut ::c_char,
pub mon_decimal_point: *mut ::c_char,
pub mon_thousands_sep: *mut ::c_char,
pub mon_grouping: *mut ::c_char,
pub positive_sign: *mut ::c_char,
pub negative_sign: *mut ::c_char,
pub int_frac_digits: ::c_char,
pub frac_digits: ::c_char,
pub p_cs_precedes: ::c_char,
pub p_sep_by_space: ::c_char,
pub n_cs_precedes: ::c_char,
pub n_sep_by_space: ::c_char,
pub p_sign_posn: ::c_char,
pub n_sign_posn: ::c_char,
pub int_p_cs_precedes: ::c_char,
pub int_n_cs_precedes: ::c_char,
pub int_p_sep_by_space: ::c_char,
pub int_n_sep_by_space: ::c_char,
pub int_p_sign_posn: ::c_char,
pub int_n_sign_posn: ::c_char,
}
pub struct proc_taskinfo {
pub pti_virtual_size: u64,
pub pti_resident_size: u64,
pub pti_total_user: u64,
pub pti_total_system: u64,
pub pti_threads_user: u64,
pub pti_threads_system: u64,
pub pti_policy: i32,
pub pti_faults: i32,
pub pti_pageins: i32,
pub pti_cow_faults: i32,
pub pti_messages_sent: i32,
pub pti_messages_received: i32,
pub pti_syscalls_mach: i32,
pub pti_syscalls_unix: i32,
pub pti_csw: i32,
pub pti_threadnum: i32,
pub pti_numrunning: i32,
pub pti_priority: i32,
}
pub struct proc_bsdinfo {
pub pbi_flags: u32,
pub pbi_status: u32,
pub pbi_xstatus: u32,
pub pbi_pid: u32,
pub pbi_ppid: u32,
pub pbi_uid: ::uid_t,
pub pbi_gid: ::gid_t,
pub pbi_ruid: ::uid_t,
pub pbi_rgid: ::gid_t,
pub pbi_svuid: ::uid_t,
pub pbi_svgid: ::gid_t,
pub rfu_1: u32,
pub pbi_comm: [::c_char; MAXCOMLEN],
pub pbi_name: [::c_char; 32], // MAXCOMLEN * 2, but macro isn't happy...
pub pbi_nfiles: u32,
pub pbi_pgid: u32,
pub pbi_pjobc: u32,
pub e_tdev: u32,
pub e_tpgid: u32,
pub pbi_nice: i32,
pub pbi_start_tvsec: u64,
pub pbi_start_tvusec: u64,
}
pub struct proc_taskallinfo {
pub pbsd: proc_bsdinfo,
pub ptinfo: proc_taskinfo,
}
pub struct xsw_usage {
pub xsu_total: u64,
pub xsu_avail: u64,
pub xsu_used: u64,
pub xsu_pagesize: u32,
pub xsu_encrypted: ::boolean_t,
}
pub struct xucred {
pub cr_version: ::c_uint,
pub cr_uid: ::uid_t,
pub cr_ngroups: ::c_short,
pub cr_groups: [::gid_t;16]
}
#[deprecated(
since = "0.2.55",
note = "Use the `mach` crate instead",
)]
pub struct mach_header {
pub magic: u32,
pub cputype: cpu_type_t,
pub cpusubtype: cpu_subtype_t,
pub filetype: u32,
pub ncmds: u32,
pub sizeofcmds: u32,
pub flags: u32,
}
#[deprecated(
since = "0.2.55",
note = "Use the `mach` crate instead",
)]
pub struct mach_header_64 {
pub magic: u32,
pub cputype: cpu_type_t,
pub cpusubtype: cpu_subtype_t,
pub filetype: u32,
pub ncmds: u32,
pub sizeofcmds: u32,
pub flags: u32,
pub reserved: u32,
}
pub struct segment_command {
pub cmd: u32,
pub cmdsize: u32,
pub segname: [::c_char; 16],
pub vmaddr: u32,
pub vmsize: u32,
pub fileoff: u32,
pub filesize: u32,
pub maxprot: vm_prot_t,
pub initprot: vm_prot_t,
pub nsects: u32,
pub flags: u32,
}
pub struct segment_command_64 {
pub cmd: u32,
pub cmdsize: u32,
pub segname: [::c_char; 16],
pub vmaddr: u64,
pub vmsize: u64,
pub fileoff: u64,
pub filesize: u64,
pub maxprot: vm_prot_t,
pub initprot: vm_prot_t,
pub nsects: u32,
pub flags: u32,
}
pub struct load_command {
pub cmd: u32,
pub cmdsize: u32,
}
pub struct sockaddr_dl {
pub sdl_len: ::c_uchar,
pub sdl_family: ::c_uchar,
pub sdl_index: ::c_ushort,
pub sdl_type: ::c_uchar,
pub sdl_nlen: ::c_uchar,
pub sdl_alen: ::c_uchar,
pub sdl_slen: ::c_uchar,
pub sdl_data: [::c_char; 12],
}
pub struct sockaddr_inarp {
pub sin_len: ::c_uchar,
pub sin_family: ::c_uchar,
pub sin_port: ::c_ushort,
pub sin_addr: ::in_addr,
pub sin_srcaddr: ::in_addr,
pub sin_tos: ::c_ushort,
pub sin_other: ::c_ushort,
}
pub struct sockaddr_ctl {
pub sc_len: ::c_uchar,
pub sc_family: ::c_uchar,
pub ss_sysaddr: u16,
pub sc_id: u32,
pub sc_unit: u32,
pub sc_reserved: [u32; 5],
}
pub struct in_pktinfo {
pub ipi_ifindex: ::c_uint,
pub ipi_spec_dst: ::in_addr,
pub ipi_addr: ::in_addr,
}
pub struct in6_pktinfo {
pub ipi6_addr: ::in6_addr,
pub ipi6_ifindex: ::c_uint,
}
// sys/ipc.h:
pub struct ipc_perm {
pub uid: ::uid_t,
pub gid: ::gid_t,
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::mode_t,
pub _seq: ::c_ushort,
pub _key: ::key_t,
}
// sys/sem.h
pub struct sembuf {
pub sem_num: ::c_ushort,
pub sem_op: ::c_short,
pub sem_flg: ::c_short,
}
// sys/shm.h
pub struct arphdr {
pub ar_hrd: u16,
pub ar_pro: u16,
pub ar_hln: u8,
pub ar_pln: u8,
pub ar_op: u16,
}
pub struct in_addr {
pub s_addr: ::in_addr_t,
}
// sys/socket.h
pub struct sa_endpoints_t {
pub sae_srcif: ::c_uint, // optional source interface
pub sae_srcaddr: *const ::sockaddr, // optional source address
pub sae_srcaddrlen: ::socklen_t, // size of source address
pub sae_dstaddr: *const ::sockaddr, // destination address
pub sae_dstaddrlen: ::socklen_t, // size of destination address
}
pub struct timex {
pub modes: ::c_uint,
pub offset: ::c_long,
pub freq: ::c_long,
pub maxerror: ::c_long,
pub esterror: ::c_long,
pub status: ::c_int,
pub constant: ::c_long,
pub precision: ::c_long,
pub tolerance: ::c_long,
pub ppsfreq: ::c_long,
pub jitter: ::c_long,
pub shift: ::c_int,
pub stabil: ::c_long,
pub jitcnt: ::c_long,
pub calcnt: ::c_long,
pub errcnt: ::c_long,
pub stbcnt: ::c_long,
}
pub struct ntptimeval {
pub time: ::timespec,
pub maxerror: ::c_long,
pub esterror: ::c_long,
pub tai: ::c_long,
pub time_state: ::c_int,
}
}
s_no_extra_traits! {
#[cfg_attr(libc_packedN, repr(packed(4)))]
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: i16,
pub flags: u16,
pub fflags: u32,
pub data: ::intptr_t,
pub udata: *mut ::c_void,
}
#[cfg_attr(libc_packedN, repr(packed(4)))]
pub struct semid_ds {
// Note the manpage shows different types than the system header.
pub sem_perm: ipc_perm,
pub sem_base: i32,
pub sem_nsems: ::c_ushort,
pub sem_otime: ::time_t,
pub sem_pad1: i32,
pub sem_ctime: ::time_t,
pub sem_pad2: i32,
pub sem_pad3: [i32; 4],
}
#[cfg_attr(libc_packedN, repr(packed(4)))]
pub struct shmid_ds {
pub shm_perm: ipc_perm,
pub shm_segsz: ::size_t,
pub shm_lpid: ::pid_t,
pub shm_cpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
pub shm_atime: ::time_t, // FIXME: 64-bit wrong align => wrong offset
pub shm_dtime: ::time_t, // FIXME: 64-bit wrong align => wrong offset
pub shm_ctime: ::time_t, // FIXME: 64-bit wrong align => wrong offset
// FIXME: 64-bit wrong align => wrong offset:
pub shm_internal: *mut ::c_void,
}
pub struct proc_threadinfo {
pub pth_user_time: u64,
pub pth_system_time: u64,
pub pth_cpu_usage: i32,
pub pth_policy: i32,
pub pth_run_state: i32,
pub pth_flags: i32,
pub pth_sleep_time: i32,
pub pth_curpri: i32,
pub pth_priority: i32,
pub pth_maxpriority: i32,
pub pth_name: [::c_char; MAXTHREADNAMESIZE],
}
pub struct statfs {
pub f_bsize: u32,
pub f_iosize: i32,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_fsid: ::fsid_t,
pub f_owner: ::uid_t,
pub f_type: u32,
pub f_flags: u32,
pub f_fssubtype: u32,
pub f_fstypename: [::c_char; 16],
pub f_mntonname: [::c_char; 1024],
pub f_mntfromname: [::c_char; 1024],
pub f_reserved: [u32; 8],
}
pub struct dirent {
pub d_ino: u64,
pub d_seekoff: u64,
pub d_reclen: u16,
pub d_namlen: u16,
pub d_type: u8,
pub d_name: [::c_char; 1024],
}
pub struct pthread_rwlock_t {
__sig: ::c_long,
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
}
pub struct pthread_mutex_t {
__sig: ::c_long,
__opaque: [u8; __PTHREAD_MUTEX_SIZE__],
}
pub struct pthread_cond_t {
__sig: ::c_long,
__opaque: [u8; __PTHREAD_COND_SIZE__],
}
pub struct sockaddr_storage {
pub ss_len: u8,
pub ss_family: ::sa_family_t,
__ss_pad1: [u8; 6],
__ss_align: i64,
__ss_pad2: [u8; 112],
}
pub struct utmpx {
pub ut_user: [::c_char; _UTX_USERSIZE],
pub ut_id: [::c_char; _UTX_IDSIZE],
pub ut_line: [::c_char; _UTX_LINESIZE],
pub ut_pid: ::pid_t,
pub ut_type: ::c_short,
pub ut_tv: ::timeval,
pub ut_host: [::c_char; _UTX_HOSTSIZE],
ut_pad: [u32; 16],
}
pub struct sigevent {
pub sigev_notify: ::c_int,
pub sigev_signo: ::c_int,
pub sigev_value: ::sigval,
__unused1: *mut ::c_void, //actually a function pointer
pub sigev_notify_attributes: *mut ::pthread_attr_t
}
}
impl siginfo_t {
pub unsafe fn si_addr(&self) -> *mut ::c_void {
self.si_addr
}
pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
struct siginfo_timer {
_si_signo: ::c_int,
_si_errno: ::c_int,
_si_code: ::c_int,
_si_pid: ::pid_t,
_si_uid: ::uid_t,
_si_status: ::c_int,
_si_addr: *mut ::c_void,
si_value: ::sigval,
}
(*(self as *const siginfo_t as *const siginfo_timer)).si_value
}
pub unsafe fn si_pid(&self) -> ::pid_t {
self.si_pid
}
pub unsafe fn si_uid(&self) -> ::uid_t {
self.si_uid
}
}
cfg_if! {
if #[cfg(libc_union)] {
s_no_extra_traits! {
pub union semun {
pub val: ::c_int,
pub buf: *mut semid_ds,
pub array: *mut ::c_ushort,
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for semun {
fn eq(&self, other: &semun) -> bool {
unsafe { self.val == other.val }
}
}
impl Eq for semun {}
impl ::fmt::Debug for semun {
fn fmt(&self, f: &mut ::fmt::Formatter)
-> ::fmt::Result {
f.debug_struct("semun")
.field("val", unsafe { &self.val })
.finish()
}
}
impl ::hash::Hash for semun {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
unsafe { self.val.hash(state) };
}
}
}
}
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for kevent {
fn eq(&self, other: &kevent) -> bool {
self.ident == other.ident
&& self.filter == other.filter
&& self.flags == other.flags
&& self.fflags == other.fflags
&& self.data == other.data
&& self.udata == other.udata
}
}
impl Eq for kevent {}
impl ::fmt::Debug for kevent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let ident = self.ident;
let filter = self.filter;
let flags = self.flags;
let fflags = self.fflags;
let data = self.data;
let udata = self.udata;
f.debug_struct("kevent")
.field("ident", &ident)
.field("filter", &filter)
.field("flags", &flags)
.field("fflags", &fflags)
.field("data", &data)
.field("udata", &udata)
.finish()
}
}
impl ::hash::Hash for kevent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let ident = self.ident;
let filter = self.filter;
let flags = self.flags;
let fflags = self.fflags;
let data = self.data;
let udata = self.udata;
ident.hash(state);
filter.hash(state);
flags.hash(state);
fflags.hash(state);
data.hash(state);
udata.hash(state);
}
}
impl PartialEq for semid_ds {
fn eq(&self, other: &semid_ds) -> bool {
let sem_perm = self.sem_perm;
let sem_pad3 = self.sem_pad3;
let other_sem_perm = other.sem_perm;
let other_sem_pad3 = other.sem_pad3;
sem_perm == other_sem_perm
&& self.sem_base == other.sem_base
&& self.sem_nsems == other.sem_nsems
&& self.sem_otime == other.sem_otime
&& self.sem_pad1 == other.sem_pad1
&& self.sem_ctime == other.sem_ctime
&& self.sem_pad2 == other.sem_pad2
&& sem_pad3 == other_sem_pad3
}
}
impl Eq for semid_ds {}
impl ::fmt::Debug for semid_ds {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let sem_perm = self.sem_perm;
let sem_base = self.sem_base;
let sem_nsems = self.sem_nsems;
let sem_otime = self.sem_otime;
let sem_pad1 = self.sem_pad1;
let sem_ctime = self.sem_ctime;
let sem_pad2 = self.sem_pad2;
let sem_pad3 = self.sem_pad3;
f.debug_struct("semid_ds")
.field("sem_perm", &sem_perm)
.field("sem_base", &sem_base)
.field("sem_nsems", &sem_nsems)
.field("sem_otime", &sem_otime)
.field("sem_pad1", &sem_pad1)
.field("sem_ctime", &sem_ctime)
.field("sem_pad2", &sem_pad2)
.field("sem_pad3", &sem_pad3)
.finish()
}
}
impl ::hash::Hash for semid_ds {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let sem_perm = self.sem_perm;
let sem_base = self.sem_base;
let sem_nsems = self.sem_nsems;
let sem_otime = self.sem_otime;
let sem_pad1 = self.sem_pad1;
let sem_ctime = self.sem_ctime;
let sem_pad2 = self.sem_pad2;
let sem_pad3 = self.sem_pad3;
sem_perm.hash(state);
sem_base.hash(state);
sem_nsems.hash(state);
sem_otime.hash(state);
sem_pad1.hash(state);
sem_ctime.hash(state);
sem_pad2.hash(state);
sem_pad3.hash(state);
}
}
impl PartialEq for shmid_ds {
fn eq(&self, other: &shmid_ds) -> bool {
let shm_perm = self.shm_perm;
let other_shm_perm = other.shm_perm;
shm_perm == other_shm_perm
&& self.shm_segsz == other.shm_segsz
&& self.shm_lpid == other.shm_lpid
&& self.shm_cpid == other.shm_cpid
&& self.shm_nattch == other.shm_nattch
&& self.shm_atime == other.shm_atime
&& self.shm_dtime == other.shm_dtime
&& self.shm_ctime == other.shm_ctime
&& self.shm_internal == other.shm_internal
}
}
impl Eq for shmid_ds {}
impl ::fmt::Debug for shmid_ds {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let shm_perm = self.shm_perm;
let shm_segsz = self.shm_segsz;
let shm_lpid = self.shm_lpid;
let shm_cpid = self.shm_cpid;
let shm_nattch = self.shm_nattch;
let shm_atime = self.shm_atime;
let shm_dtime = self.shm_dtime;
let shm_ctime = self.shm_ctime;
let shm_internal = self.shm_internal;
f.debug_struct("shmid_ds")
.field("shm_perm", &shm_perm)
.field("shm_segsz", &shm_segsz)
.field("shm_lpid", &shm_lpid)
.field("shm_cpid", &shm_cpid)
.field("shm_nattch", &shm_nattch)
.field("shm_atime", &shm_atime)
.field("shm_dtime", &shm_dtime)
.field("shm_ctime", &shm_ctime)
.field("shm_internal", &shm_internal)
.finish()
}
}
impl ::hash::Hash for shmid_ds {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let shm_perm = self.shm_perm;
let shm_segsz = self.shm_segsz;
let shm_lpid = self.shm_lpid;
let shm_cpid = self.shm_cpid;
let shm_nattch = self.shm_nattch;
let shm_atime = self.shm_atime;
let shm_dtime = self.shm_dtime;
let shm_ctime = self.shm_ctime;
let shm_internal = self.shm_internal;
shm_perm.hash(state);
shm_segsz.hash(state);
shm_lpid.hash(state);
shm_cpid.hash(state);
shm_nattch.hash(state);
shm_atime.hash(state);
shm_dtime.hash(state);
shm_ctime.hash(state);
shm_internal.hash(state);
}
}
impl PartialEq for proc_threadinfo {
fn eq(&self, other: &proc_threadinfo) -> bool {
self.pth_user_time == other.pth_user_time
&& self.pth_system_time == other.pth_system_time
&& self.pth_cpu_usage == other.pth_cpu_usage
&& self.pth_policy == other.pth_policy
&& self.pth_run_state == other.pth_run_state
&& self.pth_flags == other.pth_flags
&& self.pth_sleep_time == other.pth_sleep_time
&& self.pth_curpri == other.pth_curpri
&& self.pth_priority == other.pth_priority
&& self.pth_maxpriority == other.pth_maxpriority
&& self.pth_name
.iter()
.zip(other.pth_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for proc_threadinfo {}
impl ::fmt::Debug for proc_threadinfo {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("proc_threadinfo")
.field("pth_user_time", &self.pth_user_time)
.field("pth_system_time", &self.pth_system_time)
.field("pth_cpu_usage", &self.pth_cpu_usage)
.field("pth_policy", &self.pth_policy)
.field("pth_run_state", &self.pth_run_state)
.field("pth_flags", &self.pth_flags)
.field("pth_sleep_time", &self.pth_sleep_time)
.field("pth_curpri", &self.pth_curpri)
.field("pth_priority", &self.pth_priority)
.field("pth_maxpriority", &self.pth_maxpriority)
// FIXME: .field("pth_name", &self.pth_name)
.finish()
}
}
impl ::hash::Hash for proc_threadinfo {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.pth_user_time.hash(state);
self.pth_system_time.hash(state);
self.pth_cpu_usage.hash(state);
self.pth_policy.hash(state);
self.pth_run_state.hash(state);
self.pth_flags.hash(state);
self.pth_sleep_time.hash(state);
self.pth_curpri.hash(state);
self.pth_priority.hash(state);
self.pth_maxpriority.hash(state);
self.pth_name.hash(state);
}
}
impl PartialEq for statfs {
fn eq(&self, other: &statfs) -> bool {
self.f_bsize == other.f_bsize
&& self.f_iosize == other.f_iosize
&& self.f_blocks == other.f_blocks
&& self.f_bfree == other.f_bfree
&& self.f_bavail == other.f_bavail
&& self.f_files == other.f_files
&& self.f_ffree == other.f_ffree
&& self.f_fsid == other.f_fsid
&& self.f_owner == other.f_owner
&& self.f_flags == other.f_flags
&& self.f_fssubtype == other.f_fssubtype
&& self.f_fstypename == other.f_fstypename
&& self.f_type == other.f_type
&& self
.f_mntonname
.iter()
.zip(other.f_mntonname.iter())
.all(|(a,b)| a == b)
&& self
.f_mntfromname
.iter()
.zip(other.f_mntfromname.iter())
.all(|(a,b)| a == b)
&& self.f_reserved == other.f_reserved
}
}
impl Eq for statfs {}
impl ::fmt::Debug for statfs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("statfs")
.field("f_bsize", &self.f_bsize)
.field("f_iosize", &self.f_iosize)
.field("f_blocks", &self.f_blocks)
.field("f_bfree", &self.f_bfree)
.field("f_bavail", &self.f_bavail)
.field("f_files", &self.f_files)
.field("f_ffree", &self.f_ffree)
.field("f_fsid", &self.f_fsid)
.field("f_owner", &self.f_owner)
.field("f_flags", &self.f_flags)
.field("f_fssubtype", &self.f_fssubtype)
.field("f_fstypename", &self.f_fstypename)
.field("f_type", &self.f_type)
// FIXME: .field("f_mntonname", &self.f_mntonname)