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