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_int;
32 pub type fd_mask = u32;
33 pub type regoff_t = ::c_int;
34 pub type key_t = i32;
35 pub type msgqnum_t = u32;
36 pub type msglen_t = u32;
37 
38 pub type Elf32_Addr = u32;
39 pub type Elf32_Half = u16;
40 pub type Elf32_Off = u32;
41 pub type Elf32_Sword = i32;
42 pub type Elf32_Word = u32;
43 
44 pub type Elf64_Addr = u64;
45 pub type Elf64_Half = u16;
46 pub type Elf64_Off = u64;
47 pub type Elf64_Sword = i32;
48 pub type Elf64_Sxword = i64;
49 pub type Elf64_Word = u32;
50 pub type Elf64_Xword = u64;
51 
52 pub type ENTRY = entry;
53 pub type ACTION = ::c_int;
54 
55 pub type posix_spawnattr_t = *mut ::c_void;
56 pub type posix_spawn_file_actions_t = *mut ::c_void;
57 
58 pub type StringList = _stringlist;
59 
60 #[cfg_attr(feature = "extra_traits", derive(Debug))]
61 pub enum timezone {}
62 impl ::Copy for timezone {}
63 impl ::Clone for timezone {
clone(&self) -> timezone64     fn clone(&self) -> timezone {
65         *self
66     }
67 }
68 
69 impl siginfo_t {
si_addr(&self) -> *mut ::c_void70     pub unsafe fn si_addr(&self) -> *mut ::c_void {
71         self.si_addr
72     }
73 
si_pid(&self) -> ::pid_t74     pub unsafe fn si_pid(&self) -> ::pid_t {
75         self.si_pid
76     }
77 
si_uid(&self) -> ::uid_t78     pub unsafe fn si_uid(&self) -> ::uid_t {
79         self.si_uid
80     }
81 
si_status(&self) -> ::c_int82     pub unsafe fn si_status(&self) -> ::c_int {
83         self.si_status
84     }
85 }
86 
87 s! {
88     pub struct in_addr {
89         pub s_addr: ::in_addr_t,
90     }
91 
92     pub struct ip_mreq {
93         pub imr_multiaddr: in_addr,
94         pub imr_interface: in_addr,
95     }
96 
97     pub struct sockaddr {
98         pub sa_len: u8,
99         pub sa_family: sa_family_t,
100         pub sa_data: [u8; 30],
101     }
102 
103     pub struct sockaddr_in {
104         pub sin_len: u8,
105         pub sin_family: sa_family_t,
106         pub sin_port: ::in_port_t,
107         pub sin_addr: ::in_addr,
108         pub sin_zero: [i8; 24],
109     }
110 
111     pub struct sockaddr_in6 {
112         pub sin6_len: u8,
113         pub sin6_family: u8,
114         pub sin6_port: u16,
115         pub sin6_flowinfo: u32,
116         pub sin6_addr: ::in6_addr,
117         pub sin6_scope_id: u32,
118     }
119 
120     pub struct addrinfo {
121         pub ai_flags: ::c_int,
122         pub ai_family: ::c_int,
123         pub ai_socktype: ::c_int,
124         pub ai_protocol: ::c_int,
125         pub ai_addrlen: socklen_t,
126         pub ai_canonname: *mut c_char,
127         pub ai_addr: *mut ::sockaddr,
128         pub ai_next: *mut addrinfo,
129     }
130 
131     pub struct ifaddrs {
132         pub ifa_next: *mut ifaddrs,
133         pub ifa_name: *const ::c_char,
134         pub ifa_flags: ::c_uint,
135         pub ifa_addr: *mut ::sockaddr,
136         pub ifa_netmask: *mut ::sockaddr,
137         pub ifa_dstaddr: *mut ::sockaddr,
138         pub ifa_data: *mut ::c_void,
139     }
140 
141     pub struct fd_set {
142         // size for 1024 bits, and a fd_mask with size u32
143         fds_bits: [fd_mask; 32],
144     }
145 
146     pub struct tm {
147         pub tm_sec: ::c_int,
148         pub tm_min: ::c_int,
149         pub tm_hour: ::c_int,
150         pub tm_mday: ::c_int,
151         pub tm_mon: ::c_int,
152         pub tm_year: ::c_int,
153         pub tm_wday: ::c_int,
154         pub tm_yday: ::c_int,
155         pub tm_isdst: ::c_int,
156         pub tm_gmtoff: ::c_int,
157         pub tm_zone: *mut ::c_char,
158     }
159 
160     pub struct utsname {
161         pub sysname: [::c_char; 32],
162         pub nodename: [::c_char; 32],
163         pub release: [::c_char; 32],
164         pub version: [::c_char; 32],
165         pub machine: [::c_char; 32],
166     }
167 
168     pub struct lconv {
169         pub decimal_point: *mut ::c_char,
170         pub thousands_sep: *mut ::c_char,
171         pub grouping: *mut ::c_char,
172         pub int_curr_symbol: *mut ::c_char,
173         pub currency_symbol: *mut ::c_char,
174         pub mon_decimal_point: *mut ::c_char,
175         pub mon_thousands_sep: *mut ::c_char,
176         pub mon_grouping: *mut ::c_char,
177         pub positive_sign: *mut ::c_char,
178         pub negative_sign: *mut ::c_char,
179         pub int_frac_digits: ::c_char,
180         pub frac_digits: ::c_char,
181         pub p_cs_precedes: ::c_char,
182         pub p_sep_by_space: ::c_char,
183         pub n_cs_precedes: ::c_char,
184         pub n_sep_by_space: ::c_char,
185         pub p_sign_posn: ::c_char,
186         pub n_sign_posn: ::c_char,
187         pub int_p_cs_precedes: ::c_char,
188         pub int_p_sep_by_space: ::c_char,
189         pub int_n_cs_precedes: ::c_char,
190         pub int_n_sep_by_space: ::c_char,
191         pub int_p_sign_posn: ::c_char,
192         pub int_n_sign_posn: ::c_char,
193     }
194 
195     pub struct msghdr {
196         pub msg_name: *mut ::c_void,
197         pub msg_namelen: socklen_t,
198         pub msg_iov: *mut ::iovec,
199         pub msg_iovlen: ::c_int,
200         pub msg_control: *mut ::c_void,
201         pub msg_controllen: socklen_t,
202         pub msg_flags: ::c_int,
203     }
204 
205     pub struct cmsghdr {
206         pub cmsg_len: ::socklen_t,
207         pub cmsg_level: ::c_int,
208         pub cmsg_type: ::c_int,
209     }
210 
211     pub struct Dl_info {
212         pub dli_fname: *const ::c_char,
213         pub dli_fbase: *mut ::c_void,
214         pub dli_sname: *const ::c_char,
215         pub dli_saddr: *mut ::c_void,
216     }
217 
218     pub struct termios {
219         pub c_iflag: ::tcflag_t,
220         pub c_oflag: ::tcflag_t,
221         pub c_cflag: ::tcflag_t,
222         pub c_lflag: ::tcflag_t,
223         pub c_line:  ::c_char,
224         pub c_ispeed: ::speed_t,
225         pub c_ospeed: ::speed_t,
226         pub c_cc: [::cc_t; ::NCCS],
227     }
228 
229     pub struct flock {
230         pub l_type: ::c_short,
231         pub l_whence: ::c_short,
232         pub l_start: ::off_t,
233         pub l_len: ::off_t,
234         pub l_pid: ::pid_t,
235     }
236 
237     pub struct stat {
238         pub st_dev: dev_t,
239         pub st_ino: ino_t,
240         pub st_mode: mode_t,
241         pub st_nlink: nlink_t,
242         pub st_uid: ::uid_t,
243         pub st_gid: ::gid_t,
244         pub st_size: off_t,
245         pub st_rdev: dev_t,
246         pub st_blksize: blksize_t,
247         pub st_atime: time_t,
248         pub st_atime_nsec: c_long,
249         pub st_mtime: time_t,
250         pub st_mtime_nsec: c_long,
251         pub st_ctime: time_t,
252         pub st_ctime_nsec: c_long,
253         pub st_crtime: time_t,
254         pub st_crtime_nsec: c_long,
255         pub st_type: u32,
256         pub st_blocks: blkcnt_t,
257     }
258 
259     pub struct glob_t {
260         pub gl_pathc: ::size_t,
261         __unused1: ::size_t,
262         pub gl_offs: ::size_t,
263         __unused2: ::size_t,
264         pub gl_pathv: *mut *mut c_char,
265 
266         __unused3: *mut ::c_void,
267         __unused4: *mut ::c_void,
268         __unused5: *mut ::c_void,
269         __unused6: *mut ::c_void,
270         __unused7: *mut ::c_void,
271         __unused8: *mut ::c_void,
272     }
273 
274     pub struct pthread_mutex_t {
275         flags: u32,
276         lock: i32,
277         unused: i32,
278         owner: i32,
279         owner_count: i32,
280     }
281 
282     pub struct pthread_cond_t {
283         flags: u32,
284         unused: i32,
285         mutex: *mut ::c_void,
286         waiter_count: i32,
287         lock: i32,
288     }
289 
290     pub struct pthread_rwlock_t {
291         flags: u32,
292         owner: i32,
293         lock_sem: i32,      // this is actually a union
294         lock_count: i32,
295         reader_count: i32,
296         writer_count: i32,
297         waiters: [*mut ::c_void; 2],
298     }
299 
300     pub struct pthread_spinlock_t {
301         lock: u32,
302     }
303 
304     pub struct passwd {
305         pub pw_name: *mut ::c_char,
306         pub pw_passwd: *mut ::c_char,
307         pub pw_uid: ::uid_t,
308         pub pw_gid: ::gid_t,
309         pub pw_dir: *mut ::c_char,
310         pub pw_shell: *mut ::c_char,
311         pub pw_gecos: *mut ::c_char,
312     }
313 
314     pub struct statvfs {
315         pub f_bsize: ::c_ulong,
316         pub f_frsize: ::c_ulong,
317         pub f_blocks: ::fsblkcnt_t,
318         pub f_bfree: ::fsblkcnt_t,
319         pub f_bavail: ::fsblkcnt_t,
320         pub f_files: ::fsfilcnt_t,
321         pub f_ffree: ::fsfilcnt_t,
322         pub f_favail: ::fsfilcnt_t,
323         pub f_fsid: ::c_ulong,
324         pub f_flag: ::c_ulong,
325         pub f_namemax: ::c_ulong,
326     }
327 
328     pub struct stack_t {
329         pub ss_sp: *mut ::c_void,
330         pub ss_size: ::size_t,
331         pub ss_flags: ::c_int,
332     }
333 
334     pub struct siginfo_t {
335         pub si_signo: ::c_int,
336         pub si_code: ::c_int,
337         pub si_errno: ::c_int,
338         pub si_pid: ::pid_t,
339         pub si_uid: ::uid_t,
340         pub si_addr: *mut ::c_void,
341         pub si_status: ::c_int,
342         pub si_band: c_long,
343         pub sigval: *mut ::c_void,
344     }
345 
346     pub struct sigaction {
347         pub sa_sigaction: ::sighandler_t, //actually a union with sa_handler
348         pub sa_mask: ::sigset_t,
349         pub sa_flags: ::c_int,
350         sa_userdata: *mut ::c_void,
351     }
352 
353     pub struct sem_t {
354         pub type_: i32,
355         pub named_sem_id: i32, // actually a union with unnamed_sem (i32)
356         pub padding: [i32; 2],
357     }
358 
359     pub struct ucred {
360         pub pid: ::pid_t,
361         pub uid: ::uid_t,
362         pub gid: ::gid_t,
363     }
364 
365     pub struct sockaddr_dl {
366         pub sdl_len: u8,
367         pub sdl_family: u8,
368         pub sdl_e_type: u16,
369         pub sdl_index: u32,
370         pub sdl_type: u8,
371         pub sdl_nlen: u8,
372         pub sdl_alen: u8,
373         pub sdl_slen: u8,
374         pub sdl_data: [u8; 46],
375     }
376 
377     pub struct spwd {
378         pub sp_namp: *mut ::c_char,
379         pub sp_pwdp: *mut ::c_char,
380         pub sp_lstchg: ::c_int,
381         pub sp_min: ::c_int,
382         pub sp_max: ::c_int,
383         pub sp_warn: ::c_int,
384         pub sp_inact: ::c_int,
385         pub sp_expire: ::c_int,
386         pub sp_flag: ::c_int,
387     }
388 
389     pub struct regex_t {
390         __buffer: *mut ::c_void,
391         __allocated: ::size_t,
392         __used: ::size_t,
393         __syntax: ::c_ulong,
394         __fastmap: *mut ::c_char,
395         __translate: *mut ::c_char,
396         __re_nsub: ::size_t,
397         __bitfield: u8,
398     }
399 
400     pub struct regmatch_t {
401         pub rm_so: regoff_t,
402         pub rm_eo: regoff_t,
403     }
404 
405     pub struct msqid_ds {
406         pub msg_perm: ::ipc_perm,
407         pub msg_qnum: ::msgqnum_t,
408         pub msg_qbytes: ::msglen_t,
409         pub msg_lspid: ::pid_t,
410         pub msg_lrpid: ::pid_t,
411         pub msg_stime: ::time_t,
412         pub msg_rtime: ::time_t,
413         pub msg_ctime: ::time_t,
414     }
415 
416     pub struct ipc_perm {
417         pub key: ::key_t,
418         pub uid: ::uid_t,
419         pub gid: ::gid_t,
420         pub cuid: ::uid_t,
421         pub cgid: ::gid_t,
422         pub mode: ::mode_t,
423     }
424 
425     pub struct sembuf {
426         pub sem_num: ::c_ushort,
427         pub sem_op: ::c_short,
428         pub sem_flg: ::c_short,
429     }
430 
431     pub struct entry {
432         pub key: *mut ::c_char,
433         pub data: *mut ::c_void,
434     }
435 
436     pub struct option {
437         pub name: *const ::c_char,
438         pub has_arg: ::c_int,
439         pub flag: *mut ::c_int,
440         pub val: ::c_int,
441     }
442 
443     pub struct _stringlist {
444         pub sl_str: *mut *mut ::c_char,
445         pub sl_max: ::size_t,
446         pub sl_cur: ::size_t,
447     }
448 
449     pub struct dl_phdr_info {
450         pub dlpi_addr: ::Elf_Addr,
451         pub dlpi_name: *const ::c_char,
452         pub dlpi_phdr: *const ::Elf_Phdr,
453         pub dlpi_phnum: ::Elf_Half,
454     }
455 }
456 
457 s_no_extra_traits! {
458     pub struct sockaddr_un {
459         pub sun_len: u8,
460         pub sun_family: sa_family_t,
461         pub sun_path: [::c_char; 126]
462     }
463     pub struct sockaddr_storage {
464         pub ss_len: u8,
465         pub ss_family: sa_family_t,
466         __ss_pad1: [u8; 6],
467         __ss_pad2: u64,
468         __ss_pad3: [u8; 112],
469     }
470     pub struct dirent {
471         pub d_dev: dev_t,
472         pub d_pdev: dev_t,
473         pub d_ino: ino_t,
474         pub d_pino: i64,
475         pub d_reclen: ::c_ushort,
476         pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
477     }
478 
479     pub struct sigevent {
480         pub sigev_notify: ::c_int,
481         pub sigev_signo: ::c_int,
482         pub sigev_value: ::sigval,
483         __unused1: *mut ::c_void, // actually a function pointer
484         pub sigev_notify_attributes: *mut ::pthread_attr_t,
485     }
486 
487     pub struct utmpx {
488         pub ut_type: ::c_short,
489         pub ut_tv: ::timeval,
490         pub ut_id: [::c_char; 8],
491         pub ut_pid: ::pid_t,
492         pub ut_user: [::c_char; 32],
493         pub ut_line: [::c_char; 16],
494         pub ut_host: [::c_char; 128],
495         __ut_reserved: [::c_char; 64],
496     }
497 }
498 
499 cfg_if! {
500     if #[cfg(feature = "extra_traits")] {
501         impl PartialEq for utmpx {
502             fn eq(&self, other: &utmpx) -> bool {
503                 self.ut_type == other.ut_type
504                     && self.ut_tv == other.ut_tv
505                     && self.ut_id == other.ut_id
506                     && self.ut_pid == other.ut_pid
507                     && self.ut_user == other.ut_user
508                     && self.ut_line == other.ut_line
509                     && self.ut_host.iter().zip(other.ut_host.iter()).all(|(a,b)| a == b)
510                     && self.__ut_reserved == other.__ut_reserved
511             }
512         }
513 
514         impl Eq for utmpx {}
515 
516         impl ::fmt::Debug for utmpx {
517             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
518                 f.debug_struct("utmpx")
519                     .field("ut_type", &self.ut_type)
520                     .field("ut_tv", &self.ut_tv)
521                     .field("ut_id", &self.ut_id)
522                     .field("ut_pid", &self.ut_pid)
523                     .field("ut_user", &self.ut_user)
524                     .field("ut_line", &self.ut_line)
525                     .field("ut_host", &self.ut_host)
526                     .field("__ut_reserved", &self.__ut_reserved)
527                     .finish()
528             }
529         }
530 
531         impl ::hash::Hash for utmpx {
532             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
533                 self.ut_type.hash(state);
534                 self.ut_tv.hash(state);
535                 self.ut_id.hash(state);
536                 self.ut_pid.hash(state);
537                 self.ut_user.hash(state);
538                 self.ut_line.hash(state);
539                 self.ut_host.hash(state);
540                 self.__ut_reserved.hash(state);
541             }
542         }
543         impl PartialEq for sockaddr_un {
544             fn eq(&self, other: &sockaddr_un) -> bool {
545                 self.sun_len == other.sun_len
546                     && self.sun_family == other.sun_family
547                     && self
548                     .sun_path
549                     .iter()
550                     .zip(other.sun_path.iter())
551                     .all(|(a,b)| a == b)
552             }
553         }
554         impl Eq for sockaddr_un {}
555         impl ::fmt::Debug for sockaddr_un {
556             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
557                 f.debug_struct("sockaddr_un")
558                     .field("sun_len", &self.sun_len)
559                     .field("sun_family", &self.sun_family)
560                     // FIXME: .field("sun_path", &self.sun_path)
561                     .finish()
562             }
563         }
564         impl ::hash::Hash for sockaddr_un {
565             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
566                 self.sun_len.hash(state);
567                 self.sun_family.hash(state);
568                 self.sun_path.hash(state);
569             }
570         }
571 
572         impl PartialEq for sockaddr_storage {
573             fn eq(&self, other: &sockaddr_storage) -> bool {
574                 self.ss_len == other.ss_len
575                     && self.ss_family == other.ss_family
576                     && self
577                     .__ss_pad1
578                     .iter()
579                     .zip(other.__ss_pad1.iter())
580                     .all(|(a, b)| a == b)
581                     && self.__ss_pad2 == other.__ss_pad2
582                     && self
583                     .__ss_pad3
584                     .iter()
585                     .zip(other.__ss_pad3.iter())
586                     .all(|(a, b)| a == b)
587             }
588         }
589         impl Eq for sockaddr_storage {}
590         impl ::fmt::Debug for sockaddr_storage {
591             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
592                 f.debug_struct("sockaddr_storage")
593                     .field("ss_len", &self.ss_len)
594                     .field("ss_family", &self.ss_family)
595                     .field("__ss_pad1", &self.__ss_pad1)
596                     .field("__ss_pad2", &self.__ss_pad2)
597                     // FIXME: .field("__ss_pad3", &self.__ss_pad3)
598                     .finish()
599             }
600         }
601         impl ::hash::Hash for sockaddr_storage {
602             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
603                 self.ss_len.hash(state);
604                 self.ss_family.hash(state);
605                 self.__ss_pad1.hash(state);
606                 self.__ss_pad2.hash(state);
607                 self.__ss_pad3.hash(state);
608             }
609         }
610 
611         impl PartialEq for dirent {
612             fn eq(&self, other: &dirent) -> bool {
613                 self.d_dev == other.d_dev
614                     && self.d_pdev == other.d_pdev
615                     && self.d_ino == other.d_ino
616                     && self.d_pino == other.d_pino
617                     && self.d_reclen == other.d_reclen
618                     && self
619                     .d_name
620                     .iter()
621                     .zip(other.d_name.iter())
622                     .all(|(a,b)| a == b)
623             }
624         }
625         impl Eq for dirent {}
626         impl ::fmt::Debug for dirent {
627             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
628                 f.debug_struct("dirent")
629                     .field("d_dev", &self.d_dev)
630                     .field("d_pdev", &self.d_pdev)
631                     .field("d_ino", &self.d_ino)
632                     .field("d_pino", &self.d_pino)
633                     .field("d_reclen", &self.d_reclen)
634                     // FIXME: .field("d_name", &self.d_name)
635                     .finish()
636             }
637         }
638         impl ::hash::Hash for dirent {
639             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
640                 self.d_dev.hash(state);
641                 self.d_pdev.hash(state);
642                 self.d_ino.hash(state);
643                 self.d_pino.hash(state);
644                 self.d_reclen.hash(state);
645                 self.d_name.hash(state);
646             }
647         }
648 
649         impl PartialEq for sigevent {
650             fn eq(&self, other: &sigevent) -> bool {
651                 self.sigev_notify == other.sigev_notify
652                     && self.sigev_signo == other.sigev_signo
653                     && self.sigev_value == other.sigev_value
654                     && self.sigev_notify_attributes
655                         == other.sigev_notify_attributes
656             }
657         }
658         impl Eq for sigevent {}
659         impl ::fmt::Debug for sigevent {
660             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
661                 f.debug_struct("sigevent")
662                     .field("sigev_notify", &self.sigev_notify)
663                     .field("sigev_signo", &self.sigev_signo)
664                     .field("sigev_value", &self.sigev_value)
665                     .field("sigev_notify_attributes",
666                            &self.sigev_notify_attributes)
667                     .finish()
668             }
669         }
670         impl ::hash::Hash for sigevent {
671             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
672                 self.sigev_notify.hash(state);
673                 self.sigev_signo.hash(state);
674                 self.sigev_value.hash(state);
675                 self.sigev_notify_attributes.hash(state);
676             }
677         }
678     }
679 }
680 
681 pub const EXIT_FAILURE: ::c_int = 1;
682 pub const EXIT_SUCCESS: ::c_int = 0;
683 pub const RAND_MAX: ::c_int = 2147483647;
684 pub const EOF: ::c_int = -1;
685 pub const SEEK_SET: ::c_int = 0;
686 pub const SEEK_CUR: ::c_int = 1;
687 pub const SEEK_END: ::c_int = 2;
688 pub const L_SET: ::c_int = SEEK_SET;
689 pub const L_INCR: ::c_int = SEEK_CUR;
690 pub const L_XTND: ::c_int = SEEK_END;
691 pub const _IOFBF: ::c_int = 0;
692 pub const _IONBF: ::c_int = 2;
693 pub const _IOLBF: ::c_int = 1;
694 
695 pub const F_DUPFD: ::c_int = 0x0001;
696 pub const F_GETFD: ::c_int = 0x0002;
697 pub const F_SETFD: ::c_int = 0x0004;
698 pub const F_GETFL: ::c_int = 0x0008;
699 pub const F_SETFL: ::c_int = 0x0010;
700 pub const F_GETLK: ::c_int = 0x0020;
701 pub const F_SETLK: ::c_int = 0x0080;
702 pub const F_SETLKW: ::c_int = 0x0100;
703 pub const F_DUPFD_CLOEXEC: ::c_int = 0x0200;
704 
705 pub const F_RDLCK: ::c_int = 0x0040;
706 pub const F_UNLCK: ::c_int = 0x0200;
707 pub const F_WRLCK: ::c_int = 0x0400;
708 
709 pub const AT_FDCWD: ::c_int = -100;
710 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01;
711 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02;
712 pub const AT_REMOVEDIR: ::c_int = 0x04;
713 pub const AT_EACCESS: ::c_int = 0x08;
714 
715 pub const POLLIN: ::c_short = 0x0001;
716 pub const POLLOUT: ::c_short = 0x0002;
717 pub const POLLRDNORM: ::c_short = POLLIN;
718 pub const POLLWRNORM: ::c_short = POLLOUT;
719 pub const POLLRDBAND: ::c_short = 0x0008;
720 pub const POLLWRBAND: ::c_short = 0x0010;
721 pub const POLLPRI: ::c_short = 0x0020;
722 pub const POLLERR: ::c_short = 0x0004;
723 pub const POLLHUP: ::c_short = 0x0080;
724 pub const POLLNVAL: ::c_short = 0x1000;
725 
726 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
727 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
728 
729 pub const CLOCK_REALTIME: ::c_int = -1;
730 pub const CLOCK_MONOTONIC: ::c_int = 0;
731 pub const CLOCK_PROCESS_CPUTIME_ID: ::c_int = -2;
732 pub const CLOCK_THREAD_CPUTIME_ID: ::c_int = -3;
733 
734 pub const RLIMIT_CORE: ::c_int = 0;
735 pub const RLIMIT_CPU: ::c_int = 1;
736 pub const RLIMIT_DATA: ::c_int = 2;
737 pub const RLIMIT_FSIZE: ::c_int = 3;
738 pub const RLIMIT_NOFILE: ::c_int = 4;
739 pub const RLIMIT_STACK: ::c_int = 5;
740 pub const RLIMIT_AS: ::c_int = 6;
741 pub const RLIM_INFINITY: ::rlim_t = 0xffffffff;
742 // Haiku specific
743 pub const RLIMIT_NOVMON: ::c_int = 7;
744 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
745 pub const RLIM_NLIMITS: ::c_int = 8;
746 
747 pub const RUSAGE_SELF: ::c_int = 0;
748 
749 pub const RTLD_LAZY: ::c_int = 0;
750 
751 pub const NCCS: usize = 11;
752 
753 pub const O_RDONLY: ::c_int = 0x0000;
754 pub const O_WRONLY: ::c_int = 0x0001;
755 pub const O_RDWR: ::c_int = 0x0002;
756 pub const O_ACCMODE: ::c_int = 0x0003;
757 
758 pub const O_EXCL: ::c_int = 0x0100;
759 pub const O_CREAT: ::c_int = 0x0200;
760 pub const O_TRUNC: ::c_int = 0x0400;
761 pub const O_NOCTTY: ::c_int = 0x1000;
762 pub const O_NOTRAVERSE: ::c_int = 0x2000;
763 
764 pub const O_CLOEXEC: ::c_int = 0x00000040;
765 pub const O_NONBLOCK: ::c_int = 0x00000080;
766 pub const O_APPEND: ::c_int = 0x00000800;
767 pub const O_SYNC: ::c_int = 0x00010000;
768 pub const O_RSYNC: ::c_int = 0x00020000;
769 pub const O_DSYNC: ::c_int = 0x00040000;
770 pub const O_NOFOLLOW: ::c_int = 0x00080000;
771 pub const O_NOCACHE: ::c_int = 0x00100000;
772 pub const O_DIRECTORY: ::c_int = 0x00200000;
773 
774 pub const S_IFIFO: ::mode_t = 4096;
775 pub const S_IFCHR: ::mode_t = 8192;
776 pub const S_IFBLK: ::mode_t = 24576;
777 pub const S_IFDIR: ::mode_t = 16384;
778 pub const S_IFREG: ::mode_t = 32768;
779 pub const S_IFLNK: ::mode_t = 40960;
780 pub const S_IFSOCK: ::mode_t = 49152;
781 pub const S_IFMT: ::mode_t = 61440;
782 
783 pub const S_IRWXU: ::mode_t = 0o00700;
784 pub const S_IRUSR: ::mode_t = 0o00400;
785 pub const S_IWUSR: ::mode_t = 0o00200;
786 pub const S_IXUSR: ::mode_t = 0o00100;
787 pub const S_IRWXG: ::mode_t = 0o00070;
788 pub const S_IRGRP: ::mode_t = 0o00040;
789 pub const S_IWGRP: ::mode_t = 0o00020;
790 pub const S_IXGRP: ::mode_t = 0o00010;
791 pub const S_IRWXO: ::mode_t = 0o00007;
792 pub const S_IROTH: ::mode_t = 0o00004;
793 pub const S_IWOTH: ::mode_t = 0o00002;
794 pub const S_IXOTH: ::mode_t = 0o00001;
795 
796 pub const F_OK: ::c_int = 0;
797 pub const R_OK: ::c_int = 4;
798 pub const W_OK: ::c_int = 2;
799 pub const X_OK: ::c_int = 1;
800 pub const STDIN_FILENO: ::c_int = 0;
801 pub const STDOUT_FILENO: ::c_int = 1;
802 pub const STDERR_FILENO: ::c_int = 2;
803 
804 pub const SIGHUP: ::c_int = 1;
805 pub const SIGINT: ::c_int = 2;
806 pub const SIGQUIT: ::c_int = 3;
807 pub const SIGILL: ::c_int = 4;
808 pub const SIGCHLD: ::c_int = 5;
809 pub const SIGABRT: ::c_int = 6;
810 pub const SIGPIPE: ::c_int = 7;
811 pub const SIGFPE: ::c_int = 8;
812 pub const SIGKILL: ::c_int = 9;
813 pub const SIGSTOP: ::c_int = 10;
814 pub const SIGSEGV: ::c_int = 11;
815 pub const SIGCONT: ::c_int = 12;
816 pub const SIGTSTP: ::c_int = 13;
817 pub const SIGALRM: ::c_int = 14;
818 pub const SIGTERM: ::c_int = 15;
819 pub const SIGTTIN: ::c_int = 16;
820 pub const SIGTTOU: ::c_int = 17;
821 pub const SIGUSR1: ::c_int = 18;
822 pub const SIGUSR2: ::c_int = 19;
823 pub const SIGWINCH: ::c_int = 20;
824 pub const SIGKILLTHR: ::c_int = 21;
825 pub const SIGTRAP: ::c_int = 22;
826 pub const SIGPOLL: ::c_int = 23;
827 pub const SIGPROF: ::c_int = 24;
828 pub const SIGSYS: ::c_int = 25;
829 pub const SIGURG: ::c_int = 26;
830 pub const SIGVTALRM: ::c_int = 27;
831 pub const SIGXCPU: ::c_int = 28;
832 pub const SIGXFSZ: ::c_int = 29;
833 pub const SIGBUS: ::c_int = 30;
834 
835 pub const SIG_BLOCK: ::c_int = 1;
836 pub const SIG_UNBLOCK: ::c_int = 2;
837 pub const SIG_SETMASK: ::c_int = 3;
838 
839 pub const SIGEV_NONE: ::c_int = 0;
840 pub const SIGEV_SIGNAL: ::c_int = 1;
841 pub const SIGEV_THREAD: ::c_int = 2;
842 
843 pub const EAI_AGAIN: ::c_int = 2;
844 pub const EAI_BADFLAGS: ::c_int = 3;
845 pub const EAI_FAIL: ::c_int = 4;
846 pub const EAI_FAMILY: ::c_int = 5;
847 pub const EAI_MEMORY: ::c_int = 6;
848 pub const EAI_NODATA: ::c_int = 7;
849 pub const EAI_NONAME: ::c_int = 8;
850 pub const EAI_SERVICE: ::c_int = 9;
851 pub const EAI_SOCKTYPE: ::c_int = 10;
852 pub const EAI_SYSTEM: ::c_int = 11;
853 pub const EAI_OVERFLOW: ::c_int = 14;
854 
855 pub const PROT_NONE: ::c_int = 0;
856 pub const PROT_READ: ::c_int = 1;
857 pub const PROT_WRITE: ::c_int = 2;
858 pub const PROT_EXEC: ::c_int = 4;
859 
860 pub const LC_ALL: ::c_int = 0;
861 pub const LC_COLLATE: ::c_int = 1;
862 pub const LC_CTYPE: ::c_int = 2;
863 pub const LC_MONETARY: ::c_int = 3;
864 pub const LC_NUMERIC: ::c_int = 4;
865 pub const LC_TIME: ::c_int = 5;
866 pub const LC_MESSAGES: ::c_int = 6;
867 
868 // FIXME: Haiku does not have MAP_FILE, but library/std/os.rs requires it
869 pub const MAP_FILE: ::c_int = 0x00;
870 pub const MAP_SHARED: ::c_int = 0x01;
871 pub const MAP_PRIVATE: ::c_int = 0x02;
872 pub const MAP_FIXED: ::c_int = 0x04;
873 pub const MAP_ANONYMOUS: ::c_int = 0x08;
874 pub const MAP_NORESERVE: ::c_int = 0x10;
875 pub const MAP_ANON: ::c_int = MAP_ANONYMOUS;
876 
877 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
878 
879 pub const MS_ASYNC: ::c_int = 0x01;
880 pub const MS_INVALIDATE: ::c_int = 0x04;
881 pub const MS_SYNC: ::c_int = 0x02;
882 
883 pub const E2BIG: ::c_int = -2147454975;
884 pub const ECHILD: ::c_int = -2147454974;
885 pub const EDEADLK: ::c_int = -2147454973;
886 pub const EFBIG: ::c_int = -2147454972;
887 pub const EMLINK: ::c_int = -2147454971;
888 pub const ENFILE: ::c_int = -2147454970;
889 pub const ENODEV: ::c_int = -2147454969;
890 pub const ENOLCK: ::c_int = -2147454968;
891 pub const ENOSYS: ::c_int = -2147454967;
892 pub const ENOTTY: ::c_int = -2147454966;
893 pub const ENXIO: ::c_int = -2147454965;
894 pub const ESPIPE: ::c_int = -2147454964;
895 pub const ESRCH: ::c_int = -2147454963;
896 pub const EFPOS: ::c_int = -2147454962;
897 pub const ESIGPARM: ::c_int = -2147454961;
898 pub const EDOM: ::c_int = -2147454960;
899 pub const ERANGE: ::c_int = -2147454959;
900 pub const EPROTOTYPE: ::c_int = -2147454958;
901 pub const EPROTONOSUPPORT: ::c_int = -2147454957;
902 pub const EPFNOSUPPORT: ::c_int = -2147454956;
903 pub const EAFNOSUPPORT: ::c_int = -2147454955;
904 pub const EADDRINUSE: ::c_int = -2147454954;
905 pub const EADDRNOTAVAIL: ::c_int = -2147454953;
906 pub const ENETDOWN: ::c_int = -2147454952;
907 pub const ENETUNREACH: ::c_int = -2147454951;
908 pub const ENETRESET: ::c_int = -2147454950;
909 pub const ECONNABORTED: ::c_int = -2147454949;
910 pub const ECONNRESET: ::c_int = -2147454948;
911 pub const EISCONN: ::c_int = -2147454947;
912 pub const ENOTCONN: ::c_int = -2147454946;
913 pub const ESHUTDOWN: ::c_int = -2147454945;
914 pub const ECONNREFUSED: ::c_int = -2147454944;
915 pub const EHOSTUNREACH: ::c_int = -2147454943;
916 pub const ENOPROTOOPT: ::c_int = -2147454942;
917 pub const ENOBUFS: ::c_int = -2147454941;
918 pub const EINPROGRESS: ::c_int = -2147454940;
919 pub const EALREADY: ::c_int = -2147454939;
920 pub const EILSEQ: ::c_int = -2147454938;
921 pub const ENOMSG: ::c_int = -2147454937;
922 pub const ESTALE: ::c_int = -2147454936;
923 pub const EOVERFLOW: ::c_int = -2147454935;
924 pub const EMSGSIZE: ::c_int = -2147454934;
925 pub const EOPNOTSUPP: ::c_int = -2147454933;
926 pub const ENOTSOCK: ::c_int = -2147454932;
927 pub const EHOSTDOWN: ::c_int = -2147454931;
928 pub const EBADMSG: ::c_int = -2147454930;
929 pub const ECANCELED: ::c_int = -2147454929;
930 pub const EDESTADDRREQ: ::c_int = -2147454928;
931 pub const EDQUOT: ::c_int = -2147454927;
932 pub const EIDRM: ::c_int = -2147454926;
933 pub const EMULTIHOP: ::c_int = -2147454925;
934 pub const ENODATA: ::c_int = -2147454924;
935 pub const ENOLINK: ::c_int = -2147454923;
936 pub const ENOSR: ::c_int = -2147454922;
937 pub const ENOSTR: ::c_int = -2147454921;
938 pub const ENOTSUP: ::c_int = -2147454920;
939 pub const EPROTO: ::c_int = -2147454919;
940 pub const ETIME: ::c_int = -2147454918;
941 pub const ETXTBSY: ::c_int = -2147454917;
942 pub const ENOATTR: ::c_int = -2147454916;
943 
944 // INT_MIN
945 pub const ENOMEM: ::c_int = -2147483648;
946 
947 // POSIX errors that can be mapped to BeOS error codes
948 pub const EACCES: ::c_int = -2147483646;
949 pub const EINTR: ::c_int = -2147483638;
950 pub const EIO: ::c_int = -2147483647;
951 pub const EBUSY: ::c_int = -2147483634;
952 pub const EFAULT: ::c_int = -2147478783;
953 pub const ETIMEDOUT: ::c_int = -2147483639;
954 pub const EAGAIN: ::c_int = -2147483637;
955 pub const EWOULDBLOCK: ::c_int = -2147483637;
956 pub const EBADF: ::c_int = -2147459072;
957 pub const EEXIST: ::c_int = -2147459070;
958 pub const EINVAL: ::c_int = -2147483643;
959 pub const ENAMETOOLONG: ::c_int = -2147459068;
960 pub const ENOENT: ::c_int = -2147459069;
961 pub const EPERM: ::c_int = -2147483633;
962 pub const ENOTDIR: ::c_int = -2147459067;
963 pub const EISDIR: ::c_int = -2147459063;
964 pub const ENOTEMPTY: ::c_int = -2147459066;
965 pub const ENOSPC: ::c_int = -2147459065;
966 pub const EROFS: ::c_int = -2147459064;
967 pub const EMFILE: ::c_int = -2147459062;
968 pub const EXDEV: ::c_int = -2147459061;
969 pub const ELOOP: ::c_int = -2147459060;
970 pub const ENOEXEC: ::c_int = -2147478782;
971 pub const EPIPE: ::c_int = -2147459059;
972 
973 pub const IPPROTO_RAW: ::c_int = 255;
974 
975 // These are prefixed with POSIX_ on Haiku
976 pub const MADV_NORMAL: ::c_int = 1;
977 pub const MADV_SEQUENTIAL: ::c_int = 2;
978 pub const MADV_RANDOM: ::c_int = 3;
979 pub const MADV_WILLNEED: ::c_int = 4;
980 pub const MADV_DONTNEED: ::c_int = 5;
981 pub const MADV_FREE: ::c_int = 6;
982 
983 // https://github.com/haiku/haiku/blob/HEAD/headers/posix/net/if.h#L80
984 pub const IFF_UP: ::c_int = 0x0001;
985 pub const IFF_BROADCAST: ::c_int = 0x0002; // valid broadcast address
986 pub const IFF_LOOPBACK: ::c_int = 0x0008;
987 pub const IFF_POINTOPOINT: ::c_int = 0x0010; // point-to-point link
988 pub const IFF_NOARP: ::c_int = 0x0040; // no address resolution
989 pub const IFF_AUTOUP: ::c_int = 0x0080; // auto dial
990 pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
991 pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
992 pub const IFF_SIMPLEX: ::c_int = 0x0800; // doesn't receive own transmissions
993 pub const IFF_LINK: ::c_int = 0x1000; // has link
994 pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000;
995 pub const IFF_CONFIGURING: ::c_int = 0x4000;
996 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
997 
998 pub const AF_UNSPEC: ::c_int = 0;
999 pub const AF_INET: ::c_int = 1;
1000 pub const AF_APPLETALK: ::c_int = 2;
1001 pub const AF_ROUTE: ::c_int = 3;
1002 pub const AF_LINK: ::c_int = 4;
1003 pub const AF_INET6: ::c_int = 5;
1004 pub const AF_DLI: ::c_int = 6;
1005 pub const AF_IPX: ::c_int = 7;
1006 pub const AF_NOTIFY: ::c_int = 8;
1007 pub const AF_LOCAL: ::c_int = 9;
1008 pub const AF_UNIX: ::c_int = AF_LOCAL;
1009 pub const AF_BLUETOOTH: ::c_int = 10;
1010 
1011 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
1012 pub const PF_INET: ::c_int = AF_INET;
1013 pub const PF_ROUTE: ::c_int = AF_ROUTE;
1014 pub const PF_LINK: ::c_int = AF_LINK;
1015 pub const PF_INET6: ::c_int = AF_INET6;
1016 pub const PF_LOCAL: ::c_int = AF_LOCAL;
1017 pub const PF_UNIX: ::c_int = AF_UNIX;
1018 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1019 
1020 pub const IP_OPTIONS: ::c_int = 1;
1021 pub const IP_HDRINCL: ::c_int = 2;
1022 pub const IP_TOS: ::c_int = 3;
1023 pub const IP_TTL: ::c_int = 4;
1024 pub const IP_RECVOPTS: ::c_int = 5;
1025 pub const IP_RECVRETOPTS: ::c_int = 6;
1026 pub const IP_RECVDSTADDR: ::c_int = 7;
1027 pub const IP_RETOPTS: ::c_int = 8;
1028 pub const IP_MULTICAST_IF: ::c_int = 9;
1029 pub const IP_MULTICAST_TTL: ::c_int = 10;
1030 pub const IP_MULTICAST_LOOP: ::c_int = 11;
1031 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
1032 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
1033 pub const IP_BLOCK_SOURCE: ::c_int = 14;
1034 pub const IP_UNBLOCK_SOURCE: ::c_int = 15;
1035 pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 16;
1036 pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 17;
1037 
1038 pub const TCP_NODELAY: ::c_int = 0x01;
1039 pub const TCP_MAXSEG: ::c_int = 0x02;
1040 pub const TCP_NOPUSH: ::c_int = 0x04;
1041 pub const TCP_NOOPT: ::c_int = 0x08;
1042 
1043 pub const IF_NAMESIZE: ::size_t = 32;
1044 pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
1045 
1046 pub const IPV6_MULTICAST_IF: ::c_int = 24;
1047 pub const IPV6_MULTICAST_HOPS: ::c_int = 25;
1048 pub const IPV6_MULTICAST_LOOP: ::c_int = 26;
1049 pub const IPV6_UNICAST_HOPS: ::c_int = 27;
1050 pub const IPV6_JOIN_GROUP: ::c_int = 28;
1051 pub const IPV6_LEAVE_GROUP: ::c_int = 29;
1052 pub const IPV6_V6ONLY: ::c_int = 30;
1053 pub const IPV6_PKTINFO: ::c_int = 31;
1054 pub const IPV6_RECVPKTINFO: ::c_int = 32;
1055 pub const IPV6_HOPLIMIT: ::c_int = 33;
1056 pub const IPV6_RECVHOPLIMIT: ::c_int = 34;
1057 pub const IPV6_HOPOPTS: ::c_int = 35;
1058 pub const IPV6_DSTOPTS: ::c_int = 36;
1059 pub const IPV6_RTHDR: ::c_int = 37;
1060 
1061 pub const MSG_OOB: ::c_int = 0x0001;
1062 pub const MSG_PEEK: ::c_int = 0x0002;
1063 pub const MSG_DONTROUTE: ::c_int = 0x0004;
1064 pub const MSG_EOR: ::c_int = 0x0008;
1065 pub const MSG_TRUNC: ::c_int = 0x0010;
1066 pub const MSG_CTRUNC: ::c_int = 0x0020;
1067 pub const MSG_WAITALL: ::c_int = 0x0040;
1068 pub const MSG_DONTWAIT: ::c_int = 0x0080;
1069 pub const MSG_BCAST: ::c_int = 0x0100;
1070 pub const MSG_MCAST: ::c_int = 0x0200;
1071 pub const MSG_EOF: ::c_int = 0x0400;
1072 pub const MSG_NOSIGNAL: ::c_int = 0x0800;
1073 
1074 pub const SHUT_RD: ::c_int = 0;
1075 pub const SHUT_WR: ::c_int = 1;
1076 pub const SHUT_RDWR: ::c_int = 2;
1077 
1078 pub const LOCK_SH: ::c_int = 0x01;
1079 pub const LOCK_EX: ::c_int = 0x02;
1080 pub const LOCK_NB: ::c_int = 0x04;
1081 pub const LOCK_UN: ::c_int = 0x08;
1082 
1083 pub const MINSIGSTKSZ: ::size_t = 8192;
1084 pub const SIGSTKSZ: ::size_t = 16384;
1085 
1086 pub const IOV_MAX: ::c_int = 1024;
1087 pub const PATH_MAX: ::c_int = 1024;
1088 
1089 pub const SA_NOCLDSTOP: ::c_int = 0x01;
1090 pub const SA_NOCLDWAIT: ::c_int = 0x02;
1091 pub const SA_RESETHAND: ::c_int = 0x04;
1092 pub const SA_NODEFER: ::c_int = 0x08;
1093 pub const SA_RESTART: ::c_int = 0x10;
1094 pub const SA_ONSTACK: ::c_int = 0x20;
1095 pub const SA_SIGINFO: ::c_int = 0x40;
1096 pub const SA_NOMASK: ::c_int = SA_NODEFER;
1097 pub const SA_STACK: ::c_int = SA_ONSTACK;
1098 pub const SA_ONESHOT: ::c_int = SA_RESETHAND;
1099 
1100 pub const SS_ONSTACK: ::c_int = 0x1;
1101 pub const SS_DISABLE: ::c_int = 0x2;
1102 
1103 pub const FD_SETSIZE: usize = 1024;
1104 
1105 pub const RTLD_LOCAL: ::c_int = 0x0;
1106 pub const RTLD_NOW: ::c_int = 0x1;
1107 pub const RTLD_GLOBAL: ::c_int = 0x2;
1108 pub const RTLD_DEFAULT: *mut ::c_void = 0isize as *mut ::c_void;
1109 
1110 pub const BUFSIZ: ::c_uint = 8192;
1111 pub const FILENAME_MAX: ::c_uint = 256;
1112 pub const FOPEN_MAX: ::c_uint = 128;
1113 pub const L_tmpnam: ::c_uint = 512;
1114 pub const TMP_MAX: ::c_uint = 32768;
1115 
1116 pub const _PC_CHOWN_RESTRICTED: ::c_int = 1;
1117 pub const _PC_MAX_CANON: ::c_int = 2;
1118 pub const _PC_MAX_INPUT: ::c_int = 3;
1119 pub const _PC_NAME_MAX: ::c_int = 4;
1120 pub const _PC_NO_TRUNC: ::c_int = 5;
1121 pub const _PC_PATH_MAX: ::c_int = 6;
1122 pub const _PC_PIPE_BUF: ::c_int = 7;
1123 pub const _PC_VDISABLE: ::c_int = 8;
1124 pub const _PC_LINK_MAX: ::c_int = 25;
1125 pub const _PC_SYNC_IO: ::c_int = 26;
1126 pub const _PC_ASYNC_IO: ::c_int = 27;
1127 pub const _PC_PRIO_IO: ::c_int = 28;
1128 pub const _PC_SOCK_MAXBUF: ::c_int = 29;
1129 pub const _PC_FILESIZEBITS: ::c_int = 30;
1130 pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 31;
1131 pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 32;
1132 pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 33;
1133 pub const _PC_REC_XFER_ALIGN: ::c_int = 34;
1134 pub const _PC_ALLOC_SIZE_MIN: ::c_int = 35;
1135 pub const _PC_SYMLINK_MAX: ::c_int = 36;
1136 pub const _PC_2_SYMLINKS: ::c_int = 37;
1137 pub const _PC_XATTR_EXISTS: ::c_int = 38;
1138 pub const _PC_XATTR_ENABLED: ::c_int = 39;
1139 
1140 pub const FIONBIO: ::c_ulong = 0xbe000000;
1141 pub const FIONREAD: ::c_ulong = 0xbe000001;
1142 pub const FIOSEEKDATA: ::c_ulong = 0xbe000002;
1143 pub const FIOSEEKHOLE: ::c_ulong = 0xbe000003;
1144 
1145 pub const _SC_ARG_MAX: ::c_int = 15;
1146 pub const _SC_CHILD_MAX: ::c_int = 16;
1147 pub const _SC_CLK_TCK: ::c_int = 17;
1148 pub const _SC_JOB_CONTROL: ::c_int = 18;
1149 pub const _SC_NGROUPS_MAX: ::c_int = 19;
1150 pub const _SC_OPEN_MAX: ::c_int = 20;
1151 pub const _SC_SAVED_IDS: ::c_int = 21;
1152 pub const _SC_STREAM_MAX: ::c_int = 22;
1153 pub const _SC_TZNAME_MAX: ::c_int = 23;
1154 pub const _SC_VERSION: ::c_int = 24;
1155 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 25;
1156 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 26;
1157 pub const _SC_PAGESIZE: ::c_int = 27;
1158 pub const _SC_PAGE_SIZE: ::c_int = 27;
1159 pub const _SC_SEM_NSEMS_MAX: ::c_int = 28;
1160 pub const _SC_SEM_VALUE_MAX: ::c_int = 29;
1161 pub const _SC_SEMAPHORES: ::c_int = 30;
1162 pub const _SC_THREADS: ::c_int = 31;
1163 pub const _SC_IOV_MAX: ::c_int = 32;
1164 pub const _SC_UIO_MAXIOV: ::c_int = 32;
1165 pub const _SC_NPROCESSORS_CONF: ::c_int = 34;
1166 pub const _SC_NPROCESSORS_ONLN: ::c_int = 35;
1167 pub const _SC_ATEXIT_MAX: ::c_int = 37;
1168 pub const _SC_PASS_MAX: ::c_int = 39;
1169 pub const _SC_PHYS_PAGES: ::c_int = 40;
1170 pub const _SC_AVPHYS_PAGES: ::c_int = 41;
1171 pub const _SC_PIPE: ::c_int = 42;
1172 pub const _SC_SELECT: ::c_int = 43;
1173 pub const _SC_POLL: ::c_int = 44;
1174 pub const _SC_MAPPED_FILES: ::c_int = 45;
1175 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 46;
1176 pub const _SC_THREAD_STACK_MIN: ::c_int = 47;
1177 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 48;
1178 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 49;
1179 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 50;
1180 pub const _SC_REALTIME_SIGNALS: ::c_int = 51;
1181 pub const _SC_MEMORY_PROTECTION: ::c_int = 52;
1182 pub const _SC_SIGQUEUE_MAX: ::c_int = 53;
1183 pub const _SC_RTSIG_MAX: ::c_int = 54;
1184 pub const _SC_MONOTONIC_CLOCK: ::c_int = 55;
1185 pub const _SC_DELAYTIMER_MAX: ::c_int = 56;
1186 pub const _SC_TIMER_MAX: ::c_int = 57;
1187 pub const _SC_TIMERS: ::c_int = 58;
1188 pub const _SC_CPUTIME: ::c_int = 59;
1189 pub const _SC_THREAD_CPUTIME: ::c_int = 60;
1190 pub const _SC_HOST_NAME_MAX: ::c_int = 61;
1191 pub const _SC_REGEXP: ::c_int = 62;
1192 pub const _SC_SYMLOOP_MAX: ::c_int = 63;
1193 pub const _SC_SHELL: ::c_int = 64;
1194 pub const _SC_TTY_NAME_MAX: ::c_int = 65;
1195 pub const _SC_ADVISORY_INFO: ::c_int = 66;
1196 pub const _SC_BARRIERS: ::c_int = 67;
1197 pub const _SC_CLOCK_SELECTION: ::c_int = 68;
1198 pub const _SC_FSYNC: ::c_int = 69;
1199 pub const _SC_IPV6: ::c_int = 70;
1200 pub const _SC_MEMLOCK: ::c_int = 71;
1201 pub const _SC_MEMLOCK_RANGE: ::c_int = 72;
1202 pub const _SC_MESSAGE_PASSING: ::c_int = 73;
1203 pub const _SC_PRIORITIZED_IO: ::c_int = 74;
1204 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 75;
1205 pub const _SC_READER_WRITER_LOCKS: ::c_int = 76;
1206 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 77;
1207 pub const _SC_SPAWN: ::c_int = 78;
1208 pub const _SC_SPIN_LOCKS: ::c_int = 79;
1209 pub const _SC_SPORADIC_SERVER: ::c_int = 80;
1210 pub const _SC_SYNCHRONIZED_IO: ::c_int = 81;
1211 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 82;
1212 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 83;
1213 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 84;
1214 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 85;
1215 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 86;
1216 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 87;
1217 pub const _SC_TIMEOUTS: ::c_int = 88;
1218 pub const _SC_TRACE: ::c_int = 89;
1219 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 90;
1220 pub const _SC_TRACE_INHERIT: ::c_int = 91;
1221 pub const _SC_TRACE_LOG: ::c_int = 92;
1222 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 93;
1223 pub const _SC_V6_ILP32_OFF32: ::c_int = 94;
1224 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 95;
1225 pub const _SC_V6_LP64_OFF64: ::c_int = 96;
1226 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 97;
1227 pub const _SC_V7_ILP32_OFF32: ::c_int = 98;
1228 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 99;
1229 pub const _SC_V7_LP64_OFF64: ::c_int = 100;
1230 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 101;
1231 pub const _SC_2_C_BIND: ::c_int = 102;
1232 pub const _SC_2_C_DEV: ::c_int = 103;
1233 pub const _SC_2_CHAR_TERM: ::c_int = 104;
1234 pub const _SC_2_FORT_DEV: ::c_int = 105;
1235 pub const _SC_2_FORT_RUN: ::c_int = 106;
1236 pub const _SC_2_LOCALEDEF: ::c_int = 107;
1237 pub const _SC_2_PBS: ::c_int = 108;
1238 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 109;
1239 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 110;
1240 pub const _SC_2_PBS_LOCATE: ::c_int = 111;
1241 pub const _SC_2_PBS_MESSAGE: ::c_int = 112;
1242 pub const _SC_2_PBS_TRACK: ::c_int = 113;
1243 pub const _SC_2_SW_DEV: ::c_int = 114;
1244 pub const _SC_2_UPE: ::c_int = 115;
1245 pub const _SC_2_VERSION: ::c_int = 116;
1246 pub const _SC_XOPEN_CRYPT: ::c_int = 117;
1247 pub const _SC_XOPEN_ENH_I18N: ::c_int = 118;
1248 pub const _SC_XOPEN_REALTIME: ::c_int = 119;
1249 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 120;
1250 pub const _SC_XOPEN_SHM: ::c_int = 121;
1251 pub const _SC_XOPEN_STREAMS: ::c_int = 122;
1252 pub const _SC_XOPEN_UNIX: ::c_int = 123;
1253 pub const _SC_XOPEN_UUCP: ::c_int = 124;
1254 pub const _SC_XOPEN_VERSION: ::c_int = 125;
1255 pub const _SC_BC_BASE_MAX: ::c_int = 129;
1256 pub const _SC_BC_DIM_MAX: ::c_int = 130;
1257 pub const _SC_BC_SCALE_MAX: ::c_int = 131;
1258 pub const _SC_BC_STRING_MAX: ::c_int = 132;
1259 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 133;
1260 pub const _SC_EXPR_NEST_MAX: ::c_int = 134;
1261 pub const _SC_LINE_MAX: ::c_int = 135;
1262 pub const _SC_LOGIN_NAME_MAX: ::c_int = 136;
1263 pub const _SC_MQ_OPEN_MAX: ::c_int = 137;
1264 pub const _SC_MQ_PRIO_MAX: ::c_int = 138;
1265 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 139;
1266 pub const _SC_THREAD_KEYS_MAX: ::c_int = 140;
1267 pub const _SC_THREAD_THREADS_MAX: ::c_int = 141;
1268 pub const _SC_RE_DUP_MAX: ::c_int = 142;
1269 
1270 pub const PTHREAD_STACK_MIN: ::size_t = 8192;
1271 
1272 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
1273     flags: 0,
1274     lock: 0,
1275     unused: -42,
1276     owner: -1,
1277     owner_count: 0,
1278 };
1279 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1280     flags: 0,
1281     unused: -42,
1282     mutex: 0 as *mut _,
1283     waiter_count: 0,
1284     lock: 0,
1285 };
1286 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1287     flags: 0,
1288     owner: -1,
1289     lock_sem: 0,
1290     lock_count: 0,
1291     reader_count: 0,
1292     writer_count: 0,
1293     waiters: [0 as *mut _; 2],
1294 };
1295 
1296 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0;
1297 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1;
1298 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
1299 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
1300 
1301 pub const FIOCLEX: c_ulong = 0; // FIXME: does not exist on Haiku!
1302 
1303 pub const RUSAGE_CHILDREN: ::c_int = -1;
1304 
1305 pub const SOCK_STREAM: ::c_int = 1;
1306 pub const SOCK_DGRAM: ::c_int = 2;
1307 pub const SOCK_RAW: ::c_int = 3;
1308 pub const SOCK_SEQPACKET: ::c_int = 5;
1309 
1310 pub const SOL_SOCKET: ::c_int = -1;
1311 pub const SO_ACCEPTCONN: ::c_int = 0x00000001;
1312 pub const SO_BROADCAST: ::c_int = 0x00000002;
1313 pub const SO_DEBUG: ::c_int = 0x00000004;
1314 pub const SO_DONTROUTE: ::c_int = 0x00000008;
1315 pub const SO_KEEPALIVE: ::c_int = 0x00000010;
1316 pub const SO_OOBINLINE: ::c_int = 0x00000020;
1317 pub const SO_REUSEADDR: ::c_int = 0x00000040;
1318 pub const SO_REUSEPORT: ::c_int = 0x00000080;
1319 pub const SO_USELOOPBACK: ::c_int = 0x00000100;
1320 pub const SO_LINGER: ::c_int = 0x00000200;
1321 pub const SO_SNDBUF: ::c_int = 0x40000001;
1322 pub const SO_SNDLOWAT: ::c_int = 0x40000002;
1323 pub const SO_SNDTIMEO: ::c_int = 0x40000003;
1324 pub const SO_RCVBUF: ::c_int = 0x40000004;
1325 pub const SO_RCVLOWAT: ::c_int = 0x40000005;
1326 pub const SO_RCVTIMEO: ::c_int = 0x40000006;
1327 pub const SO_ERROR: ::c_int = 0x40000007;
1328 pub const SO_TYPE: ::c_int = 0x40000008;
1329 pub const SO_NONBLOCK: ::c_int = 0x40000009;
1330 pub const SO_BINDTODEVICE: ::c_int = 0x4000000a;
1331 pub const SO_PEERCRED: ::c_int = 0x4000000b;
1332 
1333 pub const SCM_RIGHTS: ::c_int = 0x01;
1334 
1335 pub const SOMAXCONN: ::c_int = 32;
1336 
1337 pub const NI_MAXHOST: ::size_t = 1025;
1338 
1339 pub const WNOHANG: ::c_int = 0x01;
1340 pub const WUNTRACED: ::c_int = 0x02;
1341 pub const WCONTINUED: ::c_int = 0x04;
1342 pub const WEXITED: ::c_int = 0x08;
1343 pub const WSTOPPED: ::c_int = 0x10;
1344 pub const WNOWAIT: ::c_int = 0x20;
1345 
1346 // si_code values for SIGBUS signal
1347 pub const BUS_ADRALN: ::c_int = 40;
1348 pub const BUS_ADRERR: ::c_int = 41;
1349 pub const BUS_OBJERR: ::c_int = 42;
1350 
1351 // si_code values for SIGCHLD signal
1352 pub const CLD_EXITED: ::c_int = 60;
1353 pub const CLD_KILLED: ::c_int = 61;
1354 pub const CLD_DUMPED: ::c_int = 62;
1355 pub const CLD_TRAPPED: ::c_int = 63;
1356 pub const CLD_STOPPED: ::c_int = 64;
1357 pub const CLD_CONTINUED: ::c_int = 65;
1358 
1359 pub const P_ALL: idtype_t = 0;
1360 pub const P_PID: idtype_t = 1;
1361 pub const P_PGID: idtype_t = 2;
1362 
1363 pub const UTIME_OMIT: c_long = 1000000001;
1364 pub const UTIME_NOW: c_long = 1000000000;
1365 
1366 pub const VINTR: usize = 0;
1367 pub const VQUIT: usize = 1;
1368 pub const VERASE: usize = 2;
1369 pub const VKILL: usize = 3;
1370 pub const VEOF: usize = 4;
1371 pub const VEOL: usize = 5;
1372 pub const VMIN: usize = 4;
1373 pub const VTIME: usize = 5;
1374 pub const VEOL2: usize = 6;
1375 pub const VSWTCH: usize = 7;
1376 pub const VSTART: usize = 8;
1377 pub const VSTOP: usize = 9;
1378 pub const VSUSP: usize = 10;
1379 
1380 pub const IGNBRK: ::tcflag_t = 0x01;
1381 pub const BRKINT: ::tcflag_t = 0x02;
1382 pub const IGNPAR: ::tcflag_t = 0x04;
1383 pub const PARMRK: ::tcflag_t = 0x08;
1384 pub const INPCK: ::tcflag_t = 0x10;
1385 pub const ISTRIP: ::tcflag_t = 0x20;
1386 pub const INLCR: ::tcflag_t = 0x40;
1387 pub const IGNCR: ::tcflag_t = 0x80;
1388 pub const ICRNL: ::tcflag_t = 0x100;
1389 pub const IUCLC: ::tcflag_t = 0x200;
1390 pub const IXON: ::tcflag_t = 0x400;
1391 pub const IXANY: ::tcflag_t = 0x800;
1392 pub const IXOFF: ::tcflag_t = 0x1000;
1393 
1394 pub const OPOST: ::tcflag_t = 0x00000001;
1395 pub const OLCUC: ::tcflag_t = 0x00000002;
1396 pub const ONLCR: ::tcflag_t = 0x00000004;
1397 pub const OCRNL: ::tcflag_t = 0x00000008;
1398 pub const ONOCR: ::tcflag_t = 0x00000010;
1399 pub const ONLRET: ::tcflag_t = 0x00000020;
1400 pub const OFILL: ::tcflag_t = 0x00000040;
1401 pub const OFDEL: ::tcflag_t = 0x00000080;
1402 pub const NLDLY: ::tcflag_t = 0x00000100;
1403 pub const NL0: ::tcflag_t = 0x00000000;
1404 pub const NL1: ::tcflag_t = 0x00000100;
1405 pub const CRDLY: ::tcflag_t = 0x00000600;
1406 pub const CR0: ::tcflag_t = 0x00000000;
1407 pub const CR1: ::tcflag_t = 0x00000200;
1408 pub const CR2: ::tcflag_t = 0x00000400;
1409 pub const CR3: ::tcflag_t = 0x00000600;
1410 pub const TABDLY: ::tcflag_t = 0x00001800;
1411 pub const TAB0: ::tcflag_t = 0x00000000;
1412 pub const TAB1: ::tcflag_t = 0x00000800;
1413 pub const TAB2: ::tcflag_t = 0x00001000;
1414 pub const TAB3: ::tcflag_t = 0x00001800;
1415 pub const BSDLY: ::tcflag_t = 0x00002000;
1416 pub const BS0: ::tcflag_t = 0x00000000;
1417 pub const BS1: ::tcflag_t = 0x00002000;
1418 pub const VTDLY: ::tcflag_t = 0x00004000;
1419 pub const VT0: ::tcflag_t = 0x00000000;
1420 pub const VT1: ::tcflag_t = 0x00004000;
1421 pub const FFDLY: ::tcflag_t = 0x00008000;
1422 pub const FF0: ::tcflag_t = 0x00000000;
1423 pub const FF1: ::tcflag_t = 0x00008000;
1424 
1425 pub const CSIZE: ::tcflag_t = 0x00000020;
1426 pub const CS5: ::tcflag_t = 0x00000000;
1427 pub const CS6: ::tcflag_t = 0x00000000;
1428 pub const CS7: ::tcflag_t = 0x00000000;
1429 pub const CS8: ::tcflag_t = 0x00000020;
1430 pub const CSTOPB: ::tcflag_t = 0x00000040;
1431 pub const CREAD: ::tcflag_t = 0x00000080;
1432 pub const PARENB: ::tcflag_t = 0x00000100;
1433 pub const PARODD: ::tcflag_t = 0x00000200;
1434 pub const HUPCL: ::tcflag_t = 0x00000400;
1435 pub const CLOCAL: ::tcflag_t = 0x00000800;
1436 pub const XLOBLK: ::tcflag_t = 0x00001000;
1437 pub const CTSFLOW: ::tcflag_t = 0x00002000;
1438 pub const RTSFLOW: ::tcflag_t = 0x00004000;
1439 pub const CRTSCTS: ::tcflag_t = RTSFLOW | CTSFLOW;
1440 
1441 pub const ISIG: ::tcflag_t = 0x00000001;
1442 pub const ICANON: ::tcflag_t = 0x00000002;
1443 pub const XCASE: ::tcflag_t = 0x00000004;
1444 pub const ECHO: ::tcflag_t = 0x00000008;
1445 pub const ECHOE: ::tcflag_t = 0x00000010;
1446 pub const ECHOK: ::tcflag_t = 0x00000020;
1447 pub const ECHONL: ::tcflag_t = 0x00000040;
1448 pub const NOFLSH: ::tcflag_t = 0x00000080;
1449 pub const TOSTOP: ::tcflag_t = 0x00000100;
1450 pub const IEXTEN: ::tcflag_t = 0x00000200;
1451 pub const ECHOCTL: ::tcflag_t = 0x00000400;
1452 pub const ECHOPRT: ::tcflag_t = 0x00000800;
1453 pub const ECHOKE: ::tcflag_t = 0x00001000;
1454 pub const FLUSHO: ::tcflag_t = 0x00002000;
1455 pub const PENDIN: ::tcflag_t = 0x00004000;
1456 
1457 pub const TCGB_CTS: ::c_int = 0x01;
1458 pub const TCGB_DSR: ::c_int = 0x02;
1459 pub const TCGB_RI: ::c_int = 0x04;
1460 pub const TCGB_DCD: ::c_int = 0x08;
1461 pub const TIOCM_CTS: ::c_int = TCGB_CTS;
1462 pub const TIOCM_CD: ::c_int = TCGB_DCD;
1463 pub const TIOCM_CAR: ::c_int = TCGB_DCD;
1464 pub const TIOCM_RI: ::c_int = TCGB_RI;
1465 pub const TIOCM_RNG: ::c_int = TCGB_RI;
1466 pub const TIOCM_DSR: ::c_int = TCGB_DSR;
1467 pub const TIOCM_DTR: ::c_int = 0x10;
1468 pub const TIOCM_RTS: ::c_int = 0x20;
1469 
1470 pub const B0: speed_t = 0x00;
1471 pub const B50: speed_t = 0x01;
1472 pub const B75: speed_t = 0x02;
1473 pub const B110: speed_t = 0x03;
1474 pub const B134: speed_t = 0x04;
1475 pub const B150: speed_t = 0x05;
1476 pub const B200: speed_t = 0x06;
1477 pub const B300: speed_t = 0x07;
1478 pub const B600: speed_t = 0x08;
1479 pub const B1200: speed_t = 0x09;
1480 pub const B1800: speed_t = 0x0A;
1481 pub const B2400: speed_t = 0x0B;
1482 pub const B4800: speed_t = 0x0C;
1483 pub const B9600: speed_t = 0x0D;
1484 pub const B19200: speed_t = 0x0E;
1485 pub const B38400: speed_t = 0x0F;
1486 pub const B57600: speed_t = 0x10;
1487 pub const B115200: speed_t = 0x11;
1488 pub const B230400: speed_t = 0x12;
1489 pub const B31250: speed_t = 0x13;
1490 
1491 pub const TCSANOW: ::c_int = 0x01;
1492 pub const TCSADRAIN: ::c_int = 0x02;
1493 pub const TCSAFLUSH: ::c_int = 0x04;
1494 
1495 pub const TCOOFF: ::c_int = 0x01;
1496 pub const TCOON: ::c_int = 0x02;
1497 pub const TCIOFF: ::c_int = 0x04;
1498 pub const TCION: ::c_int = 0x08;
1499 
1500 pub const TCIFLUSH: ::c_int = 0x01;
1501 pub const TCOFLUSH: ::c_int = 0x02;
1502 pub const TCIOFLUSH: ::c_int = 0x03;
1503 
1504 pub const TCGETA: ::c_ulong = 0x8000;
1505 pub const TCSETA: ::c_ulong = TCGETA + 1;
1506 pub const TCSETAF: ::c_ulong = TCGETA + 2;
1507 pub const TCSETAW: ::c_ulong = TCGETA + 3;
1508 pub const TCSBRK: ::c_ulong = TCGETA + 5;
1509 pub const TCFLSH: ::c_ulong = TCGETA + 6;
1510 pub const TCXONC: ::c_ulong = TCGETA + 7;
1511 pub const TCGETBITS: ::c_ulong = TCGETA + 9;
1512 pub const TCSETDTR: ::c_ulong = TCGETA + 10;
1513 pub const TCSETRTS: ::c_ulong = TCGETA + 11;
1514 pub const TIOCGWINSZ: ::c_ulong = TCGETA + 12;
1515 pub const TIOCSWINSZ: ::c_ulong = TCGETA + 13;
1516 pub const TIOCGPGRP: ::c_ulong = TCGETA + 15;
1517 pub const TIOCSPGRP: ::c_ulong = TCGETA + 16;
1518 pub const TIOCSCTTY: ::c_ulong = TCGETA + 17;
1519 pub const TIOCMGET: ::c_ulong = TCGETA + 18;
1520 pub const TIOCMSET: ::c_ulong = TCGETA + 19;
1521 pub const TIOCSBRK: ::c_ulong = TCGETA + 20;
1522 pub const TIOCCBRK: ::c_ulong = TCGETA + 21;
1523 pub const TIOCMBIS: ::c_ulong = TCGETA + 22;
1524 pub const TIOCMBIC: ::c_ulong = TCGETA + 23;
1525 pub const TIOCGSID: ::c_ulong = TCGETA + 24;
1526 pub const TIOCOUTQ: ::c_ulong = TCGETA + 25;
1527 pub const TIOCEXCL: ::c_ulong = TCGETA + 26;
1528 pub const TIOCNXCL: ::c_ulong = TCGETA + 27;
1529 
1530 pub const PRIO_PROCESS: ::c_int = 0;
1531 pub const PRIO_PGRP: ::c_int = 1;
1532 pub const PRIO_USER: ::c_int = 2;
1533 
1534 // utmpx entry types
1535 pub const EMPTY: ::c_short = 0;
1536 pub const BOOT_TIME: ::c_short = 1;
1537 pub const OLD_TIME: ::c_short = 2;
1538 pub const NEW_TIME: ::c_short = 3;
1539 pub const USER_PROCESS: ::c_short = 4;
1540 pub const INIT_PROCESS: ::c_short = 5;
1541 pub const LOGIN_PROCESS: ::c_short = 6;
1542 pub const DEAD_PROCESS: ::c_short = 7;
1543 
1544 pub const LOG_PID: ::c_int = 1 << 12;
1545 pub const LOG_CONS: ::c_int = 2 << 12;
1546 pub const LOG_ODELAY: ::c_int = 4 << 12;
1547 pub const LOG_NDELAY: ::c_int = 8 << 12;
1548 pub const LOG_SERIAL: ::c_int = 16 << 12;
1549 pub const LOG_PERROR: ::c_int = 32 << 12;
1550 pub const LOG_NOWAIT: ::c_int = 64 << 12;
1551 
1552 // spawn.h
1553 pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
1554 pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
1555 pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
1556 pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
1557 pub const POSIX_SPAWN_SETSID: ::c_int = 0x40;
1558 
1559 const_fn! {
1560     {const} fn CMSG_ALIGN(len: usize) -> usize {
1561         len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
1562     }
1563 }
1564 
1565 f! {
1566     pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1567         if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
1568             (*mhdr).msg_control as *mut cmsghdr
1569         } else {
1570             0 as *mut cmsghdr
1571         }
1572     }
1573 
1574     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1575         (cmsg as *mut ::c_uchar)
1576             .offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1577     }
1578 
1579     pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1580         (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
1581             as ::c_uint
1582     }
1583 
1584     pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1585         CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
1586     }
1587 
1588     pub fn CMSG_NXTHDR(mhdr: *const msghdr,
1589                        cmsg: *const cmsghdr) -> *mut cmsghdr {
1590         if cmsg.is_null() {
1591             return ::CMSG_FIRSTHDR(mhdr);
1592         };
1593         let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)
1594             + CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
1595         let max = (*mhdr).msg_control as usize
1596             + (*mhdr).msg_controllen as usize;
1597         if next > max {
1598             0 as *mut ::cmsghdr
1599         } else {
1600             (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize))
1601                 as *mut ::cmsghdr
1602         }
1603     }
1604 
1605     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
1606         let fd = fd as usize;
1607         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1608         (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1609         return
1610     }
1611 
1612     pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
1613         let fd = fd as usize;
1614         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1615         return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
1616     }
1617 
1618     pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
1619         let fd = fd as usize;
1620         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1621         (*set).fds_bits[fd / size] |= 1 << (fd % size);
1622         return
1623     }
1624 
1625     pub fn FD_ZERO(set: *mut fd_set) -> () {
1626         for slot in (*set).fds_bits.iter_mut() {
1627             *slot = 0;
1628         }
1629     }
1630 }
1631 
1632 safe_f! {
1633     pub {const} fn WIFEXITED(status: ::c_int) -> bool {
1634         (status & !0xff) == 0
1635     }
1636 
1637     pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
1638         status & 0xff
1639     }
1640 
1641     pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1642         ((status >> 8) & 0xff) != 0
1643     }
1644 
1645     pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
1646         (status >> 8) & 0xff
1647     }
1648 
1649     pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
1650         ((status >> 16) & 0xff) != 0
1651     }
1652 
1653     pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
1654         (status >> 16) & 0xff
1655     }
1656 
1657     // actually WIFCORED, but this is used everywhere else
1658     pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
1659         (status & 0x10000) != 0
1660     }
1661 
1662     pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
1663         (status & 0x20000) != 0
1664     }
1665 }
1666 
1667 extern "C" {
getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int1668     pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int1669     pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
getpriority(which: ::c_int, who: id_t) -> ::c_int1670     pub fn getpriority(which: ::c_int, who: id_t) -> ::c_int;
setpriority(which: ::c_int, who: id_t, priority: ::c_int) -> ::c_int1671     pub fn setpriority(which: ::c_int, who: id_t, priority: ::c_int) -> ::c_int;
1672 
endusershell()1673     pub fn endusershell();
getpass(prompt: *const ::c_char) -> *mut ::c_char1674     pub fn getpass(prompt: *const ::c_char) -> *mut ::c_char;
getusershell() -> *mut ::c_char1675     pub fn getusershell() -> *mut ::c_char;
issetugid() -> ::c_int1676     pub fn issetugid() -> ::c_int;
setusershell()1677     pub fn setusershell();
1678 
utimensat( fd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int, ) -> ::c_int1679     pub fn utimensat(
1680         fd: ::c_int,
1681         path: *const ::c_char,
1682         times: *const ::timespec,
1683         flag: ::c_int,
1684     ) -> ::c_int;
futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int1685     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int1686     pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
_errnop() -> *mut ::c_int1687     pub fn _errnop() -> *mut ::c_int;
1688 
abs(i: ::c_int) -> ::c_int1689     pub fn abs(i: ::c_int) -> ::c_int;
labs(i: ::c_long) -> ::c_long1690     pub fn labs(i: ::c_long) -> ::c_long;
rand() -> ::c_int1691     pub fn rand() -> ::c_int;
srand(seed: ::c_uint)1692     pub fn srand(seed: ::c_uint);
getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int1693     pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
freeifaddrs(ifa: *mut ::ifaddrs)1694     pub fn freeifaddrs(ifa: *mut ::ifaddrs);
ppoll( fds: *mut ::pollfd, numfds: ::nfds_t, timeout: *const ::timespec, sigMask: *const sigset_t, ) -> ::c_int1695     pub fn ppoll(
1696         fds: *mut ::pollfd,
1697         numfds: ::nfds_t,
1698         timeout: *const ::timespec,
1699         sigMask: *const sigset_t,
1700     ) -> ::c_int;
1701 
getspent() -> *mut spwd1702     pub fn getspent() -> *mut spwd;
getspent_r( pwd: *mut spwd, buf: *mut ::c_char, bufferSize: ::size_t, res: *mut *mut spwd, ) -> ::c_int1703     pub fn getspent_r(
1704         pwd: *mut spwd,
1705         buf: *mut ::c_char,
1706         bufferSize: ::size_t,
1707         res: *mut *mut spwd,
1708     ) -> ::c_int;
setspent()1709     pub fn setspent();
endspent()1710     pub fn endspent();
getspnam(name: *const ::c_char) -> *mut spwd1711     pub fn getspnam(name: *const ::c_char) -> *mut spwd;
getspnam_r( name: *const ::c_char, spwd: *mut spwd, buffer: *mut ::c_char, bufferSize: ::size_t, res: *mut *mut spwd, ) -> ::c_int1712     pub fn getspnam_r(
1713         name: *const ::c_char,
1714         spwd: *mut spwd,
1715         buffer: *mut ::c_char,
1716         bufferSize: ::size_t,
1717         res: *mut *mut spwd,
1718     ) -> ::c_int;
sgetspent(line: *const ::c_char) -> *mut spwd1719     pub fn sgetspent(line: *const ::c_char) -> *mut spwd;
sgetspent_r( line: *const ::c_char, spwd: *mut spwd, buffer: *mut ::c_char, bufferSize: ::size_t, res: *mut *mut spwd, ) -> ::c_int1720     pub fn sgetspent_r(
1721         line: *const ::c_char,
1722         spwd: *mut spwd,
1723         buffer: *mut ::c_char,
1724         bufferSize: ::size_t,
1725         res: *mut *mut spwd,
1726     ) -> ::c_int;
fgetspent(file: *mut ::FILE) -> *mut spwd1727     pub fn fgetspent(file: *mut ::FILE) -> *mut spwd;
fgetspent_r( file: *mut ::FILE, spwd: *mut spwd, buffer: *mut ::c_char, bufferSize: ::size_t, res: *mut *mut spwd, ) -> ::c_int1728     pub fn fgetspent_r(
1729         file: *mut ::FILE,
1730         spwd: *mut spwd,
1731         buffer: *mut ::c_char,
1732         bufferSize: ::size_t,
1733         res: *mut *mut spwd,
1734     ) -> ::c_int;
mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int1735     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
mknodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t, ) -> ::c_int1736     pub fn mknodat(
1737         dirfd: ::c_int,
1738         pathname: *const ::c_char,
1739         mode: ::mode_t,
1740         dev: dev_t,
1741     ) -> ::c_int;
sem_destroy(sem: *mut sem_t) -> ::c_int1742     pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int1743     pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
1744 
clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int1745     pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int1746     pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int1747     pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int1748     pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::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_int1749     pub fn pthread_create(
1750         thread: *mut ::pthread_t,
1751         attr: *const ::pthread_attr_t,
1752         f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
1753         value: *mut ::c_void,
1754     ) -> ::c_int;
pthread_attr_getguardsize( attr: *const ::pthread_attr_t, guardsize: *mut ::size_t, ) -> ::c_int1755     pub fn pthread_attr_getguardsize(
1756         attr: *const ::pthread_attr_t,
1757         guardsize: *mut ::size_t,
1758     ) -> ::c_int;
pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int1759     pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pthread_attr_getstack( attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t, ) -> ::c_int1760     pub fn pthread_attr_getstack(
1761         attr: *const ::pthread_attr_t,
1762         stackaddr: *mut *mut ::c_void,
1763         stacksize: *mut ::size_t,
1764     ) -> ::c_int;
pthread_condattr_getclock( attr: *const pthread_condattr_t, clock_id: *mut clockid_t, ) -> ::c_int1765     pub fn pthread_condattr_getclock(
1766         attr: *const pthread_condattr_t,
1767         clock_id: *mut clockid_t,
1768     ) -> ::c_int;
pthread_condattr_setclock( attr: *mut pthread_condattr_t, clock_id: ::clockid_t, ) -> ::c_int1769     pub fn pthread_condattr_setclock(
1770         attr: *mut pthread_condattr_t,
1771         clock_id: ::clockid_t,
1772     ) -> ::c_int;
valloc(numBytes: ::size_t) -> *mut ::c_void1773     pub fn valloc(numBytes: ::size_t) -> *mut ::c_void;
malloc_usable_size(ptr: *mut ::c_void) -> ::size_t1774     pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void1775     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int1776     pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int1777     pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int1778     pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int1779     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
dirfd(dirp: *mut ::DIR) -> ::c_int1780     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, servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int1781     pub fn getnameinfo(
1782         sa: *const ::sockaddr,
1783         salen: ::socklen_t,
1784         host: *mut ::c_char,
1785         hostlen: ::socklen_t,
1786         serv: *mut ::c_char,
1787         servlen: ::socklen_t,
1788         flags: ::c_int,
1789     ) -> ::c_int;
pthread_mutex_timedlock( lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1790     pub fn pthread_mutex_timedlock(
1791         lock: *mut pthread_mutex_t,
1792         abstime: *const ::timespec,
1793     ) -> ::c_int;
pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::c_int1794     pub fn pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::c_int;
pthread_spin_init(lock: *mut ::pthread_spinlock_t, pshared: ::c_int) -> ::c_int1795     pub fn pthread_spin_init(lock: *mut ::pthread_spinlock_t, pshared: ::c_int) -> ::c_int;
pthread_spin_destroy(lock: *mut ::pthread_spinlock_t) -> ::c_int1796     pub fn pthread_spin_destroy(lock: *mut ::pthread_spinlock_t) -> ::c_int;
pthread_spin_lock(lock: *mut ::pthread_spinlock_t) -> ::c_int1797     pub fn pthread_spin_lock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
pthread_spin_trylock(lock: *mut ::pthread_spinlock_t) -> ::c_int1798     pub fn pthread_spin_trylock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
pthread_spin_unlock(lock: *mut ::pthread_spinlock_t) -> ::c_int1799     pub fn pthread_spin_unlock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int1800     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
1801         -> ::c_int;
1802 
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_int1803     pub fn glob(
1804         pattern: *const ::c_char,
1805         flags: ::c_int,
1806         errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
1807         pglob: *mut ::glob_t,
1808     ) -> ::c_int;
globfree(pglob: *mut ::glob_t)1809     pub fn globfree(pglob: *mut ::glob_t);
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1810     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_int1811     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_int1812     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_int1813     pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
1814 
shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int1815     pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int;
shm_unlink(name: *const ::c_char) -> ::c_int1816     pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1817 
seekdir(dirp: *mut ::DIR, loc: ::c_long)1818     pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
1819 
telldir(dirp: *mut ::DIR) -> ::c_long1820     pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int1821     pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
1822 
msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int1823     pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
1824 
recvfrom( socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, ) -> ::ssize_t1825     pub fn recvfrom(
1826         socket: ::c_int,
1827         buf: *mut ::c_void,
1828         len: ::size_t,
1829         flags: ::c_int,
1830         addr: *mut ::sockaddr,
1831         addrlen: *mut ::socklen_t,
1832     ) -> ::ssize_t;
mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int1833     pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
nl_langinfo(item: ::nl_item) -> *mut ::c_char1834     pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
1835 
bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int1836     pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
1837 
writev(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t1838     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_t1839     pub fn readv(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t;
1840 
sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t1841     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_t1842     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_int1843     pub fn execvpe(
1844         file: *const ::c_char,
1845         argv: *const *const ::c_char,
1846         environment: *const *const ::c_char,
1847     ) -> ::c_int;
getgrgid_r( gid: ::gid_t, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int1848     pub fn getgrgid_r(
1849         gid: ::gid_t,
1850         grp: *mut ::group,
1851         buf: *mut ::c_char,
1852         buflen: ::size_t,
1853         result: *mut *mut ::group,
1854     ) -> ::c_int;
getgrouplist( user: *const ::c_char, basegroup: ::gid_t, grouplist: *mut ::gid_t, groupcount: *mut ::c_int, ) -> ::c_int1855     pub fn getgrouplist(
1856         user: *const ::c_char,
1857         basegroup: ::gid_t,
1858         grouplist: *mut ::gid_t,
1859         groupcount: *mut ::c_int,
1860     ) -> ::c_int;
sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int1861     pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
sigsuspend(mask: *const ::sigset_t) -> ::c_int1862     pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
sem_close(sem: *mut sem_t) -> ::c_int1863     pub fn sem_close(sem: *mut sem_t) -> ::c_int;
getdtablesize() -> ::c_int1864     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_int1865     pub fn getgrnam_r(
1866         name: *const ::c_char,
1867         grp: *mut ::group,
1868         buf: *mut ::c_char,
1869         buflen: ::size_t,
1870         result: *mut *mut ::group,
1871     ) -> ::c_int;
pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1872     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_t1873     pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
getgrnam(name: *const ::c_char) -> *mut ::group1874     pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int1875     pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
sem_unlink(name: *const ::c_char) -> ::c_int1876     pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
getpwnam_r( name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int1877     pub fn getpwnam_r(
1878         name: *const ::c_char,
1879         pwd: *mut passwd,
1880         buf: *mut ::c_char,
1881         buflen: ::size_t,
1882         result: *mut *mut passwd,
1883     ) -> ::c_int;
getpwuid_r( uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int1884     pub fn getpwuid_r(
1885         uid: ::uid_t,
1886         pwd: *mut passwd,
1887         buf: *mut ::c_char,
1888         buflen: ::size_t,
1889         result: *mut *mut passwd,
1890     ) -> ::c_int;
getpwent() -> *mut passwd1891     pub fn getpwent() -> *mut passwd;
setpwent()1892     pub fn setpwent();
endpwent()1893     pub fn endpwent();
endgrent()1894     pub fn endgrent();
getgrent() -> *mut ::group1895     pub fn getgrent() -> *mut ::group;
setgrent()1896     pub fn setgrent();
sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int1897     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_int1898     pub fn pthread_atfork(
1899         prepare: ::Option<unsafe extern "C" fn()>,
1900         parent: ::Option<unsafe extern "C" fn()>,
1901         child: ::Option<unsafe extern "C" fn()>,
1902     ) -> ::c_int;
getgrgid(gid: ::gid_t) -> *mut ::group1903     pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE1904     pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int1905     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
uname(buf: *mut ::utsname) -> ::c_int1906     pub fn uname(buf: *mut ::utsname) -> ::c_int;
getutxent() -> *mut utmpx1907     pub fn getutxent() -> *mut utmpx;
getutxid(ut: *const utmpx) -> *mut utmpx1908     pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
getutxline(ut: *const utmpx) -> *mut utmpx1909     pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pututxline(ut: *const utmpx) -> *mut utmpx1910     pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
setutxent()1911     pub fn setutxent();
endutxent()1912     pub fn endutxent();
faccessat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::c_int, flags: ::c_int, ) -> ::c_int1913     pub fn faccessat(
1914         dirfd: ::c_int,
1915         pathname: *const ::c_char,
1916         mode: ::c_int,
1917         flags: ::c_int,
1918     ) -> ::c_int;
1919 
sigtimedwait( set: *const sigset_t, info: *mut siginfo_t, timeout: *const ::timespec, ) -> ::c_int1920     pub fn sigtimedwait(
1921         set: *const sigset_t,
1922         info: *mut siginfo_t,
1923         timeout: *const ::timespec,
1924     ) -> ::c_int;
sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int1925     pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
1926 
getitimer(which: ::c_int, curr_value: *mut ::itimerval) -> ::c_int1927     pub fn getitimer(which: ::c_int, curr_value: *mut ::itimerval) -> ::c_int;
setitimer( which: ::c_int, new_value: *const ::itimerval, old_value: *mut ::itimerval, ) -> ::c_int1928     pub fn setitimer(
1929         which: ::c_int,
1930         new_value: *const ::itimerval,
1931         old_value: *mut ::itimerval,
1932     ) -> ::c_int;
1933 
regcomp(preg: *mut regex_t, pattern: *const ::c_char, cflags: ::c_int) -> ::c_int1934     pub fn regcomp(preg: *mut regex_t, pattern: *const ::c_char, cflags: ::c_int) -> ::c_int;
1935 
regexec( preg: *const regex_t, input: *const ::c_char, nmatch: ::size_t, pmatch: *mut regmatch_t, eflags: ::c_int, ) -> ::c_int1936     pub fn regexec(
1937         preg: *const regex_t,
1938         input: *const ::c_char,
1939         nmatch: ::size_t,
1940         pmatch: *mut regmatch_t,
1941         eflags: ::c_int,
1942     ) -> ::c_int;
1943 
regerror( errcode: ::c_int, preg: *const regex_t, errbuf: *mut ::c_char, errbuf_size: ::size_t, ) -> ::size_t1944     pub fn regerror(
1945         errcode: ::c_int,
1946         preg: *const regex_t,
1947         errbuf: *mut ::c_char,
1948         errbuf_size: ::size_t,
1949     ) -> ::size_t;
1950 
regfree(preg: *mut regex_t)1951     pub fn regfree(preg: *mut regex_t);
1952 
msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int1953     pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int1954     pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
msgrcv( msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, msgtype: ::c_long, msgflg: ::c_int, ) -> ::ssize_t1955     pub fn msgrcv(
1956         msqid: ::c_int,
1957         msgp: *mut ::c_void,
1958         msgsz: ::size_t,
1959         msgtype: ::c_long,
1960         msgflg: ::c_int,
1961     ) -> ::ssize_t;
msgsnd( msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, msgflg: ::c_int, ) -> ::c_int1962     pub fn msgsnd(
1963         msqid: ::c_int,
1964         msgp: *const ::c_void,
1965         msgsz: ::size_t,
1966         msgflg: ::c_int,
1967     ) -> ::c_int;
semget(key: ::key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int1968     pub fn semget(key: ::key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int;
semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int1969     pub fn semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int1970     pub fn semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int;
ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t1971     pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
1972 
memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void1973     pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
1974 
lsearch( key: *const ::c_void, base: *mut ::c_void, nelp: *mut ::size_t, width: ::size_t, compar: ::Option<unsafe extern "C" fn(*const ::c_void, *const ::c_void) -> ::c_int>, ) -> *mut ::c_void1975     pub fn lsearch(
1976         key: *const ::c_void,
1977         base: *mut ::c_void,
1978         nelp: *mut ::size_t,
1979         width: ::size_t,
1980         compar: ::Option<unsafe extern "C" fn(*const ::c_void, *const ::c_void) -> ::c_int>,
1981     ) -> *mut ::c_void;
lfind( key: *const ::c_void, base: *const ::c_void, nelp: *mut ::size_t, width: ::size_t, compar: ::Option<unsafe extern "C" fn(*const ::c_void, *const ::c_void) -> ::c_int>, ) -> *mut ::c_void1982     pub fn lfind(
1983         key: *const ::c_void,
1984         base: *const ::c_void,
1985         nelp: *mut ::size_t,
1986         width: ::size_t,
1987         compar: ::Option<unsafe extern "C" fn(*const ::c_void, *const ::c_void) -> ::c_int>,
1988     ) -> *mut ::c_void;
hcreate(nelt: ::size_t) -> ::c_int1989     pub fn hcreate(nelt: ::size_t) -> ::c_int;
hdestroy()1990     pub fn hdestroy();
hsearch(entry: ::ENTRY, action: ::ACTION) -> *mut ::ENTRY1991     pub fn hsearch(entry: ::ENTRY, action: ::ACTION) -> *mut ::ENTRY;
1992 
drand48() -> ::c_double1993     pub fn drand48() -> ::c_double;
erand48(xseed: *mut ::c_ushort) -> ::c_double1994     pub fn erand48(xseed: *mut ::c_ushort) -> ::c_double;
lrand48() -> ::c_long1995     pub fn lrand48() -> ::c_long;
nrand48(xseed: *mut ::c_ushort) -> ::c_long1996     pub fn nrand48(xseed: *mut ::c_ushort) -> ::c_long;
mrand48() -> ::c_long1997     pub fn mrand48() -> ::c_long;
jrand48(xseed: *mut ::c_ushort) -> ::c_long1998     pub fn jrand48(xseed: *mut ::c_ushort) -> ::c_long;
srand48(seed: ::c_long)1999     pub fn srand48(seed: ::c_long);
seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort2000     pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort;
lcong48(p: *mut ::c_ushort)2001     pub fn lcong48(p: *mut ::c_ushort);
2002 
clearenv() -> ::c_int2003     pub fn clearenv() -> ::c_int;
ctermid(s: *mut ::c_char) -> *mut ::c_char2004     pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;
2005 
sync()2006     pub fn sync();
getpagesize() -> ::c_int2007     pub fn getpagesize() -> ::c_int;
2008 
brk(addr: *mut ::c_void) -> ::c_int2009     pub fn brk(addr: *mut ::c_void) -> ::c_int;
sbrk(increment: ::intptr_t) -> *mut ::c_void2010     pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
2011 
posix_spawn( pid: *mut ::pid_t, path: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char, ) -> ::c_int2012     pub fn posix_spawn(
2013         pid: *mut ::pid_t,
2014         path: *const ::c_char,
2015         file_actions: *const ::posix_spawn_file_actions_t,
2016         attrp: *const ::posix_spawnattr_t,
2017         argv: *const *mut ::c_char,
2018         envp: *const *mut ::c_char,
2019     ) -> ::c_int;
posix_spawnp( pid: *mut ::pid_t, file: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char, ) -> ::c_int2020     pub fn posix_spawnp(
2021         pid: *mut ::pid_t,
2022         file: *const ::c_char,
2023         file_actions: *const ::posix_spawn_file_actions_t,
2024         attrp: *const ::posix_spawnattr_t,
2025         argv: *const *mut ::c_char,
2026         envp: *const *mut ::c_char,
2027     ) -> ::c_int;
2028 
posix_spawn_file_actions_init(file_actions: *mut posix_spawn_file_actions_t) -> ::c_int2029     pub fn posix_spawn_file_actions_init(file_actions: *mut posix_spawn_file_actions_t) -> ::c_int;
posix_spawn_file_actions_destroy( file_actions: *mut posix_spawn_file_actions_t, ) -> ::c_int2030     pub fn posix_spawn_file_actions_destroy(
2031         file_actions: *mut posix_spawn_file_actions_t,
2032     ) -> ::c_int;
posix_spawn_file_actions_addopen( file_actions: *mut posix_spawn_file_actions_t, fildes: ::c_int, path: *const ::c_char, oflag: ::c_int, mode: ::mode_t, ) -> ::c_int2033     pub fn posix_spawn_file_actions_addopen(
2034         file_actions: *mut posix_spawn_file_actions_t,
2035         fildes: ::c_int,
2036         path: *const ::c_char,
2037         oflag: ::c_int,
2038         mode: ::mode_t,
2039     ) -> ::c_int;
posix_spawn_file_actions_addclose( file_actions: *mut posix_spawn_file_actions_t, fildes: ::c_int, ) -> ::c_int2040     pub fn posix_spawn_file_actions_addclose(
2041         file_actions: *mut posix_spawn_file_actions_t,
2042         fildes: ::c_int,
2043     ) -> ::c_int;
posix_spawn_file_actions_adddup2( file_actions: *mut posix_spawn_file_actions_t, fildes: ::c_int, newfildes: ::c_int, ) -> ::c_int2044     pub fn posix_spawn_file_actions_adddup2(
2045         file_actions: *mut posix_spawn_file_actions_t,
2046         fildes: ::c_int,
2047         newfildes: ::c_int,
2048     ) -> ::c_int;
2049 
posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int2050     pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int2051     pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_getflags( attr: *const posix_spawnattr_t, _flags: *mut ::c_short, ) -> ::c_int2052     pub fn posix_spawnattr_getflags(
2053         attr: *const posix_spawnattr_t,
2054         _flags: *mut ::c_short,
2055     ) -> ::c_int;
posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int2056     pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
posix_spawnattr_getpgroup( attr: *const posix_spawnattr_t, _pgroup: *mut ::pid_t, ) -> ::c_int2057     pub fn posix_spawnattr_getpgroup(
2058         attr: *const posix_spawnattr_t,
2059         _pgroup: *mut ::pid_t,
2060     ) -> ::c_int;
posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, pgroup: ::pid_t) -> ::c_int2061     pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, pgroup: ::pid_t) -> ::c_int;
posix_spawnattr_getsigdefault( attr: *const posix_spawnattr_t, sigdefault: *mut ::sigset_t, ) -> ::c_int2062     pub fn posix_spawnattr_getsigdefault(
2063         attr: *const posix_spawnattr_t,
2064         sigdefault: *mut ::sigset_t,
2065     ) -> ::c_int;
posix_spawnattr_setsigdefault( attr: *mut posix_spawnattr_t, sigdefault: *const ::sigset_t, ) -> ::c_int2066     pub fn posix_spawnattr_setsigdefault(
2067         attr: *mut posix_spawnattr_t,
2068         sigdefault: *const ::sigset_t,
2069     ) -> ::c_int;
posix_spawnattr_getsigmask( attr: *const posix_spawnattr_t, _sigmask: *mut ::sigset_t, ) -> ::c_int2070     pub fn posix_spawnattr_getsigmask(
2071         attr: *const posix_spawnattr_t,
2072         _sigmask: *mut ::sigset_t,
2073     ) -> ::c_int;
posix_spawnattr_setsigmask( attr: *mut posix_spawnattr_t, sigmask: *const ::sigset_t, ) -> ::c_int2074     pub fn posix_spawnattr_setsigmask(
2075         attr: *mut posix_spawnattr_t,
2076         sigmask: *const ::sigset_t,
2077     ) -> ::c_int;
getopt_long( argc: ::c_int, argv: *const *mut c_char, optstring: *const c_char, longopts: *const option, longindex: *mut ::c_int, ) -> ::c_int2078     pub fn getopt_long(
2079         argc: ::c_int,
2080         argv: *const *mut c_char,
2081         optstring: *const c_char,
2082         longopts: *const option,
2083         longindex: *mut ::c_int,
2084     ) -> ::c_int;
strcasecmp_l( string1: *const ::c_char, string2: *const ::c_char, locale: ::locale_t, ) -> ::c_int2085     pub fn strcasecmp_l(
2086         string1: *const ::c_char,
2087         string2: *const ::c_char,
2088         locale: ::locale_t,
2089     ) -> ::c_int;
strncasecmp_l( string1: *const ::c_char, string2: *const ::c_char, length: ::size_t, locale: ::locale_t, ) -> ::c_int2090     pub fn strncasecmp_l(
2091         string1: *const ::c_char,
2092         string2: *const ::c_char,
2093         length: ::size_t,
2094         locale: ::locale_t,
2095     ) -> ::c_int;
2096 }
2097 
2098 #[link(name = "bsd")]
2099 extern "C" {
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int2100     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int2101     pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
forkpty( amaster: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::pid_t2102     pub fn forkpty(
2103         amaster: *mut ::c_int,
2104         name: *mut ::c_char,
2105         termp: *mut termios,
2106         winp: *mut ::winsize,
2107     ) -> ::pid_t;
openpty( amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::c_int2108     pub fn openpty(
2109         amaster: *mut ::c_int,
2110         aslave: *mut ::c_int,
2111         name: *mut ::c_char,
2112         termp: *mut termios,
2113         winp: *mut ::winsize,
2114     ) -> ::c_int;
strsep(string: *mut *mut ::c_char, delimiters: *const ::c_char) -> *mut ::c_char2115     pub fn strsep(string: *mut *mut ::c_char, delimiters: *const ::c_char) -> *mut ::c_char;
explicit_bzero(buf: *mut ::c_void, len: ::size_t)2116     pub fn explicit_bzero(buf: *mut ::c_void, len: ::size_t);
login_tty(_fd: ::c_int) -> ::c_int2117     pub fn login_tty(_fd: ::c_int) -> ::c_int;
2118 
sl_init() -> *mut StringList2119     pub fn sl_init() -> *mut StringList;
sl_add(sl: *mut StringList, n: *mut ::c_char) -> ::c_int2120     pub fn sl_add(sl: *mut StringList, n: *mut ::c_char) -> ::c_int;
sl_free(sl: *mut StringList, i: ::c_int)2121     pub fn sl_free(sl: *mut StringList, i: ::c_int);
sl_find(sl: *mut StringList, n: *mut ::c_char) -> *mut ::c_char2122     pub fn sl_find(sl: *mut StringList, n: *mut ::c_char) -> *mut ::c_char;
2123 
getprogname() -> *const ::c_char2124     pub fn getprogname() -> *const ::c_char;
setprogname(progname: *const ::c_char)2125     pub fn setprogname(progname: *const ::c_char);
dl_iterate_phdr( callback: ::Option< unsafe extern "C" fn( info: *mut dl_phdr_info, size: usize, data: *mut ::c_void, ) -> ::c_int, >, data: *mut ::c_void, ) -> ::c_int2126     pub fn dl_iterate_phdr(
2127         callback: ::Option<
2128             unsafe extern "C" fn(
2129                 info: *mut dl_phdr_info,
2130                 size: usize,
2131                 data: *mut ::c_void,
2132             ) -> ::c_int,
2133         >,
2134         data: *mut ::c_void,
2135     ) -> ::c_int;
2136 
arc4random() -> u322137     pub fn arc4random() -> u32;
arc4random_uniform(upper_bound: u32) -> u322138     pub fn arc4random_uniform(upper_bound: u32) -> u32;
arc4random_buf(buf: *mut ::c_void, n: ::size_t)2139     pub fn arc4random_buf(buf: *mut ::c_void, n: ::size_t);
2140 }
2141 
2142 #[link(name = "gnu")]
2143 extern "C" {
memmem( source: *const ::c_void, sourceLength: ::size_t, search: *const ::c_void, searchLength: ::size_t, ) -> *mut ::c_void2144     pub fn memmem(
2145         source: *const ::c_void,
2146         sourceLength: ::size_t,
2147         search: *const ::c_void,
2148         searchLength: ::size_t,
2149     ) -> *mut ::c_void;
2150 
pthread_getattr_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int2151     pub fn pthread_getattr_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_getname_np( thread: ::pthread_t, buffer: *mut ::c_char, length: ::size_t, ) -> ::c_int2152     pub fn pthread_getname_np(
2153         thread: ::pthread_t,
2154         buffer: *mut ::c_char,
2155         length: ::size_t,
2156     ) -> ::c_int;
pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int2157     pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
2158 }
2159 
2160 cfg_if! {
2161     if #[cfg(target_pointer_width = "64")] {
2162         mod b64;
2163         pub use self::b64::*;
2164     } else {
2165         mod b32;
2166         pub use self::b32::*;
2167     }
2168 }
2169 
2170 cfg_if! {
2171     if #[cfg(target_arch = "x86")] {
2172         // TODO
2173         // mod x86;
2174         // pub use self::x86::*;
2175     } else if #[cfg(target_arch = "x86_64")] {
2176         mod x86_64;
2177         pub use self::x86_64::*;
2178     } else if #[cfg(target_arch = "aarch64")] {
2179         // TODO
2180         // mod aarch64;
2181         // pub use self::aarch64::*;
2182     }
2183 }
2184 
2185 mod native;
2186 pub use self::native::*;
2187