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