1 //! Linux-specific definitions for linux-like values
2 
3 use dox::{mem, Option};
4 
5 pub type useconds_t = u32;
6 pub type dev_t = u64;
7 pub type socklen_t = u32;
8 pub type pthread_t = c_ulong;
9 pub type mode_t = u32;
10 pub type ino64_t = u64;
11 pub type off64_t = i64;
12 pub type blkcnt64_t = i64;
13 pub type rlim64_t = u64;
14 pub type mqd_t = ::c_int;
15 pub type nfds_t = ::c_ulong;
16 pub type nl_item = ::c_int;
17 pub type idtype_t = ::c_uint;
18 pub type loff_t = ::c_longlong;
19 
20 pub type __u8 = ::c_uchar;
21 pub type __u16 = ::c_ushort;
22 pub type __s16 = ::c_short;
23 pub type __u32 = ::c_uint;
24 pub type __s32 = ::c_int;
25 
26 pub type Elf32_Half = u16;
27 pub type Elf32_Word = u32;
28 pub type Elf32_Off = u32;
29 pub type Elf32_Addr = u32;
30 
31 pub type Elf64_Half = u16;
32 pub type Elf64_Word = u32;
33 pub type Elf64_Off = u64;
34 pub type Elf64_Addr = u64;
35 pub type Elf64_Xword = u64;
36 
37 pub enum fpos64_t {} // TODO: fill this out with a struct
38 
39 s! {
40     pub struct dirent {
41         pub d_ino: ::ino_t,
42         pub d_off: ::off_t,
43         pub d_reclen: ::c_ushort,
44         pub d_type: ::c_uchar,
45         pub d_name: [::c_char; 256],
46     }
47 
48     pub struct dirent64 {
49         pub d_ino: ::ino64_t,
50         pub d_off: ::off64_t,
51         pub d_reclen: ::c_ushort,
52         pub d_type: ::c_uchar,
53         pub d_name: [::c_char; 256],
54     }
55 
56     pub struct rlimit64 {
57         pub rlim_cur: rlim64_t,
58         pub rlim_max: rlim64_t,
59     }
60 
61     pub struct glob_t {
62         pub gl_pathc: ::size_t,
63         pub gl_pathv: *mut *mut c_char,
64         pub gl_offs: ::size_t,
65         pub gl_flags: ::c_int,
66 
67         __unused1: *mut ::c_void,
68         __unused2: *mut ::c_void,
69         __unused3: *mut ::c_void,
70         __unused4: *mut ::c_void,
71         __unused5: *mut ::c_void,
72     }
73 
74     #[cfg_attr(all(feature = "align",
75                    target_pointer_width = "32",
76                    any(target_arch = "mips",
77                        target_arch = "arm",
78                        target_arch = "powerpc",
79                        target_arch = "x86_64",
80                        target_arch = "x86")),
81                repr(align(4)))]
82     #[cfg_attr(all(feature = "align",
83                    any(target_pointer_width = "64",
84                        not(any(target_arch = "mips",
85                                target_arch = "arm",
86                                target_arch = "powerpc",
87                                target_arch = "x86_64",
88                                target_arch = "x86")))),
89                repr(align(8)))]
90     pub struct pthread_mutex_t {
91         #[cfg(all(not(feature = "align"),
92                   any(target_arch = "mips",
93                       target_arch = "arm",
94                       target_arch = "powerpc",
95                       all(target_arch = "x86_64",
96                           target_pointer_width = "32"))))]
97         __align: [::c_long; 0],
98         #[cfg(not(any(feature = "align",
99                       target_arch = "mips",
100                       target_arch = "arm",
101                       target_arch = "powerpc",
102                       all(target_arch = "x86_64",
103                           target_pointer_width = "32"))))]
104         __align: [::c_longlong; 0],
105         size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
106     }
107 
108     #[cfg_attr(all(feature = "align",
109                    target_pointer_width = "32",
110                    any(target_arch = "mips",
111                        target_arch = "arm",
112                        target_arch = "powerpc",
113                        target_arch = "x86_64",
114                        target_arch = "x86")),
115                repr(align(4)))]
116     #[cfg_attr(all(feature = "align",
117                    any(target_pointer_width = "64",
118                        not(any(target_arch = "mips",
119                                target_arch = "arm",
120                                target_arch = "powerpc",
121                                target_arch = "x86_64",
122                                target_arch = "x86")))),
123                repr(align(8)))]
124     pub struct pthread_rwlock_t {
125         #[cfg(all(not(feature = "align"),
126                   any(target_arch = "mips",
127                       target_arch = "arm",
128                       target_arch = "powerpc",
129                       all(target_arch = "x86_64",
130                           target_pointer_width = "32"))))]
131         __align: [::c_long; 0],
132         #[cfg(not(any(feature = "align",
133                       target_arch = "mips",
134                       target_arch = "arm",
135                       target_arch = "powerpc",
136                       all(target_arch = "x86_64",
137                           target_pointer_width = "32"))))]
138         __align: [::c_longlong; 0],
139         size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
140     }
141 
142     #[cfg_attr(all(feature = "align",
143                    any(target_pointer_width = "32",
144                        target_arch = "x86_64", target_arch = "powerpc64",
145                        target_arch = "mips64", target_arch = "s390x",
146                        target_arch = "sparc64",
147                        all(target_arch = "aarch64", target_env = "musl"))),
148                repr(align(4)))]
149     #[cfg_attr(all(feature = "align",
150                    not(any(target_pointer_width = "32",
151                            target_arch = "x86_64", target_arch = "powerpc64",
152                            target_arch = "mips64", target_arch = "s390x",
153                            target_arch = "sparc64",
154                            all(target_arch = "aarch64", target_env = "musl")))),
155                repr(align(8)))]
156     pub struct pthread_mutexattr_t {
157         #[cfg(all(not(features = "align"),
158                   any(target_arch = "x86_64", target_arch = "powerpc64",
159                       target_arch = "mips64", target_arch = "s390x",
160                       target_arch = "sparc64",
161                       all(target_arch = "aarch64", target_env = "musl"))))]
162         __align: [::c_int; 0],
163         #[cfg(all(not(features = "align"),
164                   not(any(target_arch = "x86_64", target_arch = "powerpc64",
165                           target_arch = "mips64", target_arch = "s390x",
166                           target_arch = "sparc64",
167                           all(target_arch = "aarch64", target_env = "musl")))))]
168         __align: [::c_long; 0],
169         size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
170     }
171 
172     #[cfg_attr(all(feature = "align",
173                    any(target_env = "musl", target_pointer_width = "32")),
174                repr(align(4)))]
175     #[cfg_attr(all(feature = "align",
176                    not(target_env = "musl"),
177                    target_pointer_width = "64"),
178                repr(align(8)))]
179     pub struct pthread_rwlockattr_t {
180         #[cfg(all(not(feature = "align"), target_env = "musl"))]
181         __align: [::c_int; 0],
182         #[cfg(all(not(feature = "align"), not(target_env = "musl")))]
183         __align: [::c_long; 0],
184         size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
185     }
186 
187     #[cfg_attr(all(feature = "align",
188                    target_env = "musl",
189                    target_pointer_width = "32"),
190                repr(align(4)))]
191     #[cfg_attr(all(feature = "align",
192                    target_env = "musl",
193                    target_pointer_width = "64"),
194                repr(align(8)))]
195     #[cfg_attr(all(feature = "align",
196                    not(target_env = "musl"),
197                    target_arch = "x86"),
198                repr(align(4)))]
199     #[cfg_attr(all(feature = "align",
200                    not(target_env = "musl"),
201                    not(target_arch = "x86")),
202                repr(align(8)))]
203     pub struct pthread_cond_t {
204         #[cfg(all(not(feature = "align"), target_env = "musl"))]
205         __align: [*const ::c_void; 0],
206         #[cfg(not(any(feature = "align", target_env = "musl")))]
207         __align: [::c_longlong; 0],
208         size: [u8; __SIZEOF_PTHREAD_COND_T],
209     }
210 
211     #[cfg_attr(feature = "align", repr(align(4)))]
212     pub struct pthread_condattr_t {
213         #[cfg(not(feature = "align"))]
214         __align: [::c_int; 0],
215         size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
216     }
217 
218     pub struct passwd {
219         pub pw_name: *mut ::c_char,
220         pub pw_passwd: *mut ::c_char,
221         pub pw_uid: ::uid_t,
222         pub pw_gid: ::gid_t,
223         pub pw_gecos: *mut ::c_char,
224         pub pw_dir: *mut ::c_char,
225         pub pw_shell: *mut ::c_char,
226     }
227 
228     pub struct spwd {
229         pub sp_namp: *mut ::c_char,
230         pub sp_pwdp: *mut ::c_char,
231         pub sp_lstchg: ::c_long,
232         pub sp_min: ::c_long,
233         pub sp_max: ::c_long,
234         pub sp_warn: ::c_long,
235         pub sp_inact: ::c_long,
236         pub sp_expire: ::c_long,
237         pub sp_flag: ::c_ulong,
238     }
239 
240     pub struct dqblk {
241         pub dqb_bhardlimit: ::uint64_t,
242         pub dqb_bsoftlimit: ::uint64_t,
243         pub dqb_curspace: ::uint64_t,
244         pub dqb_ihardlimit: ::uint64_t,
245         pub dqb_isoftlimit: ::uint64_t,
246         pub dqb_curinodes: ::uint64_t,
247         pub dqb_btime: ::uint64_t,
248         pub dqb_itime: ::uint64_t,
249         pub dqb_valid: ::uint32_t,
250     }
251 
252     pub struct signalfd_siginfo {
253         pub ssi_signo: ::uint32_t,
254         pub ssi_errno: ::int32_t,
255         pub ssi_code: ::int32_t,
256         pub ssi_pid: ::uint32_t,
257         pub ssi_uid: ::uint32_t,
258         pub ssi_fd: ::int32_t,
259         pub ssi_tid: ::uint32_t,
260         pub ssi_band: ::uint32_t,
261         pub ssi_overrun: ::uint32_t,
262         pub ssi_trapno: ::uint32_t,
263         pub ssi_status: ::int32_t,
264         pub ssi_int: ::int32_t,
265         pub ssi_ptr: ::uint64_t,
266         pub ssi_utime: ::uint64_t,
267         pub ssi_stime: ::uint64_t,
268         pub ssi_addr: ::uint64_t,
269         _pad: [::uint8_t; 48],
270     }
271 
272     pub struct itimerspec {
273         pub it_interval: ::timespec,
274         pub it_value: ::timespec,
275     }
276 
277     pub struct fsid_t {
278         __val: [::c_int; 2],
279     }
280 
281     // x32 compatibility
282     // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
283     pub struct mq_attr {
284         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
285         pub mq_flags: i64,
286         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
287         pub mq_maxmsg: i64,
288         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
289         pub mq_msgsize: i64,
290         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
291         pub mq_curmsgs: i64,
292         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
293         pad: [i64; 4],
294 
295         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
296         pub mq_flags: ::c_long,
297         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
298         pub mq_maxmsg: ::c_long,
299         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
300         pub mq_msgsize: ::c_long,
301         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
302         pub mq_curmsgs: ::c_long,
303         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
304         pad: [::c_long; 4],
305     }
306 
307     pub struct packet_mreq {
308         pub mr_ifindex: ::c_int,
309         pub mr_type: ::c_ushort,
310         pub mr_alen: ::c_ushort,
311         pub mr_address: [::c_uchar; 8],
312     }
313 
314     pub struct cpu_set_t {
315         #[cfg(all(target_pointer_width = "32",
316                   not(target_arch = "x86_64")))]
317         bits: [u32; 32],
318         #[cfg(not(all(target_pointer_width = "32",
319                       not(target_arch = "x86_64"))))]
320         bits: [u64; 16],
321     }
322 
323     pub struct if_nameindex {
324         pub if_index: ::c_uint,
325         pub if_name: *mut ::c_char,
326     }
327 
328     // System V IPC
329     pub struct msginfo {
330         pub msgpool: ::c_int,
331         pub msgmap: ::c_int,
332         pub msgmax: ::c_int,
333         pub msgmnb: ::c_int,
334         pub msgmni: ::c_int,
335         pub msgssz: ::c_int,
336         pub msgtql: ::c_int,
337         pub msgseg: ::c_ushort,
338     }
339 
340     pub struct mmsghdr {
341         pub msg_hdr: ::msghdr,
342         pub msg_len: ::c_uint,
343     }
344 
345     pub struct sembuf {
346         pub sem_num: ::c_ushort,
347         pub sem_op: ::c_short,
348         pub sem_flg: ::c_short,
349     }
350 
351     pub struct input_event {
352         pub time: ::timeval,
353         pub type_: ::__u16,
354         pub code: ::__u16,
355         pub value: ::__s32,
356     }
357 
358     pub struct input_id {
359         pub bustype: ::__u16,
360         pub vendor: ::__u16,
361         pub product: ::__u16,
362         pub version: ::__u16,
363     }
364 
365     pub struct input_absinfo {
366         pub value: ::__s32,
367         pub minimum: ::__s32,
368         pub maximum: ::__s32,
369         pub fuzz: ::__s32,
370         pub flat: ::__s32,
371         pub resolution: ::__s32,
372     }
373 
374     pub struct input_keymap_entry {
375         pub flags: ::__u8,
376         pub len: ::__u8,
377         pub index: ::__u16,
378         pub keycode: ::__u32,
379         pub scancode: [::__u8; 32],
380     }
381 
382     pub struct input_mask {
383         pub type_: ::__u32,
384         pub codes_size: ::__u32,
385         pub codes_ptr: ::__u64,
386     }
387 
388     pub struct ff_replay {
389         pub length: ::__u16,
390         pub delay: ::__u16,
391     }
392 
393     pub struct ff_trigger {
394         pub button: ::__u16,
395         pub interval: ::__u16,
396     }
397 
398     pub struct ff_envelope {
399         pub attack_length: ::__u16,
400         pub attack_level: ::__u16,
401         pub fade_length: ::__u16,
402         pub fade_level: ::__u16,
403     }
404 
405     pub struct ff_constant_effect {
406         pub level: ::__s16,
407         pub envelope: ff_envelope,
408     }
409 
410     pub struct ff_ramp_effect {
411         pub start_level: ::__s16,
412         pub end_level: ::__s16,
413         pub envelope: ff_envelope,
414     }
415 
416     pub struct ff_condition_effect {
417         pub right_saturation: ::__u16,
418         pub left_saturation: ::__u16,
419 
420         pub right_coeff: ::__s16,
421         pub left_coeff: ::__s16,
422 
423         pub deadband: ::__u16,
424         pub center: ::__s16,
425     }
426 
427     pub struct ff_periodic_effect {
428         pub waveform: ::__u16,
429         pub period: ::__u16,
430         pub magnitude: ::__s16,
431         pub offset: ::__s16,
432         pub phase: ::__u16,
433 
434         pub envelope: ff_envelope,
435 
436         pub custom_len: ::__u32,
437         pub custom_data: *mut ::__s16,
438     }
439 
440     pub struct ff_rumble_effect {
441         pub strong_magnitude: ::__u16,
442         pub weak_magnitude: ::__u16,
443     }
444 
445     pub struct ff_effect {
446         pub type_: ::__u16,
447         pub id: ::__s16,
448         pub direction: ::__u16,
449         pub trigger: ff_trigger,
450         pub replay: ff_replay,
451         // FIXME this is actually a union
452         #[cfg(target_pointer_width = "64")]
453         pub u: [u64; 4],
454         #[cfg(target_pointer_width = "32")]
455         pub u: [u32; 7],
456     }
457 
458     pub struct dl_phdr_info {
459         #[cfg(target_pointer_width = "64")]
460         pub dlpi_addr: Elf64_Addr,
461         #[cfg(target_pointer_width = "32")]
462         pub dlpi_addr: Elf32_Addr,
463 
464         pub dlpi_name: *const ::c_char,
465 
466         #[cfg(target_pointer_width = "64")]
467         pub dlpi_phdr: *const Elf64_Phdr,
468         #[cfg(target_pointer_width = "32")]
469         pub dlpi_phdr: *const Elf32_Phdr,
470 
471         #[cfg(target_pointer_width = "64")]
472         pub dlpi_phnum: Elf64_Half,
473         #[cfg(target_pointer_width = "32")]
474         pub dlpi_phnum: Elf32_Half,
475 
476         pub dlpi_adds: ::c_ulonglong,
477         pub dlpi_subs: ::c_ulonglong,
478         pub dlpi_tls_modid: ::size_t,
479         pub dlpi_tls_data: *mut ::c_void,
480     }
481 
482     pub struct Elf32_Phdr {
483         pub p_type: Elf32_Word,
484         pub p_offset: Elf32_Off,
485         pub p_vaddr: Elf32_Addr,
486         pub p_paddr: Elf32_Addr,
487         pub p_filesz: Elf32_Word,
488         pub p_memsz: Elf32_Word,
489         pub p_flags: Elf32_Word,
490         pub p_align: Elf32_Word,
491     }
492 
493     pub struct Elf64_Phdr {
494         pub p_type: Elf64_Word,
495         pub p_flags: Elf64_Word,
496         pub p_offset: Elf64_Off,
497         pub p_vaddr: Elf64_Addr,
498         pub p_paddr: Elf64_Addr,
499         pub p_filesz: Elf64_Xword,
500         pub p_memsz: Elf64_Xword,
501         pub p_align: Elf64_Xword,
502     }
503 
504     pub struct ucred {
505         pub pid: ::pid_t,
506         pub uid: ::uid_t,
507         pub gid: ::gid_t,
508     }
509 
510     pub struct mntent {
511         pub mnt_fsname: *mut ::c_char,
512         pub mnt_dir: *mut ::c_char,
513         pub mnt_type: *mut ::c_char,
514         pub mnt_opts: *mut ::c_char,
515         pub mnt_freq: ::c_int,
516         pub mnt_passno: ::c_int,
517     }
518 
519     pub struct posix_spawn_file_actions_t {
520         __allocated: ::c_int,
521         __used: ::c_int,
522         __actions: *mut ::c_int,
523         __pad: [::c_int; 16],
524     }
525 
526     pub struct posix_spawnattr_t {
527         __flags: ::c_short,
528         __pgrp: ::pid_t,
529         __sd: ::sigset_t,
530         __ss: ::sigset_t,
531         #[cfg(target_env = "musl")]
532         __prio: ::c_int,
533         #[cfg(not(target_env = "musl"))]
534         __sp: ::sched_param,
535         __policy: ::c_int,
536         __pad: [::c_int; 16],
537     }
538 
539     pub struct genlmsghdr {
540         pub cmd: u8,
541         pub version: u8,
542         pub reserved: u16,
543     }
544 
545     pub struct in6_pktinfo {
546         pub ipi6_addr: ::in6_addr,
547         pub ipi6_ifindex: ::c_uint,
548     }
549 
550     pub struct arpd_request {
551         pub req: ::c_ushort,
552         pub ip: u32,
553         pub dev: ::c_ulong,
554         pub stamp: ::c_ulong,
555         pub updated: ::c_ulong,
556         pub ha: [::c_uchar; ::MAX_ADDR_LEN],
557     }
558 }
559 
560 pub const ABDAY_1: ::nl_item = 0x20000;
561 pub const ABDAY_2: ::nl_item = 0x20001;
562 pub const ABDAY_3: ::nl_item = 0x20002;
563 pub const ABDAY_4: ::nl_item = 0x20003;
564 pub const ABDAY_5: ::nl_item = 0x20004;
565 pub const ABDAY_6: ::nl_item = 0x20005;
566 pub const ABDAY_7: ::nl_item = 0x20006;
567 
568 pub const DAY_1: ::nl_item = 0x20007;
569 pub const DAY_2: ::nl_item = 0x20008;
570 pub const DAY_3: ::nl_item = 0x20009;
571 pub const DAY_4: ::nl_item = 0x2000A;
572 pub const DAY_5: ::nl_item = 0x2000B;
573 pub const DAY_6: ::nl_item = 0x2000C;
574 pub const DAY_7: ::nl_item = 0x2000D;
575 
576 pub const ABMON_1: ::nl_item = 0x2000E;
577 pub const ABMON_2: ::nl_item = 0x2000F;
578 pub const ABMON_3: ::nl_item = 0x20010;
579 pub const ABMON_4: ::nl_item = 0x20011;
580 pub const ABMON_5: ::nl_item = 0x20012;
581 pub const ABMON_6: ::nl_item = 0x20013;
582 pub const ABMON_7: ::nl_item = 0x20014;
583 pub const ABMON_8: ::nl_item = 0x20015;
584 pub const ABMON_9: ::nl_item = 0x20016;
585 pub const ABMON_10: ::nl_item = 0x20017;
586 pub const ABMON_11: ::nl_item = 0x20018;
587 pub const ABMON_12: ::nl_item = 0x20019;
588 
589 pub const MON_1: ::nl_item = 0x2001A;
590 pub const MON_2: ::nl_item = 0x2001B;
591 pub const MON_3: ::nl_item = 0x2001C;
592 pub const MON_4: ::nl_item = 0x2001D;
593 pub const MON_5: ::nl_item = 0x2001E;
594 pub const MON_6: ::nl_item = 0x2001F;
595 pub const MON_7: ::nl_item = 0x20020;
596 pub const MON_8: ::nl_item = 0x20021;
597 pub const MON_9: ::nl_item = 0x20022;
598 pub const MON_10: ::nl_item = 0x20023;
599 pub const MON_11: ::nl_item = 0x20024;
600 pub const MON_12: ::nl_item = 0x20025;
601 
602 pub const AM_STR: ::nl_item = 0x20026;
603 pub const PM_STR: ::nl_item = 0x20027;
604 
605 pub const D_T_FMT: ::nl_item = 0x20028;
606 pub const D_FMT: ::nl_item = 0x20029;
607 pub const T_FMT: ::nl_item = 0x2002A;
608 pub const T_FMT_AMPM: ::nl_item = 0x2002B;
609 
610 pub const ERA: ::nl_item = 0x2002C;
611 pub const ERA_D_FMT: ::nl_item = 0x2002E;
612 pub const ALT_DIGITS: ::nl_item = 0x2002F;
613 pub const ERA_D_T_FMT: ::nl_item = 0x20030;
614 pub const ERA_T_FMT: ::nl_item = 0x20031;
615 
616 pub const CODESET: ::nl_item = 14;
617 
618 pub const CRNCYSTR: ::nl_item = 0x4000F;
619 
620 pub const RUSAGE_THREAD: ::c_int = 1;
621 pub const RUSAGE_CHILDREN: ::c_int = -1;
622 
623 pub const RADIXCHAR: ::nl_item = 0x10000;
624 pub const THOUSEP: ::nl_item = 0x10001;
625 
626 pub const YESEXPR: ::nl_item = 0x50000;
627 pub const NOEXPR: ::nl_item = 0x50001;
628 pub const YESSTR: ::nl_item = 0x50002;
629 pub const NOSTR: ::nl_item = 0x50003;
630 
631 pub const FILENAME_MAX: ::c_uint = 4096;
632 pub const L_tmpnam: ::c_uint = 20;
633 pub const _PC_LINK_MAX: ::c_int = 0;
634 pub const _PC_MAX_CANON: ::c_int = 1;
635 pub const _PC_MAX_INPUT: ::c_int = 2;
636 pub const _PC_NAME_MAX: ::c_int = 3;
637 pub const _PC_PATH_MAX: ::c_int = 4;
638 pub const _PC_PIPE_BUF: ::c_int = 5;
639 pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
640 pub const _PC_NO_TRUNC: ::c_int = 7;
641 pub const _PC_VDISABLE: ::c_int = 8;
642 pub const _PC_SYNC_IO: ::c_int = 9;
643 pub const _PC_ASYNC_IO: ::c_int = 10;
644 pub const _PC_PRIO_IO: ::c_int = 11;
645 pub const _PC_SOCK_MAXBUF: ::c_int = 12;
646 pub const _PC_FILESIZEBITS: ::c_int = 13;
647 pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
648 pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
649 pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
650 pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
651 pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
652 pub const _PC_SYMLINK_MAX: ::c_int = 19;
653 pub const _PC_2_SYMLINKS: ::c_int = 20;
654 
655 pub const _SC_ARG_MAX: ::c_int = 0;
656 pub const _SC_CHILD_MAX: ::c_int = 1;
657 pub const _SC_CLK_TCK: ::c_int = 2;
658 pub const _SC_NGROUPS_MAX: ::c_int = 3;
659 pub const _SC_OPEN_MAX: ::c_int = 4;
660 pub const _SC_STREAM_MAX: ::c_int = 5;
661 pub const _SC_TZNAME_MAX: ::c_int = 6;
662 pub const _SC_JOB_CONTROL: ::c_int = 7;
663 pub const _SC_SAVED_IDS: ::c_int = 8;
664 pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
665 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
666 pub const _SC_TIMERS: ::c_int = 11;
667 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
668 pub const _SC_PRIORITIZED_IO: ::c_int = 13;
669 pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
670 pub const _SC_FSYNC: ::c_int = 15;
671 pub const _SC_MAPPED_FILES: ::c_int = 16;
672 pub const _SC_MEMLOCK: ::c_int = 17;
673 pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
674 pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
675 pub const _SC_MESSAGE_PASSING: ::c_int = 20;
676 pub const _SC_SEMAPHORES: ::c_int = 21;
677 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
678 pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
679 pub const _SC_AIO_MAX: ::c_int = 24;
680 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
681 pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
682 pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
683 pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
684 pub const _SC_VERSION: ::c_int = 29;
685 pub const _SC_PAGESIZE: ::c_int = 30;
686 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
687 pub const _SC_RTSIG_MAX: ::c_int = 31;
688 pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
689 pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
690 pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
691 pub const _SC_TIMER_MAX: ::c_int = 35;
692 pub const _SC_BC_BASE_MAX: ::c_int = 36;
693 pub const _SC_BC_DIM_MAX: ::c_int = 37;
694 pub const _SC_BC_SCALE_MAX: ::c_int = 38;
695 pub const _SC_BC_STRING_MAX: ::c_int = 39;
696 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
697 pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
698 pub const _SC_LINE_MAX: ::c_int = 43;
699 pub const _SC_RE_DUP_MAX: ::c_int = 44;
700 pub const _SC_2_VERSION: ::c_int = 46;
701 pub const _SC_2_C_BIND: ::c_int = 47;
702 pub const _SC_2_C_DEV: ::c_int = 48;
703 pub const _SC_2_FORT_DEV: ::c_int = 49;
704 pub const _SC_2_FORT_RUN: ::c_int = 50;
705 pub const _SC_2_SW_DEV: ::c_int = 51;
706 pub const _SC_2_LOCALEDEF: ::c_int = 52;
707 pub const _SC_UIO_MAXIOV: ::c_int = 60;
708 pub const _SC_IOV_MAX: ::c_int = 60;
709 pub const _SC_THREADS: ::c_int = 67;
710 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
711 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
712 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
713 pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
714 pub const _SC_TTY_NAME_MAX: ::c_int = 72;
715 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
716 pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
717 pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
718 pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
719 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
720 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
721 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
722 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
723 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
724 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
725 pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
726 pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
727 pub const _SC_PHYS_PAGES: ::c_int = 85;
728 pub const _SC_AVPHYS_PAGES: ::c_int = 86;
729 pub const _SC_ATEXIT_MAX: ::c_int = 87;
730 pub const _SC_PASS_MAX: ::c_int = 88;
731 pub const _SC_XOPEN_VERSION: ::c_int = 89;
732 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
733 pub const _SC_XOPEN_UNIX: ::c_int = 91;
734 pub const _SC_XOPEN_CRYPT: ::c_int = 92;
735 pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
736 pub const _SC_XOPEN_SHM: ::c_int = 94;
737 pub const _SC_2_CHAR_TERM: ::c_int = 95;
738 pub const _SC_2_UPE: ::c_int = 97;
739 pub const _SC_XOPEN_XPG2: ::c_int = 98;
740 pub const _SC_XOPEN_XPG3: ::c_int = 99;
741 pub const _SC_XOPEN_XPG4: ::c_int = 100;
742 pub const _SC_NZERO: ::c_int = 109;
743 pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
744 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
745 pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
746 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
747 pub const _SC_XOPEN_LEGACY: ::c_int = 129;
748 pub const _SC_XOPEN_REALTIME: ::c_int = 130;
749 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
750 pub const _SC_ADVISORY_INFO: ::c_int = 132;
751 pub const _SC_BARRIERS: ::c_int = 133;
752 pub const _SC_CLOCK_SELECTION: ::c_int = 137;
753 pub const _SC_CPUTIME: ::c_int = 138;
754 pub const _SC_THREAD_CPUTIME: ::c_int = 139;
755 pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
756 pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
757 pub const _SC_SPIN_LOCKS: ::c_int = 154;
758 pub const _SC_REGEXP: ::c_int = 155;
759 pub const _SC_SHELL: ::c_int = 157;
760 pub const _SC_SPAWN: ::c_int = 159;
761 pub const _SC_SPORADIC_SERVER: ::c_int = 160;
762 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
763 pub const _SC_TIMEOUTS: ::c_int = 164;
764 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
765 pub const _SC_2_PBS: ::c_int = 168;
766 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
767 pub const _SC_2_PBS_LOCATE: ::c_int = 170;
768 pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
769 pub const _SC_2_PBS_TRACK: ::c_int = 172;
770 pub const _SC_SYMLOOP_MAX: ::c_int = 173;
771 pub const _SC_STREAMS: ::c_int = 174;
772 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
773 pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
774 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
775 pub const _SC_V6_LP64_OFF64: ::c_int = 178;
776 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
777 pub const _SC_HOST_NAME_MAX: ::c_int = 180;
778 pub const _SC_TRACE: ::c_int = 181;
779 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
780 pub const _SC_TRACE_INHERIT: ::c_int = 183;
781 pub const _SC_TRACE_LOG: ::c_int = 184;
782 pub const _SC_IPV6: ::c_int = 235;
783 pub const _SC_RAW_SOCKETS: ::c_int = 236;
784 pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
785 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
786 pub const _SC_V7_LP64_OFF64: ::c_int = 239;
787 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
788 pub const _SC_SS_REPL_MAX: ::c_int = 241;
789 pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
790 pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
791 pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
792 pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
793 pub const _SC_XOPEN_STREAMS: ::c_int = 246;
794 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
795 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
796 
797 pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
798 pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
799 
800 pub const GLOB_ERR: ::c_int = 1 << 0;
801 pub const GLOB_MARK: ::c_int = 1 << 1;
802 pub const GLOB_NOSORT: ::c_int = 1 << 2;
803 pub const GLOB_DOOFFS: ::c_int = 1 << 3;
804 pub const GLOB_NOCHECK: ::c_int = 1 << 4;
805 pub const GLOB_APPEND: ::c_int = 1 << 5;
806 pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
807 
808 pub const GLOB_NOSPACE: ::c_int = 1;
809 pub const GLOB_ABORTED: ::c_int = 2;
810 pub const GLOB_NOMATCH: ::c_int = 3;
811 
812 pub const POSIX_MADV_NORMAL: ::c_int = 0;
813 pub const POSIX_MADV_RANDOM: ::c_int = 1;
814 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
815 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
816 
817 pub const S_IEXEC: mode_t = 64;
818 pub const S_IWRITE: mode_t = 128;
819 pub const S_IREAD: mode_t = 256;
820 
821 pub const F_LOCK: ::c_int = 1;
822 pub const F_TEST: ::c_int = 3;
823 pub const F_TLOCK: ::c_int = 2;
824 pub const F_ULOCK: ::c_int = 0;
825 
826 pub const IFF_LOWER_UP: ::c_int = 0x10000;
827 pub const IFF_DORMANT: ::c_int = 0x20000;
828 pub const IFF_ECHO: ::c_int = 0x40000;
829 
830 // linux/if_tun.h
831 pub const IFF_TUN: ::c_short = 0x0001;
832 pub const IFF_TAP: ::c_short = 0x0002;
833 pub const IFF_NO_PI: ::c_short = 0x1000;
834 // Read queue size
835 pub const TUN_READQ_SIZE: ::c_short = 500;
836 // TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead.
837 pub const TUN_TUN_DEV: ::c_short   = ::IFF_TUN;
838 pub const TUN_TAP_DEV: ::c_short   = ::IFF_TAP;
839 pub const TUN_TYPE_MASK: ::c_short = 0x000f;
840 // This flag has no real effect
841 pub const IFF_ONE_QUEUE: ::c_short    = 0x2000;
842 pub const IFF_VNET_HDR: ::c_short     = 0x4000;
843 pub const IFF_TUN_EXCL: ::c_short     = 0x8000;
844 pub const IFF_MULTI_QUEUE: ::c_short  = 0x0100;
845 pub const IFF_ATTACH_QUEUE: ::c_short = 0x0200;
846 pub const IFF_DETACH_QUEUE: ::c_short = 0x0400;
847 // read-only flag
848 pub const IFF_PERSIST: ::c_short  = 0x0800;
849 pub const IFF_NOFILTER: ::c_short = 0x1000;
850 
851 pub const ST_RDONLY: ::c_ulong = 1;
852 pub const ST_NOSUID: ::c_ulong = 2;
853 pub const ST_NODEV: ::c_ulong = 4;
854 pub const ST_NOEXEC: ::c_ulong = 8;
855 pub const ST_SYNCHRONOUS: ::c_ulong = 16;
856 pub const ST_MANDLOCK: ::c_ulong = 64;
857 pub const ST_WRITE: ::c_ulong = 128;
858 pub const ST_APPEND: ::c_ulong = 256;
859 pub const ST_IMMUTABLE: ::c_ulong = 512;
860 pub const ST_NOATIME: ::c_ulong = 1024;
861 pub const ST_NODIRATIME: ::c_ulong = 2048;
862 
863 pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
864 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
865 pub const RTLD_NODELETE: ::c_int = 0x1000;
866 pub const RTLD_NOW: ::c_int = 0x2;
867 
868 pub const TCP_MD5SIG: ::c_int = 14;
869 
870 align_const! {
871     pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
872         size: [0; __SIZEOF_PTHREAD_MUTEX_T],
873     };
874     pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
875         size: [0; __SIZEOF_PTHREAD_COND_T],
876     };
877     pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
878         size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
879     };
880 }
881 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
882 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
883 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
884 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
885 pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
886 pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
887 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
888 
889 pub const RENAME_NOREPLACE: ::c_int = 1;
890 pub const RENAME_EXCHANGE: ::c_int = 2;
891 pub const RENAME_WHITEOUT: ::c_int = 4;
892 
893 pub const SCHED_OTHER: ::c_int = 0;
894 pub const SCHED_FIFO: ::c_int = 1;
895 pub const SCHED_RR: ::c_int = 2;
896 pub const SCHED_BATCH: ::c_int = 3;
897 pub const SCHED_IDLE: ::c_int = 5;
898 
899 // netinet/in.h
900 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
901 
902 // IPPROTO_IP defined in src/unix/mod.rs
903 /// Hop-by-hop option header
904 pub const IPPROTO_HOPOPTS: ::c_int = 0;
905 // IPPROTO_ICMP defined in src/unix/mod.rs
906 /// group mgmt protocol
907 pub const IPPROTO_IGMP: ::c_int = 2;
908 /// for compatibility
909 pub const IPPROTO_IPIP: ::c_int = 4;
910 // IPPROTO_TCP defined in src/unix/mod.rs
911 /// exterior gateway protocol
912 pub const IPPROTO_EGP: ::c_int = 8;
913 /// pup
914 pub const IPPROTO_PUP: ::c_int = 12;
915 // IPPROTO_UDP defined in src/unix/mod.rs
916 /// xns idp
917 pub const IPPROTO_IDP: ::c_int = 22;
918 /// tp-4 w/ class negotiation
919 pub const IPPROTO_TP: ::c_int = 29;
920 /// DCCP
921 pub const IPPROTO_DCCP: ::c_int = 33;
922 // IPPROTO_IPV6 defined in src/unix/mod.rs
923 /// IP6 routing header
924 pub const IPPROTO_ROUTING: ::c_int = 43;
925 /// IP6 fragmentation header
926 pub const IPPROTO_FRAGMENT: ::c_int = 44;
927 /// resource reservation
928 pub const IPPROTO_RSVP: ::c_int = 46;
929 /// General Routing Encap.
930 pub const IPPROTO_GRE: ::c_int = 47;
931 /// IP6 Encap Sec. Payload
932 pub const IPPROTO_ESP: ::c_int = 50;
933 /// IP6 Auth Header
934 pub const IPPROTO_AH: ::c_int = 51;
935 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
936 /// IP6 no next header
937 pub const IPPROTO_NONE: ::c_int = 59;
938 /// IP6 destination option
939 pub const IPPROTO_DSTOPTS: ::c_int = 60;
940 pub const IPPROTO_MTP: ::c_int = 92;
941 pub const IPPROTO_BEETPH: ::c_int = 94;
942 /// encapsulation header
943 pub const IPPROTO_ENCAP: ::c_int = 98;
944 /// Protocol indep. multicast
945 pub const IPPROTO_PIM: ::c_int = 103;
946 /// IP Payload Comp. Protocol
947 pub const IPPROTO_COMP: ::c_int = 108;
948 /// SCTP
949 pub const IPPROTO_SCTP: ::c_int = 132;
950 pub const IPPROTO_MH: ::c_int = 135;
951 pub const IPPROTO_UDPLITE: ::c_int = 136;
952 pub const IPPROTO_MPLS: ::c_int = 137;
953 /// raw IP packet
954 pub const IPPROTO_RAW: ::c_int = 255;
955 pub const IPPROTO_MAX: ::c_int = 256;
956 
957 pub const AF_IB: ::c_int = 27;
958 pub const AF_MPLS: ::c_int = 28;
959 pub const AF_NFC: ::c_int = 39;
960 pub const AF_VSOCK: ::c_int = 40;
961 pub const PF_IB: ::c_int = AF_IB;
962 pub const PF_MPLS: ::c_int = AF_MPLS;
963 pub const PF_NFC: ::c_int = AF_NFC;
964 pub const PF_VSOCK: ::c_int = AF_VSOCK;
965 
966 // System V IPC
967 pub const IPC_PRIVATE: ::key_t = 0;
968 
969 pub const IPC_CREAT: ::c_int = 0o1000;
970 pub const IPC_EXCL: ::c_int = 0o2000;
971 pub const IPC_NOWAIT: ::c_int = 0o4000;
972 
973 pub const IPC_RMID: ::c_int = 0;
974 pub const IPC_SET: ::c_int = 1;
975 pub const IPC_STAT: ::c_int = 2;
976 pub const IPC_INFO: ::c_int = 3;
977 pub const MSG_STAT: ::c_int = 11;
978 pub const MSG_INFO: ::c_int = 12;
979 
980 pub const MSG_NOERROR: ::c_int = 0o10000;
981 pub const MSG_EXCEPT: ::c_int = 0o20000;
982 pub const MSG_COPY: ::c_int = 0o40000;
983 
984 pub const SHM_R: ::c_int = 0o400;
985 pub const SHM_W: ::c_int = 0o200;
986 
987 pub const SHM_RDONLY: ::c_int = 0o10000;
988 pub const SHM_RND: ::c_int = 0o20000;
989 pub const SHM_REMAP: ::c_int = 0o40000;
990 pub const SHM_EXEC: ::c_int = 0o100000;
991 
992 pub const SHM_LOCK: ::c_int = 11;
993 pub const SHM_UNLOCK: ::c_int = 12;
994 
995 pub const SHM_HUGETLB: ::c_int = 0o4000;
996 pub const SHM_NORESERVE: ::c_int = 0o10000;
997 
998 pub const EPOLLRDHUP: ::c_int = 0x2000;
999 pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
1000 pub const EPOLLONESHOT: ::c_int = 0x40000000;
1001 
1002 pub const QFMT_VFS_OLD: ::c_int = 1;
1003 pub const QFMT_VFS_V0: ::c_int = 2;
1004 pub const QFMT_VFS_V1: ::c_int = 4;
1005 
1006 pub const EFD_SEMAPHORE: ::c_int = 0x1;
1007 
1008 pub const LOG_NFACILITIES: ::c_int = 24;
1009 
1010 pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
1011 
1012 pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
1013 pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
1014 pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
1015 pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
1016 pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
1017 pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
1018 pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
1019 
1020 pub const AI_PASSIVE: ::c_int = 0x0001;
1021 pub const AI_CANONNAME: ::c_int = 0x0002;
1022 pub const AI_NUMERICHOST: ::c_int = 0x0004;
1023 pub const AI_V4MAPPED: ::c_int = 0x0008;
1024 pub const AI_ALL: ::c_int = 0x0010;
1025 pub const AI_ADDRCONFIG: ::c_int = 0x0020;
1026 
1027 pub const AI_NUMERICSERV: ::c_int = 0x0400;
1028 
1029 pub const EAI_BADFLAGS: ::c_int = -1;
1030 pub const EAI_NONAME: ::c_int = -2;
1031 pub const EAI_AGAIN: ::c_int = -3;
1032 pub const EAI_FAIL: ::c_int = -4;
1033 pub const EAI_NODATA: ::c_int = -5;
1034 pub const EAI_FAMILY: ::c_int = -6;
1035 pub const EAI_SOCKTYPE: ::c_int = -7;
1036 pub const EAI_SERVICE: ::c_int = -8;
1037 pub const EAI_MEMORY: ::c_int = -10;
1038 pub const EAI_SYSTEM: ::c_int = -11;
1039 pub const EAI_OVERFLOW: ::c_int = -12;
1040 
1041 pub const NI_NUMERICHOST: ::c_int = 1;
1042 pub const NI_NUMERICSERV: ::c_int = 2;
1043 pub const NI_NOFQDN: ::c_int = 4;
1044 pub const NI_NAMEREQD: ::c_int = 8;
1045 pub const NI_DGRAM: ::c_int = 16;
1046 
1047 pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
1048 pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
1049 pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
1050 
1051 pub const AIO_CANCELED: ::c_int = 0;
1052 pub const AIO_NOTCANCELED: ::c_int = 1;
1053 pub const AIO_ALLDONE: ::c_int = 2;
1054 pub const LIO_READ: ::c_int = 0;
1055 pub const LIO_WRITE: ::c_int = 1;
1056 pub const LIO_NOP: ::c_int = 2;
1057 pub const LIO_WAIT: ::c_int = 0;
1058 pub const LIO_NOWAIT: ::c_int = 1;
1059 
1060 pub const MREMAP_MAYMOVE: ::c_int = 1;
1061 pub const MREMAP_FIXED: ::c_int = 2;
1062 
1063 pub const PR_SET_PDEATHSIG: ::c_int = 1;
1064 pub const PR_GET_PDEATHSIG: ::c_int = 2;
1065 
1066 pub const PR_GET_DUMPABLE: ::c_int = 3;
1067 pub const PR_SET_DUMPABLE: ::c_int = 4;
1068 
1069 pub const PR_GET_UNALIGN: ::c_int = 5;
1070 pub const PR_SET_UNALIGN: ::c_int = 6;
1071 pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
1072 pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
1073 
1074 pub const PR_GET_KEEPCAPS: ::c_int = 7;
1075 pub const PR_SET_KEEPCAPS: ::c_int = 8;
1076 
1077 pub const PR_GET_FPEMU: ::c_int = 9;
1078 pub const PR_SET_FPEMU: ::c_int = 10;
1079 pub const PR_FPEMU_NOPRINT: ::c_int = 1;
1080 pub const PR_FPEMU_SIGFPE: ::c_int = 2;
1081 
1082 pub const PR_GET_FPEXC: ::c_int = 11;
1083 pub const PR_SET_FPEXC: ::c_int = 12;
1084 pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
1085 pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
1086 pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
1087 pub const PR_FP_EXC_UND: ::c_int = 0x040000;
1088 pub const PR_FP_EXC_RES: ::c_int = 0x080000;
1089 pub const PR_FP_EXC_INV: ::c_int = 0x100000;
1090 pub const PR_FP_EXC_DISABLED: ::c_int = 0;
1091 pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
1092 pub const PR_FP_EXC_ASYNC: ::c_int = 2;
1093 pub const PR_FP_EXC_PRECISE: ::c_int = 3;
1094 
1095 pub const PR_GET_TIMING: ::c_int = 13;
1096 pub const PR_SET_TIMING: ::c_int = 14;
1097 pub const PR_TIMING_STATISTICAL: ::c_int = 0;
1098 pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
1099 
1100 pub const PR_SET_NAME: ::c_int = 15;
1101 pub const PR_GET_NAME: ::c_int = 16;
1102 
1103 pub const PR_GET_ENDIAN: ::c_int = 19;
1104 pub const PR_SET_ENDIAN: ::c_int = 20;
1105 pub const PR_ENDIAN_BIG: ::c_int = 0;
1106 pub const PR_ENDIAN_LITTLE: ::c_int = 1;
1107 pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
1108 
1109 pub const PR_GET_SECCOMP: ::c_int = 21;
1110 pub const PR_SET_SECCOMP: ::c_int = 22;
1111 
1112 pub const PR_CAPBSET_READ: ::c_int = 23;
1113 pub const PR_CAPBSET_DROP: ::c_int = 24;
1114 
1115 pub const PR_GET_TSC: ::c_int = 25;
1116 pub const PR_SET_TSC: ::c_int = 26;
1117 pub const PR_TSC_ENABLE: ::c_int = 1;
1118 pub const PR_TSC_SIGSEGV: ::c_int = 2;
1119 
1120 pub const PR_GET_SECUREBITS: ::c_int = 27;
1121 pub const PR_SET_SECUREBITS: ::c_int = 28;
1122 
1123 pub const PR_SET_TIMERSLACK: ::c_int = 29;
1124 pub const PR_GET_TIMERSLACK: ::c_int = 30;
1125 
1126 pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
1127 pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
1128 
1129 pub const PR_MCE_KILL: ::c_int = 33;
1130 pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
1131 pub const PR_MCE_KILL_SET: ::c_int = 1;
1132 
1133 pub const PR_MCE_KILL_LATE: ::c_int = 0;
1134 pub const PR_MCE_KILL_EARLY: ::c_int = 1;
1135 pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
1136 
1137 pub const PR_MCE_KILL_GET: ::c_int = 34;
1138 
1139 pub const PR_SET_MM: ::c_int = 35;
1140 pub const PR_SET_MM_START_CODE: ::c_int = 1;
1141 pub const PR_SET_MM_END_CODE: ::c_int = 2;
1142 pub const PR_SET_MM_START_DATA: ::c_int = 3;
1143 pub const PR_SET_MM_END_DATA: ::c_int = 4;
1144 pub const PR_SET_MM_START_STACK: ::c_int = 5;
1145 pub const PR_SET_MM_START_BRK: ::c_int = 6;
1146 pub const PR_SET_MM_BRK: ::c_int = 7;
1147 pub const PR_SET_MM_ARG_START: ::c_int = 8;
1148 pub const PR_SET_MM_ARG_END: ::c_int = 9;
1149 pub const PR_SET_MM_ENV_START: ::c_int = 10;
1150 pub const PR_SET_MM_ENV_END: ::c_int = 11;
1151 pub const PR_SET_MM_AUXV: ::c_int = 12;
1152 pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
1153 pub const PR_SET_MM_MAP: ::c_int = 14;
1154 pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
1155 
1156 pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
1157 
1158 pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
1159 pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
1160 
1161 pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
1162 pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
1163 
1164 pub const PR_GET_TID_ADDRESS: ::c_int = 40;
1165 
1166 pub const PR_SET_THP_DISABLE: ::c_int = 41;
1167 pub const PR_GET_THP_DISABLE: ::c_int = 42;
1168 
1169 pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43;
1170 pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44;
1171 
1172 pub const PR_SET_FP_MODE: ::c_int = 45;
1173 pub const PR_GET_FP_MODE: ::c_int = 46;
1174 pub const PR_FP_MODE_FR: ::c_int = 1 << 0;
1175 pub const PR_FP_MODE_FRE: ::c_int = 1 << 1;
1176 
1177 pub const PR_CAP_AMBIENT: ::c_int = 47;
1178 pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1;
1179 pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
1180 pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
1181 pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
1182 
1183 pub const GRND_NONBLOCK: ::c_uint = 0x0001;
1184 pub const GRND_RANDOM: ::c_uint = 0x0002;
1185 
1186 pub const SECCOMP_MODE_DISABLED: ::c_uint = 0;
1187 pub const SECCOMP_MODE_STRICT: ::c_uint = 1;
1188 pub const SECCOMP_MODE_FILTER: ::c_uint = 2;
1189 
1190 pub const ITIMER_REAL: ::c_int = 0;
1191 pub const ITIMER_VIRTUAL: ::c_int = 1;
1192 pub const ITIMER_PROF: ::c_int = 2;
1193 
1194 pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC;
1195 pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK;
1196 pub const TFD_TIMER_ABSTIME: ::c_int = 1;
1197 
1198 pub const XATTR_CREATE: ::c_int = 0x1;
1199 pub const XATTR_REPLACE: ::c_int = 0x2;
1200 
1201 pub const _POSIX_VDISABLE: ::cc_t = 0;
1202 
1203 pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
1204 pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
1205 pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
1206 pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
1207 pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
1208 pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
1209 
1210 // On Linux, libc doesn't define this constant, libattr does instead.
1211 // We still define it for Linux as it's defined by libc on other platforms,
1212 // and it's mentioned in the man pages for getxattr and setxattr.
1213 pub const ENOATTR: ::c_int = ::ENODATA;
1214 
1215 pub const SO_ORIGINAL_DST: ::c_int = 80;
1216 pub const IUTF8: ::tcflag_t = 0x00004000;
1217 pub const CMSPAR: ::tcflag_t = 0o10000000000;
1218 
1219 pub const MFD_CLOEXEC: ::c_uint = 0x0001;
1220 pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
1221 
1222 // these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
1223 // the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
1224 // so we can use that type here to avoid having to cast.
1225 pub const PT_NULL: u32 = 0;
1226 pub const PT_LOAD: u32 = 1;
1227 pub const PT_DYNAMIC: u32 = 2;
1228 pub const PT_INTERP: u32 = 3;
1229 pub const PT_NOTE: u32 = 4;
1230 pub const PT_SHLIB: u32 = 5;
1231 pub const PT_PHDR: u32 = 6;
1232 pub const PT_TLS: u32 = 7;
1233 pub const PT_NUM: u32 = 8;
1234 pub const PT_LOOS: u32 = 0x60000000;
1235 pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
1236 pub const PT_GNU_STACK: u32 = 0x6474e551;
1237 pub const PT_GNU_RELRO: u32 = 0x6474e552;
1238 
1239 // linux/if_ether.h
1240 pub const ETH_ALEN: ::c_int = 6;
1241 pub const ETH_HLEN: ::c_int = 14;
1242 pub const ETH_ZLEN: ::c_int = 60;
1243 pub const ETH_DATA_LEN: ::c_int = 1500;
1244 pub const ETH_FRAME_LEN: ::c_int = 1514;
1245 pub const ETH_FCS_LEN: ::c_int = 4;
1246 
1247 // These are the defined Ethernet Protocol ID's.
1248 pub const ETH_P_LOOP: ::c_int = 0x0060;
1249 pub const ETH_P_PUP: ::c_int = 0x0200;
1250 pub const ETH_P_PUPAT: ::c_int = 0x0201;
1251 pub const ETH_P_IP: ::c_int = 0x0800;
1252 pub const ETH_P_X25: ::c_int = 0x0805;
1253 pub const ETH_P_ARP: ::c_int = 0x0806;
1254 pub const ETH_P_BPQ: ::c_int = 0x08FF;
1255 pub const ETH_P_IEEEPUP: ::c_int = 0x0a00;
1256 pub const ETH_P_IEEEPUPAT: ::c_int = 0x0a01;
1257 pub const ETH_P_BATMAN: ::c_int = 0x4305;
1258 pub const ETH_P_DEC: ::c_int = 0x6000;
1259 pub const ETH_P_DNA_DL: ::c_int = 0x6001;
1260 pub const ETH_P_DNA_RC: ::c_int = 0x6002;
1261 pub const ETH_P_DNA_RT: ::c_int = 0x6003;
1262 pub const ETH_P_LAT: ::c_int = 0x6004;
1263 pub const ETH_P_DIAG: ::c_int = 0x6005;
1264 pub const ETH_P_CUST: ::c_int = 0x6006;
1265 pub const ETH_P_SCA: ::c_int = 0x6007;
1266 pub const ETH_P_TEB: ::c_int = 0x6558;
1267 pub const ETH_P_RARP: ::c_int = 0x8035;
1268 pub const ETH_P_ATALK: ::c_int = 0x809B;
1269 pub const ETH_P_AARP: ::c_int = 0x80F3;
1270 pub const ETH_P_8021Q: ::c_int = 0x8100;
1271 pub const ETH_P_IPX: ::c_int = 0x8137;
1272 pub const ETH_P_IPV6: ::c_int = 0x86DD;
1273 pub const ETH_P_PAUSE: ::c_int = 0x8808;
1274 pub const ETH_P_SLOW: ::c_int = 0x8809;
1275 pub const ETH_P_WCCP: ::c_int = 0x883E;
1276 pub const ETH_P_MPLS_UC: ::c_int = 0x8847;
1277 pub const ETH_P_MPLS_MC: ::c_int = 0x8848;
1278 pub const ETH_P_ATMMPOA: ::c_int = 0x884c;
1279 pub const ETH_P_PPP_DISC: ::c_int = 0x8863;
1280 pub const ETH_P_PPP_SES: ::c_int = 0x8864;
1281 pub const ETH_P_LINK_CTL: ::c_int = 0x886c;
1282 pub const ETH_P_ATMFATE: ::c_int = 0x8884;
1283 pub const ETH_P_PAE: ::c_int = 0x888E;
1284 pub const ETH_P_AOE: ::c_int = 0x88A2;
1285 pub const ETH_P_8021AD: ::c_int = 0x88A8;
1286 pub const ETH_P_802_EX1: ::c_int = 0x88B5;
1287 pub const ETH_P_TIPC: ::c_int = 0x88CA;
1288 pub const ETH_P_MACSEC: ::c_int = 0x88E5;
1289 pub const ETH_P_8021AH: ::c_int = 0x88E7;
1290 pub const ETH_P_MVRP: ::c_int = 0x88F5;
1291 pub const ETH_P_1588: ::c_int = 0x88F7;
1292 pub const ETH_P_PRP: ::c_int = 0x88FB;
1293 pub const ETH_P_FCOE: ::c_int = 0x8906;
1294 pub const ETH_P_TDLS: ::c_int = 0x890D;
1295 pub const ETH_P_FIP: ::c_int = 0x8914;
1296 pub const ETH_P_80221: ::c_int = 0x8917;
1297 pub const ETH_P_LOOPBACK: ::c_int = 0x9000;
1298 pub const ETH_P_QINQ1: ::c_int = 0x9100;
1299 pub const ETH_P_QINQ2: ::c_int = 0x9200;
1300 pub const ETH_P_QINQ3: ::c_int = 0x9300;
1301 pub const ETH_P_EDSA: ::c_int = 0xDADA;
1302 pub const ETH_P_AF_IUCV: ::c_int = 0xFBFB;
1303 
1304 pub const ETH_P_802_3_MIN: ::c_int = 0x0600;
1305 
1306 // Non DIX types. Won't clash for 1500 types.
1307 pub const ETH_P_802_3: ::c_int = 0x0001;
1308 pub const ETH_P_AX25: ::c_int = 0x0002;
1309 pub const ETH_P_ALL: ::c_int = 0x0003;
1310 pub const ETH_P_802_2: ::c_int = 0x0004;
1311 pub const ETH_P_SNAP: ::c_int = 0x0005;
1312 pub const ETH_P_DDCMP: ::c_int = 0x0006;
1313 pub const ETH_P_WAN_PPP: ::c_int = 0x0007;
1314 pub const ETH_P_PPP_MP: ::c_int = 0x0008;
1315 pub const ETH_P_LOCALTALK: ::c_int = 0x0009;
1316 pub const ETH_P_CANFD: ::c_int = 0x000D;
1317 pub const ETH_P_PPPTALK: ::c_int = 0x0010;
1318 pub const ETH_P_TR_802_2: ::c_int = 0x0011;
1319 pub const ETH_P_MOBITEX: ::c_int = 0x0015;
1320 pub const ETH_P_CONTROL: ::c_int = 0x0016;
1321 pub const ETH_P_IRDA: ::c_int = 0x0017;
1322 pub const ETH_P_ECONET: ::c_int = 0x0018;
1323 pub const ETH_P_HDLC: ::c_int = 0x0019;
1324 pub const ETH_P_ARCNET: ::c_int = 0x001A;
1325 pub const ETH_P_DSA: ::c_int = 0x001B;
1326 pub const ETH_P_TRAILER: ::c_int = 0x001C;
1327 pub const ETH_P_PHONET: ::c_int = 0x00F5;
1328 pub const ETH_P_IEEE802154: ::c_int = 0x00F6;
1329 pub const ETH_P_CAIF: ::c_int = 0x00F7;
1330 
1331 pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
1332 pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
1333 pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
1334 pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
1335 pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x10;
1336 pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x20;
1337 
1338 pub const NLMSG_NOOP: ::c_int = 0x1;
1339 pub const NLMSG_ERROR: ::c_int = 0x2;
1340 pub const NLMSG_DONE: ::c_int = 0x3;
1341 pub const NLMSG_OVERRUN: ::c_int = 0x4;
1342 pub const NLMSG_MIN_TYPE: ::c_int = 0x10;
1343 
1344 pub const GENL_NAMSIZ: ::c_int = 16;
1345 
1346 pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE;
1347 pub const GENL_MAX_ID: ::c_int = 1023;
1348 
1349 pub const GENL_ADMIN_PERM: ::c_int = 0x01;
1350 pub const GENL_CMD_CAP_DO: ::c_int = 0x02;
1351 pub const GENL_CMD_CAP_DUMP: ::c_int = 0x04;
1352 pub const GENL_CMD_CAP_HASPOL: ::c_int = 0x08;
1353 
1354 pub const GENL_ID_CTRL: ::c_int = NLMSG_MIN_TYPE;
1355 
1356 pub const CTRL_CMD_UNSPEC: ::c_int = 0;
1357 pub const CTRL_CMD_NEWFAMILY: ::c_int = 1;
1358 pub const CTRL_CMD_DELFAMILY: ::c_int = 2;
1359 pub const CTRL_CMD_GETFAMILY: ::c_int = 3;
1360 pub const CTRL_CMD_NEWOPS: ::c_int = 4;
1361 pub const CTRL_CMD_DELOPS: ::c_int = 5;
1362 pub const CTRL_CMD_GETOPS: ::c_int = 6;
1363 pub const CTRL_CMD_NEWMCAST_GRP: ::c_int = 7;
1364 pub const CTRL_CMD_DELMCAST_GRP: ::c_int = 8;
1365 pub const CTRL_CMD_GETMCAST_GRP: ::c_int = 9;
1366 
1367 pub const CTRL_ATTR_UNSPEC: ::c_int = 0;
1368 pub const CTRL_ATTR_FAMILY_ID: ::c_int = 1;
1369 pub const CTRL_ATTR_FAMILY_NAME: ::c_int = 2;
1370 pub const CTRL_ATTR_VERSION: ::c_int = 3;
1371 pub const CTRL_ATTR_HDRSIZE: ::c_int = 4;
1372 pub const CTRL_ATTR_MAXATTR: ::c_int = 5;
1373 pub const CTRL_ATTR_OPS: ::c_int = 6;
1374 pub const CTRL_ATTR_MCAST_GROUPS: ::c_int = 7;
1375 
1376 pub const CTRL_ATTR_OP_UNSPEC: ::c_int = 0;
1377 pub const CTRL_ATTR_OP_ID: ::c_int = 1;
1378 pub const CTRL_ATTR_OP_FLAGS: ::c_int = 2;
1379 
1380 pub const CTRL_ATTR_MCAST_GRP_UNSPEC: ::c_int = 0;
1381 pub const CTRL_ATTR_MCAST_GRP_NAME: ::c_int = 1;
1382 pub const CTRL_ATTR_MCAST_GRP_ID: ::c_int = 2;
1383 
1384 // linux/if_packet.h
1385 pub const PACKET_ADD_MEMBERSHIP: ::c_int = 1;
1386 pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2;
1387 
1388 pub const PACKET_MR_MULTICAST: ::c_int = 0;
1389 pub const PACKET_MR_PROMISC: ::c_int = 1;
1390 pub const PACKET_MR_ALLMULTI: ::c_int = 2;
1391 pub const PACKET_MR_UNICAST: ::c_int = 3;
1392 
1393 // linux/netfilter.h
1394 pub const NF_DROP: ::c_int = 0;
1395 pub const NF_ACCEPT: ::c_int =  1;
1396 pub const NF_STOLEN: ::c_int =  2;
1397 pub const NF_QUEUE: ::c_int =  3;
1398 pub const NF_REPEAT: ::c_int =  4;
1399 pub const NF_STOP: ::c_int =  5;
1400 pub const NF_MAX_VERDICT: ::c_int = NF_STOP;
1401 
1402 pub const NF_VERDICT_MASK: ::c_int = 0x000000ff;
1403 pub const NF_VERDICT_FLAG_QUEUE_BYPASS: ::c_int = 0x00008000;
1404 
1405 pub const NF_VERDICT_QMASK: ::c_int = 0xffff0000;
1406 pub const NF_VERDICT_QBITS: ::c_int = 16;
1407 
1408 pub const NF_VERDICT_BITS: ::c_int = 16;
1409 
1410 pub const NF_INET_PRE_ROUTING: ::c_int = 0;
1411 pub const NF_INET_LOCAL_IN: ::c_int = 1;
1412 pub const NF_INET_FORWARD: ::c_int = 2;
1413 pub const NF_INET_LOCAL_OUT: ::c_int = 3;
1414 pub const NF_INET_POST_ROUTING: ::c_int = 4;
1415 pub const NF_INET_NUMHOOKS: ::c_int = 5;
1416 
1417 // Some NFPROTO are not compatible with musl and are defined in submodules.
1418 pub const NFPROTO_UNSPEC: ::c_int = 0;
1419 pub const NFPROTO_IPV4: ::c_int = 2;
1420 pub const NFPROTO_ARP: ::c_int = 3;
1421 pub const NFPROTO_BRIDGE: ::c_int = 7;
1422 pub const NFPROTO_IPV6: ::c_int = 10;
1423 pub const NFPROTO_DECNET: ::c_int = 12;
1424 pub const NFPROTO_NUMPROTO: ::c_int = 13;
1425 
1426 // linux/netfilter_ipv4.h
1427 pub const NF_IP_PRE_ROUTING: ::c_int = 0;
1428 pub const NF_IP_LOCAL_IN: ::c_int = 1;
1429 pub const NF_IP_FORWARD: ::c_int = 2;
1430 pub const NF_IP_LOCAL_OUT: ::c_int = 3;
1431 pub const NF_IP_POST_ROUTING: ::c_int = 4;
1432 pub const NF_IP_NUMHOOKS: ::c_int = 5;
1433 
1434 pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN;
1435 pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400;
1436 pub const NF_IP_PRI_RAW: ::c_int = -300;
1437 pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225;
1438 pub const NF_IP_PRI_CONNTRACK: ::c_int = -200;
1439 pub const NF_IP_PRI_MANGLE: ::c_int = -150;
1440 pub const NF_IP_PRI_NAT_DST: ::c_int = -100;
1441 pub const NF_IP_PRI_FILTER: ::c_int = 0;
1442 pub const NF_IP_PRI_SECURITY: ::c_int = 50;
1443 pub const NF_IP_PRI_NAT_SRC: ::c_int = 100;
1444 pub const NF_IP_PRI_SELINUX_LAST: ::c_int = 225;
1445 pub const NF_IP_PRI_CONNTRACK_HELPER: ::c_int = 300;
1446 pub const NF_IP_PRI_CONNTRACK_CONFIRM: ::c_int = ::INT_MAX;
1447 pub const NF_IP_PRI_LAST: ::c_int = ::INT_MAX;
1448 
1449 // linux/netfilter_ipv6.h
1450 pub const NF_IP6_PRE_ROUTING: ::c_int = 0;
1451 pub const NF_IP6_LOCAL_IN: ::c_int = 1;
1452 pub const NF_IP6_FORWARD: ::c_int = 2;
1453 pub const NF_IP6_LOCAL_OUT: ::c_int = 3;
1454 pub const NF_IP6_POST_ROUTING: ::c_int = 4;
1455 pub const NF_IP6_NUMHOOKS: ::c_int = 5;
1456 
1457 pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN;
1458 pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400;
1459 pub const NF_IP6_PRI_RAW: ::c_int = -300;
1460 pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225;
1461 pub const NF_IP6_PRI_CONNTRACK: ::c_int = -200;
1462 pub const NF_IP6_PRI_MANGLE: ::c_int = -150;
1463 pub const NF_IP6_PRI_NAT_DST: ::c_int = -100;
1464 pub const NF_IP6_PRI_FILTER: ::c_int = 0;
1465 pub const NF_IP6_PRI_SECURITY: ::c_int = 50;
1466 pub const NF_IP6_PRI_NAT_SRC: ::c_int = 100;
1467 pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225;
1468 pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300;
1469 pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX;
1470 
1471 pub const SIOCADDRT: ::c_ulong = 0x0000890B;
1472 pub const SIOCDELRT: ::c_ulong = 0x0000890C;
1473 pub const SIOCGIFNAME: ::c_ulong = 0x00008910;
1474 pub const SIOCSIFLINK: ::c_ulong = 0x00008911;
1475 pub const SIOCGIFCONF: ::c_ulong = 0x00008912;
1476 pub const SIOCGIFFLAGS: ::c_ulong = 0x00008913;
1477 pub const SIOCSIFFLAGS: ::c_ulong = 0x00008914;
1478 pub const SIOCGIFADDR: ::c_ulong = 0x00008915;
1479 pub const SIOCSIFADDR: ::c_ulong = 0x00008916;
1480 pub const SIOCGIFDSTADDR: ::c_ulong = 0x00008917;
1481 pub const SIOCSIFDSTADDR: ::c_ulong = 0x00008918;
1482 pub const SIOCGIFBRDADDR: ::c_ulong = 0x00008919;
1483 pub const SIOCSIFBRDADDR: ::c_ulong = 0x0000891A;
1484 pub const SIOCGIFNETMASK: ::c_ulong = 0x0000891B;
1485 pub const SIOCSIFNETMASK: ::c_ulong = 0x0000891C;
1486 pub const SIOCGIFMETRIC: ::c_ulong = 0x0000891D;
1487 pub const SIOCSIFMETRIC: ::c_ulong = 0x0000891E;
1488 pub const SIOCGIFMEM: ::c_ulong = 0x0000891F;
1489 pub const SIOCSIFMEM: ::c_ulong = 0x00008920;
1490 pub const SIOCGIFMTU: ::c_ulong = 0x00008921;
1491 pub const SIOCSIFMTU: ::c_ulong = 0x00008922;
1492 pub const SIOCSIFHWADDR: ::c_ulong = 0x00008924;
1493 pub const SIOCGIFENCAP: ::c_ulong = 0x00008925;
1494 pub const SIOCSIFENCAP: ::c_ulong = 0x00008926;
1495 pub const SIOCGIFHWADDR: ::c_ulong = 0x00008927;
1496 pub const SIOCGIFSLAVE: ::c_ulong = 0x00008929;
1497 pub const SIOCSIFSLAVE: ::c_ulong = 0x00008930;
1498 pub const SIOCADDMULTI: ::c_ulong = 0x00008931;
1499 pub const SIOCDELMULTI: ::c_ulong = 0x00008932;
1500 pub const SIOCDARP: ::c_ulong = 0x00008953;
1501 pub const SIOCGARP: ::c_ulong = 0x00008954;
1502 pub const SIOCSARP: ::c_ulong = 0x00008955;
1503 pub const SIOCDRARP: ::c_ulong = 0x00008960;
1504 pub const SIOCGRARP: ::c_ulong = 0x00008961;
1505 pub const SIOCSRARP: ::c_ulong = 0x00008962;
1506 pub const SIOCGIFMAP: ::c_ulong = 0x00008970;
1507 pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
1508 
1509 pub const IPTOS_TOS_MASK: u8 = 0x1E;
1510 pub const IPTOS_PREC_MASK: u8 = 0xE0;
1511 
1512 pub const RTF_UP: ::c_ushort = 0x0001;
1513 pub const RTF_GATEWAY: ::c_ushort = 0x0002;
1514 
1515 pub const RTF_HOST: ::c_ushort = 0x0004;
1516 pub const RTF_REINSTATE: ::c_ushort = 0x0008;
1517 pub const RTF_DYNAMIC: ::c_ushort = 0x0010;
1518 pub const RTF_MODIFIED: ::c_ushort = 0x0020;
1519 pub const RTF_MTU: ::c_ushort = 0x0040;
1520 pub const RTF_MSS: ::c_ushort = RTF_MTU;
1521 pub const RTF_WINDOW: ::c_ushort = 0x0080;
1522 pub const RTF_IRTT: ::c_ushort = 0x0100;
1523 pub const RTF_REJECT: ::c_ushort = 0x0200;
1524 pub const RTF_STATIC: ::c_ushort = 0x0400;
1525 pub const RTF_XRESOLVE: ::c_ushort = 0x0800;
1526 pub const RTF_NOFORWARD: ::c_ushort = 0x1000;
1527 pub const RTF_THROW: ::c_ushort = 0x2000;
1528 pub const RTF_NOPMTUDISC: ::c_ushort = 0x4000;
1529 
1530 pub const RTF_DEFAULT: u32 = 0x00010000;
1531 pub const RTF_ALLONLINK: u32 = 0x00020000;
1532 pub const RTF_ADDRCONF: u32 = 0x00040000;
1533 pub const RTF_LINKRT: u32 = 0x00100000;
1534 pub const RTF_NONEXTHOP: u32 = 0x00200000;
1535 pub const RTF_CACHE: u32 = 0x01000000;
1536 pub const RTF_FLOW: u32 = 0x02000000;
1537 pub const RTF_POLICY: u32 = 0x04000000;
1538 
1539 pub const RTCF_VALVE: u32 = 0x00200000;
1540 pub const RTCF_MASQ: u32 = 0x00400000;
1541 pub const RTCF_NAT: u32 = 0x00800000;
1542 pub const RTCF_DOREDIRECT: u32 = 0x01000000;
1543 pub const RTCF_LOG: u32 = 0x02000000;
1544 pub const RTCF_DIRECTSRC: u32 = 0x04000000;
1545 
1546 pub const RTF_LOCAL: u32 = 0x80000000;
1547 pub const RTF_INTERFACE: u32 = 0x40000000;
1548 pub const RTF_MULTICAST: u32 = 0x20000000;
1549 pub const RTF_BROADCAST: u32 = 0x10000000;
1550 pub const RTF_NAT: u32 = 0x08000000;
1551 pub const RTF_ADDRCLASSMASK: u32 = 0xF8000000;
1552 
1553 pub const RT_CLASS_UNSPEC: u8 = 0;
1554 pub const RT_CLASS_DEFAULT: u8 = 253;
1555 pub const RT_CLASS_MAIN: u8 = 254;
1556 pub const RT_CLASS_LOCAL: u8 = 255;
1557 pub const RT_CLASS_MAX: u8 = 255;
1558 
1559 pub const RTMSG_OVERRUN: u32 = ::NLMSG_OVERRUN as u32;
1560 pub const RTMSG_NEWDEVICE: u32 = 0x11;
1561 pub const RTMSG_DELDEVICE: u32 = 0x12;
1562 pub const RTMSG_NEWROUTE: u32 = 0x21;
1563 pub const RTMSG_DELROUTE: u32 = 0x22;
1564 pub const RTMSG_NEWRULE: u32 = 0x31;
1565 pub const RTMSG_DELRULE: u32 = 0x32;
1566 pub const RTMSG_CONTROL: u32 = 0x40;
1567 pub const RTMSG_AR_FAILED: u32 = 0x51;
1568 
1569 pub const MAX_ADDR_LEN: usize = 7;
1570 pub const ARPD_UPDATE: ::c_ushort = 0x01;
1571 pub const ARPD_LOOKUP: ::c_ushort = 0x02;
1572 pub const ARPD_FLUSH: ::c_ushort = 0x03;
1573 pub const ATF_MAGIC: ::c_int = 0x80;
1574 
1575 // linux/module.h
1576 pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
1577 pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
1578 
1579 f! {
1580     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1581         for slot in cpuset.bits.iter_mut() {
1582             *slot = 0;
1583         }
1584     }
1585 
1586     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1587         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1588         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1589         cpuset.bits[idx] |= 1 << offset;
1590         ()
1591     }
1592 
1593     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1594         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1595         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1596         cpuset.bits[idx] &= !(1 << offset);
1597         ()
1598     }
1599 
1600     pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
1601         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]);
1602         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1603         0 != (cpuset.bits[idx] & (1 << offset))
1604     }
1605 
1606     pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
1607         set1.bits == set2.bits
1608     }
1609 
1610     pub fn major(dev: ::dev_t) -> ::c_uint {
1611         let mut major = 0;
1612         major |= (dev & 0x00000000000fff00) >> 8;
1613         major |= (dev & 0xfffff00000000000) >> 32;
1614         major as ::c_uint
1615     }
1616 
1617     pub fn minor(dev: ::dev_t) -> ::c_uint {
1618         let mut minor = 0;
1619         minor |= (dev & 0x00000000000000ff) >> 0;
1620         minor |= (dev & 0x00000ffffff00000) >> 12;
1621         minor as ::c_uint
1622     }
1623 
1624     pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
1625         let major = major as ::dev_t;
1626         let minor = minor as ::dev_t;
1627         let mut dev = 0;
1628         dev |= (major & 0x00000fff) << 8;
1629         dev |= (major & 0xfffff000) << 32;
1630         dev |= (minor & 0x000000ff) << 0;
1631         dev |= (minor & 0xffffff00) << 12;
1632         dev
1633     }
1634 
1635     pub fn IPTOS_TOS(tos: u8) -> u8 {
1636         tos & IPTOS_TOS_MASK
1637     }
1638 
1639     pub fn IPTOS_PREC(tos: u8) -> u8 {
1640         tos & IPTOS_PREC_MASK
1641     }
1642 
1643     pub fn RT_TOS(tos: u8) -> u8 {
1644         tos & ::IPTOS_TOS_MASK
1645     }
1646 
1647     pub fn RT_ADDRCLASS(flags: u32) -> u32 {
1648         flags >> 23
1649     }
1650 
1651     pub fn RT_LOCALADDR(flags: u32) -> bool {
1652         (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE)
1653     }
1654 }
1655 
1656 extern {
aio_read(aiocbp: *mut aiocb) -> ::c_int1657     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int1658     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int1659     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int1660     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t1661     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec) -> ::c_int1662     pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
1663                        timeout: *const ::timespec) -> ::c_int;
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int1664     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int1665     pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
1666                       nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int;
1667 
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int1668     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
1669 
setpwent()1670     pub fn setpwent();
endpwent()1671     pub fn endpwent();
getpwent() -> *mut passwd1672     pub fn getpwent() -> *mut passwd;
setgrent()1673     pub fn setgrent();
endgrent()1674     pub fn endgrent();
getgrent() -> *mut ::group1675     pub fn getgrent() -> *mut ::group;
setspent()1676     pub fn setspent();
endspent()1677     pub fn endspent();
getspent() -> *mut spwd1678     pub fn getspent() -> *mut spwd;
1679 
getspnam(__name: *const ::c_char) -> *mut spwd1680     pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
1681 
shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int1682     pub fn shm_open(name: *const c_char, oflag: ::c_int,
1683                     mode: mode_t) -> ::c_int;
1684 
1685     // System V IPC
shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int1686     pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void1687     pub fn shmat(shmid: ::c_int,
1688                  shmaddr: *const ::c_void,
1689                  shmflg: ::c_int) -> *mut ::c_void;
shmdt(shmaddr: *const ::c_void) -> ::c_int1690     pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int1691     pub fn shmctl(shmid: ::c_int,
1692                   cmd: ::c_int,
1693                   buf: *mut ::shmid_ds) -> ::c_int;
ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t1694     pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int1695     pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int;
semop(semid: ::c_int, sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int1696     pub fn semop(semid: ::c_int,
1697                  sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int;
semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int1698     pub fn semctl(semid: ::c_int,
1699                   semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int1700     pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int1701     pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t1702     pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
1703                   msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t;
msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, msgflg: ::c_int) -> ::c_int1704     pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
1705                   msgflg: ::c_int) -> ::c_int;
1706 
mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int1707     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
1708                     -> ::c_int;
__errno_location() -> *mut ::c_int1709     pub fn __errno_location() -> *mut ::c_int;
1710 
fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE1711     pub fn fopen64(filename: *const c_char,
1712                    mode: *const c_char) -> *mut ::FILE;
freopen64(filename: *const c_char, mode: *const c_char, file: *mut ::FILE) -> *mut ::FILE1713     pub fn freopen64(filename: *const c_char, mode: *const c_char,
1714                      file: *mut ::FILE) -> *mut ::FILE;
tmpfile64() -> *mut ::FILE1715     pub fn tmpfile64() -> *mut ::FILE;
fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int1716     pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int1717     pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int1718     pub fn fseeko64(stream: *mut ::FILE,
1719                     offset: ::off64_t,
1720                     whence: ::c_int) -> ::c_int;
ftello64(stream: *mut ::FILE) -> ::off64_t1721     pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int1722     pub fn fallocate(fd: ::c_int, mode: ::c_int,
1723                      offset: ::off_t, len: ::off_t) -> ::c_int;
posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int1724     pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
1725                            len: ::off_t) -> ::c_int;
readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t1726     pub fn readahead(fd: ::c_int, offset: ::off64_t,
1727                      count: ::size_t) -> ::ssize_t;
getxattr(path: *const c_char, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t1728     pub fn getxattr(path: *const c_char, name: *const c_char,
1729                     value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
lgetxattr(path: *const c_char, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t1730     pub fn lgetxattr(path: *const c_char, name: *const c_char,
1731                      value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
fgetxattr(filedes: ::c_int, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t1732     pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
1733                      value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
setxattr(path: *const c_char, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int1734     pub fn setxattr(path: *const c_char, name: *const c_char,
1735                     value: *const ::c_void, size: ::size_t,
1736                     flags: ::c_int) -> ::c_int;
lsetxattr(path: *const c_char, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int1737     pub fn lsetxattr(path: *const c_char, name: *const c_char,
1738                      value: *const ::c_void, size: ::size_t,
1739                      flags: ::c_int) -> ::c_int;
fsetxattr(filedes: ::c_int, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int1740     pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
1741                      value: *const ::c_void, size: ::size_t,
1742                      flags: ::c_int) -> ::c_int;
listxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t1743     pub fn listxattr(path: *const c_char, list: *mut c_char,
1744                      size: ::size_t) -> ::ssize_t;
llistxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t1745     pub fn llistxattr(path: *const c_char, list: *mut c_char,
1746                       size: ::size_t) -> ::ssize_t;
flistxattr(filedes: ::c_int, list: *mut c_char, size: ::size_t) -> ::ssize_t1747     pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
1748                       size: ::size_t) -> ::ssize_t;
removexattr(path: *const c_char, name: *const c_char) -> ::c_int1749     pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int1750     pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int1751     pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int1752     pub fn signalfd(fd: ::c_int,
1753                     mask: *const ::sigset_t,
1754                     flags: ::c_int) -> ::c_int;
timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int1755     pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int;
timerfd_gettime(fd: ::c_int, curr_value: *mut itimerspec) -> ::c_int1756     pub fn timerfd_gettime(fd: ::c_int,
1757                            curr_value: *mut itimerspec) -> ::c_int;
timerfd_settime(fd: ::c_int, flags: ::c_int, new_value: *const itimerspec, old_value: *mut itimerspec) -> ::c_int1758     pub fn timerfd_settime(fd: ::c_int,
1759                            flags: ::c_int,
1760                            new_value: *const itimerspec,
1761                            old_value: *mut itimerspec) -> ::c_int;
pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t1762     pub fn pwritev(fd: ::c_int,
1763                    iov: *const ::iovec,
1764                    iovcnt: ::c_int,
1765                    offset: ::off_t) -> ::ssize_t;
preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t1766     pub fn preadv(fd: ::c_int,
1767                   iov: *const ::iovec,
1768                   iovcnt: ::c_int,
1769                   offset: ::off_t) -> ::ssize_t;
quotactl(cmd: ::c_int, special: *const ::c_char, id: ::c_int, data: *mut ::c_char) -> ::c_int1770     pub fn quotactl(cmd: ::c_int,
1771                     special: *const ::c_char,
1772                     id: ::c_int,
1773                     data: *mut ::c_char) -> ::c_int;
mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t1774     pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
mq_close(mqd: ::mqd_t) -> ::c_int1775     pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
mq_unlink(name: *const ::c_char) -> ::c_int1776     pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
mq_receive(mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msq_prio: *mut ::c_uint) -> ::ssize_t1777     pub fn mq_receive(mqd: ::mqd_t,
1778                       msg_ptr: *mut ::c_char,
1779                       msg_len: ::size_t,
1780                       msq_prio: *mut ::c_uint) -> ::ssize_t;
mq_send(mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msq_prio: ::c_uint) -> ::c_int1781     pub fn mq_send(mqd: ::mqd_t,
1782                    msg_ptr: *const ::c_char,
1783                    msg_len: ::size_t,
1784                    msq_prio: ::c_uint) -> ::c_int;
mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int1785     pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int1786     pub fn mq_setattr(mqd: ::mqd_t,
1787                       newattr: *const ::mq_attr,
1788                       oldattr: *mut ::mq_attr) -> ::c_int;
epoll_pwait(epfd: ::c_int, events: *mut ::epoll_event, maxevents: ::c_int, timeout: ::c_int, sigmask: *const ::sigset_t) -> ::c_int1789     pub fn epoll_pwait(epfd: ::c_int,
1790                        events: *mut ::epoll_event,
1791                        maxevents: ::c_int,
1792                        timeout: ::c_int,
1793                        sigmask: *const ::sigset_t) -> ::c_int;
dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int1794     pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int1795     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int1796     pub fn mkostemps(template: *mut ::c_char,
1797                      suffixlen: ::c_int,
1798                      flags: ::c_int) -> ::c_int;
sigtimedwait(set: *const sigset_t, info: *mut siginfo_t, timeout: *const ::timespec) -> ::c_int1799     pub fn sigtimedwait(set: *const sigset_t,
1800                         info: *mut siginfo_t,
1801                         timeout: *const ::timespec) -> ::c_int;
sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int1802     pub fn sigwaitinfo(set: *const sigset_t,
1803                        info: *mut siginfo_t) -> ::c_int;
nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char1804     pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, sevlen: ::socklen_t, flags: ::c_int) -> ::c_int1805     pub fn getnameinfo(sa: *const ::sockaddr,
1806                        salen: ::socklen_t,
1807                        host: *mut ::c_char,
1808                        hostlen: ::socklen_t,
1809                        serv: *mut ::c_char,
1810                        sevlen: ::socklen_t,
1811                        flags: ::c_int) -> ::c_int;
pthread_setschedprio(native: ::pthread_t, priority: ::c_int) -> ::c_int1812     pub fn pthread_setschedprio(native: ::pthread_t,
1813                                 priority: ::c_int) -> ::c_int;
prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit, old_limit: *mut ::rlimit) -> ::c_int1814     pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit,
1815                    old_limit: *mut ::rlimit) -> ::c_int;
prlimit64(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit64, old_limit: *mut ::rlimit64) -> ::c_int1816     pub fn prlimit64(pid: ::pid_t,
1817                      resource: ::c_int,
1818                      new_limit: *const ::rlimit64,
1819                      old_limit: *mut ::rlimit64) -> ::c_int;
getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int1820     pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
process_vm_readv(pid: ::pid_t, local_iov: *const ::iovec, liovcnt: ::c_ulong, remote_iov: *const ::iovec, riovcnt: ::c_ulong, flags: ::c_ulong) -> isize1821     pub fn process_vm_readv(pid: ::pid_t,
1822                             local_iov: *const ::iovec,
1823                             liovcnt: ::c_ulong,
1824                             remote_iov: *const ::iovec,
1825                             riovcnt: ::c_ulong,
1826                             flags: ::c_ulong) -> isize;
process_vm_writev(pid: ::pid_t, local_iov: *const ::iovec, liovcnt: ::c_ulong, remote_iov: *const ::iovec, riovcnt: ::c_ulong, flags: ::c_ulong) -> isize1827     pub fn process_vm_writev(pid: ::pid_t,
1828                              local_iov: *const ::iovec,
1829                              liovcnt: ::c_ulong,
1830                              remote_iov: *const ::iovec,
1831                              riovcnt: ::c_ulong,
1832                              flags: ::c_ulong) -> isize;
reboot(how_to: ::c_int) -> ::c_int1833     pub fn reboot(how_to: ::c_int) -> ::c_int;
setfsgid(gid: ::gid_t) -> ::c_int1834     pub fn setfsgid(gid: ::gid_t) -> ::c_int;
setfsuid(uid: ::uid_t) -> ::c_int1835     pub fn setfsuid(uid: ::uid_t) -> ::c_int;
1836 
1837     // Not available now on Android
mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int1838     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
1839                     mode: ::mode_t) -> ::c_int;
if_nameindex() -> *mut if_nameindex1840     pub fn if_nameindex() -> *mut if_nameindex;
if_freenameindex(ptr: *mut if_nameindex)1841     pub fn if_freenameindex(ptr: *mut if_nameindex);
sync_file_range(fd: ::c_int, offset: ::off64_t, nbytes: ::off64_t, flags: ::c_uint) -> ::c_int1842     pub fn sync_file_range(fd: ::c_int, offset: ::off64_t,
1843                            nbytes: ::off64_t, flags: ::c_uint) -> ::c_int;
mremap(addr: *mut ::c_void, len: ::size_t, new_len: ::size_t, flags: ::c_int, ...) -> *mut ::c_void1844     pub fn mremap(addr: *mut ::c_void,
1845                   len: ::size_t,
1846                   new_len: ::size_t,
1847                   flags: ::c_int,
1848                   ...) -> *mut ::c_void;
1849 
glob(pattern: *const c_char, flags: ::c_int, errfunc: Option<extern fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int1850     pub fn glob(pattern: *const c_char,
1851                 flags: ::c_int,
1852                 errfunc: Option<extern fn(epath: *const c_char,
1853                                           errno: ::c_int) -> ::c_int>,
1854                 pglob: *mut ::glob_t) -> ::c_int;
globfree(pglob: *mut ::glob_t)1855     pub fn globfree(pglob: *mut ::glob_t);
1856 
posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1857     pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
1858                          -> ::c_int;
1859 
shm_unlink(name: *const ::c_char) -> ::c_int1860     pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1861 
seekdir(dirp: *mut ::DIR, loc: ::c_long)1862     pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
1863 
telldir(dirp: *mut ::DIR) -> ::c_long1864     pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1865     pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
1866                   -> ::c_int;
1867 
msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int1868     pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
remap_file_pages(addr: *mut ::c_void, size: ::size_t, prot: ::c_int, pgoff: ::size_t, flags: ::c_int) -> ::c_int1869     pub fn remap_file_pages(addr: *mut ::c_void, size: ::size_t, prot: ::c_int,
1870                             pgoff: ::size_t, flags: ::c_int) -> ::c_int;
recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::ssize_t1871     pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
1872                     flags: ::c_int, addr: *mut ::sockaddr,
1873                     addrlen: *mut ::socklen_t) -> ::ssize_t;
mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int1874     pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int1875     pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
nl_langinfo(item: ::nl_item) -> *mut ::c_char1876     pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
1877 
getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int1878     pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int1879     pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
vhangup() -> ::c_int1880     pub fn vhangup() -> ::c_int;
sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, flags: ::c_int) -> ::c_int1881     pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
1882                     flags: ::c_int) -> ::c_int;
recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, flags: ::c_int, timeout: *mut ::timespec) -> ::c_int1883     pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
1884                     flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
sync()1885     pub fn sync();
syscall(num: ::c_long, ...) -> ::c_long1886     pub fn syscall(num: ::c_long, ...) -> ::c_long;
sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *mut cpu_set_t) -> ::c_int1887     pub fn sched_getaffinity(pid: ::pid_t,
1888                              cpusetsize: ::size_t,
1889                              cpuset: *mut cpu_set_t) -> ::c_int;
sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *const cpu_set_t) -> ::c_int1890     pub fn sched_setaffinity(pid: ::pid_t,
1891                              cpusetsize: ::size_t,
1892                              cpuset: *const cpu_set_t) -> ::c_int;
epoll_create(size: ::c_int) -> ::c_int1893     pub fn epoll_create(size: ::c_int) -> ::c_int;
epoll_create1(flags: ::c_int) -> ::c_int1894     pub fn epoll_create1(flags: ::c_int) -> ::c_int;
epoll_wait(epfd: ::c_int, events: *mut ::epoll_event, maxevents: ::c_int, timeout: ::c_int) -> ::c_int1895     pub fn epoll_wait(epfd: ::c_int,
1896                       events: *mut ::epoll_event,
1897                       maxevents: ::c_int,
1898                       timeout: ::c_int) -> ::c_int;
epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event) -> ::c_int1899     pub fn epoll_ctl(epfd: ::c_int,
1900                      op: ::c_int,
1901                      fd: ::c_int,
1902                      event: *mut ::epoll_event) -> ::c_int;
pthread_getschedparam(native: ::pthread_t, policy: *mut ::c_int, param: *mut ::sched_param) -> ::c_int1903     pub fn pthread_getschedparam(native: ::pthread_t,
1904                                  policy: *mut ::c_int,
1905                                  param: *mut ::sched_param) -> ::c_int;
unshare(flags: ::c_int) -> ::c_int1906     pub fn unshare(flags: ::c_int) -> ::c_int;
umount(target: *const ::c_char) -> ::c_int1907     pub fn umount(target: *const ::c_char) -> ::c_int;
sched_get_priority_max(policy: ::c_int) -> ::c_int1908     pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t1909     pub fn tee(fd_in: ::c_int,
1910                fd_out: ::c_int,
1911                len: ::size_t,
1912                flags: ::c_uint) -> ::ssize_t;
settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int1913     pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
splice(fd_in: ::c_int, off_in: *mut ::loff_t, fd_out: ::c_int, off_out: *mut ::loff_t, len: ::size_t, flags: ::c_uint) -> ::ssize_t1914     pub fn splice(fd_in: ::c_int,
1915                   off_in: *mut ::loff_t,
1916                   fd_out: ::c_int,
1917                   off_out: *mut ::loff_t,
1918                   len: ::size_t,
1919                   flags: ::c_uint) -> ::ssize_t;
eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int1920     pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int1921     pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int1922     pub fn sem_timedwait(sem: *mut sem_t,
1923                          abstime: *const ::timespec) -> ::c_int;
sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int1924     pub fn sem_getvalue(sem: *mut sem_t,
1925                         sval: *mut ::c_int) -> ::c_int;
sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int1926     pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
setns(fd: ::c_int, nstype: ::c_int) -> ::c_int1927     pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
swapoff(puath: *const ::c_char) -> ::c_int1928     pub fn swapoff(puath: *const ::c_char) -> ::c_int;
vmsplice(fd: ::c_int, iov: *const ::iovec, nr_segs: ::size_t, flags: ::c_uint) -> ::ssize_t1929     pub fn vmsplice(fd: ::c_int,
1930                     iov: *const ::iovec,
1931                     nr_segs: ::size_t,
1932                     flags: ::c_uint) -> ::ssize_t;
mount(src: *const ::c_char, target: *const ::c_char, fstype: *const ::c_char, flags: ::c_ulong, data: *const ::c_void) -> ::c_int1933     pub fn mount(src: *const ::c_char,
1934                  target: *const ::c_char,
1935                  fstype: *const ::c_char,
1936                  flags: ::c_ulong,
1937                  data: *const ::c_void) -> ::c_int;
personality(persona: ::c_ulong) -> ::c_int1938     pub fn personality(persona: ::c_ulong) -> ::c_int;
prctl(option: ::c_int, ...) -> ::c_int1939     pub fn prctl(option: ::c_int, ...) -> ::c_int;
sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int1940     pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
ppoll(fds: *mut ::pollfd, nfds: nfds_t, timeout: *const ::timespec, sigmask: *const sigset_t) -> ::c_int1941     pub fn ppoll(fds: *mut ::pollfd,
1942                  nfds: nfds_t,
1943                  timeout: *const ::timespec,
1944                  sigmask: *const sigset_t) -> ::c_int;
pthread_mutex_timedlock(lock: *mut pthread_mutex_t, abstime: *const ::timespec) -> ::c_int1945     pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
1946                                    abstime: *const ::timespec) -> ::c_int;
clone(cb: extern fn(*mut ::c_void) -> ::c_int, child_stack: *mut ::c_void, flags: ::c_int, arg: *mut ::c_void, ...) -> ::c_int1947     pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
1948                  child_stack: *mut ::c_void,
1949                  flags: ::c_int,
1950                  arg: *mut ::c_void, ...) -> ::c_int;
sched_getscheduler(pid: ::pid_t) -> ::c_int1951     pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
clock_nanosleep(clk_id: ::clockid_t, flags: ::c_int, rqtp: *const ::timespec, rmtp: *mut ::timespec) -> ::c_int1952     pub fn clock_nanosleep(clk_id: ::clockid_t,
1953                            flags: ::c_int,
1954                            rqtp: *const ::timespec,
1955                            rmtp:  *mut ::timespec) -> ::c_int;
pthread_attr_getguardsize(attr: *const ::pthread_attr_t, guardsize: *mut ::size_t) -> ::c_int1956     pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
1957                                      guardsize: *mut ::size_t) -> ::c_int;
sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int1958     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
sched_get_priority_min(policy: ::c_int) -> ::c_int1959     pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
pthread_condattr_getpshared(attr: *const pthread_condattr_t, pshared: *mut ::c_int) -> ::c_int1960     pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
1961                                        pshared: *mut ::c_int) -> ::c_int;
sysinfo(info: *mut ::sysinfo) -> ::c_int1962     pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int;
umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int1963     pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
pthread_setschedparam(native: ::pthread_t, policy: ::c_int, param: *const ::sched_param) -> ::c_int1964     pub fn pthread_setschedparam(native: ::pthread_t,
1965                                  policy: ::c_int,
1966                                  param: *const ::sched_param) -> ::c_int;
swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int1967     pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
sched_setscheduler(pid: ::pid_t, policy: ::c_int, param: *const ::sched_param) -> ::c_int1968     pub fn sched_setscheduler(pid: ::pid_t,
1969                               policy: ::c_int,
1970                               param: *const ::sched_param) -> ::c_int;
sendfile(out_fd: ::c_int, in_fd: ::c_int, offset: *mut off_t, count: ::size_t) -> ::ssize_t1971     pub fn sendfile(out_fd: ::c_int,
1972                     in_fd: ::c_int,
1973                     offset: *mut off_t,
1974                     count: ::size_t) -> ::ssize_t;
sigsuspend(mask: *const ::sigset_t) -> ::c_int1975     pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
1976     #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
getgrgid_r(uid: ::uid_t, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int1977     pub fn getgrgid_r(uid: ::uid_t,
1978                       grp: *mut ::group,
1979                       buf: *mut ::c_char,
1980                       buflen: ::size_t,
1981                       result: *mut *mut ::group) -> ::c_int;
1982     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1983                link_name = "sigaltstack$UNIX2003")]
1984     #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int1985     pub fn sigaltstack(ss: *const stack_t,
1986                        oss: *mut stack_t) -> ::c_int;
sem_close(sem: *mut sem_t) -> ::c_int1987     pub fn sem_close(sem: *mut sem_t) -> ::c_int;
getdtablesize() -> ::c_int1988     pub fn getdtablesize() -> ::c_int;
1989     #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
getgrnam_r(name: *const ::c_char, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int1990     pub fn getgrnam_r(name: *const ::c_char,
1991                       grp: *mut ::group,
1992                       buf: *mut ::c_char,
1993                       buflen: ::size_t,
1994                       result: *mut *mut ::group) -> ::c_int;
initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int1995     pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
1996     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1997                link_name = "pthread_sigmask$UNIX2003")]
pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1998     pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
1999                            oldset: *mut sigset_t) -> ::c_int;
sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t2000     pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
getgrnam(name: *const ::c_char) -> *mut ::group2001     pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pthread_cancel(thread: ::pthread_t) -> ::c_int2002     pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int2003     pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
sem_unlink(name: *const ::c_char) -> ::c_int2004     pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int2005     pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
2006     #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
2007     #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
getpwnam_r(name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int2008     pub fn getpwnam_r(name: *const ::c_char,
2009                       pwd: *mut passwd,
2010                       buf: *mut ::c_char,
2011                       buflen: ::size_t,
2012                       result: *mut *mut passwd) -> ::c_int;
2013     #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
2014     #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int2015     pub fn getpwuid_r(uid: ::uid_t,
2016                       pwd: *mut passwd,
2017                       buf: *mut ::c_char,
2018                       buflen: ::size_t,
2019                       result: *mut *mut passwd) -> ::c_int;
2020     #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
2021                link_name = "sigwait$UNIX2003")]
2022     #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int2023     pub fn sigwait(set: *const sigset_t,
2024                    sig: *mut ::c_int) -> ::c_int;
pthread_atfork(prepare: Option<unsafe extern fn()>, parent: Option<unsafe extern fn()>, child: Option<unsafe extern fn()>) -> ::c_int2025     pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
2026                           parent: Option<unsafe extern fn()>,
2027                           child: Option<unsafe extern fn()>) -> ::c_int;
getgrgid(gid: ::gid_t) -> *mut ::group2028     pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
getgrouplist(user: *const ::c_char, group: ::gid_t, groups: *mut ::gid_t, ngroups: *mut ::c_int) -> ::c_int2029     pub fn getgrouplist(user: *const ::c_char,
2030                         group: ::gid_t,
2031                         groups: *mut ::gid_t,
2032                         ngroups: *mut ::c_int) -> ::c_int;
pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, pshared: *mut ::c_int) -> ::c_int2033     pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
2034                                         pshared: *mut ::c_int) -> ::c_int;
2035     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
2036                link_name = "popen$UNIX2003")]
popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE2037     pub fn popen(command: *const c_char,
2038                  mode: *const c_char) -> *mut ::FILE;
faccessat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::c_int, flags: ::c_int) -> ::c_int2039     pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
2040                      mode: ::c_int, flags: ::c_int) -> ::c_int;
pthread_create(native: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int2041     pub fn pthread_create(native: *mut ::pthread_t,
2042                           attr: *const ::pthread_attr_t,
2043                           f: extern fn(*mut ::c_void) -> *mut ::c_void,
2044                           value: *mut ::c_void) -> ::c_int;
dl_iterate_phdr( callback: Option<unsafe extern fn( info: *mut ::dl_phdr_info, size: ::size_t, data: *mut ::c_void ) -> ::c_int>, data: *mut ::c_void ) -> ::c_int2045     pub fn dl_iterate_phdr(
2046         callback: Option<unsafe extern fn(
2047             info: *mut ::dl_phdr_info,
2048             size: ::size_t,
2049             data: *mut ::c_void
2050         ) -> ::c_int>,
2051         data: *mut ::c_void
2052     ) -> ::c_int;
2053 
setmntent(filename: *const ::c_char, ty: *const ::c_char) -> *mut ::FILE2054     pub fn setmntent(filename: *const ::c_char,
2055                      ty: *const ::c_char) -> *mut ::FILE;
getmntent(stream: *mut ::FILE) -> *mut ::mntent2056     pub fn getmntent(stream: *mut ::FILE) -> *mut ::mntent;
addmntent(stream: *mut ::FILE, mnt: *const ::mntent) -> ::c_int2057     pub fn addmntent(stream: *mut ::FILE, mnt: *const ::mntent) -> ::c_int;
endmntent(streamp: *mut ::FILE) -> ::c_int2058     pub fn endmntent(streamp: *mut ::FILE) -> ::c_int;
hasmntopt(mnt: *const ::mntent, opt: *const ::c_char) -> *mut ::c_char2059     pub fn hasmntopt(mnt: *const ::mntent,
2060                      opt: *const ::c_char) -> *mut ::c_char;
2061 
posix_spawn(pid: *mut ::pid_t, path: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int2062     pub fn posix_spawn(pid: *mut ::pid_t,
2063                        path: *const ::c_char,
2064                        file_actions: *const ::posix_spawn_file_actions_t,
2065                        attrp: *const ::posix_spawnattr_t,
2066                        argv: *const *mut ::c_char,
2067                        envp: *const *mut ::c_char) -> ::c_int;
posix_spawnp(pid: *mut ::pid_t, file: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int2068     pub fn posix_spawnp(pid: *mut ::pid_t,
2069                        file: *const ::c_char,
2070                         file_actions: *const ::posix_spawn_file_actions_t,
2071                         attrp: *const ::posix_spawnattr_t,
2072                         argv: *const *mut ::c_char,
2073                         envp: *const *mut ::c_char) -> ::c_int;
posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int2074     pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int2075     pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t, default: *mut ::sigset_t) -> ::c_int2076     pub fn posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t,
2077                                          default: *mut ::sigset_t) -> ::c_int;
posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t, default: *const ::sigset_t) -> ::c_int2078     pub fn posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t,
2079                                          default: *const ::sigset_t) -> ::c_int;
posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t, default: *mut ::sigset_t) -> ::c_int2080     pub fn posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t,
2081                                       default: *mut ::sigset_t) -> ::c_int;
posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t, default: *const ::sigset_t) -> ::c_int2082     pub fn posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t,
2083                                       default: *const ::sigset_t) -> ::c_int;
posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut ::c_short) -> ::c_int2084     pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t,
2085                                     flags: *mut ::c_short) -> ::c_int;
posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int2086     pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t,
2087                                     flags: ::c_short) -> ::c_int;
posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, flags: *mut ::pid_t) -> ::c_int2088     pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t,
2089                                      flags: *mut ::pid_t) -> ::c_int;
posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int2090     pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t,
2091                                      flags: ::pid_t) -> ::c_int;
posix_spawnattr_getschedpolicy(attr: *const posix_spawnattr_t, flags: *mut ::c_int) -> ::c_int2092     pub fn posix_spawnattr_getschedpolicy(attr: *const posix_spawnattr_t,
2093                                           flags: *mut ::c_int) -> ::c_int;
posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int2094     pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t,
2095                                           flags: ::c_int) -> ::c_int;
posix_spawnattr_getschedparam( attr: *const posix_spawnattr_t, param: *mut ::sched_param, ) -> ::c_int2096     pub fn posix_spawnattr_getschedparam(
2097         attr: *const posix_spawnattr_t,
2098         param: *mut ::sched_param,
2099     ) -> ::c_int;
posix_spawnattr_setschedparam( attr: *mut posix_spawnattr_t, param: *const ::sched_param, ) -> ::c_int2100     pub fn posix_spawnattr_setschedparam(
2101         attr: *mut posix_spawnattr_t,
2102         param: *const ::sched_param,
2103     ) -> ::c_int;
2104 
posix_spawn_file_actions_init( actions: *mut posix_spawn_file_actions_t, ) -> ::c_int2105     pub fn posix_spawn_file_actions_init(
2106         actions: *mut posix_spawn_file_actions_t,
2107     ) -> ::c_int;
posix_spawn_file_actions_destroy( actions: *mut posix_spawn_file_actions_t, ) -> ::c_int2108     pub fn posix_spawn_file_actions_destroy(
2109         actions: *mut posix_spawn_file_actions_t,
2110     ) -> ::c_int;
posix_spawn_file_actions_addopen( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, path: *const ::c_char, oflag: ::c_int, mode: ::mode_t, ) -> ::c_int2111     pub fn posix_spawn_file_actions_addopen(
2112         actions: *mut posix_spawn_file_actions_t,
2113         fd: ::c_int,
2114         path: *const ::c_char,
2115         oflag: ::c_int,
2116         mode: ::mode_t,
2117     ) -> ::c_int;
posix_spawn_file_actions_addclose( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, ) -> ::c_int2118     pub fn posix_spawn_file_actions_addclose(
2119         actions: *mut posix_spawn_file_actions_t,
2120         fd: ::c_int,
2121     ) -> ::c_int;
posix_spawn_file_actions_adddup2( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, newfd: ::c_int, ) -> ::c_int2122     pub fn posix_spawn_file_actions_adddup2(
2123         actions: *mut posix_spawn_file_actions_t,
2124         fd: ::c_int,
2125         newfd: ::c_int,
2126     ) -> ::c_int;
fread_unlocked(ptr: *mut ::c_void, size: ::size_t, nobj: ::size_t, stream: *mut ::FILE ) -> ::size_t2127     pub fn fread_unlocked(ptr: *mut ::c_void,
2128         size: ::size_t,
2129         nobj: ::size_t,
2130         stream: *mut ::FILE
2131     ) -> ::size_t;
2132 }
2133 
2134 cfg_if! {
2135     if #[cfg(any(target_env = "musl", target_os = "fuchsia"))] {
2136         mod musl;
2137         pub use self::musl::*;
2138     } else if #[cfg(any(target_arch = "mips",
2139                         target_arch = "mips64"))] {
2140         mod mips;
2141         pub use self::mips::*;
2142     } else if #[cfg(any(target_arch = "s390x"))] {
2143         mod s390x;
2144         pub use self::s390x::*;
2145     } else {
2146         mod other;
2147         pub use self::other::*;
2148     }
2149 }
2150