1 pub type sa_family_t = u16;
2 pub type speed_t = ::c_uint;
3 pub type tcflag_t = ::c_uint;
4 pub type clockid_t = ::c_int;
5 pub type key_t = ::c_int;
6 pub type id_t = ::c_uint;
7 
8 #[cfg_attr(feature = "extra_traits", derive(Debug))]
9 pub enum timezone {}
10 impl ::Copy for timezone {}
11 impl ::Clone for timezone {
clone(&self) -> timezone12     fn clone(&self) -> timezone { *self }
13 }
14 
15 s! {
16     pub struct in_addr {
17         pub s_addr: ::in_addr_t,
18     }
19 
20     pub struct ip_mreq {
21         pub imr_multiaddr: in_addr,
22         pub imr_interface: in_addr,
23     }
24 
25     pub struct sockaddr {
26         pub sa_family: sa_family_t,
27         pub sa_data: [::c_char; 14],
28     }
29 
30     pub struct sockaddr_in {
31         pub sin_family: sa_family_t,
32         pub sin_port: ::in_port_t,
33         pub sin_addr: ::in_addr,
34         pub sin_zero: [u8; 8],
35     }
36 
37     pub struct sockaddr_in6 {
38         pub sin6_family: sa_family_t,
39         pub sin6_port: ::in_port_t,
40         pub sin6_flowinfo: u32,
41         pub sin6_addr: ::in6_addr,
42         pub sin6_scope_id: u32,
43     }
44 
45     pub struct addrinfo {
46         pub ai_flags: ::c_int,
47         pub ai_family: ::c_int,
48         pub ai_socktype: ::c_int,
49         pub ai_protocol: ::c_int,
50         pub ai_addrlen: socklen_t,
51 
52         #[cfg(any(target_os = "linux",
53                   target_os = "emscripten"))]
54         pub ai_addr: *mut ::sockaddr,
55 
56         pub ai_canonname: *mut c_char,
57 
58         #[cfg(target_os = "android")]
59         pub ai_addr: *mut ::sockaddr,
60 
61         pub ai_next: *mut addrinfo,
62     }
63 
64     pub struct sockaddr_ll {
65         pub sll_family: ::c_ushort,
66         pub sll_protocol: ::c_ushort,
67         pub sll_ifindex: ::c_int,
68         pub sll_hatype: ::c_ushort,
69         pub sll_pkttype: ::c_uchar,
70         pub sll_halen: ::c_uchar,
71         pub sll_addr: [::c_uchar; 8]
72     }
73 
74     pub struct fd_set {
75         fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
76     }
77 
78     pub struct tm {
79         pub tm_sec: ::c_int,
80         pub tm_min: ::c_int,
81         pub tm_hour: ::c_int,
82         pub tm_mday: ::c_int,
83         pub tm_mon: ::c_int,
84         pub tm_year: ::c_int,
85         pub tm_wday: ::c_int,
86         pub tm_yday: ::c_int,
87         pub tm_isdst: ::c_int,
88         pub tm_gmtoff: ::c_long,
89         pub tm_zone: *const ::c_char,
90     }
91 
92     pub struct sched_param {
93         pub sched_priority: ::c_int,
94         #[cfg(any(target_env = "musl", target_os = "emscripten"))]
95         pub sched_ss_low_priority: ::c_int,
96         #[cfg(any(target_env = "musl", target_os = "emscripten"))]
97         pub sched_ss_repl_period: ::timespec,
98         #[cfg(any(target_env = "musl", target_os = "emscripten"))]
99         pub sched_ss_init_budget: ::timespec,
100         #[cfg(any(target_env = "musl", target_os = "emscripten"))]
101         pub sched_ss_max_repl: ::c_int,
102     }
103 
104     pub struct Dl_info {
105         pub dli_fname: *const ::c_char,
106         pub dli_fbase: *mut ::c_void,
107         pub dli_sname: *const ::c_char,
108         pub dli_saddr: *mut ::c_void,
109     }
110 
111     pub struct lconv {
112         pub decimal_point: *mut ::c_char,
113         pub thousands_sep: *mut ::c_char,
114         pub grouping: *mut ::c_char,
115         pub int_curr_symbol: *mut ::c_char,
116         pub currency_symbol: *mut ::c_char,
117         pub mon_decimal_point: *mut ::c_char,
118         pub mon_thousands_sep: *mut ::c_char,
119         pub mon_grouping: *mut ::c_char,
120         pub positive_sign: *mut ::c_char,
121         pub negative_sign: *mut ::c_char,
122         pub int_frac_digits: ::c_char,
123         pub frac_digits: ::c_char,
124         pub p_cs_precedes: ::c_char,
125         pub p_sep_by_space: ::c_char,
126         pub n_cs_precedes: ::c_char,
127         pub n_sep_by_space: ::c_char,
128         pub p_sign_posn: ::c_char,
129         pub n_sign_posn: ::c_char,
130         pub int_p_cs_precedes: ::c_char,
131         pub int_p_sep_by_space: ::c_char,
132         pub int_n_cs_precedes: ::c_char,
133         pub int_n_sep_by_space: ::c_char,
134         pub int_p_sign_posn: ::c_char,
135         pub int_n_sign_posn: ::c_char,
136     }
137 
138     pub struct sigevent {
139         pub sigev_value: ::sigval,
140         pub sigev_signo: ::c_int,
141         pub sigev_notify: ::c_int,
142         // Actually a union.  We only expose sigev_notify_thread_id because it's
143         // the most useful member
144         pub sigev_notify_thread_id: ::c_int,
145         #[cfg(target_pointer_width = "64")]
146         __unused1: [::c_int; 11],
147         #[cfg(target_pointer_width = "32")]
148         __unused1: [::c_int; 12]
149     }
150 
151     pub struct in_pktinfo {
152         pub ipi_ifindex: ::c_int,
153         pub ipi_spec_dst: ::in_addr,
154         pub ipi_addr: ::in_addr,
155     }
156 
157     pub struct ifaddrs {
158         pub ifa_next: *mut ifaddrs,
159         pub ifa_name: *mut c_char,
160         pub ifa_flags: ::c_uint,
161         pub ifa_addr: *mut ::sockaddr,
162         pub ifa_netmask: *mut ::sockaddr,
163         pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
164         pub ifa_data: *mut ::c_void
165     }
166 
167     pub struct in6_rtmsg {
168         rtmsg_dst: ::in6_addr,
169         rtmsg_src: ::in6_addr,
170         rtmsg_gateway: ::in6_addr,
171         rtmsg_type: u32,
172         rtmsg_dst_len: u16,
173         rtmsg_src_len: u16,
174         rtmsg_metric: u32,
175         rtmsg_info: ::c_ulong,
176         rtmsg_flags: u32,
177         rtmsg_ifindex: ::c_int,
178     }
179 
180     pub struct arpreq {
181         pub arp_pa: ::sockaddr,
182         pub arp_ha: ::sockaddr,
183         pub arp_flags: ::c_int,
184         pub arp_netmask: ::sockaddr,
185         pub arp_dev: [::c_char; 16],
186     }
187 
188     pub struct arpreq_old {
189         pub arp_pa: ::sockaddr,
190         pub arp_ha: ::sockaddr,
191         pub arp_flags: ::c_int,
192         pub arp_netmask: ::sockaddr,
193     }
194 
195     pub struct arphdr {
196         pub ar_hrd: u16,
197         pub ar_pro: u16,
198         pub ar_hln: u8,
199         pub ar_pln: u8,
200         pub ar_op: u16,
201     }
202 
203     pub struct mmsghdr {
204         pub msg_hdr: ::msghdr,
205         pub msg_len: ::c_uint,
206     }
207 }
208 
209 s_no_extra_traits!{
210     #[cfg_attr(
211         any(
212             all(
213                 target_arch = "x86",
214                 not(target_env = "musl"),
215                 not(target_os = "android")),
216             target_arch = "x86_64"),
217         repr(packed))]
218     pub struct epoll_event {
219         pub events: u32,
220         pub u64: u64,
221     }
222 
223     pub struct sockaddr_un {
224         pub sun_family: sa_family_t,
225         pub sun_path: [::c_char; 108]
226     }
227 
228     pub struct sockaddr_storage {
229         pub ss_family: sa_family_t,
230         __ss_align: ::size_t,
231         #[cfg(target_pointer_width = "32")]
232         __ss_pad2: [u8; 128 - 2 * 4],
233         #[cfg(target_pointer_width = "64")]
234         __ss_pad2: [u8; 128 - 2 * 8],
235     }
236 
237     pub struct utsname {
238         pub sysname: [::c_char; 65],
239         pub nodename: [::c_char; 65],
240         pub release: [::c_char; 65],
241         pub version: [::c_char; 65],
242         pub machine: [::c_char; 65],
243         pub domainname: [::c_char; 65]
244     }
245 }
246 
247 cfg_if! {
248     if #[cfg(feature = "extra_traits")] {
249         impl PartialEq for epoll_event {
250             fn eq(&self, other: &epoll_event) -> bool {
251                 self.events == other.events
252                     && self.u64 == other.u64
253             }
254         }
255         impl Eq for epoll_event {}
256         impl ::fmt::Debug for epoll_event {
257             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
258                 let events = self.events;
259                 let u64 = self.u64;
260                 f.debug_struct("epoll_event")
261                     .field("events", &events)
262                     .field("u64", &u64)
263                     .finish()
264             }
265         }
266         impl ::hash::Hash for epoll_event {
267             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
268                 let events = self.events;
269                 let u64 = self.u64;
270                 events.hash(state);
271                 u64.hash(state);
272             }
273         }
274 
275         impl PartialEq for sockaddr_un {
276             fn eq(&self, other: &sockaddr_un) -> bool {
277                 self.sun_family == other.sun_family
278                     && self
279                     .sun_path
280                     .iter()
281                     .zip(other.sun_path.iter())
282                     .all(|(a, b)| a == b)
283             }
284         }
285         impl Eq for sockaddr_un {}
286         impl ::fmt::Debug for sockaddr_un {
287             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
288                 f.debug_struct("sockaddr_un")
289                     .field("sun_family", &self.sun_family)
290                 // FIXME: .field("sun_path", &self.sun_path)
291                     .finish()
292             }
293         }
294         impl ::hash::Hash for sockaddr_un {
295             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
296                 self.sun_family.hash(state);
297                 self.sun_path.hash(state);
298             }
299         }
300 
301         impl PartialEq for sockaddr_storage {
302             fn eq(&self, other: &sockaddr_storage) -> bool {
303                 self.ss_family == other.ss_family
304                     && self
305                     .__ss_pad2
306                     .iter()
307                     .zip(other.__ss_pad2.iter())
308                     .all(|(a, b)| a == b)
309             }
310         }
311 
312         impl Eq for sockaddr_storage {}
313 
314         impl ::fmt::Debug for sockaddr_storage {
315             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
316                 f.debug_struct("sockaddr_storage")
317                     .field("ss_family", &self.ss_family)
318                     .field("__ss_align", &self.__ss_align)
319                 // FIXME: .field("__ss_pad2", &self.__ss_pad2)
320                     .finish()
321             }
322         }
323 
324         impl ::hash::Hash for sockaddr_storage {
325             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
326                 self.ss_family.hash(state);
327                 self.__ss_pad2.hash(state);
328             }
329         }
330 
331         impl PartialEq for utsname {
332             fn eq(&self, other: &utsname) -> bool {
333                 self.sysname
334                     .iter()
335                     .zip(other.sysname.iter())
336                     .all(|(a, b)| a == b)
337                     && self
338                     .nodename
339                     .iter()
340                     .zip(other.nodename.iter())
341                     .all(|(a, b)| a == b)
342                     && self
343                     .release
344                     .iter()
345                     .zip(other.release.iter())
346                     .all(|(a, b)| a == b)
347                     && self
348                     .version
349                     .iter()
350                     .zip(other.version.iter())
351                     .all(|(a, b)| a == b)
352                     && self
353                     .machine
354                     .iter()
355                     .zip(other.machine.iter())
356                     .all(|(a, b)| a == b)
357                     && self
358                     .domainname
359                     .iter()
360                     .zip(other.domainname.iter())
361                     .all(|(a, b)| a == b)
362             }
363         }
364 
365         impl Eq for utsname {}
366 
367         impl ::fmt::Debug for utsname {
368             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
369                 f.debug_struct("utsname")
370                 // FIXME: .field("sysname", &self.sysname)
371                 // FIXME: .field("nodename", &self.nodename)
372                 // FIXME: .field("release", &self.release)
373                 // FIXME: .field("version", &self.version)
374                 // FIXME: .field("machine", &self.machine)
375                 // FIXME: .field("domainname", &self.domainname)
376                     .finish()
377             }
378         }
379 
380         impl ::hash::Hash for utsname {
381             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
382                 self.sysname.hash(state);
383                 self.nodename.hash(state);
384                 self.release.hash(state);
385                 self.version.hash(state);
386                 self.machine.hash(state);
387                 self.domainname.hash(state);
388             }
389         }
390     }
391 }
392 
393 // intentionally not public, only used for fd_set
394 cfg_if! {
395     if #[cfg(target_pointer_width = "32")] {
396         const ULONG_SIZE: usize = 32;
397     } else if #[cfg(target_pointer_width = "64")] {
398         const ULONG_SIZE: usize = 64;
399     } else {
400         // Unknown target_pointer_width
401     }
402 }
403 
404 pub const EXIT_FAILURE: ::c_int = 1;
405 pub const EXIT_SUCCESS: ::c_int = 0;
406 pub const RAND_MAX: ::c_int = 2147483647;
407 pub const EOF: ::c_int = -1;
408 pub const SEEK_SET: ::c_int = 0;
409 pub const SEEK_CUR: ::c_int = 1;
410 pub const SEEK_END: ::c_int = 2;
411 pub const _IOFBF: ::c_int = 0;
412 pub const _IONBF: ::c_int = 2;
413 pub const _IOLBF: ::c_int = 1;
414 
415 pub const F_DUPFD: ::c_int = 0;
416 pub const F_GETFD: ::c_int = 1;
417 pub const F_SETFD: ::c_int = 2;
418 pub const F_GETFL: ::c_int = 3;
419 pub const F_SETFL: ::c_int = 4;
420 
421 // Linux-specific fcntls
422 pub const F_SETLEASE: ::c_int = 1024;
423 pub const F_GETLEASE: ::c_int = 1025;
424 pub const F_NOTIFY: ::c_int = 1026;
425 pub const F_CANCELLK: ::c_int = 1029;
426 pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
427 pub const F_SETPIPE_SZ: ::c_int = 1031;
428 pub const F_GETPIPE_SZ: ::c_int = 1032;
429 pub const F_ADD_SEALS: ::c_int = 1033;
430 pub const F_GET_SEALS: ::c_int = 1034;
431 
432 pub const F_SEAL_SEAL: ::c_int = 0x0001;
433 pub const F_SEAL_SHRINK: ::c_int = 0x0002;
434 pub const F_SEAL_GROW: ::c_int = 0x0004;
435 pub const F_SEAL_WRITE: ::c_int = 0x0008;
436 
437 // TODO(#235): Include file sealing fcntls once we have a way to verify them.
438 
439 pub const SIGTRAP: ::c_int = 5;
440 
441 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
442 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
443 
444 pub const CLOCK_REALTIME: ::clockid_t = 0;
445 pub const CLOCK_MONOTONIC: ::clockid_t = 1;
446 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
447 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
448 pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4;
449 pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5;
450 pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
451 pub const CLOCK_BOOTTIME: ::clockid_t = 7;
452 pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8;
453 pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9;
454 // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
455 // 2014.) See also musl/mod.rs
456 // pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
457 // pub const CLOCK_TAI: ::clockid_t = 11;
458 pub const TIMER_ABSTIME: ::c_int = 1;
459 
460 pub const RUSAGE_SELF: ::c_int = 0;
461 
462 pub const O_RDONLY: ::c_int = 0;
463 pub const O_WRONLY: ::c_int = 1;
464 pub const O_RDWR: ::c_int = 2;
465 
466 pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
467 
468 pub const S_IFIFO: ::mode_t = 4096;
469 pub const S_IFCHR: ::mode_t = 8192;
470 pub const S_IFBLK: ::mode_t = 24576;
471 pub const S_IFDIR: ::mode_t = 16384;
472 pub const S_IFREG: ::mode_t = 32768;
473 pub const S_IFLNK: ::mode_t = 40960;
474 pub const S_IFSOCK: ::mode_t = 49152;
475 pub const S_IFMT: ::mode_t = 61440;
476 pub const S_IRWXU: ::mode_t = 448;
477 pub const S_IXUSR: ::mode_t = 64;
478 pub const S_IWUSR: ::mode_t = 128;
479 pub const S_IRUSR: ::mode_t = 256;
480 pub const S_IRWXG: ::mode_t = 56;
481 pub const S_IXGRP: ::mode_t = 8;
482 pub const S_IWGRP: ::mode_t = 16;
483 pub const S_IRGRP: ::mode_t = 32;
484 pub const S_IRWXO: ::mode_t = 7;
485 pub const S_IXOTH: ::mode_t = 1;
486 pub const S_IWOTH: ::mode_t = 2;
487 pub const S_IROTH: ::mode_t = 4;
488 pub const F_OK: ::c_int = 0;
489 pub const R_OK: ::c_int = 4;
490 pub const W_OK: ::c_int = 2;
491 pub const X_OK: ::c_int = 1;
492 pub const STDIN_FILENO: ::c_int = 0;
493 pub const STDOUT_FILENO: ::c_int = 1;
494 pub const STDERR_FILENO: ::c_int = 2;
495 pub const SIGHUP: ::c_int = 1;
496 pub const SIGINT: ::c_int = 2;
497 pub const SIGQUIT: ::c_int = 3;
498 pub const SIGILL: ::c_int = 4;
499 pub const SIGABRT: ::c_int = 6;
500 pub const SIGFPE: ::c_int = 8;
501 pub const SIGKILL: ::c_int = 9;
502 pub const SIGSEGV: ::c_int = 11;
503 pub const SIGPIPE: ::c_int = 13;
504 pub const SIGALRM: ::c_int = 14;
505 pub const SIGTERM: ::c_int = 15;
506 
507 pub const PROT_NONE: ::c_int = 0;
508 pub const PROT_READ: ::c_int = 1;
509 pub const PROT_WRITE: ::c_int = 2;
510 pub const PROT_EXEC: ::c_int = 4;
511 
512 pub const LC_CTYPE: ::c_int = 0;
513 pub const LC_NUMERIC: ::c_int = 1;
514 pub const LC_TIME: ::c_int = 2;
515 pub const LC_COLLATE: ::c_int = 3;
516 pub const LC_MONETARY: ::c_int = 4;
517 pub const LC_MESSAGES: ::c_int = 5;
518 pub const LC_ALL: ::c_int = 6;
519 pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
520 pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
521 pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
522 pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
523 pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
524 pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
525 // LC_ALL_MASK defined per platform
526 
527 pub const MAP_FILE: ::c_int = 0x0000;
528 pub const MAP_SHARED: ::c_int = 0x0001;
529 pub const MAP_PRIVATE: ::c_int = 0x0002;
530 pub const MAP_FIXED: ::c_int = 0x0010;
531 
532 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
533 
534 // MS_ flags for msync(2)
535 pub const MS_ASYNC: ::c_int = 0x0001;
536 pub const MS_INVALIDATE: ::c_int = 0x0002;
537 pub const MS_SYNC: ::c_int = 0x0004;
538 
539 // MS_ flags for mount(2)
540 pub const MS_RDONLY: ::c_ulong = 0x01;
541 pub const MS_NOSUID: ::c_ulong = 0x02;
542 pub const MS_NODEV: ::c_ulong = 0x04;
543 pub const MS_NOEXEC: ::c_ulong = 0x08;
544 pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
545 pub const MS_REMOUNT: ::c_ulong = 0x20;
546 pub const MS_MANDLOCK: ::c_ulong = 0x40;
547 pub const MS_DIRSYNC: ::c_ulong = 0x80;
548 pub const MS_NOATIME: ::c_ulong = 0x0400;
549 pub const MS_NODIRATIME: ::c_ulong = 0x0800;
550 pub const MS_BIND: ::c_ulong = 0x1000;
551 pub const MS_MOVE: ::c_ulong = 0x2000;
552 pub const MS_REC: ::c_ulong = 0x4000;
553 pub const MS_SILENT: ::c_ulong = 0x8000;
554 pub const MS_POSIXACL: ::c_ulong = 0x010000;
555 pub const MS_UNBINDABLE: ::c_ulong = 0x020000;
556 pub const MS_PRIVATE: ::c_ulong = 0x040000;
557 pub const MS_SLAVE: ::c_ulong = 0x080000;
558 pub const MS_SHARED: ::c_ulong = 0x100000;
559 pub const MS_RELATIME: ::c_ulong = 0x200000;
560 pub const MS_KERNMOUNT: ::c_ulong = 0x400000;
561 pub const MS_I_VERSION: ::c_ulong = 0x800000;
562 pub const MS_STRICTATIME: ::c_ulong = 0x1000000;
563 pub const MS_ACTIVE: ::c_ulong = 0x40000000;
564 pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
565 pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
566 
567 pub const EPERM: ::c_int = 1;
568 pub const ENOENT: ::c_int = 2;
569 pub const ESRCH: ::c_int = 3;
570 pub const EINTR: ::c_int = 4;
571 pub const EIO: ::c_int = 5;
572 pub const ENXIO: ::c_int = 6;
573 pub const E2BIG: ::c_int = 7;
574 pub const ENOEXEC: ::c_int = 8;
575 pub const EBADF: ::c_int = 9;
576 pub const ECHILD: ::c_int = 10;
577 pub const EAGAIN: ::c_int = 11;
578 pub const ENOMEM: ::c_int = 12;
579 pub const EACCES: ::c_int = 13;
580 pub const EFAULT: ::c_int = 14;
581 pub const ENOTBLK: ::c_int = 15;
582 pub const EBUSY: ::c_int = 16;
583 pub const EEXIST: ::c_int = 17;
584 pub const EXDEV: ::c_int = 18;
585 pub const ENODEV: ::c_int = 19;
586 pub const ENOTDIR: ::c_int = 20;
587 pub const EISDIR: ::c_int = 21;
588 pub const EINVAL: ::c_int = 22;
589 pub const ENFILE: ::c_int = 23;
590 pub const EMFILE: ::c_int = 24;
591 pub const ENOTTY: ::c_int = 25;
592 pub const ETXTBSY: ::c_int = 26;
593 pub const EFBIG: ::c_int = 27;
594 pub const ENOSPC: ::c_int = 28;
595 pub const ESPIPE: ::c_int = 29;
596 pub const EROFS: ::c_int = 30;
597 pub const EMLINK: ::c_int = 31;
598 pub const EPIPE: ::c_int = 32;
599 pub const EDOM: ::c_int = 33;
600 pub const ERANGE: ::c_int = 34;
601 pub const EWOULDBLOCK: ::c_int = EAGAIN;
602 
603 pub const SCM_RIGHTS: ::c_int = 0x01;
604 pub const SCM_CREDENTIALS: ::c_int = 0x02;
605 
606 pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
607 pub const PROT_GROWSUP: ::c_int = 0x2000000;
608 
609 pub const MAP_TYPE: ::c_int = 0x000f;
610 
611 pub const MADV_NORMAL: ::c_int = 0;
612 pub const MADV_RANDOM: ::c_int = 1;
613 pub const MADV_SEQUENTIAL: ::c_int = 2;
614 pub const MADV_WILLNEED: ::c_int = 3;
615 pub const MADV_DONTNEED: ::c_int = 4;
616 pub const MADV_FREE: ::c_int = 8;
617 pub const MADV_REMOVE: ::c_int = 9;
618 pub const MADV_DONTFORK: ::c_int = 10;
619 pub const MADV_DOFORK: ::c_int = 11;
620 pub const MADV_MERGEABLE: ::c_int = 12;
621 pub const MADV_UNMERGEABLE: ::c_int = 13;
622 pub const MADV_HUGEPAGE: ::c_int = 14;
623 pub const MADV_NOHUGEPAGE: ::c_int = 15;
624 pub const MADV_DONTDUMP: ::c_int = 16;
625 pub const MADV_DODUMP: ::c_int = 17;
626 pub const MADV_HWPOISON: ::c_int = 100;
627 
628 pub const IFF_UP: ::c_int = 0x1;
629 pub const IFF_BROADCAST: ::c_int = 0x2;
630 pub const IFF_DEBUG: ::c_int = 0x4;
631 pub const IFF_LOOPBACK: ::c_int = 0x8;
632 pub const IFF_POINTOPOINT: ::c_int = 0x10;
633 pub const IFF_NOTRAILERS: ::c_int = 0x20;
634 pub const IFF_RUNNING: ::c_int = 0x40;
635 pub const IFF_NOARP: ::c_int = 0x80;
636 pub const IFF_PROMISC: ::c_int = 0x100;
637 pub const IFF_ALLMULTI: ::c_int = 0x200;
638 pub const IFF_MASTER: ::c_int = 0x400;
639 pub const IFF_SLAVE: ::c_int = 0x800;
640 pub const IFF_MULTICAST: ::c_int = 0x1000;
641 pub const IFF_PORTSEL: ::c_int = 0x2000;
642 pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
643 pub const IFF_DYNAMIC: ::c_int = 0x8000;
644 
645 pub const SOL_IP: ::c_int = 0;
646 pub const SOL_TCP: ::c_int = 6;
647 pub const SOL_UDP: ::c_int = 17;
648 pub const SOL_IPV6: ::c_int = 41;
649 pub const SOL_ICMPV6: ::c_int = 58;
650 pub const SOL_RAW: ::c_int = 255;
651 pub const SOL_DECNET: ::c_int = 261;
652 pub const SOL_X25: ::c_int = 262;
653 pub const SOL_PACKET: ::c_int = 263;
654 pub const SOL_ATM: ::c_int = 264;
655 pub const SOL_AAL: ::c_int = 265;
656 pub const SOL_IRDA: ::c_int = 266;
657 pub const SOL_NETBEUI: ::c_int = 267;
658 pub const SOL_LLC: ::c_int = 268;
659 pub const SOL_DCCP: ::c_int = 269;
660 pub const SOL_NETLINK: ::c_int = 270;
661 pub const SOL_TIPC: ::c_int = 271;
662 pub const SOL_BLUETOOTH: ::c_int = 274;
663 pub const SOL_ALG: ::c_int = 279;
664 
665 pub const AF_UNSPEC: ::c_int = 0;
666 pub const AF_UNIX: ::c_int = 1;
667 pub const AF_LOCAL: ::c_int = 1;
668 pub const AF_INET: ::c_int = 2;
669 pub const AF_AX25: ::c_int = 3;
670 pub const AF_IPX: ::c_int = 4;
671 pub const AF_APPLETALK: ::c_int = 5;
672 pub const AF_NETROM: ::c_int = 6;
673 pub const AF_BRIDGE: ::c_int = 7;
674 pub const AF_ATMPVC: ::c_int = 8;
675 pub const AF_X25: ::c_int = 9;
676 pub const AF_INET6: ::c_int = 10;
677 pub const AF_ROSE: ::c_int = 11;
678 pub const AF_DECnet: ::c_int = 12;
679 pub const AF_NETBEUI: ::c_int = 13;
680 pub const AF_SECURITY: ::c_int = 14;
681 pub const AF_KEY: ::c_int = 15;
682 pub const AF_NETLINK: ::c_int = 16;
683 pub const AF_ROUTE: ::c_int = AF_NETLINK;
684 pub const AF_PACKET: ::c_int = 17;
685 pub const AF_ASH: ::c_int = 18;
686 pub const AF_ECONET: ::c_int = 19;
687 pub const AF_ATMSVC: ::c_int = 20;
688 pub const AF_RDS: ::c_int = 21;
689 pub const AF_SNA: ::c_int = 22;
690 pub const AF_IRDA: ::c_int = 23;
691 pub const AF_PPPOX: ::c_int = 24;
692 pub const AF_WANPIPE: ::c_int = 25;
693 pub const AF_LLC: ::c_int = 26;
694 pub const AF_CAN: ::c_int = 29;
695 pub const AF_TIPC: ::c_int = 30;
696 pub const AF_BLUETOOTH: ::c_int = 31;
697 pub const AF_IUCV: ::c_int = 32;
698 pub const AF_RXRPC: ::c_int = 33;
699 pub const AF_ISDN: ::c_int = 34;
700 pub const AF_PHONET: ::c_int = 35;
701 pub const AF_IEEE802154: ::c_int = 36;
702 pub const AF_CAIF: ::c_int = 37;
703 pub const AF_ALG: ::c_int = 38;
704 
705 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
706 pub const PF_UNIX: ::c_int = AF_UNIX;
707 pub const PF_LOCAL: ::c_int = AF_LOCAL;
708 pub const PF_INET: ::c_int = AF_INET;
709 pub const PF_AX25: ::c_int = AF_AX25;
710 pub const PF_IPX: ::c_int = AF_IPX;
711 pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
712 pub const PF_NETROM: ::c_int = AF_NETROM;
713 pub const PF_BRIDGE: ::c_int = AF_BRIDGE;
714 pub const PF_ATMPVC: ::c_int = AF_ATMPVC;
715 pub const PF_X25: ::c_int = AF_X25;
716 pub const PF_INET6: ::c_int = AF_INET6;
717 pub const PF_ROSE: ::c_int = AF_ROSE;
718 pub const PF_DECnet: ::c_int = AF_DECnet;
719 pub const PF_NETBEUI: ::c_int = AF_NETBEUI;
720 pub const PF_SECURITY: ::c_int = AF_SECURITY;
721 pub const PF_KEY: ::c_int = AF_KEY;
722 pub const PF_NETLINK: ::c_int = AF_NETLINK;
723 pub const PF_ROUTE: ::c_int = AF_ROUTE;
724 pub const PF_PACKET: ::c_int = AF_PACKET;
725 pub const PF_ASH: ::c_int = AF_ASH;
726 pub const PF_ECONET: ::c_int = AF_ECONET;
727 pub const PF_ATMSVC: ::c_int = AF_ATMSVC;
728 pub const PF_RDS: ::c_int = AF_RDS;
729 pub const PF_SNA: ::c_int = AF_SNA;
730 pub const PF_IRDA: ::c_int = AF_IRDA;
731 pub const PF_PPPOX: ::c_int = AF_PPPOX;
732 pub const PF_WANPIPE: ::c_int = AF_WANPIPE;
733 pub const PF_LLC: ::c_int = AF_LLC;
734 pub const PF_CAN: ::c_int = AF_CAN;
735 pub const PF_TIPC: ::c_int = AF_TIPC;
736 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
737 pub const PF_IUCV: ::c_int = AF_IUCV;
738 pub const PF_RXRPC: ::c_int = AF_RXRPC;
739 pub const PF_ISDN: ::c_int = AF_ISDN;
740 pub const PF_PHONET: ::c_int = AF_PHONET;
741 pub const PF_IEEE802154: ::c_int = AF_IEEE802154;
742 pub const PF_CAIF: ::c_int = AF_CAIF;
743 pub const PF_ALG: ::c_int = AF_ALG;
744 
745 pub const SOMAXCONN: ::c_int = 128;
746 
747 pub const MSG_OOB: ::c_int = 1;
748 pub const MSG_PEEK: ::c_int = 2;
749 pub const MSG_DONTROUTE: ::c_int = 4;
750 pub const MSG_CTRUNC: ::c_int = 8;
751 pub const MSG_TRUNC: ::c_int = 0x20;
752 pub const MSG_DONTWAIT: ::c_int = 0x40;
753 pub const MSG_EOR: ::c_int = 0x80;
754 pub const MSG_WAITALL: ::c_int = 0x100;
755 pub const MSG_FIN: ::c_int = 0x200;
756 pub const MSG_SYN: ::c_int = 0x400;
757 pub const MSG_CONFIRM: ::c_int = 0x800;
758 pub const MSG_RST: ::c_int = 0x1000;
759 pub const MSG_ERRQUEUE: ::c_int = 0x2000;
760 pub const MSG_NOSIGNAL: ::c_int = 0x4000;
761 pub const MSG_MORE: ::c_int = 0x8000;
762 pub const MSG_WAITFORONE: ::c_int = 0x10000;
763 pub const MSG_FASTOPEN: ::c_int = 0x20000000;
764 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
765 
766 pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
767 
768 pub const SOCK_RAW: ::c_int = 3;
769 pub const SOCK_RDM: ::c_int = 4;
770 pub const IP_MULTICAST_IF: ::c_int = 32;
771 pub const IP_MULTICAST_TTL: ::c_int = 33;
772 pub const IP_MULTICAST_LOOP: ::c_int = 34;
773 pub const IP_TOS: ::c_int = 1;
774 pub const IP_TTL: ::c_int = 2;
775 pub const IP_HDRINCL: ::c_int = 3;
776 pub const IP_PKTINFO: ::c_int = 8;
777 pub const IP_RECVTOS: ::c_int = 13;
778 pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
779 pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
780 pub const IP_TRANSPARENT: ::c_int = 19;
781 pub const IPV6_UNICAST_HOPS: ::c_int = 16;
782 pub const IPV6_MULTICAST_IF: ::c_int = 17;
783 pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
784 pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
785 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
786 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
787 pub const IPV6_V6ONLY: ::c_int = 26;
788 pub const IPV6_RECVPKTINFO: ::c_int = 49;
789 pub const IPV6_PKTINFO: ::c_int = 50;
790 pub const IPV6_RECVTCLASS: ::c_int = 66;
791 pub const IPV6_TCLASS: ::c_int = 67;
792 
793 pub const TCP_NODELAY: ::c_int = 1;
794 pub const TCP_MAXSEG: ::c_int = 2;
795 pub const TCP_CORK: ::c_int = 3;
796 pub const TCP_KEEPIDLE: ::c_int = 4;
797 pub const TCP_KEEPINTVL: ::c_int = 5;
798 pub const TCP_KEEPCNT: ::c_int = 6;
799 pub const TCP_SYNCNT: ::c_int = 7;
800 pub const TCP_LINGER2: ::c_int = 8;
801 pub const TCP_DEFER_ACCEPT: ::c_int = 9;
802 pub const TCP_WINDOW_CLAMP: ::c_int = 10;
803 pub const TCP_INFO: ::c_int = 11;
804 pub const TCP_QUICKACK: ::c_int = 12;
805 pub const TCP_CONGESTION: ::c_int = 13;
806 
807 pub const SO_DEBUG: ::c_int = 1;
808 
809 pub const SHUT_RD: ::c_int = 0;
810 pub const SHUT_WR: ::c_int = 1;
811 pub const SHUT_RDWR: ::c_int = 2;
812 
813 pub const LOCK_SH: ::c_int = 1;
814 pub const LOCK_EX: ::c_int = 2;
815 pub const LOCK_NB: ::c_int = 4;
816 pub const LOCK_UN: ::c_int = 8;
817 
818 pub const SS_ONSTACK: ::c_int = 1;
819 pub const SS_DISABLE: ::c_int = 2;
820 
821 pub const PATH_MAX: ::c_int = 4096;
822 
823 pub const FD_SETSIZE: usize = 1024;
824 
825 pub const EPOLLIN: ::c_int = 0x1;
826 pub const EPOLLPRI: ::c_int = 0x2;
827 pub const EPOLLOUT: ::c_int = 0x4;
828 pub const EPOLLRDNORM: ::c_int = 0x40;
829 pub const EPOLLRDBAND: ::c_int = 0x80;
830 pub const EPOLLWRNORM: ::c_int = 0x100;
831 pub const EPOLLWRBAND: ::c_int = 0x200;
832 pub const EPOLLMSG: ::c_int = 0x400;
833 pub const EPOLLERR: ::c_int = 0x8;
834 pub const EPOLLHUP: ::c_int = 0x10;
835 pub const EPOLLET: ::c_int = 0x80000000;
836 
837 pub const EPOLL_CTL_ADD: ::c_int = 1;
838 pub const EPOLL_CTL_MOD: ::c_int = 3;
839 pub const EPOLL_CTL_DEL: ::c_int = 2;
840 
841 pub const MNT_DETACH: ::c_int = 0x2;
842 pub const MNT_EXPIRE: ::c_int = 0x4;
843 
844 pub const Q_GETFMT: ::c_int = 0x800004;
845 pub const Q_GETINFO: ::c_int = 0x800005;
846 pub const Q_SETINFO: ::c_int = 0x800006;
847 pub const QIF_BLIMITS: u32 = 1;
848 pub const QIF_SPACE: u32 = 2;
849 pub const QIF_ILIMITS: u32 = 4;
850 pub const QIF_INODES: u32 = 8;
851 pub const QIF_BTIME: u32 = 16;
852 pub const QIF_ITIME: u32 = 32;
853 pub const QIF_LIMITS: u32 = 5;
854 pub const QIF_USAGE: u32 = 10;
855 pub const QIF_TIMES: u32 = 48;
856 pub const QIF_ALL: u32 = 63;
857 
858 pub const MNT_FORCE: ::c_int = 0x1;
859 
860 pub const Q_SYNC: ::c_int = 0x800001;
861 pub const Q_QUOTAON: ::c_int = 0x800002;
862 pub const Q_QUOTAOFF: ::c_int = 0x800003;
863 pub const Q_GETQUOTA: ::c_int = 0x800007;
864 pub const Q_SETQUOTA: ::c_int = 0x800008;
865 
866 pub const TCIOFF: ::c_int = 2;
867 pub const TCION: ::c_int = 3;
868 pub const TCOOFF: ::c_int = 0;
869 pub const TCOON: ::c_int = 1;
870 pub const TCIFLUSH: ::c_int = 0;
871 pub const TCOFLUSH: ::c_int = 1;
872 pub const TCIOFLUSH: ::c_int = 2;
873 pub const NL0: ::tcflag_t = 0x00000000;
874 pub const NL1: ::tcflag_t = 0x00000100;
875 pub const TAB0: ::tcflag_t = 0x00000000;
876 pub const CR0: ::tcflag_t = 0x00000000;
877 pub const FF0: ::tcflag_t = 0x00000000;
878 pub const BS0: ::tcflag_t = 0x00000000;
879 pub const VT0: ::tcflag_t = 0x00000000;
880 pub const VERASE: usize = 2;
881 pub const VKILL: usize = 3;
882 pub const VINTR: usize = 0;
883 pub const VQUIT: usize = 1;
884 pub const VLNEXT: usize = 15;
885 pub const IGNBRK: ::tcflag_t = 0x00000001;
886 pub const BRKINT: ::tcflag_t = 0x00000002;
887 pub const IGNPAR: ::tcflag_t = 0x00000004;
888 pub const PARMRK: ::tcflag_t = 0x00000008;
889 pub const INPCK: ::tcflag_t = 0x00000010;
890 pub const ISTRIP: ::tcflag_t = 0x00000020;
891 pub const INLCR: ::tcflag_t = 0x00000040;
892 pub const IGNCR: ::tcflag_t = 0x00000080;
893 pub const ICRNL: ::tcflag_t = 0x00000100;
894 pub const IXANY: ::tcflag_t = 0x00000800;
895 pub const IMAXBEL: ::tcflag_t = 0x00002000;
896 pub const OPOST: ::tcflag_t = 0x1;
897 pub const CS5: ::tcflag_t = 0x00000000;
898 pub const CRTSCTS: ::tcflag_t = 0x80000000;
899 pub const ECHO: ::tcflag_t = 0x00000008;
900 pub const OCRNL:  ::tcflag_t = 0o000010;
901 pub const ONOCR:  ::tcflag_t = 0o000020;
902 pub const ONLRET: ::tcflag_t = 0o000040;
903 pub const OFILL:  ::tcflag_t = 0o000100;
904 pub const OFDEL:  ::tcflag_t = 0o000200;
905 
906 pub const CLONE_VM: ::c_int = 0x100;
907 pub const CLONE_FS: ::c_int = 0x200;
908 pub const CLONE_FILES: ::c_int = 0x400;
909 pub const CLONE_SIGHAND: ::c_int = 0x800;
910 pub const CLONE_PTRACE: ::c_int = 0x2000;
911 pub const CLONE_VFORK: ::c_int = 0x4000;
912 pub const CLONE_PARENT: ::c_int = 0x8000;
913 pub const CLONE_THREAD: ::c_int = 0x10000;
914 pub const CLONE_NEWNS: ::c_int = 0x20000;
915 pub const CLONE_SYSVSEM: ::c_int = 0x40000;
916 pub const CLONE_SETTLS: ::c_int = 0x80000;
917 pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
918 pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
919 pub const CLONE_DETACHED: ::c_int = 0x400000;
920 pub const CLONE_UNTRACED: ::c_int = 0x800000;
921 pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
922 pub const CLONE_NEWUTS: ::c_int = 0x04000000;
923 pub const CLONE_NEWIPC: ::c_int = 0x08000000;
924 pub const CLONE_NEWUSER: ::c_int = 0x10000000;
925 pub const CLONE_NEWPID: ::c_int = 0x20000000;
926 pub const CLONE_NEWNET: ::c_int = 0x40000000;
927 pub const CLONE_IO: ::c_int = 0x80000000;
928 pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
929 
930 pub const WNOHANG: ::c_int = 0x00000001;
931 pub const WUNTRACED: ::c_int = 0x00000002;
932 pub const WSTOPPED: ::c_int = WUNTRACED;
933 pub const WEXITED: ::c_int = 0x00000004;
934 pub const WCONTINUED: ::c_int = 0x00000008;
935 pub const WNOWAIT: ::c_int = 0x01000000;
936 
937 // Options set using PTRACE_SETOPTIONS.
938 pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
939 pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002;
940 pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004;
941 pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008;
942 pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
943 pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
944 pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
945 pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
946 pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
947 pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
948 pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
949 
950 // Wait extended result codes for the above trace options.
951 pub const PTRACE_EVENT_FORK: ::c_int = 1;
952 pub const PTRACE_EVENT_VFORK: ::c_int = 2;
953 pub const PTRACE_EVENT_CLONE: ::c_int = 3;
954 pub const PTRACE_EVENT_EXEC: ::c_int = 4;
955 pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5;
956 pub const PTRACE_EVENT_EXIT: ::c_int = 6;
957 pub const PTRACE_EVENT_SECCOMP: ::c_int = 7;
958 // PTRACE_EVENT_STOP was added to glibc in 2.26
959 // pub const PTRACE_EVENT_STOP: ::c_int = 128;
960 
961 pub const __WNOTHREAD: ::c_int = 0x20000000;
962 pub const __WALL: ::c_int = 0x40000000;
963 pub const __WCLONE: ::c_int = 0x80000000;
964 
965 pub const SPLICE_F_MOVE: ::c_uint = 0x01;
966 pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
967 pub const SPLICE_F_MORE: ::c_uint = 0x04;
968 pub const SPLICE_F_GIFT: ::c_uint = 0x08;
969 
970 pub const RTLD_LOCAL: ::c_int = 0;
971 pub const RTLD_LAZY: ::c_int = 1;
972 
973 pub const POSIX_FADV_NORMAL: ::c_int = 0;
974 pub const POSIX_FADV_RANDOM: ::c_int = 1;
975 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
976 pub const POSIX_FADV_WILLNEED: ::c_int = 3;
977 
978 pub const AT_FDCWD: ::c_int = -100;
979 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
980 pub const AT_REMOVEDIR: ::c_int = 0x200;
981 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
982 pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
983 pub const AT_EMPTY_PATH: ::c_int = 0x1000;
984 
985 pub const LOG_CRON: ::c_int = 9 << 3;
986 pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
987 pub const LOG_FTP: ::c_int = 11 << 3;
988 pub const LOG_PERROR: ::c_int = 0x20;
989 
990 pub const PIPE_BUF: usize = 4096;
991 
992 pub const SI_LOAD_SHIFT: ::c_uint = 16;
993 
994 pub const SIGEV_SIGNAL: ::c_int = 0;
995 pub const SIGEV_NONE: ::c_int = 1;
996 pub const SIGEV_THREAD: ::c_int = 2;
997 
998 pub const P_ALL: idtype_t = 0;
999 pub const P_PID: idtype_t = 1;
1000 pub const P_PGID: idtype_t = 2;
1001 
1002 pub const UTIME_OMIT: c_long = 1073741822;
1003 pub const UTIME_NOW: c_long = 1073741823;
1004 
1005 pub const POLLIN: ::c_short = 0x1;
1006 pub const POLLPRI: ::c_short = 0x2;
1007 pub const POLLOUT: ::c_short = 0x4;
1008 pub const POLLERR: ::c_short = 0x8;
1009 pub const POLLHUP: ::c_short = 0x10;
1010 pub const POLLNVAL: ::c_short = 0x20;
1011 pub const POLLRDNORM: ::c_short = 0x040;
1012 pub const POLLRDBAND: ::c_short = 0x080;
1013 
1014 pub const IPTOS_LOWDELAY: u8 = 0x10;
1015 pub const IPTOS_THROUGHPUT: u8 = 0x08;
1016 pub const IPTOS_RELIABILITY: u8 = 0x04;
1017 pub const IPTOS_MINCOST: u8 = 0x02;
1018 
1019 pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0;
1020 pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0;
1021 pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0;
1022 pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80;
1023 pub const IPTOS_PREC_FLASH: u8 = 0x60;
1024 pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40;
1025 pub const IPTOS_PREC_PRIORITY: u8 = 0x20;
1026 pub const IPTOS_PREC_ROUTINE: u8 = 0x00;
1027 
1028 pub const IPTOS_ECN_MASK: u8 = 0x03;
1029 pub const IPTOS_ECN_ECT1: u8 = 0x01;
1030 pub const IPTOS_ECN_ECT0: u8 = 0x02;
1031 pub const IPTOS_ECN_CE: u8 = 0x03;
1032 
1033 pub const IPOPT_COPY: u8 = 0x80;
1034 pub const IPOPT_CLASS_MASK: u8 = 0x60;
1035 pub const IPOPT_NUMBER_MASK: u8 = 0x1f;
1036 
1037 pub const IPOPT_CONTROL: u8 = 0x00;
1038 pub const IPOPT_RESERVED1: u8 = 0x20;
1039 pub const IPOPT_MEASUREMENT: u8 = 0x40;
1040 pub const IPOPT_RESERVED2: u8 = 0x60;
1041 pub const IPOPT_END: u8 = (0 |IPOPT_CONTROL);
1042 pub const IPOPT_NOOP: u8 = (1 |IPOPT_CONTROL);
1043 pub const IPOPT_SEC: u8 = (2 |IPOPT_CONTROL|IPOPT_COPY);
1044 pub const IPOPT_LSRR: u8 = (3 |IPOPT_CONTROL|IPOPT_COPY);
1045 pub const IPOPT_TIMESTAMP: u8 = (4 |IPOPT_MEASUREMENT);
1046 pub const IPOPT_RR: u8 = (7 |IPOPT_CONTROL);
1047 pub const IPOPT_SID: u8 = (8 |IPOPT_CONTROL|IPOPT_COPY);
1048 pub const IPOPT_SSRR: u8 = (9 |IPOPT_CONTROL|IPOPT_COPY);
1049 pub const IPOPT_RA: u8 = (20|IPOPT_CONTROL|IPOPT_COPY);
1050 pub const IPVERSION: u8 = 4;
1051 pub const MAXTTL: u8 = 255;
1052 pub const IPDEFTTL: u8 = 64;
1053 pub const IPOPT_OPTVAL: u8 = 0;
1054 pub const IPOPT_OLEN: u8 = 1;
1055 pub const IPOPT_OFFSET: u8 = 2;
1056 pub const IPOPT_MINOFF: u8 = 4;
1057 pub const MAX_IPOPTLEN: u8 = 40;
1058 pub const IPOPT_NOP: u8 = IPOPT_NOOP;
1059 pub const IPOPT_EOL: u8 = IPOPT_END;
1060 pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP;
1061 pub const IPOPT_TS_TSONLY: u8 = 0;
1062 pub const IPOPT_TS_TSANDADDR: u8 = 1;
1063 pub const IPOPT_TS_PRESPEC: u8 = 3;
1064 
1065 pub const ARPOP_RREQUEST: u16 = 3;
1066 pub const ARPOP_RREPLY: u16 = 4;
1067 pub const ARPOP_InREQUEST: u16 = 8;
1068 pub const ARPOP_InREPLY: u16 = 9;
1069 pub const ARPOP_NAK: u16 = 10;
1070 
1071 pub const ATF_NETMASK: ::c_int = 0x20;
1072 pub const ATF_DONTPUB: ::c_int = 0x40;
1073 
1074 pub const ARPHRD_NETROM: u16 = 0;
1075 pub const ARPHRD_ETHER: u16 = 1;
1076 pub const ARPHRD_EETHER: u16 = 2;
1077 pub const ARPHRD_AX25: u16 = 3;
1078 pub const ARPHRD_PRONET: u16 = 4;
1079 pub const ARPHRD_CHAOS: u16 = 5;
1080 pub const ARPHRD_IEEE802: u16 = 6;
1081 pub const ARPHRD_ARCNET: u16 = 7;
1082 pub const ARPHRD_APPLETLK: u16 = 8;
1083 pub const ARPHRD_DLCI: u16 = 15;
1084 pub const ARPHRD_ATM: u16 = 19;
1085 pub const ARPHRD_METRICOM: u16 = 23;
1086 pub const ARPHRD_IEEE1394: u16 = 24;
1087 pub const ARPHRD_EUI64: u16 = 27;
1088 pub const ARPHRD_INFINIBAND: u16 = 32;
1089 
1090 pub const ARPHRD_SLIP: u16 = 256;
1091 pub const ARPHRD_CSLIP: u16 = 257;
1092 pub const ARPHRD_SLIP6: u16 = 258;
1093 pub const ARPHRD_CSLIP6: u16 = 259;
1094 pub const ARPHRD_RSRVD: u16 = 260;
1095 pub const ARPHRD_ADAPT: u16 = 264;
1096 pub const ARPHRD_ROSE: u16 = 270;
1097 pub const ARPHRD_X25: u16 = 271;
1098 pub const ARPHRD_HWX25: u16 = 272;
1099 pub const ARPHRD_PPP: u16 = 512;
1100 pub const ARPHRD_CISCO: u16 = 513;
1101 pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO;
1102 pub const ARPHRD_LAPB: u16 = 516;
1103 pub const ARPHRD_DDCMP: u16 = 517;
1104 pub const ARPHRD_RAWHDLC: u16 = 518;
1105 
1106 pub const ARPHRD_TUNNEL: u16 = 768;
1107 pub const ARPHRD_TUNNEL6: u16 = 769;
1108 pub const ARPHRD_FRAD: u16 = 770;
1109 pub const ARPHRD_SKIP: u16 = 771;
1110 pub const ARPHRD_LOOPBACK: u16 = 772;
1111 pub const ARPHRD_LOCALTLK: u16 = 773;
1112 pub const ARPHRD_FDDI: u16 = 774;
1113 pub const ARPHRD_BIF: u16 = 775;
1114 pub const ARPHRD_SIT: u16 = 776;
1115 pub const ARPHRD_IPDDP: u16 = 777;
1116 pub const ARPHRD_IPGRE: u16 = 778;
1117 pub const ARPHRD_PIMREG: u16 = 779;
1118 pub const ARPHRD_HIPPI: u16 = 780;
1119 pub const ARPHRD_ASH: u16 = 781;
1120 pub const ARPHRD_ECONET: u16 = 782;
1121 pub const ARPHRD_IRDA: u16 = 783;
1122 pub const ARPHRD_FCPP: u16 = 784;
1123 pub const ARPHRD_FCAL: u16 = 785;
1124 pub const ARPHRD_FCPL: u16 = 786;
1125 pub const ARPHRD_FCFABRIC: u16 = 787;
1126 pub const ARPHRD_IEEE802_TR: u16 = 800;
1127 pub const ARPHRD_IEEE80211: u16 = 801;
1128 pub const ARPHRD_IEEE80211_PRISM: u16 = 802;
1129 pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803;
1130 pub const ARPHRD_IEEE802154: u16 = 804;
1131 
1132 pub const ARPHRD_VOID: u16 = 0xFFFF;
1133 pub const ARPHRD_NONE: u16 = 0xFFFE;
1134 
CMSG_ALIGN(len: usize) -> usize1135 fn CMSG_ALIGN(len: usize) -> usize {
1136     len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
1137 }
1138 
1139 f! {
1140     pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1141         if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
1142             (*mhdr).msg_control as *mut cmsghdr
1143         } else {
1144             0 as *mut cmsghdr
1145         }
1146     }
1147 
1148     pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar {
1149         cmsg.offset(1) as *mut ::c_uchar
1150     }
1151 
1152     pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1153         (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
1154             as ::c_uint
1155     }
1156 
1157     pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1158         CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
1159     }
1160 
1161     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
1162         let fd = fd as usize;
1163         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1164         (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1165         return
1166     }
1167 
1168     pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1169         let fd = fd as usize;
1170         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1171         return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
1172     }
1173 
1174     pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
1175         let fd = fd as usize;
1176         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1177         (*set).fds_bits[fd / size] |= 1 << (fd % size);
1178         return
1179     }
1180 
1181     pub fn FD_ZERO(set: *mut fd_set) -> () {
1182         for slot in (*set).fds_bits.iter_mut() {
1183             *slot = 0;
1184         }
1185     }
1186 
1187     pub fn WIFSTOPPED(status: ::c_int) -> bool {
1188         (status & 0xff) == 0x7f
1189     }
1190 
1191     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
1192         (status >> 8) & 0xff
1193     }
1194 
1195     pub fn WIFCONTINUED(status: ::c_int) -> bool {
1196         status == 0xffff
1197     }
1198 
1199     pub fn WIFSIGNALED(status: ::c_int) -> bool {
1200         ((status & 0x7f) + 1) as i8 >= 2
1201     }
1202 
1203     pub fn WTERMSIG(status: ::c_int) -> ::c_int {
1204         status & 0x7f
1205     }
1206 
1207     pub fn WIFEXITED(status: ::c_int) -> bool {
1208         (status & 0x7f) == 0
1209     }
1210 
1211     pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
1212         (status >> 8) & 0xff
1213     }
1214 
1215     pub fn WCOREDUMP(status: ::c_int) -> bool {
1216         (status & 0x80) != 0
1217     }
1218 
1219     pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
1220         (cmd << 8) | (type_ & 0x00ff)
1221     }
1222 
1223     pub fn IPOPT_COPIED(o: u8) -> u8 {
1224         o & IPOPT_COPY
1225     }
1226 
1227     pub fn IPOPT_CLASS(o: u8) -> u8 {
1228         o & IPOPT_CLASS_MASK
1229     }
1230 
1231     pub fn IPOPT_NUMBER(o: u8) -> u8 {
1232         o & IPOPT_NUMBER_MASK
1233     }
1234 
1235     pub fn IPTOS_ECN(x: u8) -> u8 {
1236         x & ::IPTOS_ECN_MASK
1237     }
1238 }
1239 
1240 extern {
sem_destroy(sem: *mut sem_t) -> ::c_int1241     pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int1242     pub fn sem_init(sem: *mut sem_t,
1243                     pshared: ::c_int,
1244                     value: ::c_uint)
1245                     -> ::c_int;
fdatasync(fd: ::c_int) -> ::c_int1246     pub fn fdatasync(fd: ::c_int) -> ::c_int;
mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int1247     pub fn mincore(addr: *mut ::c_void, len: ::size_t,
1248                    vec: *mut ::c_uchar) -> ::c_int;
clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int1249     pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int1250     pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int1251     pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
dirfd(dirp: *mut ::DIR) -> ::c_int1252     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
1253 
pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int1254     pub fn pthread_getattr_np(native: ::pthread_t,
1255                               attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_getstack(attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t) -> ::c_int1256     pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
1257                                  stackaddr: *mut *mut ::c_void,
1258                                  stacksize: *mut ::size_t) -> ::c_int;
memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void1259     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int1260     pub fn setgroups(ngroups: ::size_t,
1261                      ptr: *const ::gid_t) -> ::c_int;
pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int1262     pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int1263     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int1264     pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int;
fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int1265     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int1266     pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int;
statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int1267     pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int1268     pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int;
memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void1269     pub fn memrchr(cx: *const ::c_void,
1270                    c: ::c_int,
1271                    n: ::size_t) -> *mut ::c_void;
1272 
posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int1273     pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
1274                          advise: ::c_int) -> ::c_int;
futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int1275     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_int1276     pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
1277                      times: *const ::timespec, flag: ::c_int) -> ::c_int;
duplocale(base: ::locale_t) -> ::locale_t1278     pub fn duplocale(base: ::locale_t) -> ::locale_t;
freelocale(loc: ::locale_t)1279     pub fn freelocale(loc: ::locale_t);
newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t1280     pub fn newlocale(mask: ::c_int,
1281                      locale: *const ::c_char,
1282                      base: ::locale_t) -> ::locale_t;
uselocale(loc: ::locale_t) -> ::locale_t1283     pub fn uselocale(loc: ::locale_t) -> ::locale_t;
creat64(path: *const c_char, mode: mode_t) -> ::c_int1284     pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int1285     pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
fstatat64(dirfd: ::c_int, pathname: *const c_char, buf: *mut stat64, flags: ::c_int) -> ::c_int1286     pub fn fstatat64(dirfd: ::c_int, pathname: *const c_char,
1287                      buf: *mut stat64, flags: ::c_int) -> ::c_int;
ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int1288     pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t1289     pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int1290     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_void1291     pub fn mmap64(addr: *mut ::c_void,
1292                   len: ::size_t,
1293                   prot: ::c_int,
1294                   flags: ::c_int,
1295                   fd: ::c_int,
1296                   offset: off64_t)
1297                   -> *mut ::c_void;
open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int1298     pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
openat64(fd: ::c_int, path: *const c_char, oflag: ::c_int, ...) -> ::c_int1299     pub fn openat64(fd: ::c_int,
1300                     path: *const c_char,
1301                     oflag: ::c_int, ...) -> ::c_int;
pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off64_t) -> ::ssize_t1302     pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
1303                    offset: off64_t) -> ::ssize_t;
preadv64(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off64_t) -> ::ssize_t1304     pub fn preadv64(fd: ::c_int,
1305                     iov: *const ::iovec,
1306                     iovcnt: ::c_int,
1307                     offset: ::off64_t) -> ::ssize_t;
pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off64_t) -> ::ssize_t1308     pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
1309                     offset: off64_t) -> ::ssize_t;
pwritev64(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off64_t) -> ::ssize_t1310     pub fn pwritev64(fd: ::c_int,
1311                      iov: *const ::iovec,
1312                      iovcnt: ::c_int,
1313                      offset: ::off64_t) -> ::ssize_t;
readdir64(dirp: *mut ::DIR) -> *mut ::dirent641314     pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, result: *mut *mut ::dirent64) -> ::c_int1315     pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
1316                        result: *mut *mut ::dirent64) -> ::c_int;
stat64(path: *const c_char, buf: *mut stat64) -> ::c_int1317     pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
truncate64(path: *const c_char, length: off64_t) -> ::c_int1318     pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
1319 
mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int1320     pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
1321                    mode: ::mode_t, dev: dev_t) -> ::c_int;
pthread_condattr_getclock(attr: *const pthread_condattr_t, clock_id: *mut clockid_t) -> ::c_int1322     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
1323                                      clock_id: *mut clockid_t) -> ::c_int;
pthread_condattr_setclock(attr: *mut pthread_condattr_t, clock_id: ::clockid_t) -> ::c_int1324     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
1325                                      clock_id: ::clockid_t) -> ::c_int;
pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int1326     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
1327                                        pshared: ::c_int) -> ::c_int;
accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t, flg: ::c_int) -> ::c_int1328     pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
1329                    flg: ::c_int) -> ::c_int;
pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: ::c_int) -> ::c_int1330     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
1331                                         pshared: ::c_int) -> ::c_int;
pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, val: *mut ::c_int) -> ::c_int1332     pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
1333                                          val: *mut ::c_int) -> ::c_int;
pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int1334     pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
1335                                          val: ::c_int) -> ::c_int;
ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int1336     pub fn ptsname_r(fd: ::c_int,
1337                      buf: *mut ::c_char,
1338                      buflen: ::size_t) -> ::c_int;
clearenv() -> ::c_int1339     pub fn clearenv() -> ::c_int;
waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int1340     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
1341                   options: ::c_int) -> ::c_int;
setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int1342     pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int1343     pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int1344     pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t,
1345                      suid: *mut ::uid_t) -> ::c_int;
getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int1346     pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t,
1347                      sgid: *mut ::gid_t) -> ::c_int;
acct(filename: *const ::c_char) -> ::c_int1348     pub fn acct(filename: *const ::c_char) -> ::c_int;
brk(addr: *mut ::c_void) -> ::c_int1349     pub fn brk(addr: *mut ::c_void) -> ::c_int;
sbrk(increment: ::intptr_t) -> *mut ::c_void1350     pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
vfork() -> ::pid_t1351     pub fn vfork() -> ::pid_t;
setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int1352     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_int1353     pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int, rusage: *mut ::rusage) -> ::pid_t1354     pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
1355                  rusage: *mut ::rusage) -> ::pid_t;
openpty(amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, termp: *const termios, winp: *const ::winsize) -> ::c_int1356     pub fn openpty(amaster: *mut ::c_int,
1357                 aslave: *mut ::c_int,
1358                 name: *mut ::c_char,
1359                 termp: *const termios,
1360                 winp: *const ::winsize) -> ::c_int;
forkpty(amaster: *mut ::c_int, name: *mut ::c_char, termp: *const termios, winp: *const ::winsize) -> ::pid_t1361     pub fn forkpty(amaster: *mut ::c_int,
1362                 name: *mut ::c_char,
1363                 termp: *const termios,
1364                 winp: *const ::winsize) -> ::pid_t;
login_tty(fd: ::c_int) -> ::c_int1365     pub fn login_tty(fd: ::c_int) -> ::c_int;
execvpe(file: *const ::c_char, argv: *const *const ::c_char, envp: *const *const ::c_char) -> ::c_int1366     pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
1367                    envp: *const *const ::c_char) -> ::c_int;
fexecve(fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char) -> ::c_int1368     pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
1369                    envp: *const *const ::c_char)
1370                    -> ::c_int;
getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int1371     pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
freeifaddrs(ifa: *mut ::ifaddrs)1372     pub fn freeifaddrs(ifa: *mut ::ifaddrs);
bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int1373     pub fn bind(socket: ::c_int, address: *const ::sockaddr,
1374                 address_len: ::socklen_t) -> ::c_int;
1375 
writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t1376     pub fn writev(fd: ::c_int,
1377                   iov: *const ::iovec,
1378                   iovcnt: ::c_int) -> ::ssize_t;
readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t1379     pub fn readv(fd: ::c_int,
1380                  iov: *const ::iovec,
1381                  iovcnt: ::c_int) -> ::ssize_t;
1382 
sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t1383     pub fn sendmsg(fd: ::c_int,
1384                    msg: *const ::msghdr,
1385                    flags: ::c_int) -> ::ssize_t;
recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t1386     pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
1387                    -> ::ssize_t;
uname(buf: *mut ::utsname) -> ::c_int1388     pub fn uname(buf: *mut ::utsname) -> ::c_int;
1389 }
1390 
1391 cfg_if! {
1392     if #[cfg(target_os = "emscripten")] {
1393         mod emscripten;
1394         pub use self::emscripten::*;
1395     } else if #[cfg(target_os = "linux")] {
1396         mod linux;
1397         pub use self::linux::*;
1398     } else if #[cfg(target_os = "android")] {
1399         mod android;
1400         pub use self::android::*;
1401     } else {
1402         // Unknown target_os
1403     }
1404 }
1405