xref: /rust-libc-0.2.174/src/fuchsia/mod.rs (revision b46b6e2e)
1 //! Definitions found commonly among almost all Unix derivatives
2 //!
3 //! More functions and definitions can be found in the more specific modules
4 //! according to the platform in question.
5 
6 use dox::{mem, Option};
7 
8 // PUB_TYPE
9 
10 pub type int8_t = i8;
11 pub type int16_t = i16;
12 pub type int32_t = i32;
13 pub type int64_t = i64;
14 pub type uint8_t = u8;
15 pub type uint16_t = u16;
16 pub type uint32_t = u32;
17 pub type uint64_t = u64;
18 
19 pub type c_schar = i8;
20 pub type c_uchar = u8;
21 pub type c_short = i16;
22 pub type c_ushort = u16;
23 pub type c_int = i32;
24 pub type c_uint = u32;
25 pub type c_float = f32;
26 pub type c_double = f64;
27 pub type c_longlong = i64;
28 pub type c_ulonglong = u64;
29 pub type intmax_t = i64;
30 pub type uintmax_t = u64;
31 
32 pub type size_t = usize;
33 pub type ptrdiff_t = isize;
34 pub type intptr_t = isize;
35 pub type uintptr_t = usize;
36 pub type ssize_t = isize;
37 
38 pub type pid_t = i32;
39 pub type uid_t = u32;
40 pub type gid_t = u32;
41 pub type in_addr_t = u32;
42 pub type in_port_t = u16;
43 pub type sighandler_t = ::size_t;
44 pub type cc_t = ::c_uchar;
45 pub type sa_family_t = u16;
46 pub type pthread_key_t = ::c_uint;
47 pub type speed_t = ::c_uint;
48 pub type tcflag_t = ::c_uint;
49 pub type clockid_t = ::c_int;
50 pub type key_t = ::c_int;
51 pub type id_t = ::c_uint;
52 pub type useconds_t = u32;
53 pub type dev_t = u64;
54 pub type socklen_t = u32;
55 pub type pthread_t = c_ulong;
56 pub type mode_t = u32;
57 pub type ino64_t = u64;
58 pub type off64_t = i64;
59 pub type blkcnt64_t = i64;
60 pub type rlim64_t = u64;
61 pub type mqd_t = ::c_int;
62 pub type nfds_t = ::c_ulong;
63 pub type nl_item = ::c_int;
64 pub type idtype_t = ::c_uint;
65 pub type loff_t = ::c_longlong;
66 
67 pub type __u8 = ::c_uchar;
68 pub type __u16 = ::c_ushort;
69 pub type __s16 = ::c_short;
70 pub type __u32 = ::c_uint;
71 pub type __s32 = ::c_int;
72 
73 pub type Elf32_Half = u16;
74 pub type Elf32_Word = u32;
75 pub type Elf32_Off = u32;
76 pub type Elf32_Addr = u32;
77 
78 pub type Elf64_Half = u16;
79 pub type Elf64_Word = u32;
80 pub type Elf64_Off = u64;
81 pub type Elf64_Addr = u64;
82 pub type Elf64_Xword = u64;
83 
84 pub type clock_t = c_long;
85 pub type time_t = c_long;
86 pub type suseconds_t = c_long;
87 pub type ino_t = u64;
88 pub type off_t = i64;
89 pub type blkcnt_t = i64;
90 
91 pub type shmatt_t = ::c_ulong;
92 pub type msgqnum_t = ::c_ulong;
93 pub type msglen_t = ::c_ulong;
94 pub type fsblkcnt_t = ::c_ulonglong;
95 pub type fsfilcnt_t = ::c_ulonglong;
96 pub type rlim_t = ::c_ulonglong;
97 
98 pub type c_long = i64;
99 pub type c_ulong = u64;
100 
101 // FIXME: why are these uninhabited types? that seems... wrong?
102 // Presumably these should be `()` or an `extern type` (when that stabilizes).
103 pub enum timezone {}
104 pub enum DIR {}
105 pub enum locale_t {}
106 pub enum fpos64_t {} // TODO: fill this out with a struct
107 
108 // PUB_STRUCT
109 
110 s! {
111     pub struct group {
112         pub gr_name: *mut ::c_char,
113         pub gr_passwd: *mut ::c_char,
114         pub gr_gid: ::gid_t,
115         pub gr_mem: *mut *mut ::c_char,
116     }
117 
118     pub struct utimbuf {
119         pub actime: time_t,
120         pub modtime: time_t,
121     }
122 
123     pub struct timeval {
124         pub tv_sec: time_t,
125         pub tv_usec: suseconds_t,
126     }
127 
128     pub struct timespec {
129         pub tv_sec: time_t,
130         pub tv_nsec: ::c_long,
131     }
132 
133     // FIXME: the rlimit and rusage related functions and types don't exist
134     // within zircon. Are there reasons for keeping them around?
135     pub struct rlimit {
136         pub rlim_cur: rlim_t,
137         pub rlim_max: rlim_t,
138     }
139 
140     pub struct rusage {
141         pub ru_utime: timeval,
142         pub ru_stime: timeval,
143         pub ru_maxrss: c_long,
144         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
145         __pad1: u32,
146         pub ru_ixrss: c_long,
147         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
148         __pad2: u32,
149         pub ru_idrss: c_long,
150         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
151         __pad3: u32,
152         pub ru_isrss: c_long,
153         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
154         __pad4: u32,
155         pub ru_minflt: c_long,
156         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
157         __pad5: u32,
158         pub ru_majflt: c_long,
159         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
160         __pad6: u32,
161         pub ru_nswap: c_long,
162         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
163         __pad7: u32,
164         pub ru_inblock: c_long,
165         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
166         __pad8: u32,
167         pub ru_oublock: c_long,
168         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
169         __pad9: u32,
170         pub ru_msgsnd: c_long,
171         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
172         __pad10: u32,
173         pub ru_msgrcv: c_long,
174         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
175         __pad11: u32,
176         pub ru_nsignals: c_long,
177         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
178         __pad12: u32,
179         pub ru_nvcsw: c_long,
180         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
181         __pad13: u32,
182         pub ru_nivcsw: c_long,
183         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
184         __pad14: u32,
185 
186         #[cfg(any(target_env = "musl", target_os = "emscripten"))]
187         __reserved: [c_long; 16],
188     }
189 
190     pub struct in_addr {
191         pub s_addr: in_addr_t,
192     }
193 
194     pub struct in6_addr {
195         pub s6_addr: [u8; 16],
196     }
197 
198     pub struct ip_mreq {
199         pub imr_multiaddr: in_addr,
200         pub imr_interface: in_addr,
201     }
202 
203     pub struct ipv6_mreq {
204         pub ipv6mr_multiaddr: in6_addr,
205         pub ipv6mr_interface: ::c_uint,
206     }
207 
208     pub struct hostent {
209         pub h_name: *mut ::c_char,
210         pub h_aliases: *mut *mut ::c_char,
211         pub h_addrtype: ::c_int,
212         pub h_length: ::c_int,
213         pub h_addr_list: *mut *mut ::c_char,
214     }
215 
216     pub struct iovec {
217         pub iov_base: *mut ::c_void,
218         pub iov_len: ::size_t,
219     }
220 
221     pub struct pollfd {
222         pub fd: ::c_int,
223         pub events: ::c_short,
224         pub revents: ::c_short,
225     }
226 
227     pub struct winsize {
228         pub ws_row: ::c_ushort,
229         pub ws_col: ::c_ushort,
230         pub ws_xpixel: ::c_ushort,
231         pub ws_ypixel: ::c_ushort,
232     }
233 
234     pub struct linger {
235         pub l_onoff: ::c_int,
236         pub l_linger: ::c_int,
237     }
238 
239     pub struct sigval {
240         // Actually a union of an int and a void*
241         pub sival_ptr: *mut ::c_void
242     }
243 
244     // <sys/time.h>
245     pub struct itimerval {
246         pub it_interval: ::timeval,
247         pub it_value: ::timeval,
248     }
249 
250     // <sys/times.h>
251     pub struct tms {
252         pub tms_utime: ::clock_t,
253         pub tms_stime: ::clock_t,
254         pub tms_cutime: ::clock_t,
255         pub tms_cstime: ::clock_t,
256     }
257 
258     pub struct servent {
259         pub s_name: *mut ::c_char,
260         pub s_aliases: *mut *mut ::c_char,
261         pub s_port: ::c_int,
262         pub s_proto: *mut ::c_char,
263     }
264 
265     pub struct protoent {
266         pub p_name: *mut ::c_char,
267         pub p_aliases: *mut *mut ::c_char,
268         pub p_proto: ::c_int,
269     }
270 
271     pub struct aiocb {
272         pub aio_fildes: ::c_int,
273         pub aio_lio_opcode: ::c_int,
274         pub aio_reqprio: ::c_int,
275         pub aio_buf: *mut ::c_void,
276         pub aio_nbytes: ::size_t,
277         pub aio_sigevent: ::sigevent,
278         __td: *mut ::c_void,
279         __lock: [::c_int; 2],
280         __err: ::c_int,
281         __ret: ::ssize_t,
282         pub aio_offset: off_t,
283         __next: *mut ::c_void,
284         __prev: *mut ::c_void,
285         #[cfg(target_pointer_width = "32")]
286         __dummy4: [::c_char; 24],
287         #[cfg(target_pointer_width = "64")]
288         __dummy4: [::c_char; 16],
289     }
290 
291     pub struct sigaction {
292         pub sa_sigaction: ::sighandler_t,
293         pub sa_mask: ::sigset_t,
294         pub sa_flags: ::c_int,
295         pub sa_restorer: ::dox::Option<extern fn()>,
296     }
297 
298     pub struct termios {
299         pub c_iflag: ::tcflag_t,
300         pub c_oflag: ::tcflag_t,
301         pub c_cflag: ::tcflag_t,
302         pub c_lflag: ::tcflag_t,
303         pub c_line: ::cc_t,
304         pub c_cc: [::cc_t; ::NCCS],
305         pub __c_ispeed: ::speed_t,
306         pub __c_ospeed: ::speed_t,
307     }
308 
309     pub struct flock {
310         pub l_type: ::c_short,
311         pub l_whence: ::c_short,
312         pub l_start: ::off_t,
313         pub l_len: ::off_t,
314         pub l_pid: ::pid_t,
315     }
316 
317     pub struct sysinfo {
318         pub uptime: ::c_ulong,
319         pub loads: [::c_ulong; 3],
320         pub totalram: ::c_ulong,
321         pub freeram: ::c_ulong,
322         pub sharedram: ::c_ulong,
323         pub bufferram: ::c_ulong,
324         pub totalswap: ::c_ulong,
325         pub freeswap: ::c_ulong,
326         pub procs: ::c_ushort,
327         pub pad: ::c_ushort,
328         pub totalhigh: ::c_ulong,
329         pub freehigh: ::c_ulong,
330         pub mem_unit: ::c_uint,
331         pub __reserved: [::c_char; 256],
332     }
333 
334     pub struct ucred {
335         pub pid: ::pid_t,
336         pub uid: ::uid_t,
337         pub gid: ::gid_t,
338     }
339 
340     pub struct sockaddr {
341         pub sa_family: sa_family_t,
342         pub sa_data: [::c_char; 14],
343     }
344 
345     pub struct sockaddr_in {
346         pub sin_family: sa_family_t,
347         pub sin_port: ::in_port_t,
348         pub sin_addr: ::in_addr,
349         pub sin_zero: [u8; 8],
350     }
351 
352     pub struct sockaddr_in6 {
353         pub sin6_family: sa_family_t,
354         pub sin6_port: ::in_port_t,
355         pub sin6_flowinfo: u32,
356         pub sin6_addr: ::in6_addr,
357         pub sin6_scope_id: u32,
358     }
359 
360     pub struct sockaddr_un {
361         pub sun_family: sa_family_t,
362         pub sun_path: [::c_char; 108]
363     }
364 
365     pub struct sockaddr_storage {
366         pub ss_family: sa_family_t,
367         __ss_align: ::size_t,
368         __ss_pad2: [u8; 128 - 2 * 8],
369     }
370 
371     pub struct addrinfo {
372         pub ai_flags: ::c_int,
373         pub ai_family: ::c_int,
374         pub ai_socktype: ::c_int,
375         pub ai_protocol: ::c_int,
376         pub ai_addrlen: socklen_t,
377 
378         pub ai_addr: *mut ::sockaddr,
379 
380         pub ai_canonname: *mut c_char,
381 
382         pub ai_next: *mut addrinfo,
383     }
384 
385     pub struct sockaddr_nl {
386         pub nl_family: ::sa_family_t,
387         nl_pad: ::c_ushort,
388         pub nl_pid: u32,
389         pub nl_groups: u32
390     }
391 
392     pub struct sockaddr_ll {
393         pub sll_family: ::c_ushort,
394         pub sll_protocol: ::c_ushort,
395         pub sll_ifindex: ::c_int,
396         pub sll_hatype: ::c_ushort,
397         pub sll_pkttype: ::c_uchar,
398         pub sll_halen: ::c_uchar,
399         pub sll_addr: [::c_uchar; 8]
400     }
401 
402     pub struct fd_set {
403         fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
404     }
405 
406     pub struct tm {
407         pub tm_sec: ::c_int,
408         pub tm_min: ::c_int,
409         pub tm_hour: ::c_int,
410         pub tm_mday: ::c_int,
411         pub tm_mon: ::c_int,
412         pub tm_year: ::c_int,
413         pub tm_wday: ::c_int,
414         pub tm_yday: ::c_int,
415         pub tm_isdst: ::c_int,
416         pub tm_gmtoff: ::c_long,
417         pub tm_zone: *const ::c_char,
418     }
419 
420     pub struct sched_param {
421         pub sched_priority: ::c_int,
422         pub sched_ss_low_priority: ::c_int,
423         pub sched_ss_repl_period: ::timespec,
424         pub sched_ss_init_budget: ::timespec,
425         pub sched_ss_max_repl: ::c_int,
426     }
427 
428     pub struct Dl_info {
429         pub dli_fname: *const ::c_char,
430         pub dli_fbase: *mut ::c_void,
431         pub dli_sname: *const ::c_char,
432         pub dli_saddr: *mut ::c_void,
433     }
434 
435     pub struct epoll_event {
436         pub events: ::uint32_t,
437         pub u64: ::uint64_t,
438     }
439 
440     pub struct utsname {
441         pub sysname: [::c_char; 65],
442         pub nodename: [::c_char; 65],
443         pub release: [::c_char; 65],
444         pub version: [::c_char; 65],
445         pub machine: [::c_char; 65],
446         pub domainname: [::c_char; 65]
447     }
448 
449     pub struct lconv {
450         pub decimal_point: *mut ::c_char,
451         pub thousands_sep: *mut ::c_char,
452         pub grouping: *mut ::c_char,
453         pub int_curr_symbol: *mut ::c_char,
454         pub currency_symbol: *mut ::c_char,
455         pub mon_decimal_point: *mut ::c_char,
456         pub mon_thousands_sep: *mut ::c_char,
457         pub mon_grouping: *mut ::c_char,
458         pub positive_sign: *mut ::c_char,
459         pub negative_sign: *mut ::c_char,
460         pub int_frac_digits: ::c_char,
461         pub frac_digits: ::c_char,
462         pub p_cs_precedes: ::c_char,
463         pub p_sep_by_space: ::c_char,
464         pub n_cs_precedes: ::c_char,
465         pub n_sep_by_space: ::c_char,
466         pub p_sign_posn: ::c_char,
467         pub n_sign_posn: ::c_char,
468         pub int_p_cs_precedes: ::c_char,
469         pub int_p_sep_by_space: ::c_char,
470         pub int_n_cs_precedes: ::c_char,
471         pub int_n_sep_by_space: ::c_char,
472         pub int_p_sign_posn: ::c_char,
473         pub int_n_sign_posn: ::c_char,
474     }
475 
476     pub struct sigevent {
477         pub sigev_value: ::sigval,
478         pub sigev_signo: ::c_int,
479         pub sigev_notify: ::c_int,
480         pub sigev_notify_function: fn(::sigval),
481         pub sigev_notify_attributes: *mut pthread_attr_t,
482         pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */],
483     }
484 
485     pub struct dirent {
486         pub d_ino: ::ino_t,
487         pub d_off: ::off_t,
488         pub d_reclen: ::c_ushort,
489         pub d_type: ::c_uchar,
490         pub d_name: [::c_char; 256],
491     }
492 
493     pub struct dirent64 {
494         pub d_ino: ::ino64_t,
495         pub d_off: ::off64_t,
496         pub d_reclen: ::c_ushort,
497         pub d_type: ::c_uchar,
498         pub d_name: [::c_char; 256],
499     }
500 
501     pub struct rlimit64 {
502         pub rlim_cur: rlim64_t,
503         pub rlim_max: rlim64_t,
504     }
505 
506     pub struct glob_t {
507         pub gl_pathc: ::size_t,
508         pub gl_pathv: *mut *mut c_char,
509         pub gl_offs: ::size_t,
510         pub gl_flags: ::c_int,
511 
512         __unused1: *mut ::c_void,
513         __unused2: *mut ::c_void,
514         __unused3: *mut ::c_void,
515         __unused4: *mut ::c_void,
516         __unused5: *mut ::c_void,
517     }
518 
519     pub struct ifaddrs {
520         pub ifa_next: *mut ifaddrs,
521         pub ifa_name: *mut c_char,
522         pub ifa_flags: ::c_uint,
523         pub ifa_addr: *mut ::sockaddr,
524         pub ifa_netmask: *mut ::sockaddr,
525         pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
526         pub ifa_data: *mut ::c_void
527     }
528 
529     #[cfg_attr(all(feature = "align",
530                    target_pointer_width = "32",
531                    any(target_arch = "arm",
532                        target_arch = "x86_64")),
533                repr(align(4)))]
534     #[cfg_attr(all(feature = "align",
535                    any(target_pointer_width = "64",
536                        not(any(target_arch = "arm",
537                                target_arch = "x86_64")))),
538                repr(align(8)))]
539     pub struct pthread_mutex_t {
540         #[cfg(all(not(feature = "align"),
541                   any(target_arch = "arm",
542                       all(target_arch = "x86_64",
543                           target_pointer_width = "32"))))]
544         __align: [::c_long; 0],
545         #[cfg(not(any(feature = "align",
546                       target_arch = "arm",
547                       all(target_arch = "x86_64",
548                           target_pointer_width = "32"))))]
549         __align: [::c_longlong; 0],
550         size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
551     }
552 
553     #[cfg_attr(all(feature = "align",
554                    target_pointer_width = "32",
555                    any(target_arch = "arm",
556                        target_arch = "x86_64")),
557                repr(align(4)))]
558     #[cfg_attr(all(feature = "align",
559                    any(target_pointer_width = "64",
560                        not(any(target_arch = "arm",
561                                target_arch = "x86_64")))),
562                repr(align(8)))]
563     pub struct pthread_rwlock_t {
564         #[cfg(all(not(feature = "align"),
565                   any(target_arch = "arm",
566                       all(target_arch = "x86_64",
567                           target_pointer_width = "32"))))]
568         __align: [::c_long; 0],
569         #[cfg(not(any(feature = "align",
570                       target_arch = "arm",
571                       all(target_arch = "x86_64",
572                           target_pointer_width = "32"))))]
573         __align: [::c_longlong; 0],
574         size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
575     }
576 
577     #[cfg_attr(all(feature = "align",
578                    any(target_pointer_width = "32",
579                        target_arch = "x86_64",
580                        all(target_arch = "aarch64", target_env = "musl"))),
581                repr(align(4)))]
582     #[cfg_attr(all(feature = "align",
583                    not(any(target_pointer_width = "32",
584                            target_arch = "x86_64",
585                            all(target_arch = "aarch64", target_env = "musl")))),
586                repr(align(8)))]
587     pub struct pthread_mutexattr_t {
588         #[cfg(all(not(features = "align"),
589                   any(target_arch = "x86_64",
590                       all(target_arch = "aarch64", target_env = "musl"))))]
591         __align: [::c_int; 0],
592         #[cfg(all(not(features = "align"),
593                   not(any(target_arch = "x86_64",
594                           all(target_arch = "aarch64", target_env = "musl")))))]
595         __align: [::c_long; 0],
596         size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
597     }
598 
599     #[cfg_attr(all(feature = "align",
600                    any(target_env = "musl", target_pointer_width = "32")),
601                repr(align(4)))]
602     #[cfg_attr(all(feature = "align",
603                    not(target_env = "musl"),
604                    target_pointer_width = "64"),
605                repr(align(8)))]
606     pub struct pthread_rwlockattr_t {
607         #[cfg(all(not(feature = "align"), target_env = "musl"))]
608         __align: [::c_int; 0],
609         #[cfg(all(not(feature = "align"), not(target_env = "musl")))]
610         __align: [::c_long; 0],
611         size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
612     }
613 
614     #[cfg_attr(all(feature = "align",
615                    target_env = "musl",
616                    target_pointer_width = "32"),
617                repr(align(4)))]
618     #[cfg_attr(all(feature = "align",
619                    target_env = "musl",
620                    target_pointer_width = "64"),
621                repr(align(8)))]
622     #[cfg_attr(all(feature = "align",
623                    not(target_env = "musl"),
624                    target_arch = "x86"),
625                repr(align(4)))]
626     #[cfg_attr(all(feature = "align",
627                    not(target_env = "musl"),
628                    not(target_arch = "x86")),
629                repr(align(8)))]
630     pub struct pthread_cond_t {
631         #[cfg(all(not(feature = "align"), target_env = "musl"))]
632         __align: [*const ::c_void; 0],
633         #[cfg(not(any(feature = "align", target_env = "musl")))]
634         __align: [::c_longlong; 0],
635         size: [u8; __SIZEOF_PTHREAD_COND_T],
636     }
637 
638     #[cfg_attr(feature = "align", repr(align(4)))]
639     pub struct pthread_condattr_t {
640         #[cfg(not(feature = "align"))]
641         __align: [::c_int; 0],
642         size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
643     }
644 
645     pub struct passwd {
646         pub pw_name: *mut ::c_char,
647         pub pw_passwd: *mut ::c_char,
648         pub pw_uid: ::uid_t,
649         pub pw_gid: ::gid_t,
650         pub pw_gecos: *mut ::c_char,
651         pub pw_dir: *mut ::c_char,
652         pub pw_shell: *mut ::c_char,
653     }
654 
655     pub struct spwd {
656         pub sp_namp: *mut ::c_char,
657         pub sp_pwdp: *mut ::c_char,
658         pub sp_lstchg: ::c_long,
659         pub sp_min: ::c_long,
660         pub sp_max: ::c_long,
661         pub sp_warn: ::c_long,
662         pub sp_inact: ::c_long,
663         pub sp_expire: ::c_long,
664         pub sp_flag: ::c_ulong,
665     }
666 
667     pub struct statvfs {
668         pub f_bsize: ::c_ulong,
669         pub f_frsize: ::c_ulong,
670         pub f_blocks: ::fsblkcnt_t,
671         pub f_bfree: ::fsblkcnt_t,
672         pub f_bavail: ::fsblkcnt_t,
673         pub f_files: ::fsfilcnt_t,
674         pub f_ffree: ::fsfilcnt_t,
675         pub f_favail: ::fsfilcnt_t,
676         #[cfg(target_endian = "little")]
677         pub f_fsid: ::c_ulong,
678         #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
679         __f_unused: ::c_int,
680         #[cfg(target_endian = "big")]
681         pub f_fsid: ::c_ulong,
682         pub f_flag: ::c_ulong,
683         pub f_namemax: ::c_ulong,
684         __f_spare: [::c_int; 6],
685     }
686 
687     pub struct dqblk {
688         pub dqb_bhardlimit: ::uint64_t,
689         pub dqb_bsoftlimit: ::uint64_t,
690         pub dqb_curspace: ::uint64_t,
691         pub dqb_ihardlimit: ::uint64_t,
692         pub dqb_isoftlimit: ::uint64_t,
693         pub dqb_curinodes: ::uint64_t,
694         pub dqb_btime: ::uint64_t,
695         pub dqb_itime: ::uint64_t,
696         pub dqb_valid: ::uint32_t,
697     }
698 
699     pub struct signalfd_siginfo {
700         pub ssi_signo: ::uint32_t,
701         pub ssi_errno: ::int32_t,
702         pub ssi_code: ::int32_t,
703         pub ssi_pid: ::uint32_t,
704         pub ssi_uid: ::uint32_t,
705         pub ssi_fd: ::int32_t,
706         pub ssi_tid: ::uint32_t,
707         pub ssi_band: ::uint32_t,
708         pub ssi_overrun: ::uint32_t,
709         pub ssi_trapno: ::uint32_t,
710         pub ssi_status: ::int32_t,
711         pub ssi_int: ::int32_t,
712         pub ssi_ptr: ::uint64_t,
713         pub ssi_utime: ::uint64_t,
714         pub ssi_stime: ::uint64_t,
715         pub ssi_addr: ::uint64_t,
716         pub ssi_addr_lsb: ::uint16_t,
717         _pad2: ::uint16_t,
718         pub ssi_syscall: ::int32_t,
719         pub ssi_call_addr: ::uint64_t,
720         pub ssi_arch: ::uint32_t,
721         _pad: [::uint8_t; 28],
722     }
723 
724     pub struct itimerspec {
725         pub it_interval: ::timespec,
726         pub it_value: ::timespec,
727     }
728 
729     pub struct fsid_t {
730         __val: [::c_int; 2],
731     }
732 
733     // x32 compatibility
734     // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
735     pub struct mq_attr {
736         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
737         pub mq_flags: i64,
738         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
739         pub mq_maxmsg: i64,
740         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
741         pub mq_msgsize: i64,
742         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
743         pub mq_curmsgs: i64,
744         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
745         pad: [i64; 4],
746 
747         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
748         pub mq_flags: ::c_long,
749         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
750         pub mq_maxmsg: ::c_long,
751         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
752         pub mq_msgsize: ::c_long,
753         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
754         pub mq_curmsgs: ::c_long,
755         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
756         pad: [::c_long; 4],
757     }
758 
759     pub struct cpu_set_t {
760         #[cfg(all(target_pointer_width = "32",
761                   not(target_arch = "x86_64")))]
762         bits: [u32; 32],
763         #[cfg(not(all(target_pointer_width = "32",
764                       not(target_arch = "x86_64"))))]
765         bits: [u64; 16],
766     }
767 
768     pub struct if_nameindex {
769         pub if_index: ::c_uint,
770         pub if_name: *mut ::c_char,
771     }
772 
773     // System V IPC
774     pub struct msginfo {
775         pub msgpool: ::c_int,
776         pub msgmap: ::c_int,
777         pub msgmax: ::c_int,
778         pub msgmnb: ::c_int,
779         pub msgmni: ::c_int,
780         pub msgssz: ::c_int,
781         pub msgtql: ::c_int,
782         pub msgseg: ::c_ushort,
783     }
784 
785     pub struct mmsghdr {
786         pub msg_hdr: ::msghdr,
787         pub msg_len: ::c_uint,
788     }
789 
790     pub struct sembuf {
791         pub sem_num: ::c_ushort,
792         pub sem_op: ::c_short,
793         pub sem_flg: ::c_short,
794     }
795 
796     pub struct input_event {
797         pub time: ::timeval,
798         pub type_: ::__u16,
799         pub code: ::__u16,
800         pub value: ::__s32,
801     }
802 
803     pub struct input_id {
804         pub bustype: ::__u16,
805         pub vendor: ::__u16,
806         pub product: ::__u16,
807         pub version: ::__u16,
808     }
809 
810     pub struct input_absinfo {
811         pub value: ::__s32,
812         pub minimum: ::__s32,
813         pub maximum: ::__s32,
814         pub fuzz: ::__s32,
815         pub flat: ::__s32,
816         pub resolution: ::__s32,
817     }
818 
819     pub struct input_keymap_entry {
820         pub flags: ::__u8,
821         pub len: ::__u8,
822         pub index: ::__u16,
823         pub keycode: ::__u32,
824         pub scancode: [::__u8; 32],
825     }
826 
827     pub struct input_mask {
828         pub type_: ::__u32,
829         pub codes_size: ::__u32,
830         pub codes_ptr: ::__u64,
831     }
832 
833     pub struct ff_replay {
834         pub length: ::__u16,
835         pub delay: ::__u16,
836     }
837 
838     pub struct ff_trigger {
839         pub button: ::__u16,
840         pub interval: ::__u16,
841     }
842 
843     pub struct ff_envelope {
844         pub attack_length: ::__u16,
845         pub attack_level: ::__u16,
846         pub fade_length: ::__u16,
847         pub fade_level: ::__u16,
848     }
849 
850     pub struct ff_constant_effect {
851         pub level: ::__s16,
852         pub envelope: ff_envelope,
853     }
854 
855     pub struct ff_ramp_effect {
856         pub start_level: ::__s16,
857         pub end_level: ::__s16,
858         pub envelope: ff_envelope,
859     }
860 
861     pub struct ff_condition_effect {
862         pub right_saturation: ::__u16,
863         pub left_saturation: ::__u16,
864 
865         pub right_coeff: ::__s16,
866         pub left_coeff: ::__s16,
867 
868         pub deadband: ::__u16,
869         pub center: ::__s16,
870     }
871 
872     pub struct ff_periodic_effect {
873         pub waveform: ::__u16,
874         pub period: ::__u16,
875         pub magnitude: ::__s16,
876         pub offset: ::__s16,
877         pub phase: ::__u16,
878 
879         pub envelope: ff_envelope,
880 
881         pub custom_len: ::__u32,
882         pub custom_data: *mut ::__s16,
883     }
884 
885     pub struct ff_rumble_effect {
886         pub strong_magnitude: ::__u16,
887         pub weak_magnitude: ::__u16,
888     }
889 
890     pub struct ff_effect {
891         pub type_: ::__u16,
892         pub id: ::__s16,
893         pub direction: ::__u16,
894         pub trigger: ff_trigger,
895         pub replay: ff_replay,
896         // FIXME this is actually a union
897         #[cfg(target_pointer_width = "64")]
898         pub u: [u64; 4],
899         #[cfg(target_pointer_width = "32")]
900         pub u: [u32; 7],
901     }
902 
903     pub struct dl_phdr_info {
904         #[cfg(target_pointer_width = "64")]
905         pub dlpi_addr: Elf64_Addr,
906         #[cfg(target_pointer_width = "32")]
907         pub dlpi_addr: Elf32_Addr,
908 
909         pub dlpi_name: *const ::c_char,
910 
911         #[cfg(target_pointer_width = "64")]
912         pub dlpi_phdr: *const Elf64_Phdr,
913         #[cfg(target_pointer_width = "32")]
914         pub dlpi_phdr: *const Elf32_Phdr,
915 
916         #[cfg(target_pointer_width = "64")]
917         pub dlpi_phnum: Elf64_Half,
918         #[cfg(target_pointer_width = "32")]
919         pub dlpi_phnum: Elf32_Half,
920 
921         pub dlpi_adds: ::c_ulonglong,
922         pub dlpi_subs: ::c_ulonglong,
923         pub dlpi_tls_modid: ::size_t,
924         pub dlpi_tls_data: *mut ::c_void,
925     }
926 
927     pub struct Elf32_Phdr {
928         pub p_type: Elf32_Word,
929         pub p_offset: Elf32_Off,
930         pub p_vaddr: Elf32_Addr,
931         pub p_paddr: Elf32_Addr,
932         pub p_filesz: Elf32_Word,
933         pub p_memsz: Elf32_Word,
934         pub p_flags: Elf32_Word,
935         pub p_align: Elf32_Word,
936     }
937 
938     pub struct Elf64_Phdr {
939         pub p_type: Elf64_Word,
940         pub p_flags: Elf64_Word,
941         pub p_offset: Elf64_Off,
942         pub p_vaddr: Elf64_Addr,
943         pub p_paddr: Elf64_Addr,
944         pub p_filesz: Elf64_Xword,
945         pub p_memsz: Elf64_Xword,
946         pub p_align: Elf64_Xword,
947     }
948 
949     pub struct statfs64 {
950         pub f_type: ::c_ulong,
951         pub f_bsize: ::c_ulong,
952         pub f_blocks: ::fsblkcnt_t,
953         pub f_bfree: ::fsblkcnt_t,
954         pub f_bavail: ::fsblkcnt_t,
955         pub f_files: ::fsfilcnt_t,
956         pub f_ffree: ::fsfilcnt_t,
957         pub f_fsid: ::fsid_t,
958         pub f_namelen: ::c_ulong,
959         pub f_frsize: ::c_ulong,
960         pub f_flags: ::c_ulong,
961         pub f_spare: [::c_ulong; 4],
962     }
963 
964     pub struct statvfs64 {
965         pub f_bsize: ::c_ulong,
966         pub f_frsize: ::c_ulong,
967         pub f_blocks: u64,
968         pub f_bfree: u64,
969         pub f_bavail: u64,
970         pub f_files: u64,
971         pub f_ffree: u64,
972         pub f_favail: u64,
973         pub f_fsid: ::c_ulong,
974         pub f_flag: ::c_ulong,
975         pub f_namemax: ::c_ulong,
976         __f_spare: [::c_int; 6],
977     }
978 
979     pub struct stack_t {
980         pub ss_sp: *mut ::c_void,
981         pub ss_flags: ::c_int,
982         pub ss_size: ::size_t
983     }
984 
985     pub struct pthread_attr_t {
986         __size: [u64; 7]
987     }
988 
989     pub struct sigset_t {
990         __val: [::c_ulong; 16],
991     }
992 
993     pub struct shmid_ds {
994         pub shm_perm: ::ipc_perm,
995         pub shm_segsz: ::size_t,
996         pub shm_atime: ::time_t,
997         pub shm_dtime: ::time_t,
998         pub shm_ctime: ::time_t,
999         pub shm_cpid: ::pid_t,
1000         pub shm_lpid: ::pid_t,
1001         pub shm_nattch: ::c_ulong,
1002         __pad1: ::c_ulong,
1003         __pad2: ::c_ulong,
1004     }
1005 
1006     pub struct msqid_ds {
1007         pub msg_perm: ::ipc_perm,
1008         pub msg_stime: ::time_t,
1009         pub msg_rtime: ::time_t,
1010         pub msg_ctime: ::time_t,
1011         __msg_cbytes: ::c_ulong,
1012         pub msg_qnum: ::msgqnum_t,
1013         pub msg_qbytes: ::msglen_t,
1014         pub msg_lspid: ::pid_t,
1015         pub msg_lrpid: ::pid_t,
1016         __pad1: ::c_ulong,
1017         __pad2: ::c_ulong,
1018     }
1019 
1020     pub struct statfs {
1021         pub f_type: ::c_ulong,
1022         pub f_bsize: ::c_ulong,
1023         pub f_blocks: ::fsblkcnt_t,
1024         pub f_bfree: ::fsblkcnt_t,
1025         pub f_bavail: ::fsblkcnt_t,
1026         pub f_files: ::fsfilcnt_t,
1027         pub f_ffree: ::fsfilcnt_t,
1028         pub f_fsid: ::fsid_t,
1029         pub f_namelen: ::c_ulong,
1030         pub f_frsize: ::c_ulong,
1031         pub f_flags: ::c_ulong,
1032         pub f_spare: [::c_ulong; 4],
1033     }
1034 
1035     pub struct msghdr {
1036         pub msg_name: *mut ::c_void,
1037         pub msg_namelen: ::socklen_t,
1038         pub msg_iov: *mut ::iovec,
1039         pub msg_iovlen: ::c_int,
1040         __pad1: ::c_int,
1041         pub msg_control: *mut ::c_void,
1042         pub msg_controllen: ::socklen_t,
1043         __pad2: ::socklen_t,
1044         pub msg_flags: ::c_int,
1045     }
1046 
1047     pub struct cmsghdr {
1048         pub cmsg_len: ::socklen_t,
1049         pub __pad1: ::c_int,
1050         pub cmsg_level: ::c_int,
1051         pub cmsg_type: ::c_int,
1052     }
1053 
1054     pub struct sem_t {
1055         __val: [::c_int; 8],
1056     }
1057 
1058     pub struct siginfo_t {
1059         pub si_signo: ::c_int,
1060         pub si_errno: ::c_int,
1061         pub si_code: ::c_int,
1062         pub _pad: [::c_int; 29],
1063         _align: [usize; 0],
1064     }
1065 
1066     pub struct termios2 {
1067         pub c_iflag: ::tcflag_t,
1068         pub c_oflag: ::tcflag_t,
1069         pub c_cflag: ::tcflag_t,
1070         pub c_lflag: ::tcflag_t,
1071         pub c_line: ::cc_t,
1072         pub c_cc: [::cc_t; 19],
1073         pub c_ispeed: ::speed_t,
1074         pub c_ospeed: ::speed_t,
1075     }
1076 }
1077 
1078 // PUB_CONST
1079 
1080 pub const INT_MIN: c_int = -2147483648;
1081 pub const INT_MAX: c_int = 2147483647;
1082 
1083 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
1084 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
1085 pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
1086 
1087 pub const DT_FIFO: u8 = 1;
1088 pub const DT_CHR: u8 = 2;
1089 pub const DT_DIR: u8 = 4;
1090 pub const DT_BLK: u8 = 6;
1091 pub const DT_REG: u8 = 8;
1092 pub const DT_LNK: u8 = 10;
1093 pub const DT_SOCK: u8 = 12;
1094 
1095 pub const FD_CLOEXEC: ::c_int = 0x1;
1096 
1097 pub const USRQUOTA: ::c_int = 0;
1098 pub const GRPQUOTA: ::c_int = 1;
1099 
1100 pub const SIGIOT: ::c_int = 6;
1101 
1102 pub const S_ISUID: ::c_int = 0x800;
1103 pub const S_ISGID: ::c_int = 0x400;
1104 pub const S_ISVTX: ::c_int = 0x200;
1105 
1106 pub const IF_NAMESIZE: ::size_t = 16;
1107 
1108 pub const LOG_EMERG: ::c_int = 0;
1109 pub const LOG_ALERT: ::c_int = 1;
1110 pub const LOG_CRIT: ::c_int = 2;
1111 pub const LOG_ERR: ::c_int = 3;
1112 pub const LOG_WARNING: ::c_int = 4;
1113 pub const LOG_NOTICE: ::c_int = 5;
1114 pub const LOG_INFO: ::c_int = 6;
1115 pub const LOG_DEBUG: ::c_int = 7;
1116 
1117 pub const LOG_KERN: ::c_int = 0;
1118 pub const LOG_USER: ::c_int = 1 << 3;
1119 pub const LOG_MAIL: ::c_int = 2 << 3;
1120 pub const LOG_DAEMON: ::c_int = 3 << 3;
1121 pub const LOG_AUTH: ::c_int = 4 << 3;
1122 pub const LOG_SYSLOG: ::c_int = 5 << 3;
1123 pub const LOG_LPR: ::c_int = 6 << 3;
1124 pub const LOG_NEWS: ::c_int = 7 << 3;
1125 pub const LOG_UUCP: ::c_int = 8 << 3;
1126 pub const LOG_LOCAL0: ::c_int = 16 << 3;
1127 pub const LOG_LOCAL1: ::c_int = 17 << 3;
1128 pub const LOG_LOCAL2: ::c_int = 18 << 3;
1129 pub const LOG_LOCAL3: ::c_int = 19 << 3;
1130 pub const LOG_LOCAL4: ::c_int = 20 << 3;
1131 pub const LOG_LOCAL5: ::c_int = 21 << 3;
1132 pub const LOG_LOCAL6: ::c_int = 22 << 3;
1133 pub const LOG_LOCAL7: ::c_int = 23 << 3;
1134 
1135 pub const LOG_PID: ::c_int = 0x01;
1136 pub const LOG_CONS: ::c_int = 0x02;
1137 pub const LOG_ODELAY: ::c_int = 0x04;
1138 pub const LOG_NDELAY: ::c_int = 0x08;
1139 pub const LOG_NOWAIT: ::c_int = 0x10;
1140 
1141 pub const LOG_PRIMASK: ::c_int = 7;
1142 pub const LOG_FACMASK: ::c_int = 0x3f8;
1143 
1144 pub const PRIO_PROCESS: ::c_int = 0;
1145 pub const PRIO_PGRP: ::c_int = 1;
1146 pub const PRIO_USER: ::c_int = 2;
1147 
1148 pub const PRIO_MIN: ::c_int = -20;
1149 pub const PRIO_MAX: ::c_int = 20;
1150 
1151 pub const IPPROTO_ICMP: ::c_int = 1;
1152 pub const IPPROTO_ICMPV6: ::c_int = 58;
1153 pub const IPPROTO_TCP: ::c_int = 6;
1154 pub const IPPROTO_UDP: ::c_int = 17;
1155 pub const IPPROTO_IP: ::c_int = 0;
1156 pub const IPPROTO_IPV6: ::c_int = 41;
1157 
1158 pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
1159 pub const INADDR_ANY: in_addr_t = 0;
1160 pub const INADDR_BROADCAST: in_addr_t = 4294967295;
1161 pub const INADDR_NONE: in_addr_t = 4294967295;
1162 
1163 pub const EXIT_FAILURE: ::c_int = 1;
1164 pub const EXIT_SUCCESS: ::c_int = 0;
1165 pub const RAND_MAX: ::c_int = 2147483647;
1166 pub const EOF: ::c_int = -1;
1167 pub const SEEK_SET: ::c_int = 0;
1168 pub const SEEK_CUR: ::c_int = 1;
1169 pub const SEEK_END: ::c_int = 2;
1170 pub const _IOFBF: ::c_int = 0;
1171 pub const _IONBF: ::c_int = 2;
1172 pub const _IOLBF: ::c_int = 1;
1173 
1174 pub const F_DUPFD: ::c_int = 0;
1175 pub const F_GETFD: ::c_int = 1;
1176 pub const F_SETFD: ::c_int = 2;
1177 pub const F_GETFL: ::c_int = 3;
1178 pub const F_SETFL: ::c_int = 4;
1179 
1180 // Linux-specific fcntls
1181 pub const F_SETLEASE: ::c_int = 1024;
1182 pub const F_GETLEASE: ::c_int = 1025;
1183 pub const F_NOTIFY: ::c_int = 1026;
1184 pub const F_CANCELLK: ::c_int = 1029;
1185 pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
1186 pub const F_SETPIPE_SZ: ::c_int = 1031;
1187 pub const F_GETPIPE_SZ: ::c_int = 1032;
1188 pub const F_ADD_SEALS: ::c_int = 1033;
1189 pub const F_GET_SEALS: ::c_int = 1034;
1190 
1191 pub const F_SEAL_SEAL: ::c_int = 0x0001;
1192 pub const F_SEAL_SHRINK: ::c_int = 0x0002;
1193 pub const F_SEAL_GROW: ::c_int = 0x0004;
1194 pub const F_SEAL_WRITE: ::c_int = 0x0008;
1195 
1196 // TODO(#235): Include file sealing fcntls once we have a way to verify them.
1197 
1198 pub const SIGTRAP: ::c_int = 5;
1199 
1200 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
1201 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
1202 
1203 pub const CLOCK_REALTIME: ::clockid_t = 0;
1204 pub const CLOCK_MONOTONIC: ::clockid_t = 1;
1205 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
1206 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
1207 pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4;
1208 pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5;
1209 pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
1210 pub const CLOCK_BOOTTIME: ::clockid_t = 7;
1211 pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8;
1212 pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9;
1213 // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
1214 // 2014.) See also musl/mod.rs
1215 // pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
1216 // pub const CLOCK_TAI: ::clockid_t = 11;
1217 pub const TIMER_ABSTIME: ::c_int = 1;
1218 
1219 pub const RLIMIT_CPU: ::c_int = 0;
1220 pub const RLIMIT_FSIZE: ::c_int = 1;
1221 pub const RLIMIT_DATA: ::c_int = 2;
1222 pub const RLIMIT_STACK: ::c_int = 3;
1223 pub const RLIMIT_CORE: ::c_int = 4;
1224 pub const RLIMIT_LOCKS: ::c_int = 10;
1225 pub const RLIMIT_SIGPENDING: ::c_int = 11;
1226 pub const RLIMIT_MSGQUEUE: ::c_int = 12;
1227 pub const RLIMIT_NICE: ::c_int = 13;
1228 pub const RLIMIT_RTPRIO: ::c_int = 14;
1229 
1230 pub const RUSAGE_SELF: ::c_int = 0;
1231 
1232 pub const O_RDONLY: ::c_int = 0;
1233 pub const O_WRONLY: ::c_int = 1;
1234 pub const O_RDWR: ::c_int = 2;
1235 
1236 pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
1237 
1238 pub const S_IFIFO: ::mode_t = 4096;
1239 pub const S_IFCHR: ::mode_t = 8192;
1240 pub const S_IFBLK: ::mode_t = 24576;
1241 pub const S_IFDIR: ::mode_t = 16384;
1242 pub const S_IFREG: ::mode_t = 32768;
1243 pub const S_IFLNK: ::mode_t = 40960;
1244 pub const S_IFSOCK: ::mode_t = 49152;
1245 pub const S_IFMT: ::mode_t = 61440;
1246 pub const S_IRWXU: ::mode_t = 448;
1247 pub const S_IXUSR: ::mode_t = 64;
1248 pub const S_IWUSR: ::mode_t = 128;
1249 pub const S_IRUSR: ::mode_t = 256;
1250 pub const S_IRWXG: ::mode_t = 56;
1251 pub const S_IXGRP: ::mode_t = 8;
1252 pub const S_IWGRP: ::mode_t = 16;
1253 pub const S_IRGRP: ::mode_t = 32;
1254 pub const S_IRWXO: ::mode_t = 7;
1255 pub const S_IXOTH: ::mode_t = 1;
1256 pub const S_IWOTH: ::mode_t = 2;
1257 pub const S_IROTH: ::mode_t = 4;
1258 pub const F_OK: ::c_int = 0;
1259 pub const R_OK: ::c_int = 4;
1260 pub const W_OK: ::c_int = 2;
1261 pub const X_OK: ::c_int = 1;
1262 pub const STDIN_FILENO: ::c_int = 0;
1263 pub const STDOUT_FILENO: ::c_int = 1;
1264 pub const STDERR_FILENO: ::c_int = 2;
1265 pub const SIGHUP: ::c_int = 1;
1266 pub const SIGINT: ::c_int = 2;
1267 pub const SIGQUIT: ::c_int = 3;
1268 pub const SIGILL: ::c_int = 4;
1269 pub const SIGABRT: ::c_int = 6;
1270 pub const SIGFPE: ::c_int = 8;
1271 pub const SIGKILL: ::c_int = 9;
1272 pub const SIGSEGV: ::c_int = 11;
1273 pub const SIGPIPE: ::c_int = 13;
1274 pub const SIGALRM: ::c_int = 14;
1275 pub const SIGTERM: ::c_int = 15;
1276 
1277 pub const PROT_NONE: ::c_int = 0;
1278 pub const PROT_READ: ::c_int = 1;
1279 pub const PROT_WRITE: ::c_int = 2;
1280 pub const PROT_EXEC: ::c_int = 4;
1281 
1282 pub const LC_CTYPE: ::c_int = 0;
1283 pub const LC_NUMERIC: ::c_int = 1;
1284 pub const LC_TIME: ::c_int = 2;
1285 pub const LC_COLLATE: ::c_int = 3;
1286 pub const LC_MONETARY: ::c_int = 4;
1287 pub const LC_MESSAGES: ::c_int = 5;
1288 pub const LC_ALL: ::c_int = 6;
1289 pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
1290 pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
1291 pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
1292 pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
1293 pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
1294 pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
1295 // LC_ALL_MASK defined per platform
1296 
1297 pub const MAP_FILE: ::c_int = 0x0000;
1298 pub const MAP_SHARED: ::c_int = 0x0001;
1299 pub const MAP_PRIVATE: ::c_int = 0x0002;
1300 pub const MAP_FIXED: ::c_int = 0x0010;
1301 
1302 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
1303 
1304 // MS_ flags for msync(2)
1305 pub const MS_ASYNC: ::c_int = 0x0001;
1306 pub const MS_INVALIDATE: ::c_int = 0x0002;
1307 pub const MS_SYNC: ::c_int = 0x0004;
1308 
1309 // MS_ flags for mount(2)
1310 pub const MS_RDONLY: ::c_ulong = 0x01;
1311 pub const MS_NOSUID: ::c_ulong = 0x02;
1312 pub const MS_NODEV: ::c_ulong = 0x04;
1313 pub const MS_NOEXEC: ::c_ulong = 0x08;
1314 pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
1315 pub const MS_REMOUNT: ::c_ulong = 0x20;
1316 pub const MS_MANDLOCK: ::c_ulong = 0x40;
1317 pub const MS_DIRSYNC: ::c_ulong = 0x80;
1318 pub const MS_NOATIME: ::c_ulong = 0x0400;
1319 pub const MS_NODIRATIME: ::c_ulong = 0x0800;
1320 pub const MS_BIND: ::c_ulong = 0x1000;
1321 pub const MS_MOVE: ::c_ulong = 0x2000;
1322 pub const MS_REC: ::c_ulong = 0x4000;
1323 pub const MS_SILENT: ::c_ulong = 0x8000;
1324 pub const MS_POSIXACL: ::c_ulong = 0x010000;
1325 pub const MS_UNBINDABLE: ::c_ulong = 0x020000;
1326 pub const MS_PRIVATE: ::c_ulong = 0x040000;
1327 pub const MS_SLAVE: ::c_ulong = 0x080000;
1328 pub const MS_SHARED: ::c_ulong = 0x100000;
1329 pub const MS_RELATIME: ::c_ulong = 0x200000;
1330 pub const MS_KERNMOUNT: ::c_ulong = 0x400000;
1331 pub const MS_I_VERSION: ::c_ulong = 0x800000;
1332 pub const MS_STRICTATIME: ::c_ulong = 0x1000000;
1333 pub const MS_ACTIVE: ::c_ulong = 0x40000000;
1334 pub const MS_NOUSER: ::c_ulong = 0x80000000;
1335 pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
1336 pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
1337 pub const MS_RMT_MASK: ::c_ulong = 0x800051;
1338 
1339 pub const EPERM: ::c_int = 1;
1340 pub const ENOENT: ::c_int = 2;
1341 pub const ESRCH: ::c_int = 3;
1342 pub const EINTR: ::c_int = 4;
1343 pub const EIO: ::c_int = 5;
1344 pub const ENXIO: ::c_int = 6;
1345 pub const E2BIG: ::c_int = 7;
1346 pub const ENOEXEC: ::c_int = 8;
1347 pub const EBADF: ::c_int = 9;
1348 pub const ECHILD: ::c_int = 10;
1349 pub const EAGAIN: ::c_int = 11;
1350 pub const ENOMEM: ::c_int = 12;
1351 pub const EACCES: ::c_int = 13;
1352 pub const EFAULT: ::c_int = 14;
1353 pub const ENOTBLK: ::c_int = 15;
1354 pub const EBUSY: ::c_int = 16;
1355 pub const EEXIST: ::c_int = 17;
1356 pub const EXDEV: ::c_int = 18;
1357 pub const ENODEV: ::c_int = 19;
1358 pub const ENOTDIR: ::c_int = 20;
1359 pub const EISDIR: ::c_int = 21;
1360 pub const EINVAL: ::c_int = 22;
1361 pub const ENFILE: ::c_int = 23;
1362 pub const EMFILE: ::c_int = 24;
1363 pub const ENOTTY: ::c_int = 25;
1364 pub const ETXTBSY: ::c_int = 26;
1365 pub const EFBIG: ::c_int = 27;
1366 pub const ENOSPC: ::c_int = 28;
1367 pub const ESPIPE: ::c_int = 29;
1368 pub const EROFS: ::c_int = 30;
1369 pub const EMLINK: ::c_int = 31;
1370 pub const EPIPE: ::c_int = 32;
1371 pub const EDOM: ::c_int = 33;
1372 pub const ERANGE: ::c_int = 34;
1373 pub const EWOULDBLOCK: ::c_int = EAGAIN;
1374 
1375 pub const SCM_RIGHTS: ::c_int = 0x01;
1376 pub const SCM_CREDENTIALS: ::c_int = 0x02;
1377 
1378 pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
1379 pub const PROT_GROWSUP: ::c_int = 0x2000000;
1380 
1381 pub const MAP_TYPE: ::c_int = 0x000f;
1382 
1383 pub const MADV_NORMAL: ::c_int = 0;
1384 pub const MADV_RANDOM: ::c_int = 1;
1385 pub const MADV_SEQUENTIAL: ::c_int = 2;
1386 pub const MADV_WILLNEED: ::c_int = 3;
1387 pub const MADV_DONTNEED: ::c_int = 4;
1388 pub const MADV_FREE: ::c_int = 8;
1389 pub const MADV_REMOVE: ::c_int = 9;
1390 pub const MADV_DONTFORK: ::c_int = 10;
1391 pub const MADV_DOFORK: ::c_int = 11;
1392 pub const MADV_MERGEABLE: ::c_int = 12;
1393 pub const MADV_UNMERGEABLE: ::c_int = 13;
1394 pub const MADV_HUGEPAGE: ::c_int = 14;
1395 pub const MADV_NOHUGEPAGE: ::c_int = 15;
1396 pub const MADV_DONTDUMP: ::c_int = 16;
1397 pub const MADV_DODUMP: ::c_int = 17;
1398 pub const MADV_HWPOISON: ::c_int = 100;
1399 pub const MADV_SOFT_OFFLINE: ::c_int = 101;
1400 
1401 pub const IFF_UP: ::c_int = 0x1;
1402 pub const IFF_BROADCAST: ::c_int = 0x2;
1403 pub const IFF_DEBUG: ::c_int = 0x4;
1404 pub const IFF_LOOPBACK: ::c_int = 0x8;
1405 pub const IFF_POINTOPOINT: ::c_int = 0x10;
1406 pub const IFF_NOTRAILERS: ::c_int = 0x20;
1407 pub const IFF_RUNNING: ::c_int = 0x40;
1408 pub const IFF_NOARP: ::c_int = 0x80;
1409 pub const IFF_PROMISC: ::c_int = 0x100;
1410 pub const IFF_ALLMULTI: ::c_int = 0x200;
1411 pub const IFF_MASTER: ::c_int = 0x400;
1412 pub const IFF_SLAVE: ::c_int = 0x800;
1413 pub const IFF_MULTICAST: ::c_int = 0x1000;
1414 pub const IFF_PORTSEL: ::c_int = 0x2000;
1415 pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
1416 pub const IFF_DYNAMIC: ::c_int = 0x8000;
1417 pub const IFF_TUN: ::c_int = 0x0001;
1418 pub const IFF_TAP: ::c_int = 0x0002;
1419 pub const IFF_NO_PI: ::c_int = 0x1000;
1420 
1421 pub const SOL_IP: ::c_int = 0;
1422 pub const SOL_TCP: ::c_int = 6;
1423 pub const SOL_UDP: ::c_int = 17;
1424 pub const SOL_IPV6: ::c_int = 41;
1425 pub const SOL_ICMPV6: ::c_int = 58;
1426 pub const SOL_RAW: ::c_int = 255;
1427 pub const SOL_DECNET: ::c_int = 261;
1428 pub const SOL_X25: ::c_int = 262;
1429 pub const SOL_PACKET: ::c_int = 263;
1430 pub const SOL_ATM: ::c_int = 264;
1431 pub const SOL_AAL: ::c_int = 265;
1432 pub const SOL_IRDA: ::c_int = 266;
1433 pub const SOL_NETBEUI: ::c_int = 267;
1434 pub const SOL_LLC: ::c_int = 268;
1435 pub const SOL_DCCP: ::c_int = 269;
1436 pub const SOL_NETLINK: ::c_int = 270;
1437 pub const SOL_TIPC: ::c_int = 271;
1438 
1439 pub const AF_UNSPEC: ::c_int = 0;
1440 pub const AF_UNIX: ::c_int = 1;
1441 pub const AF_LOCAL: ::c_int = 1;
1442 pub const AF_INET: ::c_int = 2;
1443 pub const AF_AX25: ::c_int = 3;
1444 pub const AF_IPX: ::c_int = 4;
1445 pub const AF_APPLETALK: ::c_int = 5;
1446 pub const AF_NETROM: ::c_int = 6;
1447 pub const AF_BRIDGE: ::c_int = 7;
1448 pub const AF_ATMPVC: ::c_int = 8;
1449 pub const AF_X25: ::c_int = 9;
1450 pub const AF_INET6: ::c_int = 10;
1451 pub const AF_ROSE: ::c_int = 11;
1452 pub const AF_DECnet: ::c_int = 12;
1453 pub const AF_NETBEUI: ::c_int = 13;
1454 pub const AF_SECURITY: ::c_int = 14;
1455 pub const AF_KEY: ::c_int = 15;
1456 pub const AF_NETLINK: ::c_int = 16;
1457 pub const AF_ROUTE: ::c_int = AF_NETLINK;
1458 pub const AF_PACKET: ::c_int = 17;
1459 pub const AF_ASH: ::c_int = 18;
1460 pub const AF_ECONET: ::c_int = 19;
1461 pub const AF_ATMSVC: ::c_int = 20;
1462 pub const AF_RDS: ::c_int = 21;
1463 pub const AF_SNA: ::c_int = 22;
1464 pub const AF_IRDA: ::c_int = 23;
1465 pub const AF_PPPOX: ::c_int = 24;
1466 pub const AF_WANPIPE: ::c_int = 25;
1467 pub const AF_LLC: ::c_int = 26;
1468 pub const AF_CAN: ::c_int = 29;
1469 pub const AF_TIPC: ::c_int = 30;
1470 pub const AF_BLUETOOTH: ::c_int = 31;
1471 pub const AF_IUCV: ::c_int = 32;
1472 pub const AF_RXRPC: ::c_int = 33;
1473 pub const AF_ISDN: ::c_int = 34;
1474 pub const AF_PHONET: ::c_int = 35;
1475 pub const AF_IEEE802154: ::c_int = 36;
1476 pub const AF_CAIF: ::c_int = 37;
1477 pub const AF_ALG: ::c_int = 38;
1478 
1479 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
1480 pub const PF_UNIX: ::c_int = AF_UNIX;
1481 pub const PF_LOCAL: ::c_int = AF_LOCAL;
1482 pub const PF_INET: ::c_int = AF_INET;
1483 pub const PF_AX25: ::c_int = AF_AX25;
1484 pub const PF_IPX: ::c_int = AF_IPX;
1485 pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
1486 pub const PF_NETROM: ::c_int = AF_NETROM;
1487 pub const PF_BRIDGE: ::c_int = AF_BRIDGE;
1488 pub const PF_ATMPVC: ::c_int = AF_ATMPVC;
1489 pub const PF_X25: ::c_int = AF_X25;
1490 pub const PF_INET6: ::c_int = AF_INET6;
1491 pub const PF_ROSE: ::c_int = AF_ROSE;
1492 pub const PF_DECnet: ::c_int = AF_DECnet;
1493 pub const PF_NETBEUI: ::c_int = AF_NETBEUI;
1494 pub const PF_SECURITY: ::c_int = AF_SECURITY;
1495 pub const PF_KEY: ::c_int = AF_KEY;
1496 pub const PF_NETLINK: ::c_int = AF_NETLINK;
1497 pub const PF_ROUTE: ::c_int = AF_ROUTE;
1498 pub const PF_PACKET: ::c_int = AF_PACKET;
1499 pub const PF_ASH: ::c_int = AF_ASH;
1500 pub const PF_ECONET: ::c_int = AF_ECONET;
1501 pub const PF_ATMSVC: ::c_int = AF_ATMSVC;
1502 pub const PF_RDS: ::c_int = AF_RDS;
1503 pub const PF_SNA: ::c_int = AF_SNA;
1504 pub const PF_IRDA: ::c_int = AF_IRDA;
1505 pub const PF_PPPOX: ::c_int = AF_PPPOX;
1506 pub const PF_WANPIPE: ::c_int = AF_WANPIPE;
1507 pub const PF_LLC: ::c_int = AF_LLC;
1508 pub const PF_CAN: ::c_int = AF_CAN;
1509 pub const PF_TIPC: ::c_int = AF_TIPC;
1510 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1511 pub const PF_IUCV: ::c_int = AF_IUCV;
1512 pub const PF_RXRPC: ::c_int = AF_RXRPC;
1513 pub const PF_ISDN: ::c_int = AF_ISDN;
1514 pub const PF_PHONET: ::c_int = AF_PHONET;
1515 pub const PF_IEEE802154: ::c_int = AF_IEEE802154;
1516 pub const PF_CAIF: ::c_int = AF_CAIF;
1517 pub const PF_ALG: ::c_int = AF_ALG;
1518 
1519 pub const SOMAXCONN: ::c_int = 128;
1520 
1521 pub const MSG_OOB: ::c_int = 1;
1522 pub const MSG_PEEK: ::c_int = 2;
1523 pub const MSG_DONTROUTE: ::c_int = 4;
1524 pub const MSG_CTRUNC: ::c_int = 8;
1525 pub const MSG_TRUNC: ::c_int = 0x20;
1526 pub const MSG_DONTWAIT: ::c_int = 0x40;
1527 pub const MSG_EOR: ::c_int = 0x80;
1528 pub const MSG_WAITALL: ::c_int = 0x100;
1529 pub const MSG_FIN: ::c_int = 0x200;
1530 pub const MSG_SYN: ::c_int = 0x400;
1531 pub const MSG_CONFIRM: ::c_int = 0x800;
1532 pub const MSG_RST: ::c_int = 0x1000;
1533 pub const MSG_ERRQUEUE: ::c_int = 0x2000;
1534 pub const MSG_NOSIGNAL: ::c_int = 0x4000;
1535 pub const MSG_MORE: ::c_int = 0x8000;
1536 pub const MSG_WAITFORONE: ::c_int = 0x10000;
1537 pub const MSG_FASTOPEN: ::c_int = 0x20000000;
1538 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
1539 
1540 pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
1541 
1542 pub const SOCK_RAW: ::c_int = 3;
1543 pub const SOCK_RDM: ::c_int = 4;
1544 pub const IP_MULTICAST_IF: ::c_int = 32;
1545 pub const IP_MULTICAST_TTL: ::c_int = 33;
1546 pub const IP_MULTICAST_LOOP: ::c_int = 34;
1547 pub const IP_TTL: ::c_int = 2;
1548 pub const IP_HDRINCL: ::c_int = 3;
1549 pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
1550 pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
1551 pub const IP_TRANSPARENT: ::c_int = 19;
1552 pub const IPV6_UNICAST_HOPS: ::c_int = 16;
1553 pub const IPV6_MULTICAST_IF: ::c_int = 17;
1554 pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
1555 pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
1556 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
1557 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
1558 pub const IPV6_V6ONLY: ::c_int = 26;
1559 
1560 pub const TCP_NODELAY: ::c_int = 1;
1561 pub const TCP_MAXSEG: ::c_int = 2;
1562 pub const TCP_CORK: ::c_int = 3;
1563 pub const TCP_KEEPIDLE: ::c_int = 4;
1564 pub const TCP_KEEPINTVL: ::c_int = 5;
1565 pub const TCP_KEEPCNT: ::c_int = 6;
1566 pub const TCP_SYNCNT: ::c_int = 7;
1567 pub const TCP_LINGER2: ::c_int = 8;
1568 pub const TCP_DEFER_ACCEPT: ::c_int = 9;
1569 pub const TCP_WINDOW_CLAMP: ::c_int = 10;
1570 pub const TCP_INFO: ::c_int = 11;
1571 pub const TCP_QUICKACK: ::c_int = 12;
1572 pub const TCP_CONGESTION: ::c_int = 13;
1573 
1574 pub const SO_DEBUG: ::c_int = 1;
1575 
1576 pub const SHUT_RD: ::c_int = 0;
1577 pub const SHUT_WR: ::c_int = 1;
1578 pub const SHUT_RDWR: ::c_int = 2;
1579 
1580 pub const LOCK_SH: ::c_int = 1;
1581 pub const LOCK_EX: ::c_int = 2;
1582 pub const LOCK_NB: ::c_int = 4;
1583 pub const LOCK_UN: ::c_int = 8;
1584 
1585 pub const SS_ONSTACK: ::c_int = 1;
1586 pub const SS_DISABLE: ::c_int = 2;
1587 
1588 pub const PATH_MAX: ::c_int = 4096;
1589 
1590 pub const FD_SETSIZE: usize = 1024;
1591 
1592 pub const EPOLLIN: ::c_int = 0x1;
1593 pub const EPOLLPRI: ::c_int = 0x2;
1594 pub const EPOLLOUT: ::c_int = 0x4;
1595 pub const EPOLLRDNORM: ::c_int = 0x40;
1596 pub const EPOLLRDBAND: ::c_int = 0x80;
1597 pub const EPOLLWRNORM: ::c_int = 0x100;
1598 pub const EPOLLWRBAND: ::c_int = 0x200;
1599 pub const EPOLLMSG: ::c_int = 0x400;
1600 pub const EPOLLERR: ::c_int = 0x8;
1601 pub const EPOLLHUP: ::c_int = 0x10;
1602 pub const EPOLLET: ::c_int = 0x80000000;
1603 
1604 pub const EPOLL_CTL_ADD: ::c_int = 1;
1605 pub const EPOLL_CTL_MOD: ::c_int = 3;
1606 pub const EPOLL_CTL_DEL: ::c_int = 2;
1607 
1608 pub const MNT_DETACH: ::c_int = 0x2;
1609 pub const MNT_EXPIRE: ::c_int = 0x4;
1610 
1611 pub const Q_GETFMT: ::c_int = 0x800004;
1612 pub const Q_GETINFO: ::c_int = 0x800005;
1613 pub const Q_SETINFO: ::c_int = 0x800006;
1614 pub const QIF_BLIMITS: ::uint32_t = 1;
1615 pub const QIF_SPACE: ::uint32_t = 2;
1616 pub const QIF_ILIMITS: ::uint32_t = 4;
1617 pub const QIF_INODES: ::uint32_t = 8;
1618 pub const QIF_BTIME: ::uint32_t = 16;
1619 pub const QIF_ITIME: ::uint32_t = 32;
1620 pub const QIF_LIMITS: ::uint32_t = 5;
1621 pub const QIF_USAGE: ::uint32_t = 10;
1622 pub const QIF_TIMES: ::uint32_t = 48;
1623 pub const QIF_ALL: ::uint32_t = 63;
1624 
1625 pub const MNT_FORCE: ::c_int = 0x1;
1626 
1627 pub const Q_SYNC: ::c_int = 0x800001;
1628 pub const Q_QUOTAON: ::c_int = 0x800002;
1629 pub const Q_QUOTAOFF: ::c_int = 0x800003;
1630 pub const Q_GETQUOTA: ::c_int = 0x800007;
1631 pub const Q_SETQUOTA: ::c_int = 0x800008;
1632 
1633 pub const TCIOFF: ::c_int = 2;
1634 pub const TCION: ::c_int = 3;
1635 pub const TCOOFF: ::c_int = 0;
1636 pub const TCOON: ::c_int = 1;
1637 pub const TCIFLUSH: ::c_int = 0;
1638 pub const TCOFLUSH: ::c_int = 1;
1639 pub const TCIOFLUSH: ::c_int = 2;
1640 pub const NL0: ::c_int  = 0x00000000;
1641 pub const NL1: ::c_int  = 0x00000100;
1642 pub const TAB0: ::c_int = 0x00000000;
1643 pub const CR0: ::c_int  = 0x00000000;
1644 pub const FF0: ::c_int  = 0x00000000;
1645 pub const BS0: ::c_int  = 0x00000000;
1646 pub const VT0: ::c_int  = 0x00000000;
1647 pub const VERASE: usize = 2;
1648 pub const VKILL: usize = 3;
1649 pub const VINTR: usize = 0;
1650 pub const VQUIT: usize = 1;
1651 pub const VLNEXT: usize = 15;
1652 pub const IGNBRK: ::tcflag_t = 0x00000001;
1653 pub const BRKINT: ::tcflag_t = 0x00000002;
1654 pub const IGNPAR: ::tcflag_t = 0x00000004;
1655 pub const PARMRK: ::tcflag_t = 0x00000008;
1656 pub const INPCK: ::tcflag_t = 0x00000010;
1657 pub const ISTRIP: ::tcflag_t = 0x00000020;
1658 pub const INLCR: ::tcflag_t = 0x00000040;
1659 pub const IGNCR: ::tcflag_t = 0x00000080;
1660 pub const ICRNL: ::tcflag_t = 0x00000100;
1661 pub const IXANY: ::tcflag_t = 0x00000800;
1662 pub const IMAXBEL: ::tcflag_t = 0x00002000;
1663 pub const OPOST: ::tcflag_t = 0x1;
1664 pub const CS5: ::tcflag_t = 0x00000000;
1665 pub const CRTSCTS: ::tcflag_t = 0x80000000;
1666 pub const ECHO: ::tcflag_t = 0x00000008;
1667 pub const OCRNL:  ::tcflag_t = 0o000010;
1668 pub const ONOCR:  ::tcflag_t = 0o000020;
1669 pub const ONLRET: ::tcflag_t = 0o000040;
1670 pub const OFILL:  ::tcflag_t = 0o000100;
1671 pub const OFDEL:  ::tcflag_t = 0o000200;
1672 
1673 pub const CLONE_VM: ::c_int = 0x100;
1674 pub const CLONE_FS: ::c_int = 0x200;
1675 pub const CLONE_FILES: ::c_int = 0x400;
1676 pub const CLONE_SIGHAND: ::c_int = 0x800;
1677 pub const CLONE_PTRACE: ::c_int = 0x2000;
1678 pub const CLONE_VFORK: ::c_int = 0x4000;
1679 pub const CLONE_PARENT: ::c_int = 0x8000;
1680 pub const CLONE_THREAD: ::c_int = 0x10000;
1681 pub const CLONE_NEWNS: ::c_int = 0x20000;
1682 pub const CLONE_SYSVSEM: ::c_int = 0x40000;
1683 pub const CLONE_SETTLS: ::c_int = 0x80000;
1684 pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
1685 pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
1686 pub const CLONE_DETACHED: ::c_int = 0x400000;
1687 pub const CLONE_UNTRACED: ::c_int = 0x800000;
1688 pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
1689 pub const CLONE_NEWUTS: ::c_int = 0x04000000;
1690 pub const CLONE_NEWIPC: ::c_int = 0x08000000;
1691 pub const CLONE_NEWUSER: ::c_int = 0x10000000;
1692 pub const CLONE_NEWPID: ::c_int = 0x20000000;
1693 pub const CLONE_NEWNET: ::c_int = 0x40000000;
1694 pub const CLONE_IO: ::c_int = 0x80000000;
1695 pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
1696 
1697 pub const WNOHANG: ::c_int = 0x00000001;
1698 pub const WUNTRACED: ::c_int = 0x00000002;
1699 pub const WSTOPPED: ::c_int = WUNTRACED;
1700 pub const WEXITED: ::c_int = 0x00000004;
1701 pub const WCONTINUED: ::c_int = 0x00000008;
1702 pub const WNOWAIT: ::c_int = 0x01000000;
1703 
1704 // Options set using PTRACE_SETOPTIONS.
1705 pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
1706 pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002;
1707 pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004;
1708 pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008;
1709 pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
1710 pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
1711 pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
1712 pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
1713 pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
1714 pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
1715 pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
1716 
1717 // Wait extended result codes for the above trace options.
1718 pub const PTRACE_EVENT_FORK: ::c_int = 1;
1719 pub const PTRACE_EVENT_VFORK: ::c_int = 2;
1720 pub const PTRACE_EVENT_CLONE: ::c_int = 3;
1721 pub const PTRACE_EVENT_EXEC: ::c_int = 4;
1722 pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5;
1723 pub const PTRACE_EVENT_EXIT: ::c_int = 6;
1724 pub const PTRACE_EVENT_SECCOMP: ::c_int = 7;
1725 // PTRACE_EVENT_STOP was added to glibc in 2.26
1726 // pub const PTRACE_EVENT_STOP: ::c_int = 128;
1727 
1728 pub const __WNOTHREAD: ::c_int = 0x20000000;
1729 pub const __WALL: ::c_int = 0x40000000;
1730 pub const __WCLONE: ::c_int = 0x80000000;
1731 
1732 pub const SPLICE_F_MOVE: ::c_uint = 0x01;
1733 pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
1734 pub const SPLICE_F_MORE: ::c_uint = 0x04;
1735 pub const SPLICE_F_GIFT: ::c_uint = 0x08;
1736 
1737 pub const RTLD_LOCAL: ::c_int = 0;
1738 pub const RTLD_LAZY: ::c_int = 1;
1739 
1740 pub const POSIX_FADV_NORMAL: ::c_int = 0;
1741 pub const POSIX_FADV_RANDOM: ::c_int = 1;
1742 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
1743 pub const POSIX_FADV_WILLNEED: ::c_int = 3;
1744 
1745 pub const AT_FDCWD: ::c_int = -100;
1746 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
1747 pub const AT_REMOVEDIR: ::c_int = 0x200;
1748 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
1749 pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
1750 pub const AT_EMPTY_PATH: ::c_int = 0x1000;
1751 
1752 pub const LOG_CRON: ::c_int = 9 << 3;
1753 pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
1754 pub const LOG_FTP: ::c_int = 11 << 3;
1755 pub const LOG_PERROR: ::c_int = 0x20;
1756 
1757 pub const PIPE_BUF: usize = 4096;
1758 
1759 pub const SI_LOAD_SHIFT: ::c_uint = 16;
1760 
1761 pub const SIGEV_SIGNAL: ::c_int = 0;
1762 pub const SIGEV_NONE: ::c_int = 1;
1763 pub const SIGEV_THREAD: ::c_int = 2;
1764 
1765 pub const P_ALL: idtype_t = 0;
1766 pub const P_PID: idtype_t = 1;
1767 pub const P_PGID: idtype_t = 2;
1768 
1769 pub const UTIME_OMIT: c_long = 1073741822;
1770 pub const UTIME_NOW: c_long = 1073741823;
1771 
1772 pub const POLLIN: ::c_short = 0x1;
1773 pub const POLLPRI: ::c_short = 0x2;
1774 pub const POLLOUT: ::c_short = 0x4;
1775 pub const POLLERR: ::c_short = 0x8;
1776 pub const POLLHUP: ::c_short = 0x10;
1777 pub const POLLNVAL: ::c_short = 0x20;
1778 pub const POLLRDNORM: ::c_short = 0x040;
1779 pub const POLLRDBAND: ::c_short = 0x080;
1780 
1781 pub const ABDAY_1: ::nl_item = 0x20000;
1782 pub const ABDAY_2: ::nl_item = 0x20001;
1783 pub const ABDAY_3: ::nl_item = 0x20002;
1784 pub const ABDAY_4: ::nl_item = 0x20003;
1785 pub const ABDAY_5: ::nl_item = 0x20004;
1786 pub const ABDAY_6: ::nl_item = 0x20005;
1787 pub const ABDAY_7: ::nl_item = 0x20006;
1788 
1789 pub const DAY_1: ::nl_item = 0x20007;
1790 pub const DAY_2: ::nl_item = 0x20008;
1791 pub const DAY_3: ::nl_item = 0x20009;
1792 pub const DAY_4: ::nl_item = 0x2000A;
1793 pub const DAY_5: ::nl_item = 0x2000B;
1794 pub const DAY_6: ::nl_item = 0x2000C;
1795 pub const DAY_7: ::nl_item = 0x2000D;
1796 
1797 pub const ABMON_1: ::nl_item = 0x2000E;
1798 pub const ABMON_2: ::nl_item = 0x2000F;
1799 pub const ABMON_3: ::nl_item = 0x20010;
1800 pub const ABMON_4: ::nl_item = 0x20011;
1801 pub const ABMON_5: ::nl_item = 0x20012;
1802 pub const ABMON_6: ::nl_item = 0x20013;
1803 pub const ABMON_7: ::nl_item = 0x20014;
1804 pub const ABMON_8: ::nl_item = 0x20015;
1805 pub const ABMON_9: ::nl_item = 0x20016;
1806 pub const ABMON_10: ::nl_item = 0x20017;
1807 pub const ABMON_11: ::nl_item = 0x20018;
1808 pub const ABMON_12: ::nl_item = 0x20019;
1809 
1810 pub const MON_1: ::nl_item = 0x2001A;
1811 pub const MON_2: ::nl_item = 0x2001B;
1812 pub const MON_3: ::nl_item = 0x2001C;
1813 pub const MON_4: ::nl_item = 0x2001D;
1814 pub const MON_5: ::nl_item = 0x2001E;
1815 pub const MON_6: ::nl_item = 0x2001F;
1816 pub const MON_7: ::nl_item = 0x20020;
1817 pub const MON_8: ::nl_item = 0x20021;
1818 pub const MON_9: ::nl_item = 0x20022;
1819 pub const MON_10: ::nl_item = 0x20023;
1820 pub const MON_11: ::nl_item = 0x20024;
1821 pub const MON_12: ::nl_item = 0x20025;
1822 
1823 pub const AM_STR: ::nl_item = 0x20026;
1824 pub const PM_STR: ::nl_item = 0x20027;
1825 
1826 pub const D_T_FMT: ::nl_item = 0x20028;
1827 pub const D_FMT: ::nl_item = 0x20029;
1828 pub const T_FMT: ::nl_item = 0x2002A;
1829 pub const T_FMT_AMPM: ::nl_item = 0x2002B;
1830 
1831 pub const ERA: ::nl_item = 0x2002C;
1832 pub const ERA_D_FMT: ::nl_item = 0x2002E;
1833 pub const ALT_DIGITS: ::nl_item = 0x2002F;
1834 pub const ERA_D_T_FMT: ::nl_item = 0x20030;
1835 pub const ERA_T_FMT: ::nl_item = 0x20031;
1836 
1837 pub const CODESET: ::nl_item = 14;
1838 
1839 pub const CRNCYSTR: ::nl_item = 0x4000F;
1840 
1841 pub const RUSAGE_THREAD: ::c_int = 1;
1842 pub const RUSAGE_CHILDREN: ::c_int = -1;
1843 
1844 pub const RADIXCHAR: ::nl_item = 0x10000;
1845 pub const THOUSEP: ::nl_item = 0x10001;
1846 
1847 pub const YESEXPR: ::nl_item = 0x50000;
1848 pub const NOEXPR: ::nl_item = 0x50001;
1849 pub const YESSTR: ::nl_item = 0x50002;
1850 pub const NOSTR: ::nl_item = 0x50003;
1851 
1852 pub const FILENAME_MAX: ::c_uint = 4096;
1853 pub const L_tmpnam: ::c_uint = 20;
1854 pub const _PC_LINK_MAX: ::c_int = 0;
1855 pub const _PC_MAX_CANON: ::c_int = 1;
1856 pub const _PC_MAX_INPUT: ::c_int = 2;
1857 pub const _PC_NAME_MAX: ::c_int = 3;
1858 pub const _PC_PATH_MAX: ::c_int = 4;
1859 pub const _PC_PIPE_BUF: ::c_int = 5;
1860 pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
1861 pub const _PC_NO_TRUNC: ::c_int = 7;
1862 pub const _PC_VDISABLE: ::c_int = 8;
1863 pub const _PC_SYNC_IO: ::c_int = 9;
1864 pub const _PC_ASYNC_IO: ::c_int = 10;
1865 pub const _PC_PRIO_IO: ::c_int = 11;
1866 pub const _PC_SOCK_MAXBUF: ::c_int = 12;
1867 pub const _PC_FILESIZEBITS: ::c_int = 13;
1868 pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
1869 pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
1870 pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
1871 pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
1872 pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
1873 pub const _PC_SYMLINK_MAX: ::c_int = 19;
1874 pub const _PC_2_SYMLINKS: ::c_int = 20;
1875 
1876 pub const _SC_ARG_MAX: ::c_int = 0;
1877 pub const _SC_CHILD_MAX: ::c_int = 1;
1878 pub const _SC_CLK_TCK: ::c_int = 2;
1879 pub const _SC_NGROUPS_MAX: ::c_int = 3;
1880 pub const _SC_OPEN_MAX: ::c_int = 4;
1881 pub const _SC_STREAM_MAX: ::c_int = 5;
1882 pub const _SC_TZNAME_MAX: ::c_int = 6;
1883 pub const _SC_JOB_CONTROL: ::c_int = 7;
1884 pub const _SC_SAVED_IDS: ::c_int = 8;
1885 pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
1886 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
1887 pub const _SC_TIMERS: ::c_int = 11;
1888 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
1889 pub const _SC_PRIORITIZED_IO: ::c_int = 13;
1890 pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
1891 pub const _SC_FSYNC: ::c_int = 15;
1892 pub const _SC_MAPPED_FILES: ::c_int = 16;
1893 pub const _SC_MEMLOCK: ::c_int = 17;
1894 pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
1895 pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
1896 pub const _SC_MESSAGE_PASSING: ::c_int = 20;
1897 pub const _SC_SEMAPHORES: ::c_int = 21;
1898 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
1899 pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
1900 pub const _SC_AIO_MAX: ::c_int = 24;
1901 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
1902 pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
1903 pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
1904 pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
1905 pub const _SC_VERSION: ::c_int = 29;
1906 pub const _SC_PAGESIZE: ::c_int = 30;
1907 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
1908 pub const _SC_RTSIG_MAX: ::c_int = 31;
1909 pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
1910 pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
1911 pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
1912 pub const _SC_TIMER_MAX: ::c_int = 35;
1913 pub const _SC_BC_BASE_MAX: ::c_int = 36;
1914 pub const _SC_BC_DIM_MAX: ::c_int = 37;
1915 pub const _SC_BC_SCALE_MAX: ::c_int = 38;
1916 pub const _SC_BC_STRING_MAX: ::c_int = 39;
1917 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
1918 pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
1919 pub const _SC_LINE_MAX: ::c_int = 43;
1920 pub const _SC_RE_DUP_MAX: ::c_int = 44;
1921 pub const _SC_2_VERSION: ::c_int = 46;
1922 pub const _SC_2_C_BIND: ::c_int = 47;
1923 pub const _SC_2_C_DEV: ::c_int = 48;
1924 pub const _SC_2_FORT_DEV: ::c_int = 49;
1925 pub const _SC_2_FORT_RUN: ::c_int = 50;
1926 pub const _SC_2_SW_DEV: ::c_int = 51;
1927 pub const _SC_2_LOCALEDEF: ::c_int = 52;
1928 pub const _SC_UIO_MAXIOV: ::c_int = 60;
1929 pub const _SC_IOV_MAX: ::c_int = 60;
1930 pub const _SC_THREADS: ::c_int = 67;
1931 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
1932 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
1933 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
1934 pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
1935 pub const _SC_TTY_NAME_MAX: ::c_int = 72;
1936 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
1937 pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
1938 pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
1939 pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
1940 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
1941 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
1942 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
1943 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
1944 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
1945 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
1946 pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
1947 pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
1948 pub const _SC_PHYS_PAGES: ::c_int = 85;
1949 pub const _SC_AVPHYS_PAGES: ::c_int = 86;
1950 pub const _SC_ATEXIT_MAX: ::c_int = 87;
1951 pub const _SC_PASS_MAX: ::c_int = 88;
1952 pub const _SC_XOPEN_VERSION: ::c_int = 89;
1953 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
1954 pub const _SC_XOPEN_UNIX: ::c_int = 91;
1955 pub const _SC_XOPEN_CRYPT: ::c_int = 92;
1956 pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
1957 pub const _SC_XOPEN_SHM: ::c_int = 94;
1958 pub const _SC_2_CHAR_TERM: ::c_int = 95;
1959 pub const _SC_2_UPE: ::c_int = 97;
1960 pub const _SC_XOPEN_XPG2: ::c_int = 98;
1961 pub const _SC_XOPEN_XPG3: ::c_int = 99;
1962 pub const _SC_XOPEN_XPG4: ::c_int = 100;
1963 pub const _SC_NZERO: ::c_int = 109;
1964 pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
1965 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
1966 pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
1967 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
1968 pub const _SC_XOPEN_LEGACY: ::c_int = 129;
1969 pub const _SC_XOPEN_REALTIME: ::c_int = 130;
1970 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
1971 pub const _SC_ADVISORY_INFO: ::c_int = 132;
1972 pub const _SC_BARRIERS: ::c_int = 133;
1973 pub const _SC_CLOCK_SELECTION: ::c_int = 137;
1974 pub const _SC_CPUTIME: ::c_int = 138;
1975 pub const _SC_THREAD_CPUTIME: ::c_int = 139;
1976 pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
1977 pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
1978 pub const _SC_SPIN_LOCKS: ::c_int = 154;
1979 pub const _SC_REGEXP: ::c_int = 155;
1980 pub const _SC_SHELL: ::c_int = 157;
1981 pub const _SC_SPAWN: ::c_int = 159;
1982 pub const _SC_SPORADIC_SERVER: ::c_int = 160;
1983 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
1984 pub const _SC_TIMEOUTS: ::c_int = 164;
1985 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
1986 pub const _SC_2_PBS: ::c_int = 168;
1987 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
1988 pub const _SC_2_PBS_LOCATE: ::c_int = 170;
1989 pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
1990 pub const _SC_2_PBS_TRACK: ::c_int = 172;
1991 pub const _SC_SYMLOOP_MAX: ::c_int = 173;
1992 pub const _SC_STREAMS: ::c_int = 174;
1993 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
1994 pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
1995 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
1996 pub const _SC_V6_LP64_OFF64: ::c_int = 178;
1997 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
1998 pub const _SC_HOST_NAME_MAX: ::c_int = 180;
1999 pub const _SC_TRACE: ::c_int = 181;
2000 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
2001 pub const _SC_TRACE_INHERIT: ::c_int = 183;
2002 pub const _SC_TRACE_LOG: ::c_int = 184;
2003 pub const _SC_IPV6: ::c_int = 235;
2004 pub const _SC_RAW_SOCKETS: ::c_int = 236;
2005 pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
2006 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
2007 pub const _SC_V7_LP64_OFF64: ::c_int = 239;
2008 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
2009 pub const _SC_SS_REPL_MAX: ::c_int = 241;
2010 pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
2011 pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
2012 pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
2013 pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
2014 pub const _SC_XOPEN_STREAMS: ::c_int = 246;
2015 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
2016 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
2017 
2018 pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
2019 pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
2020 
2021 pub const GLOB_ERR: ::c_int = 1 << 0;
2022 pub const GLOB_MARK: ::c_int = 1 << 1;
2023 pub const GLOB_NOSORT: ::c_int = 1 << 2;
2024 pub const GLOB_DOOFFS: ::c_int = 1 << 3;
2025 pub const GLOB_NOCHECK: ::c_int = 1 << 4;
2026 pub const GLOB_APPEND: ::c_int = 1 << 5;
2027 pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
2028 
2029 pub const GLOB_NOSPACE: ::c_int = 1;
2030 pub const GLOB_ABORTED: ::c_int = 2;
2031 pub const GLOB_NOMATCH: ::c_int = 3;
2032 
2033 pub const POSIX_MADV_NORMAL: ::c_int = 0;
2034 pub const POSIX_MADV_RANDOM: ::c_int = 1;
2035 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
2036 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
2037 
2038 pub const S_IEXEC: mode_t = 64;
2039 pub const S_IWRITE: mode_t = 128;
2040 pub const S_IREAD: mode_t = 256;
2041 
2042 pub const F_LOCK: ::c_int = 1;
2043 pub const F_TEST: ::c_int = 3;
2044 pub const F_TLOCK: ::c_int = 2;
2045 pub const F_ULOCK: ::c_int = 0;
2046 
2047 pub const IFF_LOWER_UP: ::c_int = 0x10000;
2048 pub const IFF_DORMANT: ::c_int = 0x20000;
2049 pub const IFF_ECHO: ::c_int = 0x40000;
2050 
2051 pub const ST_RDONLY: ::c_ulong = 1;
2052 pub const ST_NOSUID: ::c_ulong = 2;
2053 pub const ST_NODEV: ::c_ulong = 4;
2054 pub const ST_NOEXEC: ::c_ulong = 8;
2055 pub const ST_SYNCHRONOUS: ::c_ulong = 16;
2056 pub const ST_MANDLOCK: ::c_ulong = 64;
2057 pub const ST_WRITE: ::c_ulong = 128;
2058 pub const ST_APPEND: ::c_ulong = 256;
2059 pub const ST_IMMUTABLE: ::c_ulong = 512;
2060 pub const ST_NOATIME: ::c_ulong = 1024;
2061 pub const ST_NODIRATIME: ::c_ulong = 2048;
2062 
2063 pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
2064 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
2065 pub const RTLD_NODELETE: ::c_int = 0x1000;
2066 pub const RTLD_NOW: ::c_int = 0x2;
2067 
2068 pub const TCP_MD5SIG: ::c_int = 14;
2069 
2070 align_const! {
2071     pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2072         size: [0; __SIZEOF_PTHREAD_MUTEX_T],
2073     };
2074     pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2075         size: [0; __SIZEOF_PTHREAD_COND_T],
2076     };
2077     pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2078         size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
2079     };
2080 }
2081 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
2082 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
2083 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
2084 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
2085 pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
2086 pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
2087 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
2088 
2089 pub const RENAME_NOREPLACE: ::c_int = 1;
2090 pub const RENAME_EXCHANGE: ::c_int = 2;
2091 pub const RENAME_WHITEOUT: ::c_int = 4;
2092 
2093 pub const SCHED_OTHER: ::c_int = 0;
2094 pub const SCHED_FIFO: ::c_int = 1;
2095 pub const SCHED_RR: ::c_int = 2;
2096 pub const SCHED_BATCH: ::c_int = 3;
2097 pub const SCHED_IDLE: ::c_int = 5;
2098 
2099 // netinet/in.h
2100 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
2101 
2102 // IPPROTO_IP defined in src/unix/mod.rs
2103 /// Hop-by-hop option header
2104 pub const IPPROTO_HOPOPTS: ::c_int = 0;
2105 // IPPROTO_ICMP defined in src/unix/mod.rs
2106 /// group mgmt protocol
2107 pub const IPPROTO_IGMP: ::c_int = 2;
2108 /// for compatibility
2109 pub const IPPROTO_IPIP: ::c_int = 4;
2110 // IPPROTO_TCP defined in src/unix/mod.rs
2111 /// exterior gateway protocol
2112 pub const IPPROTO_EGP: ::c_int = 8;
2113 /// pup
2114 pub const IPPROTO_PUP: ::c_int = 12;
2115 // IPPROTO_UDP defined in src/unix/mod.rs
2116 /// xns idp
2117 pub const IPPROTO_IDP: ::c_int = 22;
2118 /// tp-4 w/ class negotiation
2119 pub const IPPROTO_TP: ::c_int = 29;
2120 /// DCCP
2121 pub const IPPROTO_DCCP: ::c_int = 33;
2122 // IPPROTO_IPV6 defined in src/unix/mod.rs
2123 /// IP6 routing header
2124 pub const IPPROTO_ROUTING: ::c_int = 43;
2125 /// IP6 fragmentation header
2126 pub const IPPROTO_FRAGMENT: ::c_int = 44;
2127 /// resource reservation
2128 pub const IPPROTO_RSVP: ::c_int = 46;
2129 /// General Routing Encap.
2130 pub const IPPROTO_GRE: ::c_int = 47;
2131 /// IP6 Encap Sec. Payload
2132 pub const IPPROTO_ESP: ::c_int = 50;
2133 /// IP6 Auth Header
2134 pub const IPPROTO_AH: ::c_int = 51;
2135 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
2136 /// IP6 no next header
2137 pub const IPPROTO_NONE: ::c_int = 59;
2138 /// IP6 destination option
2139 pub const IPPROTO_DSTOPTS: ::c_int = 60;
2140 pub const IPPROTO_MTP: ::c_int = 92;
2141 pub const IPPROTO_BEETPH: ::c_int = 94;
2142 /// encapsulation header
2143 pub const IPPROTO_ENCAP: ::c_int = 98;
2144 /// Protocol indep. multicast
2145 pub const IPPROTO_PIM: ::c_int = 103;
2146 /// IP Payload Comp. Protocol
2147 pub const IPPROTO_COMP: ::c_int = 108;
2148 /// SCTP
2149 pub const IPPROTO_SCTP: ::c_int = 132;
2150 pub const IPPROTO_MH: ::c_int = 135;
2151 pub const IPPROTO_UDPLITE: ::c_int = 136;
2152 pub const IPPROTO_MPLS: ::c_int = 137;
2153 /// raw IP packet
2154 pub const IPPROTO_RAW: ::c_int = 255;
2155 pub const IPPROTO_MAX: ::c_int = 256;
2156 
2157 pub const AF_IB: ::c_int = 27;
2158 pub const AF_MPLS: ::c_int = 28;
2159 pub const AF_NFC: ::c_int = 39;
2160 pub const AF_VSOCK: ::c_int = 40;
2161 pub const PF_IB: ::c_int = AF_IB;
2162 pub const PF_MPLS: ::c_int = AF_MPLS;
2163 pub const PF_NFC: ::c_int = AF_NFC;
2164 pub const PF_VSOCK: ::c_int = AF_VSOCK;
2165 
2166 // System V IPC
2167 pub const IPC_PRIVATE: ::key_t = 0;
2168 
2169 pub const IPC_CREAT: ::c_int = 0o1000;
2170 pub const IPC_EXCL: ::c_int = 0o2000;
2171 pub const IPC_NOWAIT: ::c_int = 0o4000;
2172 
2173 pub const IPC_RMID: ::c_int = 0;
2174 pub const IPC_SET: ::c_int = 1;
2175 pub const IPC_STAT: ::c_int = 2;
2176 pub const IPC_INFO: ::c_int = 3;
2177 pub const MSG_STAT: ::c_int = 11;
2178 pub const MSG_INFO: ::c_int = 12;
2179 
2180 pub const MSG_NOERROR: ::c_int = 0o10000;
2181 pub const MSG_EXCEPT: ::c_int = 0o20000;
2182 pub const MSG_COPY: ::c_int = 0o40000;
2183 
2184 pub const SHM_R: ::c_int = 0o400;
2185 pub const SHM_W: ::c_int = 0o200;
2186 
2187 pub const SHM_RDONLY: ::c_int = 0o10000;
2188 pub const SHM_RND: ::c_int = 0o20000;
2189 pub const SHM_REMAP: ::c_int = 0o40000;
2190 pub const SHM_EXEC: ::c_int = 0o100000;
2191 
2192 pub const SHM_LOCK: ::c_int = 11;
2193 pub const SHM_UNLOCK: ::c_int = 12;
2194 
2195 pub const SHM_HUGETLB: ::c_int = 0o4000;
2196 pub const SHM_NORESERVE: ::c_int = 0o10000;
2197 
2198 pub const EPOLLRDHUP: ::c_int = 0x2000;
2199 pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
2200 pub const EPOLLONESHOT: ::c_int = 0x40000000;
2201 
2202 pub const QFMT_VFS_OLD: ::c_int = 1;
2203 pub const QFMT_VFS_V0: ::c_int = 2;
2204 pub const QFMT_VFS_V1: ::c_int = 4;
2205 
2206 pub const EFD_SEMAPHORE: ::c_int = 0x1;
2207 
2208 pub const LOG_NFACILITIES: ::c_int = 24;
2209 
2210 pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
2211 
2212 pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
2213 pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
2214 pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
2215 pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
2216 pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
2217 pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
2218 pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
2219 
2220 pub const AI_PASSIVE: ::c_int = 0x0001;
2221 pub const AI_CANONNAME: ::c_int = 0x0002;
2222 pub const AI_NUMERICHOST: ::c_int = 0x0004;
2223 pub const AI_V4MAPPED: ::c_int = 0x0008;
2224 pub const AI_ALL: ::c_int = 0x0010;
2225 pub const AI_ADDRCONFIG: ::c_int = 0x0020;
2226 
2227 pub const AI_NUMERICSERV: ::c_int = 0x0400;
2228 
2229 pub const EAI_BADFLAGS: ::c_int = -1;
2230 pub const EAI_NONAME: ::c_int = -2;
2231 pub const EAI_AGAIN: ::c_int = -3;
2232 pub const EAI_FAIL: ::c_int = -4;
2233 pub const EAI_FAMILY: ::c_int = -6;
2234 pub const EAI_SOCKTYPE: ::c_int = -7;
2235 pub const EAI_SERVICE: ::c_int = -8;
2236 pub const EAI_MEMORY: ::c_int = -10;
2237 pub const EAI_OVERFLOW: ::c_int = -12;
2238 
2239 pub const NI_NUMERICHOST: ::c_int = 1;
2240 pub const NI_NUMERICSERV: ::c_int = 2;
2241 pub const NI_NOFQDN: ::c_int = 4;
2242 pub const NI_NAMEREQD: ::c_int = 8;
2243 pub const NI_DGRAM: ::c_int = 16;
2244 
2245 pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
2246 pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
2247 pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
2248 
2249 pub const EAI_SYSTEM: ::c_int = -11;
2250 
2251 pub const AIO_CANCELED: ::c_int = 0;
2252 pub const AIO_NOTCANCELED: ::c_int = 1;
2253 pub const AIO_ALLDONE: ::c_int = 2;
2254 pub const LIO_READ: ::c_int = 0;
2255 pub const LIO_WRITE: ::c_int = 1;
2256 pub const LIO_NOP: ::c_int = 2;
2257 pub const LIO_WAIT: ::c_int = 0;
2258 pub const LIO_NOWAIT: ::c_int = 1;
2259 
2260 pub const MREMAP_MAYMOVE: ::c_int = 1;
2261 pub const MREMAP_FIXED: ::c_int = 2;
2262 
2263 pub const PR_SET_PDEATHSIG: ::c_int = 1;
2264 pub const PR_GET_PDEATHSIG: ::c_int = 2;
2265 
2266 pub const PR_GET_DUMPABLE: ::c_int = 3;
2267 pub const PR_SET_DUMPABLE: ::c_int = 4;
2268 
2269 pub const PR_GET_UNALIGN: ::c_int = 5;
2270 pub const PR_SET_UNALIGN: ::c_int = 6;
2271 pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
2272 pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
2273 
2274 pub const PR_GET_KEEPCAPS: ::c_int = 7;
2275 pub const PR_SET_KEEPCAPS: ::c_int = 8;
2276 
2277 pub const PR_GET_FPEMU: ::c_int = 9;
2278 pub const PR_SET_FPEMU: ::c_int = 10;
2279 pub const PR_FPEMU_NOPRINT: ::c_int = 1;
2280 pub const PR_FPEMU_SIGFPE: ::c_int = 2;
2281 
2282 pub const PR_GET_FPEXC: ::c_int = 11;
2283 pub const PR_SET_FPEXC: ::c_int = 12;
2284 pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
2285 pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
2286 pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
2287 pub const PR_FP_EXC_UND: ::c_int = 0x040000;
2288 pub const PR_FP_EXC_RES: ::c_int = 0x080000;
2289 pub const PR_FP_EXC_INV: ::c_int = 0x100000;
2290 pub const PR_FP_EXC_DISABLED: ::c_int = 0;
2291 pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
2292 pub const PR_FP_EXC_ASYNC: ::c_int = 2;
2293 pub const PR_FP_EXC_PRECISE: ::c_int = 3;
2294 
2295 pub const PR_GET_TIMING: ::c_int = 13;
2296 pub const PR_SET_TIMING: ::c_int = 14;
2297 pub const PR_TIMING_STATISTICAL: ::c_int = 0;
2298 pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
2299 
2300 pub const PR_SET_NAME: ::c_int = 15;
2301 pub const PR_GET_NAME: ::c_int = 16;
2302 
2303 pub const PR_GET_ENDIAN: ::c_int = 19;
2304 pub const PR_SET_ENDIAN: ::c_int = 20;
2305 pub const PR_ENDIAN_BIG: ::c_int = 0;
2306 pub const PR_ENDIAN_LITTLE: ::c_int = 1;
2307 pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
2308 
2309 pub const PR_GET_SECCOMP: ::c_int = 21;
2310 pub const PR_SET_SECCOMP: ::c_int = 22;
2311 
2312 pub const PR_CAPBSET_READ: ::c_int = 23;
2313 pub const PR_CAPBSET_DROP: ::c_int = 24;
2314 
2315 pub const PR_GET_TSC: ::c_int = 25;
2316 pub const PR_SET_TSC: ::c_int = 26;
2317 pub const PR_TSC_ENABLE: ::c_int = 1;
2318 pub const PR_TSC_SIGSEGV: ::c_int = 2;
2319 
2320 pub const PR_GET_SECUREBITS: ::c_int = 27;
2321 pub const PR_SET_SECUREBITS: ::c_int = 28;
2322 
2323 pub const PR_SET_TIMERSLACK: ::c_int = 29;
2324 pub const PR_GET_TIMERSLACK: ::c_int = 30;
2325 
2326 pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
2327 pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
2328 
2329 pub const PR_MCE_KILL: ::c_int = 33;
2330 pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
2331 pub const PR_MCE_KILL_SET: ::c_int = 1;
2332 
2333 pub const PR_MCE_KILL_LATE: ::c_int = 0;
2334 pub const PR_MCE_KILL_EARLY: ::c_int = 1;
2335 pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
2336 
2337 pub const PR_MCE_KILL_GET: ::c_int = 34;
2338 
2339 pub const PR_SET_MM: ::c_int = 35;
2340 pub const PR_SET_MM_START_CODE: ::c_int = 1;
2341 pub const PR_SET_MM_END_CODE: ::c_int = 2;
2342 pub const PR_SET_MM_START_DATA: ::c_int = 3;
2343 pub const PR_SET_MM_END_DATA: ::c_int = 4;
2344 pub const PR_SET_MM_START_STACK: ::c_int = 5;
2345 pub const PR_SET_MM_START_BRK: ::c_int = 6;
2346 pub const PR_SET_MM_BRK: ::c_int = 7;
2347 pub const PR_SET_MM_ARG_START: ::c_int = 8;
2348 pub const PR_SET_MM_ARG_END: ::c_int = 9;
2349 pub const PR_SET_MM_ENV_START: ::c_int = 10;
2350 pub const PR_SET_MM_ENV_END: ::c_int = 11;
2351 pub const PR_SET_MM_AUXV: ::c_int = 12;
2352 pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
2353 pub const PR_SET_MM_MAP: ::c_int = 14;
2354 pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
2355 
2356 pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
2357 
2358 pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
2359 pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
2360 
2361 pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
2362 pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
2363 
2364 pub const PR_GET_TID_ADDRESS: ::c_int = 40;
2365 
2366 pub const PR_SET_THP_DISABLE: ::c_int = 41;
2367 pub const PR_GET_THP_DISABLE: ::c_int = 42;
2368 
2369 pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43;
2370 pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44;
2371 
2372 pub const PR_SET_FP_MODE: ::c_int = 45;
2373 pub const PR_GET_FP_MODE: ::c_int = 46;
2374 pub const PR_FP_MODE_FR: ::c_int = 1 << 0;
2375 pub const PR_FP_MODE_FRE: ::c_int = 1 << 1;
2376 
2377 pub const PR_CAP_AMBIENT: ::c_int = 47;
2378 pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1;
2379 pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
2380 pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
2381 pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
2382 
2383 pub const GRND_NONBLOCK: ::c_uint = 0x0001;
2384 pub const GRND_RANDOM: ::c_uint = 0x0002;
2385 
2386 pub const ITIMER_REAL: ::c_int = 0;
2387 pub const ITIMER_VIRTUAL: ::c_int = 1;
2388 pub const ITIMER_PROF: ::c_int = 2;
2389 
2390 pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC;
2391 pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK;
2392 pub const TFD_TIMER_ABSTIME: ::c_int = 1;
2393 
2394 pub const XATTR_CREATE: ::c_int = 0x1;
2395 pub const XATTR_REPLACE: ::c_int = 0x2;
2396 
2397 pub const _POSIX_VDISABLE: ::cc_t = 0;
2398 
2399 pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
2400 pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
2401 pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
2402 pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
2403 pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
2404 pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
2405 
2406 // On Linux, libc doesn't define this constant, libattr does instead.
2407 // We still define it for Linux as it's defined by libc on other platforms,
2408 // and it's mentioned in the man pages for getxattr and setxattr.
2409 pub const ENOATTR: ::c_int = ::ENODATA;
2410 
2411 pub const SO_ORIGINAL_DST: ::c_int = 80;
2412 pub const IUTF8: ::tcflag_t = 0x00004000;
2413 pub const CMSPAR: ::tcflag_t = 0o10000000000;
2414 
2415 pub const MFD_CLOEXEC: ::c_uint = 0x0001;
2416 pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
2417 
2418 // these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
2419 // the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
2420 // so we can use that type here to avoid having to cast.
2421 pub const PT_NULL: u32 = 0;
2422 pub const PT_LOAD: u32 = 1;
2423 pub const PT_DYNAMIC: u32 = 2;
2424 pub const PT_INTERP: u32 = 3;
2425 pub const PT_NOTE: u32 = 4;
2426 pub const PT_SHLIB: u32 = 5;
2427 pub const PT_PHDR: u32 = 6;
2428 pub const PT_TLS: u32 = 7;
2429 pub const PT_NUM: u32 = 8;
2430 pub const PT_LOOS: u32 = 0x60000000;
2431 pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
2432 pub const PT_GNU_STACK: u32 = 0x6474e551;
2433 pub const PT_GNU_RELRO: u32 = 0x6474e552;
2434 
2435 pub const SFD_CLOEXEC: ::c_int = 0x080000;
2436 
2437 pub const NCCS: usize = 32;
2438 
2439 pub const O_TRUNC:   ::c_int = 0x00040000;
2440 pub const O_NOATIME: ::c_int = 0x00002000;
2441 pub const O_CLOEXEC: ::c_int = 0x00000100;
2442 pub const O_TMPFILE: ::c_int = 0x00004000;
2443 
2444 pub const EBFONT: ::c_int = 59;
2445 pub const ENOSTR: ::c_int = 60;
2446 pub const ENODATA: ::c_int = 61;
2447 pub const ETIME: ::c_int = 62;
2448 pub const ENOSR: ::c_int = 63;
2449 pub const ENONET: ::c_int = 64;
2450 pub const ENOPKG: ::c_int = 65;
2451 pub const EREMOTE: ::c_int = 66;
2452 pub const ENOLINK: ::c_int = 67;
2453 pub const EADV: ::c_int = 68;
2454 pub const ESRMNT: ::c_int = 69;
2455 pub const ECOMM: ::c_int = 70;
2456 pub const EPROTO: ::c_int = 71;
2457 pub const EDOTDOT: ::c_int = 73;
2458 
2459 pub const SA_NODEFER: ::c_int = 0x40000000;
2460 pub const SA_RESETHAND: ::c_int = 0x80000000;
2461 pub const SA_RESTART: ::c_int = 0x10000000;
2462 pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
2463 
2464 pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
2465 
2466 pub const EFD_CLOEXEC: ::c_int = 0x80000;
2467 
2468 pub const BUFSIZ: ::c_uint = 1024;
2469 pub const TMP_MAX: ::c_uint = 10000;
2470 pub const FOPEN_MAX: ::c_uint = 1000;
2471 pub const O_PATH: ::c_int = 0x00400000;
2472 pub const O_EXEC: ::c_int = O_PATH;
2473 pub const O_SEARCH: ::c_int = O_PATH;
2474 pub const O_ACCMODE: ::c_int = (03 | O_SEARCH);
2475 pub const O_NDELAY: ::c_int = O_NONBLOCK;
2476 pub const NI_MAXHOST: ::socklen_t = 255;
2477 pub const PTHREAD_STACK_MIN: ::size_t = 2048;
2478 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
2479 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
2480 
2481 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
2482 
2483 pub const RLIM_INFINITY: ::rlim_t = !0;
2484 pub const RLIMIT_RTTIME: ::c_int = 15;
2485 pub const RLIMIT_NLIMITS: ::c_int = 16;
2486 
2487 pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
2488 
2489 pub const SOCK_DCCP: ::c_int = 6;
2490 pub const SOCK_PACKET: ::c_int = 10;
2491 
2492 pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
2493 pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
2494 pub const TCP_THIN_DUPACK: ::c_int = 17;
2495 pub const TCP_USER_TIMEOUT: ::c_int = 18;
2496 pub const TCP_REPAIR: ::c_int = 19;
2497 pub const TCP_REPAIR_QUEUE: ::c_int = 20;
2498 pub const TCP_QUEUE_SEQ: ::c_int = 21;
2499 pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
2500 pub const TCP_FASTOPEN: ::c_int = 23;
2501 pub const TCP_TIMESTAMP: ::c_int = 24;
2502 
2503 pub const SIGUNUSED: ::c_int = ::SIGSYS;
2504 
2505 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
2506 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
2507 pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
2508 
2509 pub const CPU_SETSIZE: ::c_int = 128;
2510 
2511 pub const PTRACE_TRACEME: ::c_int = 0;
2512 pub const PTRACE_PEEKTEXT: ::c_int = 1;
2513 pub const PTRACE_PEEKDATA: ::c_int = 2;
2514 pub const PTRACE_PEEKUSER: ::c_int = 3;
2515 pub const PTRACE_POKETEXT: ::c_int = 4;
2516 pub const PTRACE_POKEDATA: ::c_int = 5;
2517 pub const PTRACE_POKEUSER: ::c_int = 6;
2518 pub const PTRACE_CONT: ::c_int = 7;
2519 pub const PTRACE_KILL: ::c_int = 8;
2520 pub const PTRACE_SINGLESTEP: ::c_int = 9;
2521 pub const PTRACE_GETREGS: ::c_int = 12;
2522 pub const PTRACE_SETREGS: ::c_int = 13;
2523 pub const PTRACE_GETFPREGS: ::c_int = 14;
2524 pub const PTRACE_SETFPREGS: ::c_int = 15;
2525 pub const PTRACE_ATTACH: ::c_int = 16;
2526 pub const PTRACE_DETACH: ::c_int = 17;
2527 pub const PTRACE_GETFPXREGS: ::c_int = 18;
2528 pub const PTRACE_SETFPXREGS: ::c_int = 19;
2529 pub const PTRACE_SYSCALL: ::c_int = 24;
2530 pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
2531 pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
2532 pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
2533 pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
2534 pub const PTRACE_GETREGSET: ::c_int = 0x4204;
2535 pub const PTRACE_SETREGSET: ::c_int = 0x4205;
2536 pub const PTRACE_SEIZE: ::c_int = 0x4206;
2537 pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
2538 pub const PTRACE_LISTEN: ::c_int = 0x4208;
2539 pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
2540 
2541 pub const EPOLLWAKEUP: ::c_int = 0x20000000;
2542 
2543 pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
2544 
2545 pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
2546 
2547 pub const TCSANOW: ::c_int = 0;
2548 pub const TCSADRAIN: ::c_int = 1;
2549 pub const TCSAFLUSH: ::c_int = 2;
2550 
2551 pub const TIOCINQ: ::c_int = ::FIONREAD;
2552 
2553 pub const RTLD_GLOBAL: ::c_int = 0x100;
2554 pub const RTLD_NOLOAD: ::c_int = 0x4;
2555 
2556 // TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
2557 // kernel 3.10).  See also notbsd/mod.rs
2558 pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
2559 pub const CLOCK_TAI: ::clockid_t = 11;
2560 
2561 pub const MCL_CURRENT: ::c_int = 0x0001;
2562 pub const MCL_FUTURE: ::c_int = 0x0002;
2563 
2564 pub const CBAUD: ::tcflag_t = 0o0010017;
2565 pub const TAB1: ::c_int = 0x00000800;
2566 pub const TAB2: ::c_int = 0x00001000;
2567 pub const TAB3: ::c_int = 0x00001800;
2568 pub const CR1: ::c_int  = 0x00000200;
2569 pub const CR2: ::c_int  = 0x00000400;
2570 pub const CR3: ::c_int  = 0x00000600;
2571 pub const FF1: ::c_int  = 0x00008000;
2572 pub const BS1: ::c_int  = 0x00002000;
2573 pub const VT1: ::c_int  = 0x00004000;
2574 pub const VWERASE: usize = 14;
2575 pub const VREPRINT: usize = 12;
2576 pub const VSUSP: usize = 10;
2577 pub const VSTART: usize = 8;
2578 pub const VSTOP: usize = 9;
2579 pub const VDISCARD: usize = 13;
2580 pub const VTIME: usize = 5;
2581 pub const IXON: ::tcflag_t = 0x00000400;
2582 pub const IXOFF: ::tcflag_t = 0x00001000;
2583 pub const ONLCR: ::tcflag_t = 0x4;
2584 pub const CSIZE: ::tcflag_t = 0x00000030;
2585 pub const CS6: ::tcflag_t = 0x00000010;
2586 pub const CS7: ::tcflag_t = 0x00000020;
2587 pub const CS8: ::tcflag_t = 0x00000030;
2588 pub const CSTOPB: ::tcflag_t = 0x00000040;
2589 pub const CREAD: ::tcflag_t = 0x00000080;
2590 pub const PARENB: ::tcflag_t = 0x00000100;
2591 pub const PARODD: ::tcflag_t = 0x00000200;
2592 pub const HUPCL: ::tcflag_t = 0x00000400;
2593 pub const CLOCAL: ::tcflag_t = 0x00000800;
2594 pub const ECHOKE: ::tcflag_t = 0x00000800;
2595 pub const ECHOE: ::tcflag_t = 0x00000010;
2596 pub const ECHOK: ::tcflag_t = 0x00000020;
2597 pub const ECHONL: ::tcflag_t = 0x00000040;
2598 pub const ECHOPRT: ::tcflag_t = 0x00000400;
2599 pub const ECHOCTL: ::tcflag_t = 0x00000200;
2600 pub const ISIG: ::tcflag_t = 0x00000001;
2601 pub const ICANON: ::tcflag_t = 0x00000002;
2602 pub const PENDIN: ::tcflag_t = 0x00004000;
2603 pub const NOFLSH: ::tcflag_t = 0x00000080;
2604 pub const CIBAUD: ::tcflag_t = 0o02003600000;
2605 pub const CBAUDEX: ::tcflag_t = 0o010000;
2606 pub const VSWTC: usize = 7;
2607 pub const OLCUC:  ::tcflag_t = 0o000002;
2608 pub const NLDLY:  ::tcflag_t = 0o000400;
2609 pub const CRDLY:  ::tcflag_t = 0o003000;
2610 pub const TABDLY: ::tcflag_t = 0o014000;
2611 pub const BSDLY:  ::tcflag_t = 0o020000;
2612 pub const FFDLY:  ::tcflag_t = 0o100000;
2613 pub const VTDLY:  ::tcflag_t = 0o040000;
2614 pub const XTABS:  ::tcflag_t = 0o014000;
2615 
2616 pub const B0: ::speed_t = 0o000000;
2617 pub const B50: ::speed_t = 0o000001;
2618 pub const B75: ::speed_t = 0o000002;
2619 pub const B110: ::speed_t = 0o000003;
2620 pub const B134: ::speed_t = 0o000004;
2621 pub const B150: ::speed_t = 0o000005;
2622 pub const B200: ::speed_t = 0o000006;
2623 pub const B300: ::speed_t = 0o000007;
2624 pub const B600: ::speed_t = 0o000010;
2625 pub const B1200: ::speed_t = 0o000011;
2626 pub const B1800: ::speed_t = 0o000012;
2627 pub const B2400: ::speed_t = 0o000013;
2628 pub const B4800: ::speed_t = 0o000014;
2629 pub const B9600: ::speed_t = 0o000015;
2630 pub const B19200: ::speed_t = 0o000016;
2631 pub const B38400: ::speed_t = 0o000017;
2632 pub const EXTA: ::speed_t = B19200;
2633 pub const EXTB: ::speed_t = B38400;
2634 pub const B57600: ::speed_t = 0o010001;
2635 pub const B115200: ::speed_t = 0o010002;
2636 pub const B230400: ::speed_t = 0o010003;
2637 pub const B460800: ::speed_t = 0o010004;
2638 pub const B500000: ::speed_t = 0o010005;
2639 pub const B576000: ::speed_t = 0o010006;
2640 pub const B921600: ::speed_t = 0o010007;
2641 pub const B1000000: ::speed_t = 0o010010;
2642 pub const B1152000: ::speed_t = 0o010011;
2643 pub const B1500000: ::speed_t = 0o010012;
2644 pub const B2000000: ::speed_t = 0o010013;
2645 pub const B2500000: ::speed_t = 0o010014;
2646 pub const B3000000: ::speed_t = 0o010015;
2647 pub const B3500000: ::speed_t = 0o010016;
2648 pub const B4000000: ::speed_t = 0o010017;
2649 
2650 pub const SO_BINDTODEVICE: ::c_int = 25;
2651 pub const SO_TIMESTAMP: ::c_int = 29;
2652 pub const SO_MARK: ::c_int = 36;
2653 pub const SO_RXQ_OVFL: ::c_int = 40;
2654 pub const SO_PEEK_OFF: ::c_int = 42;
2655 pub const SO_BUSY_POLL: ::c_int = 46;
2656 
2657 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
2658 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
2659 
2660 pub const O_ASYNC: ::c_int = 0x00000400;
2661 
2662 pub const FIOCLEX: ::c_int = 0x5451;
2663 pub const FIONBIO: ::c_int = 0x5421;
2664 
2665 pub const RLIMIT_RSS: ::c_int = 5;
2666 pub const RLIMIT_NOFILE: ::c_int = 7;
2667 pub const RLIMIT_AS: ::c_int = 9;
2668 pub const RLIMIT_NPROC: ::c_int = 6;
2669 pub const RLIMIT_MEMLOCK: ::c_int = 8;
2670 
2671 pub const O_APPEND: ::c_int = 0x00100000;
2672 pub const O_CREAT:  ::c_int = 0x00010000;
2673 pub const O_EXCL:   ::c_int = 0x00020000;
2674 pub const O_NOCTTY: ::c_int = 0x00000200;
2675 pub const O_NONBLOCK: ::c_int = 0x00000010;
2676 pub const O_SYNC:   ::c_int = (0x00000040 | O_DSYNC);
2677 pub const O_RSYNC:  ::c_int = O_SYNC;
2678 pub const O_DSYNC:  ::c_int = 0x00000020;
2679 
2680 pub const SOCK_NONBLOCK: ::c_int = 2048;
2681 
2682 pub const MAP_ANON: ::c_int = 0x0020;
2683 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
2684 pub const MAP_DENYWRITE: ::c_int = 0x0800;
2685 pub const MAP_EXECUTABLE: ::c_int = 0x01000;
2686 pub const MAP_LOCKED: ::c_int = 0x02000;
2687 pub const MAP_NORESERVE: ::c_int = 0x04000;
2688 pub const MAP_POPULATE: ::c_int = 0x08000;
2689 pub const MAP_NONBLOCK: ::c_int = 0x010000;
2690 pub const MAP_STACK: ::c_int = 0x020000;
2691 
2692 pub const SOCK_STREAM: ::c_int = 1;
2693 pub const SOCK_DGRAM: ::c_int = 2;
2694 pub const SOCK_SEQPACKET: ::c_int = 5;
2695 
2696 pub const SOL_SOCKET: ::c_int = 1;
2697 
2698 pub const EDEADLK: ::c_int = 35;
2699 pub const ENAMETOOLONG: ::c_int = 36;
2700 pub const ENOLCK: ::c_int = 37;
2701 pub const ENOSYS: ::c_int = 38;
2702 pub const ENOTEMPTY: ::c_int = 39;
2703 pub const ELOOP: ::c_int = 40;
2704 pub const ENOMSG: ::c_int = 42;
2705 pub const EIDRM: ::c_int = 43;
2706 pub const ECHRNG: ::c_int = 44;
2707 pub const EL2NSYNC: ::c_int = 45;
2708 pub const EL3HLT: ::c_int = 46;
2709 pub const EL3RST: ::c_int = 47;
2710 pub const ELNRNG: ::c_int = 48;
2711 pub const EUNATCH: ::c_int = 49;
2712 pub const ENOCSI: ::c_int = 50;
2713 pub const EL2HLT: ::c_int = 51;
2714 pub const EBADE: ::c_int = 52;
2715 pub const EBADR: ::c_int = 53;
2716 pub const EXFULL: ::c_int = 54;
2717 pub const ENOANO: ::c_int = 55;
2718 pub const EBADRQC: ::c_int = 56;
2719 pub const EBADSLT: ::c_int = 57;
2720 pub const EDEADLOCK: ::c_int = EDEADLK;
2721 pub const EMULTIHOP: ::c_int = 72;
2722 pub const EBADMSG: ::c_int = 74;
2723 pub const EOVERFLOW: ::c_int = 75;
2724 pub const ENOTUNIQ: ::c_int = 76;
2725 pub const EBADFD: ::c_int = 77;
2726 pub const EREMCHG: ::c_int = 78;
2727 pub const ELIBACC: ::c_int = 79;
2728 pub const ELIBBAD: ::c_int = 80;
2729 pub const ELIBSCN: ::c_int = 81;
2730 pub const ELIBMAX: ::c_int = 82;
2731 pub const ELIBEXEC: ::c_int = 83;
2732 pub const EILSEQ: ::c_int = 84;
2733 pub const ERESTART: ::c_int = 85;
2734 pub const ESTRPIPE: ::c_int = 86;
2735 pub const EUSERS: ::c_int = 87;
2736 pub const ENOTSOCK: ::c_int = 88;
2737 pub const EDESTADDRREQ: ::c_int = 89;
2738 pub const EMSGSIZE: ::c_int = 90;
2739 pub const EPROTOTYPE: ::c_int = 91;
2740 pub const ENOPROTOOPT: ::c_int = 92;
2741 pub const EPROTONOSUPPORT: ::c_int = 93;
2742 pub const ESOCKTNOSUPPORT: ::c_int = 94;
2743 pub const EOPNOTSUPP: ::c_int = 95;
2744 pub const ENOTSUP: ::c_int = EOPNOTSUPP;
2745 pub const EPFNOSUPPORT: ::c_int = 96;
2746 pub const EAFNOSUPPORT: ::c_int = 97;
2747 pub const EADDRINUSE: ::c_int = 98;
2748 pub const EADDRNOTAVAIL: ::c_int = 99;
2749 pub const ENETDOWN: ::c_int = 100;
2750 pub const ENETUNREACH: ::c_int = 101;
2751 pub const ENETRESET: ::c_int = 102;
2752 pub const ECONNABORTED: ::c_int = 103;
2753 pub const ECONNRESET: ::c_int = 104;
2754 pub const ENOBUFS: ::c_int = 105;
2755 pub const EISCONN: ::c_int = 106;
2756 pub const ENOTCONN: ::c_int = 107;
2757 pub const ESHUTDOWN: ::c_int = 108;
2758 pub const ETOOMANYREFS: ::c_int = 109;
2759 pub const ETIMEDOUT: ::c_int = 110;
2760 pub const ECONNREFUSED: ::c_int = 111;
2761 pub const EHOSTDOWN: ::c_int = 112;
2762 pub const EHOSTUNREACH: ::c_int = 113;
2763 pub const EALREADY: ::c_int = 114;
2764 pub const EINPROGRESS: ::c_int = 115;
2765 pub const ESTALE: ::c_int = 116;
2766 pub const EUCLEAN: ::c_int = 117;
2767 pub const ENOTNAM: ::c_int = 118;
2768 pub const ENAVAIL: ::c_int = 119;
2769 pub const EISNAM: ::c_int = 120;
2770 pub const EREMOTEIO: ::c_int = 121;
2771 pub const EDQUOT: ::c_int = 122;
2772 pub const ENOMEDIUM: ::c_int = 123;
2773 pub const EMEDIUMTYPE: ::c_int = 124;
2774 pub const ECANCELED: ::c_int = 125;
2775 pub const ENOKEY: ::c_int = 126;
2776 pub const EKEYEXPIRED: ::c_int = 127;
2777 pub const EKEYREVOKED: ::c_int = 128;
2778 pub const EKEYREJECTED: ::c_int = 129;
2779 pub const EOWNERDEAD: ::c_int = 130;
2780 pub const ENOTRECOVERABLE: ::c_int = 131;
2781 pub const ERFKILL: ::c_int = 132;
2782 pub const EHWPOISON: ::c_int = 133;
2783 
2784 pub const SO_REUSEADDR: ::c_int = 2;
2785 pub const SO_TYPE: ::c_int = 3;
2786 pub const SO_ERROR: ::c_int = 4;
2787 pub const SO_DONTROUTE: ::c_int = 5;
2788 pub const SO_BROADCAST: ::c_int = 6;
2789 pub const SO_SNDBUF: ::c_int = 7;
2790 pub const SO_RCVBUF: ::c_int = 8;
2791 pub const SO_KEEPALIVE: ::c_int = 9;
2792 pub const SO_OOBINLINE: ::c_int = 10;
2793 pub const SO_NO_CHECK: ::c_int = 11;
2794 pub const SO_PRIORITY: ::c_int = 12;
2795 pub const SO_LINGER: ::c_int = 13;
2796 pub const SO_BSDCOMPAT: ::c_int = 14;
2797 pub const SO_REUSEPORT: ::c_int = 15;
2798 pub const SO_PASSCRED: ::c_int = 16;
2799 pub const SO_PEERCRED: ::c_int = 17;
2800 pub const SO_RCVLOWAT: ::c_int = 18;
2801 pub const SO_SNDLOWAT: ::c_int = 19;
2802 pub const SO_RCVTIMEO: ::c_int = 20;
2803 pub const SO_SNDTIMEO: ::c_int = 21;
2804 pub const SO_ACCEPTCONN: ::c_int = 30;
2805 pub const SO_SNDBUFFORCE: ::c_int = 32;
2806 pub const SO_RCVBUFFORCE: ::c_int = 33;
2807 pub const SO_PROTOCOL: ::c_int = 38;
2808 pub const SO_DOMAIN: ::c_int = 39;
2809 
2810 pub const SA_ONSTACK: ::c_int = 0x08000000;
2811 pub const SA_SIGINFO: ::c_int = 0x00000004;
2812 pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
2813 
2814 pub const SIGCHLD: ::c_int = 17;
2815 pub const SIGBUS: ::c_int = 7;
2816 pub const SIGTTIN: ::c_int = 21;
2817 pub const SIGTTOU: ::c_int = 22;
2818 pub const SIGXCPU: ::c_int = 24;
2819 pub const SIGXFSZ: ::c_int = 25;
2820 pub const SIGVTALRM: ::c_int = 26;
2821 pub const SIGPROF: ::c_int = 27;
2822 pub const SIGWINCH: ::c_int = 28;
2823 pub const SIGUSR1: ::c_int = 10;
2824 pub const SIGUSR2: ::c_int = 12;
2825 pub const SIGCONT: ::c_int = 18;
2826 pub const SIGSTOP: ::c_int = 19;
2827 pub const SIGTSTP: ::c_int = 20;
2828 pub const SIGURG: ::c_int = 23;
2829 pub const SIGIO: ::c_int = 29;
2830 pub const SIGSYS: ::c_int = 31;
2831 pub const SIGSTKFLT: ::c_int = 16;
2832 pub const SIGPOLL: ::c_int = 29;
2833 pub const SIGPWR: ::c_int = 30;
2834 pub const SIG_SETMASK: ::c_int = 2;
2835 pub const SIG_BLOCK: ::c_int = 0x000000;
2836 pub const SIG_UNBLOCK: ::c_int = 0x01;
2837 
2838 pub const EXTPROC: ::tcflag_t = 0x00010000;
2839 
2840 pub const MAP_HUGETLB: ::c_int = 0x040000;
2841 
2842 pub const F_GETLK: ::c_int = 5;
2843 pub const F_GETOWN: ::c_int = 9;
2844 pub const F_SETLK: ::c_int = 6;
2845 pub const F_SETLKW: ::c_int = 7;
2846 pub const F_SETOWN: ::c_int = 8;
2847 
2848 pub const VEOF: usize = 4;
2849 pub const VEOL: usize = 11;
2850 pub const VEOL2: usize = 16;
2851 pub const VMIN: usize = 6;
2852 pub const IEXTEN: ::tcflag_t = 0x00008000;
2853 pub const TOSTOP: ::tcflag_t = 0x00000100;
2854 pub const FLUSHO: ::tcflag_t = 0x00001000;
2855 
2856 pub const TCGETS: ::c_int = 0x5401;
2857 pub const TCSETS: ::c_int = 0x5402;
2858 pub const TCSETSW: ::c_int = 0x5403;
2859 pub const TCSETSF: ::c_int = 0x5404;
2860 pub const TCGETA: ::c_int = 0x5405;
2861 pub const TCSETA: ::c_int = 0x5406;
2862 pub const TCSETAW: ::c_int = 0x5407;
2863 pub const TCSETAF: ::c_int = 0x5408;
2864 pub const TCSBRK: ::c_int = 0x5409;
2865 pub const TCXONC: ::c_int = 0x540A;
2866 pub const TCFLSH: ::c_int = 0x540B;
2867 pub const TIOCGSOFTCAR: ::c_int = 0x5419;
2868 pub const TIOCSSOFTCAR: ::c_int = 0x541A;
2869 pub const TIOCLINUX: ::c_int = 0x541C;
2870 pub const TIOCGSERIAL: ::c_int = 0x541E;
2871 pub const TIOCEXCL: ::c_int = 0x540C;
2872 pub const TIOCNXCL: ::c_int = 0x540D;
2873 pub const TIOCSCTTY: ::c_int = 0x540E;
2874 pub const TIOCGPGRP: ::c_int = 0x540F;
2875 pub const TIOCSPGRP: ::c_int = 0x5410;
2876 pub const TIOCOUTQ: ::c_int = 0x5411;
2877 pub const TIOCSTI: ::c_int = 0x5412;
2878 pub const TIOCGWINSZ: ::c_int = 0x5413;
2879 pub const TIOCSWINSZ: ::c_int = 0x5414;
2880 pub const TIOCMGET: ::c_int = 0x5415;
2881 pub const TIOCMBIS: ::c_int = 0x5416;
2882 pub const TIOCMBIC: ::c_int = 0x5417;
2883 pub const TIOCMSET: ::c_int = 0x5418;
2884 pub const FIONREAD: ::c_int = 0x541B;
2885 pub const TIOCCONS: ::c_int = 0x541D;
2886 
2887 pub const POLLWRNORM: ::c_short = 0x100;
2888 pub const POLLWRBAND: ::c_short = 0x200;
2889 
2890 pub const TIOCM_LE: ::c_int = 0x001;
2891 pub const TIOCM_DTR: ::c_int = 0x002;
2892 pub const TIOCM_RTS: ::c_int = 0x004;
2893 pub const TIOCM_ST: ::c_int = 0x008;
2894 pub const TIOCM_SR: ::c_int = 0x010;
2895 pub const TIOCM_CTS: ::c_int = 0x020;
2896 pub const TIOCM_CAR: ::c_int = 0x040;
2897 pub const TIOCM_RNG: ::c_int = 0x080;
2898 pub const TIOCM_DSR: ::c_int = 0x100;
2899 pub const TIOCM_CD: ::c_int = TIOCM_CAR;
2900 pub const TIOCM_RI: ::c_int = TIOCM_RNG;
2901 
2902 pub const O_DIRECTORY: ::c_int = 0x00080000;
2903 pub const O_DIRECT:    ::c_int = 0x00000800;
2904 pub const O_LARGEFILE: ::c_int = 0x00001000;
2905 pub const O_NOFOLLOW:  ::c_int = 0x00000080;
2906 
2907 // intentionally not public, only used for fd_set
2908 cfg_if! {
2909     if #[cfg(target_pointer_width = "32")] {
2910         const ULONG_SIZE: usize = 32;
2911     } else if #[cfg(target_pointer_width = "64")] {
2912         const ULONG_SIZE: usize = 64;
2913     } else {
2914         // Unknown target_pointer_width
2915     }
2916 }
2917 
2918 // END_PUB_CONST
2919 
2920 f! {
2921     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
2922         let fd = fd as usize;
2923         let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
2924         (*set).fds_bits[fd / size] &= !(1 << (fd % size));
2925         return
2926     }
2927 
2928     pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
2929         let fd = fd as usize;
2930         let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
2931         return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
2932     }
2933 
2934     pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
2935         let fd = fd as usize;
2936         let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
2937         (*set).fds_bits[fd / size] |= 1 << (fd % size);
2938         return
2939     }
2940 
2941     pub fn FD_ZERO(set: *mut fd_set) -> () {
2942         for slot in (*set).fds_bits.iter_mut() {
2943             *slot = 0;
2944         }
2945     }
2946 
2947     pub fn WIFSTOPPED(status: ::c_int) -> bool {
2948         (status & 0xff) == 0x7f
2949     }
2950 
2951     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
2952         (status >> 8) & 0xff
2953     }
2954 
2955     pub fn WIFCONTINUED(status: ::c_int) -> bool {
2956         status == 0xffff
2957     }
2958 
2959     pub fn WIFSIGNALED(status: ::c_int) -> bool {
2960         ((status & 0x7f) + 1) as i8 >= 2
2961     }
2962 
2963     pub fn WTERMSIG(status: ::c_int) -> ::c_int {
2964         status & 0x7f
2965     }
2966 
2967     pub fn WIFEXITED(status: ::c_int) -> bool {
2968         (status & 0x7f) == 0
2969     }
2970 
2971     pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
2972         (status >> 8) & 0xff
2973     }
2974 
2975     pub fn WCOREDUMP(status: ::c_int) -> bool {
2976         (status & 0x80) != 0
2977     }
2978 
2979     pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
2980         (cmd << 8) | (type_ & 0x00ff)
2981     }
2982 
2983     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
2984         for slot in cpuset.bits.iter_mut() {
2985             *slot = 0;
2986         }
2987     }
2988 
2989     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
2990         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
2991         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
2992         cpuset.bits[idx] |= 1 << offset;
2993         ()
2994     }
2995 
2996     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
2997         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
2998         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
2999         cpuset.bits[idx] &= !(1 << offset);
3000         ()
3001     }
3002 
3003     pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
3004         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]);
3005         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
3006         0 != (cpuset.bits[idx] & (1 << offset))
3007     }
3008 
3009     pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
3010         set1.bits == set2.bits
3011     }
3012 
3013     pub fn major(dev: ::dev_t) -> ::c_uint {
3014         let mut major = 0;
3015         major |= (dev & 0x00000000000fff00) >> 8;
3016         major |= (dev & 0xfffff00000000000) >> 32;
3017         major as ::c_uint
3018     }
3019 
3020     pub fn minor(dev: ::dev_t) -> ::c_uint {
3021         let mut minor = 0;
3022         minor |= (dev & 0x00000000000000ff) >> 0;
3023         minor |= (dev & 0x00000ffffff00000) >> 12;
3024         minor as ::c_uint
3025     }
3026 
3027     pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
3028         let major = major as ::dev_t;
3029         let minor = minor as ::dev_t;
3030         let mut dev = 0;
3031         dev |= (major & 0x00000fff) << 8;
3032         dev |= (major & 0xfffff000) << 32;
3033         dev |= (minor & 0x000000ff) << 0;
3034         dev |= (minor & 0xffffff00) << 12;
3035         dev
3036     }
3037 }
3038 
3039 // EXTERN_FN
3040 
3041 #[link(name = "c")]
3042 #[link(name = "fdio")]
3043 extern {}
3044 
3045 pub enum FILE {}
3046 pub enum fpos_t {} // TODO: fill this out with a struct
3047 
3048 extern {
3049     pub fn isalnum(c: c_int) -> c_int;
3050     pub fn isalpha(c: c_int) -> c_int;
3051     pub fn iscntrl(c: c_int) -> c_int;
3052     pub fn isdigit(c: c_int) -> c_int;
3053     pub fn isgraph(c: c_int) -> c_int;
3054     pub fn islower(c: c_int) -> c_int;
3055     pub fn isprint(c: c_int) -> c_int;
3056     pub fn ispunct(c: c_int) -> c_int;
3057     pub fn isspace(c: c_int) -> c_int;
3058     pub fn isupper(c: c_int) -> c_int;
3059     pub fn isxdigit(c: c_int) -> c_int;
3060     pub fn tolower(c: c_int) -> c_int;
3061     pub fn toupper(c: c_int) -> c_int;
3062     pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
3063     pub fn freopen(filename: *const c_char, mode: *const c_char,
3064                    file: *mut FILE) -> *mut FILE;
3065     pub fn fflush(file: *mut FILE) -> c_int;
3066     pub fn fclose(file: *mut FILE) -> c_int;
3067     pub fn remove(filename: *const c_char) -> c_int;
3068     pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
3069     pub fn tmpfile() -> *mut FILE;
3070     pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int,
3071                    size: size_t) -> c_int;
3072     pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
3073     pub fn getchar() -> c_int;
3074     pub fn putchar(c: c_int) -> c_int;
3075     pub fn fgetc(stream: *mut FILE) -> c_int;
3076     pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
3077     pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
3078     pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
3079     pub fn puts(s: *const c_char) -> c_int;
3080     pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
3081     pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t,
3082                  stream: *mut FILE) -> size_t;
3083     pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t,
3084                   stream: *mut FILE) -> size_t;
3085     pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
3086     pub fn ftell(stream: *mut FILE) -> c_long;
3087     pub fn rewind(stream: *mut FILE);
3088     pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
3089     pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
3090     pub fn feof(stream: *mut FILE) -> c_int;
3091     pub fn ferror(stream: *mut FILE) -> c_int;
3092     pub fn perror(s: *const c_char);
3093     pub fn atoi(s: *const c_char) -> c_int;
3094     pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
3095     pub fn strtol(s: *const c_char, endp: *mut *mut c_char,
3096                   base: c_int) -> c_long;
3097     pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
3098                    base: c_int) -> c_ulong;
3099     pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
3100     pub fn malloc(size: size_t) -> *mut c_void;
3101     pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
3102     pub fn free(p: *mut c_void);
3103     pub fn abort() -> !;
3104     pub fn exit(status: c_int) -> !;
3105     pub fn _exit(status: c_int) -> !;
3106     pub fn atexit(cb: extern fn()) -> c_int;
3107     pub fn system(s: *const c_char) -> c_int;
3108     pub fn getenv(s: *const c_char) -> *mut c_char;
3109 
3110     pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
3111     pub fn strncpy(dst: *mut c_char, src: *const c_char,
3112                    n: size_t) -> *mut c_char;
3113     pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
3114     pub fn strncat(s: *mut c_char, ct: *const c_char,
3115                    n: size_t) -> *mut c_char;
3116     pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
3117     pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
3118     pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
3119     pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
3120     pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
3121     pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
3122     pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
3123     pub fn strdup(cs: *const c_char) -> *mut c_char;
3124     pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
3125     pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
3126     pub fn strlen(cs: *const c_char) -> size_t;
3127     pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
3128     pub fn strerror(n: c_int) -> *mut c_char;
3129     pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
3130     pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
3131     pub fn wcslen(buf: *const wchar_t) -> size_t;
3132     pub fn wcstombs(dest: *mut c_char, src: *const wchar_t,
3133                     n: size_t) -> ::size_t;
3134 
3135     pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
3136     pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
3137     pub fn memcpy(dest: *mut c_void, src: *const c_void,
3138                   n: size_t) -> *mut c_void;
3139     pub fn memmove(dest: *mut c_void, src: *const c_void,
3140                    n: size_t) -> *mut c_void;
3141     pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
3142 
3143     pub fn abs(i: c_int) -> c_int;
3144     pub fn atof(s: *const c_char) -> c_double;
3145     pub fn labs(i: c_long) -> c_long;
3146     pub fn rand() -> c_int;
3147     pub fn srand(seed: c_uint);
3148 
3149     pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
3150     pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
3151 
3152     pub fn fprintf(stream: *mut ::FILE,
3153                    format: *const ::c_char, ...) -> ::c_int;
3154     pub fn printf(format: *const ::c_char, ...) -> ::c_int;
3155     pub fn snprintf(s: *mut ::c_char, n: ::size_t,
3156                     format: *const ::c_char, ...) -> ::c_int;
3157     pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
3158     pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
3159     pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
3160     pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
3161     pub fn getchar_unlocked() -> ::c_int;
3162     pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
3163 
3164     pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
3165     pub fn connect(socket: ::c_int, address: *const sockaddr,
3166                    len: socklen_t) -> ::c_int;
3167     pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
3168     pub fn accept(socket: ::c_int, address: *mut sockaddr,
3169                   address_len: *mut socklen_t) -> ::c_int;
3170     pub fn getpeername(socket: ::c_int, address: *mut sockaddr,
3171                        address_len: *mut socklen_t) -> ::c_int;
3172     pub fn getsockname(socket: ::c_int, address: *mut sockaddr,
3173                        address_len: *mut socklen_t) -> ::c_int;
3174     pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int,
3175                       value: *const ::c_void,
3176                       option_len: socklen_t) -> ::c_int;
3177     pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int,
3178                       socket_vector: *mut ::c_int) -> ::c_int;
3179     pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
3180                   flags: ::c_int, addr: *const sockaddr,
3181                   addrlen: socklen_t) -> ::ssize_t;
3182     pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
3183 
3184     pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
3185     pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
3186 
3187     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
3188 
3189     pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
3190 
3191     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
3192 
3193     pub fn pclose(stream: *mut ::FILE) -> ::c_int;
3194     pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
3195     pub fn fileno(stream: *mut ::FILE) -> ::c_int;
3196 
3197     pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
3198     pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
3199     pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
3200 
3201     pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
3202     pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
3203     pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
3204                      result: *mut *mut ::dirent) -> ::c_int;
3205     pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
3206     pub fn rewinddir(dirp: *mut ::DIR);
3207 
3208     pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
3209                   flags: ::c_int, ...) -> ::c_int;
3210     pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
3211                     mode: ::mode_t, flags: ::c_int) -> ::c_int;
3212     pub fn fchown(fd: ::c_int,
3213                   owner: ::uid_t,
3214                   group: ::gid_t) -> ::c_int;
3215     pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
3216                     owner: ::uid_t, group: ::gid_t,
3217                     flags: ::c_int) -> ::c_int;
3218     pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
3219                    buf: *mut stat, flags: ::c_int) -> ::c_int;
3220     pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
3221                   newdirfd: ::c_int, newpath: *const ::c_char,
3222                   flags: ::c_int) -> ::c_int;
3223     pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
3224                    mode: ::mode_t) -> ::c_int;
3225     pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
3226                       buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
3227     pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
3228                     newdirfd: ::c_int, newpath: *const ::c_char)
3229                     -> ::c_int;
3230     pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
3231                      linkpath: *const ::c_char) -> ::c_int;
3232     pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
3233                     flags: ::c_int) -> ::c_int;
3234 
3235     pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
3236     pub fn alarm(seconds: ::c_uint) -> ::c_uint;
3237     pub fn chdir(dir: *const c_char) -> ::c_int;
3238     pub fn fchdir(dirfd: ::c_int) -> ::c_int;
3239     pub fn chown(path: *const c_char, uid: uid_t,
3240                  gid: gid_t) -> ::c_int;
3241     pub fn lchown(path: *const c_char, uid: uid_t,
3242                   gid: gid_t) -> ::c_int;
3243     pub fn close(fd: ::c_int) -> ::c_int;
3244     pub fn dup(fd: ::c_int) -> ::c_int;
3245     pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
3246     pub fn execl(path: *const c_char,
3247                  arg0: *const c_char, ...) -> ::c_int;
3248     pub fn execle(path: *const ::c_char,
3249                   arg0: *const ::c_char, ...) -> ::c_int;
3250     pub fn execlp(file: *const ::c_char,
3251                   arg0: *const ::c_char, ...) -> ::c_int;
3252     pub fn execv(prog: *const c_char,
3253                  argv: *const *const c_char) -> ::c_int;
3254     pub fn execve(prog: *const c_char, argv: *const *const c_char,
3255                   envp: *const *const c_char)
3256                   -> ::c_int;
3257     pub fn execvp(c: *const c_char,
3258                   argv: *const *const c_char) -> ::c_int;
3259     pub fn fork() -> pid_t;
3260     pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
3261     pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
3262     pub fn getegid() -> gid_t;
3263     pub fn geteuid() -> uid_t;
3264     pub fn getgid() -> gid_t;
3265     pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t)
3266                      -> ::c_int;
3267     pub fn getlogin() -> *mut c_char;
3268     pub fn getopt(argc: ::c_int, argv: *const *mut c_char,
3269                   optstr: *const c_char) -> ::c_int;
3270     pub fn getpgid(pid: pid_t) -> pid_t;
3271     pub fn getpgrp() -> pid_t;
3272     pub fn getpid() -> pid_t;
3273     pub fn getppid() -> pid_t;
3274     pub fn getuid() -> uid_t;
3275     pub fn isatty(fd: ::c_int) -> ::c_int;
3276     pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
3277     pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
3278     pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
3279     pub fn pause() -> ::c_int;
3280     pub fn pipe(fds: *mut ::c_int) -> ::c_int;
3281     pub fn posix_memalign(memptr: *mut *mut ::c_void,
3282                       align: ::size_t,
3283                       size: ::size_t) -> ::c_int;
3284     pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
3285                 -> ::ssize_t;
3286     pub fn rmdir(path: *const c_char) -> ::c_int;
3287     pub fn seteuid(uid: uid_t) -> ::c_int;
3288     pub fn setgid(gid: gid_t) -> ::c_int;
3289     pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
3290     pub fn setsid() -> pid_t;
3291     pub fn setuid(uid: uid_t) -> ::c_int;
3292     pub fn sleep(secs: ::c_uint) -> ::c_uint;
3293     pub fn nanosleep(rqtp: *const timespec,
3294                      rmtp: *mut timespec) -> ::c_int;
3295     pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
3296     pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
3297     pub fn ttyname(fd: ::c_int) -> *mut c_char;
3298     pub fn unlink(c: *const c_char) -> ::c_int;
3299     pub fn wait(status: *mut ::c_int) -> pid_t;
3300     pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int)
3301                    -> pid_t;
3302     pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
3303                  -> ::ssize_t;
3304     pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
3305                  offset: off_t) -> ::ssize_t;
3306     pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
3307                   offset: off_t) -> ::ssize_t;
3308     pub fn umask(mask: mode_t) -> mode_t;
3309 
3310     pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
3311 
3312     pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
3313 
3314     pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
3315     pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
3316     pub fn mlockall(flags: ::c_int) -> ::c_int;
3317     pub fn munlockall() -> ::c_int;
3318 
3319     pub fn mmap(addr: *mut ::c_void,
3320                 len: ::size_t,
3321                 prot: ::c_int,
3322                 flags: ::c_int,
3323                 fd: ::c_int,
3324                 offset: off_t)
3325                 -> *mut ::c_void;
3326     pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
3327 
3328     pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
3329     pub fn if_indextoname(ifindex: ::c_uint,
3330                           ifname: *mut ::c_char) -> *mut ::c_char;
3331 
3332     pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
3333 
3334     pub fn fsync(fd: ::c_int) -> ::c_int;
3335 
3336     pub fn setenv(name: *const c_char, val: *const c_char,
3337                   overwrite: ::c_int) -> ::c_int;
3338     pub fn unsetenv(name: *const c_char) -> ::c_int;
3339 
3340     pub fn symlink(path1: *const c_char,
3341                    path2: *const c_char) -> ::c_int;
3342 
3343     pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
3344 
3345     pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
3346 
3347     pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int;
3348     pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int;
3349     pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
3350 
3351     pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
3352                     -> *mut ::c_char;
3353 
3354     pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
3355 
3356     pub fn gettimeofday(tp: *mut ::timeval,
3357                         tz: *mut ::c_void) -> ::c_int;
3358     pub fn times(buf: *mut ::tms) -> ::clock_t;
3359 
3360     pub fn pthread_self() -> ::pthread_t;
3361     pub fn pthread_join(native: ::pthread_t,
3362                         value: *mut *mut ::c_void) -> ::c_int;
3363     pub fn pthread_exit(value: *mut ::c_void);
3364     pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
3365     pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
3366     pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t,
3367                                      stack_size: ::size_t) -> ::c_int;
3368     pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t,
3369                                        state: ::c_int) -> ::c_int;
3370     pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
3371     pub fn sched_yield() -> ::c_int;
3372     pub fn pthread_key_create(key: *mut pthread_key_t,
3373                               dtor: Option<unsafe extern fn(*mut ::c_void)>)
3374                               -> ::c_int;
3375     pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
3376     pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
3377     pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void)
3378                                -> ::c_int;
3379     pub fn pthread_mutex_init(lock: *mut pthread_mutex_t,
3380                               attr: *const pthread_mutexattr_t) -> ::c_int;
3381     pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
3382     pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
3383     pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
3384     pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
3385 
3386     pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
3387     pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
3388     pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t,
3389                                      _type: ::c_int) -> ::c_int;
3390 
3391     pub fn pthread_cond_init(cond: *mut pthread_cond_t,
3392                              attr: *const pthread_condattr_t) -> ::c_int;
3393     pub fn pthread_cond_wait(cond: *mut pthread_cond_t,
3394                              lock: *mut pthread_mutex_t) -> ::c_int;
3395     pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t,
3396                               lock: *mut pthread_mutex_t,
3397                               abstime: *const ::timespec) -> ::c_int;
3398     pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
3399     pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
3400     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
3401     pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
3402     pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
3403     pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
3404                                attr: *const pthread_rwlockattr_t) -> ::c_int;
3405     pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
3406     pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3407     pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3408     pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3409     pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3410     pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3411     pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
3412     pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
3413                                       -> ::c_int;
3414     pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
3415                       buflen: ::size_t) -> ::c_int;
3416 
3417     pub fn getsockopt(sockfd: ::c_int,
3418                       level: ::c_int,
3419                       optname: ::c_int,
3420                       optval: *mut ::c_void,
3421                       optlen: *mut ::socklen_t) -> ::c_int;
3422     pub fn raise(signum: ::c_int) -> ::c_int;
3423     pub fn sigaction(signum: ::c_int,
3424                      act: *const sigaction,
3425                      oldact: *mut sigaction) -> ::c_int;
3426 
3427     pub fn utimes(filename: *const ::c_char,
3428                   times: *const ::timeval) -> ::c_int;
3429     pub fn dlopen(filename: *const ::c_char,
3430                   flag: ::c_int) -> *mut ::c_void;
3431     pub fn dlerror() -> *mut ::c_char;
3432     pub fn dlsym(handle: *mut ::c_void,
3433                  symbol: *const ::c_char) -> *mut ::c_void;
3434     pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
3435     pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
3436 
3437     pub fn getaddrinfo(node: *const c_char,
3438                        service: *const c_char,
3439                        hints: *const addrinfo,
3440                        res: *mut *mut addrinfo) -> ::c_int;
3441     pub fn freeaddrinfo(res: *mut addrinfo);
3442     pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
3443     pub fn res_init() -> ::c_int;
3444 
3445     pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
3446     pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
3447     pub fn mktime(tm: *mut tm) -> time_t;
3448     pub fn time(time: *mut time_t) -> time_t;
3449     pub fn gmtime(time_p: *const time_t) -> *mut tm;
3450     pub fn localtime(time_p: *const time_t) -> *mut tm;
3451 
3452     pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
3453                  dev: ::dev_t) -> ::c_int;
3454     pub fn uname(buf: *mut ::utsname) -> ::c_int;
3455     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
3456     pub fn getservbyname(name: *const ::c_char,
3457                          proto: *const ::c_char) -> *mut servent;
3458     pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
3459     pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
3460     pub fn chroot(name: *const ::c_char) -> ::c_int;
3461     pub fn usleep(secs: ::c_uint) -> ::c_int;
3462     pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
3463                 flags: ::c_int) -> ::ssize_t;
3464     pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
3465                 flags: ::c_int) -> ::ssize_t;
3466     pub fn putenv(string: *mut c_char) -> ::c_int;
3467     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
3468     pub fn select(nfds: ::c_int,
3469                   readfs: *mut fd_set,
3470                   writefds: *mut fd_set,
3471                   errorfds: *mut fd_set,
3472                   timeout: *mut timeval) -> ::c_int;
3473     pub fn setlocale(category: ::c_int,
3474                      locale: *const ::c_char) -> *mut ::c_char;
3475     pub fn localeconv() -> *mut lconv;
3476 
3477     pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
3478     pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
3479     pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
3480     pub fn sem_post(sem: *mut sem_t) -> ::c_int;
3481     pub fn sem_init(sem: *mut sem_t,
3482                     pshared: ::c_int,
3483                     value: ::c_uint)
3484                     -> ::c_int;
3485     pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
3486     pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
3487 
3488     pub fn readlink(path: *const c_char,
3489                     buf: *mut c_char,
3490                     bufsz: ::size_t)
3491                     -> ::ssize_t;
3492 
3493     pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
3494     pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
3495     pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
3496     pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
3497     pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
3498 
3499     pub fn sigprocmask(how: ::c_int,
3500                        set: *const sigset_t,
3501                        oldset: *mut sigset_t)
3502                        -> ::c_int;
3503     pub fn sigpending(set: *mut sigset_t) -> ::c_int;
3504 
3505     pub fn timegm(tm: *mut ::tm) -> time_t;
3506 
3507     pub fn getsid(pid: pid_t) -> pid_t;
3508 
3509     pub fn sysconf(name: ::c_int) -> ::c_long;
3510 
3511     pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
3512 
3513     pub fn pselect(nfds: ::c_int,
3514                    readfs: *mut fd_set,
3515                    writefds: *mut fd_set,
3516                    errorfds: *mut fd_set,
3517                    timeout: *const timespec,
3518                    sigmask: *const sigset_t) -> ::c_int;
3519     pub fn fseeko(stream: *mut ::FILE,
3520                   offset: ::off_t,
3521                   whence: ::c_int) -> ::c_int;
3522     pub fn ftello(stream: *mut ::FILE) -> ::off_t;
3523     pub fn tcdrain(fd: ::c_int) -> ::c_int;
3524     pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
3525     pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
3526     pub fn cfmakeraw(termios: *mut ::termios);
3527     pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
3528     pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
3529     pub fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
3530     pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
3531     pub fn tcsetattr(fd: ::c_int,
3532                      optional_actions: ::c_int,
3533                      termios: *const ::termios) -> ::c_int;
3534     pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
3535     pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
3536     pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
3537     pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
3538     pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
3539     pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
3540 
3541     pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
3542 
3543     pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
3544     pub fn closelog();
3545     pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
3546     pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
3547     pub fn nice(incr: ::c_int) -> ::c_int;
3548 
3549     pub fn grantpt(fd: ::c_int) -> ::c_int;
3550     pub fn posix_openpt(flags: ::c_int) -> ::c_int;
3551     pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
3552     pub fn unlockpt(fd: ::c_int) -> ::c_int;
3553 
3554     pub fn fdatasync(fd: ::c_int) -> ::c_int;
3555     pub fn mincore(addr: *mut ::c_void, len: ::size_t,
3556                    vec: *mut ::c_uchar) -> ::c_int;
3557     pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
3558     pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
3559     pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
3560     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
3561 
3562     pub fn pthread_getattr_np(native: ::pthread_t,
3563                               attr: *mut ::pthread_attr_t) -> ::c_int;
3564     pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
3565                                  stackaddr: *mut *mut ::c_void,
3566                                  stacksize: *mut ::size_t) -> ::c_int;
3567     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
3568     pub fn setgroups(ngroups: ::size_t,
3569                      ptr: *const ::gid_t) -> ::c_int;
3570     pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
3571     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
3572     pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int;
3573     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
3574     pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int;
3575     pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
3576     pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int;
3577     pub fn memrchr(cx: *const ::c_void,
3578                    c: ::c_int,
3579                    n: ::size_t) -> *mut ::c_void;
3580 
3581     pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
3582                          advise: ::c_int) -> ::c_int;
3583     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
3584     pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
3585                      times: *const ::timespec, flag: ::c_int) -> ::c_int;
3586     pub fn duplocale(base: ::locale_t) -> ::locale_t;
3587     pub fn freelocale(loc: ::locale_t);
3588     pub fn newlocale(mask: ::c_int,
3589                      locale: *const ::c_char,
3590                      base: ::locale_t) -> ::locale_t;
3591     pub fn uselocale(loc: ::locale_t) -> ::locale_t;
3592     pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
3593     pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
3594     pub fn fstatat64(dirfd: ::c_int, pathname: *const c_char,
3595                      buf: *mut stat64, flags: ::c_int) -> ::c_int;
3596     pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
3597     pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
3598     pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
3599     pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
3600     pub fn mmap64(addr: *mut ::c_void,
3601                   len: ::size_t,
3602                   prot: ::c_int,
3603                   flags: ::c_int,
3604                   fd: ::c_int,
3605                   offset: off64_t)
3606                   -> *mut ::c_void;
3607     pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
3608     pub fn openat64(fd: ::c_int,
3609                     path: *const c_char,
3610                     oflag: ::c_int, ...) -> ::c_int;
3611     pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
3612                    offset: off64_t) -> ::ssize_t;
3613     pub fn preadv64(fd: ::c_int,
3614                     iov: *const ::iovec,
3615                     iovcnt: ::c_int,
3616                     offset: ::off64_t) -> ::ssize_t;
3617     pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
3618                     offset: off64_t) -> ::ssize_t;
3619     pub fn pwritev64(fd: ::c_int,
3620                      iov: *const ::iovec,
3621                      iovcnt: ::c_int,
3622                      offset: ::off64_t) -> ::ssize_t;
3623     pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
3624     pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
3625                        result: *mut *mut ::dirent64) -> ::c_int;
3626     pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
3627     pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
3628     pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
3629 
3630     pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
3631 
3632     pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
3633                    mode: ::mode_t, dev: dev_t) -> ::c_int;
3634     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
3635                                      clock_id: *mut clockid_t) -> ::c_int;
3636     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
3637                                      clock_id: ::clockid_t) -> ::c_int;
3638     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
3639                                        pshared: ::c_int) -> ::c_int;
3640     pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
3641                    flg: ::c_int) -> ::c_int;
3642     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
3643                                         pshared: ::c_int) -> ::c_int;
3644     pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
3645                                          val: *mut ::c_int) -> ::c_int;
3646     pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
3647                                          val: ::c_int) -> ::c_int;
3648     pub fn ptsname_r(fd: ::c_int,
3649                      buf: *mut ::c_char,
3650                      buflen: ::size_t) -> ::c_int;
3651     pub fn clearenv() -> ::c_int;
3652     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
3653                   options: ::c_int) -> ::c_int;
3654     pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
3655     pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
3656     pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t,
3657                      suid: *mut ::uid_t) -> ::c_int;
3658     pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t,
3659                      sgid: *mut ::gid_t) -> ::c_int;
3660     pub fn acct(filename: *const ::c_char) -> ::c_int;
3661     pub fn brk(addr: *mut ::c_void) -> ::c_int;
3662     pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
3663     pub fn vfork() -> ::pid_t;
3664     pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
3665     pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
3666     pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
3667                  rusage: *mut ::rusage) -> ::pid_t;
3668     pub fn openpty(amaster: *mut ::c_int,
3669                 aslave: *mut ::c_int,
3670                 name: *mut ::c_char,
3671                 termp: *const termios,
3672                 winp: *const ::winsize) -> ::c_int;
3673     pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
3674                    envp: *const *const ::c_char) -> ::c_int;
3675     pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
3676                    envp: *const *const ::c_char)
3677                    -> ::c_int;
3678 
3679     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
3680     pub fn ptrace(request: ::c_int, ...) -> ::c_long;
3681     pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
3682     pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
3683 
3684     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
3685     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
3686     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
3687     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
3688     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
3689     pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
3690                        timeout: *const ::timespec) -> ::c_int;
3691     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
3692     pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
3693                       nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int;
3694 
3695     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
3696 
3697     pub fn setpwent();
3698     pub fn endpwent();
3699     pub fn getpwent() -> *mut passwd;
3700     pub fn setspent();
3701     pub fn endspent();
3702     pub fn getspent() -> *mut spwd;
3703     pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
3704 
3705     pub fn shm_open(name: *const c_char, oflag: ::c_int,
3706                     mode: mode_t) -> ::c_int;
3707 
3708     // System V IPC
3709     pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
3710     pub fn shmat(shmid: ::c_int,
3711                  shmaddr: *const ::c_void,
3712                  shmflg: ::c_int) -> *mut ::c_void;
3713     pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
3714     pub fn shmctl(shmid: ::c_int,
3715                   cmd: ::c_int,
3716                   buf: *mut ::shmid_ds) -> ::c_int;
3717     pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
3718     pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int;
3719     pub fn semop(semid: ::c_int,
3720                  sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int;
3721     pub fn semctl(semid: ::c_int,
3722                   semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
3723     pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
3724     pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
3725     pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
3726                   msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t;
3727     pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
3728                   msgflg: ::c_int) -> ::c_int;
3729 
3730     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
3731                     -> ::c_int;
3732     pub fn __errno_location() -> *mut ::c_int;
3733 
3734     pub fn fopen64(filename: *const c_char,
3735                    mode: *const c_char) -> *mut ::FILE;
3736     pub fn freopen64(filename: *const c_char, mode: *const c_char,
3737                      file: *mut ::FILE) -> *mut ::FILE;
3738     pub fn tmpfile64() -> *mut ::FILE;
3739     pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
3740     pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
3741     pub fn fseeko64(stream: *mut ::FILE,
3742                     offset: ::off64_t,
3743                     whence: ::c_int) -> ::c_int;
3744     pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
3745     pub fn fallocate(fd: ::c_int, mode: ::c_int,
3746                      offset: ::off_t, len: ::off_t) -> ::c_int;
3747     pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
3748                            len: ::off_t) -> ::c_int;
3749     pub fn readahead(fd: ::c_int, offset: ::off64_t,
3750                      count: ::size_t) -> ::ssize_t;
3751     pub fn getxattr(path: *const c_char, name: *const c_char,
3752                     value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
3753     pub fn lgetxattr(path: *const c_char, name: *const c_char,
3754                      value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
3755     pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
3756                      value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
3757     pub fn setxattr(path: *const c_char, name: *const c_char,
3758                     value: *const ::c_void, size: ::size_t,
3759                     flags: ::c_int) -> ::c_int;
3760     pub fn lsetxattr(path: *const c_char, name: *const c_char,
3761                      value: *const ::c_void, size: ::size_t,
3762                      flags: ::c_int) -> ::c_int;
3763     pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
3764                      value: *const ::c_void, size: ::size_t,
3765                      flags: ::c_int) -> ::c_int;
3766     pub fn listxattr(path: *const c_char, list: *mut c_char,
3767                      size: ::size_t) -> ::ssize_t;
3768     pub fn llistxattr(path: *const c_char, list: *mut c_char,
3769                       size: ::size_t) -> ::ssize_t;
3770     pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
3771                       size: ::size_t) -> ::ssize_t;
3772     pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
3773     pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
3774     pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
3775     pub fn signalfd(fd: ::c_int,
3776                     mask: *const ::sigset_t,
3777                     flags: ::c_int) -> ::c_int;
3778     pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int;
3779     pub fn timerfd_gettime(fd: ::c_int,
3780                            curr_value: *mut itimerspec) -> ::c_int;
3781     pub fn timerfd_settime(fd: ::c_int,
3782                            flags: ::c_int,
3783                            new_value: *const itimerspec,
3784                            old_value: *mut itimerspec) -> ::c_int;
3785     pub fn pwritev(fd: ::c_int,
3786                    iov: *const ::iovec,
3787                    iovcnt: ::c_int,
3788                    offset: ::off_t) -> ::ssize_t;
3789     pub fn preadv(fd: ::c_int,
3790                   iov: *const ::iovec,
3791                   iovcnt: ::c_int,
3792                   offset: ::off_t) -> ::ssize_t;
3793     pub fn quotactl(cmd: ::c_int,
3794                     special: *const ::c_char,
3795                     id: ::c_int,
3796                     data: *mut ::c_char) -> ::c_int;
3797     pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
3798     pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
3799     pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
3800     pub fn mq_receive(mqd: ::mqd_t,
3801                       msg_ptr: *mut ::c_char,
3802                       msg_len: ::size_t,
3803                       msq_prio: *mut ::c_uint) -> ::ssize_t;
3804     pub fn mq_send(mqd: ::mqd_t,
3805                    msg_ptr: *const ::c_char,
3806                    msg_len: ::size_t,
3807                    msq_prio: ::c_uint) -> ::c_int;
3808     pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
3809     pub fn mq_setattr(mqd: ::mqd_t,
3810                       newattr: *const ::mq_attr,
3811                       oldattr: *mut ::mq_attr) -> ::c_int;
3812     pub fn epoll_pwait(epfd: ::c_int,
3813                        events: *mut ::epoll_event,
3814                        maxevents: ::c_int,
3815                        timeout: ::c_int,
3816                        sigmask: *const ::sigset_t) -> ::c_int;
3817     pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
3818     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
3819     pub fn mkostemps(template: *mut ::c_char,
3820                      suffixlen: ::c_int,
3821                      flags: ::c_int) -> ::c_int;
3822     pub fn sigtimedwait(set: *const sigset_t,
3823                         info: *mut siginfo_t,
3824                         timeout: *const ::timespec) -> ::c_int;
3825     pub fn sigwaitinfo(set: *const sigset_t,
3826                        info: *mut siginfo_t) -> ::c_int;
3827     pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
3828     pub fn getnameinfo(sa: *const ::sockaddr,
3829                        salen: ::socklen_t,
3830                        host: *mut ::c_char,
3831                        hostlen: ::socklen_t,
3832                        serv: *mut ::c_char,
3833                        sevlen: ::socklen_t,
3834                        flags: ::c_int) -> ::c_int;
3835     pub fn pthread_setschedprio(native: ::pthread_t,
3836                                 priority: ::c_int) -> ::c_int;
3837     pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit,
3838                    old_limit: *mut ::rlimit) -> ::c_int;
3839     pub fn prlimit64(pid: ::pid_t,
3840                      resource: ::c_int,
3841                      new_limit: *const ::rlimit64,
3842                      old_limit: *mut ::rlimit64) -> ::c_int;
3843     pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
3844     pub fn process_vm_readv(pid: ::pid_t,
3845                             local_iov: *const ::iovec,
3846                             liovcnt: ::c_ulong,
3847                             remote_iov: *const ::iovec,
3848                             riovcnt: ::c_ulong,
3849                             flags: ::c_ulong) -> isize;
3850     pub fn process_vm_writev(pid: ::pid_t,
3851                              local_iov: *const ::iovec,
3852                              liovcnt: ::c_ulong,
3853                              remote_iov: *const ::iovec,
3854                              riovcnt: ::c_ulong,
3855                              flags: ::c_ulong) -> isize;
3856     pub fn reboot(how_to: ::c_int) -> ::c_int;
3857     pub fn setfsgid(gid: ::gid_t) -> ::c_int;
3858     pub fn setfsuid(uid: ::uid_t) -> ::c_int;
3859 
3860     // Not available now on Android
3861     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
3862                     mode: ::mode_t) -> ::c_int;
3863     pub fn if_nameindex() -> *mut if_nameindex;
3864     pub fn if_freenameindex(ptr: *mut if_nameindex);
3865     pub fn sync_file_range(fd: ::c_int, offset: ::off64_t,
3866                            nbytes: ::off64_t, flags: ::c_uint) -> ::c_int;
3867     pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
3868     pub fn freeifaddrs(ifa: *mut ::ifaddrs);
3869 
3870     pub fn mremap(addr: *mut ::c_void,
3871                   len: ::size_t,
3872                   new_len: ::size_t,
3873                   flags: ::c_int,
3874                   ...) -> *mut ::c_void;
3875 
3876     pub fn glob(pattern: *const c_char,
3877                 flags: ::c_int,
3878                 errfunc: Option<extern fn(epath: *const c_char,
3879                                           errno: ::c_int) -> ::c_int>,
3880                 pglob: *mut ::glob_t) -> ::c_int;
3881     pub fn globfree(pglob: *mut ::glob_t);
3882 
3883     pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
3884                          -> ::c_int;
3885 
3886     pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
3887 
3888     pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
3889 
3890     pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
3891     pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
3892                   -> ::c_int;
3893 
3894     pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
3895 
3896     pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
3897                     flags: ::c_int, addr: *mut ::sockaddr,
3898                     addrlen: *mut ::socklen_t) -> ::ssize_t;
3899     pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
3900     pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
3901     pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
3902 
3903     pub fn bind(socket: ::c_int, address: *const ::sockaddr,
3904                 address_len: ::socklen_t) -> ::c_int;
3905 
3906     pub fn writev(fd: ::c_int,
3907                   iov: *const ::iovec,
3908                   iovcnt: ::c_int) -> ::ssize_t;
3909     pub fn readv(fd: ::c_int,
3910                  iov: *const ::iovec,
3911                  iovcnt: ::c_int) -> ::ssize_t;
3912 
3913     pub fn sendmsg(fd: ::c_int,
3914                    msg: *const ::msghdr,
3915                    flags: ::c_int) -> ::ssize_t;
3916     pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
3917                    -> ::ssize_t;
3918     pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
3919     pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
3920     pub fn vhangup() -> ::c_int;
3921     pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
3922                     flags: ::c_int) -> ::c_int;
3923     pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
3924                     flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
3925     pub fn sync();
3926     pub fn syscall(num: ::c_long, ...) -> ::c_long;
3927     pub fn sched_getaffinity(pid: ::pid_t,
3928                              cpusetsize: ::size_t,
3929                              cpuset: *mut cpu_set_t) -> ::c_int;
3930     pub fn sched_setaffinity(pid: ::pid_t,
3931                              cpusetsize: ::size_t,
3932                              cpuset: *const cpu_set_t) -> ::c_int;
3933     pub fn epoll_create(size: ::c_int) -> ::c_int;
3934     pub fn epoll_create1(flags: ::c_int) -> ::c_int;
3935     pub fn epoll_wait(epfd: ::c_int,
3936                       events: *mut ::epoll_event,
3937                       maxevents: ::c_int,
3938                       timeout: ::c_int) -> ::c_int;
3939     pub fn epoll_ctl(epfd: ::c_int,
3940                      op: ::c_int,
3941                      fd: ::c_int,
3942                      event: *mut ::epoll_event) -> ::c_int;
3943     pub fn pthread_getschedparam(native: ::pthread_t,
3944                                  policy: *mut ::c_int,
3945                                  param: *mut ::sched_param) -> ::c_int;
3946     pub fn unshare(flags: ::c_int) -> ::c_int;
3947     pub fn umount(target: *const ::c_char) -> ::c_int;
3948     pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
3949     pub fn tee(fd_in: ::c_int,
3950                fd_out: ::c_int,
3951                len: ::size_t,
3952                flags: ::c_uint) -> ::ssize_t;
3953     pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
3954     pub fn splice(fd_in: ::c_int,
3955                   off_in: *mut ::loff_t,
3956                   fd_out: ::c_int,
3957                   off_out: *mut ::loff_t,
3958                   len: ::size_t,
3959                   flags: ::c_uint) -> ::ssize_t;
3960     pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
3961     pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
3962     pub fn sem_timedwait(sem: *mut sem_t,
3963                          abstime: *const ::timespec) -> ::c_int;
3964     pub fn sem_getvalue(sem: *mut sem_t,
3965                         sval: *mut ::c_int) -> ::c_int;
3966     pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
3967     pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
3968     pub fn swapoff(puath: *const ::c_char) -> ::c_int;
3969     pub fn vmsplice(fd: ::c_int,
3970                     iov: *const ::iovec,
3971                     nr_segs: ::size_t,
3972                     flags: ::c_uint) -> ::ssize_t;
3973     pub fn mount(src: *const ::c_char,
3974                  target: *const ::c_char,
3975                  fstype: *const ::c_char,
3976                  flags: ::c_ulong,
3977                  data: *const ::c_void) -> ::c_int;
3978     pub fn personality(persona: ::c_ulong) -> ::c_int;
3979     pub fn prctl(option: ::c_int, ...) -> ::c_int;
3980     pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
3981     pub fn ppoll(fds: *mut ::pollfd,
3982                  nfds: nfds_t,
3983                  timeout: *const ::timespec,
3984                  sigmask: *const sigset_t) -> ::c_int;
3985     pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
3986                                    abstime: *const ::timespec) -> ::c_int;
3987     pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
3988                  child_stack: *mut ::c_void,
3989                  flags: ::c_int,
3990                  arg: *mut ::c_void, ...) -> ::c_int;
3991     pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
3992     pub fn clock_nanosleep(clk_id: ::clockid_t,
3993                            flags: ::c_int,
3994                            rqtp: *const ::timespec,
3995                            rmtp:  *mut ::timespec) -> ::c_int;
3996     pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
3997                                      guardsize: *mut ::size_t) -> ::c_int;
3998     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
3999     pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
4000     pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
4001                                        pshared: *mut ::c_int) -> ::c_int;
4002     pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int;
4003     pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
4004     pub fn pthread_setschedparam(native: ::pthread_t,
4005                                  policy: ::c_int,
4006                                  param: *const ::sched_param) -> ::c_int;
4007     pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
4008     pub fn sched_setscheduler(pid: ::pid_t,
4009                               policy: ::c_int,
4010                               param: *const ::sched_param) -> ::c_int;
4011     pub fn sendfile(out_fd: ::c_int,
4012                     in_fd: ::c_int,
4013                     offset: *mut off_t,
4014                     count: ::size_t) -> ::ssize_t;
4015     pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
4016     pub fn getgrgid_r(uid: ::uid_t,
4017                       grp: *mut ::group,
4018                       buf: *mut ::c_char,
4019                       buflen: ::size_t,
4020                       result: *mut *mut ::group) -> ::c_int;
4021     pub fn sigaltstack(ss: *const stack_t,
4022                        oss: *mut stack_t) -> ::c_int;
4023     pub fn sem_close(sem: *mut sem_t) -> ::c_int;
4024     pub fn getdtablesize() -> ::c_int;
4025     pub fn getgrnam_r(name: *const ::c_char,
4026                       grp: *mut ::group,
4027                       buf: *mut ::c_char,
4028                       buflen: ::size_t,
4029                       result: *mut *mut ::group) -> ::c_int;
4030     pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
4031     pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
4032                            oldset: *mut sigset_t) -> ::c_int;
4033     pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
4034     pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
4035     pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
4036     pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
4037     pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
4038     pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
4039     pub fn getpwnam_r(name: *const ::c_char,
4040                       pwd: *mut passwd,
4041                       buf: *mut ::c_char,
4042                       buflen: ::size_t,
4043                       result: *mut *mut passwd) -> ::c_int;
4044     pub fn getpwuid_r(uid: ::uid_t,
4045                       pwd: *mut passwd,
4046                       buf: *mut ::c_char,
4047                       buflen: ::size_t,
4048                       result: *mut *mut passwd) -> ::c_int;
4049     pub fn sigwait(set: *const sigset_t,
4050                    sig: *mut ::c_int) -> ::c_int;
4051     pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
4052                           parent: Option<unsafe extern fn()>,
4053                           child: Option<unsafe extern fn()>) -> ::c_int;
4054     pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
4055     pub fn getgrouplist(user: *const ::c_char,
4056                         group: ::gid_t,
4057                         groups: *mut ::gid_t,
4058                         ngroups: *mut ::c_int) -> ::c_int;
4059     pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
4060                                         pshared: *mut ::c_int) -> ::c_int;
4061     pub fn popen(command: *const c_char,
4062                  mode: *const c_char) -> *mut ::FILE;
4063     pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
4064                      mode: ::c_int, flags: ::c_int) -> ::c_int;
4065     pub fn pthread_create(native: *mut ::pthread_t,
4066                           attr: *const ::pthread_attr_t,
4067                           f: extern fn(*mut ::c_void) -> *mut ::c_void,
4068                           value: *mut ::c_void) -> ::c_int;
4069     pub fn dl_iterate_phdr(
4070         callback: Option<unsafe extern fn(
4071             info: *mut ::dl_phdr_info,
4072             size: ::size_t,
4073             data: *mut ::c_void
4074         ) -> ::c_int>,
4075         data: *mut ::c_void
4076     ) -> ::c_int;
4077 }
4078 
4079 cfg_if! {
4080     if #[cfg(target_arch = "aarch64")] {
4081         mod aarch64;
4082         pub use self::aarch64::*;
4083     } else if #[cfg(any(target_arch = "x86_64"))] {
4084         mod x86_64;
4085         pub use self::x86_64::*;
4086     } else {
4087         // Unknown target_arch
4088     }
4089 }
4090 
4091 cfg_if! {
4092     if #[cfg(core_cvoid)] {
4093         pub use core::ffi::c_void;
4094     } else {
4095         // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
4096         // enable more optimization opportunities around it recognizing things
4097         // like malloc/free.
4098         #[repr(u8)]
4099         pub enum c_void {
4100             // Two dummy variants so the #[repr] attribute can be used.
4101             #[doc(hidden)]
4102             __variant1,
4103             #[doc(hidden)]
4104             __variant2,
4105         }
4106     }
4107 }
4108