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