forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.rs
2509 lines (2234 loc) · 80.4 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
use crate::prelude::*;
use crate::*;
pub type wchar_t = c_ushort;
pub type blkcnt_t = i64;
pub type blksize_t = i32;
pub type dev_t = u32;
pub type fsblkcnt_t = c_ulong;
pub type fsfilcnt_t = c_ulong;
pub type ino_t = u64;
pub type key_t = c_longlong;
pub type sa_family_t = u16;
pub type socklen_t = c_int;
pub type off_t = c_long;
pub type id_t = u32;
pub type mode_t = u32;
pub type _off64_t = c_longlong;
pub type loff_t = _off64_t;
pub type iconv_t = *mut c_void;
pub type clock_t = c_ulong;
pub type time_t = c_long;
pub type clockid_t = c_ulong;
pub type timer_t = c_ulong;
pub type nl_item = c_int;
pub type nlink_t = c_ushort;
pub type suseconds_t = c_long;
pub type useconds_t = c_ulong;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl Copy for timezone {}
impl Clone for timezone {
fn clone(&self) -> timezone {
*self
}
}
pub type sigset_t = c_ulong;
pub type fd_mask = c_ulong;
pub type pthread_t = *mut c_void;
pub type pthread_mutex_t = *mut c_void;
// Must be usize due to libstd/sys_common/thread_local.rs,
// should technically be *mut c_void
pub type pthread_key_t = usize;
pub type pthread_attr_t = *mut c_void;
pub type pthread_mutexattr_t = *mut c_void;
pub type pthread_condattr_t = *mut c_void;
pub type pthread_cond_t = *mut c_void;
// The following ones should be *mut c_void
pub type pthread_barrierattr_t = usize;
pub type pthread_barrier_t = usize;
pub type pthread_spinlock_t = usize;
pub type pthread_rwlock_t = *mut c_void;
pub type pthread_rwlockattr_t = *mut c_void;
pub type register_t = intptr_t;
pub type u_char = c_uchar;
pub type u_short = c_ushort;
pub type u_long = c_ulong;
pub type u_int = c_uint;
pub type caddr_t = *mut c_char;
pub type vm_size_t = c_ulong;
pub type rlim_t = c_ulong;
pub type nfds_t = c_uint;
pub type sem_t = *mut sem;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}
impl Copy for sem {}
impl Clone for sem {
fn clone(&self) -> sem {
*self
}
}
pub type tcflag_t = c_uint;
pub type speed_t = c_uint;
pub type vm_offset_t = c_ulong;
pub type posix_spawn_file_actions_t = *mut c_void;
pub type posix_spawnattr_t = *mut c_void;
s! {
pub struct itimerspec {
pub it_interval: timespec,
pub it_value: timespec,
}
pub struct cpu_set_t {
bits: [u64; 16],
}
pub struct sigaction {
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_flags: c_int,
pub ss_size: size_t,
}
pub struct tm {
pub tm_sec: c_int,
pub tm_min: c_int,
pub tm_hour: c_int,
pub tm_mday: c_int,
pub tm_mon: c_int,
pub tm_year: c_int,
pub tm_wday: c_int,
pub tm_yday: c_int,
pub tm_isdst: c_int,
pub tm_gmtoff: c_long,
pub tm_zone: *const c_char,
}
pub struct bintime {
pub sec: time_t,
pub frac: u64,
}
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_comment: *mut c_char,
pub pw_gecos: *mut c_char,
pub pw_dir: *mut c_char,
pub pw_shell: *mut c_char,
}
pub struct if_nameindex {
pub if_index: c_uint,
pub if_name: *mut c_char,
}
pub struct ucred {
pub pid: pid_t,
pub uid: uid_t,
pub gid: gid_t,
}
pub struct msghdr {
pub msg_name: *mut c_void,
pub msg_namelen: socklen_t,
pub msg_iov: *mut iovec,
pub msg_iovlen: c_int,
pub msg_control: *mut c_void,
pub msg_controllen: socklen_t,
pub msg_flags: c_int,
}
pub struct cmsghdr {
pub cmsg_len: size_t,
pub cmsg_level: c_int,
pub cmsg_type: c_int,
}
pub struct Dl_info {
pub dli_fname: [c_char; PATH_MAX as usize],
pub dli_fbase: *mut c_void,
pub dli_sname: *const c_char,
pub dli_saddr: *mut c_void,
}
pub struct in6_pktinfo {
pub ipi6_addr: in6_addr,
pub ipi6_ifindex: u32,
}
pub struct sockaddr_in6 {
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
pub sin6_flowinfo: u32,
pub sin6_addr: in6_addr,
pub sin6_scope_id: u32,
}
pub struct ip_mreq_source {
pub imr_multiaddr: in_addr,
pub imr_sourceaddr: in_addr,
pub imr_interface: in_addr,
}
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,
}
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_n_cs_precedes: c_char,
pub int_n_sep_by_space: c_char,
pub int_n_sign_posn: c_char,
pub int_p_cs_precedes: c_char,
pub int_p_sep_by_space: c_char,
pub int_p_sign_posn: c_char,
}
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_line: c_char,
pub c_cc: [cc_t; NCCS],
pub c_ispeed: speed_t,
pub c_ospeed: speed_t,
}
pub struct sched_param {
pub sched_priority: c_int,
}
pub struct flock {
pub l_type: c_short,
pub l_whence: c_short,
pub l_start: off_t,
pub l_len: off_t,
pub l_pid: pid_t,
}
pub struct hostent {
pub h_name: *const c_char,
pub h_aliases: *mut *mut c_char,
pub h_addrtype: c_short,
pub h_length: c_short,
pub h_addr_list: *mut *mut c_char,
}
pub struct linger {
pub l_onoff: c_ushort,
pub l_linger: c_ushort,
}
pub struct fd_set {
fds_bits: [fd_mask; FD_SETSIZE / core::mem::size_of::<c_ulong>() / 8],
}
pub struct _uc_fpxreg {
pub significand: [u16; 4],
pub exponent: u16,
pub padding: [u16; 3],
}
pub struct _uc_xmmreg {
pub element: [u32; 4],
}
pub struct _fpstate {
pub cwd: u16,
pub swd: u16,
pub ftw: u16,
pub fop: u16,
pub rip: u64,
pub rdp: u64,
pub mxcsr: u32,
pub mxcr_mask: u32,
pub st: [_uc_fpxreg; 8],
pub xmm: [_uc_xmmreg; 16],
pub padding: [u32; 24],
}
#[repr(align(16))]
pub struct mcontext_t {
pub p1home: u64,
pub p2home: u64,
pub p3home: u64,
pub p4home: u64,
pub p5home: u64,
pub p6home: u64,
pub ctxflags: u32,
pub mxcsr: u32,
pub cs: u16,
pub ds: u16,
pub es: u16,
pub fs: u16,
pub gs: u16,
pub ss: u16,
pub eflags: u32,
pub dr0: u64,
pub dr1: u64,
pub dr2: u64,
pub dr3: u64,
pub dr6: u64,
pub dr7: u64,
pub rax: u64,
pub rcx: u64,
pub rdx: u64,
pub rbx: u64,
pub rsp: u64,
pub rbp: u64,
pub rsi: u64,
pub rdi: u64,
pub r8: u64,
pub r9: u64,
pub r10: u64,
pub r11: u64,
pub r12: u64,
pub r13: u64,
pub r14: u64,
pub r15: u64,
pub rip: u64,
pub fpregs: _fpstate,
pub vregs: [u64; 52],
pub vcx: u64,
pub dbc: u64,
pub btr: u64,
pub bfr: u64,
pub etr: u64,
pub efr: u64,
pub oldmask: u64,
pub cr2: u64,
}
pub struct sigevent {
pub sigev_value: sigval,
pub sigev_signo: c_int,
pub sigev_notify: c_int,
pub sigev_notify_function: Option<extern "C" fn(val: sigval)>,
pub sigev_notify_attributes: *mut pthread_attr_t,
}
#[repr(align(8))]
pub struct ucontext_t {
pub uc_mcontext: mcontext_t,
pub uc_link: *mut ucontext_t,
pub uc_sigmask: sigset_t,
pub uc_stack: stack_t,
pub uc_flags: c_ulong,
}
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [c_char; 14],
}
pub struct sockaddr_storage {
pub ss_family: sa_family_t,
__ss_pad1: [c_char; 6],
__ss_align: i64,
__ss_pad2: [c_char; 112],
}
pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_mode: mode_t,
pub st_nlink: nlink_t,
pub st_uid: uid_t,
pub st_gid: gid_t,
pub st_rdev: dev_t,
pub st_size: off_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_blksize: blksize_t,
pub st_blocks: blkcnt_t,
pub st_birthtime: time_t,
pub st_birthtime_nsec: c_long,
}
pub struct in_addr {
pub s_addr: in_addr_t,
}
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
pub struct in_pktinfo {
pub ipi_addr: in_addr,
pub ipi_ifindex: u32,
}
pub struct sockaddr_in {
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_addr: in_addr,
pub sin_zero: [u8; 8],
}
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 statfs {
pub f_type: c_ulong,
pub f_bsize: c_ulong,
pub f_blocks: c_ulong,
pub f_bfree: c_ulong,
pub f_bavail: c_ulong,
pub f_files: c_ulong,
pub f_ffree: c_ulong,
pub f_fsid: c_ulong,
pub f_namelen: c_ulong,
pub f_spare: [c_ulong; 6],
}
}
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 4],
}
pub struct siginfo_t {
pub si_signo: c_int,
pub si_code: c_int,
pub si_pid: pid_t,
pub si_uid: uid_t,
pub si_errno: c_int,
__pad: [u32; 32],
}
pub union __c_anonymous_ifr_ifru {
pub ifru_addr: sockaddr,
pub ifru_broadaddr: sockaddr,
pub ifru_dstaddr: sockaddr,
pub ifru_netmask: sockaddr,
pub ifru_hwaddr: sockaddr,
pub ifru_flags: c_int,
pub ifru_metric: c_int,
pub ifru_mtu: c_int,
pub ifru_ifindex: c_int,
pub ifru_data: *mut c_char,
__ifru_pad: [c_char; 28],
}
pub struct ifreq {
/// if name, e.g. "en0"
pub ifr_name: [c_char; IFNAMSIZ],
pub ifr_ifru: __c_anonymous_ifr_ifru,
}
pub union __c_anonymous_ifc_ifcu {
pub ifcu_buf: caddr_t,
pub ifcu_req: *mut ifreq,
}
pub struct ifconf {
pub ifc_len: c_int,
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
}
pub struct dirent {
__d_version: u32,
pub d_ino: ino_t,
pub d_type: c_uchar,
__d_unused1: [c_uchar; 3],
__d_internal1: u32,
pub d_name: [c_char; 256],
}
pub struct sockaddr_un {
pub sun_family: sa_family_t,
pub sun_path: [c_char; 108],
}
pub struct utsname {
pub sysname: [c_char; 65],
pub nodename: [c_char; 65],
pub release: [c_char; 65],
pub version: [c_char; 65],
pub machine: [c_char; 65],
pub domainname: [c_char; 65],
}
}
impl siginfo_t {
pub unsafe fn si_addr(&self) -> *mut c_void {
#[repr(C)]
struct siginfo_si_addr {
_si_signo: c_int,
_si_code: c_int,
_si_pid: pid_t,
_si_uid: uid_t,
_si_errno: c_int,
si_addr: *mut c_void,
}
(*(self as *const siginfo_t as *const siginfo_si_addr)).si_addr
}
pub unsafe fn si_status(&self) -> c_int {
#[repr(C)]
struct siginfo_sigchld {
_si_signo: c_int,
_si_code: c_int,
_si_pid: pid_t,
_si_uid: uid_t,
_si_errno: c_int,
si_status: c_int,
}
(*(self as *const siginfo_t as *const siginfo_sigchld)).si_status
}
pub unsafe fn si_pid(&self) -> pid_t {
self.si_pid
}
pub unsafe fn si_uid(&self) -> uid_t {
self.si_uid
}
pub unsafe fn si_value(&self) -> sigval {
#[repr(C)]
struct siginfo_si_value {
_si_signo: c_int,
_si_code: c_int,
_si_pid: pid_t,
_si_uid: uid_t,
_si_errno: c_int,
si_value: sigval,
}
(*(self as *const siginfo_t as *const siginfo_si_value)).si_value
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for siginfo_t {
fn eq(&self, other: &siginfo_t) -> bool {
self.si_signo == other.si_signo
&& self.si_code == other.si_code
&& self.si_pid == other.si_pid
&& self.si_uid == other.si_uid
&& self.si_errno == other.si_errno
}
}
impl Eq for siginfo_t {}
impl fmt::Debug for siginfo_t {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("siginfo_t")
.field("si_signo", &self.si_signo)
.field("si_code", &self.si_code)
.field("si_pid", &self.si_pid)
.field("si_uid", &self.si_uid)
.field("si_errno", &self.si_errno)
// Ignore __pad
.finish()
}
}
impl hash::Hash for siginfo_t {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.si_signo.hash(state);
self.si_code.hash(state);
self.si_pid.hash(state);
self.si_uid.hash(state);
self.si_errno.hash(state);
// Ignore __pad
}
}
impl fmt::Debug for ifreq {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("ifreq")
.field("ifr_name", &self.ifr_name)
.field("ifr_ifru", &self.ifr_ifru)
.finish()
}
}
impl fmt::Debug for ifconf {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("ifconf")
.field("ifc_len", &self.ifc_len)
.field("ifc_ifcu", &self.ifc_ifcu)
.finish()
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_ino == other.d_ino
&& 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_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_type.hash(state);
self.d_name.hash(state);
}
}
impl PartialEq for sockaddr_un {
fn eq(&self, other: &sockaddr_un) -> bool {
self.sun_family == other.sun_family
&& self
.sun_path
.iter()
.zip(other.sun_path.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for sockaddr_un {}
impl fmt::Debug for sockaddr_un {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("sockaddr_un")
.field("sun_family", &self.sun_family)
// FIXME: .field("sun_path", &self.sun_path)
.finish()
}
}
impl hash::Hash for sockaddr_un {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.sun_family.hash(state);
self.sun_path.hash(state);
}
}
impl PartialEq for utsname {
fn eq(&self, other: &utsname) -> bool {
self.sysname
.iter()
.zip(other.sysname.iter())
.all(|(a, b)| a == b)
&& self
.nodename
.iter()
.zip(other.nodename.iter())
.all(|(a, b)| a == b)
&& self
.release
.iter()
.zip(other.release.iter())
.all(|(a, b)| a == b)
&& self
.version
.iter()
.zip(other.version.iter())
.all(|(a, b)| a == b)
&& self
.machine
.iter()
.zip(other.machine.iter())
.all(|(a, b)| a == b)
&& self
.domainname
.iter()
.zip(other.domainname.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for utsname {}
impl fmt::Debug for utsname {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("utsname")
// FIXME: .field("sysname", &self.sysname)
// FIXME: .field("nodename", &self.nodename)
// FIXME: .field("release", &self.release)
// FIXME: .field("version", &self.version)
// FIXME: .field("machine", &self.machine)
// FIXME: .field("domainname", &self.domainname)
.finish()
}
}
impl hash::Hash for utsname {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.sysname.hash(state);
self.nodename.hash(state);
self.release.hash(state);
self.version.hash(state);
self.machine.hash(state);
self.domainname.hash(state);
}
}
}
}
pub const FD_SETSIZE: usize = 1024;
pub const CPU_SETSIZE: c_int = 0x400;
// si_code values for SIGBUS signal
pub const BUS_ADRALN: c_int = 25;
pub const BUS_ADRERR: c_int = 26;
pub const BUS_OBJERR: c_int = 27;
// si_code values for SIGCHLD signal
pub const CLD_EXITED: c_int = 28;
pub const CLD_KILLED: c_int = 29;
pub const CLD_DUMPED: c_int = 30;
pub const CLD_TRAPPED: c_int = 31;
pub const CLD_STOPPED: c_int = 32;
pub const CLD_CONTINUED: c_int = 33;
pub const SIGEV_SIGNAL: c_int = 0;
pub const SIGEV_NONE: c_int = 1;
pub const SIGEV_THREAD: c_int = 2;
pub const SA_NOCLDSTOP: c_int = 0x00000001;
pub const SA_NOCLDWAIT: c_int = 0; // FIXME: does not exist on Cygwin!
pub const SA_SIGINFO: c_int = 0x00000002;
pub const SA_RESTART: c_int = 0x10000000;
pub const SA_ONSTACK: c_int = 0x20000000;
pub const SA_NODEFER: c_int = 0x40000000;
pub const SA_RESETHAND: c_int = 0x80000000;
pub const MINSIGSTKSZ: size_t = 8192;
pub const SIGSTKSZ: size_t = 32768;
pub const SIGHUP: c_int = 1;
pub const SIGINT: c_int = 2;
pub const SIGQUIT: c_int = 3;
pub const SIGILL: c_int = 4;
pub const SIGTRAP: c_int = 5;
pub const SIGABRT: c_int = 6;
pub const SIGEMT: c_int = 7;
pub const SIGFPE: c_int = 8;
pub const SIGKILL: c_int = 9;
pub const SIGBUS: c_int = 10;
pub const SIGSEGV: c_int = 11;
pub const SIGSYS: c_int = 12;
pub const SIGPIPE: c_int = 13;
pub const SIGALRM: c_int = 14;
pub const SIGTERM: c_int = 15;
pub const SIGURG: c_int = 16;
pub const SIGSTOP: c_int = 17;
pub const SIGTSTP: c_int = 18;
pub const SIGCONT: c_int = 19;
pub const SIGCHLD: c_int = 20;
pub const SIGTTIN: c_int = 21;
pub const SIGTTOU: c_int = 22;
pub const SIGIO: c_int = 23;
pub const SIGPOLL: c_int = 23;
pub const SIGXCPU: c_int = 24;
pub const SIGXFSZ: c_int = 25;
pub const SIGVTALRM: c_int = 26;
pub const SIGPROF: c_int = 27;
pub const SIGWINCH: c_int = 28;
pub const SIGPWR: c_int = 29;
pub const SIGUSR1: c_int = 30;
pub const SIGUSR2: c_int = 31;
pub const SS_ONSTACK: c_int = 0x1;
pub const SS_DISABLE: c_int = 0x2;
pub const SIG_SETMASK: c_int = 0;
pub const SIG_BLOCK: c_int = 1;
pub const SIG_UNBLOCK: c_int = 2;
pub const TIMER_ABSTIME: c_int = 4;
pub const CLOCK_REALTIME_COARSE: clockid_t = 0;
pub const CLOCK_REALTIME: clockid_t = 1;
pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
pub const CLOCK_MONOTONIC: clockid_t = 4;
pub const CLOCK_MONOTONIC_RAW: clockid_t = 5;
pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
pub const CLOCK_BOOTTIME: clockid_t = 7;
pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
pub const ITIMER_REAL: c_int = 0;
pub const ITIMER_VIRTUAL: c_int = 1;
pub const ITIMER_PROF: c_int = 2;
pub const PRIO_PROCESS: c_int = 0;
pub const PRIO_PGRP: c_int = 1;
pub const PRIO_USER: c_int = 2;
pub const RLIMIT_CPU: c_int = 0;
pub const RLIMIT_FSIZE: c_int = 1;
pub const RLIMIT_DATA: c_int = 2;
pub const RLIMIT_STACK: c_int = 3;
pub const RLIMIT_CORE: c_int = 4;
pub const RLIMIT_NOFILE: c_int = 5;
pub const RLIMIT_AS: c_int = 6;
pub const RLIM_NLIMITS: c_int = 7;
pub const RLIMIT_NLIMITS: c_int = RLIM_NLIMITS;
pub const RLIM_INFINITY: rlim_t = !0;
pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
pub const RUSAGE_SELF: c_int = 0;
pub const RUSAGE_CHILDREN: c_int = -1;
pub const IFF_UP: c_int = 0x1; // interface is up
pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid
pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net
pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link
pub const IFF_NOTRAILERS: c_int = 0x20; // avoid use of trailers
pub const IFF_RUNNING: c_int = 0x40; // resources allocated
pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol
pub const IFF_PROMISC: c_int = 0x100; // receive all packets
pub const IFF_MULTICAST: c_int = 0x1000; // supports multicast
pub const IFF_LOWER_UP: c_int = 0x10000; // driver signals L1 up
pub const IFF_DORMANT: c_int = 0x20000; // driver signals dormant
pub const IF_NAMESIZE: size_t = 44;
pub const IFNAMSIZ: size_t = IF_NAMESIZE;
pub const FIONREAD: c_int = 0x4008667f;
pub const FIONBIO: c_int = 0x8004667e;
pub const FIOASYNC: c_int = 0x8008667d;
pub const FIOCLEX: c_int = 0; // FIXME: does not exist on Cygwin!
pub const SIOCGIFCONF: c_ulong = 0x80107364;
pub const SIOCGIFFLAGS: c_ulong = 0x80507365;
pub const SIOCGIFADDR: c_ulong = 0x80507366;
pub const SIOCGIFBRDADDR: c_ulong = 0x80507367;
pub const SIOCGIFNETMASK: c_ulong = 0x80507368;
pub const SIOCGIFHWADDR: c_ulong = 0x80507369;
pub const SIOCGIFMETRIC: c_ulong = 0x8050736a;
pub const SIOCGIFMTU: c_ulong = 0x8050736b;
pub const SIOCGIFINDEX: c_ulong = 0x8050736c;
pub const SIOGIFINDEX: c_ulong = SIOCGIFINDEX;
pub const SIOCGIFDSTADDR: c_ulong = 0x8050736e;
pub const SOL_SOCKET: c_int = 0xffff;
pub const SO_DEBUG: c_int = 1;
pub const SO_ACCEPTCONN: c_int = 0x0002;
pub const SO_REUSEADDR: c_int = 0x0004;
pub const SO_KEEPALIVE: c_int = 0x0008;
pub const SO_DONTROUTE: c_int = 0x0010;
pub const SO_BROADCAST: c_int = 0x0020;
pub const SO_USELOOPBACK: c_int = 0x0040;
pub const SO_LINGER: c_int = 0x0080;
pub const SO_OOBINLINE: c_int = 0x0100;
pub const SO_PEERCRED: c_int = 0x0200;
pub const SO_PASSCRED: c_int = 0x0400;
pub const SO_SNDBUF: c_int = 0x1001;
pub const SO_RCVBUF: c_int = 0x1002;
pub const SO_SNDLOWAT: c_int = 0x1003;
pub const SO_RCVLOWAT: c_int = 0x1004;
pub const SO_SNDTIMEO: c_int = 0x1005;
pub const SO_RCVTIMEO: c_int = 0x1006;
pub const SO_ERROR: c_int = 0x1007;
pub const SO_TYPE: c_int = 0x1008;
pub const SCM_RIGHTS: c_int = 0x01;
pub const SCM_CREDENTIALS: c_int = 0x02;
pub const SOCK_STREAM: c_int = 1;
pub const SOCK_DGRAM: c_int = 2;
pub const SOCK_RAW: c_int = 3;
pub const SOCK_RDM: c_int = 4;
pub const SOCK_SEQPACKET: c_int = 5;
pub const SOCK_NONBLOCK: c_int = 0x01000000;
pub const SOCK_CLOEXEC: c_int = 0x02000000;
pub const AF_UNSPEC: c_int = 0;
pub const AF_LOCAL: c_int = 1;
pub const AF_UNIX: c_int = AF_LOCAL;
pub const AF_INET: c_int = 2;
pub const AF_IMPLINK: c_int = 3;
pub const AF_PUP: c_int = 4;
pub const AF_CHAOS: c_int = 5;
pub const AF_NS: c_int = 6;
pub const AF_ISO: c_int = 7;
pub const AF_OSI: c_int = AF_ISO;
pub const AF_ECMA: c_int = 8;
pub const AF_DATAKIT: c_int = 9;
pub const AF_CCITT: c_int = 10;
pub const AF_SNA: c_int = 11;
pub const AF_DECnet: c_int = 12;
pub const AF_DLI: c_int = 13;
pub const AF_LAT: c_int = 14;
pub const AF_HYLINK: c_int = 15;
pub const AF_APPLETALK: c_int = 16;
pub const AF_NETBIOS: c_int = 17;
pub const AF_INET6: c_int = 23;
pub const PF_UNSPEC: c_int = AF_UNSPEC;
pub const PF_LOCAL: c_int = AF_LOCAL;
pub const PF_UNIX: c_int = PF_LOCAL;
pub const PF_INET: c_int = AF_INET;
pub const PF_IMPLINK: c_int = AF_IMPLINK;
pub const PF_PUP: c_int = AF_PUP;
pub const PF_CHAOS: c_int = AF_CHAOS;
pub const PF_NS: c_int = AF_NS;
pub const PF_ISO: c_int = AF_ISO;
pub const PF_OSI: c_int = AF_ISO;
pub const PF_DATAKIT: c_int = AF_DATAKIT;
pub const PF_CCITT: c_int = AF_CCITT;
pub const PF_SNA: c_int = AF_SNA;
pub const PF_DECnet: c_int = AF_DECnet;
pub const PF_DLI: c_int = AF_DLI;
pub const PF_LAT: c_int = AF_LAT;
pub const PF_HYLINK: c_int = AF_HYLINK;
pub const PF_APPLETALK: c_int = AF_APPLETALK;
pub const PF_NETBIOS: c_int = AF_NETBIOS;
pub const PF_INET6: c_int = AF_INET6;
pub const SOMAXCONN: c_int = 0x7fffffff;
pub const MSG_OOB: c_int = 0x1;
pub const MSG_PEEK: c_int = 0x2;
pub const MSG_DONTROUTE: c_int = 0x4;
pub const MSG_WAITALL: c_int = 0x8;
pub const MSG_DONTWAIT: c_int = 0x10;
pub const MSG_NOSIGNAL: c_int = 0x20;
pub const MSG_TRUNC: c_int = 0x0100;
pub const MSG_CTRUNC: c_int = 0x0200;
pub const MSG_BCAST: c_int = 0x0400;
pub const MSG_MCAST: c_int = 0x0800;
pub const MSG_CMSG_CLOEXEC: c_int = 0x1000;
pub const MSG_EOR: c_int = 0x8000;
pub const SOL_IP: c_int = 0;
pub const SOL_IPV6: c_int = 41;
pub const SOL_TCP: c_int = 6;
pub const SOL_UDP: c_int = 17;
pub const IPTOS_LOWDELAY: u8 = 0x10;
pub const IPTOS_THROUGHPUT: u8 = 0x08;
pub const IPTOS_RELIABILITY: u8 = 0x04;
pub const IP_DEFAULT_MULTICAST_TTL: c_int = 1;
pub const IP_DEFAULT_MULTICAST_LOOP: c_int = 1;
pub const IP_OPTIONS: c_int = 1;
pub const IP_HDRINCL: c_int = 2;
pub const IP_TOS: c_int = 3;
pub const IP_TTL: c_int = 4;
pub const IP_MULTICAST_IF: c_int = 9;
pub const IP_MULTICAST_TTL: c_int = 10;
pub const IP_MULTICAST_LOOP: c_int = 11;
pub const IP_ADD_MEMBERSHIP: c_int = 12;
pub const IP_DROP_MEMBERSHIP: c_int = 13;
pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 15;
pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 16;
pub const IP_BLOCK_SOURCE: c_int = 17;
pub const IP_UNBLOCK_SOURCE: c_int = 18;
pub const IP_PKTINFO: c_int = 19;
pub const IP_UNICAST_IF: c_int = 31;
pub const IPV6_HOPOPTS: c_int = 1;
pub const IPV6_UNICAST_HOPS: c_int = 4;
pub const IPV6_MULTICAST_IF: c_int = 9;
pub const IPV6_MULTICAST_HOPS: c_int = 10;
pub const IPV6_MULTICAST_LOOP: c_int = 11;
pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
pub const IPV6_DROP_MEMBERSHIP: c_int = 13;