1 pub type rlim_t = ::uintptr_t;
2 pub type sa_family_t = u8;
3 pub type pthread_key_t = ::c_int;
4 pub type nfds_t = ::c_ulong;
5 pub type tcflag_t = ::c_uint;
6 pub type speed_t = ::c_uchar;
7 pub type c_char = i8;
8 pub type clock_t = i32;
9 pub type clockid_t = i32;
10 pub type suseconds_t = i32;
11 pub type wchar_t = i32;
12 pub type off_t = i64;
13 pub type ino_t = i64;
14 pub type blkcnt_t = i64;
15 pub type blksize_t = i32;
16 pub type dev_t = i32;
17 pub type mode_t = u32;
18 pub type nlink_t = i32;
19 pub type useconds_t = u32;
20 pub type socklen_t = u32;
21 pub type pthread_t = ::uintptr_t;
22 pub type pthread_condattr_t = ::uintptr_t;
23 pub type pthread_mutexattr_t = ::uintptr_t;
24 pub type pthread_rwlockattr_t = ::uintptr_t;
25 pub type sigset_t = u64;
26 pub type fsblkcnt_t = i64;
27 pub type fsfilcnt_t = i64;
28 pub type pthread_attr_t = *mut ::c_void;
29 pub type nl_item = ::c_int;
30 pub type id_t = i32;
31 pub type idtype_t = ::c_uint;
32 pub type fd_mask = u32;
33 
34 #[cfg_attr(feature = "extra_traits", derive(Debug))]
35 pub enum timezone {}
36 impl ::Copy for timezone {}
37 impl ::Clone for timezone {
clone(&self) -> timezone38     fn clone(&self) -> timezone {
39         *self
40     }
41 }
42 
43 impl siginfo_t {
si_addr(&self) -> *mut ::c_void44     pub unsafe fn si_addr(&self) -> *mut ::c_void {
45         self.si_addr
46     }
47 
si_pid(&self) -> ::pid_t48     pub unsafe fn si_pid(&self) -> ::pid_t {
49         self.si_pid
50     }
51 
si_uid(&self) -> ::uid_t52     pub unsafe fn si_uid(&self) -> ::uid_t {
53         self.si_uid
54     }
55 
si_status(&self) -> ::c_int56     pub unsafe fn si_status(&self) -> ::c_int {
57         self.si_status
58     }
59 }
60 
61 s! {
62     pub struct in_addr {
63         pub s_addr: ::in_addr_t,
64     }
65 
66     pub struct ip_mreq {
67         pub imr_multiaddr: in_addr,
68         pub imr_interface: in_addr,
69     }
70 
71     pub struct sockaddr {
72         pub sa_len: u8,
73         pub sa_family: sa_family_t,
74         pub sa_data: [u8; 30],
75     }
76 
77     pub struct sockaddr_in {
78         pub sin_len: u8,
79         pub sin_family: sa_family_t,
80         pub sin_port: ::in_port_t,
81         pub sin_addr: ::in_addr,
82         pub sin_zero: [i8; 24],
83     }
84 
85     pub struct sockaddr_in6 {
86         pub sin6_len: u8,
87         pub sin6_family: u8,
88         pub sin6_port: u16,
89         pub sin6_flowinfo: u32,
90         pub sin6_addr: ::in6_addr,
91         pub sin6_scope_id: u32,
92     }
93 
94     pub struct addrinfo {
95         pub ai_flags: ::c_int,
96         pub ai_family: ::c_int,
97         pub ai_socktype: ::c_int,
98         pub ai_protocol: ::c_int,
99         pub ai_addrlen: socklen_t,
100         pub ai_canonname: *mut c_char,
101         pub ai_addr: *mut ::sockaddr,
102         pub ai_next: *mut addrinfo,
103     }
104 
105     pub struct fd_set {
106         // size for 1024 bits, and a fd_mask with size u32
107         fds_bits: [fd_mask; 32],
108     }
109 
110     pub struct tm {
111         pub tm_sec: ::c_int,
112         pub tm_min: ::c_int,
113         pub tm_hour: ::c_int,
114         pub tm_mday: ::c_int,
115         pub tm_mon: ::c_int,
116         pub tm_year: ::c_int,
117         pub tm_wday: ::c_int,
118         pub tm_yday: ::c_int,
119         pub tm_isdst: ::c_int,
120         pub tm_gmtoff: ::c_int,
121         pub tm_zone: *mut ::c_char,
122     }
123 
124     pub struct utsname {
125         pub sysname: [::c_char; 32],
126         pub nodename: [::c_char; 32],
127         pub release: [::c_char; 32],
128         pub version: [::c_char; 32],
129         pub machine: [::c_char; 32],
130     }
131 
132     pub struct lconv {
133         pub decimal_point: *mut ::c_char,
134         pub thousands_sep: *mut ::c_char,
135         pub grouping: *mut ::c_char,
136         pub int_curr_symbol: *mut ::c_char,
137         pub currency_symbol: *mut ::c_char,
138         pub mon_decimal_point: *mut ::c_char,
139         pub mon_thousands_sep: *mut ::c_char,
140         pub mon_grouping: *mut ::c_char,
141         pub positive_sign: *mut ::c_char,
142         pub negative_sign: *mut ::c_char,
143         pub int_frac_digits: ::c_char,
144         pub frac_digits: ::c_char,
145         pub p_cs_precedes: ::c_char,
146         pub p_sep_by_space: ::c_char,
147         pub n_cs_precedes: ::c_char,
148         pub n_sep_by_space: ::c_char,
149         pub p_sign_posn: ::c_char,
150         pub n_sign_posn: ::c_char,
151         pub int_p_cs_precedes: ::c_char,
152         pub int_p_sep_by_space: ::c_char,
153         pub int_n_cs_precedes: ::c_char,
154         pub int_n_sep_by_space: ::c_char,
155         pub int_p_sign_posn: ::c_char,
156         pub int_n_sign_posn: ::c_char,
157     }
158 
159     pub struct msghdr {
160         pub msg_name: *mut ::c_void,
161         pub msg_namelen: socklen_t,
162         pub msg_iov: *mut ::iovec,
163         pub msg_iovlen: ::c_int,
164         pub msg_control: *mut ::c_void,
165         pub msg_controllen: socklen_t,
166         pub msg_flags: ::c_int,
167     }
168 
169     pub struct cmsghdr {
170         pub cmsg_len: ::socklen_t,
171         pub cmsg_level: ::c_int,
172         pub cmsg_type: ::c_int,
173     }
174 
175     pub struct Dl_info {
176         pub dli_fname: *const ::c_char,
177         pub dli_fbase: *mut ::c_void,
178         pub dli_sname: *const ::c_char,
179         pub dli_saddr: *mut ::c_void,
180     }
181 
182     pub struct termios {
183         pub c_iflag: ::tcflag_t,
184         pub c_oflag: ::tcflag_t,
185         pub c_cflag: ::tcflag_t,
186         pub c_lflag: ::tcflag_t,
187         pub c_line:  ::c_char,
188         pub c_ispeed: ::speed_t,
189         pub c_ospeed: ::speed_t,
190         pub c_cc: [::cc_t; ::NCCS],
191     }
192 
193     pub struct flock {
194         pub l_type: ::c_short,
195         pub l_whence: ::c_short,
196         pub l_start: ::off_t,
197         pub l_len: ::off_t,
198         pub l_pid: ::pid_t,
199     }
200 
201     pub struct stat {
202         pub st_dev: dev_t,
203         pub st_ino: ino_t,
204         pub st_mode: mode_t,
205         pub st_nlink: nlink_t,
206         pub st_uid: ::uid_t,
207         pub st_gid: ::gid_t,
208         pub st_size: off_t,
209         pub st_rdev: dev_t,
210         pub st_blksize: blksize_t,
211         pub st_atime: time_t,
212         pub st_atime_nsec: c_long,
213         pub st_mtime: time_t,
214         pub st_mtime_nsec: c_long,
215         pub st_ctime: time_t,
216         pub st_ctime_nsec: c_long,
217         pub st_crtime: time_t,
218         pub st_crtime_nsec: c_long,
219         pub st_type: u32,
220         pub st_blocks: blkcnt_t,
221     }
222 
223     pub struct glob_t {
224         pub gl_pathc: ::size_t,
225         __unused1: ::size_t,
226         pub gl_offs: ::size_t,
227         __unused2: ::size_t,
228         pub gl_pathv: *mut *mut c_char,
229 
230         __unused3: *mut ::c_void,
231         __unused4: *mut ::c_void,
232         __unused5: *mut ::c_void,
233         __unused6: *mut ::c_void,
234         __unused7: *mut ::c_void,
235         __unused8: *mut ::c_void,
236     }
237 
238     pub struct pthread_mutex_t {
239         flags: u32,
240         lock: i32,
241         unused: i32,
242         owner: i32,
243         owner_count: i32,
244     }
245 
246     pub struct pthread_cond_t {
247         flags: u32,
248         unused: i32,
249         mutex: *mut ::c_void,
250         waiter_count: i32,
251         lock: i32,
252     }
253 
254     pub struct pthread_rwlock_t {
255         flags: u32,
256         owner: i32,
257         lock_sem: i32,      // this is actually a union
258         lock_count: i32,
259         reader_count: i32,
260         writer_count: i32,
261         waiters: [*mut ::c_void; 2],
262     }
263 
264     pub struct passwd {
265         pub pw_name: *mut ::c_char,
266         pub pw_passwd: *mut ::c_char,
267         pub pw_uid: ::uid_t,
268         pub pw_gid: ::gid_t,
269         pub pw_dir: *mut ::c_char,
270         pub pw_shell: *mut ::c_char,
271         pub pw_gecos: *mut ::c_char,
272     }
273 
274     pub struct statvfs {
275         pub f_bsize: ::c_ulong,
276         pub f_frsize: ::c_ulong,
277         pub f_blocks: ::fsblkcnt_t,
278         pub f_bfree: ::fsblkcnt_t,
279         pub f_bavail: ::fsblkcnt_t,
280         pub f_files: ::fsfilcnt_t,
281         pub f_ffree: ::fsfilcnt_t,
282         pub f_favail: ::fsfilcnt_t,
283         pub f_fsid: ::c_ulong,
284         pub f_flag: ::c_ulong,
285         pub f_namemax: ::c_ulong,
286     }
287 
288     pub struct stack_t {
289         pub ss_sp: *mut ::c_void,
290         pub ss_size: ::size_t,
291         pub ss_flags: ::c_int,
292     }
293 
294     pub struct siginfo_t {
295         pub si_signo: ::c_int,
296         pub si_code: ::c_int,
297         pub si_errno: ::c_int,
298         pub si_pid: ::pid_t,
299         pub si_uid: ::uid_t,
300         pub si_addr: *mut ::c_void,
301         pub si_status: ::c_int,
302         pub si_band: c_long,
303         pub sigval: *mut ::c_void,
304     }
305 
306     pub struct sigaction {
307         pub sa_sigaction: ::sighandler_t, //actually a union with sa_handler
308         pub sa_mask: ::sigset_t,
309         pub sa_flags: ::c_int,
310         sa_userdata: *mut ::c_void,
311     }
312 
313     pub struct sem_t {
314         pub type_: i32,
315         pub named_sem_id: i32, // actually a union with unnamed_sem (i32)
316         pub padding: [i32; 2],
317     }
318 }
319 
320 s_no_extra_traits! {
321     pub struct sockaddr_un {
322         pub sun_len: u8,
323         pub sun_family: sa_family_t,
324         pub sun_path: [::c_char; 126]
325     }
326     pub struct sockaddr_storage {
327         pub ss_len: u8,
328         pub ss_family: sa_family_t,
329         __ss_pad1: [u8; 6],
330         __ss_pad2: u64,
331         __ss_pad3: [u8; 112],
332     }
333     pub struct dirent {
334         pub d_dev: dev_t,
335         pub d_pdev: dev_t,
336         pub d_ino: ino_t,
337         pub d_pino: i64,
338         pub d_reclen: ::c_ushort,
339         pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
340     }
341 
342     pub struct sigevent {
343         pub sigev_notify: ::c_int,
344         pub sigev_signo: ::c_int,
345         pub sigev_value: ::sigval,
346         __unused1: *mut ::c_void, // actually a function pointer
347         pub sigev_notify_attributes: *mut ::pthread_attr_t,
348     }
349 }
350 
351 cfg_if! {
352     if #[cfg(feature = "extra_traits")] {
353         impl PartialEq for sockaddr_un {
354             fn eq(&self, other: &sockaddr_un) -> bool {
355                 self.sun_len == other.sun_len
356                     && self.sun_family == other.sun_family
357                     && self
358                     .sun_path
359                     .iter()
360                     .zip(other.sun_path.iter())
361                     .all(|(a,b)| a == b)
362             }
363         }
364         impl Eq for sockaddr_un {}
365         impl ::fmt::Debug for sockaddr_un {
366             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
367                 f.debug_struct("sockaddr_un")
368                     .field("sun_len", &self.sun_len)
369                     .field("sun_family", &self.sun_family)
370                     // FIXME: .field("sun_path", &self.sun_path)
371                     .finish()
372             }
373         }
374         impl ::hash::Hash for sockaddr_un {
375             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
376                 self.sun_len.hash(state);
377                 self.sun_family.hash(state);
378                 self.sun_path.hash(state);
379             }
380         }
381 
382         impl PartialEq for sockaddr_storage {
383             fn eq(&self, other: &sockaddr_storage) -> bool {
384                 self.ss_len == other.ss_len
385                     && self.ss_family == other.ss_family
386                     && self
387                     .__ss_pad1
388                     .iter()
389                     .zip(other.__ss_pad1.iter())
390                     .all(|(a, b)| a == b)
391                     && self.__ss_pad2 == other.__ss_pad2
392                     && self
393                     .__ss_pad3
394                     .iter()
395                     .zip(other.__ss_pad3.iter())
396                     .all(|(a, b)| a == b)
397             }
398         }
399         impl Eq for sockaddr_storage {}
400         impl ::fmt::Debug for sockaddr_storage {
401             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
402                 f.debug_struct("sockaddr_storage")
403                     .field("ss_len", &self.ss_len)
404                     .field("ss_family", &self.ss_family)
405                     .field("__ss_pad1", &self.__ss_pad1)
406                     .field("__ss_pad2", &self.__ss_pad2)
407                     // FIXME: .field("__ss_pad3", &self.__ss_pad3)
408                     .finish()
409             }
410         }
411         impl ::hash::Hash for sockaddr_storage {
412             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
413                 self.ss_len.hash(state);
414                 self.ss_family.hash(state);
415                 self.__ss_pad1.hash(state);
416                 self.__ss_pad2.hash(state);
417                 self.__ss_pad3.hash(state);
418             }
419         }
420 
421         impl PartialEq for dirent {
422             fn eq(&self, other: &dirent) -> bool {
423                 self.d_dev == other.d_dev
424                     && self.d_pdev == other.d_pdev
425                     && self.d_ino == other.d_ino
426                     && self.d_pino == other.d_pino
427                     && self.d_reclen == other.d_reclen
428                     && self
429                     .d_name
430                     .iter()
431                     .zip(other.d_name.iter())
432                     .all(|(a,b)| a == b)
433             }
434         }
435         impl Eq for dirent {}
436         impl ::fmt::Debug for dirent {
437             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
438                 f.debug_struct("dirent")
439                     .field("d_dev", &self.d_dev)
440                     .field("d_pdev", &self.d_pdev)
441                     .field("d_ino", &self.d_ino)
442                     .field("d_pino", &self.d_pino)
443                     .field("d_reclen", &self.d_reclen)
444                     // FIXME: .field("d_name", &self.d_name)
445                     .finish()
446             }
447         }
448         impl ::hash::Hash for dirent {
449             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
450                 self.d_dev.hash(state);
451                 self.d_pdev.hash(state);
452                 self.d_ino.hash(state);
453                 self.d_pino.hash(state);
454                 self.d_reclen.hash(state);
455                 self.d_name.hash(state);
456             }
457         }
458 
459         impl PartialEq for sigevent {
460             fn eq(&self, other: &sigevent) -> bool {
461                 self.sigev_notify == other.sigev_notify
462                     && self.sigev_signo == other.sigev_signo
463                     && self.sigev_value == other.sigev_value
464                     && self.sigev_notify_attributes
465                         == other.sigev_notify_attributes
466             }
467         }
468         impl Eq for sigevent {}
469         impl ::fmt::Debug for sigevent {
470             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
471                 f.debug_struct("sigevent")
472                     .field("sigev_notify", &self.sigev_notify)
473                     .field("sigev_signo", &self.sigev_signo)
474                     .field("sigev_value", &self.sigev_value)
475                     .field("sigev_notify_attributes",
476                            &self.sigev_notify_attributes)
477                     .finish()
478             }
479         }
480         impl ::hash::Hash for sigevent {
481             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
482                 self.sigev_notify.hash(state);
483                 self.sigev_signo.hash(state);
484                 self.sigev_value.hash(state);
485                 self.sigev_notify_attributes.hash(state);
486             }
487         }
488     }
489 }
490 
491 pub const EXIT_FAILURE: ::c_int = 1;
492 pub const EXIT_SUCCESS: ::c_int = 0;
493 pub const RAND_MAX: ::c_int = 2147483647;
494 pub const EOF: ::c_int = -1;
495 pub const SEEK_SET: ::c_int = 0;
496 pub const SEEK_CUR: ::c_int = 1;
497 pub const SEEK_END: ::c_int = 2;
498 pub const _IOFBF: ::c_int = 0;
499 pub const _IONBF: ::c_int = 2;
500 pub const _IOLBF: ::c_int = 1;
501 
502 pub const F_DUPFD: ::c_int = 0x0001;
503 pub const F_GETFD: ::c_int = 0x0002;
504 pub const F_SETFD: ::c_int = 0x0004;
505 pub const F_GETFL: ::c_int = 0x0008;
506 pub const F_SETFL: ::c_int = 0x0010;
507 pub const F_GETLK: ::c_int = 0x0020;
508 pub const F_SETLK: ::c_int = 0x0080;
509 pub const F_SETLKW: ::c_int = 0x0100;
510 pub const F_DUPFD_CLOEXEC: ::c_int = 0x0200;
511 
512 pub const F_RDLCK: ::c_int = 0x0040;
513 pub const F_UNLCK: ::c_int = 0x0200;
514 pub const F_WRLCK: ::c_int = 0x0400;
515 
516 pub const AT_FDCWD: ::c_int = -1;
517 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01;
518 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02;
519 pub const AT_REMOVEDIR: ::c_int = 0x04;
520 pub const AT_EACCESS: ::c_int = 0x08;
521 
522 pub const POLLIN: ::c_short = 0x0001;
523 pub const POLLOUT: ::c_short = 0x0002;
524 pub const POLLRDNORM: ::c_short = POLLIN;
525 pub const POLLWRNORM: ::c_short = POLLOUT;
526 pub const POLLRDBAND: ::c_short = 0x0008;
527 pub const POLLWRBAND: ::c_short = 0x0010;
528 pub const POLLPRI: ::c_short = 0x0020;
529 pub const POLLERR: ::c_short = 0x0004;
530 pub const POLLHUP: ::c_short = 0x0080;
531 pub const POLLNVAL: ::c_short = 0x1000;
532 
533 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
534 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
535 
536 pub const CLOCK_REALTIME: ::c_int = -1;
537 pub const CLOCK_MONOTONIC: ::c_int = 0;
538 
539 pub const RLIMIT_CORE: ::c_int = 0;
540 pub const RLIMIT_CPU: ::c_int = 1;
541 pub const RLIMIT_DATA: ::c_int = 2;
542 pub const RLIMIT_FSIZE: ::c_int = 3;
543 pub const RLIMIT_NOFILE: ::c_int = 4;
544 pub const RLIMIT_STACK: ::c_int = 5;
545 pub const RLIMIT_AS: ::c_int = 6;
546 // Haiku specific
547 pub const RLIMIT_NOVMON: ::c_int = 7;
548 pub const RLIM_NLIMITS: ::c_int = 8;
549 
550 pub const RUSAGE_SELF: ::c_int = 0;
551 
552 pub const RTLD_LAZY: ::c_int = 0;
553 
554 pub const NCCS: usize = 11;
555 
556 pub const O_RDONLY: ::c_int = 0x0000;
557 pub const O_WRONLY: ::c_int = 0x0001;
558 pub const O_RDWR: ::c_int = 0x0002;
559 pub const O_ACCMODE: ::c_int = 0x0003;
560 
561 pub const O_EXCL: ::c_int = 0x0100;
562 pub const O_CREAT: ::c_int = 0x0200;
563 pub const O_TRUNC: ::c_int = 0x0400;
564 pub const O_NOCTTY: ::c_int = 0x1000;
565 pub const O_NOTRAVERSE: ::c_int = 0x2000;
566 
567 pub const O_CLOEXEC: ::c_int = 0x00000040;
568 pub const O_NONBLOCK: ::c_int = 0x00000080;
569 pub const O_APPEND: ::c_int = 0x00000800;
570 pub const O_SYNC: ::c_int = 0x00010000;
571 pub const O_RSYNC: ::c_int = 0x00020000;
572 pub const O_DSYNC: ::c_int = 0x00040000;
573 pub const O_NOFOLLOW: ::c_int = 0x00080000;
574 pub const O_NOCACHE: ::c_int = 0x00100000;
575 pub const O_DIRECTORY: ::c_int = 0x00200000;
576 
577 pub const S_IFIFO: ::mode_t = 4096;
578 pub const S_IFCHR: ::mode_t = 8192;
579 pub const S_IFBLK: ::mode_t = 24576;
580 pub const S_IFDIR: ::mode_t = 16384;
581 pub const S_IFREG: ::mode_t = 32768;
582 pub const S_IFLNK: ::mode_t = 40960;
583 pub const S_IFSOCK: ::mode_t = 49152;
584 pub const S_IFMT: ::mode_t = 61440;
585 
586 pub const S_IRWXU: ::mode_t = 0o00700;
587 pub const S_IRUSR: ::mode_t = 0o00400;
588 pub const S_IWUSR: ::mode_t = 0o00200;
589 pub const S_IXUSR: ::mode_t = 0o00100;
590 pub const S_IRWXG: ::mode_t = 0o00070;
591 pub const S_IRGRP: ::mode_t = 0o00040;
592 pub const S_IWGRP: ::mode_t = 0o00020;
593 pub const S_IXGRP: ::mode_t = 0o00010;
594 pub const S_IRWXO: ::mode_t = 0o00007;
595 pub const S_IROTH: ::mode_t = 0o00004;
596 pub const S_IWOTH: ::mode_t = 0o00002;
597 pub const S_IXOTH: ::mode_t = 0o00001;
598 
599 pub const F_OK: ::c_int = 0;
600 pub const R_OK: ::c_int = 4;
601 pub const W_OK: ::c_int = 2;
602 pub const X_OK: ::c_int = 1;
603 pub const STDIN_FILENO: ::c_int = 0;
604 pub const STDOUT_FILENO: ::c_int = 1;
605 pub const STDERR_FILENO: ::c_int = 2;
606 
607 pub const SIGHUP: ::c_int = 1;
608 pub const SIGINT: ::c_int = 2;
609 pub const SIGQUIT: ::c_int = 3;
610 pub const SIGILL: ::c_int = 4;
611 pub const SIGCHLD: ::c_int = 5;
612 pub const SIGABRT: ::c_int = 6;
613 pub const SIGPIPE: ::c_int = 7;
614 pub const SIGFPE: ::c_int = 8;
615 pub const SIGKILL: ::c_int = 9;
616 pub const SIGSTOP: ::c_int = 10;
617 pub const SIGSEGV: ::c_int = 11;
618 pub const SIGCONT: ::c_int = 12;
619 pub const SIGTSTP: ::c_int = 13;
620 pub const SIGALRM: ::c_int = 14;
621 pub const SIGTERM: ::c_int = 15;
622 pub const SIGTTIN: ::c_int = 16;
623 pub const SIGTTOU: ::c_int = 17;
624 pub const SIGUSR1: ::c_int = 18;
625 pub const SIGUSR2: ::c_int = 19;
626 pub const SIGWINCH: ::c_int = 20;
627 pub const SIGKILLTHR: ::c_int = 21;
628 pub const SIGTRAP: ::c_int = 22;
629 pub const SIGPOLL: ::c_int = 23;
630 pub const SIGPROF: ::c_int = 24;
631 pub const SIGSYS: ::c_int = 25;
632 pub const SIGURG: ::c_int = 26;
633 pub const SIGVTALRM: ::c_int = 27;
634 pub const SIGXCPU: ::c_int = 28;
635 pub const SIGXFSZ: ::c_int = 29;
636 pub const SIGBUS: ::c_int = 30;
637 
638 pub const SIG_BLOCK: ::c_int = 1;
639 pub const SIG_UNBLOCK: ::c_int = 2;
640 pub const SIG_SETMASK: ::c_int = 3;
641 
642 pub const SIGEV_NONE: ::c_int = 0;
643 pub const SIGEV_SIGNAL: ::c_int = 1;
644 pub const SIGEV_THREAD: ::c_int = 2;
645 
646 pub const EAI_AGAIN: ::c_int = 2;
647 pub const EAI_BADFLAGS: ::c_int = 3;
648 pub const EAI_FAIL: ::c_int = 4;
649 pub const EAI_FAMILY: ::c_int = 5;
650 pub const EAI_MEMORY: ::c_int = 6;
651 pub const EAI_NODATA: ::c_int = 7;
652 pub const EAI_NONAME: ::c_int = 8;
653 pub const EAI_SERVICE: ::c_int = 9;
654 pub const EAI_SOCKTYPE: ::c_int = 10;
655 pub const EAI_SYSTEM: ::c_int = 11;
656 pub const EAI_OVERFLOW: ::c_int = 14;
657 
658 pub const PROT_NONE: ::c_int = 0;
659 pub const PROT_READ: ::c_int = 1;
660 pub const PROT_WRITE: ::c_int = 2;
661 pub const PROT_EXEC: ::c_int = 4;
662 
663 pub const LC_ALL: ::c_int = 0;
664 pub const LC_COLLATE: ::c_int = 1;
665 pub const LC_CTYPE: ::c_int = 2;
666 pub const LC_MONETARY: ::c_int = 3;
667 pub const LC_NUMERIC: ::c_int = 4;
668 pub const LC_TIME: ::c_int = 5;
669 pub const LC_MESSAGES: ::c_int = 6;
670 
671 // FIXME: Haiku does not have MAP_FILE, but libstd/os.rs requires it
672 pub const MAP_FILE: ::c_int = 0x00;
673 pub const MAP_SHARED: ::c_int = 0x01;
674 pub const MAP_PRIVATE: ::c_int = 0x02;
675 pub const MAP_FIXED: ::c_int = 0x04;
676 pub const MAP_ANONYMOUS: ::c_int = 0x08;
677 pub const MAP_ANON: ::c_int = MAP_ANONYMOUS;
678 
679 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
680 
681 pub const MS_ASYNC: ::c_int = 0x01;
682 pub const MS_INVALIDATE: ::c_int = 0x04;
683 pub const MS_SYNC: ::c_int = 0x02;
684 
685 pub const E2BIG: ::c_int = -2147454975;
686 pub const ECHILD: ::c_int = -2147454974;
687 pub const EDEADLK: ::c_int = -2147454973;
688 pub const EFBIG: ::c_int = -2147454972;
689 pub const EMLINK: ::c_int = -2147454971;
690 pub const ENFILE: ::c_int = -2147454970;
691 pub const ENODEV: ::c_int = -2147454969;
692 pub const ENOLCK: ::c_int = -2147454968;
693 pub const ENOSYS: ::c_int = -2147454967;
694 pub const ENOTTY: ::c_int = -2147454966;
695 pub const ENXIO: ::c_int = -2147454965;
696 pub const ESPIPE: ::c_int = -2147454964;
697 pub const ESRCH: ::c_int = -2147454963;
698 pub const EFPOS: ::c_int = -2147454962;
699 pub const ESIGPARM: ::c_int = -2147454961;
700 pub const EDOM: ::c_int = -2147454960;
701 pub const ERANGE: ::c_int = -2147454959;
702 pub const EPROTOTYPE: ::c_int = -2147454958;
703 pub const EPROTONOSUPPORT: ::c_int = -2147454957;
704 pub const EPFNOSUPPORT: ::c_int = -2147454956;
705 pub const EAFNOSUPPORT: ::c_int = -2147454955;
706 pub const EADDRINUSE: ::c_int = -2147454954;
707 pub const EADDRNOTAVAIL: ::c_int = -2147454953;
708 pub const ENETDOWN: ::c_int = -2147454952;
709 pub const ENETUNREACH: ::c_int = -2147454951;
710 pub const ENETRESET: ::c_int = -2147454950;
711 pub const ECONNABORTED: ::c_int = -2147454949;
712 pub const ECONNRESET: ::c_int = -2147454948;
713 pub const EISCONN: ::c_int = -2147454947;
714 pub const ENOTCONN: ::c_int = -2147454946;
715 pub const ESHUTDOWN: ::c_int = -2147454945;
716 pub const ECONNREFUSED: ::c_int = -2147454944;
717 pub const EHOSTUNREACH: ::c_int = -2147454943;
718 pub const ENOPROTOOPT: ::c_int = -2147454942;
719 pub const ENOBUFS: ::c_int = -2147454941;
720 pub const EINPROGRESS: ::c_int = -2147454940;
721 pub const EALREADY: ::c_int = -2147454939;
722 pub const EILSEQ: ::c_int = -2147454938;
723 pub const ENOMSG: ::c_int = -2147454937;
724 pub const ESTALE: ::c_int = -2147454936;
725 pub const EOVERFLOW: ::c_int = -2147454935;
726 pub const EMSGSIZE: ::c_int = -2147454934;
727 pub const EOPNOTSUPP: ::c_int = -2147454933;
728 pub const ENOTSOCK: ::c_int = -2147454932;
729 pub const EHOSTDOWN: ::c_int = -2147454931;
730 pub const EBADMSG: ::c_int = -2147454930;
731 pub const ECANCELED: ::c_int = -2147454929;
732 pub const EDESTADDRREQ: ::c_int = -2147454928;
733 pub const EDQUOT: ::c_int = -2147454927;
734 pub const EIDRM: ::c_int = -2147454926;
735 pub const EMULTIHOP: ::c_int = -2147454925;
736 pub const ENODATA: ::c_int = -2147454924;
737 pub const ENOLINK: ::c_int = -2147454923;
738 pub const ENOSR: ::c_int = -2147454922;
739 pub const ENOSTR: ::c_int = -2147454921;
740 pub const ENOTSUP: ::c_int = -2147454920;
741 pub const EPROTO: ::c_int = -2147454919;
742 pub const ETIME: ::c_int = -2147454918;
743 pub const ETXTBSY: ::c_int = -2147454917;
744 pub const ENOATTR: ::c_int = -2147454916;
745 
746 // INT_MIN
747 pub const ENOMEM: ::c_int = -2147483648;
748 
749 // POSIX errors that can be mapped to BeOS error codes
750 pub const EACCES: ::c_int = -2147483646;
751 pub const EINTR: ::c_int = -2147483638;
752 pub const EIO: ::c_int = -2147483647;
753 pub const EBUSY: ::c_int = -2147483634;
754 pub const EFAULT: ::c_int = -2147478783;
755 pub const ETIMEDOUT: ::c_int = -2147483639;
756 pub const EAGAIN: ::c_int = -2147483637;
757 pub const EWOULDBLOCK: ::c_int = -2147483637;
758 pub const EBADF: ::c_int = -2147459072;
759 pub const EEXIST: ::c_int = -2147459070;
760 pub const EINVAL: ::c_int = -2147483643;
761 pub const ENAMETOOLONG: ::c_int = -2147459068;
762 pub const ENOENT: ::c_int = -2147459069;
763 pub const EPERM: ::c_int = -2147483633;
764 pub const ENOTDIR: ::c_int = -2147459067;
765 pub const EISDIR: ::c_int = -2147459063;
766 pub const ENOTEMPTY: ::c_int = -2147459066;
767 pub const ENOSPC: ::c_int = -2147459065;
768 pub const EROFS: ::c_int = -2147459064;
769 pub const EMFILE: ::c_int = -2147459062;
770 pub const EXDEV: ::c_int = -2147459061;
771 pub const ELOOP: ::c_int = -2147459060;
772 pub const ENOEXEC: ::c_int = -2147478782;
773 pub const EPIPE: ::c_int = -2147459059;
774 
775 pub const IPPROTO_RAW: ::c_int = 255;
776 
777 // These are prefixed with POSIX_ on Haiku
778 pub const MADV_NORMAL: ::c_int = 1;
779 pub const MADV_SEQUENTIAL: ::c_int = 2;
780 pub const MADV_RANDOM: ::c_int = 3;
781 pub const MADV_WILLNEED: ::c_int = 4;
782 pub const MADV_DONTNEED: ::c_int = 5;
783 
784 // https://github.com/haiku/haiku/blob/master/headers/posix/net/if.h#L80
785 pub const IFF_UP: ::c_int = 0x0001;
786 pub const IFF_BROADCAST: ::c_int = 0x0002; // valid broadcast address
787 pub const IFF_LOOPBACK: ::c_int = 0x0008;
788 pub const IFF_POINTOPOINT: ::c_int = 0x0010; // point-to-point link
789 pub const IFF_NOARP: ::c_int = 0x0040; // no address resolution
790 pub const IFF_AUTOUP: ::c_int = 0x0080; // auto dial
791 pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
792 pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
793 pub const IFF_SIMPLEX: ::c_int = 0x0800; // doesn't receive own transmissions
794 pub const IFF_LINK: ::c_int = 0x1000; // has link
795 pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000;
796 pub const IFF_CONFIGURING: ::c_int = 0x4000;
797 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
798 
799 pub const AF_UNSPEC: ::c_int = 0;
800 pub const AF_INET: ::c_int = 1;
801 pub const AF_APPLETALK: ::c_int = 2;
802 pub const AF_ROUTE: ::c_int = 3;
803 pub const AF_LINK: ::c_int = 4;
804 pub const AF_INET6: ::c_int = 5;
805 pub const AF_DLI: ::c_int = 6;
806 pub const AF_IPX: ::c_int = 7;
807 pub const AF_NOTIFY: ::c_int = 8;
808 pub const AF_LOCAL: ::c_int = 9;
809 pub const AF_UNIX: ::c_int = AF_LOCAL;
810 pub const AF_BLUETOOTH: ::c_int = 10;
811 
812 pub const IP_OPTIONS: ::c_int = 1;
813 pub const IP_HDRINCL: ::c_int = 2;
814 pub const IP_TOS: ::c_int = 3;
815 pub const IP_TTL: ::c_int = 4;
816 pub const IP_RECVOPTS: ::c_int = 5;
817 pub const IP_RECVRETOPTS: ::c_int = 6;
818 pub const IP_RECVDSTADDR: ::c_int = 7;
819 pub const IP_RETOPTS: ::c_int = 8;
820 pub const IP_MULTICAST_IF: ::c_int = 9;
821 pub const IP_MULTICAST_TTL: ::c_int = 10;
822 pub const IP_MULTICAST_LOOP: ::c_int = 11;
823 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
824 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
825 pub const IP_BLOCK_SOURCE: ::c_int = 14;
826 pub const IP_UNBLOCK_SOURCE: ::c_int = 15;
827 pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 16;
828 pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 17;
829 
830 pub const TCP_NODELAY: ::c_int = 0x01;
831 pub const TCP_MAXSEG: ::c_int = 0x02;
832 pub const TCP_NOPUSH: ::c_int = 0x04;
833 pub const TCP_NOOPT: ::c_int = 0x08;
834 
835 pub const IF_NAMESIZE: ::size_t = 32;
836 pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
837 
838 pub const IPV6_MULTICAST_IF: ::c_int = 24;
839 pub const IPV6_MULTICAST_HOPS: ::c_int = 25;
840 pub const IPV6_MULTICAST_LOOP: ::c_int = 26;
841 pub const IPV6_UNICAST_HOPS: ::c_int = 27;
842 pub const IPV6_JOIN_GROUP: ::c_int = 28;
843 pub const IPV6_LEAVE_GROUP: ::c_int = 29;
844 pub const IPV6_V6ONLY: ::c_int = 30;
845 pub const IPV6_PKTINFO: ::c_int = 31;
846 pub const IPV6_RECVPKTINFO: ::c_int = 32;
847 pub const IPV6_HOPLIMIT: ::c_int = 33;
848 pub const IPV6_RECVHOPLIMIT: ::c_int = 34;
849 pub const IPV6_HOPOPTS: ::c_int = 35;
850 pub const IPV6_DSTOPTS: ::c_int = 36;
851 pub const IPV6_RTHDR: ::c_int = 37;
852 
853 pub const MSG_OOB: ::c_int = 0x0001;
854 pub const MSG_PEEK: ::c_int = 0x0002;
855 pub const MSG_DONTROUTE: ::c_int = 0x0004;
856 pub const MSG_EOR: ::c_int = 0x0008;
857 pub const MSG_TRUNC: ::c_int = 0x0010;
858 pub const MSG_CTRUNC: ::c_int = 0x0020;
859 pub const MSG_WAITALL: ::c_int = 0x0040;
860 pub const MSG_DONTWAIT: ::c_int = 0x0080;
861 pub const MSG_BCAST: ::c_int = 0x0100;
862 pub const MSG_MCAST: ::c_int = 0x0200;
863 pub const MSG_EOF: ::c_int = 0x0400;
864 pub const MSG_NOSIGNAL: ::c_int = 0x0800;
865 
866 pub const SHUT_RD: ::c_int = 0;
867 pub const SHUT_WR: ::c_int = 1;
868 pub const SHUT_RDWR: ::c_int = 2;
869 
870 pub const LOCK_SH: ::c_int = 0x01;
871 pub const LOCK_EX: ::c_int = 0x02;
872 pub const LOCK_NB: ::c_int = 0x04;
873 pub const LOCK_UN: ::c_int = 0x08;
874 
875 pub const SIGSTKSZ: ::size_t = 16384;
876 
877 pub const IOV_MAX: ::c_int = 1024;
878 pub const PATH_MAX: ::c_int = 1024;
879 
880 pub const SA_NOCLDSTOP: ::c_int = 0x01;
881 pub const SA_NOCLDWAIT: ::c_int = 0x02;
882 pub const SA_RESETHAND: ::c_int = 0x04;
883 pub const SA_NODEFER: ::c_int = 0x08;
884 pub const SA_RESTART: ::c_int = 0x10;
885 pub const SA_ONSTACK: ::c_int = 0x20;
886 pub const SA_SIGINFO: ::c_int = 0x40;
887 pub const SA_NOMASK: ::c_int = SA_NODEFER;
888 pub const SA_STACK: ::c_int = SA_ONSTACK;
889 pub const SA_ONESHOT: ::c_int = SA_RESETHAND;
890 
891 pub const FD_SETSIZE: usize = 1024;
892 
893 pub const RTLD_LOCAL: ::c_int = 0x0;
894 pub const RTLD_NOW: ::c_int = 0x1;
895 pub const RTLD_GLOBAL: ::c_int = 0x2;
896 pub const RTLD_DEFAULT: *mut ::c_void = 0isize as *mut ::c_void;
897 
898 pub const BUFSIZ: ::c_uint = 8192;
899 pub const FILENAME_MAX: ::c_uint = 256;
900 pub const FOPEN_MAX: ::c_uint = 128;
901 pub const L_tmpnam: ::c_uint = 512;
902 pub const TMP_MAX: ::c_uint = 32768;
903 
904 pub const _PC_CHOWN_RESTRICTED: ::c_int = 1;
905 pub const _PC_MAX_CANON: ::c_int = 2;
906 pub const _PC_MAX_INPUT: ::c_int = 3;
907 pub const _PC_NAME_MAX: ::c_int = 4;
908 pub const _PC_NO_TRUNC: ::c_int = 5;
909 pub const _PC_PATH_MAX: ::c_int = 6;
910 pub const _PC_PIPE_BUF: ::c_int = 7;
911 pub const _PC_VDISABLE: ::c_int = 8;
912 pub const _PC_LINK_MAX: ::c_int = 25;
913 pub const _PC_SYNC_IO: ::c_int = 26;
914 pub const _PC_ASYNC_IO: ::c_int = 27;
915 pub const _PC_PRIO_IO: ::c_int = 28;
916 pub const _PC_SOCK_MAXBUF: ::c_int = 29;
917 pub const _PC_FILESIZEBITS: ::c_int = 30;
918 pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 31;
919 pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 32;
920 pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 33;
921 pub const _PC_REC_XFER_ALIGN: ::c_int = 34;
922 pub const _PC_ALLOC_SIZE_MIN: ::c_int = 35;
923 pub const _PC_SYMLINK_MAX: ::c_int = 36;
924 pub const _PC_2_SYMLINKS: ::c_int = 37;
925 pub const _PC_XATTR_EXISTS: ::c_int = 38;
926 pub const _PC_XATTR_ENABLED: ::c_int = 39;
927 
928 pub const FIONBIO: ::c_ulong = 0xbe000000;
929 pub const FIONREAD: ::c_ulong = 0xbe000001;
930 pub const FIOSEEKDATA: ::c_ulong = 0xbe000002;
931 pub const FIOSEEKHOLE: ::c_ulong = 0xbe000003;
932 
933 pub const _SC_ARG_MAX: ::c_int = 15;
934 pub const _SC_CHILD_MAX: ::c_int = 16;
935 pub const _SC_CLK_TCK: ::c_int = 17;
936 pub const _SC_JOB_CONTROL: ::c_int = 18;
937 pub const _SC_NGROUPS_MAX: ::c_int = 19;
938 pub const _SC_OPEN_MAX: ::c_int = 20;
939 pub const _SC_SAVED_IDS: ::c_int = 21;
940 pub const _SC_STREAM_MAX: ::c_int = 22;
941 pub const _SC_TZNAME_MAX: ::c_int = 23;
942 pub const _SC_VERSION: ::c_int = 24;
943 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 25;
944 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 26;
945 pub const _SC_PAGESIZE: ::c_int = 27;
946 pub const _SC_PAGE_SIZE: ::c_int = 27;
947 pub const _SC_SEM_NSEMS_MAX: ::c_int = 28;
948 pub const _SC_SEM_VALUE_MAX: ::c_int = 29;
949 pub const _SC_SEMAPHORES: ::c_int = 30;
950 pub const _SC_THREADS: ::c_int = 31;
951 pub const _SC_IOV_MAX: ::c_int = 32;
952 pub const _SC_UIO_MAXIOV: ::c_int = 32;
953 pub const _SC_NPROCESSORS_CONF: ::c_int = 34;
954 pub const _SC_NPROCESSORS_ONLN: ::c_int = 35;
955 pub const _SC_ATEXIT_MAX: ::c_int = 37;
956 pub const _SC_PASS_MAX: ::c_int = 39;
957 pub const _SC_PHYS_PAGES: ::c_int = 40;
958 pub const _SC_AVPHYS_PAGES: ::c_int = 41;
959 pub const _SC_PIPE: ::c_int = 42;
960 pub const _SC_SELECT: ::c_int = 43;
961 pub const _SC_POLL: ::c_int = 44;
962 pub const _SC_MAPPED_FILES: ::c_int = 45;
963 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 46;
964 pub const _SC_THREAD_STACK_MIN: ::c_int = 47;
965 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 48;
966 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 49;
967 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 50;
968 pub const _SC_REALTIME_SIGNALS: ::c_int = 51;
969 pub const _SC_MEMORY_PROTECTION: ::c_int = 52;
970 pub const _SC_SIGQUEUE_MAX: ::c_int = 53;
971 pub const _SC_RTSIG_MAX: ::c_int = 54;
972 pub const _SC_MONOTONIC_CLOCK: ::c_int = 55;
973 pub const _SC_DELAYTIMER_MAX: ::c_int = 56;
974 pub const _SC_TIMER_MAX: ::c_int = 57;
975 pub const _SC_TIMERS: ::c_int = 58;
976 pub const _SC_CPUTIME: ::c_int = 59;
977 pub const _SC_THREAD_CPUTIME: ::c_int = 60;
978 pub const _SC_HOST_NAME_MAX: ::c_int = 61;
979 pub const _SC_REGEXP: ::c_int = 62;
980 pub const _SC_SYMLOOP_MAX: ::c_int = 63;
981 pub const _SC_SHELL: ::c_int = 64;
982 
983 pub const PTHREAD_STACK_MIN: ::size_t = 8192;
984 
985 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
986     flags: 0,
987     lock: 0,
988     unused: -42,
989     owner: -1,
990     owner_count: 0,
991 };
992 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
993     flags: 0,
994     unused: -42,
995     mutex: 0 as *mut _,
996     waiter_count: 0,
997     lock: 0,
998 };
999 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1000     flags: 0,
1001     owner: -1,
1002     lock_sem: 0,
1003     lock_count: 0,
1004     reader_count: 0,
1005     writer_count: 0,
1006     waiters: [0 as *mut _; 2],
1007 };
1008 
1009 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0;
1010 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1;
1011 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
1012 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
1013 
1014 pub const FIOCLEX: c_ulong = 0; // FIXME: does not exist on Haiku!
1015 
1016 pub const RUSAGE_CHILDREN: ::c_int = -1;
1017 
1018 pub const SOCK_STREAM: ::c_int = 1;
1019 pub const SOCK_DGRAM: ::c_int = 2;
1020 pub const SOCK_RAW: ::c_int = 3;
1021 pub const SOCK_SEQPACKET: ::c_int = 5;
1022 
1023 pub const SOL_SOCKET: ::c_int = -1;
1024 pub const SO_ACCEPTCONN: ::c_int = 0x00000001;
1025 pub const SO_BROADCAST: ::c_int = 0x00000002;
1026 pub const SO_DEBUG: ::c_int = 0x00000004;
1027 pub const SO_DONTROUTE: ::c_int = 0x00000008;
1028 pub const SO_KEEPALIVE: ::c_int = 0x00000010;
1029 pub const SO_OOBINLINE: ::c_int = 0x00000020;
1030 pub const SO_REUSEADDR: ::c_int = 0x00000040;
1031 pub const SO_REUSEPORT: ::c_int = 0x00000080;
1032 pub const SO_USELOOPBACK: ::c_int = 0x00000100;
1033 pub const SO_LINGER: ::c_int = 0x00000200;
1034 pub const SO_SNDBUF: ::c_int = 0x40000001;
1035 pub const SO_SNDLOWAT: ::c_int = 0x40000002;
1036 pub const SO_SNDTIMEO: ::c_int = 0x40000003;
1037 pub const SO_RCVBUF: ::c_int = 0x40000004;
1038 pub const SO_RCVLOWAT: ::c_int = 0x40000005;
1039 pub const SO_RCVTIMEO: ::c_int = 0x40000006;
1040 pub const SO_ERROR: ::c_int = 0x40000007;
1041 pub const SO_TYPE: ::c_int = 0x40000008;
1042 pub const SO_NONBLOCK: ::c_int = 0x40000009;
1043 pub const SO_BINDTODEVICE: ::c_int = 0x4000000a;
1044 pub const SO_PEERCRED: ::c_int = 0x4000000b;
1045 
1046 pub const SCM_RIGHTS: ::c_int = 0x01;
1047 
1048 pub const NI_MAXHOST: ::size_t = 1025;
1049 
1050 pub const WNOHANG: ::c_int = 0x01;
1051 pub const WUNTRACED: ::c_int = 0x02;
1052 pub const WCONTINUED: ::c_int = 0x04;
1053 pub const WEXITED: ::c_int = 0x08;
1054 pub const WSTOPPED: ::c_int = 0x10;
1055 pub const WNOWAIT: ::c_int = 0x20;
1056 
1057 pub const CLD_EXITED: ::c_int = 60;
1058 pub const CLD_KILLED: ::c_int = 61;
1059 pub const CLD_DUMPED: ::c_int = 62;
1060 pub const CLD_TRAPPED: ::c_int = 63;
1061 pub const CLD_STOPPED: ::c_int = 64;
1062 pub const CLD_CONTINUED: ::c_int = 65;
1063 
1064 pub const P_ALL: idtype_t = 0;
1065 pub const P_PID: idtype_t = 1;
1066 pub const P_PGID: idtype_t = 2;
1067 
1068 pub const UTIME_OMIT: c_long = 1000000001;
1069 pub const UTIME_NOW: c_long = 1000000000;
1070 
1071 pub const VINTR: usize = 0;
1072 pub const VQUIT: usize = 1;
1073 pub const VERASE: usize = 2;
1074 pub const VKILL: usize = 3;
1075 pub const VEOF: usize = 4;
1076 pub const VEOL: usize = 5;
1077 pub const VMIN: usize = 4;
1078 pub const VTIME: usize = 5;
1079 pub const VEOL2: usize = 6;
1080 pub const VSWTCH: usize = 7;
1081 pub const VSTART: usize = 8;
1082 pub const VSTOP: usize = 9;
1083 pub const VSUSP: usize = 10;
1084 
1085 pub const IGNBRK: ::tcflag_t = 0x01;
1086 pub const BRKINT: ::tcflag_t = 0x02;
1087 pub const IGNPAR: ::tcflag_t = 0x04;
1088 pub const PARMRK: ::tcflag_t = 0x08;
1089 pub const INPCK: ::tcflag_t = 0x10;
1090 pub const ISTRIP: ::tcflag_t = 0x20;
1091 pub const INLCR: ::tcflag_t = 0x40;
1092 pub const IGNCR: ::tcflag_t = 0x80;
1093 pub const ICRNL: ::tcflag_t = 0x100;
1094 pub const IUCLC: ::tcflag_t = 0x200;
1095 pub const IXON: ::tcflag_t = 0x400;
1096 pub const IXANY: ::tcflag_t = 0x800;
1097 pub const IXOFF: ::tcflag_t = 0x1000;
1098 
1099 pub const OPOST: ::tcflag_t = 0x00000001;
1100 pub const OLCUC: ::tcflag_t = 0x00000002;
1101 pub const ONLCR: ::tcflag_t = 0x00000004;
1102 pub const OCRNL: ::tcflag_t = 0x00000008;
1103 pub const ONOCR: ::tcflag_t = 0x00000010;
1104 pub const ONLRET: ::tcflag_t = 0x00000020;
1105 pub const OFILL: ::tcflag_t = 0x00000040;
1106 pub const OFDEL: ::tcflag_t = 0x00000080;
1107 pub const NLDLY: ::tcflag_t = 0x00000100;
1108 pub const NL0: ::tcflag_t = 0x00000000;
1109 pub const NL1: ::tcflag_t = 0x00000100;
1110 pub const CRDLY: ::tcflag_t = 0x00000600;
1111 pub const CR0: ::tcflag_t = 0x00000000;
1112 pub const CR1: ::tcflag_t = 0x00000200;
1113 pub const CR2: ::tcflag_t = 0x00000400;
1114 pub const CR3: ::tcflag_t = 0x00000600;
1115 pub const TABDLY: ::tcflag_t = 0x00001800;
1116 pub const TAB0: ::tcflag_t = 0x00000000;
1117 pub const TAB1: ::tcflag_t = 0x00000800;
1118 pub const TAB2: ::tcflag_t = 0x00001000;
1119 pub const TAB3: ::tcflag_t = 0x00001800;
1120 pub const BSDLY: ::tcflag_t = 0x00002000;
1121 pub const BS0: ::tcflag_t = 0x00000000;
1122 pub const BS1: ::tcflag_t = 0x00002000;
1123 pub const VTDLY: ::tcflag_t = 0x00004000;
1124 pub const VT0: ::tcflag_t = 0x00000000;
1125 pub const VT1: ::tcflag_t = 0x00004000;
1126 pub const FFDLY: ::tcflag_t = 0x00008000;
1127 pub const FF0: ::tcflag_t = 0x00000000;
1128 pub const FF1: ::tcflag_t = 0x00008000;
1129 
1130 pub const CSIZE: ::tcflag_t = 0x00000020;
1131 pub const CS5: ::tcflag_t = 0x00000000;
1132 pub const CS6: ::tcflag_t = 0x00000000;
1133 pub const CS7: ::tcflag_t = 0x00000000;
1134 pub const CS8: ::tcflag_t = 0x00000020;
1135 pub const CSTOPB: ::tcflag_t = 0x00000040;
1136 pub const CREAD: ::tcflag_t = 0x00000080;
1137 pub const PARENB: ::tcflag_t = 0x00000100;
1138 pub const PARODD: ::tcflag_t = 0x00000200;
1139 pub const HUPCL: ::tcflag_t = 0x00000400;
1140 pub const CLOCAL: ::tcflag_t = 0x00000800;
1141 pub const XLOBLK: ::tcflag_t = 0x00001000;
1142 pub const CTSFLOW: ::tcflag_t = 0x00002000;
1143 pub const RTSFLOW: ::tcflag_t = 0x00004000;
1144 pub const CRTSCTS: ::tcflag_t = RTSFLOW | CTSFLOW;
1145 
1146 pub const ISIG: ::tcflag_t = 0x00000001;
1147 pub const ICANON: ::tcflag_t = 0x00000002;
1148 pub const XCASE: ::tcflag_t = 0x00000004;
1149 pub const ECHO: ::tcflag_t = 0x00000008;
1150 pub const ECHOE: ::tcflag_t = 0x00000010;
1151 pub const ECHOK: ::tcflag_t = 0x00000020;
1152 pub const ECHONL: ::tcflag_t = 0x00000040;
1153 pub const NOFLSH: ::tcflag_t = 0x00000080;
1154 pub const TOSTOP: ::tcflag_t = 0x00000100;
1155 pub const IEXTEN: ::tcflag_t = 0x00000200;
1156 pub const ECHOCTL: ::tcflag_t = 0x00000400;
1157 pub const ECHOPRT: ::tcflag_t = 0x00000800;
1158 pub const ECHOKE: ::tcflag_t = 0x00001000;
1159 pub const FLUSHO: ::tcflag_t = 0x00002000;
1160 pub const PENDIN: ::tcflag_t = 0x00004000;
1161 
1162 pub const TCGB_CTS: ::c_int = 0x01;
1163 pub const TCGB_DSR: ::c_int = 0x02;
1164 pub const TCGB_RI: ::c_int = 0x04;
1165 pub const TCGB_DCD: ::c_int = 0x08;
1166 pub const TIOCM_CTS: ::c_int = TCGB_CTS;
1167 pub const TIOCM_CD: ::c_int = TCGB_DCD;
1168 pub const TIOCM_CAR: ::c_int = TIOCM_CD;
1169 pub const TIOCM_RI: ::c_int = TCGB_RI;
1170 pub const TIOCM_DSR: ::c_int = TCGB_DSR;
1171 pub const TIOCM_DTR: ::c_int = 0x10;
1172 pub const TIOCM_RTS: ::c_int = 0x20;
1173 
1174 pub const B0: speed_t = 0x00;
1175 pub const B50: speed_t = 0x01;
1176 pub const B75: speed_t = 0x02;
1177 pub const B110: speed_t = 0x03;
1178 pub const B134: speed_t = 0x04;
1179 pub const B150: speed_t = 0x05;
1180 pub const B200: speed_t = 0x06;
1181 pub const B300: speed_t = 0x07;
1182 pub const B600: speed_t = 0x08;
1183 pub const B1200: speed_t = 0x09;
1184 pub const B1800: speed_t = 0x0A;
1185 pub const B2400: speed_t = 0x0B;
1186 pub const B4800: speed_t = 0x0C;
1187 pub const B9600: speed_t = 0x0D;
1188 pub const B19200: speed_t = 0x0E;
1189 pub const B38400: speed_t = 0x0F;
1190 pub const B57600: speed_t = 0x10;
1191 pub const B115200: speed_t = 0x11;
1192 pub const B230400: speed_t = 0x12;
1193 pub const B31250: speed_t = 0x13;
1194 
1195 pub const TCSANOW: ::c_int = 0x01;
1196 pub const TCSADRAIN: ::c_int = 0x02;
1197 pub const TCSAFLUSH: ::c_int = 0x04;
1198 
1199 pub const TCOOFF: ::c_int = 0x01;
1200 pub const TCOON: ::c_int = 0x02;
1201 pub const TCIOFF: ::c_int = 0x04;
1202 pub const TCION: ::c_int = 0x08;
1203 
1204 pub const TCIFLUSH: ::c_int = 0x01;
1205 pub const TCOFLUSH: ::c_int = 0x02;
1206 pub const TCIOFLUSH: ::c_int = 0x03;
1207 
1208 pub const TCGETA: ::c_ulong = 0x8000;
1209 pub const TCSETA: ::c_ulong = TCGETA + 1;
1210 pub const TCSETAF: ::c_ulong = TCGETA + 2;
1211 pub const TCSETAW: ::c_ulong = TCGETA + 3;
1212 pub const TCWAITEVENT: ::c_ulong = TCGETA + 4;
1213 pub const TCSBRK: ::c_ulong = TCGETA + 5;
1214 pub const TCFLSH: ::c_ulong = TCGETA + 6;
1215 pub const TCXONC: ::c_ulong = TCGETA + 7;
1216 pub const TCQUERYCONNECTED: ::c_ulong = TCGETA + 8;
1217 pub const TCGETBITS: ::c_ulong = TCGETA + 9;
1218 pub const TCSETDTR: ::c_ulong = TCGETA + 10;
1219 pub const TCSETRTS: ::c_ulong = TCGETA + 11;
1220 pub const TIOCGWINSZ: ::c_ulong = TCGETA + 12;
1221 pub const TIOCSWINSZ: ::c_ulong = TCGETA + 13;
1222 pub const TCVTIME: ::c_ulong = TCGETA + 14;
1223 pub const TIOCGPGRP: ::c_ulong = TCGETA + 15;
1224 pub const TIOCSPGRP: ::c_ulong = TCGETA + 16;
1225 pub const TIOCSCTTY: ::c_ulong = TCGETA + 17;
1226 pub const TIOCMGET: ::c_ulong = TCGETA + 18;
1227 pub const TIOCMSET: ::c_ulong = TCGETA + 19;
1228 pub const TIOCSBRK: ::c_ulong = TCGETA + 20;
1229 pub const TIOCCBRK: ::c_ulong = TCGETA + 21;
1230 pub const TIOCMBIS: ::c_ulong = TCGETA + 22;
1231 pub const TIOCMBIC: ::c_ulong = TCGETA + 23;
1232 
1233 pub const PRIO_PROCESS: ::c_int = 0;
1234 pub const PRIO_PGRP: ::c_int = 1;
1235 pub const PRIO_USER: ::c_int = 2;
1236 
1237 pub const LOG_PID: ::c_int = 1 << 12;
1238 pub const LOG_CONS: ::c_int = 2 << 12;
1239 pub const LOG_ODELAY: ::c_int = 4 << 12;
1240 pub const LOG_NDELAY: ::c_int = 8 << 12;
1241 pub const LOG_SERIAL: ::c_int = 16 << 12;
1242 pub const LOG_PERROR: ::c_int = 32 << 12;
1243 pub const LOG_NOWAIT: ::c_int = 64 << 12;
1244 
1245 const_fn! {
1246     {const} fn CMSG_ALIGN(len: usize) -> usize {
1247         len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
1248     }
1249 }
1250 
1251 f! {
1252     pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1253         if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
1254             (*mhdr).msg_control as *mut cmsghdr
1255         } else {
1256             0 as *mut cmsghdr
1257         }
1258     }
1259 
1260     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1261         (cmsg as *mut ::c_uchar)
1262             .offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1263     }
1264 
1265     pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1266         (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
1267             as ::c_uint
1268     }
1269 
1270     pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1271         CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
1272     }
1273 
1274     pub fn CMSG_NXTHDR(mhdr: *const msghdr,
1275                        cmsg: *const cmsghdr) -> *mut cmsghdr {
1276         if cmsg.is_null() {
1277             return ::CMSG_FIRSTHDR(mhdr);
1278         };
1279         let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)
1280             + CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
1281         let max = (*mhdr).msg_control as usize
1282             + (*mhdr).msg_controllen as usize;
1283         if next > max {
1284             0 as *mut ::cmsghdr
1285         } else {
1286             (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize))
1287                 as *mut ::cmsghdr
1288         }
1289     }
1290 
1291     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
1292         let fd = fd as usize;
1293         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1294         (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1295         return
1296     }
1297 
1298     pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1299         let fd = fd as usize;
1300         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1301         return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
1302     }
1303 
1304     pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
1305         let fd = fd as usize;
1306         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1307         (*set).fds_bits[fd / size] |= 1 << (fd % size);
1308         return
1309     }
1310 
1311     pub fn FD_ZERO(set: *mut fd_set) -> () {
1312         for slot in (*set).fds_bits.iter_mut() {
1313             *slot = 0;
1314         }
1315     }
1316 }
1317 
1318 safe_f! {
1319     pub {const} fn WIFEXITED(status: ::c_int) -> bool {
1320         (status & !0xff) == 0
1321     }
1322 
1323     pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
1324         status & 0xff
1325     }
1326 
1327     pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1328         ((status >> 8) & 0xff) != 0
1329     }
1330 
1331     pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
1332         (status >> 8) & 0xff
1333     }
1334 
1335     pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
1336         ((status >> 16) & 0xff) != 0
1337     }
1338 
1339     pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
1340         (status >> 16) & 0xff
1341     }
1342 
1343     // actually WIFCORED, but this is used everywhere else
1344     pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
1345         (status & 0x10000) != 0
1346     }
1347 
1348     pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
1349         (status & 0x20000) != 0
1350     }
1351 }
1352 
1353 extern "C" {
getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int1354     pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int1355     pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
getpriority(which: ::c_int, who: id_t) -> ::c_int1356     pub fn getpriority(which: ::c_int, who: id_t) -> ::c_int;
setpriority( which: ::c_int, who: id_t, priority: ::c_int, ) -> ::c_int1357     pub fn setpriority(
1358         which: ::c_int,
1359         who: id_t,
1360         priority: ::c_int,
1361     ) -> ::c_int;
1362 
utimensat( fd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int, ) -> ::c_int1363     pub fn utimensat(
1364         fd: ::c_int,
1365         path: *const ::c_char,
1366         times: *const ::timespec,
1367         flag: ::c_int,
1368     ) -> ::c_int;
futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int1369     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
strerror_r( errnum: ::c_int, buf: *mut c_char, buflen: ::size_t, ) -> ::c_int1370     pub fn strerror_r(
1371         errnum: ::c_int,
1372         buf: *mut c_char,
1373         buflen: ::size_t,
1374     ) -> ::c_int;
_errnop() -> *mut ::c_int1375     pub fn _errnop() -> *mut ::c_int;
1376 
abs(i: ::c_int) -> ::c_int1377     pub fn abs(i: ::c_int) -> ::c_int;
atof(s: *const ::c_char) -> ::c_double1378     pub fn atof(s: *const ::c_char) -> ::c_double;
labs(i: ::c_long) -> ::c_long1379     pub fn labs(i: ::c_long) -> ::c_long;
rand() -> ::c_int1380     pub fn rand() -> ::c_int;
srand(seed: ::c_uint)1381     pub fn srand(seed: ::c_uint);
1382 }
1383 
1384 #[link(name = "bsd")]
1385 extern "C" {
sem_destroy(sem: *mut sem_t) -> ::c_int1386     pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
sem_init( sem: *mut sem_t, pshared: ::c_int, value: ::c_uint, ) -> ::c_int1387     pub fn sem_init(
1388         sem: *mut sem_t,
1389         pshared: ::c_int,
1390         value: ::c_uint,
1391     ) -> ::c_int;
1392 
clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int1393     pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int1394     pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int;
pthread_create( thread: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int1395     pub fn pthread_create(
1396         thread: *mut ::pthread_t,
1397         attr: *const ::pthread_attr_t,
1398         f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
1399         value: *mut ::c_void,
1400     ) -> ::c_int;
pthread_attr_getguardsize( attr: *const ::pthread_attr_t, guardsize: *mut ::size_t, ) -> ::c_int1401     pub fn pthread_attr_getguardsize(
1402         attr: *const ::pthread_attr_t,
1403         guardsize: *mut ::size_t,
1404     ) -> ::c_int;
pthread_attr_getstack( attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t, ) -> ::c_int1405     pub fn pthread_attr_getstack(
1406         attr: *const ::pthread_attr_t,
1407         stackaddr: *mut *mut ::c_void,
1408         stacksize: *mut ::size_t,
1409     ) -> ::c_int;
pthread_condattr_getclock( attr: *const pthread_condattr_t, clock_id: *mut clockid_t, ) -> ::c_int1410     pub fn pthread_condattr_getclock(
1411         attr: *const pthread_condattr_t,
1412         clock_id: *mut clockid_t,
1413     ) -> ::c_int;
pthread_condattr_setclock( attr: *mut pthread_condattr_t, clock_id: ::clockid_t, ) -> ::c_int1414     pub fn pthread_condattr_setclock(
1415         attr: *mut pthread_condattr_t,
1416         clock_id: ::clockid_t,
1417     ) -> ::c_int;
memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void1418     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int1419     pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int1420     pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
mprotect( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, ) -> ::c_int1421     pub fn mprotect(
1422         addr: *mut ::c_void,
1423         len: ::size_t,
1424         prot: ::c_int,
1425     ) -> ::c_int;
dirfd(dirp: *mut ::DIR) -> ::c_int1426     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
getnameinfo( sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, sevlen: ::socklen_t, flags: ::c_int, ) -> ::c_int1427     pub fn getnameinfo(
1428         sa: *const ::sockaddr,
1429         salen: ::socklen_t,
1430         host: *mut ::c_char,
1431         hostlen: ::socklen_t,
1432         serv: *mut ::c_char,
1433         sevlen: ::socklen_t,
1434         flags: ::c_int,
1435     ) -> ::c_int;
pthread_mutex_timedlock( lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1436     pub fn pthread_mutex_timedlock(
1437         lock: *mut pthread_mutex_t,
1438         abstime: *const ::timespec,
1439     ) -> ::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;
1446 
glob( pattern: *const ::c_char, flags: ::c_int, errfunc: ::Option< extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int, >, pglob: *mut ::glob_t, ) -> ::c_int1447     pub fn glob(
1448         pattern: *const ::c_char,
1449         flags: ::c_int,
1450         errfunc: ::Option<
1451             extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
1452         >,
1453         pglob: *mut ::glob_t,
1454     ) -> ::c_int;
globfree(pglob: *mut ::glob_t)1455     pub fn globfree(pglob: *mut ::glob_t);
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1456     pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
posix_madvise( addr: *mut ::c_void, len: ::size_t, advice: ::c_int, ) -> ::c_int1457     pub fn posix_madvise(
1458         addr: *mut ::c_void,
1459         len: ::size_t,
1460         advice: ::c_int,
1461     ) -> ::c_int;
1462 
shm_open( name: *const ::c_char, oflag: ::c_int, mode: ::mode_t, ) -> ::c_int1463     pub fn shm_open(
1464         name: *const ::c_char,
1465         oflag: ::c_int,
1466         mode: ::mode_t,
1467     ) -> ::c_int;
shm_unlink(name: *const ::c_char) -> ::c_int1468     pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1469 
seekdir(dirp: *mut ::DIR, loc: ::c_long)1470     pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
1471 
telldir(dirp: *mut ::DIR) -> ::c_long1472     pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
madvise( addr: *mut ::c_void, len: ::size_t, advice: ::c_int, ) -> ::c_int1473     pub fn madvise(
1474         addr: *mut ::c_void,
1475         len: ::size_t,
1476         advice: ::c_int,
1477     ) -> ::c_int;
1478 
msync( addr: *mut ::c_void, len: ::size_t, flags: ::c_int, ) -> ::c_int1479     pub fn msync(
1480         addr: *mut ::c_void,
1481         len: ::size_t,
1482         flags: ::c_int,
1483     ) -> ::c_int;
1484 
recvfrom( socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, ) -> ::ssize_t1485     pub fn recvfrom(
1486         socket: ::c_int,
1487         buf: *mut ::c_void,
1488         len: ::size_t,
1489         flags: ::c_int,
1490         addr: *mut ::sockaddr,
1491         addrlen: *mut ::socklen_t,
1492     ) -> ::ssize_t;
mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int1493     pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int1494     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
nl_langinfo(item: ::nl_item) -> *mut ::c_char1495     pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
1496 
bind( socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t, ) -> ::c_int1497     pub fn bind(
1498         socket: ::c_int,
1499         address: *const ::sockaddr,
1500         address_len: ::socklen_t,
1501     ) -> ::c_int;
1502 
writev( fd: ::c_int, iov: *const ::iovec, count: ::c_int, ) -> ::ssize_t1503     pub fn writev(
1504         fd: ::c_int,
1505         iov: *const ::iovec,
1506         count: ::c_int,
1507     ) -> ::ssize_t;
readv( fd: ::c_int, iov: *const ::iovec, count: ::c_int, ) -> ::ssize_t1508     pub fn readv(
1509         fd: ::c_int,
1510         iov: *const ::iovec,
1511         count: ::c_int,
1512     ) -> ::ssize_t;
1513 
sendmsg( fd: ::c_int, msg: *const ::msghdr, flags: ::c_int, ) -> ::ssize_t1514     pub fn sendmsg(
1515         fd: ::c_int,
1516         msg: *const ::msghdr,
1517         flags: ::c_int,
1518     ) -> ::ssize_t;
recvmsg( fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int, ) -> ::ssize_t1519     pub fn recvmsg(
1520         fd: ::c_int,
1521         msg: *mut ::msghdr,
1522         flags: ::c_int,
1523     ) -> ::ssize_t;
execvpe( file: *const ::c_char, argv: *const *const ::c_char, environment: *const *const ::c_char, ) -> ::c_int1524     pub fn execvpe(
1525         file: *const ::c_char,
1526         argv: *const *const ::c_char,
1527         environment: *const *const ::c_char,
1528     ) -> ::c_int;
getgrgid_r( gid: ::gid_t, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int1529     pub fn getgrgid_r(
1530         gid: ::gid_t,
1531         grp: *mut ::group,
1532         buf: *mut ::c_char,
1533         buflen: ::size_t,
1534         result: *mut *mut ::group,
1535     ) -> ::c_int;
sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int1536     pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
sem_close(sem: *mut sem_t) -> ::c_int1537     pub fn sem_close(sem: *mut sem_t) -> ::c_int;
getdtablesize() -> ::c_int1538     pub fn getdtablesize() -> ::c_int;
getgrnam_r( name: *const ::c_char, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int1539     pub fn getgrnam_r(
1540         name: *const ::c_char,
1541         grp: *mut ::group,
1542         buf: *mut ::c_char,
1543         buflen: ::size_t,
1544         result: *mut *mut ::group,
1545     ) -> ::c_int;
pthread_sigmask( how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t, ) -> ::c_int1546     pub fn pthread_sigmask(
1547         how: ::c_int,
1548         set: *const sigset_t,
1549         oldset: *mut sigset_t,
1550     ) -> ::c_int;
sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t1551     pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
getgrnam(name: *const ::c_char) -> *mut ::group1552     pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int1553     pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
sem_unlink(name: *const ::c_char) -> ::c_int1554     pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int1555     pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
getpwnam_r( name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int1556     pub fn getpwnam_r(
1557         name: *const ::c_char,
1558         pwd: *mut passwd,
1559         buf: *mut ::c_char,
1560         buflen: ::size_t,
1561         result: *mut *mut passwd,
1562     ) -> ::c_int;
getpwuid_r( uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int1563     pub fn getpwuid_r(
1564         uid: ::uid_t,
1565         pwd: *mut passwd,
1566         buf: *mut ::c_char,
1567         buflen: ::size_t,
1568         result: *mut *mut passwd,
1569     ) -> ::c_int;
sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int1570     pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
pthread_atfork( prepare: ::Option<unsafe extern "C" fn()>, parent: ::Option<unsafe extern "C" fn()>, child: ::Option<unsafe extern "C" fn()>, ) -> ::c_int1571     pub fn pthread_atfork(
1572         prepare: ::Option<unsafe extern "C" fn()>,
1573         parent: ::Option<unsafe extern "C" fn()>,
1574         child: ::Option<unsafe extern "C" fn()>,
1575     ) -> ::c_int;
getgrgid(gid: ::gid_t) -> *mut ::group1576     pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE1577     pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
openpty( amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::c_int1578     pub fn openpty(
1579         amaster: *mut ::c_int,
1580         aslave: *mut ::c_int,
1581         name: *mut ::c_char,
1582         termp: *mut termios,
1583         winp: *mut ::winsize,
1584     ) -> ::c_int;
forkpty( amaster: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::pid_t1585     pub fn forkpty(
1586         amaster: *mut ::c_int,
1587         name: *mut ::c_char,
1588         termp: *mut termios,
1589         winp: *mut ::winsize,
1590     ) -> ::pid_t;
sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int1591     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
uname(buf: *mut ::utsname) -> ::c_int1592     pub fn uname(buf: *mut ::utsname) -> ::c_int;
1593 }
1594 
1595 cfg_if! {
1596     if #[cfg(target_pointer_width = "64")] {
1597         mod b64;
1598         pub use self::b64::*;
1599     } else {
1600         mod b32;
1601         pub use self::b32::*;
1602     }
1603 }
1604 
1605 mod native;
1606 pub use self::native::*;
1607