1 pub type sa_family_t = u16;
2 pub type pthread_key_t = ::c_uint;
3 pub type speed_t = ::c_uint;
4 pub type tcflag_t = ::c_uint;
5 pub type loff_t = ::c_longlong;
6 pub type clockid_t = ::c_int;
7 pub type key_t = ::c_int;
8 pub type id_t = ::c_uint;
9 pub type useconds_t = u32;
10 pub type dev_t = u64;
11 pub type socklen_t = u32;
12 pub type mode_t = u32;
13 pub type ino64_t = u64;
14 pub type off64_t = i64;
15 pub type blkcnt64_t = i64;
16 pub type rlim64_t = u64;
17 pub type shmatt_t = ::c_ulong;
18 pub type mqd_t = ::c_int;
19 pub type msgqnum_t = ::c_ulong;
20 pub type msglen_t = ::c_ulong;
21 pub type nfds_t = ::c_ulong;
22 pub type nl_item = ::c_int;
23 pub type idtype_t = ::c_uint;
24 
25 #[cfg_attr(feature = "extra_traits", derive(Debug))]
26 pub enum fpos64_t {} // TODO: fill this out with a struct
27 impl ::Copy for fpos64_t {}
28 impl ::Clone for fpos64_t {
clone(&self) -> fpos64_t29     fn clone(&self) -> fpos64_t { *self }
30 }
31 
32 #[cfg_attr(feature = "extra_traits", derive(Debug))]
33 pub enum timezone {}
34 impl ::Copy for timezone {}
35 impl ::Clone for timezone {
clone(&self) -> timezone36     fn clone(&self) -> timezone { *self }
37 }
38 
39 s! {
40     pub struct in_addr {
41         pub s_addr: ::in_addr_t,
42     }
43 
44     pub struct ip_mreq {
45         pub imr_multiaddr: in_addr,
46         pub imr_interface: in_addr,
47     }
48 
49     pub struct sockaddr {
50         pub sa_family: sa_family_t,
51         pub sa_data: [::c_char; 14],
52     }
53 
54     pub struct sockaddr_in {
55         pub sin_family: sa_family_t,
56         pub sin_port: ::in_port_t,
57         pub sin_addr: ::in_addr,
58         pub sin_zero: [u8; 8],
59     }
60 
61     pub struct sockaddr_in6 {
62         pub sin6_family: sa_family_t,
63         pub sin6_port: ::in_port_t,
64         pub sin6_flowinfo: u32,
65         pub sin6_addr: ::in6_addr,
66         pub sin6_scope_id: u32,
67     }
68 
69     pub struct sockaddr_un {
70         pub sun_family: sa_family_t,
71         pub sun_path: [::c_char; 108]
72     }
73 
74     pub struct sockaddr_storage {
75         pub ss_family: sa_family_t,
76         __ss_align: ::size_t,
77         #[cfg(target_pointer_width = "32")]
78         __ss_pad2: [u8; 128 - 2 * 4],
79         #[cfg(target_pointer_width = "64")]
80         __ss_pad2: [u8; 128 - 2 * 8],
81     }
82 
83     pub struct addrinfo {
84         pub ai_flags: ::c_int,
85         pub ai_family: ::c_int,
86         pub ai_socktype: ::c_int,
87         pub ai_protocol: ::c_int,
88         pub ai_addrlen: socklen_t,
89 
90         pub ai_addr: *mut ::sockaddr,
91 
92         pub ai_canonname: *mut c_char,
93 
94         pub ai_next: *mut addrinfo,
95     }
96 
97     pub struct sockaddr_nl {
98         pub nl_family: ::sa_family_t,
99         nl_pad: ::c_ushort,
100         pub nl_pid: u32,
101         pub nl_groups: u32
102     }
103 
104     pub struct sockaddr_ll {
105         pub sll_family: ::c_ushort,
106         pub sll_protocol: ::c_ushort,
107         pub sll_ifindex: ::c_int,
108         pub sll_hatype: ::c_ushort,
109         pub sll_pkttype: ::c_uchar,
110         pub sll_halen: ::c_uchar,
111         pub sll_addr: [::c_uchar; 8]
112     }
113 
114     pub struct fd_set {
115         fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
116     }
117 
118     pub struct tm {
119         pub tm_sec: ::c_int,
120         pub tm_min: ::c_int,
121         pub tm_hour: ::c_int,
122         pub tm_mday: ::c_int,
123         pub tm_mon: ::c_int,
124         pub tm_year: ::c_int,
125         pub tm_wday: ::c_int,
126         pub tm_yday: ::c_int,
127         pub tm_isdst: ::c_int,
128         pub tm_gmtoff: ::c_long,
129         pub tm_zone: *const ::c_char,
130     }
131 
132     pub struct sched_param {
133         pub sched_priority: ::c_int,
134     }
135 
136     pub struct Dl_info {
137         pub dli_fname: *const ::c_char,
138         pub dli_fbase: *mut ::c_void,
139         pub dli_sname: *const ::c_char,
140         pub dli_saddr: *mut ::c_void,
141     }
142 
143     pub struct utsname {
144         pub sysname: [::c_char; 65],
145         pub nodename: [::c_char; 65],
146         pub release: [::c_char; 65],
147         pub version: [::c_char; 65],
148         pub machine: [::c_char; 65],
149         pub domainname: [::c_char; 65]
150     }
151 
152     pub struct lconv {
153         pub decimal_point: *mut ::c_char,
154         pub thousands_sep: *mut ::c_char,
155         pub grouping: *mut ::c_char,
156         pub int_curr_symbol: *mut ::c_char,
157         pub currency_symbol: *mut ::c_char,
158         pub mon_decimal_point: *mut ::c_char,
159         pub mon_thousands_sep: *mut ::c_char,
160         pub mon_grouping: *mut ::c_char,
161         pub positive_sign: *mut ::c_char,
162         pub negative_sign: *mut ::c_char,
163         pub int_frac_digits: ::c_char,
164         pub frac_digits: ::c_char,
165         pub p_cs_precedes: ::c_char,
166         pub p_sep_by_space: ::c_char,
167         pub n_cs_precedes: ::c_char,
168         pub n_sep_by_space: ::c_char,
169         pub p_sign_posn: ::c_char,
170         pub n_sign_posn: ::c_char,
171         pub int_p_cs_precedes: ::c_char,
172         pub int_p_sep_by_space: ::c_char,
173         pub int_n_cs_precedes: ::c_char,
174         pub int_n_sep_by_space: ::c_char,
175         pub int_p_sign_posn: ::c_char,
176         pub int_n_sign_posn: ::c_char,
177     }
178 
179     pub struct sigevent {
180         pub sigev_value: ::sigval,
181         pub sigev_signo: ::c_int,
182         pub sigev_notify: ::c_int,
183         // Actually a union.  We only expose sigev_notify_thread_id because it's
184         // the most useful member
185         pub sigev_notify_thread_id: ::c_int,
186         #[cfg(target_pointer_width = "64")]
187         __unused1: [::c_int; 11],
188         #[cfg(target_pointer_width = "32")]
189         __unused1: [::c_int; 12]
190     }
191 
192     pub struct dirent {
193         pub d_ino: ::ino_t,
194         pub d_off: ::off_t,
195         pub d_reclen: ::c_ushort,
196         pub d_type: ::c_uchar,
197         pub d_name: [::c_char; 256],
198     }
199 
200     pub struct dirent64 {
201         pub d_ino: ::ino64_t,
202         pub d_off: ::off64_t,
203         pub d_reclen: ::c_ushort,
204         pub d_type: ::c_uchar,
205         pub d_name: [::c_char; 256],
206     }
207 
208     pub struct rlimit64 {
209         pub rlim_cur: rlim64_t,
210         pub rlim_max: rlim64_t,
211     }
212 
213     pub struct glob_t {
214         pub gl_pathc: ::size_t,
215         pub gl_pathv: *mut *mut c_char,
216         pub gl_offs: ::size_t,
217         pub gl_flags: ::c_int,
218 
219         __unused1: *mut ::c_void,
220         __unused2: *mut ::c_void,
221         __unused3: *mut ::c_void,
222         __unused4: *mut ::c_void,
223         __unused5: *mut ::c_void,
224     }
225 
226     pub struct ifaddrs {
227         pub ifa_next: *mut ifaddrs,
228         pub ifa_name: *mut c_char,
229         pub ifa_flags: ::c_uint,
230         pub ifa_addr: *mut ::sockaddr,
231         pub ifa_netmask: *mut ::sockaddr,
232         pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
233         pub ifa_data: *mut ::c_void
234     }
235 
236     pub struct pthread_rwlockattr_t {
237         __lockkind: ::c_int,
238         __pshared: ::c_int,
239     }
240 
241     pub struct passwd {
242         pub pw_name: *mut ::c_char,
243         pub pw_passwd: *mut ::c_char,
244         pub pw_uid: ::uid_t,
245         pub pw_gid: ::gid_t,
246         pub pw_gecos: *mut ::c_char,
247         pub pw_dir: *mut ::c_char,
248         pub pw_shell: *mut ::c_char,
249     }
250 
251     pub struct spwd {
252         pub sp_namp: *mut ::c_char,
253         pub sp_pwdp: *mut ::c_char,
254         pub sp_lstchg: ::c_long,
255         pub sp_min: ::c_long,
256         pub sp_max: ::c_long,
257         pub sp_warn: ::c_long,
258         pub sp_inact: ::c_long,
259         pub sp_expire: ::c_long,
260         pub sp_flag: ::c_ulong,
261     }
262 
263     pub struct statvfs {
264         pub f_bsize: ::c_ulong,
265         pub f_frsize: ::c_ulong,
266         pub f_blocks: ::fsblkcnt_t,
267         pub f_bfree: ::fsblkcnt_t,
268         pub f_bavail: ::fsblkcnt_t,
269         pub f_files: ::fsfilcnt_t,
270         pub f_ffree: ::fsfilcnt_t,
271         pub f_favail: ::fsfilcnt_t,
272         #[cfg(target_endian = "little")]
273         pub f_fsid: ::c_ulong,
274         #[cfg(target_pointer_width = "32")]
275         __f_unused: ::c_int,
276         #[cfg(target_endian = "big")]
277         pub f_fsid: ::c_ulong,
278         pub f_flag: ::c_ulong,
279         pub f_namemax: ::c_ulong,
280         __f_spare: [::c_int; 6],
281     }
282 
283     pub struct dqblk {
284         pub dqb_bhardlimit: ::uint32_t,
285         pub dqb_bsoftlimit: ::uint32_t,
286         pub dqb_curblocks: ::uint32_t,
287         pub dqb_ihardlimit: ::uint32_t,
288         pub dqb_isoftlimit: ::uint32_t,
289         pub dqb_curinodes: ::uint32_t,
290         pub dqb_btime: ::time_t,
291         pub dqb_itime: ::time_t,
292     }
293 
294     pub struct signalfd_siginfo {
295         pub ssi_signo: ::uint32_t,
296         pub ssi_errno: ::int32_t,
297         pub ssi_code: ::int32_t,
298         pub ssi_pid: ::uint32_t,
299         pub ssi_uid: ::uint32_t,
300         pub ssi_fd: ::int32_t,
301         pub ssi_tid: ::uint32_t,
302         pub ssi_band: ::uint32_t,
303         pub ssi_overrun: ::uint32_t,
304         pub ssi_trapno: ::uint32_t,
305         pub ssi_status: ::int32_t,
306         pub ssi_int: ::int32_t,
307         pub ssi_ptr: ::uint64_t,
308         pub ssi_utime: ::uint64_t,
309         pub ssi_stime: ::uint64_t,
310         pub ssi_addr: ::uint64_t,
311         pub ssi_addr_lsb: ::uint16_t,
312         _pad2: ::uint16_t,
313         pub ssi_syscall: ::int32_t,
314         pub ssi_call_addr: ::uint64_t,
315         pub ssi_arch: ::uint32_t,
316         _pad: [::uint8_t; 28],
317     }
318 
319     pub struct fsid_t {
320         __val: [::c_int; 2],
321     }
322 
323     pub struct mq_attr {
324         pub mq_flags: ::c_long,
325         pub mq_maxmsg: ::c_long,
326         pub mq_msgsize: ::c_long,
327         pub mq_curmsgs: ::c_long,
328         pad: [::c_long; 4]
329     }
330 
331     pub struct cpu_set_t {
332         #[cfg(target_pointer_width = "32")]
333         bits: [u32; 32],
334         #[cfg(target_pointer_width = "64")]
335         bits: [u64; 16],
336     }
337 
338     pub struct if_nameindex {
339         pub if_index: ::c_uint,
340         pub if_name: *mut ::c_char,
341     }
342 
343     // System V IPC
344     pub struct msginfo {
345         pub msgpool: ::c_int,
346         pub msgmap: ::c_int,
347         pub msgmax: ::c_int,
348         pub msgmnb: ::c_int,
349         pub msgmni: ::c_int,
350         pub msgssz: ::c_int,
351         pub msgtql: ::c_int,
352         pub msgseg: ::c_ushort,
353     }
354 }
355 
356 s_no_extra_traits! {
357     #[cfg_attr(
358         any(target_arch = "x86", target_arch = "x86_64"),
359         repr(packed)
360     )]
361     pub struct epoll_event {
362         pub events: ::uint32_t,
363         pub u64: ::uint64_t,
364     }
365 }
366 
367 // intentionally not public, only used for fd_set
368 cfg_if! {
369     if #[cfg(target_pointer_width = "32")] {
370         const ULONG_SIZE: usize = 32;
371     } else if #[cfg(target_pointer_width = "64")] {
372         const ULONG_SIZE: usize = 64;
373     } else {
374         // Unknown target_pointer_width
375     }
376 }
377 
378 pub const EXIT_FAILURE: ::c_int = 1;
379 pub const EXIT_SUCCESS: ::c_int = 0;
380 pub const RAND_MAX: ::c_int = 2147483647;
381 pub const EOF: ::c_int = -1;
382 pub const SEEK_SET: ::c_int = 0;
383 pub const SEEK_CUR: ::c_int = 1;
384 pub const SEEK_END: ::c_int = 2;
385 pub const _IOFBF: ::c_int = 0;
386 pub const _IONBF: ::c_int = 2;
387 pub const _IOLBF: ::c_int = 1;
388 
389 pub const F_DUPFD: ::c_int = 0;
390 pub const F_GETFD: ::c_int = 1;
391 pub const F_SETFD: ::c_int = 2;
392 pub const F_GETFL: ::c_int = 3;
393 pub const F_SETFL: ::c_int = 4;
394 
395 // Linux-specific fcntls
396 pub const F_SETLEASE: ::c_int = 1024;
397 pub const F_GETLEASE: ::c_int = 1025;
398 pub const F_NOTIFY: ::c_int = 1026;
399 pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
400 
401 // TODO(#235): Include file sealing fcntls once we have a way to verify them.
402 
403 pub const SIGTRAP: ::c_int = 5;
404 
405 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
406 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
407 
408 pub const CLOCK_REALTIME: ::clockid_t = 0;
409 pub const CLOCK_MONOTONIC: ::clockid_t = 1;
410 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
411 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
412 // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
413 // 2014.) See also musl/mod.rs
414 // pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
415 // pub const CLOCK_TAI: ::clockid_t = 11;
416 pub const TIMER_ABSTIME: ::c_int = 1;
417 
418 pub const RLIMIT_CPU: ::c_int = 0;
419 pub const RLIMIT_FSIZE: ::c_int = 1;
420 pub const RLIMIT_DATA: ::c_int = 2;
421 pub const RLIMIT_STACK: ::c_int = 3;
422 pub const RLIMIT_CORE: ::c_int = 4;
423 pub const RLIMIT_LOCKS: ::c_int = 10;
424 pub const RLIMIT_SIGPENDING: ::c_int = 11;
425 pub const RLIMIT_MSGQUEUE: ::c_int = 12;
426 pub const RLIMIT_NICE: ::c_int = 13;
427 pub const RLIMIT_RTPRIO: ::c_int = 14;
428 
429 pub const RUSAGE_SELF: ::c_int = 0;
430 
431 pub const O_RDONLY: ::c_int = 0;
432 pub const O_WRONLY: ::c_int = 1;
433 pub const O_RDWR: ::c_int = 2;
434 
435 pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
436 
437 pub const S_IFIFO: ::mode_t = 4096;
438 pub const S_IFCHR: ::mode_t = 8192;
439 pub const S_IFBLK: ::mode_t = 24576;
440 pub const S_IFDIR: ::mode_t = 16384;
441 pub const S_IFREG: ::mode_t = 32768;
442 pub const S_IFLNK: ::mode_t = 40960;
443 pub const S_IFSOCK: ::mode_t = 49152;
444 pub const S_IFMT: ::mode_t = 61440;
445 pub const S_IRWXU: ::mode_t = 448;
446 pub const S_IXUSR: ::mode_t = 64;
447 pub const S_IWUSR: ::mode_t = 128;
448 pub const S_IRUSR: ::mode_t = 256;
449 pub const S_IRWXG: ::mode_t = 56;
450 pub const S_IXGRP: ::mode_t = 8;
451 pub const S_IWGRP: ::mode_t = 16;
452 pub const S_IRGRP: ::mode_t = 32;
453 pub const S_IRWXO: ::mode_t = 7;
454 pub const S_IXOTH: ::mode_t = 1;
455 pub const S_IWOTH: ::mode_t = 2;
456 pub const S_IROTH: ::mode_t = 4;
457 pub const F_OK: ::c_int = 0;
458 pub const R_OK: ::c_int = 4;
459 pub const W_OK: ::c_int = 2;
460 pub const X_OK: ::c_int = 1;
461 pub const STDIN_FILENO: ::c_int = 0;
462 pub const STDOUT_FILENO: ::c_int = 1;
463 pub const STDERR_FILENO: ::c_int = 2;
464 pub const SIGHUP: ::c_int = 1;
465 pub const SIGINT: ::c_int = 2;
466 pub const SIGQUIT: ::c_int = 3;
467 pub const SIGILL: ::c_int = 4;
468 pub const SIGABRT: ::c_int = 6;
469 pub const SIGFPE: ::c_int = 8;
470 pub const SIGKILL: ::c_int = 9;
471 pub const SIGSEGV: ::c_int = 11;
472 pub const SIGPIPE: ::c_int = 13;
473 pub const SIGALRM: ::c_int = 14;
474 pub const SIGTERM: ::c_int = 15;
475 
476 pub const PROT_NONE: ::c_int = 0;
477 pub const PROT_READ: ::c_int = 1;
478 pub const PROT_WRITE: ::c_int = 2;
479 pub const PROT_EXEC: ::c_int = 4;
480 
481 pub const LC_CTYPE: ::c_int = 0;
482 pub const LC_NUMERIC: ::c_int = 1;
483 pub const LC_MONETARY: ::c_int = 2;
484 pub const LC_TIME: ::c_int = 3;
485 pub const LC_COLLATE: ::c_int = 4;
486 pub const LC_MESSAGES: ::c_int = 5;
487 pub const LC_ALL: ::c_int = 6;
488 pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
489 pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
490 pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
491 pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
492 pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
493 pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
494 // LC_ALL_MASK defined per platform
495 
496 pub const MAP_FILE: ::c_int = 0x0000;
497 pub const MAP_SHARED: ::c_int = 0x0001;
498 pub const MAP_PRIVATE: ::c_int = 0x0002;
499 pub const MAP_FIXED: ::c_int = 0x0010;
500 
501 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
502 
503 // MS_ flags for msync(2)
504 pub const MS_ASYNC: ::c_int = 0x0001;
505 pub const MS_INVALIDATE: ::c_int = 0x0002;
506 pub const MS_SYNC: ::c_int = 0x0004;
507 
508 // MS_ flags for mount(2)
509 pub const MS_RDONLY: ::c_ulong = 0x01;
510 pub const MS_NOSUID: ::c_ulong = 0x02;
511 pub const MS_NODEV: ::c_ulong = 0x04;
512 pub const MS_NOEXEC: ::c_ulong = 0x08;
513 pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
514 pub const MS_REMOUNT: ::c_ulong = 0x20;
515 pub const MS_MANDLOCK: ::c_ulong = 0x40;
516 pub const MS_NOATIME: ::c_ulong = 0x0400;
517 pub const MS_NODIRATIME: ::c_ulong = 0x0800;
518 pub const MS_BIND: ::c_ulong = 0x1000;
519 pub const MS_NOUSER: ::c_ulong = 0x80000000;
520 pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
521 pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
522 pub const MS_RMT_MASK: ::c_ulong = 0x800051;
523 
524 pub const EPERM: ::c_int = 1;
525 pub const ENOENT: ::c_int = 2;
526 pub const ESRCH: ::c_int = 3;
527 pub const EINTR: ::c_int = 4;
528 pub const EIO: ::c_int = 5;
529 pub const ENXIO: ::c_int = 6;
530 pub const E2BIG: ::c_int = 7;
531 pub const ENOEXEC: ::c_int = 8;
532 pub const EBADF: ::c_int = 9;
533 pub const ECHILD: ::c_int = 10;
534 pub const EAGAIN: ::c_int = 11;
535 pub const ENOMEM: ::c_int = 12;
536 pub const EACCES: ::c_int = 13;
537 pub const EFAULT: ::c_int = 14;
538 pub const ENOTBLK: ::c_int = 15;
539 pub const EBUSY: ::c_int = 16;
540 pub const EEXIST: ::c_int = 17;
541 pub const EXDEV: ::c_int = 18;
542 pub const ENODEV: ::c_int = 19;
543 pub const ENOTDIR: ::c_int = 20;
544 pub const EISDIR: ::c_int = 21;
545 pub const EINVAL: ::c_int = 22;
546 pub const ENFILE: ::c_int = 23;
547 pub const EMFILE: ::c_int = 24;
548 pub const ENOTTY: ::c_int = 25;
549 pub const ETXTBSY: ::c_int = 26;
550 pub const EFBIG: ::c_int = 27;
551 pub const ENOSPC: ::c_int = 28;
552 pub const ESPIPE: ::c_int = 29;
553 pub const EROFS: ::c_int = 30;
554 pub const EMLINK: ::c_int = 31;
555 pub const EPIPE: ::c_int = 32;
556 pub const EDOM: ::c_int = 33;
557 pub const ERANGE: ::c_int = 34;
558 pub const EWOULDBLOCK: ::c_int = EAGAIN;
559 
560 pub const SCM_RIGHTS: ::c_int = 0x01;
561 pub const SCM_CREDENTIALS: ::c_int = 0x02;
562 
563 // netinet/in.h
564 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
565 
566 // IPPROTO_IP defined in src/unix/mod.rs
567 /// Hop-by-hop option header
568 pub const IPPROTO_HOPOPTS: ::c_int = 0;
569 // IPPROTO_ICMP defined in src/unix/mod.rs
570 /// group mgmt protocol
571 pub const IPPROTO_IGMP: ::c_int = 2;
572 /// for compatibility
573 pub const IPPROTO_IPIP: ::c_int = 4;
574 // IPPROTO_TCP defined in src/unix/mod.rs
575 /// exterior gateway protocol
576 pub const IPPROTO_EGP: ::c_int = 8;
577 /// pup
578 pub const IPPROTO_PUP: ::c_int = 12;
579 // IPPROTO_UDP defined in src/unix/mod.rs
580 /// xns idp
581 pub const IPPROTO_IDP: ::c_int = 22;
582 /// tp-4 w/ class negotiation
583 pub const IPPROTO_TP: ::c_int = 29;
584 /// DCCP
585 pub const IPPROTO_DCCP: ::c_int = 33;
586 // IPPROTO_IPV6 defined in src/unix/mod.rs
587 /// IP6 routing header
588 pub const IPPROTO_ROUTING: ::c_int = 43;
589 /// IP6 fragmentation header
590 pub const IPPROTO_FRAGMENT: ::c_int = 44;
591 /// resource reservation
592 pub const IPPROTO_RSVP: ::c_int = 46;
593 /// General Routing Encap.
594 pub const IPPROTO_GRE: ::c_int = 47;
595 /// IP6 Encap Sec. Payload
596 pub const IPPROTO_ESP: ::c_int = 50;
597 /// IP6 Auth Header
598 pub const IPPROTO_AH: ::c_int = 51;
599 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
600 /// IP6 no next header
601 pub const IPPROTO_NONE: ::c_int = 59;
602 /// IP6 destination option
603 pub const IPPROTO_DSTOPTS: ::c_int = 60;
604 pub const IPPROTO_MTP: ::c_int = 92;
605 pub const IPPROTO_BEETPH: ::c_int = 94;
606 /// encapsulation header
607 pub const IPPROTO_ENCAP: ::c_int = 98;
608 /// Protocol indep. multicast
609 pub const IPPROTO_PIM: ::c_int = 103;
610 /// IP Payload Comp. Protocol
611 pub const IPPROTO_COMP: ::c_int = 108;
612 /// SCTP
613 pub const IPPROTO_SCTP: ::c_int = 132;
614 pub const IPPROTO_MH: ::c_int = 135;
615 pub const IPPROTO_UDPLITE: ::c_int = 136;
616 pub const IPPROTO_MPLS: ::c_int = 137;
617 /// raw IP packet
618 pub const IPPROTO_RAW: ::c_int = 255;
619 pub const IPPROTO_MAX: ::c_int = 256;
620 
621 pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
622 pub const PROT_GROWSUP: ::c_int = 0x2000000;
623 
624 pub const MAP_TYPE: ::c_int = 0x000f;
625 
626 pub const MADV_NORMAL: ::c_int = 0;
627 pub const MADV_RANDOM: ::c_int = 1;
628 pub const MADV_SEQUENTIAL: ::c_int = 2;
629 pub const MADV_WILLNEED: ::c_int = 3;
630 pub const MADV_DONTNEED: ::c_int = 4;
631 pub const MADV_REMOVE: ::c_int = 9;
632 pub const MADV_DONTFORK: ::c_int = 10;
633 pub const MADV_DOFORK: ::c_int = 11;
634 pub const MADV_MERGEABLE: ::c_int = 12;
635 pub const MADV_UNMERGEABLE: ::c_int = 13;
636 pub const MADV_HWPOISON: ::c_int = 100;
637 
638 // https://github.com/kraj/uClibc/blob/master/include/net/if.h#L44
639 pub const IFF_UP: ::c_int = 0x1; // Interface is up.
640 pub const IFF_BROADCAST: ::c_int = 0x2; // Broadcast address valid.
641 pub const IFF_DEBUG: ::c_int = 0x4; // Turn on debugging.
642 pub const IFF_LOOPBACK: ::c_int = 0x8; // Is a loopback net.
643 pub const IFF_POINTOPOINT: ::c_int = 0x10; // Interface is point-to-point link.
644 pub const IFF_NOTRAILERS: ::c_int = 0x20; // Avoid use of trailers.
645 pub const IFF_RUNNING: ::c_int = 0x40; // Resources allocated.
646 pub const IFF_NOARP: ::c_int = 0x80; // No address resolution protocol.
647 pub const IFF_PROMISC: ::c_int = 0x100; // Receive all packets.
648 // Not supported
649 pub const IFF_ALLMULTI: ::c_int = 0x200; // Receive all multicast packets.
650 pub const IFF_MASTER: ::c_int = 0x400; // Master of a load balancer.
651 pub const IFF_SLAVE: ::c_int = 0x800; // Slave of a load balancer.
652 pub const IFF_MULTICAST: ::c_int = 0x1000; // Supports multicast.
653 pub const IFF_PORTSEL: ::c_int = 0x2000; // Can set media type.
654 pub const IFF_AUTOMEDIA: ::c_int = 0x4000; // Auto media select active.
655 // Dialup device with changing addresses.
656 pub const IFF_DYNAMIC: ::c_int = 0x8000;
657 
658 pub const SOL_IP: ::c_int = 0;
659 pub const SOL_TCP: ::c_int = 6;
660 pub const SOL_IPV6: ::c_int = 41;
661 pub const SOL_ICMPV6: ::c_int = 58;
662 pub const SOL_RAW: ::c_int = 255;
663 pub const SOL_DECNET: ::c_int = 261;
664 pub const SOL_X25: ::c_int = 262;
665 pub const SOL_PACKET: ::c_int = 263;
666 pub const SOL_ATM: ::c_int = 264;
667 pub const SOL_AAL: ::c_int = 265;
668 pub const SOL_IRDA: ::c_int = 266;
669 
670 pub const AF_UNSPEC: ::c_int = 0;
671 pub const AF_UNIX: ::c_int = 1;
672 pub const AF_LOCAL: ::c_int = 1;
673 pub const AF_INET: ::c_int = 2;
674 pub const AF_AX25: ::c_int = 3;
675 pub const AF_IPX: ::c_int = 4;
676 pub const AF_APPLETALK: ::c_int = 5;
677 pub const AF_NETROM: ::c_int = 6;
678 pub const AF_BRIDGE: ::c_int = 7;
679 pub const AF_ATMPVC: ::c_int = 8;
680 pub const AF_X25: ::c_int = 9;
681 pub const AF_INET6: ::c_int = 10;
682 pub const AF_ROSE: ::c_int = 11;
683 pub const AF_DECnet: ::c_int = 12;
684 pub const AF_NETBEUI: ::c_int = 13;
685 pub const AF_SECURITY: ::c_int = 14;
686 pub const AF_KEY: ::c_int = 15;
687 pub const AF_NETLINK: ::c_int = 16;
688 pub const AF_ROUTE: ::c_int = AF_NETLINK;
689 pub const AF_PACKET: ::c_int = 17;
690 pub const AF_ASH: ::c_int = 18;
691 pub const AF_ECONET: ::c_int = 19;
692 pub const AF_ATMSVC: ::c_int = 20;
693 pub const AF_SNA: ::c_int = 22;
694 pub const AF_IRDA: ::c_int = 23;
695 pub const AF_PPPOX: ::c_int = 24;
696 pub const AF_WANPIPE: ::c_int = 25;
697 pub const AF_LLC: ::c_int = 26;
698 pub const AF_CAN: ::c_int = 29;
699 pub const AF_TIPC: ::c_int = 30;
700 pub const AF_BLUETOOTH: ::c_int = 31;
701 pub const AF_IUCV: ::c_int = 32;
702 pub const AF_RXRPC: ::c_int = 33;
703 pub const AF_ISDN: ::c_int = 34;
704 pub const AF_PHONET: ::c_int = 35;
705 pub const AF_IEEE802154: ::c_int = 36;
706 pub const AF_CAIF: ::c_int = 37;
707 pub const AF_ALG: ::c_int = 38;
708 
709 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
710 pub const PF_UNIX: ::c_int = AF_UNIX;
711 pub const PF_LOCAL: ::c_int = AF_LOCAL;
712 pub const PF_INET: ::c_int = AF_INET;
713 pub const PF_AX25: ::c_int = AF_AX25;
714 pub const PF_IPX: ::c_int = AF_IPX;
715 pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
716 pub const PF_NETROM: ::c_int = AF_NETROM;
717 pub const PF_BRIDGE: ::c_int = AF_BRIDGE;
718 pub const PF_ATMPVC: ::c_int = AF_ATMPVC;
719 pub const PF_X25: ::c_int = AF_X25;
720 pub const PF_INET6: ::c_int = AF_INET6;
721 pub const PF_ROSE: ::c_int = AF_ROSE;
722 pub const PF_DECnet: ::c_int = AF_DECnet;
723 pub const PF_NETBEUI: ::c_int = AF_NETBEUI;
724 pub const PF_SECURITY: ::c_int = AF_SECURITY;
725 pub const PF_KEY: ::c_int = AF_KEY;
726 pub const PF_NETLINK: ::c_int = AF_NETLINK;
727 pub const PF_ROUTE: ::c_int = AF_ROUTE;
728 pub const PF_PACKET: ::c_int = AF_PACKET;
729 pub const PF_ASH: ::c_int = AF_ASH;
730 pub const PF_ECONET: ::c_int = AF_ECONET;
731 pub const PF_ATMSVC: ::c_int = AF_ATMSVC;
732 pub const PF_SNA: ::c_int = AF_SNA;
733 pub const PF_IRDA: ::c_int = AF_IRDA;
734 pub const PF_PPPOX: ::c_int = AF_PPPOX;
735 pub const PF_WANPIPE: ::c_int = AF_WANPIPE;
736 pub const PF_LLC: ::c_int = AF_LLC;
737 pub const PF_CAN: ::c_int = AF_CAN;
738 pub const PF_TIPC: ::c_int = AF_TIPC;
739 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
740 pub const PF_IUCV: ::c_int = AF_IUCV;
741 pub const PF_RXRPC: ::c_int = AF_RXRPC;
742 pub const PF_ISDN: ::c_int = AF_ISDN;
743 pub const PF_PHONET: ::c_int = AF_PHONET;
744 pub const PF_IEEE802154: ::c_int = AF_IEEE802154;
745 pub const PF_CAIF: ::c_int = AF_CAIF;
746 pub const PF_ALG: ::c_int = AF_ALG;
747 
748 pub const SOMAXCONN: ::c_int = 128;
749 
750 pub const MSG_OOB: ::c_int = 1;
751 pub const MSG_PEEK: ::c_int = 2;
752 pub const MSG_DONTROUTE: ::c_int = 4;
753 pub const MSG_CTRUNC: ::c_int = 8;
754 pub const MSG_TRUNC: ::c_int = 0x20;
755 pub const MSG_DONTWAIT: ::c_int = 0x40;
756 pub const MSG_EOR: ::c_int = 0x80;
757 pub const MSG_WAITALL: ::c_int = 0x100;
758 pub const MSG_FIN: ::c_int = 0x200;
759 pub const MSG_SYN: ::c_int = 0x400;
760 pub const MSG_CONFIRM: ::c_int = 0x800;
761 pub const MSG_RST: ::c_int = 0x1000;
762 pub const MSG_ERRQUEUE: ::c_int = 0x2000;
763 pub const MSG_NOSIGNAL: ::c_int = 0x4000;
764 pub const MSG_MORE: ::c_int = 0x8000;
765 pub const MSG_WAITFORONE: ::c_int = 0x10000;
766 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
767 
768 pub const SOCK_RAW: ::c_int = 3;
769 pub const IP_MULTICAST_TTL: ::c_int = 33;
770 pub const IP_MULTICAST_LOOP: ::c_int = 34;
771 pub const IP_TTL: ::c_int = 2;
772 pub const IP_HDRINCL: ::c_int = 3;
773 pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
774 pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
775 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
776 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
777 
778 pub const IPV6_JOIN_GROUP: ::c_int = 20;
779 pub const IPV6_LEAVE_GROUP: ::c_int = 21;
780 
781 pub const TCP_NODELAY: ::c_int = 1;
782 pub const TCP_MAXSEG: ::c_int = 2;
783 pub const TCP_CORK: ::c_int = 3;
784 pub const TCP_KEEPIDLE: ::c_int = 4;
785 pub const TCP_KEEPINTVL: ::c_int = 5;
786 pub const TCP_KEEPCNT: ::c_int = 6;
787 pub const TCP_SYNCNT: ::c_int = 7;
788 pub const TCP_LINGER2: ::c_int = 8;
789 pub const TCP_DEFER_ACCEPT: ::c_int = 9;
790 pub const TCP_WINDOW_CLAMP: ::c_int = 10;
791 pub const TCP_INFO: ::c_int = 11;
792 pub const TCP_QUICKACK: ::c_int = 12;
793 pub const TCP_CONGESTION: ::c_int = 13;
794 
795 pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
796 pub const IPV6_V6ONLY: ::c_int = 26;
797 
798 pub const SO_DEBUG: ::c_int = 1;
799 
800 pub const SHUT_RD: ::c_int = 0;
801 pub const SHUT_WR: ::c_int = 1;
802 pub const SHUT_RDWR: ::c_int = 2;
803 
804 pub const LOCK_SH: ::c_int = 1;
805 pub const LOCK_EX: ::c_int = 2;
806 pub const LOCK_NB: ::c_int = 4;
807 pub const LOCK_UN: ::c_int = 8;
808 
809 pub const SS_ONSTACK: ::c_int = 1;
810 pub const SS_DISABLE: ::c_int = 2;
811 
812 pub const PATH_MAX: ::c_int = 4096;
813 
814 pub const FD_SETSIZE: usize = 1024;
815 
816 pub const EPOLLIN: ::c_int = 0x1;
817 pub const EPOLLPRI: ::c_int = 0x2;
818 pub const EPOLLOUT: ::c_int = 0x4;
819 pub const EPOLLRDNORM: ::c_int = 0x40;
820 pub const EPOLLRDBAND: ::c_int = 0x80;
821 pub const EPOLLWRNORM: ::c_int = 0x100;
822 pub const EPOLLWRBAND: ::c_int = 0x200;
823 pub const EPOLLMSG: ::c_int = 0x400;
824 pub const EPOLLERR: ::c_int = 0x8;
825 pub const EPOLLHUP: ::c_int = 0x10;
826 pub const EPOLLET: ::c_int = 0x80000000;
827 
828 pub const EPOLL_CTL_ADD: ::c_int = 1;
829 pub const EPOLL_CTL_MOD: ::c_int = 3;
830 pub const EPOLL_CTL_DEL: ::c_int = 2;
831 
832 pub const MNT_DETACH: ::c_int = 0x2;
833 pub const MNT_EXPIRE: ::c_int = 0x4;
834 
835 pub const MNT_FORCE: ::c_int = 0x1;
836 
837 pub const Q_SYNC: ::c_int = 0x600;
838 pub const Q_QUOTAON: ::c_int = 0x100;
839 pub const Q_QUOTAOFF: ::c_int = 0x200;
840 pub const Q_GETQUOTA: ::c_int = 0x300;
841 pub const Q_SETQUOTA: ::c_int = 0x400;
842 
843 pub const TCIOFF: ::c_int = 2;
844 pub const TCION: ::c_int = 3;
845 pub const TCOOFF: ::c_int = 0;
846 pub const TCOON: ::c_int = 1;
847 pub const TCIFLUSH: ::c_int = 0;
848 pub const TCOFLUSH: ::c_int = 1;
849 pub const TCIOFLUSH: ::c_int = 2;
850 pub const NL0: ::c_int  = 0x00000000;
851 pub const NL1: ::c_int  = 0x00000100;
852 pub const TAB0: ::c_int = 0x00000000;
853 pub const CR0: ::c_int  = 0x00000000;
854 pub const FF0: ::c_int  = 0x00000000;
855 pub const BS0: ::c_int  = 0x00000000;
856 pub const VT0: ::c_int  = 0x00000000;
857 pub const VERASE: usize = 2;
858 pub const VKILL: usize = 3;
859 pub const VINTR: usize = 0;
860 pub const VQUIT: usize = 1;
861 pub const VLNEXT: usize = 15;
862 pub const IGNBRK: ::tcflag_t = 0x00000001;
863 pub const BRKINT: ::tcflag_t = 0x00000002;
864 pub const IGNPAR: ::tcflag_t = 0x00000004;
865 pub const PARMRK: ::tcflag_t = 0x00000008;
866 pub const INPCK: ::tcflag_t = 0x00000010;
867 pub const ISTRIP: ::tcflag_t = 0x00000020;
868 pub const INLCR: ::tcflag_t = 0x00000040;
869 pub const IGNCR: ::tcflag_t = 0x00000080;
870 pub const ICRNL: ::tcflag_t = 0x00000100;
871 pub const IXANY: ::tcflag_t = 0x00000800;
872 pub const IMAXBEL: ::tcflag_t = 0x00002000;
873 pub const OPOST: ::tcflag_t = 0x1;
874 pub const CS5: ::tcflag_t = 0x00000000;
875 pub const CRTSCTS: ::tcflag_t = 0x80000000;
876 pub const ECHO: ::tcflag_t = 0x00000008;
877 
878 pub const CLONE_VM: ::c_int = 0x100;
879 pub const CLONE_FS: ::c_int = 0x200;
880 pub const CLONE_FILES: ::c_int = 0x400;
881 pub const CLONE_SIGHAND: ::c_int = 0x800;
882 pub const CLONE_PTRACE: ::c_int = 0x2000;
883 pub const CLONE_VFORK: ::c_int = 0x4000;
884 pub const CLONE_PARENT: ::c_int = 0x8000;
885 pub const CLONE_THREAD: ::c_int = 0x10000;
886 pub const CLONE_NEWNS: ::c_int = 0x20000;
887 pub const CLONE_SYSVSEM: ::c_int = 0x40000;
888 pub const CLONE_SETTLS: ::c_int = 0x80000;
889 pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
890 pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
891 pub const CLONE_DETACHED: ::c_int = 0x400000;
892 pub const CLONE_UNTRACED: ::c_int = 0x800000;
893 pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
894 pub const CLONE_NEWUTS: ::c_int = 0x04000000;
895 pub const CLONE_NEWIPC: ::c_int = 0x08000000;
896 pub const CLONE_NEWUSER: ::c_int = 0x10000000;
897 pub const CLONE_NEWPID: ::c_int = 0x20000000;
898 pub const CLONE_NEWNET: ::c_int = 0x40000000;
899 pub const CLONE_IO: ::c_int = 0x80000000;
900 
901 pub const WNOHANG: ::c_int = 0x00000001;
902 pub const WUNTRACED: ::c_int = 0x00000002;
903 pub const WSTOPPED: ::c_int = WUNTRACED;
904 pub const WEXITED: ::c_int = 0x00000004;
905 pub const WCONTINUED: ::c_int = 0x00000008;
906 pub const WNOWAIT: ::c_int = 0x01000000;
907 
908 pub const __WNOTHREAD: ::c_int = 0x20000000;
909 pub const __WALL: ::c_int = 0x40000000;
910 pub const __WCLONE: ::c_int = 0x80000000;
911 
912 pub const SPLICE_F_MOVE: ::c_uint = 0x01;
913 pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
914 pub const SPLICE_F_MORE: ::c_uint = 0x04;
915 pub const SPLICE_F_GIFT: ::c_uint = 0x08;
916 
917 pub const RTLD_LOCAL: ::c_int = 0;
918 pub const RTLD_LAZY: ::c_int = 1;
919 
920 pub const POSIX_FADV_NORMAL: ::c_int = 0;
921 pub const POSIX_FADV_RANDOM: ::c_int = 1;
922 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
923 pub const POSIX_FADV_WILLNEED: ::c_int = 3;
924 
925 pub const AT_FDCWD: ::c_int = -100;
926 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
927 pub const AT_REMOVEDIR: ::c_int = 0x200;
928 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
929 
930 pub const LOG_CRON: ::c_int = 9 << 3;
931 pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
932 pub const LOG_FTP: ::c_int = 11 << 3;
933 pub const LOG_PERROR: ::c_int = 0x20;
934 
935 pub const POLLIN: ::c_short = 0x1;
936 pub const POLLPRI: ::c_short = 0x2;
937 pub const POLLOUT: ::c_short = 0x4;
938 pub const POLLERR: ::c_short = 0x8;
939 pub const POLLHUP: ::c_short = 0x10;
940 pub const POLLNVAL: ::c_short = 0x20;
941 
942 pub const PIPE_BUF: usize = 4096;
943 
944 pub const SI_LOAD_SHIFT: ::c_uint = 16;
945 
946 pub const SIGEV_SIGNAL: ::c_int = 0;
947 pub const SIGEV_NONE: ::c_int = 1;
948 pub const SIGEV_THREAD: ::c_int = 2;
949 
950 pub const P_ALL: idtype_t = 0;
951 pub const P_PID: idtype_t = 1;
952 pub const P_PGID: idtype_t = 2;
953 
954 pub const UTIME_OMIT: c_long = 1073741822;
955 pub const UTIME_NOW: c_long = 1073741823;
956 
957 pub const L_tmpnam: ::c_uint = 20;
958 pub const _PC_LINK_MAX: ::c_int = 0;
959 pub const _PC_MAX_CANON: ::c_int = 1;
960 pub const _PC_MAX_INPUT: ::c_int = 2;
961 pub const _PC_NAME_MAX: ::c_int = 3;
962 pub const _PC_PATH_MAX: ::c_int = 4;
963 pub const _PC_PIPE_BUF: ::c_int = 5;
964 pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
965 pub const _PC_NO_TRUNC: ::c_int = 7;
966 pub const _PC_VDISABLE: ::c_int = 8;
967 
968 pub const _SC_ARG_MAX: ::c_int = 0;
969 pub const _SC_CHILD_MAX: ::c_int = 1;
970 pub const _SC_CLK_TCK: ::c_int = 2;
971 pub const _SC_NGROUPS_MAX: ::c_int = 3;
972 pub const _SC_OPEN_MAX: ::c_int = 4;
973 pub const _SC_STREAM_MAX: ::c_int = 5;
974 pub const _SC_TZNAME_MAX: ::c_int = 6;
975 pub const _SC_JOB_CONTROL: ::c_int = 7;
976 pub const _SC_SAVED_IDS: ::c_int = 8;
977 pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
978 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
979 pub const _SC_TIMERS: ::c_int = 11;
980 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
981 pub const _SC_PRIORITIZED_IO: ::c_int = 13;
982 pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
983 pub const _SC_FSYNC: ::c_int = 15;
984 pub const _SC_MAPPED_FILES: ::c_int = 16;
985 pub const _SC_MEMLOCK: ::c_int = 17;
986 pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
987 pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
988 pub const _SC_MESSAGE_PASSING: ::c_int = 20;
989 pub const _SC_SEMAPHORES: ::c_int = 21;
990 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
991 pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
992 pub const _SC_AIO_MAX: ::c_int = 24;
993 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
994 pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
995 pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
996 pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
997 pub const _SC_VERSION: ::c_int = 29;
998 pub const _SC_PAGESIZE: ::c_int = 30;
999 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
1000 pub const _SC_RTSIG_MAX: ::c_int = 31;
1001 pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
1002 pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
1003 pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
1004 pub const _SC_TIMER_MAX: ::c_int = 35;
1005 pub const _SC_BC_BASE_MAX: ::c_int = 36;
1006 pub const _SC_BC_DIM_MAX: ::c_int = 37;
1007 pub const _SC_BC_SCALE_MAX: ::c_int = 38;
1008 pub const _SC_BC_STRING_MAX: ::c_int = 39;
1009 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
1010 pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
1011 pub const _SC_LINE_MAX: ::c_int = 43;
1012 pub const _SC_RE_DUP_MAX: ::c_int = 44;
1013 pub const _SC_2_VERSION: ::c_int = 46;
1014 pub const _SC_2_C_BIND: ::c_int = 47;
1015 pub const _SC_2_C_DEV: ::c_int = 48;
1016 pub const _SC_2_FORT_DEV: ::c_int = 49;
1017 pub const _SC_2_FORT_RUN: ::c_int = 50;
1018 pub const _SC_2_SW_DEV: ::c_int = 51;
1019 pub const _SC_2_LOCALEDEF: ::c_int = 52;
1020 pub const _SC_IOV_MAX: ::c_int = 60;
1021 pub const _SC_THREADS: ::c_int = 67;
1022 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
1023 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
1024 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
1025 pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
1026 pub const _SC_TTY_NAME_MAX: ::c_int = 72;
1027 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
1028 pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
1029 pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
1030 pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
1031 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
1032 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
1033 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
1034 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
1035 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
1036 pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
1037 pub const _SC_ATEXIT_MAX: ::c_int = 87;
1038 pub const _SC_XOPEN_VERSION: ::c_int = 89;
1039 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
1040 pub const _SC_XOPEN_UNIX: ::c_int = 91;
1041 pub const _SC_XOPEN_CRYPT: ::c_int = 92;
1042 pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
1043 pub const _SC_XOPEN_SHM: ::c_int = 94;
1044 pub const _SC_2_CHAR_TERM: ::c_int = 95;
1045 pub const _SC_2_UPE: ::c_int = 97;
1046 pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
1047 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
1048 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
1049 pub const _SC_XOPEN_LEGACY: ::c_int = 129;
1050 pub const _SC_XOPEN_REALTIME: ::c_int = 130;
1051 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
1052 pub const _SC_HOST_NAME_MAX: ::c_int = 180;
1053 
1054 pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
1055 pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
1056 
1057 pub const GLOB_ERR: ::c_int = 1 << 0;
1058 pub const GLOB_MARK: ::c_int = 1 << 1;
1059 pub const GLOB_NOSORT: ::c_int = 1 << 2;
1060 pub const GLOB_DOOFFS: ::c_int = 1 << 3;
1061 pub const GLOB_NOCHECK: ::c_int = 1 << 4;
1062 pub const GLOB_APPEND: ::c_int = 1 << 5;
1063 pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
1064 
1065 pub const GLOB_NOSPACE: ::c_int = 1;
1066 pub const GLOB_ABORTED: ::c_int = 2;
1067 pub const GLOB_NOMATCH: ::c_int = 3;
1068 
1069 pub const POSIX_MADV_NORMAL: ::c_int = 0;
1070 pub const POSIX_MADV_RANDOM: ::c_int = 1;
1071 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
1072 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
1073 
1074 pub const S_IEXEC: mode_t = 64;
1075 pub const S_IWRITE: mode_t = 128;
1076 pub const S_IREAD: mode_t = 256;
1077 
1078 pub const F_LOCK: ::c_int = 1;
1079 pub const F_TEST: ::c_int = 3;
1080 pub const F_TLOCK: ::c_int = 2;
1081 pub const F_ULOCK: ::c_int = 0;
1082 
1083 pub const ST_RDONLY: ::c_ulong = 1;
1084 pub const ST_NOSUID: ::c_ulong = 2;
1085 pub const ST_NODEV: ::c_ulong = 4;
1086 pub const ST_NOEXEC: ::c_ulong = 8;
1087 pub const ST_SYNCHRONOUS: ::c_ulong = 16;
1088 pub const ST_MANDLOCK: ::c_ulong = 64;
1089 pub const ST_WRITE: ::c_ulong = 128;
1090 pub const ST_APPEND: ::c_ulong = 256;
1091 pub const ST_IMMUTABLE: ::c_ulong = 512;
1092 pub const ST_NOATIME: ::c_ulong = 1024;
1093 pub const ST_NODIRATIME: ::c_ulong = 2048;
1094 
1095 pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
1096 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
1097 pub const RTLD_NODELETE: ::c_int = 0x1000;
1098 pub const RTLD_NOW: ::c_int = 0x2;
1099 
1100 pub const TCP_MD5SIG: ::c_int = 14;
1101 
1102 align_const! {
1103     pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
1104         size: [0; __SIZEOF_PTHREAD_MUTEX_T],
1105     };
1106     pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1107         size: [0; __SIZEOF_PTHREAD_COND_T],
1108     };
1109     pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1110         size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
1111     };
1112 }
1113 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
1114 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
1115 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
1116 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
1117 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
1118 
1119 pub const SCHED_OTHER: ::c_int = 0;
1120 pub const SCHED_FIFO: ::c_int = 1;
1121 pub const SCHED_RR: ::c_int = 2;
1122 pub const SCHED_BATCH: ::c_int = 3;
1123 pub const SCHED_IDLE: ::c_int = 5;
1124 
1125 // System V IPC
1126 pub const IPC_PRIVATE: ::key_t = 0;
1127 
1128 pub const IPC_CREAT: ::c_int = 0o1000;
1129 pub const IPC_EXCL: ::c_int = 0o2000;
1130 pub const IPC_NOWAIT: ::c_int = 0o4000;
1131 
1132 pub const IPC_RMID: ::c_int = 0;
1133 pub const IPC_SET: ::c_int = 1;
1134 pub const IPC_STAT: ::c_int = 2;
1135 pub const IPC_INFO: ::c_int = 3;
1136 pub const MSG_STAT: ::c_int = 11;
1137 pub const MSG_INFO: ::c_int = 12;
1138 
1139 pub const MSG_NOERROR: ::c_int = 0o10000;
1140 pub const MSG_EXCEPT: ::c_int = 0o20000;
1141 
1142 pub const SHM_R: ::c_int = 0o400;
1143 pub const SHM_W: ::c_int = 0o200;
1144 
1145 pub const SHM_RDONLY: ::c_int = 0o10000;
1146 pub const SHM_RND: ::c_int = 0o20000;
1147 pub const SHM_REMAP: ::c_int = 0o40000;
1148 
1149 pub const SHM_LOCK: ::c_int = 11;
1150 pub const SHM_UNLOCK: ::c_int = 12;
1151 
1152 pub const SHM_HUGETLB: ::c_int = 0o4000;
1153 pub const SHM_NORESERVE: ::c_int = 0o10000;
1154 
1155 pub const EPOLLRDHUP: ::c_int = 0x2000;
1156 pub const EPOLLONESHOT: ::c_int = 0x40000000;
1157 
1158 pub const QFMT_VFS_OLD: ::c_int = 1;
1159 pub const QFMT_VFS_V0: ::c_int = 2;
1160 
1161 pub const EFD_SEMAPHORE: ::c_int = 0x1;
1162 
1163 pub const LOG_NFACILITIES: ::c_int = 24;
1164 
1165 pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
1166 
1167 pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
1168 pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
1169 pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
1170 pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
1171 pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
1172 
1173 pub const AI_PASSIVE: ::c_int = 0x0001;
1174 pub const AI_CANONNAME: ::c_int = 0x0002;
1175 pub const AI_NUMERICHOST: ::c_int = 0x0004;
1176 pub const AI_V4MAPPED: ::c_int = 0x0008;
1177 pub const AI_ALL: ::c_int = 0x0010;
1178 pub const AI_ADDRCONFIG: ::c_int = 0x0020;
1179 
1180 pub const AI_NUMERICSERV: ::c_int = 0x0400;
1181 
1182 pub const EAI_BADFLAGS: ::c_int = -1;
1183 pub const EAI_NONAME: ::c_int = -2;
1184 pub const EAI_AGAIN: ::c_int = -3;
1185 pub const EAI_FAIL: ::c_int = -4;
1186 pub const EAI_FAMILY: ::c_int = -6;
1187 pub const EAI_SOCKTYPE: ::c_int = -7;
1188 pub const EAI_SERVICE: ::c_int = -8;
1189 pub const EAI_MEMORY: ::c_int = -10;
1190 pub const EAI_OVERFLOW: ::c_int = -12;
1191 
1192 pub const NI_NUMERICHOST: ::c_int = 1;
1193 pub const NI_NUMERICSERV: ::c_int = 2;
1194 pub const NI_NOFQDN: ::c_int = 4;
1195 pub const NI_NAMEREQD: ::c_int = 8;
1196 pub const NI_DGRAM: ::c_int = 16;
1197 
1198 pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
1199 pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
1200 pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
1201 
1202 pub const EAI_SYSTEM: ::c_int = -11;
1203 
1204 pub const MREMAP_MAYMOVE: ::c_int = 1;
1205 pub const MREMAP_FIXED: ::c_int = 2;
1206 
1207 pub const PR_SET_PDEATHSIG: ::c_int = 1;
1208 pub const PR_GET_PDEATHSIG: ::c_int = 2;
1209 
1210 pub const PR_GET_DUMPABLE: ::c_int = 3;
1211 pub const PR_SET_DUMPABLE: ::c_int = 4;
1212 
1213 pub const PR_GET_UNALIGN: ::c_int = 5;
1214 pub const PR_SET_UNALIGN: ::c_int = 6;
1215 pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
1216 pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
1217 
1218 pub const PR_GET_KEEPCAPS: ::c_int = 7;
1219 pub const PR_SET_KEEPCAPS: ::c_int = 8;
1220 
1221 pub const PR_GET_FPEMU: ::c_int = 9;
1222 pub const PR_SET_FPEMU: ::c_int = 10;
1223 pub const PR_FPEMU_NOPRINT: ::c_int = 1;
1224 pub const PR_FPEMU_SIGFPE: ::c_int = 2;
1225 
1226 pub const PR_GET_FPEXC: ::c_int = 11;
1227 pub const PR_SET_FPEXC: ::c_int = 12;
1228 pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
1229 pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
1230 pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
1231 pub const PR_FP_EXC_UND: ::c_int = 0x040000;
1232 pub const PR_FP_EXC_RES: ::c_int = 0x080000;
1233 pub const PR_FP_EXC_INV: ::c_int = 0x100000;
1234 pub const PR_FP_EXC_DISABLED: ::c_int = 0;
1235 pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
1236 pub const PR_FP_EXC_ASYNC: ::c_int = 2;
1237 pub const PR_FP_EXC_PRECISE: ::c_int = 3;
1238 
1239 pub const PR_GET_TIMING: ::c_int = 13;
1240 pub const PR_SET_TIMING: ::c_int = 14;
1241 pub const PR_TIMING_STATISTICAL: ::c_int = 0;
1242 pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
1243 
1244 pub const PR_SET_NAME: ::c_int = 15;
1245 pub const PR_GET_NAME: ::c_int = 16;
1246 
1247 pub const PR_GET_ENDIAN: ::c_int = 19;
1248 pub const PR_SET_ENDIAN: ::c_int = 20;
1249 pub const PR_ENDIAN_BIG: ::c_int = 0;
1250 pub const PR_ENDIAN_LITTLE: ::c_int = 1;
1251 pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
1252 
1253 pub const PR_GET_SECCOMP: ::c_int = 21;
1254 pub const PR_SET_SECCOMP: ::c_int = 22;
1255 
1256 pub const PR_CAPBSET_READ: ::c_int = 23;
1257 pub const PR_CAPBSET_DROP: ::c_int = 24;
1258 
1259 pub const PR_GET_TSC: ::c_int = 25;
1260 pub const PR_SET_TSC: ::c_int = 26;
1261 pub const PR_TSC_ENABLE: ::c_int = 1;
1262 pub const PR_TSC_SIGSEGV: ::c_int = 2;
1263 
1264 pub const PR_GET_SECUREBITS: ::c_int = 27;
1265 pub const PR_SET_SECUREBITS: ::c_int = 28;
1266 
1267 pub const PR_SET_TIMERSLACK: ::c_int = 29;
1268 pub const PR_GET_TIMERSLACK: ::c_int = 30;
1269 
1270 pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
1271 pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
1272 
1273 pub const PR_MCE_KILL: ::c_int = 33;
1274 pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
1275 pub const PR_MCE_KILL_SET: ::c_int = 1;
1276 
1277 pub const PR_MCE_KILL_LATE: ::c_int = 0;
1278 pub const PR_MCE_KILL_EARLY: ::c_int = 1;
1279 pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
1280 
1281 pub const PR_MCE_KILL_GET: ::c_int = 34;
1282 
1283 pub const PR_SET_MM: ::c_int = 35;
1284 pub const PR_SET_MM_START_CODE: ::c_int = 1;
1285 pub const PR_SET_MM_END_CODE: ::c_int = 2;
1286 pub const PR_SET_MM_START_DATA: ::c_int = 3;
1287 pub const PR_SET_MM_END_DATA: ::c_int = 4;
1288 pub const PR_SET_MM_START_STACK: ::c_int = 5;
1289 pub const PR_SET_MM_START_BRK: ::c_int = 6;
1290 pub const PR_SET_MM_BRK: ::c_int = 7;
1291 pub const PR_SET_MM_ARG_START: ::c_int = 8;
1292 pub const PR_SET_MM_ARG_END: ::c_int = 9;
1293 pub const PR_SET_MM_ENV_START: ::c_int = 10;
1294 pub const PR_SET_MM_ENV_END: ::c_int = 11;
1295 pub const PR_SET_MM_AUXV: ::c_int = 12;
1296 pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
1297 pub const PR_SET_MM_MAP: ::c_int = 14;
1298 pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
1299 
1300 pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
1301 
1302 pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
1303 pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
1304 
1305 pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
1306 pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
1307 
1308 pub const PR_GET_TID_ADDRESS: ::c_int = 40;
1309 
1310 pub const PR_SET_THP_DISABLE: ::c_int = 41;
1311 pub const PR_GET_THP_DISABLE: ::c_int = 42;
1312 
1313 pub const GRND_NONBLOCK: ::c_uint = 0x0001;
1314 pub const GRND_RANDOM: ::c_uint = 0x0002;
1315 
1316 pub const ABDAY_1: ::nl_item = 0x300;
1317 pub const ABDAY_2: ::nl_item = 0x301;
1318 pub const ABDAY_3: ::nl_item = 0x302;
1319 pub const ABDAY_4: ::nl_item = 0x303;
1320 pub const ABDAY_5: ::nl_item = 0x304;
1321 pub const ABDAY_6: ::nl_item = 0x305;
1322 pub const ABDAY_7: ::nl_item = 0x306;
1323 
1324 pub const DAY_1: ::nl_item = 0x307;
1325 pub const DAY_2: ::nl_item = 0x308;
1326 pub const DAY_3: ::nl_item = 0x309;
1327 pub const DAY_4: ::nl_item = 0x30A;
1328 pub const DAY_5: ::nl_item = 0x30B;
1329 pub const DAY_6: ::nl_item = 0x30C;
1330 pub const DAY_7: ::nl_item = 0x30D;
1331 
1332 pub const ABMON_1: ::nl_item = 0x30E;
1333 pub const ABMON_2: ::nl_item = 0x30F;
1334 pub const ABMON_3: ::nl_item = 0x310;
1335 pub const ABMON_4: ::nl_item = 0x311;
1336 pub const ABMON_5: ::nl_item = 0x312;
1337 pub const ABMON_6: ::nl_item = 0x313;
1338 pub const ABMON_7: ::nl_item = 0x314;
1339 pub const ABMON_8: ::nl_item = 0x315;
1340 pub const ABMON_9: ::nl_item = 0x316;
1341 pub const ABMON_10: ::nl_item = 0x317;
1342 pub const ABMON_11: ::nl_item = 0x318;
1343 pub const ABMON_12: ::nl_item = 0x319;
1344 
1345 pub const MON_1: ::nl_item = 0x31A;
1346 pub const MON_2: ::nl_item = 0x31B;
1347 pub const MON_3: ::nl_item = 0x31C;
1348 pub const MON_4: ::nl_item = 0x31D;
1349 pub const MON_5: ::nl_item = 0x31E;
1350 pub const MON_6: ::nl_item = 0x31F;
1351 pub const MON_7: ::nl_item = 0x320;
1352 pub const MON_8: ::nl_item = 0x321;
1353 pub const MON_9: ::nl_item = 0x322;
1354 pub const MON_10: ::nl_item = 0x323;
1355 pub const MON_11: ::nl_item = 0x324;
1356 pub const MON_12: ::nl_item = 0x325;
1357 
1358 pub const AM_STR: ::nl_item = 0x326;
1359 pub const PM_STR: ::nl_item = 0x327;
1360 
1361 pub const D_T_FMT: ::nl_item = 0x328;
1362 pub const D_FMT: ::nl_item = 0x329;
1363 pub const T_FMT: ::nl_item = 0x32A;
1364 pub const T_FMT_AMPM: ::nl_item = 0x32B;
1365 
1366 pub const ERA: ::nl_item = 0x32C;
1367 pub const ERA_D_FMT: ::nl_item = 0x32E;
1368 pub const ALT_DIGITS: ::nl_item = 0x32F;
1369 pub const ERA_D_T_FMT: ::nl_item = 0x330;
1370 pub const ERA_T_FMT: ::nl_item = 0x331;
1371 
1372 pub const CODESET: ::nl_item = 10;
1373 
1374 pub const CRNCYSTR: ::nl_item = 0x215;
1375 
1376 pub const RADIXCHAR: ::nl_item = 0x100;
1377 pub const THOUSEP: ::nl_item = 0x101;
1378 
1379 pub const NOEXPR: ::nl_item = 0x501;
1380 pub const YESSTR: ::nl_item = 0x502;
1381 pub const NOSTR: ::nl_item = 0x503;
1382 
1383 pub const FILENAME_MAX: ::c_uint = 4095;
1384 
1385 pub const AF_MAX: ::c_int = 39;
1386 
1387 f! {
1388     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
1389         let fd = fd as usize;
1390         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1391         (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1392         return
1393     }
1394 
1395     pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1396         let fd = fd as usize;
1397         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1398         return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
1399     }
1400 
1401     pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
1402         let fd = fd as usize;
1403         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1404         (*set).fds_bits[fd / size] |= 1 << (fd % size);
1405         return
1406     }
1407 
1408     pub fn FD_ZERO(set: *mut fd_set) -> () {
1409         for slot in (*set).fds_bits.iter_mut() {
1410             *slot = 0;
1411         }
1412     }
1413 
1414     pub fn WIFSTOPPED(status: ::c_int) -> bool {
1415         (status & 0xff) == 0x7f
1416     }
1417 
1418     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
1419         (status >> 8) & 0xff
1420     }
1421 
1422     pub fn WIFCONTINUED(status: ::c_int) -> bool {
1423         status == 0xffff
1424     }
1425 
1426     pub fn WIFSIGNALED(status: ::c_int) -> bool {
1427         ((status & 0x7f) + 1) as i8 >= 2
1428     }
1429 
1430     pub fn WTERMSIG(status: ::c_int) -> ::c_int {
1431         status & 0x7f
1432     }
1433 
1434     pub fn WIFEXITED(status: ::c_int) -> bool {
1435         (status & 0x7f) == 0
1436     }
1437 
1438     pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
1439         (status >> 8) & 0xff
1440     }
1441 
1442     pub fn WCOREDUMP(status: ::c_int) -> bool {
1443         (status & 0x80) != 0
1444     }
1445 
1446     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1447         for slot in cpuset.bits.iter_mut() {
1448             *slot = 0;
1449         }
1450     }
1451 
1452     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1453         let size_in_bits
1454             = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1455         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1456         cpuset.bits[idx] |= 1 << offset;
1457         ()
1458     }
1459 
1460     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1461         let size_in_bits
1462             = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1463         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1464         cpuset.bits[idx] &= !(1 << offset);
1465         ()
1466     }
1467 
1468     pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
1469         let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]);
1470         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1471         0 != (cpuset.bits[idx] & (1 << offset))
1472     }
1473 
1474     pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
1475         set1.bits == set2.bits
1476     }
1477 
1478     pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
1479         (cmd << 8) | (type_ & 0x00ff)
1480     }
1481 }
1482 
1483 extern {
sem_destroy(sem: *mut sem_t) -> ::c_int1484     pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int1485     pub fn sem_init(sem: *mut sem_t,
1486                     pshared: ::c_int,
1487                     value: ::c_uint)
1488                     -> ::c_int;
1489 
abs(i: ::c_int) -> ::c_int1490     pub fn abs(i: ::c_int) -> ::c_int;
atof(s: *const ::c_char) -> ::c_double1491     pub fn atof(s: *const ::c_char) -> ::c_double;
labs(i: ::c_long) -> ::c_long1492     pub fn labs(i: ::c_long) -> ::c_long;
rand() -> ::c_int1493     pub fn rand() -> ::c_int;
srand(seed: ::c_uint)1494     pub fn srand(seed: ::c_uint);
1495 
fdatasync(fd: ::c_int) -> ::c_int1496     pub fn fdatasync(fd: ::c_int) -> ::c_int;
mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int1497     pub fn mincore(addr: *mut ::c_void, len: ::size_t,
1498                    vec: *mut ::c_uchar) -> ::c_int;
clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int1499     pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int1500     pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
clock_nanosleep(clk_id: ::clockid_t, flags: ::c_int, rqtp: *const ::timespec, rmtp: *mut ::timespec) -> ::c_int1501     pub fn clock_nanosleep(clk_id: ::clockid_t,
1502                            flags: ::c_int,
1503                            rqtp: *const ::timespec,
1504                            rmtp:  *mut ::timespec) -> ::c_int;
clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int1505     pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
prctl(option: ::c_int, ...) -> ::c_int1506     pub fn prctl(option: ::c_int, ...) -> ::c_int;
pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int1507     pub fn pthread_getattr_np(native: ::pthread_t,
1508                               attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_getguardsize(attr: *const ::pthread_attr_t, guardsize: *mut ::size_t) -> ::c_int1509     pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
1510                                      guardsize: *mut ::size_t) -> ::c_int;
pthread_attr_getstack(attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t) -> ::c_int1511     pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
1512                                  stackaddr: *mut *mut ::c_void,
1513                                  stacksize: *mut ::size_t) -> ::c_int;
memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void1514     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int1515     pub fn setgroups(ngroups: ::size_t,
1516                      ptr: *const ::gid_t) -> ::c_int;
initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int1517     pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
sched_setscheduler(pid: ::pid_t, policy: ::c_int, param: *const ::sched_param) -> ::c_int1518     pub fn sched_setscheduler(pid: ::pid_t,
1519                               policy: ::c_int,
1520                               param: *const ::sched_param) -> ::c_int;
sched_getscheduler(pid: ::pid_t) -> ::c_int1521     pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
sched_get_priority_max(policy: ::c_int) -> ::c_int1522     pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
sched_get_priority_min(policy: ::c_int) -> ::c_int1523     pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
epoll_create(size: ::c_int) -> ::c_int1524     pub fn epoll_create(size: ::c_int) -> ::c_int;
epoll_create1(flags: ::c_int) -> ::c_int1525     pub fn epoll_create1(flags: ::c_int) -> ::c_int;
epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event) -> ::c_int1526     pub fn epoll_ctl(epfd: ::c_int,
1527                      op: ::c_int,
1528                      fd: ::c_int,
1529                      event: *mut ::epoll_event) -> ::c_int;
epoll_wait(epfd: ::c_int, events: *mut ::epoll_event, maxevents: ::c_int, timeout: ::c_int) -> ::c_int1530     pub fn epoll_wait(epfd: ::c_int,
1531                       events: *mut ::epoll_event,
1532                       maxevents: ::c_int,
1533                       timeout: ::c_int) -> ::c_int;
pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int1534     pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
mount(src: *const ::c_char, target: *const ::c_char, fstype: *const ::c_char, flags: ::c_ulong, data: *const ::c_void) -> ::c_int1535     pub fn mount(src: *const ::c_char,
1536                  target: *const ::c_char,
1537                  fstype: *const ::c_char,
1538                  flags: ::c_ulong,
1539                  data: *const ::c_void) -> ::c_int;
umount(target: *const ::c_char) -> ::c_int1540     pub fn umount(target: *const ::c_char) -> ::c_int;
umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int1541     pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
clone(cb: extern fn(*mut ::c_void) -> ::c_int, child_stack: *mut ::c_void, flags: ::c_int, arg: *mut ::c_void, ...) -> ::c_int1542     pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
1543                  child_stack: *mut ::c_void,
1544                  flags: ::c_int,
1545                  arg: *mut ::c_void, ...) -> ::c_int;
statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int1546     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int1547     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void1548     pub fn memrchr(cx: *const ::c_void,
1549                    c: ::c_int,
1550                    n: ::size_t) -> *mut ::c_void;
syscall(num: ::c_long, ...) -> ::c_long1551     pub fn syscall(num: ::c_long, ...) -> ::c_long;
sendfile(out_fd: ::c_int, in_fd: ::c_int, offset: *mut off_t, count: ::size_t) -> ::ssize_t1552     pub fn sendfile(out_fd: ::c_int,
1553                     in_fd: ::c_int,
1554                     offset: *mut off_t,
1555                     count: ::size_t) -> ::ssize_t;
splice(fd_in: ::c_int, off_in: *mut ::loff_t, fd_out: ::c_int, off_out: *mut ::loff_t, len: ::size_t, flags: ::c_uint) -> ::ssize_t1556     pub fn splice(fd_in: ::c_int,
1557                   off_in: *mut ::loff_t,
1558                   fd_out: ::c_int,
1559                   off_out: *mut ::loff_t,
1560                   len: ::size_t,
1561                   flags: ::c_uint) -> ::ssize_t;
tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t1562     pub fn tee(fd_in: ::c_int,
1563                fd_out: ::c_int,
1564                len: ::size_t,
1565                flags: ::c_uint) -> ::ssize_t;
vmsplice(fd: ::c_int, iov: *const ::iovec, nr_segs: ::size_t, flags: ::c_uint) -> ::ssize_t1566     pub fn vmsplice(fd: ::c_int,
1567                     iov: *const ::iovec,
1568                     nr_segs: ::size_t,
1569                     flags: ::c_uint) -> ::ssize_t;
1570 
posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int1571     pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
1572                          advise: ::c_int) -> ::c_int;
futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int1573     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
utimensat(dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int) -> ::c_int1574     pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
1575                      times: *const ::timespec, flag: ::c_int) -> ::c_int;
duplocale(base: ::locale_t) -> ::locale_t1576     pub fn duplocale(base: ::locale_t) -> ::locale_t;
freelocale(loc: ::locale_t)1577     pub fn freelocale(loc: ::locale_t);
newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t1578     pub fn newlocale(mask: ::c_int,
1579                      locale: *const ::c_char,
1580                      base: ::locale_t) -> ::locale_t;
uselocale(loc: ::locale_t) -> ::locale_t1581     pub fn uselocale(loc: ::locale_t) -> ::locale_t;
creat64(path: *const c_char, mode: mode_t) -> ::c_int1582     pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int1583     pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
fstatat64(fildes: ::c_int, path: *const ::c_char, buf: *mut stat64, flag: ::c_int) -> ::c_int1584     pub fn fstatat64(fildes: ::c_int, path: *const ::c_char,
1585                      buf: *mut stat64, flag: ::c_int) -> ::c_int;
ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int1586     pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int1587     pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t1588     pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int1589     pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
mmap64(addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off64_t) -> *mut ::c_void1590     pub fn mmap64(addr: *mut ::c_void,
1591                   len: ::size_t,
1592                   prot: ::c_int,
1593                   flags: ::c_int,
1594                   fd: ::c_int,
1595                   offset: off64_t)
1596                   -> *mut ::c_void;
open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int1597     pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
openat64(fd: ::c_int, path: *const c_char, oflag: ::c_int, ...) -> ::c_int1598     pub fn openat64(fd: ::c_int,
1599                     path: *const c_char,
1600                     oflag: ::c_int, ...) -> ::c_int;
pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off64_t) -> ::ssize_t1601     pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
1602                    offset: off64_t) -> ::ssize_t;
pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off64_t) -> ::ssize_t1603     pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
1604                     offset: off64_t) -> ::ssize_t;
readdir64(dirp: *mut ::DIR) -> *mut ::dirent641605     pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, result: *mut *mut ::dirent64) -> ::c_int1606     pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
1607                        result: *mut *mut ::dirent64) -> ::c_int;
setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int1608     pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
stat64(path: *const c_char, buf: *mut stat64) -> ::c_int1609     pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
truncate64(path: *const c_char, length: off64_t) -> ::c_int1610     pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int1611     pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
1612 
mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int1613     pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
1614                    mode: ::mode_t, dev: dev_t) -> ::c_int;
ppoll(fds: *mut ::pollfd, nfds: nfds_t, timeout: *const ::timespec, sigmask: *const sigset_t) -> ::c_int1615     pub fn ppoll(fds: *mut ::pollfd,
1616                  nfds: nfds_t,
1617                  timeout: *const ::timespec,
1618                  sigmask: *const sigset_t) -> ::c_int;
pthread_condattr_getclock(attr: *const pthread_condattr_t, clock_id: *mut clockid_t) -> ::c_int1619     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
1620                                      clock_id: *mut clockid_t) -> ::c_int;
pthread_condattr_setclock(attr: *mut pthread_condattr_t, clock_id: ::clockid_t) -> ::c_int1621     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
1622                                      clock_id: ::clockid_t) -> ::c_int;
pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int1623     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
1624                                        pshared: ::c_int) -> ::c_int;
pthread_condattr_getpshared(attr: *const pthread_condattr_t, pshared: *mut ::c_int) -> ::c_int1625     pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
1626                                        pshared: *mut ::c_int) -> ::c_int;
sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *mut cpu_set_t) -> ::c_int1627     pub fn sched_getaffinity(pid: ::pid_t,
1628                              cpusetsize: ::size_t,
1629                              cpuset: *mut cpu_set_t) -> ::c_int;
sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *const cpu_set_t) -> ::c_int1630     pub fn sched_setaffinity(pid: ::pid_t,
1631                              cpusetsize: ::size_t,
1632                              cpuset: *const cpu_set_t) -> ::c_int;
unshare(flags: ::c_int) -> ::c_int1633     pub fn unshare(flags: ::c_int) -> ::c_int;
sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int1634     pub fn sem_timedwait(sem: *mut sem_t,
1635                          abstime: *const ::timespec) -> ::c_int;
sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int1636     pub fn sem_getvalue(sem: *mut sem_t,
1637                         sval: *mut ::c_int) -> ::c_int;
accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t, flg: ::c_int) -> ::c_int1638     pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
1639                    flg: ::c_int) -> ::c_int;
pthread_mutex_timedlock(lock: *mut pthread_mutex_t, abstime: *const ::timespec) -> ::c_int1640     pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
1641                                    abstime: *const ::timespec) -> ::c_int;
pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: ::c_int) -> ::c_int1642     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
1643                                         pshared: ::c_int) -> ::c_int;
pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, pshared: *mut ::c_int) -> ::c_int1644     pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
1645                                         pshared: *mut ::c_int) -> ::c_int;
pthread_rwlockattr_getkind_np(attr: *const pthread_rwlockattr_t, val: *mut ::c_int) -> ::c_int1646     pub fn pthread_rwlockattr_getkind_np(attr: *const pthread_rwlockattr_t,
1647                                          val: *mut ::c_int) -> ::c_int;
pthread_rwlockattr_setkind_np(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int1648     pub fn pthread_rwlockattr_setkind_np(attr: *mut pthread_rwlockattr_t,
1649                                          val: ::c_int) -> ::c_int;
pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, val: *mut ::c_int) -> ::c_int1650     pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
1651                                          val: *mut ::c_int) -> ::c_int;
pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int1652     pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
1653                                          val: ::c_int) -> ::c_int;
ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int1654     pub fn ptsname_r(fd: ::c_int,
1655                      buf: *mut ::c_char,
1656                      buflen: ::size_t) -> ::c_int;
clearenv() -> ::c_int1657     pub fn clearenv() -> ::c_int;
waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int1658     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
1659                   options: ::c_int) -> ::c_int;
1660 
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int1661     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
1662 
setpwent()1663     pub fn setpwent();
endpwent()1664     pub fn endpwent();
getpwent() -> *mut passwd1665     pub fn getpwent() -> *mut passwd;
setspent()1666     pub fn setspent();
endspent()1667     pub fn endspent();
getspent() -> *mut spwd1668     pub fn getspent() -> *mut spwd;
getspnam(__name: *const ::c_char) -> *mut spwd1669     pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
1670 
shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int1671     pub fn shm_open(name: *const c_char, oflag: ::c_int,
1672                     mode: mode_t) -> ::c_int;
1673 
1674     // System V IPC
shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int1675     pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void1676     pub fn shmat(shmid: ::c_int,
1677                  shmaddr: *const ::c_void,
1678                  shmflg: ::c_int) -> *mut ::c_void;
shmdt(shmaddr: *const ::c_void) -> ::c_int1679     pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int1680     pub fn shmctl(shmid: ::c_int,
1681                   cmd: ::c_int,
1682                   buf: *mut ::shmid_ds) -> ::c_int;
ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t1683     pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int1684     pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int1685     pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t1686     pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
1687                   msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t;
msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, msgflg: ::c_int) -> ::c_int1688     pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
1689                   msgflg: ::c_int) -> ::c_int;
1690 
mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int1691     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
1692                     -> ::c_int;
__errno_location() -> *mut ::c_int1693     pub fn __errno_location() -> *mut ::c_int;
1694 
fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE1695     pub fn fopen64(filename: *const c_char,
1696                    mode: *const c_char) -> *mut ::FILE;
freopen64(filename: *const c_char, mode: *const c_char, file: *mut ::FILE) -> *mut ::FILE1697     pub fn freopen64(filename: *const c_char, mode: *const c_char,
1698                      file: *mut ::FILE) -> *mut ::FILE;
tmpfile64() -> *mut ::FILE1699     pub fn tmpfile64() -> *mut ::FILE;
fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int1700     pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int1701     pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int1702     pub fn fseeko64(stream: *mut ::FILE,
1703                     offset: ::off64_t,
1704                     whence: ::c_int) -> ::c_int;
ftello64(stream: *mut ::FILE) -> ::off64_t1705     pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t1706     pub fn readahead(fd: ::c_int, offset: ::off64_t,
1707                      count: ::size_t) -> ::ssize_t;
getxattr(path: *const c_char, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t1708     pub fn getxattr(path: *const c_char, name: *const c_char,
1709                     value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
lgetxattr(path: *const c_char, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t1710     pub fn lgetxattr(path: *const c_char, name: *const c_char,
1711                      value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
fgetxattr(filedes: ::c_int, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t1712     pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
1713                      value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
setxattr(path: *const c_char, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int1714     pub fn setxattr(path: *const c_char, name: *const c_char,
1715                     value: *const ::c_void, size: ::size_t,
1716                     flags: ::c_int) -> ::c_int;
lsetxattr(path: *const c_char, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int1717     pub fn lsetxattr(path: *const c_char, name: *const c_char,
1718                      value: *const ::c_void, size: ::size_t,
1719                      flags: ::c_int) -> ::c_int;
fsetxattr(filedes: ::c_int, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int1720     pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
1721                      value: *const ::c_void, size: ::size_t,
1722                      flags: ::c_int) -> ::c_int;
listxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t1723     pub fn listxattr(path: *const c_char, list: *mut c_char,
1724                      size: ::size_t) -> ::ssize_t;
llistxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t1725     pub fn llistxattr(path: *const c_char, list: *mut c_char,
1726                       size: ::size_t) -> ::ssize_t;
flistxattr(filedes: ::c_int, list: *mut c_char, size: ::size_t) -> ::ssize_t1727     pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
1728                       size: ::size_t) -> ::ssize_t;
removexattr(path: *const c_char, name: *const c_char) -> ::c_int1729     pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int1730     pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int1731     pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int1732     pub fn signalfd(fd: ::c_int,
1733                     mask: *const ::sigset_t,
1734                     flags: ::c_int) -> ::c_int;
quotactl(cmd: ::c_int, special: *const ::c_char, id: ::c_int, data: *mut ::c_char) -> ::c_int1735     pub fn quotactl(cmd: ::c_int,
1736                     special: *const ::c_char,
1737                     id: ::c_int,
1738                     data: *mut ::c_char) -> ::c_int;
mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t1739     pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
mq_close(mqd: ::mqd_t) -> ::c_int1740     pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
mq_unlink(name: *const ::c_char) -> ::c_int1741     pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
mq_receive(mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msq_prio: *mut ::c_uint) -> ::ssize_t1742     pub fn mq_receive(mqd: ::mqd_t,
1743                       msg_ptr: *mut ::c_char,
1744                       msg_len: ::size_t,
1745                       msq_prio: *mut ::c_uint) -> ::ssize_t;
mq_send(mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msq_prio: ::c_uint) -> ::c_int1746     pub fn mq_send(mqd: ::mqd_t,
1747                    msg_ptr: *const ::c_char,
1748                    msg_len: ::size_t,
1749                    msq_prio: ::c_uint) -> ::c_int;
mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int1750     pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int1751     pub fn mq_setattr(mqd: ::mqd_t,
1752                       newattr: *const ::mq_attr,
1753                       oldattr: *mut ::mq_attr) -> ::c_int;
epoll_pwait(epfd: ::c_int, events: *mut ::epoll_event, maxevents: ::c_int, timeout: ::c_int, sigmask: *const ::sigset_t) -> ::c_int1754     pub fn epoll_pwait(epfd: ::c_int,
1755                        events: *mut ::epoll_event,
1756                        maxevents: ::c_int,
1757                        timeout: ::c_int,
1758                        sigmask: *const ::sigset_t) -> ::c_int;
sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int1759     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
sigtimedwait(set: *const sigset_t, info: *mut siginfo_t, timeout: *const ::timespec) -> ::c_int1760     pub fn sigtimedwait(set: *const sigset_t,
1761                         info: *mut siginfo_t,
1762                         timeout: *const ::timespec) -> ::c_int;
sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int1763     pub fn sigwaitinfo(set: *const sigset_t,
1764                        info: *mut siginfo_t) -> ::c_int;
nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char1765     pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit, old_limit: *mut ::rlimit) -> ::c_int1766     pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit,
1767                    old_limit: *mut ::rlimit) -> ::c_int;
prlimit64(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit64, old_limit: *mut ::rlimit64) -> ::c_int1768     pub fn prlimit64(pid: ::pid_t,
1769                      resource: ::c_int,
1770                      new_limit: *const ::rlimit64,
1771                      old_limit: *mut ::rlimit64) -> ::c_int;
reboot(how_to: ::c_int) -> ::c_int1772     pub fn reboot(how_to: ::c_int) -> ::c_int;
setfsgid(gid: ::gid_t) -> ::c_int1773     pub fn setfsgid(gid: ::gid_t) -> ::c_int;
setfsuid(uid: ::uid_t) -> ::c_int1774     pub fn setfsuid(uid: ::uid_t) -> ::c_int;
setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int1775     pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int1776     pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
1777 
1778     // Not available now on Android
mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int1779     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
1780                     mode: ::mode_t) -> ::c_int;
if_nameindex() -> *mut if_nameindex1781     pub fn if_nameindex() -> *mut if_nameindex;
if_freenameindex(ptr: *mut if_nameindex)1782     pub fn if_freenameindex(ptr: *mut if_nameindex);
sync_file_range(fd: ::c_int, offset: ::off64_t, nbytes: ::off64_t, flags: ::c_uint) -> ::c_int1783     pub fn sync_file_range(fd: ::c_int, offset: ::off64_t,
1784                            nbytes: ::off64_t, flags: ::c_uint) -> ::c_int;
getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int1785     pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
freeifaddrs(ifa: *mut ::ifaddrs)1786     pub fn freeifaddrs(ifa: *mut ::ifaddrs);
1787 
mremap(addr: *mut ::c_void, len: ::size_t, new_len: ::size_t, flags: ::c_int, ...) -> *mut ::c_void1788     pub fn mremap(addr: *mut ::c_void,
1789                   len: ::size_t,
1790                   new_len: ::size_t,
1791                   flags: ::c_int,
1792                   ...) -> *mut ::c_void;
1793 
glob(pattern: *const c_char, flags: ::c_int, errfunc: ::Option<extern fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int1794     pub fn glob(pattern: *const c_char,
1795                 flags: ::c_int,
1796                 errfunc: ::Option<extern fn(epath: *const c_char,
1797                                           errno: ::c_int) -> ::c_int>,
1798                 pglob: *mut ::glob_t) -> ::c_int;
globfree(pglob: *mut ::glob_t)1799     pub fn globfree(pglob: *mut ::glob_t);
1800 
shm_unlink(name: *const ::c_char) -> ::c_int1801     pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1802 
seekdir(dirp: *mut ::DIR, loc: ::c_long)1803     pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
1804 
dirfd(dirp: *mut ::DIR) -> ::c_int1805     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
1806 
telldir(dirp: *mut ::DIR) -> ::c_long1807     pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1808     pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
1809                   -> ::c_int;
1810 
msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int1811     pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
1812 
recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::ssize_t1813     pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
1814                     flags: ::c_int, addr: *mut ::sockaddr,
1815                     addrlen: *mut ::socklen_t) -> ::ssize_t;
nl_langinfo(item: ::nl_item) -> *mut ::c_char1816     pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
1817 
bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int1818     pub fn bind(socket: ::c_int, address: *const ::sockaddr,
1819                 address_len: ::socklen_t) -> ::c_int;
1820 
writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t1821     pub fn writev(fd: ::c_int,
1822                   iov: *const ::iovec,
1823                   iovcnt: ::c_int) -> ::ssize_t;
readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t1824     pub fn readv(fd: ::c_int,
1825                  iov: *const ::iovec,
1826                  iovcnt: ::c_int) -> ::ssize_t;
1827 
sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t1828     pub fn sendmsg(fd: ::c_int,
1829                    msg: *const ::msghdr,
1830                    flags: ::c_int) -> ::ssize_t;
recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t1831     pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
1832                    -> ::ssize_t;
1833     #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
getgrgid_r(uid: ::uid_t, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int1834     pub fn getgrgid_r(uid: ::uid_t,
1835                       grp: *mut ::group,
1836                       buf: *mut ::c_char,
1837                       buflen: ::size_t,
1838                       result: *mut *mut ::group) -> ::c_int;
1839     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1840                link_name = "sigaltstack$UNIX2003")]
1841     #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int1842     pub fn sigaltstack(ss: *const stack_t,
1843                        oss: *mut stack_t) -> ::c_int;
sem_close(sem: *mut sem_t) -> ::c_int1844     pub fn sem_close(sem: *mut sem_t) -> ::c_int;
getdtablesize() -> ::c_int1845     pub fn getdtablesize() -> ::c_int;
1846     #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
getgrnam_r(name: *const ::c_char, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int1847     pub fn getgrnam_r(name: *const ::c_char,
1848                       grp: *mut ::group,
1849                       buf: *mut ::c_char,
1850                       buflen: ::size_t,
1851                       result: *mut *mut ::group) -> ::c_int;
1852     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1853                link_name = "pthread_sigmask$UNIX2003")]
pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1854     pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
1855                            oldset: *mut sigset_t) -> ::c_int;
sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t1856     pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
getgrnam(name: *const ::c_char) -> *mut ::group1857     pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int1858     pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
sem_unlink(name: *const ::c_char) -> ::c_int1859     pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int1860     pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
1861     #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
1862     #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
getpwnam_r(name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int1863     pub fn getpwnam_r(name: *const ::c_char,
1864                       pwd: *mut passwd,
1865                       buf: *mut ::c_char,
1866                       buflen: ::size_t,
1867                       result: *mut *mut passwd) -> ::c_int;
1868     #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
1869     #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int1870     pub fn getpwuid_r(uid: ::uid_t,
1871                       pwd: *mut passwd,
1872                       buf: *mut ::c_char,
1873                       buflen: ::size_t,
1874                       result: *mut *mut passwd) -> ::c_int;
1875     #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
1876                link_name = "sigwait$UNIX2003")]
1877     #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int1878     pub fn sigwait(set: *const sigset_t,
1879                    sig: *mut ::c_int) -> ::c_int;
pthread_atfork(prepare: ::Option<unsafe extern fn()>, parent: ::Option<unsafe extern fn()>, child: ::Option<unsafe extern fn()>) -> ::c_int1880     pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>,
1881                           parent: ::Option<unsafe extern fn()>,
1882                           child: ::Option<unsafe extern fn()>) -> ::c_int;
pthread_create(native: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int1883     pub fn pthread_create(native: *mut ::pthread_t,
1884                           attr: *const ::pthread_attr_t,
1885                           f: extern fn(*mut ::c_void) -> *mut ::c_void,
1886                           value: *mut ::c_void) -> ::c_int;
getgrgid(gid: ::gid_t) -> *mut ::group1887     pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
1888     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1889                link_name = "popen$UNIX2003")]
popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE1890     pub fn popen(command: *const c_char,
1891                  mode: *const c_char) -> *mut ::FILE;
uname(buf: *mut ::utsname) -> ::c_int1892     pub fn uname(buf: *mut ::utsname) -> ::c_int;
1893 }
1894 
1895 cfg_if! {
1896     if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
1897         mod mips;
1898         pub use self::mips::*;
1899     } else if #[cfg(target_arch = "x86_64")] {
1900         mod x86_64;
1901         pub use self::x86_64::*;
1902     } else {
1903         pub use unsupported_target;
1904     }
1905 }
1906 
1907 cfg_if! {
1908     if #[cfg(libc_align)] {
1909         #[macro_use]
1910         mod align;
1911     } else {
1912         #[macro_use]
1913         mod no_align;
1914     }
1915 }
1916 
1917 expand_align!();
1918