-
Notifications
You must be signed in to change notification settings - Fork 994
/
mod.rs
2652 lines (2457 loc) · 88.8 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
pub type fflags_t = u32;
pub type clock_t = i32;
pub type vm_prot_t = u_char;
pub type kvaddr_t = u64;
pub type segsz_t = isize;
pub type __fixpt_t = u32;
pub type fixpt_t = __fixpt_t;
pub type __lwpid_t = i32;
pub type lwpid_t = __lwpid_t;
pub type blksize_t = i32;
pub type clockid_t = ::c_int;
pub type sem_t = _sem;
pub type timer_t = *mut __c_anonymous__timer;
pub type fsblkcnt_t = u64;
pub type fsfilcnt_t = u64;
pub type idtype_t = ::c_uint;
pub type msglen_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type cpulevel_t = ::c_int;
pub type cpuwhich_t = ::c_int;
pub type mqd_t = *mut ::c_void;
pub type posix_spawnattr_t = *mut ::c_void;
pub type posix_spawn_file_actions_t = *mut ::c_void;
pub type pthread_spinlock_t = *mut __c_anonymous_pthread_spinlock;
pub type pthread_barrierattr_t = *mut __c_anonymous_pthread_barrierattr;
pub type pthread_barrier_t = *mut __c_anonymous_pthread_barrier;
pub type uuid_t = ::uuid;
pub type u_int = ::c_uint;
pub type u_char = ::c_uchar;
pub type u_long = ::c_ulong;
pub type u_short = ::c_ushort;
// It's an alias over "struct __kvm_t". However, its fields aren't supposed to be used directly,
// making the type definition system dependent. Better not bind it exactly.
pub type kvm_t = ::c_void;
s! {
pub struct aiocb {
pub aio_fildes: ::c_int,
pub aio_offset: ::off_t,
pub aio_buf: *mut ::c_void,
pub aio_nbytes: ::size_t,
__unused1: [::c_int; 2],
__unused2: *mut ::c_void,
pub aio_lio_opcode: ::c_int,
pub aio_reqprio: ::c_int,
// unused 3 through 5 are the __aiocb_private structure
__unused3: ::c_long,
__unused4: ::c_long,
__unused5: *mut ::c_void,
pub aio_sigevent: sigevent
}
pub struct jail {
pub version: u32,
pub path: *mut ::c_char,
pub hostname: *mut ::c_char,
pub jailname: *mut ::c_char,
pub ip4s: ::c_uint,
pub ip6s: ::c_uint,
pub ip4: *mut ::in_addr,
pub ip6: *mut ::in6_addr,
}
pub struct statvfs {
pub f_bavail: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_blocks: ::fsblkcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_bsize: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_fsid: ::c_ulong,
pub f_namemax: ::c_ulong,
}
// internal structure has changed over time
pub struct _sem {
data: [u32; 4],
}
pub struct sembuf {
pub sem_num: ::c_ushort,
pub sem_op: ::c_short,
pub sem_flg: ::c_short,
}
pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
__unused1: *mut ::c_void,
__unused2: *mut ::c_void,
pub msg_cbytes: ::msglen_t,
pub msg_qnum: ::msgqnum_t,
pub msg_qbytes: ::msglen_t,
pub msg_lspid: ::pid_t,
pub msg_lrpid: ::pid_t,
pub msg_stime: ::time_t,
pub msg_rtime: ::time_t,
pub msg_ctime: ::time_t,
}
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_size: ::size_t,
pub ss_flags: ::c_int,
}
pub struct mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::ssize_t,
}
pub struct sockcred {
pub sc_uid: ::uid_t,
pub sc_euid: ::uid_t,
pub sc_gid: ::gid_t,
pub sc_egid: ::gid_t,
pub sc_ngroups: ::c_int,
pub sc_groups: [::gid_t; 1],
}
pub struct accept_filter_arg {
pub af_name: [::c_char; 16],
af_arg: [[::c_char; 10]; 24],
}
pub struct ptrace_vm_entry {
pub pve_entry: ::c_int,
pub pve_timestamp: ::c_int,
pub pve_start: ::c_ulong,
pub pve_end: ::c_ulong,
pub pve_offset: ::c_ulong,
pub pve_prot: ::c_uint,
pub pve_pathlen: ::c_uint,
pub pve_fileid: ::c_long,
pub pve_fsid: u32,
pub pve_path: *mut ::c_char,
}
pub struct ptrace_lwpinfo {
pub pl_lwpid: lwpid_t,
pub pl_event: ::c_int,
pub pl_flags: ::c_int,
pub pl_sigmask: ::sigset_t,
pub pl_siglist: ::sigset_t,
pub pl_siginfo: ::siginfo_t,
pub pl_tdname: [::c_char; ::MAXCOMLEN as usize + 1],
pub pl_child_pid: ::pid_t,
pub pl_syscall_code: ::c_uint,
pub pl_syscall_narg: ::c_uint,
}
pub struct ptrace_sc_ret {
pub sr_retval: [::register_t; 2],
pub sr_error: ::c_int,
}
pub struct cpuset_t {
#[cfg(target_pointer_width = "64")]
__bits: [::c_long; 4],
#[cfg(target_pointer_width = "32")]
__bits: [::c_long; 8],
}
pub struct cap_rights_t {
cr_rights: [u64; 2],
}
pub struct umutex {
m_owner: ::lwpid_t,
m_flags: u32,
m_ceilings: [u32; 2],
m_rb_link: ::uintptr_t,
#[cfg(target_pointer_width = "32")]
m_pad: u32,
m_spare: [u32; 2],
}
pub struct ucond {
c_has_waiters: u32,
c_flags: u32,
c_clockid: u32,
c_spare: [u32; 1],
}
pub struct uuid {
pub time_low: u32,
pub time_mid: u16,
pub time_hi_and_version: u16,
pub clock_seq_hi_and_reserved: u8,
pub clock_seq_low: u8,
pub node: [u8; _UUID_NODE_LEN],
}
pub struct __c_anonymous_pthread_spinlock {
s_clock: umutex,
}
pub struct __c_anonymous_pthread_barrierattr {
pshared: ::c_int,
}
pub struct __c_anonymous_pthread_barrier {
b_lock: umutex,
b_cv: ucond,
b_cycle: i64,
b_count: ::c_int,
b_waiters: ::c_int,
b_refcount: ::c_int,
b_destroying: ::c_int,
}
pub struct kinfo_vmentry {
pub kve_structsize: ::c_int,
pub kve_type: ::c_int,
pub kve_start: u64,
pub kve_end: u64,
pub kve_offset: u64,
pub kve_vn_fileid: u64,
#[cfg(not(freebsd11))]
pub kve_vn_fsid_freebsd11: u32,
#[cfg(freebsd11)]
pub kve_vn_fsid: u32,
pub kve_flags: ::c_int,
pub kve_resident: ::c_int,
pub kve_private_resident: ::c_int,
pub kve_protection: ::c_int,
pub kve_ref_count: ::c_int,
pub kve_shadow_count: ::c_int,
pub kve_vn_type: ::c_int,
pub kve_vn_size: u64,
#[cfg(not(freebsd11))]
pub kve_vn_rdev_freebsd11: u32,
#[cfg(freebsd11)]
pub kve_vn_rdev: u32,
pub kve_vn_mode: u16,
pub kve_status: u16,
#[cfg(not(freebsd11))]
pub kve_vn_fsid: u64,
#[cfg(not(freebsd11))]
pub kve_vn_rdev: u64,
#[cfg(not(freebsd11))]
_kve_is_spare: [::c_int; 8],
#[cfg(freebsd11)]
_kve_is_spare: [::c_int; 12],
pub kve_path: [[::c_char; 32]; 32],
}
pub struct filestat {
fs_type: ::c_int,
fs_flags: ::c_int,
fs_fflags: ::c_int,
fs_uflags: ::c_int,
fs_fd: ::c_int,
fs_ref_count: ::c_int,
fs_offset: ::off_t,
fs_typedep: *mut ::c_void,
fs_path: *mut ::c_char,
next: *mut filestat,
fs_cap_rights: cap_rights_t,
}
pub struct filestat_list {
stqh_first: *mut filestat,
stqh_last: *mut *mut filestat,
}
pub struct procstat {
tpe: ::c_int,
kd: ::uintptr_t,
vmentries: *mut ::c_void,
files: *mut ::c_void,
argv: *mut ::c_void,
envv: *mut ::c_void,
core: ::uintptr_t,
}
pub struct itimerspec {
pub it_interval: ::timespec,
pub it_value: ::timespec,
}
pub struct __c_anonymous__timer {
_priv: [::c_int; 3],
}
/// Used to hold a copy of the command line, if it had a sane length.
pub struct pargs {
/// Reference count.
pub ar_ref: u_int,
/// Length.
pub ar_length: u_int,
/// Arguments.
pub ar_args: [::c_uchar; 1],
}
pub struct priority {
/// Scheduling class.
pub pri_class: u_char,
/// Normal priority level.
pub pri_level: u_char,
/// Priority before propagation.
pub pri_native: u_char,
/// User priority based on p_cpu and p_nice.
pub pri_user: u_char,
}
pub struct kinfo_proc {
pub ki_structsize: ::c_int,
pub ki_layout: ::c_int,
pub ki_args: *mut pargs,
// This is normally "struct proc".
pub ki_paddr: *mut ::c_void,
// This is normally "struct user".
pub ki_addr: *mut ::c_void,
// This is normally "struct vnode".
pub ki_tracep: *mut ::c_void,
// This is normally "struct vnode".
pub ki_textvp: *mut ::c_void,
// This is normally "struct filedesc".
pub ki_fd: *mut ::c_void,
// This is normally "struct vmspace".
pub ki_vmspace: *mut ::c_void,
#[cfg(freebsd13)]
pub ki_wchan: *const ::c_void,
#[cfg(not(freebsd13))]
pub ki_wchan: *mut ::c_void,
pub ki_pid: ::pid_t,
pub ki_ppid: ::pid_t,
pub ki_pgid: ::pid_t,
pub ki_tpgid: ::pid_t,
pub ki_sid: ::pid_t,
pub ki_tsid: ::pid_t,
pub ki_jobc: ::c_short,
pub ki_spare_short1: ::c_short,
#[cfg(any(freebsd12, freebsd13))]
pub ki_tdev_freebsd11: u32,
#[cfg(freebsd11)]
pub ki_tdev: ::dev_t,
pub ki_siglist: ::sigset_t,
pub ki_sigmask: ::sigset_t,
pub ki_sigignore: ::sigset_t,
pub ki_sigcatch: ::sigset_t,
pub ki_uid: ::uid_t,
pub ki_ruid: ::uid_t,
pub ki_svuid: ::uid_t,
pub ki_rgid: ::gid_t,
pub ki_svgid: ::gid_t,
pub ki_ngroups: ::c_short,
pub ki_spare_short2: ::c_short,
pub ki_groups: [::gid_t; ::KI_NGROUPS],
pub ki_size: ::vm_size_t,
pub ki_rssize: segsz_t,
pub ki_swrss: segsz_t,
pub ki_tsize: segsz_t,
pub ki_dsize: segsz_t,
pub ki_ssize: segsz_t,
pub ki_xstat: ::u_short,
pub ki_acflag: ::u_short,
pub ki_pctcpu: fixpt_t,
pub ki_estcpu: u_int,
pub ki_slptime: u_int,
pub ki_swtime: u_int,
pub ki_cow: u_int,
pub ki_runtime: u64,
pub ki_start: ::timeval,
pub ki_childtime: ::timeval,
pub ki_flag: ::c_long,
pub ki_kiflag: ::c_long,
pub ki_traceflag: ::c_int,
pub ki_stat: ::c_char,
pub ki_nice: i8, // signed char
pub ki_lock: ::c_char,
pub ki_rqindex: ::c_char,
pub ki_oncpu_old: ::c_uchar,
pub ki_lastcpu_old: ::c_uchar,
pub ki_tdname: [::c_char; TDNAMLEN + 1],
pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
pub ki_login: [::c_char; ::LOGNAMELEN + 1],
pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
pub ki_comm: [::c_char; ::COMMLEN + 1],
pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
#[cfg(freebsd13)]
pub ki_tdev: u64,
#[cfg(freebsd12)]
pub ki_tdev: ::dev_t,
pub ki_oncpu: ::c_int,
pub ki_lastcpu: ::c_int,
pub ki_tracer: ::c_int,
pub ki_flag2: ::c_int,
pub ki_fibnum: ::c_int,
pub ki_cr_flags: u_int,
pub ki_jid: ::c_int,
pub ki_numthreads: ::c_int,
pub ki_tid: lwpid_t,
pub ki_pri: priority,
pub ki_rusage: ::rusage,
pub ki_rusage_ch: ::rusage,
// This is normally "struct pcb".
pub ki_pcb: *mut ::c_void,
pub ki_kstack: *mut ::c_void,
pub ki_udata: *mut ::c_void,
// This is normally "struct thread".
pub ki_tdaddr: *mut ::c_void,
// This is normally "struct pwddesc".
#[cfg(freebsd13)]
pub ki_pd: *mut ::c_void,
pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
pub ki_sflag: ::c_long,
pub ki_tdflags: ::c_long,
}
pub struct kvm_swap {
pub ksw_devname: [::c_char; 32],
pub ksw_used: u_int,
pub ksw_total: u_int,
pub ksw_flags: ::c_int,
pub ksw_reserved1: u_int,
pub ksw_reserved2: u_int,
}
pub struct nlist {
/// symbol name (in memory)
pub n_name: *const ::c_char,
/// type defines
pub n_type: ::c_uchar,
/// "type" and binding information
pub n_other: ::c_char,
/// used by stab entries
pub n_desc: ::c_short,
pub n_value: ::c_ulong,
}
pub struct kvm_nlist {
pub n_name: *const ::c_char,
pub n_type: ::c_uchar,
pub n_value: ::kvaddr_t,
}
pub struct __c_anonymous_sem {
_priv: ::uintptr_t,
}
pub struct semid_ds {
pub sem_perm: ::ipc_perm,
pub __sem_base: *mut __c_anonymous_sem,
pub sem_nsems: ::c_ushort,
pub sem_otime: ::time_t,
pub sem_ctime: ::time_t,
}
pub struct vmtotal {
pub t_vm: u64,
pub t_avm: u64,
pub t_rm: u64,
pub t_arm: u64,
pub t_vmshr: u64,
pub t_avmshr: u64,
pub t_rmshr: u64,
pub t_armshr: u64,
pub t_free: u64,
pub t_rq: i16,
pub t_dw: i16,
pub t_pw: i16,
pub t_sl: i16,
pub t_sw: i16,
pub t_pad: [u16; 3],
}
}
s_no_extra_traits! {
pub struct utmpx {
pub ut_type: ::c_short,
pub ut_tv: ::timeval,
pub ut_id: [::c_char; 8],
pub ut_pid: ::pid_t,
pub ut_user: [::c_char; 32],
pub ut_line: [::c_char; 16],
pub ut_host: [::c_char; 128],
pub __ut_spare: [::c_char; 64],
}
#[cfg(libc_union)]
pub union __c_anonymous_cr_pid {
__cr_unused: *mut ::c_void,
pub cr_pid: ::pid_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],
#[cfg(libc_union)]
pub cr_pid__c_anonymous_union: __c_anonymous_cr_pid,
#[cfg(not(libc_union))]
__cr_unused1: *mut ::c_void,
}
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; 46],
}
pub struct mq_attr {
pub mq_flags: ::c_long,
pub mq_maxmsg: ::c_long,
pub mq_msgsize: ::c_long,
pub mq_curmsgs: ::c_long,
__reserved: [::c_long; 4]
}
pub struct sigevent {
pub sigev_notify: ::c_int,
pub sigev_signo: ::c_int,
pub sigev_value: ::sigval,
//The rest of the structure is actually a union. We expose only
//sigev_notify_thread_id because it's the most useful union member.
pub sigev_notify_thread_id: ::lwpid_t,
#[cfg(target_pointer_width = "64")]
__unused1: ::c_int,
__unused2: [::c_long; 7]
}
#[cfg(libc_union)]
pub union __c_anonymous_elf32_auxv_union {
pub a_val: ::c_int,
}
pub struct Elf32_Auxinfo {
pub a_type: ::c_int,
#[cfg(libc_union)]
pub a_un: __c_anonymous_elf32_auxv_union,
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for utmpx {
fn eq(&self, other: &utmpx) -> bool {
self.ut_type == other.ut_type
&& self.ut_tv == other.ut_tv
&& self.ut_id == other.ut_id
&& self.ut_pid == other.ut_pid
&& self.ut_user == other.ut_user
&& self.ut_line == other.ut_line
&& self
.ut_host
.iter()
.zip(other.ut_host.iter())
.all(|(a,b)| a == b)
&& self
.__ut_spare
.iter()
.zip(other.__ut_spare.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for utmpx {}
impl ::fmt::Debug for utmpx {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("utmpx")
.field("ut_type", &self.ut_type)
.field("ut_tv", &self.ut_tv)
.field("ut_id", &self.ut_id)
.field("ut_pid", &self.ut_pid)
.field("ut_user", &self.ut_user)
.field("ut_line", &self.ut_line)
// FIXME: .field("ut_host", &self.ut_host)
// FIXME: .field("__ut_spare", &self.__ut_spare)
.finish()
}
}
impl ::hash::Hash for utmpx {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.ut_type.hash(state);
self.ut_tv.hash(state);
self.ut_id.hash(state);
self.ut_pid.hash(state);
self.ut_user.hash(state);
self.ut_line.hash(state);
self.ut_host.hash(state);
self.__ut_spare.hash(state);
}
}
#[cfg(libc_union)]
impl PartialEq for __c_anonymous_cr_pid {
fn eq(&self, other: &__c_anonymous_cr_pid) -> bool {
unsafe { self.cr_pid == other.cr_pid}
}
}
#[cfg(libc_union)]
impl Eq for __c_anonymous_cr_pid {}
#[cfg(libc_union)]
impl ::fmt::Debug for __c_anonymous_cr_pid {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("cr_pid")
.field("cr_pid", unsafe { &self.cr_pid })
.finish()
}
}
#[cfg(libc_union)]
impl ::hash::Hash for __c_anonymous_cr_pid {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
unsafe { self.cr_pid.hash(state) };
}
}
impl PartialEq for xucred {
fn eq(&self, other: &xucred) -> bool {
#[cfg(libc_union)]
let equal_cr_pid = self.cr_pid__c_anonymous_union
== other.cr_pid__c_anonymous_union;
#[cfg(not(libc_union))]
let equal_cr_pid = self.__cr_unused1 == other.__cr_unused1;
self.cr_version == other.cr_version
&& self.cr_uid == other.cr_uid
&& self.cr_ngroups == other.cr_ngroups
&& self.cr_groups == other.cr_groups
&& equal_cr_pid
}
}
impl Eq for xucred {}
impl ::fmt::Debug for xucred {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let mut struct_formatter = f.debug_struct("xucred");
struct_formatter.field("cr_version", &self.cr_version);
struct_formatter.field("cr_uid", &self.cr_uid);
struct_formatter.field("cr_ngroups", &self.cr_ngroups);
struct_formatter.field("cr_groups", &self.cr_groups);
#[cfg(libc_union)]
struct_formatter.field(
"cr_pid__c_anonymous_union",
&self.cr_pid__c_anonymous_union
);
struct_formatter.finish()
}
}
impl ::hash::Hash for xucred {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.cr_version.hash(state);
self.cr_uid.hash(state);
self.cr_ngroups.hash(state);
self.cr_groups.hash(state);
#[cfg(libc_union)]
self.cr_pid__c_anonymous_union.hash(state);
#[cfg(not(libc_union))]
self.__cr_unused1.hash(state);
}
}
impl PartialEq for sockaddr_dl {
fn eq(&self, other: &sockaddr_dl) -> bool {
self.sdl_len == other.sdl_len
&& self.sdl_family == other.sdl_family
&& self.sdl_index == other.sdl_index
&& self.sdl_type == other.sdl_type
&& self.sdl_nlen == other.sdl_nlen
&& self.sdl_alen == other.sdl_alen
&& self.sdl_slen == other.sdl_slen
&& self
.sdl_data
.iter()
.zip(other.sdl_data.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for sockaddr_dl {}
impl ::fmt::Debug for sockaddr_dl {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_dl")
.field("sdl_len", &self.sdl_len)
.field("sdl_family", &self.sdl_family)
.field("sdl_index", &self.sdl_index)
.field("sdl_type", &self.sdl_type)
.field("sdl_nlen", &self.sdl_nlen)
.field("sdl_alen", &self.sdl_alen)
.field("sdl_slen", &self.sdl_slen)
// FIXME: .field("sdl_data", &self.sdl_data)
.finish()
}
}
impl ::hash::Hash for sockaddr_dl {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.sdl_len.hash(state);
self.sdl_family.hash(state);
self.sdl_index.hash(state);
self.sdl_type.hash(state);
self.sdl_nlen.hash(state);
self.sdl_alen.hash(state);
self.sdl_slen.hash(state);
self.sdl_data.hash(state);
}
}
impl PartialEq for mq_attr {
fn eq(&self, other: &mq_attr) -> bool {
self.mq_flags == other.mq_flags &&
self.mq_maxmsg == other.mq_maxmsg &&
self.mq_msgsize == other.mq_msgsize &&
self.mq_curmsgs == other.mq_curmsgs
}
}
impl Eq for mq_attr {}
impl ::fmt::Debug for mq_attr {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("mq_attr")
.field("mq_flags", &self.mq_flags)
.field("mq_maxmsg", &self.mq_maxmsg)
.field("mq_msgsize", &self.mq_msgsize)
.field("mq_curmsgs", &self.mq_curmsgs)
.finish()
}
}
impl ::hash::Hash for mq_attr {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.mq_flags.hash(state);
self.mq_maxmsg.hash(state);
self.mq_msgsize.hash(state);
self.mq_curmsgs.hash(state);
}
}
impl PartialEq for sigevent {
fn eq(&self, other: &sigevent) -> bool {
self.sigev_notify == other.sigev_notify
&& self.sigev_signo == other.sigev_signo
&& self.sigev_value == other.sigev_value
&& self.sigev_notify_thread_id
== other.sigev_notify_thread_id
}
}
impl Eq for sigevent {}
impl ::fmt::Debug for sigevent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sigevent")
.field("sigev_notify", &self.sigev_notify)
.field("sigev_signo", &self.sigev_signo)
.field("sigev_value", &self.sigev_value)
.field("sigev_notify_thread_id",
&self.sigev_notify_thread_id)
.finish()
}
}
impl ::hash::Hash for sigevent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.sigev_notify.hash(state);
self.sigev_signo.hash(state);
self.sigev_value.hash(state);
self.sigev_notify_thread_id.hash(state);
}
}
#[cfg(libc_union)]
impl PartialEq for __c_anonymous_elf32_auxv_union {
fn eq(&self, other: &__c_anonymous_elf32_auxv_union) -> bool {
unsafe { self.a_val == other.a_val}
}
}
#[cfg(libc_union)]
impl Eq for __c_anonymous_elf32_auxv_union {}
#[cfg(libc_union)]
impl ::fmt::Debug for __c_anonymous_elf32_auxv_union {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("a_val")
.field("a_val", unsafe { &self.a_val })
.finish()
}
}
#[cfg(not(libc_union))]
impl PartialEq for Elf32_Auxinfo {
fn eq(&self, other: &Elf32_Auxinfo) -> bool {
self.a_type == other.a_type
}
}
#[cfg(libc_union)]
impl PartialEq for Elf32_Auxinfo {
fn eq(&self, other: &Elf32_Auxinfo) -> bool {
self.a_type == other.a_type
&& self.a_un == other.a_un
}
}
impl Eq for Elf32_Auxinfo {}
#[cfg(not(libc_union))]
impl ::fmt::Debug for Elf32_Auxinfo {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("Elf32_Auxinfo")
.field("a_type", &self.a_type)
.finish()
}
}
#[cfg(libc_union)]
impl ::fmt::Debug for Elf32_Auxinfo {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("Elf32_Auxinfo")
.field("a_type", &self.a_type)
.field("a_un", &self.a_un)
.finish()
}
}
}
}
pub const SIGEV_THREAD_ID: ::c_int = 4;
pub const EXTATTR_NAMESPACE_EMPTY: ::c_int = 0;
pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
pub const PTHREAD_STACK_MIN: ::size_t = MINSIGSTKSZ;
pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
pub const PTHREAD_MUTEX_STALLED: ::c_int = 0;
pub const PTHREAD_MUTEX_ROBUST: ::c_int = 1;
pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + 32768;
pub const SF_NODISKIO: ::c_int = 0x00000001;
pub const SF_MNOWAIT: ::c_int = 0x00000002;
pub const SF_SYNC: ::c_int = 0x00000004;
pub const SF_USER_READAHEAD: ::c_int = 0x00000008;
pub const SF_NOCACHE: ::c_int = 0x00000010;
pub const O_CLOEXEC: ::c_int = 0x00100000;
pub const O_DIRECTORY: ::c_int = 0x00020000;
pub const O_EXEC: ::c_int = 0x00040000;
pub const O_TTY_INIT: ::c_int = 0x00080000;
pub const F_GETLK: ::c_int = 11;
pub const F_SETLK: ::c_int = 12;
pub const F_SETLKW: ::c_int = 13;
pub const ENOTCAPABLE: ::c_int = 93;
pub const ECAPMODE: ::c_int = 94;
pub const ENOTRECOVERABLE: ::c_int = 95;
pub const EOWNERDEAD: ::c_int = 96;
pub const EINTEGRITY: ::c_int = 97;
pub const RLIMIT_NPTS: ::c_int = 11;
pub const RLIMIT_SWAP: ::c_int = 12;
pub const RLIMIT_KQUEUES: ::c_int = 13;
pub const RLIMIT_UMTXP: ::c_int = 14;
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::rlim_t = 15;
pub const NI_NOFQDN: ::c_int = 0x00000001;
pub const NI_NUMERICHOST: ::c_int = 0x00000002;
pub const NI_NAMEREQD: ::c_int = 0x00000004;
pub const NI_NUMERICSERV: ::c_int = 0x00000008;
pub const NI_DGRAM: ::c_int = 0x00000010;
pub const NI_NUMERICSCOPE: ::c_int = 0x00000020;
pub const XU_NGROUPS: ::c_int = 16;
pub const Q_GETQUOTA: ::c_int = 0x700;
pub const Q_SETQUOTA: ::c_int = 0x800;
pub const MAP_GUARD: ::c_int = 0x00002000;
pub const MAP_EXCL: ::c_int = 0x00004000;
pub const MAP_PREFAULT_READ: ::c_int = 0x00040000;
pub const MAP_ALIGNED_SUPER: ::c_int = 1 << 24;
pub const POSIX_FADV_NORMAL: ::c_int = 0;
pub const POSIX_FADV_RANDOM: ::c_int = 1;
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POLLINIGNEOF: ::c_short = 0x2000;
pub const EVFILT_READ: i16 = -1;
pub const EVFILT_WRITE: i16 = -2;
pub const EVFILT_AIO: i16 = -3;
pub const EVFILT_VNODE: i16 = -4;
pub const EVFILT_PROC: i16 = -5;
pub const EVFILT_SIGNAL: i16 = -6;
pub const EVFILT_TIMER: i16 = -7;
pub const EVFILT_PROCDESC: i16 = -8;
pub const EVFILT_FS: i16 = -9;
pub const EVFILT_LIO: i16 = -10;
pub const EVFILT_USER: i16 = -11;
pub const EVFILT_SENDFILE: i16 = -12;
pub const EVFILT_EMPTY: i16 = -13;
pub const EV_ADD: u16 = 0x1;
pub const EV_DELETE: u16 = 0x2;
pub const EV_ENABLE: u16 = 0x4;
pub const EV_DISABLE: u16 = 0x8;
pub const EV_ONESHOT: u16 = 0x10;
pub const EV_CLEAR: u16 = 0x20;
pub const EV_RECEIPT: u16 = 0x40;
pub const EV_DISPATCH: u16 = 0x80;
pub const EV_DROP: u16 = 0x1000;
pub const EV_FLAG1: u16 = 0x2000;
pub const EV_ERROR: u16 = 0x4000;
pub const EV_EOF: u16 = 0x8000;
pub const EV_SYSFLAGS: u16 = 0xf000;
pub const NOTE_TRIGGER: u32 = 0x01000000;
pub const NOTE_FFNOP: u32 = 0x00000000;
pub const NOTE_FFAND: u32 = 0x40000000;
pub const NOTE_FFOR: u32 = 0x80000000;
pub const NOTE_FFCOPY: u32 = 0xc0000000;
pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
pub const NOTE_LOWAT: u32 = 0x00000001;
pub const NOTE_DELETE: u32 = 0x00000001;
pub const NOTE_WRITE: u32 = 0x00000002;
pub const NOTE_EXTEND: u32 = 0x00000004;
pub const NOTE_ATTRIB: u32 = 0x00000008;
pub const NOTE_LINK: u32 = 0x00000010;
pub const NOTE_RENAME: u32 = 0x00000020;
pub const NOTE_REVOKE: u32 = 0x00000040;
pub const NOTE_EXIT: u32 = 0x80000000;
pub const NOTE_FORK: u32 = 0x40000000;
pub const NOTE_EXEC: u32 = 0x20000000;
pub const NOTE_PDATAMASK: u32 = 0x000fffff;
pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
pub const NOTE_TRACK: u32 = 0x00000001;
pub const NOTE_TRACKERR: u32 = 0x00000002;
pub const NOTE_CHILD: u32 = 0x00000004;
pub const NOTE_SECONDS: u32 = 0x00000001;
pub const NOTE_MSECONDS: u32 = 0x00000002;
pub const NOTE_USECONDS: u32 = 0x00000004;
pub const NOTE_NSECONDS: u32 = 0x00000008;
pub const MADV_PROTECT: ::c_int = 10;
#[doc(hidden)]
#[deprecated(
since = "0.2.72",
note = "CTL_UNSPEC is deprecated. Use CTL_SYSCTL instead"
)]
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_SYSCTL: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
pub const CTL_VM: ::c_int = 2;
pub const CTL_VFS: ::c_int = 3;
pub const CTL_NET: ::c_int = 4;
pub const CTL_DEBUG: ::c_int = 5;
pub const CTL_HW: ::c_int = 6;
pub const CTL_MACHDEP: ::c_int = 7;
pub const CTL_USER: ::c_int = 8;
pub const CTL_P1003_1B: ::c_int = 9;
pub const CTL_SYSCTL_DEBUG: ::c_int = 0;
pub const CTL_SYSCTL_NAME: ::c_int = 1;
pub const CTL_SYSCTL_NEXT: ::c_int = 2;
pub const CTL_SYSCTL_NAME2OID: ::c_int = 3;
pub const CTL_SYSCTL_OIDFMT: ::c_int = 4;
pub const CTL_SYSCTL_OIDDESCR: ::c_int = 5;
pub const CTL_SYSCTL_OIDLABEL: ::c_int = 6;
pub const KERN_OSTYPE: ::c_int = 1;
pub const KERN_OSRELEASE: ::c_int = 2;
pub const KERN_OSREV: ::c_int = 3;
pub const KERN_VERSION: ::c_int = 4;
pub const KERN_MAXVNODES: ::c_int = 5;
pub const KERN_MAXPROC: ::c_int = 6;
pub const KERN_MAXFILES: ::c_int = 7;
pub const KERN_ARGMAX: ::c_int = 8;
pub const KERN_SECURELVL: ::c_int = 9;
pub const KERN_HOSTNAME: ::c_int = 10;
pub const KERN_HOSTID: ::c_int = 11;
pub const KERN_CLOCKRATE: ::c_int = 12;
pub const KERN_VNODE: ::c_int = 13;
pub const KERN_PROC: ::c_int = 14;
pub const KERN_FILE: ::c_int = 15;
pub const KERN_PROF: ::c_int = 16;
pub const KERN_POSIX1: ::c_int = 17;
pub const KERN_NGROUPS: ::c_int = 18;
pub const KERN_JOB_CONTROL: ::c_int = 19;
pub const KERN_SAVED_IDS: ::c_int = 20;
pub const KERN_BOOTTIME: ::c_int = 21;
pub const KERN_NISDOMAINNAME: ::c_int = 22;
pub const KERN_UPDATEINTERVAL: ::c_int = 23;
pub const KERN_OSRELDATE: ::c_int = 24;
pub const KERN_NTP_PLL: ::c_int = 25;
pub const KERN_BOOTFILE: ::c_int = 26;
pub const KERN_MAXFILESPERPROC: ::c_int = 27;
pub const KERN_MAXPROCPERUID: ::c_int = 28;
pub const KERN_DUMPDEV: ::c_int = 29;
pub const KERN_IPC: ::c_int = 30;
pub const KERN_DUMMY: ::c_int = 31;
pub const KERN_PS_STRINGS: ::c_int = 32;
pub const KERN_USRSTACK: ::c_int = 33;
pub const KERN_LOGSIGEXIT: ::c_int = 34;