forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.rs
3225 lines (3072 loc) · 110 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::*;
pub type caddr_t = *mut c_char;
pub type clockid_t = c_longlong;
pub type blkcnt_t = c_long;
pub type clock_t = c_int;
pub type daddr_t = c_long;
pub type dev_t = c_ulong;
pub type fpos64_t = c_longlong;
pub type fsblkcnt_t = c_ulong;
pub type fsfilcnt_t = c_ulong;
pub type idtype_t = c_int;
pub type ino_t = c_ulong;
pub type key_t = c_int;
pub type mode_t = c_uint;
pub type nlink_t = c_short;
pub type rlim_t = c_ulong;
pub type speed_t = c_uint;
pub type tcflag_t = c_uint;
pub type time_t = c_long;
pub type time64_t = u64;
pub type timer_t = c_long;
pub type wchar_t = c_uint;
pub type nfds_t = c_int;
pub type projid_t = c_int;
pub type id_t = c_uint;
pub type blksize64_t = c_ulonglong;
pub type blkcnt64_t = c_ulonglong;
pub type sctp_assoc_t = u32;
pub type suseconds_t = c_int;
pub type useconds_t = c_uint;
pub type off_t = c_long;
pub type off64_t = c_longlong;
pub type socklen_t = c_uint;
pub type sa_family_t = c_uchar;
pub type in_port_t = c_ushort;
pub type in_addr_t = c_uint;
pub type signal_t = c_int;
pub type pthread_t = c_uint;
pub type pthread_key_t = c_uint;
pub type thread_t = pthread_t;
pub type blksize_t = c_long;
pub type nl_item = c_int;
pub type mqd_t = c_int;
pub type shmatt_t = c_ulong;
pub type regoff_t = c_long;
pub type rlim64_t = c_ulonglong;
pub type sem_t = c_int;
pub type pollset_t = c_int;
pub type pthread_rwlockattr_t = *mut c_void;
pub type pthread_condattr_t = *mut c_void;
pub type pthread_mutexattr_t = *mut c_void;
pub type pthread_attr_t = *mut c_void;
pub type pthread_barrierattr_t = *mut c_void;
pub type posix_spawn_file_actions_t = *mut c_char;
pub type iconv_t = *mut c_void;
e! {
#[repr(u32)]
pub enum uio_rw {
UIO_READ = 0,
UIO_WRITE,
UIO_READ_NO_MOVE,
UIO_WRITE_NO_MOVE,
UIO_PWRITE,
}
}
s! {
pub struct fsid_t {
pub val: [c_uint; 2],
}
pub struct fsid64_t {
pub val: [crate::uint64_t; 2],
}
pub struct timezone {
pub tz_minuteswest: c_int,
pub tz_dsttime: c_int,
}
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
pub struct dirent {
pub d_offset: c_ulong,
pub d_ino: crate::ino_t,
pub d_reclen: c_ushort,
pub d_namlen: c_ushort,
pub d_name: [c_char; 256],
}
pub struct termios {
pub c_iflag: crate::tcflag_t,
pub c_oflag: crate::tcflag_t,
pub c_cflag: crate::tcflag_t,
pub c_lflag: crate::tcflag_t,
pub c_cc: [crate::cc_t; crate::NCCS],
}
pub struct flock64 {
pub l_type: c_short,
pub l_whence: c_short,
pub l_sysid: c_uint,
pub l_pid: crate::pid_t,
pub l_vfs: c_int,
pub l_start: off64_t,
pub l_len: off64_t,
}
pub struct msghdr {
pub msg_name: *mut c_void,
pub msg_namelen: crate::socklen_t,
pub msg_iov: *mut crate::iovec,
pub msg_iovlen: c_int,
pub msg_control: *mut c_void,
pub msg_controllen: socklen_t,
pub msg_flags: c_int,
}
pub struct statvfs64 {
pub f_bsize: crate::blksize64_t,
pub f_frsize: crate::blksize64_t,
pub f_blocks: crate::blkcnt64_t,
pub f_bfree: crate::blkcnt64_t,
pub f_bavail: crate::blkcnt64_t,
pub f_files: crate::blkcnt64_t,
pub f_ffree: crate::blkcnt64_t,
pub f_favail: crate::blkcnt64_t,
pub f_fsid: fsid64_t,
pub f_basetype: [c_char; 16],
pub f_flag: c_ulong,
pub f_namemax: c_ulong,
pub f_fstr: [c_char; 32],
pub f_filler: [c_ulong; 16],
}
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 left_parenthesis: *mut c_char,
pub right_parenthesis: *mut 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 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 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: c_ulong,
pub ai_canonname: *mut c_char,
pub ai_addr: *mut crate::sockaddr,
pub ai_next: *mut addrinfo,
pub ai_eflags: c_int,
}
pub struct in_addr {
pub s_addr: in_addr_t,
}
pub struct ip_mreq_source {
pub imr_multiaddr: in_addr,
pub imr_sourceaddr: in_addr,
pub imr_interface: in_addr,
}
pub struct sockaddr {
pub sa_len: c_uchar,
pub sa_family: sa_family_t,
pub sa_data: [c_char; 14],
}
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; 120],
}
pub struct sockaddr_in {
pub sin_len: c_uchar,
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 sockaddr_in6 {
pub sin6_len: c_uchar,
pub sin6_family: c_uchar,
pub sin6_port: crate::uint16_t,
pub sin6_flowinfo: crate::uint32_t,
pub sin6_addr: crate::in6_addr,
pub sin6_scope_id: crate::uint32_t,
}
pub struct sockaddr_storage {
pub __ss_len: c_uchar,
pub ss_family: sa_family_t,
__ss_pad1: [c_char; 6],
__ss_align: crate::int64_t,
__ss_pad2: [c_char; 1265],
}
pub struct sockaddr_un {
pub sun_len: c_uchar,
pub sun_family: sa_family_t,
pub sun_path: [c_char; 1023],
}
pub struct st_timespec {
pub tv_sec: crate::time_t,
pub tv_nsec: c_int,
}
pub struct statfs64 {
pub f_version: c_int,
pub f_type: c_int,
pub f_bsize: blksize64_t,
pub f_blocks: blkcnt64_t,
pub f_bfree: blkcnt64_t,
pub f_bavail: blkcnt64_t,
pub f_files: crate::uint64_t,
pub f_ffree: crate::uint64_t,
pub f_fsid: fsid64_t,
pub f_vfstype: c_int,
pub f_fsize: blksize64_t,
pub f_vfsnumber: c_int,
pub f_vfsoff: c_int,
pub f_vfslen: c_int,
pub f_vfsvers: c_int,
pub f_fname: [c_char; 32],
pub f_fpack: [c_char; 32],
pub f_name_max: c_int,
}
pub struct passwd {
pub pw_name: *mut c_char,
pub pw_passwd: *mut c_char,
pub pw_uid: crate::uid_t,
pub pw_gid: crate::gid_t,
pub pw_gecos: *mut c_char,
pub pw_dir: *mut c_char,
pub pw_shell: *mut c_char,
}
pub struct utsname {
pub sysname: [c_char; 32],
pub nodename: [c_char; 32],
pub release: [c_char; 32],
pub version: [c_char; 32],
pub machine: [c_char; 32],
}
pub struct xutsname {
pub nid: c_uint,
pub reserved: c_int,
pub longnid: c_ulonglong,
}
pub struct cmsghdr {
pub cmsg_len: crate::socklen_t,
pub cmsg_level: c_int,
pub cmsg_type: c_int,
}
pub struct sigevent {
pub sigev_value: crate::sigval,
pub sigev_signo: c_int,
pub sigev_notify: c_int,
pub sigev_notify_function: extern "C" fn(val: crate::sigval),
pub sigev_notify_attributes: *mut pthread_attr_t,
}
// Should be union with another 'sival_int'
pub struct sigval64 {
pub sival_ptr: c_ulonglong,
}
pub struct sigevent64 {
pub sigev_value: sigval64,
pub sigev_signo: c_int,
pub sigev_notify: c_int,
pub sigev_notify_function: c_ulonglong,
pub sigev_notify_attributes: c_ulonglong,
}
pub struct osigevent {
pub sevt_value: *mut c_void,
pub sevt_signo: signal_t,
}
pub struct poll_ctl {
pub cmd: c_short,
pub events: c_short,
pub fd: c_int,
}
pub struct sf_parms {
pub header_data: *mut c_void,
pub header_length: c_uint,
pub file_descriptor: c_int,
pub file_size: crate::uint64_t,
pub file_offset: crate::uint64_t,
pub file_bytes: crate::int64_t,
pub trailer_data: *mut c_void,
pub trailer_length: c_uint,
pub bytes_sent: crate::uint64_t,
}
pub struct mmsghdr {
pub msg_hdr: crate::msghdr,
pub msg_len: c_uint,
}
pub struct sched_param {
pub sched_priority: c_int,
pub sched_policy: c_int,
pub sched_reserved: [c_int; 6],
}
pub struct stack_t {
pub ss_sp: *mut c_void,
pub ss_size: size_t,
pub ss_flags: c_int,
pub __pad: [c_int; 4],
}
pub struct posix_spawnattr_t {
pub posix_attr_flags: c_short,
pub posix_attr_pgroup: crate::pid_t,
pub posix_attr_sigmask: crate::sigset_t,
pub posix_attr_sigdefault: crate::sigset_t,
pub posix_attr_schedpolicy: c_int,
pub posix_attr_schedparam: sched_param,
}
pub struct glob_t {
pub gl_pathc: size_t,
pub gl_pathv: *mut *mut c_char,
pub gl_offs: size_t,
pub gl_padr: *mut c_void,
pub gl_ptx: *mut c_void,
}
pub struct mallinfo {
pub arena: c_ulong,
pub ordblks: c_int,
pub smblks: c_int,
pub hblks: c_int,
pub hblkhd: c_int,
pub usmblks: c_ulong,
pub fsmblks: c_ulong,
pub uordblks: c_ulong,
pub fordblks: c_ulong,
pub keepcost: c_int,
}
pub struct utmp_exit_status {
pub e_termination: c_short,
pub e_exit: c_short,
}
pub struct utmp {
pub ut_user: [c_char; 256],
pub ut_id: [c_char; 14],
pub ut_line: [c_char; 64],
pub ut_pid: crate::pid_t,
pub ut_type: c_short,
pub ut_time: time64_t,
pub ut_exit: utmp_exit_status,
pub ut_host: [c_char; 256],
pub __dbl_word_pad: c_int,
pub __reservedA: [c_int; 2],
pub __reservedV: [c_int; 6],
}
pub struct regmatch_t {
pub rm_so: regoff_t,
pub rm_eo: regoff_t,
}
pub struct regex_t {
pub re_nsub: size_t,
pub re_comp: *mut c_void,
pub re_cflags: c_int,
pub re_erroff: size_t,
pub re_len: size_t,
pub re_ucoll: [crate::wchar_t; 2],
pub re_lsub: [*mut c_void; 24],
pub re_esub: [*mut c_void; 24],
pub re_map: *mut c_uchar,
pub __maxsub: c_int,
pub __unused: [*mut c_void; 34],
}
pub struct rlimit64 {
pub rlim_cur: rlim64_t,
pub rlim_max: rlim64_t,
}
pub struct shmid_ds {
pub shm_perm: ipc_perm,
pub shm_segsz: size_t,
pub shm_lpid: crate::pid_t,
pub shm_cpid: crate::pid_t,
pub shm_nattch: shmatt_t,
pub shm_cnattch: shmatt_t,
pub shm_atime: time_t,
pub shm_dtime: time_t,
pub shm_ctime: time_t,
pub shm_handle: crate::uint32_t,
pub shm_extshm: c_int,
pub shm_pagesize: crate::int64_t,
pub shm_lba: crate::uint64_t,
pub shm_reserved: crate::int64_t,
pub shm_reserved1: crate::int64_t,
}
pub struct stat64 {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_mode: mode_t,
pub st_nlink: nlink_t,
pub st_flag: c_ushort,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: dev_t,
pub st_ssize: c_int,
pub st_atim: st_timespec,
pub st_mtim: st_timespec,
pub st_ctim: st_timespec,
pub st_blksize: blksize_t,
pub st_blocks: blkcnt_t,
pub st_vfstype: c_int,
pub st_vfs: c_uint,
pub st_type: c_uint,
pub st_gen: c_uint,
pub st_reserved: [c_uint; 10],
pub st_size: off64_t,
}
pub struct mntent {
pub mnt_fsname: *mut c_char,
pub mnt_dir: *mut c_char,
pub mnt_type: *mut c_char,
pub mnt_opts: *mut c_char,
pub mnt_freq: c_int,
pub mnt_passno: c_int,
}
pub struct ipc_perm {
pub uid: crate::uid_t,
pub gid: crate::gid_t,
pub cuid: crate::uid_t,
pub cgid: crate::gid_t,
pub mode: mode_t,
pub seq: c_ushort,
pub __reserved: c_ushort,
pub key: key_t,
}
pub struct entry {
pub key: *mut c_char,
pub data: *mut c_void,
}
pub struct mq_attr {
pub mq_flags: c_long,
pub mq_maxmsg: c_long,
pub mq_msgsize: c_long,
pub mq_curmsgs: c_long,
}
pub struct sembuf {
pub sem_num: c_ushort,
pub sem_op: c_short,
pub sem_flg: c_short,
}
pub struct if_nameindex {
pub if_index: c_uint,
pub if_name: *mut c_char,
}
pub struct itimerspec {
pub it_interval: crate::timespec,
pub it_value: crate::timespec,
}
pub struct sigaction {
pub sa_sigaction: crate::sighandler_t, // FIXME(union): this field is actually a union
pub sa_mask: sigset_t,
pub sa_flags: c_int,
}
}
s_no_extra_traits! {
pub union __poll_ctl_ext_u {
pub addr: *mut c_void,
pub data32: u32,
pub data: u64,
}
pub struct poll_ctl_ext {
pub version: u8,
pub command: u8,
pub events: c_short,
pub fd: c_int,
pub u: __poll_ctl_ext_u,
pub reversed64: [u64; 6],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for __poll_ctl_ext_u {
fn eq(&self, other: &__poll_ctl_ext_u) -> bool {
unsafe {
self.addr == other.addr
&& self.data32 == other.data32
&& self.data == other.data
}
}
}
impl Eq for __poll_ctl_ext_u {}
impl hash::Hash for __poll_ctl_ext_u {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
unsafe {
self.addr.hash(state);
self.data32.hash(state);
self.data.hash(state);
}
}
}
impl PartialEq for poll_ctl_ext {
fn eq(&self, other: &poll_ctl_ext) -> bool {
self.version == other.version
&& self.command == other.command
&& self.events == other.events
&& self.fd == other.fd
&& self.reversed64 == other.reversed64
&& self.u == other.u
}
}
impl Eq for poll_ctl_ext {}
impl fmt::Debug for poll_ctl_ext {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("poll_ctl_ext")
.field("version", &self.version)
.field("command", &self.command)
.field("events", &self.events)
.field("fd", &self.fd)
.field("u", &self.u)
.field("reversed64", &self.reversed64)
.finish()
}
}
impl hash::Hash for poll_ctl_ext {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.version.hash(state);
self.command.hash(state);
self.events.hash(state);
self.fd.hash(state);
self.u.hash(state);
self.reversed64.hash(state);
}
}
}
}
// dlfcn.h
pub const RTLD_LAZY: c_int = 0x4;
pub const RTLD_NOW: c_int = 0x2;
pub const RTLD_GLOBAL: c_int = 0x10000;
pub const RTLD_LOCAL: c_int = 0x80000;
pub const RTLD_MEMBER: c_int = 0x40000;
pub const RTLD_NOAUTODEFER: c_int = 0x20000;
pub const RTLD_DEFAULT: *mut c_void = -1isize as *mut c_void;
pub const RTLD_MYSELF: *mut c_void = -2isize as *mut c_void;
pub const RTLD_NEXT: *mut c_void = -3isize as *mut c_void;
// fcntl.h
pub const O_RDONLY: c_int = 0x0;
pub const O_WRONLY: c_int = 0x1;
pub const O_RDWR: c_int = 0x2;
pub const O_NDELAY: c_int = 0x8000;
pub const O_APPEND: c_int = 0x8;
pub const O_DSYNC: c_int = 0x400000;
pub const O_CREAT: c_int = 0x100;
pub const O_EXCL: c_int = 0x400;
pub const O_NOCTTY: c_int = 0x800;
pub const O_TRUNC: c_int = 0x200;
pub const O_NOFOLLOW: c_int = 0x1000000;
pub const O_DIRECTORY: c_int = 0x80000;
pub const O_SEARCH: c_int = 0x20;
pub const O_EXEC: c_int = 0x20;
pub const O_CLOEXEC: c_int = 0x800000;
pub const O_ACCMODE: c_int = O_RDONLY | O_WRONLY | O_RDWR;
pub const O_DIRECT: c_int = 0x8000000;
pub const O_TTY_INIT: c_int = 0;
pub const O_RSYNC: c_int = 0x200000;
pub const O_LARGEFILE: c_int = 0x4000000;
pub const F_CLOSEM: c_int = 10;
pub const F_DUPFD_CLOEXEC: c_int = 16;
pub const F_GETLK64: c_int = 11;
pub const F_SETLK64: c_int = 12;
pub const F_SETLKW64: c_int = 13;
pub const F_DUP2FD: c_int = 14;
pub const F_TSTLK: c_int = 15;
pub const F_GETLK: c_int = F_GETLK64;
pub const F_SETLK: c_int = F_SETLK64;
pub const F_SETLKW: c_int = F_SETLKW64;
pub const F_GETOWN: c_int = 8;
pub const F_SETOWN: c_int = 9;
pub const AT_FDCWD: c_int = -2;
pub const AT_SYMLINK_NOFOLLOW: c_int = 1;
pub const AT_SYMLINK_FOLLOW: c_int = 2;
pub const AT_REMOVEDIR: c_int = 1;
pub const AT_EACCESS: c_int = 1;
pub const F_DUPFD: c_int = 0;
pub const F_GETFD: c_int = 1;
pub const F_SETFD: c_int = 2;
pub const F_GETFL: c_int = 3;
pub const F_SETFL: c_int = 4;
pub const O_SYNC: c_int = 16;
pub const O_NONBLOCK: c_int = 4;
pub const FASYNC: c_int = 0x20000;
pub const POSIX_FADV_NORMAL: c_int = 1;
pub const POSIX_FADV_SEQUENTIAL: c_int = 2;
pub const POSIX_FADV_RANDOM: c_int = 3;
pub const POSIX_FADV_WILLNEED: c_int = 4;
pub const POSIX_FADV_DONTNEED: c_int = 5;
pub const POSIX_FADV_NOREUSE: c_int = 6;
// glob.h
pub const GLOB_APPEND: c_int = 0x1;
pub const GLOB_DOOFFS: c_int = 0x2;
pub const GLOB_ERR: c_int = 0x4;
pub const GLOB_MARK: c_int = 0x8;
pub const GLOB_NOCHECK: c_int = 0x10;
pub const GLOB_NOSORT: c_int = 0x20;
pub const GLOB_NOESCAPE: c_int = 0x80;
pub const GLOB_NOSPACE: c_int = 0x2000;
pub const GLOB_ABORTED: c_int = 0x1000;
pub const GLOB_NOMATCH: c_int = 0x4000;
pub const GLOB_NOSYS: c_int = 0x8000;
// langinfo.h
pub const DAY_1: crate::nl_item = 13;
pub const DAY_2: crate::nl_item = 14;
pub const DAY_3: crate::nl_item = 15;
pub const DAY_4: crate::nl_item = 16;
pub const DAY_5: crate::nl_item = 17;
pub const DAY_6: crate::nl_item = 18;
pub const DAY_7: crate::nl_item = 19;
pub const ABDAY_1: crate::nl_item = 6;
pub const ABDAY_2: crate::nl_item = 7;
pub const ABDAY_3: crate::nl_item = 8;
pub const ABDAY_4: crate::nl_item = 9;
pub const ABDAY_5: crate::nl_item = 10;
pub const ABDAY_6: crate::nl_item = 11;
pub const ABDAY_7: crate::nl_item = 12;
pub const MON_1: crate::nl_item = 32;
pub const MON_2: crate::nl_item = 33;
pub const MON_3: crate::nl_item = 34;
pub const MON_4: crate::nl_item = 35;
pub const MON_5: crate::nl_item = 36;
pub const MON_6: crate::nl_item = 37;
pub const MON_7: crate::nl_item = 38;
pub const MON_8: crate::nl_item = 39;
pub const MON_9: crate::nl_item = 40;
pub const MON_10: crate::nl_item = 41;
pub const MON_11: crate::nl_item = 42;
pub const MON_12: crate::nl_item = 43;
pub const ABMON_1: crate::nl_item = 20;
pub const ABMON_2: crate::nl_item = 21;
pub const ABMON_3: crate::nl_item = 22;
pub const ABMON_4: crate::nl_item = 23;
pub const ABMON_5: crate::nl_item = 24;
pub const ABMON_6: crate::nl_item = 25;
pub const ABMON_7: crate::nl_item = 26;
pub const ABMON_8: crate::nl_item = 27;
pub const ABMON_9: crate::nl_item = 28;
pub const ABMON_10: crate::nl_item = 29;
pub const ABMON_11: crate::nl_item = 30;
pub const ABMON_12: crate::nl_item = 31;
pub const RADIXCHAR: crate::nl_item = 44;
pub const THOUSEP: crate::nl_item = 45;
pub const YESSTR: crate::nl_item = 46;
pub const NOSTR: crate::nl_item = 47;
pub const CRNCYSTR: crate::nl_item = 48;
pub const D_T_FMT: crate::nl_item = 1;
pub const D_FMT: crate::nl_item = 2;
pub const T_FMT: crate::nl_item = 3;
pub const AM_STR: crate::nl_item = 4;
pub const PM_STR: crate::nl_item = 5;
pub const CODESET: crate::nl_item = 49;
pub const T_FMT_AMPM: crate::nl_item = 55;
pub const ERA: crate::nl_item = 56;
pub const ERA_D_FMT: crate::nl_item = 57;
pub const ERA_D_T_FMT: crate::nl_item = 58;
pub const ERA_T_FMT: crate::nl_item = 59;
pub const ALT_DIGITS: crate::nl_item = 60;
pub const YESEXPR: crate::nl_item = 61;
pub const NOEXPR: crate::nl_item = 62;
// locale.h
pub const LC_GLOBAL_LOCALE: crate::locale_t = -1isize as crate::locale_t;
pub const LC_CTYPE: c_int = 1;
pub const LC_NUMERIC: c_int = 3;
pub const LC_TIME: c_int = 4;
pub const LC_COLLATE: c_int = 0;
pub const LC_MONETARY: c_int = 2;
pub const LC_MESSAGES: c_int = 4;
pub const LC_ALL: c_int = -1;
pub const LC_CTYPE_MASK: c_int = 2;
pub const LC_NUMERIC_MASK: c_int = 16;
pub const LC_TIME_MASK: c_int = 32;
pub const LC_COLLATE_MASK: c_int = 1;
pub const LC_MONETARY_MASK: c_int = 8;
pub const LC_MESSAGES_MASK: c_int = 4;
pub const LC_ALL_MASK: c_int = LC_CTYPE_MASK
| LC_NUMERIC_MASK
| LC_TIME_MASK
| LC_COLLATE_MASK
| LC_MONETARY_MASK
| LC_MESSAGES_MASK;
// netdb.h
pub const NI_MAXHOST: crate::socklen_t = 1025;
pub const NI_MAXSERV: crate::socklen_t = 32;
pub const NI_NOFQDN: crate::socklen_t = 0x1;
pub const NI_NUMERICHOST: crate::socklen_t = 0x2;
pub const NI_NAMEREQD: crate::socklen_t = 0x4;
pub const NI_NUMERICSERV: crate::socklen_t = 0x8;
pub const NI_DGRAM: crate::socklen_t = 0x10;
pub const NI_NUMERICSCOPE: crate::socklen_t = 0x40;
pub const EAI_AGAIN: c_int = 2;
pub const EAI_BADFLAGS: c_int = 3;
pub const EAI_FAIL: c_int = 4;
pub const EAI_FAMILY: c_int = 5;
pub const EAI_MEMORY: c_int = 6;
pub const EAI_NODATA: c_int = 7;
pub const EAI_NONAME: c_int = 8;
pub const EAI_SERVICE: c_int = 9;
pub const EAI_SOCKTYPE: c_int = 10;
pub const EAI_SYSTEM: c_int = 11;
pub const EAI_OVERFLOW: c_int = 13;
pub const AI_CANONNAME: c_int = 0x01;
pub const AI_PASSIVE: c_int = 0x02;
pub const AI_NUMERICHOST: c_int = 0x04;
pub const AI_ADDRCONFIG: c_int = 0x08;
pub const AI_V4MAPPED: c_int = 0x10;
pub const AI_ALL: c_int = 0x20;
pub const AI_NUMERICSERV: c_int = 0x40;
pub const AI_EXTFLAGS: c_int = 0x80;
pub const AI_DEFAULT: c_int = AI_V4MAPPED | AI_ADDRCONFIG;
pub const IPV6_ADDRFORM: c_int = 22;
pub const IPV6_ADDR_PREFERENCES: c_int = 74;
pub const IPV6_CHECKSUM: c_int = 39;
pub const IPV6_DONTFRAG: c_int = 45;
pub const IPV6_DSTOPTS: c_int = 54;
pub const IPV6_FLOWINFO_FLOWLABEL: c_int = 16777215;
pub const IPV6_FLOWINFO_PRIORITY: c_int = 251658240;
pub const IPV6_HOPLIMIT: c_int = 40;
pub const IPV6_HOPOPTS: c_int = 52;
pub const IPV6_NEXTHOP: c_int = 48;
pub const IPV6_PATHMTU: c_int = 46;
pub const IPV6_PKTINFO: c_int = 33;
pub const IPV6_PREFER_SRC_CGA: c_int = 16;
pub const IPV6_PREFER_SRC_COA: c_int = 2;
pub const IPV6_PREFER_SRC_HOME: c_int = 1;
pub const IPV6_PREFER_SRC_NONCGA: c_int = 32;
pub const IPV6_PREFER_SRC_PUBLIC: c_int = 4;
pub const IPV6_PREFER_SRC_TMP: c_int = 8;
pub const IPV6_RECVDSTOPTS: c_int = 56;
pub const IPV6_RECVHOPLIMIT: c_int = 41;
pub const IPV6_RECVHOPOPTS: c_int = 53;
pub const IPV6_RECVPATHMTU: c_int = 47;
pub const IPV6_RECVRTHDR: c_int = 51;
pub const IPV6_RECVTCLASS: c_int = 42;
pub const IPV6_RTHDR: c_int = 50;
pub const IPV6_RTHDRDSTOPTS: c_int = 55;
pub const IPV6_TCLASS: c_int = 43;
// net/bpf.h
pub const DLT_NULL: c_int = 0x18;
pub const DLT_EN10MB: c_int = 0x6;
pub const DLT_EN3MB: c_int = 0x1a;
pub const DLT_AX25: c_int = 0x5;
pub const DLT_PRONET: c_int = 0xd;
pub const DLT_IEEE802: c_int = 0x7;
pub const DLT_ARCNET: c_int = 0x23;
pub const DLT_SLIP: c_int = 0x1c;
pub const DLT_PPP: c_int = 0x17;
pub const DLT_FDDI: c_int = 0xf;
pub const DLT_ATM: c_int = 0x25;
pub const DLT_IPOIB: c_int = 0xc7;
pub const BIOCSETF: c_ulong = 0x80104267;
pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e;
pub const BIOCGBLEN: c_int = 0x40044266;
pub const BIOCSBLEN: c_int = 0xc0044266;
pub const BIOCFLUSH: c_int = 0x20004268;
pub const BIOCPROMISC: c_int = 0x20004269;
pub const BIOCGDLT: c_int = 0x4004426a;
pub const BIOCSRTIMEOUT: c_int = 0x8010426d;
pub const BIOCGSTATS: c_int = 0x4008426f;
pub const BIOCIMMEDIATE: c_int = 0x80044270;
pub const BIOCVERSION: c_int = 0x40044271;
pub const BIOCSDEVNO: c_int = 0x20004272;
pub const BIOCGETIF: c_ulong = 0x4020426b;
pub const BIOCSETIF: c_ulong = 0xffffffff8020426c;
pub const BPF_ABS: c_int = 32;
pub const BPF_ADD: c_int = 0;
pub const BPF_ALIGNMENT: c_ulong = 4;
pub const BPF_ALU: c_int = 4;
pub const BPF_AND: c_int = 80;
pub const BPF_B: c_int = 16;
pub const BPF_DIV: c_int = 48;
pub const BPF_H: c_int = 8;
pub const BPF_IMM: c_int = 0;
pub const BPF_IND: c_int = 64;
pub const BPF_JA: c_int = 0;
pub const BPF_JEQ: c_int = 16;
pub const BPF_JGE: c_int = 48;
pub const BPF_JGT: c_int = 32;
pub const BPF_JMP: c_int = 5;
pub const BPF_JSET: c_int = 64;
pub const BPF_K: c_int = 0;
pub const BPF_LD: c_int = 0;
pub const BPF_LDX: c_int = 1;
pub const BPF_LEN: c_int = 128;
pub const BPF_LSH: c_int = 96;
pub const BPF_MAXINSNS: c_int = 512;
pub const BPF_MEM: c_int = 96;
pub const BPF_MEMWORDS: c_int = 16;
pub const BPF_MISC: c_int = 7;
pub const BPF_MSH: c_int = 160;
pub const BPF_MUL: c_int = 32;
pub const BPF_NEG: c_int = 128;
pub const BPF_OR: c_int = 64;
pub const BPF_RET: c_int = 6;
pub const BPF_RSH: c_int = 112;
pub const BPF_ST: c_int = 2;
pub const BPF_STX: c_int = 3;
pub const BPF_SUB: c_int = 16;
pub const BPF_W: c_int = 0;
pub const BPF_X: c_int = 8;
// net/if.h
pub const IFNET_SLOWHZ: c_int = 1;
pub const IFQ_MAXLEN: c_int = 50;
pub const IFF_UP: c_int = 0x1;
pub const IFF_BROADCAST: c_int = 0x2;
pub const IFF_DEBUG: c_int = 0x4;
pub const IFF_LOOPBACK: c_int = 0x8;
pub const IFF_POINTOPOINT: c_int = 0x10;
pub const IFF_NOTRAILERS: c_int = 0x20;
pub const IFF_RUNNING: c_int = 0x40;
pub const IFF_NOARP: c_int = 0x80;
pub const IFF_PROMISC: c_int = 0x100;
pub const IFF_ALLMULTI: c_int = 0x200;
pub const IFF_MULTICAST: c_int = 0x80000;
pub const IFF_LINK0: c_int = 0x100000;
pub const IFF_LINK1: c_int = 0x200000;
pub const IFF_LINK2: c_int = 0x400000;
pub const IFF_OACTIVE: c_int = 0x400;
pub const IFF_SIMPLEX: c_int = 0x800;
// net/if_arp.h
pub const ARPHRD_ETHER: c_int = 1;
pub const ARPHRD_802_5: c_int = 6;
pub const ARPHRD_802_3: c_int = 6;
pub const ARPHRD_FDDI: c_int = 1;
// net/route.h
pub const RTM_ADD: c_int = 0x1;
pub const RTM_DELETE: c_int = 0x2;
pub const RTM_CHANGE: c_int = 0x3;
pub const RTM_GET: c_int = 0x4;
pub const RTM_LOSING: c_int = 0x5;
pub const RTM_REDIRECT: c_int = 0x6;
pub const RTM_MISS: c_int = 0x7;
pub const RTM_LOCK: c_int = 0x8;
pub const RTM_OLDADD: c_int = 0x9;
pub const RTM_OLDDEL: c_int = 0xa;
pub const RTM_RESOLVE: c_int = 0xb;
pub const RTM_NEWADDR: c_int = 0xc;
pub const RTM_DELADDR: c_int = 0xd;
pub const RTM_IFINFO: c_int = 0xe;
pub const RTM_EXPIRE: c_int = 0xf;
pub const RTM_RTLOST: c_int = 0x10;
pub const RTM_GETNEXT: c_int = 0x11;
pub const RTM_SAMEADDR: c_int = 0x12;
pub const RTM_SET: c_int = 0x13;
pub const RTV_MTU: c_int = 0x1;
pub const RTV_HOPCOUNT: c_int = 0x2;
pub const RTV_EXPIRE: c_int = 0x4;
pub const RTV_RPIPE: c_int = 0x8;
pub const RTV_SPIPE: c_int = 0x10;
pub const RTV_SSTHRESH: c_int = 0x20;
pub const RTV_RTT: c_int = 0x40;
pub const RTV_RTTVAR: c_int = 0x80;
pub const RTA_DST: c_int = 0x1;
pub const RTA_GATEWAY: c_int = 0x2;
pub const RTA_NETMASK: c_int = 0x4;
pub const RTA_GENMASK: c_int = 0x8;
pub const RTA_IFP: c_int = 0x10;
pub const RTA_IFA: c_int = 0x20;
pub const RTA_AUTHOR: c_int = 0x40;
pub const RTA_BRD: c_int = 0x80;
pub const RTA_DOWNSTREAM: c_int = 0x100;
pub const RTAX_DST: c_int = 0;
pub const RTAX_GATEWAY: c_int = 1;
pub const RTAX_NETMASK: c_int = 2;
pub const RTAX_GENMASK: c_int = 3;
pub const RTAX_IFP: c_int = 4;
pub const RTAX_IFA: c_int = 5;
pub const RTAX_AUTHOR: c_int = 6;
pub const RTAX_BRD: c_int = 7;
pub const RTAX_MAX: c_int = 8;
pub const RTF_UP: c_int = 0x1;
pub const RTF_GATEWAY: c_int = 0x2;
pub const RTF_HOST: c_int = 0x4;
pub const RTF_REJECT: c_int = 0x8;
pub const RTF_DYNAMIC: c_int = 0x10;
pub const RTF_MODIFIED: c_int = 0x20;
pub const RTF_DONE: c_int = 0x40;
pub const RTF_MASK: c_int = 0x80;
pub const RTF_CLONING: c_int = 0x100;
pub const RTF_XRESOLVE: c_int = 0x200;
pub const RTF_LLINFO: c_int = 0x400;
pub const RTF_STATIC: c_int = 0x800;
pub const RTF_BLACKHOLE: c_int = 0x1000;
pub const RTF_BUL: c_int = 0x2000;
pub const RTF_PROTO2: c_int = 0x4000;
pub const RTF_PROTO1: c_int = 0x8000;
pub const RTF_CLONE: c_int = 0x10000;
pub const RTF_CLONED: c_int = 0x20000;
pub const RTF_PROTO3: c_int = 0x40000;
pub const RTF_BCE: c_int = 0x80000;
pub const RTF_PINNED: c_int = 0x100000;
pub const RTF_LOCAL: c_int = 0x200000;
pub const RTF_BROADCAST: c_int = 0x400000;
pub const RTF_MULTICAST: c_int = 0x800000;
pub const RTF_ACTIVE_DGD: c_int = 0x1000000;
pub const RTF_STOPSRCH: c_int = 0x2000000;
pub const RTF_FREE_IN_PROG: c_int = 0x4000000;
pub const RTF_PERMANENT6: c_int = 0x8000000;
pub const RTF_UNREACHABLE: c_int = 0x10000000;
pub const RTF_CACHED: c_int = 0x20000000;
pub const RTF_SMALLMTU: c_int = 0x40000;