-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
mod.rs
4622 lines (4170 loc) · 146 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
//! Definitions found commonly among almost all Unix derivatives
//!
//! More functions and definitions can be found in the more specific modules
//! according to the platform in question.
// PUB_TYPE
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type locale_t = *mut ::c_void;
pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;
pub type pid_t = i32;
pub type uid_t = u32;
pub type gid_t = u32;
pub type in_addr_t = u32;
pub type in_port_t = u16;
pub type sighandler_t = ::size_t;
pub type cc_t = ::c_uchar;
pub type sa_family_t = u16;
pub type pthread_key_t = ::c_uint;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub type clockid_t = ::c_int;
pub type key_t = ::c_int;
pub type id_t = ::c_uint;
pub type useconds_t = u32;
pub type dev_t = u64;
pub type socklen_t = u32;
pub type pthread_t = c_ulong;
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 __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 clock_t = c_long;
pub type time_t = c_long;
pub type suseconds_t = c_long;
pub type ino_t = u64;
pub type off_t = i64;
pub type blkcnt_t = i64;
pub type shmatt_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulonglong;
pub type fsfilcnt_t = ::c_ulonglong;
pub type rlim_t = ::c_ulonglong;
pub type c_long = i64;
pub type c_ulong = u64;
// FIXME: why are these uninhabited types? that seems... wrong?
// Presumably these should be `()` or an `extern type` (when that stabilizes).
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
impl ::Clone for timezone {
fn clone(&self) -> timezone {
*self
}
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum DIR {}
impl ::Copy for DIR {}
impl ::Clone for DIR {
fn clone(&self) -> DIR {
*self
}
}
#[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
}
}
// PUB_STRUCT
s! {
pub struct group {
pub gr_name: *mut ::c_char,
pub gr_passwd: *mut ::c_char,
pub gr_gid: ::gid_t,
pub gr_mem: *mut *mut ::c_char,
}
pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
pub struct timeval {
pub tv_sec: time_t,
pub tv_usec: suseconds_t,
}
pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: ::c_long,
}
// FIXME: the rlimit and rusage related functions and types don't exist
// within zircon. Are there reasons for keeping them around?
pub struct rlimit {
pub rlim_cur: rlim_t,
pub rlim_max: rlim_t,
}
pub struct rusage {
pub ru_utime: timeval,
pub ru_stime: timeval,
pub ru_maxrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad1: u32,
pub ru_ixrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad2: u32,
pub ru_idrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad3: u32,
pub ru_isrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad4: u32,
pub ru_minflt: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad5: u32,
pub ru_majflt: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad6: u32,
pub ru_nswap: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad7: u32,
pub ru_inblock: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad8: u32,
pub ru_oublock: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad9: u32,
pub ru_msgsnd: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad10: u32,
pub ru_msgrcv: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad11: u32,
pub ru_nsignals: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad12: u32,
pub ru_nvcsw: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad13: u32,
pub ru_nivcsw: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad14: u32,
}
pub struct in_addr {
pub s_addr: in_addr_t,
}
pub struct in6_addr {
pub s6_addr: [u8; 16],
}
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
pub struct ipv6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: ::c_uint,
}
pub struct hostent {
pub h_name: *mut ::c_char,
pub h_aliases: *mut *mut ::c_char,
pub h_addrtype: ::c_int,
pub h_length: ::c_int,
pub h_addr_list: *mut *mut ::c_char,
}
pub struct iovec {
pub iov_base: *mut ::c_void,
pub iov_len: ::size_t,
}
pub struct pollfd {
pub fd: ::c_int,
pub events: ::c_short,
pub revents: ::c_short,
}
pub struct winsize {
pub ws_row: ::c_ushort,
pub ws_col: ::c_ushort,
pub ws_xpixel: ::c_ushort,
pub ws_ypixel: ::c_ushort,
}
pub struct linger {
pub l_onoff: ::c_int,
pub l_linger: ::c_int,
}
pub struct sigval {
// Actually a union of an int and a void*
pub sival_ptr: *mut ::c_void
}
// <sys/time.h>
pub struct itimerval {
pub it_interval: ::timeval,
pub it_value: ::timeval,
}
// <sys/times.h>
pub struct tms {
pub tms_utime: ::clock_t,
pub tms_stime: ::clock_t,
pub tms_cutime: ::clock_t,
pub tms_cstime: ::clock_t,
}
pub struct servent {
pub s_name: *mut ::c_char,
pub s_aliases: *mut *mut ::c_char,
pub s_port: ::c_int,
pub s_proto: *mut ::c_char,
}
pub struct protoent {
pub p_name: *mut ::c_char,
pub p_aliases: *mut *mut ::c_char,
pub p_proto: ::c_int,
}
pub struct aiocb {
pub aio_fildes: ::c_int,
pub aio_lio_opcode: ::c_int,
pub aio_reqprio: ::c_int,
pub aio_buf: *mut ::c_void,
pub aio_nbytes: ::size_t,
pub aio_sigevent: ::sigevent,
__td: *mut ::c_void,
__lock: [::c_int; 2],
__err: ::c_int,
__ret: ::ssize_t,
pub aio_offset: off_t,
__next: *mut ::c_void,
__prev: *mut ::c_void,
#[cfg(target_pointer_width = "32")]
__dummy4: [::c_char; 24],
#[cfg(target_pointer_width = "64")]
__dummy4: [::c_char; 16],
}
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
pub sa_mask: ::sigset_t,
pub sa_flags: ::c_int,
pub sa_restorer: ::Option<extern fn()>,
}
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: ::cc_t,
pub c_cc: [::cc_t; ::NCCS],
pub __c_ispeed: ::speed_t,
pub __c_ospeed: ::speed_t,
}
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 ucred {
pub pid: ::pid_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
}
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [::c_char; 14],
}
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 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 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_addr: *mut ::sockaddr,
pub ai_canonname: *mut c_char,
pub ai_next: *mut addrinfo,
}
pub struct sockaddr_ll {
pub sll_family: ::c_ushort,
pub sll_protocol: ::c_ushort,
pub sll_ifindex: ::c_int,
pub sll_hatype: ::c_ushort,
pub sll_pkttype: ::c_uchar,
pub sll_halen: ::c_uchar,
pub sll_addr: [::c_uchar; 8]
}
pub struct fd_set {
fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
}
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 sched_param {
pub sched_priority: ::c_int,
pub sched_ss_low_priority: ::c_int,
pub sched_ss_repl_period: ::timespec,
pub sched_ss_init_budget: ::timespec,
pub sched_ss_max_repl: ::c_int,
}
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 epoll_event {
pub events: u32,
pub u64: u64,
}
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_p_sep_by_space: ::c_char,
pub int_n_cs_precedes: ::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 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 ifaddrs {
pub ifa_next: *mut ifaddrs,
pub ifa_name: *mut c_char,
pub ifa_flags: ::c_uint,
pub ifa_addr: *mut ::sockaddr,
pub ifa_netmask: *mut ::sockaddr,
pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
pub ifa_data: *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 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,
#[cfg(target_endian = "little")]
pub f_fsid: ::c_ulong,
#[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
__f_unused: ::c_int,
#[cfg(target_endian = "big")]
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}
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 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 mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}
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 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,
pub dlpi_adds: ::c_ulonglong,
pub dlpi_subs: ::c_ulonglong,
pub dlpi_tls_modid: ::size_t,
pub dlpi_tls_data: *mut ::c_void,
}
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 statfs64 {
pub f_type: ::c_ulong,
pub f_bsize: ::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_fsid: ::fsid_t,
pub f_namelen: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_flags: ::c_ulong,
pub f_spare: [::c_ulong; 4],
}
pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_flags: ::c_int,
pub ss_size: ::size_t
}
pub struct pthread_attr_t {
__size: [u64; 7]
}
pub struct sigset_t {
__val: [::c_ulong; 16],
}
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_atime: ::time_t,
pub shm_dtime: ::time_t,
pub shm_ctime: ::time_t,
pub shm_cpid: ::pid_t,
pub shm_lpid: ::pid_t,
pub shm_nattch: ::c_ulong,
__pad1: ::c_ulong,
__pad2: ::c_ulong,
}
pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
pub msg_stime: ::time_t,
pub msg_rtime: ::time_t,
pub msg_ctime: ::time_t,
__msg_cbytes: ::c_ulong,
pub msg_qnum: ::msgqnum_t,
pub msg_qbytes: ::msglen_t,
pub msg_lspid: ::pid_t,
pub msg_lrpid: ::pid_t,
__pad1: ::c_ulong,
__pad2: ::c_ulong,
}
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::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_fsid: ::fsid_t,
pub f_namelen: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_flags: ::c_ulong,
pub f_spare: [::c_ulong; 4],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::c_int,
__pad1: ::c_int,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::socklen_t,
__pad2: ::socklen_t,
pub msg_flags: ::c_int,
}
pub struct cmsghdr {
pub cmsg_len: ::socklen_t,
pub __pad1: ::c_int,
pub cmsg_level: ::c_int,
pub cmsg_type: ::c_int,
}
pub struct sem_t {
__val: [::c_int; 8],
}
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
pub si_code: ::c_int,
pub _pad: [::c_int; 29],
_align: [usize; 0],
}
pub struct termios2 {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_line: ::cc_t,
pub c_cc: [::cc_t; 19],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
}
s_no_extra_traits! {
pub struct sysinfo {
pub uptime: ::c_ulong,
pub loads: [::c_ulong; 3],
pub totalram: ::c_ulong,
pub freeram: ::c_ulong,
pub sharedram: ::c_ulong,
pub bufferram: ::c_ulong,
pub totalswap: ::c_ulong,
pub freeswap: ::c_ulong,
pub procs: ::c_ushort,
pub pad: ::c_ushort,
pub totalhigh: ::c_ulong,
pub freehigh: ::c_ulong,
pub mem_unit: ::c_uint,
pub __reserved: [::c_char; 256],
}
pub struct sockaddr_un {
pub sun_family: sa_family_t,
pub sun_path: [::c_char; 108]
}
pub struct sockaddr_storage {
pub ss_family: sa_family_t,
__ss_align: ::size_t,
__ss_pad2: [u8; 128 - 2 * 8],
}
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]
}
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],
}
// 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],
}
pub struct sockaddr_nl {
pub nl_family: ::sa_family_t,
nl_pad: ::c_ushort,
pub nl_pid: u32,
pub nl_groups: u32
}
pub struct sigevent {
pub sigev_value: ::sigval,
pub sigev_signo: ::c_int,
pub sigev_notify: ::c_int,
pub sigev_notify_function: fn(::sigval),
pub sigev_notify_attributes: *mut pthread_attr_t,
pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for sysinfo {
fn eq(&self, other: &sysinfo) -> bool {
self.uptime == other.uptime
&& self.loads == other.loads
&& self.totalram == other.totalram
&& self.freeram == other.freeram
&& self.sharedram == other.sharedram
&& self.bufferram == other.bufferram
&& self.totalswap == other.totalswap
&& self.freeswap == other.freeswap
&& self.procs == other.procs
&& self.pad == other.pad
&& self.totalhigh == other.totalhigh
&& self.freehigh == other.freehigh
&& self.mem_unit == other.mem_unit
&& self
.__reserved
.iter()
.zip(other.__reserved.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for sysinfo {}
impl ::fmt::Debug for sysinfo {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sysinfo")