xref: /third_party/rust/crates/libc/src/unix/nto/mod.rs (revision 2add0d91)
1pub type clock_t = u32;
2
3pub type sa_family_t = u8;
4pub type speed_t = ::c_uint;
5pub type tcflag_t = ::c_uint;
6pub type clockid_t = ::c_int;
7pub type timer_t = ::c_int;
8pub type key_t = ::c_uint;
9pub type id_t = ::c_int;
10
11pub type useconds_t = u32;
12pub type dev_t = u32;
13pub type socklen_t = u32;
14pub type mode_t = u32;
15pub type rlim64_t = u64;
16pub type mqd_t = ::c_int;
17pub type nfds_t = ::c_uint;
18pub type idtype_t = ::c_uint;
19pub type errno_t = ::c_int;
20pub type rsize_t = c_ulong;
21
22pub type Elf32_Half = u16;
23pub type Elf32_Word = u32;
24pub type Elf32_Off = u32;
25pub type Elf32_Addr = u32;
26pub type Elf32_Lword = u64;
27pub type Elf32_Sword = i32;
28
29pub type Elf64_Half = u16;
30pub type Elf64_Word = u32;
31pub type Elf64_Off = u64;
32pub type Elf64_Addr = u64;
33pub type Elf64_Xword = u64;
34pub type Elf64_Sxword = i64;
35pub type Elf64_Lword = u64;
36pub type Elf64_Sword = i32;
37
38pub type Elf32_Section = u16;
39pub type Elf64_Section = u16;
40
41pub type _Time32t = u32;
42
43pub type pthread_t = ::c_int;
44pub type regoff_t = ::ssize_t;
45
46pub type nlink_t = u32;
47pub type blksize_t = u32;
48pub type suseconds_t = i32;
49
50pub type ino_t = u64;
51pub type off_t = i64;
52pub type blkcnt_t = u64;
53pub type msgqnum_t = u64;
54pub type msglen_t = u64;
55pub type fsblkcnt_t = u64;
56pub type fsfilcnt_t = u64;
57pub type rlim_t = u64;
58pub type posix_spawn_file_actions_t = *mut ::c_void;
59pub type posix_spawnattr_t = ::uintptr_t;
60
61pub type pthread_mutex_t = ::sync_t;
62pub type pthread_mutexattr_t = ::_sync_attr;
63pub type pthread_cond_t = ::sync_t;
64pub type pthread_condattr_t = ::_sync_attr;
65pub type pthread_rwlockattr_t = ::_sync_attr;
66pub type pthread_key_t = ::c_int;
67pub type pthread_spinlock_t = sync_t;
68pub type pthread_barrierattr_t = _sync_attr;
69pub type sem_t = sync_t;
70
71pub type nl_item = ::c_int;
72
73#[cfg_attr(feature = "extra_traits", derive(Debug))]
74pub enum timezone {}
75impl ::Copy for timezone {}
76impl ::Clone for timezone {
77    fn clone(&self) -> timezone {
78        *self
79    }
80}
81
82s! {
83    pub struct ip_mreq {
84        pub imr_multiaddr: in_addr,
85        pub imr_interface: in_addr,
86    }
87
88    #[repr(packed)]
89    pub struct in_addr {
90        pub s_addr: ::in_addr_t,
91    }
92
93    pub struct sockaddr {
94        pub sa_len: u8,
95        pub sa_family: sa_family_t,
96        pub sa_data: [::c_char; 14],
97    }
98
99    pub struct sockaddr_in {
100        pub sin_len: u8,
101        pub sin_family: sa_family_t,
102        pub sin_port: ::in_port_t,
103        pub sin_addr: ::in_addr,
104        pub sin_zero: [i8; 8],
105    }
106
107    pub struct sockaddr_in6 {
108        pub sin6_len: u8,
109        pub sin6_family: sa_family_t,
110        pub sin6_port: ::in_port_t,
111        pub sin6_flowinfo: u32,
112        pub sin6_addr: ::in6_addr,
113        pub sin6_scope_id: u32,
114    }
115
116    // The order of the `ai_addr` field in this struct is crucial
117    // for converting between the Rust and C types.
118    pub struct addrinfo {
119        pub ai_flags: ::c_int,
120        pub ai_family: ::c_int,
121        pub ai_socktype: ::c_int,
122        pub ai_protocol: ::c_int,
123        pub ai_addrlen: socklen_t,
124        pub ai_canonname: *mut c_char,
125        pub ai_addr: *mut ::sockaddr,
126        pub ai_next: *mut addrinfo,
127    }
128
129    pub struct fd_set {
130        fds_bits: [::c_uint; 2 * FD_SETSIZE / ULONG_SIZE],
131    }
132
133    pub struct tm {
134        pub tm_sec: ::c_int,
135        pub tm_min: ::c_int,
136        pub tm_hour: ::c_int,
137        pub tm_mday: ::c_int,
138        pub tm_mon: ::c_int,
139        pub tm_year: ::c_int,
140        pub tm_wday: ::c_int,
141        pub tm_yday: ::c_int,
142        pub tm_isdst: ::c_int,
143        pub tm_gmtoff: ::c_long,
144        pub tm_zone: *const ::c_char,
145    }
146
147    #[repr(align(8))]
148    pub struct sched_param {
149        pub sched_priority: ::c_int,
150        pub sched_curpriority: ::c_int,
151        pub reserved: [::c_int; 10],
152    }
153
154    #[repr(align(8))]
155    pub struct __sched_param {
156        pub __sched_priority: ::c_int,
157        pub __sched_curpriority: ::c_int,
158        pub reserved: [::c_int; 10],
159    }
160
161    pub struct Dl_info {
162        pub dli_fname: *const ::c_char,
163        pub dli_fbase: *mut ::c_void,
164        pub dli_sname: *const ::c_char,
165        pub dli_saddr: *mut ::c_void,
166    }
167
168    pub struct lconv {
169        pub currency_symbol: *mut ::c_char,
170        pub int_curr_symbol: *mut ::c_char,
171        pub mon_decimal_point: *mut ::c_char,
172        pub mon_grouping: *mut ::c_char,
173        pub mon_thousands_sep: *mut ::c_char,
174        pub negative_sign: *mut ::c_char,
175        pub positive_sign: *mut ::c_char,
176        pub frac_digits: ::c_char,
177        pub int_frac_digits: ::c_char,
178        pub n_cs_precedes: ::c_char,
179        pub n_sep_by_space: ::c_char,
180        pub n_sign_posn: ::c_char,
181        pub p_cs_precedes: ::c_char,
182        pub p_sep_by_space: ::c_char,
183        pub p_sign_posn: ::c_char,
184
185        pub int_n_cs_precedes: ::c_char,
186        pub int_n_sep_by_space: ::c_char,
187        pub int_n_sign_posn: ::c_char,
188        pub int_p_cs_precedes: ::c_char,
189        pub int_p_sep_by_space: ::c_char,
190        pub int_p_sign_posn: ::c_char,
191
192        pub decimal_point: *mut ::c_char,
193        pub grouping: *mut ::c_char,
194        pub thousands_sep: *mut ::c_char,
195
196        pub _Frac_grouping: *mut ::c_char,
197        pub _Frac_sep: *mut ::c_char,
198        pub _False: *mut ::c_char,
199        pub _True: *mut ::c_char,
200
201        pub _No: *mut ::c_char,
202        pub _Yes: *mut ::c_char,
203        pub _Nostr: *mut ::c_char,
204        pub _Yesstr: *mut ::c_char,
205        pub _Reserved: [*mut ::c_char; 8],
206        }
207
208    pub struct in_pktinfo {
209        pub ipi_addr: ::in_addr,
210        pub ipi_ifindex: ::c_uint,
211    }
212
213    pub struct ifaddrs {
214        pub ifa_next: *mut ifaddrs,
215        pub ifa_name: *mut c_char,
216        pub ifa_flags: ::c_uint,
217        pub ifa_addr: *mut ::sockaddr,
218        pub ifa_netmask: *mut ::sockaddr,
219        pub ifa_dstaddr: *mut ::sockaddr,
220        pub ifa_data: *mut ::c_void
221    }
222
223    pub struct arpreq {
224        pub arp_pa: ::sockaddr,
225        pub arp_ha: ::sockaddr,
226        pub arp_flags: ::c_int,
227    }
228
229    #[repr(packed)]
230    pub struct arphdr {
231        pub ar_hrd: u16,
232        pub ar_pro: u16,
233        pub ar_hln: u8,
234        pub ar_pln: u8,
235        pub ar_op: u16,
236    }
237
238    pub struct mmsghdr {
239        pub msg_hdr: ::msghdr,
240        pub msg_len: ::c_uint,
241    }
242
243    #[repr(align(8))]
244    pub struct siginfo_t {
245        pub si_signo: ::c_int,
246        pub si_code: ::c_int,
247        pub si_errno: ::c_int,
248        __data: [u8; 36], // union
249    }
250
251    pub struct sigaction {
252        pub sa_sigaction: ::sighandler_t,
253        pub sa_flags: ::c_int,
254        pub sa_mask: ::sigset_t,
255    }
256
257    pub struct _sync {
258        _union: ::c_uint,
259        __owner: ::c_uint,
260    }
261    pub struct rlimit64 {
262        pub rlim_cur: rlim64_t,
263        pub rlim_max: rlim64_t,
264    }
265
266    pub struct glob_t {
267        pub gl_pathc: ::size_t,
268        pub gl_matchc: ::c_int,
269        pub gl_pathv: *mut *mut c_char,
270        pub gl_offs: ::size_t,
271        pub gl_flags: ::c_int,
272        pub gl_errfunc: extern "C" fn(*const ::c_char, ::c_int) -> ::c_int,
273
274        __unused1: *mut ::c_void,
275        __unused2: *mut ::c_void,
276        __unused3: *mut ::c_void,
277        __unused4: *mut ::c_void,
278        __unused5: *mut ::c_void,
279    }
280
281    pub struct passwd {
282        pub pw_name: *mut ::c_char,
283        pub pw_passwd: *mut ::c_char,
284        pub pw_uid: ::uid_t,
285        pub pw_gid: ::gid_t,
286        pub pw_age: *mut ::c_char,
287        pub pw_comment: *mut ::c_char,
288        pub pw_gecos: *mut ::c_char,
289        pub pw_dir: *mut ::c_char,
290        pub pw_shell: *mut ::c_char,
291    }
292
293    pub struct if_nameindex {
294        pub if_index: ::c_uint,
295        pub if_name: *mut ::c_char,
296    }
297
298    pub struct sembuf {
299        pub sem_num: ::c_ushort,
300        pub sem_op: ::c_short,
301        pub sem_flg: ::c_short,
302    }
303
304    pub struct Elf32_Ehdr {
305        pub e_ident: [::c_uchar; 16],
306        pub e_type: Elf32_Half,
307        pub e_machine: Elf32_Half,
308        pub e_version: Elf32_Word,
309        pub e_entry: Elf32_Addr,
310        pub e_phoff: Elf32_Off,
311        pub e_shoff: Elf32_Off,
312        pub e_flags: Elf32_Word,
313        pub e_ehsize: Elf32_Half,
314        pub e_phentsize: Elf32_Half,
315        pub e_phnum: Elf32_Half,
316        pub e_shentsize: Elf32_Half,
317        pub e_shnum: Elf32_Half,
318        pub e_shstrndx: Elf32_Half,
319    }
320
321    pub struct Elf64_Ehdr {
322        pub e_ident: [::c_uchar; 16],
323        pub e_type: Elf64_Half,
324        pub e_machine: Elf64_Half,
325        pub e_version: Elf64_Word,
326        pub e_entry: Elf64_Addr,
327        pub e_phoff: Elf64_Off,
328        pub e_shoff: Elf64_Off,
329        pub e_flags: Elf64_Word,
330        pub e_ehsize: Elf64_Half,
331        pub e_phentsize: Elf64_Half,
332        pub e_phnum: Elf64_Half,
333        pub e_shentsize: Elf64_Half,
334        pub e_shnum: Elf64_Half,
335        pub e_shstrndx: Elf64_Half,
336    }
337
338    pub struct Elf32_Sym {
339        pub st_name: Elf32_Word,
340        pub st_value: Elf32_Addr,
341        pub st_size: Elf32_Word,
342        pub st_info: ::c_uchar,
343        pub st_other: ::c_uchar,
344        pub st_shndx: Elf32_Section,
345    }
346
347    pub struct Elf64_Sym {
348        pub st_name: Elf64_Word,
349        pub st_info: ::c_uchar,
350        pub st_other: ::c_uchar,
351        pub st_shndx: Elf64_Section,
352        pub st_value: Elf64_Addr,
353        pub st_size: Elf64_Xword,
354    }
355
356    pub struct Elf32_Phdr {
357        pub p_type: Elf32_Word,
358        pub p_offset: Elf32_Off,
359        pub p_vaddr: Elf32_Addr,
360        pub p_paddr: Elf32_Addr,
361        pub p_filesz: Elf32_Word,
362        pub p_memsz: Elf32_Word,
363        pub p_flags: Elf32_Word,
364        pub p_align: Elf32_Word,
365    }
366
367    pub struct Elf64_Phdr {
368        pub p_type: Elf64_Word,
369        pub p_flags: Elf64_Word,
370        pub p_offset: Elf64_Off,
371        pub p_vaddr: Elf64_Addr,
372        pub p_paddr: Elf64_Addr,
373        pub p_filesz: Elf64_Xword,
374        pub p_memsz: Elf64_Xword,
375        pub p_align: Elf64_Xword,
376    }
377
378    pub struct Elf32_Shdr {
379        pub sh_name: Elf32_Word,
380        pub sh_type: Elf32_Word,
381        pub sh_flags: Elf32_Word,
382        pub sh_addr: Elf32_Addr,
383        pub sh_offset: Elf32_Off,
384        pub sh_size: Elf32_Word,
385        pub sh_link: Elf32_Word,
386        pub sh_info: Elf32_Word,
387        pub sh_addralign: Elf32_Word,
388        pub sh_entsize: Elf32_Word,
389    }
390
391    pub struct Elf64_Shdr {
392        pub sh_name: Elf64_Word,
393        pub sh_type: Elf64_Word,
394        pub sh_flags: Elf64_Xword,
395        pub sh_addr: Elf64_Addr,
396        pub sh_offset: Elf64_Off,
397        pub sh_size: Elf64_Xword,
398        pub sh_link: Elf64_Word,
399        pub sh_info: Elf64_Word,
400        pub sh_addralign: Elf64_Xword,
401        pub sh_entsize: Elf64_Xword,
402    }
403
404    pub struct in6_pktinfo {
405        pub ipi6_addr: ::in6_addr,
406        pub ipi6_ifindex: ::c_uint,
407    }
408
409    pub struct inotify_event {
410        pub wd: ::c_int,
411        pub mask: u32,
412        pub cookie: u32,
413        pub len: u32
414    }
415
416    pub struct regmatch_t {
417        pub rm_so: regoff_t,
418        pub rm_eo: regoff_t,
419    }
420
421    pub struct msghdr {
422        pub msg_name: *mut ::c_void,
423        pub msg_namelen: ::socklen_t,
424        pub msg_iov: *mut ::iovec,
425        pub msg_iovlen: ::c_int,
426        pub msg_control: *mut ::c_void,
427        pub msg_controllen: ::socklen_t,
428        pub msg_flags: ::c_int,
429    }
430
431    pub struct cmsghdr {
432        pub cmsg_len: ::socklen_t,
433        pub cmsg_level: ::c_int,
434        pub cmsg_type: ::c_int,
435    }
436
437    pub struct termios {
438        pub c_iflag: ::tcflag_t,
439        pub c_oflag: ::tcflag_t,
440        pub c_cflag: ::tcflag_t,
441        pub c_lflag: ::tcflag_t,
442        pub c_cc: [::cc_t; ::NCCS],
443        __reserved: [::c_uint; 3],
444        pub c_ispeed: ::speed_t,
445        pub c_ospeed: ::speed_t,
446    }
447
448    pub struct mallinfo {
449        pub arena: ::c_int,
450        pub ordblks: ::c_int,
451        pub smblks: ::c_int,
452        pub hblks: ::c_int,
453        pub hblkhd: ::c_int,
454        pub usmblks: ::c_int,
455        pub fsmblks: ::c_int,
456        pub uordblks: ::c_int,
457        pub fordblks: ::c_int,
458        pub keepcost: ::c_int,
459    }
460
461    pub struct flock {
462        pub l_type: i16,
463        pub l_whence: i16,
464        pub l_zero1: i32,
465        pub l_start: ::off_t,
466        pub l_len: ::off_t,
467        pub l_pid: ::pid_t,
468        pub l_sysid: u32,
469    }
470
471    pub struct statvfs {
472        pub f_bsize: ::c_ulong,
473        pub f_frsize: ::c_ulong,
474        pub f_blocks: ::fsblkcnt_t,
475        pub f_bfree: ::fsblkcnt_t,
476        pub f_bavail: ::fsblkcnt_t,
477        pub f_files: ::fsfilcnt_t,
478        pub f_ffree: ::fsfilcnt_t,
479        pub f_favail: ::fsfilcnt_t,
480        pub f_fsid: ::c_ulong,
481        pub f_basetype: [::c_char; 16],
482        pub f_flag: ::c_ulong,
483        pub f_namemax: ::c_ulong,
484        f_filler: [::c_uint; 21],
485    }
486
487    pub struct aiocb {
488        pub aio_fildes: ::c_int,
489        pub aio_reqprio: ::c_int,
490        pub aio_offset: off_t,
491        pub aio_buf: *mut ::c_void,
492        pub aio_nbytes: ::size_t,
493        pub aio_sigevent: ::sigevent,
494        pub aio_lio_opcode: ::c_int,
495        pub _aio_lio_state: *mut ::c_void,
496        _aio_pad: [::c_int; 3],
497        pub _aio_next: *mut ::aiocb,
498        pub _aio_flag: ::c_uint,
499        pub _aio_iotype: ::c_uint,
500        pub _aio_result: ::ssize_t,
501        pub _aio_error: ::c_uint,
502        pub _aio_suspend: *mut ::c_void,
503        pub _aio_plist: *mut ::c_void,
504        pub _aio_policy: ::c_int,
505        pub _aio_param: ::__sched_param,
506    }
507
508    pub struct pthread_attr_t {
509        __data1: ::c_long,
510        __data2: [u8; 96]
511    }
512
513    pub struct ipc_perm {
514        pub uid: ::uid_t,
515        pub gid: ::gid_t,
516        pub cuid: ::uid_t,
517        pub cgid: ::gid_t,
518        pub mode: ::mode_t,
519        pub seq: ::c_uint,
520        pub key: ::key_t,
521        _reserved: [::c_int; 4],
522    }
523
524    pub struct regex_t {
525        re_magic: ::c_int,
526        re_nsub: ::size_t,
527        re_endp: *const ::c_char,
528        re_g: *mut ::c_void,
529    }
530
531    pub struct _thread_attr {
532        pub __flags: ::c_int,
533        pub __stacksize: ::size_t,
534        pub __stackaddr: *mut ::c_void,
535        pub __exitfunc: ::Option<unsafe extern "C" fn(_fake: *mut ::c_void)>,
536        pub __policy: ::c_int,
537        pub __param: ::__sched_param,
538        pub __guardsize: ::c_uint,
539        pub __prealloc: ::c_uint,
540        __spare: [::c_int; 2],
541    }
542
543    pub struct _sync_attr {
544        pub __protocol: ::c_int,
545        pub __flags: ::c_int,
546        pub __prioceiling: ::c_int,
547        pub __clockid: ::c_int,
548        pub __count: ::c_int,
549        __reserved: [::c_int; 3],
550    }
551
552    pub struct sockcred {
553        pub sc_uid: ::uid_t,
554        pub sc_euid: ::uid_t,
555        pub sc_gid: ::gid_t,
556        pub sc_egid: ::gid_t,
557        pub sc_ngroups: ::c_int,
558        pub sc_groups: [::gid_t; 1],
559    }
560
561    pub struct bpf_program {
562        pub bf_len: ::c_uint,
563        pub bf_insns: *mut ::bpf_insn,
564    }
565
566    pub struct bpf_stat {
567        pub bs_recv: u64,
568        pub bs_drop: u64,
569        pub bs_capt: u64,
570        bs_padding: [u64; 13],
571    }
572
573    pub struct bpf_version {
574        pub bv_major: ::c_ushort,
575        pub bv_minor: ::c_ushort,
576    }
577
578    pub struct bpf_hdr {
579        pub bh_tstamp: ::timeval,
580        pub bh_caplen: u32,
581        pub bh_datalen: u32,
582        pub bh_hdrlen: u16,
583    }
584
585    pub struct bpf_insn {
586        pub code: u16,
587        pub jt: ::c_uchar,
588        pub jf: ::c_uchar,
589        pub k: u32,
590    }
591
592    pub struct bpf_dltlist {
593        pub bfl_len: ::c_uint,
594        pub bfl_list: *mut ::c_uint,
595    }
596
597    pub struct unpcbid {
598        pub unp_pid: ::pid_t,
599        pub unp_euid: ::uid_t,
600        pub unp_egid: ::gid_t,
601    }
602
603    pub struct dl_phdr_info {
604        pub dlpi_addr: ::Elf64_Addr,
605        pub dlpi_name: *const ::c_char,
606        pub dlpi_phdr: *const ::Elf64_Phdr,
607        pub dlpi_phnum: ::Elf64_Half,
608    }
609
610    #[repr(align(8))]
611    pub struct ucontext_t {
612        pub uc_link: *mut ucontext_t,
613        pub uc_sigmask: ::sigset_t,
614        pub uc_stack: stack_t,
615        pub uc_mcontext: mcontext_t,
616    }
617}
618
619s_no_extra_traits! {
620    pub struct sockaddr_un {
621        pub sun_len: u8,
622        pub sun_family: sa_family_t,
623        pub sun_path: [::c_char; 104]
624    }
625
626    pub struct sockaddr_storage {
627        pub ss_len: u8,
628        pub ss_family: sa_family_t,
629        __ss_pad1: [::c_char; 6],
630        __ss_align: i64,
631        __ss_pad2: [::c_char; 112],
632    }
633
634    pub struct utsname {
635        pub sysname: [::c_char; _SYSNAME_SIZE],
636        pub nodename: [::c_char; _SYSNAME_SIZE],
637        pub release: [::c_char; _SYSNAME_SIZE],
638        pub version: [::c_char; _SYSNAME_SIZE],
639        pub machine: [::c_char; _SYSNAME_SIZE],
640    }
641
642    pub struct sigevent {
643        pub sigev_notify: ::c_int,
644        __sigev_un1: usize, // union
645        pub sigev_value: ::sigval,
646        __sigev_un2: usize, // union
647
648    }
649    pub struct dirent {
650        pub d_ino: ::ino_t,
651        pub d_offset: ::off_t,
652        pub d_reclen: ::c_short,
653        pub d_namelen: ::c_short,
654        pub d_name: [::c_char; 1], // flex array
655    }
656
657    pub struct dirent_extra {
658        pub d_datalen: u16,
659        pub d_type: u16,
660        pub d_reserved: u32,
661    }
662
663    pub struct stat {
664        pub st_ino: ::ino_t,
665        pub st_size: ::off_t,
666        pub st_dev: ::dev_t,
667        pub st_rdev: ::dev_t,
668        pub st_uid: ::uid_t,
669        pub st_gid: ::gid_t,
670        pub __old_st_mtime: ::_Time32t,
671        pub __old_st_atime: ::_Time32t,
672        pub __old_st_ctime: ::_Time32t,
673        pub st_mode: ::mode_t,
674        pub st_nlink: ::nlink_t,
675        pub st_blocksize: ::blksize_t,
676        pub st_nblocks: i32,
677        pub st_blksize: ::blksize_t,
678        pub st_blocks: ::blkcnt_t,
679        pub st_mtim:    ::timespec,
680        pub st_atim:    ::timespec,
681        pub st_ctim:    ::timespec,
682    }
683
684    pub struct sigset_t {
685        __val: [u32; 2],
686    }
687
688    pub struct mq_attr {
689        pub mq_maxmsg: ::c_long,
690        pub mq_msgsize: ::c_long,
691        pub mq_flags: ::c_long,
692        pub mq_curmsgs: ::c_long,
693        pub mq_sendwait: ::c_long,
694        pub mq_recvwait: ::c_long,
695    }
696
697    pub struct msg {
698        pub msg_next: *mut ::msg,
699        pub msg_type: ::c_long,
700        pub msg_ts: ::c_ushort,
701        pub msg_spot: ::c_short,
702        _pad: [u8; 4],
703    }
704
705    pub struct msqid_ds {
706        pub msg_perm: ::ipc_perm,
707        pub msg_first: *mut ::msg,
708        pub msg_last: *mut ::msg,
709        pub msg_cbytes: ::msglen_t,
710        pub msg_qnum: ::msgqnum_t,
711        pub msg_qbytes: ::msglen_t,
712        pub msg_lspid: ::pid_t,
713        pub msg_lrpid: ::pid_t,
714        pub msg_stime: ::time_t,
715        msg_pad1: ::c_long,
716        pub msg_rtime: ::time_t,
717        msg_pad2: ::c_long,
718        pub msg_ctime: ::time_t,
719        msg_pad3: ::c_long,
720        msg_pad4: [::c_long; 4],
721    }
722
723    pub struct sockaddr_dl {
724        pub sdl_len: ::c_uchar,
725        pub sdl_family: ::sa_family_t,
726        pub sdl_index: u16,
727        pub sdl_type: ::c_uchar,
728        pub sdl_nlen: ::c_uchar,
729        pub sdl_alen: ::c_uchar,
730        pub sdl_slen: ::c_uchar,
731        pub sdl_data: [::c_char; 12],
732    }
733
734    pub struct sync_t {
735        __u: ::c_uint,                     // union
736        pub __owner: ::c_uint,
737    }
738
739    #[repr(align(4))]
740    pub struct pthread_barrier_t {         // union
741        __pad: [u8; 28],                   // union
742    }
743
744    pub struct pthread_rwlock_t {
745        pub __active: ::c_int,
746        pub __blockedwriters: ::c_int,
747        pub __blockedreaders: ::c_int,
748        pub __heavy: ::c_int,
749        pub __lock: ::pthread_mutex_t,     // union
750        pub __rcond: ::pthread_cond_t,     // union
751        pub __wcond: ::pthread_cond_t,     // union
752        pub __owner: ::c_uint,
753        pub __spare: ::c_uint,
754    }
755}
756
757cfg_if! {
758    if #[cfg(feature = "extra_traits")] {
759        impl PartialEq for sockaddr_un {
760            fn eq(&self, other: &sockaddr_un) -> bool {
761                self.sun_len == other.sun_len
762                    && self.sun_family == other.sun_family
763                    && self
764                    .sun_path
765                    .iter()
766                    .zip(other.sun_path.iter())
767                    .all(|(a,b)| a == b)
768            }
769        }
770
771        impl Eq for sockaddr_un {}
772
773        impl ::fmt::Debug for sockaddr_un {
774            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
775                f.debug_struct("sockaddr_un")
776                    .field("sun_len", &self.sun_len)
777                    .field("sun_family", &self.sun_family)
778                    // FIXME: .field("sun_path", &self.sun_path)
779                    .finish()
780            }
781        }
782
783        impl ::hash::Hash for sockaddr_un {
784            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
785                self.sun_len.hash(state);
786                self.sun_family.hash(state);
787                self.sun_path.hash(state);
788            }
789        }
790
791        impl PartialEq for utsname {
792            fn eq(&self, other: &utsname) -> bool {
793                self.sysname
794                    .iter()
795                    .zip(other.sysname.iter())
796                    .all(|(a,b)| a == b)
797                    && self
798                    .nodename
799                    .iter()
800                    .zip(other.nodename.iter())
801                    .all(|(a,b)| a == b)
802                    && self
803                    .release
804                    .iter()
805                    .zip(other.release.iter())
806                    .all(|(a,b)| a == b)
807                    && self
808                    .version
809                    .iter()
810                    .zip(other.version.iter())
811                    .all(|(a,b)| a == b)
812                    && self
813                    .machine
814                    .iter()
815                    .zip(other.machine.iter())
816                    .all(|(a,b)| a == b)
817            }
818        }
819
820        impl Eq for utsname {}
821
822        impl ::fmt::Debug for utsname {
823            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
824                f.debug_struct("utsname")
825                // FIXME: .field("sysname", &self.sysname)
826                // FIXME: .field("nodename", &self.nodename)
827                // FIXME: .field("release", &self.release)
828                // FIXME: .field("version", &self.version)
829                // FIXME: .field("machine", &self.machine)
830                    .finish()
831            }
832        }
833
834        impl ::hash::Hash for utsname {
835            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
836                self.sysname.hash(state);
837                self.nodename.hash(state);
838                self.release.hash(state);
839                self.version.hash(state);
840                self.machine.hash(state);
841            }
842        }
843
844        impl PartialEq for mq_attr {
845            fn eq(&self, other: &mq_attr) -> bool {
846                self.mq_maxmsg == other.mq_maxmsg &&
847                self.mq_msgsize == other.mq_msgsize &&
848                self.mq_flags == other.mq_flags &&
849                self.mq_curmsgs == other.mq_curmsgs &&
850                self.mq_msgsize == other.mq_msgsize &&
851                self.mq_sendwait == other.mq_sendwait &&
852                self.mq_recvwait == other.mq_recvwait
853            }
854        }
855
856        impl Eq for mq_attr {}
857
858        impl ::fmt::Debug for mq_attr {
859            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
860                f.debug_struct("mq_attr")
861                    .field("mq_maxmsg", &self.mq_maxmsg)
862                    .field("mq_msgsize", &self.mq_msgsize)
863                    .field("mq_flags", &self.mq_flags)
864                    .field("mq_curmsgs", &self.mq_curmsgs)
865                    .field("mq_msgsize", &self.mq_msgsize)
866                    .field("mq_sendwait", &self.mq_sendwait)
867                    .field("mq_recvwait", &self.mq_recvwait)
868                    .finish()
869            }
870        }
871
872        impl PartialEq for sockaddr_storage {
873            fn eq(&self, other: &sockaddr_storage) -> bool {
874                self.ss_len == other.ss_len
875                    && self.ss_family == other.ss_family
876                    && self.__ss_pad1 == other.__ss_pad1
877                    && self.__ss_align == other.__ss_align
878                    && self
879                    .__ss_pad2
880                    .iter()
881                    .zip(other.__ss_pad2.iter())
882                    .all(|(a, b)| a == b)
883            }
884        }
885
886        impl Eq for sockaddr_storage {}
887
888        impl ::fmt::Debug for sockaddr_storage {
889            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
890                f.debug_struct("sockaddr_storage")
891                    .field("ss_len", &self.ss_len)
892                    .field("ss_family", &self.ss_family)
893                    .field("__ss_pad1", &self.__ss_pad1)
894                    .field("__ss_align", &self.__ss_align)
895                    // FIXME: .field("__ss_pad2", &self.__ss_pad2)
896                    .finish()
897            }
898        }
899
900        impl ::hash::Hash for sockaddr_storage {
901            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
902                self.ss_len.hash(state);
903                self.ss_family.hash(state);
904                self.__ss_pad1.hash(state);
905                self.__ss_align.hash(state);
906                self.__ss_pad2.hash(state);
907            }
908        }
909
910        impl PartialEq for dirent {
911            fn eq(&self, other: &dirent) -> bool {
912                self.d_ino == other.d_ino
913                    && self.d_offset == other.d_offset
914                    && self.d_reclen == other.d_reclen
915                    && self.d_namelen == other.d_namelen
916                    && self
917                    .d_name[..self.d_namelen as _]
918                    .iter()
919                    .zip(other.d_name.iter())
920                    .all(|(a,b)| a == b)
921            }
922        }
923
924        impl Eq for dirent {}
925
926        impl ::fmt::Debug for dirent {
927            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
928                f.debug_struct("dirent")
929                    .field("d_ino", &self.d_ino)
930                    .field("d_offset", &self.d_offset)
931                    .field("d_reclen", &self.d_reclen)
932                    .field("d_namelen", &self.d_namelen)
933                    .field("d_name", &&self.d_name[..self.d_namelen as _])
934                    .finish()
935            }
936        }
937
938        impl ::hash::Hash for dirent {
939            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
940                self.d_ino.hash(state);
941                self.d_offset.hash(state);
942                self.d_reclen.hash(state);
943                self.d_namelen.hash(state);
944                self.d_name[..self.d_namelen as _].hash(state);
945            }
946        }
947    }
948}
949
950pub const _SYSNAME_SIZE: usize = 256 + 1;
951pub const RLIM_INFINITY: ::rlim_t = 0xfffffffffffffffd;
952pub const O_LARGEFILE: ::c_int = 0o0100000;
953
954// intentionally not public, only used for fd_set
955cfg_if! {
956    if #[cfg(target_pointer_width = "32")] {
957        const ULONG_SIZE: usize = 32;
958    } else if #[cfg(target_pointer_width = "64")] {
959        const ULONG_SIZE: usize = 64;
960    } else {
961        // Unknown target_pointer_width
962    }
963}
964
965pub const EXIT_FAILURE: ::c_int = 1;
966pub const EXIT_SUCCESS: ::c_int = 0;
967pub const RAND_MAX: ::c_int = 32767;
968pub const EOF: ::c_int = -1;
969pub const SEEK_SET: ::c_int = 0;
970pub const SEEK_CUR: ::c_int = 1;
971pub const SEEK_END: ::c_int = 2;
972pub const _IOFBF: ::c_int = 0;
973pub const _IONBF: ::c_int = 2;
974pub const _IOLBF: ::c_int = 1;
975
976pub const F_DUPFD: ::c_int = 0;
977pub const F_GETFD: ::c_int = 1;
978pub const F_SETFD: ::c_int = 2;
979pub const F_GETFL: ::c_int = 3;
980pub const F_SETFL: ::c_int = 4;
981
982pub const F_DUPFD_CLOEXEC: ::c_int = 5;
983
984pub const SIGTRAP: ::c_int = 5;
985
986pub const CLOCK_REALTIME: ::clockid_t = 0;
987pub const CLOCK_MONOTONIC: ::clockid_t = 2;
988pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 3;
989pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 4;
990pub const TIMER_ABSTIME: ::c_uint = 0x80000000;
991
992pub const RUSAGE_SELF: ::c_int = 0;
993
994pub const F_OK: ::c_int = 0;
995pub const X_OK: ::c_int = 1;
996pub const W_OK: ::c_int = 2;
997pub const R_OK: ::c_int = 4;
998
999pub const STDIN_FILENO: ::c_int = 0;
1000pub const STDOUT_FILENO: ::c_int = 1;
1001pub const STDERR_FILENO: ::c_int = 2;
1002
1003pub const SIGHUP: ::c_int = 1;
1004pub const SIGINT: ::c_int = 2;
1005pub const SIGQUIT: ::c_int = 3;
1006pub const SIGILL: ::c_int = 4;
1007pub const SIGABRT: ::c_int = 6;
1008pub const SIGFPE: ::c_int = 8;
1009pub const SIGKILL: ::c_int = 9;
1010pub const SIGSEGV: ::c_int = 11;
1011pub const SIGPIPE: ::c_int = 13;
1012pub const SIGALRM: ::c_int = 14;
1013pub const SIGTERM: ::c_int = 15;
1014
1015pub const PROT_NONE: ::c_int = 0x00000000;
1016pub const PROT_READ: ::c_int = 0x00000100;
1017pub const PROT_WRITE: ::c_int = 0x00000200;
1018pub const PROT_EXEC: ::c_int = 0x00000400;
1019
1020pub const MAP_FILE: ::c_int = 0;
1021pub const MAP_SHARED: ::c_int = 1;
1022pub const MAP_PRIVATE: ::c_int = 2;
1023pub const MAP_FIXED: ::c_int = 0x10;
1024
1025pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
1026
1027pub const MS_ASYNC: ::c_int = 1;
1028pub const MS_INVALIDATE: ::c_int = 4;
1029pub const MS_SYNC: ::c_int = 2;
1030
1031pub const SCM_RIGHTS: ::c_int = 0x01;
1032pub const SCM_TIMESTAMP: ::c_int = 0x02;
1033pub const SCM_CREDS: ::c_int = 0x04;
1034
1035pub const MAP_TYPE: ::c_int = 0x3;
1036
1037pub const IFF_UP: ::c_int = 0x00000001;
1038pub const IFF_BROADCAST: ::c_int = 0x00000002;
1039pub const IFF_DEBUG: ::c_int = 0x00000004;
1040pub const IFF_LOOPBACK: ::c_int = 0x00000008;
1041pub const IFF_POINTOPOINT: ::c_int = 0x00000010;
1042pub const IFF_NOTRAILERS: ::c_int = 0x00000020;
1043pub const IFF_RUNNING: ::c_int = 0x00000040;
1044pub const IFF_NOARP: ::c_int = 0x00000080;
1045pub const IFF_PROMISC: ::c_int = 0x00000100;
1046pub const IFF_ALLMULTI: ::c_int = 0x00000200;
1047pub const IFF_MULTICAST: ::c_int = 0x00008000;
1048
1049pub const AF_UNSPEC: ::c_int = 0;
1050pub const AF_UNIX: ::c_int = AF_LOCAL;
1051pub const AF_LOCAL: ::c_int = 1;
1052pub const AF_INET: ::c_int = 2;
1053pub const AF_IPX: ::c_int = 23;
1054pub const AF_APPLETALK: ::c_int = 16;
1055pub const AF_INET6: ::c_int = 24;
1056pub const AF_ROUTE: ::c_int = 17;
1057pub const AF_SNA: ::c_int = 11;
1058pub const AF_BLUETOOTH: ::c_int = 31;
1059pub const AF_ISDN: ::c_int = 26;
1060
1061pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
1062pub const PF_UNIX: ::c_int = PF_LOCAL;
1063pub const PF_LOCAL: ::c_int = AF_LOCAL;
1064pub const PF_INET: ::c_int = AF_INET;
1065pub const PF_IPX: ::c_int = AF_IPX;
1066pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
1067pub const PF_INET6: ::c_int = AF_INET6;
1068pub const pseudo_AF_KEY: ::c_int = 29;
1069pub const PF_KEY: ::c_int = pseudo_AF_KEY;
1070pub const PF_ROUTE: ::c_int = AF_ROUTE;
1071pub const PF_SNA: ::c_int = AF_SNA;
1072
1073pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1074pub const PF_ISDN: ::c_int = AF_ISDN;
1075
1076pub const SOMAXCONN: ::c_int = 128;
1077
1078pub const MSG_OOB: ::c_int = 0x0001;
1079pub const MSG_PEEK: ::c_int = 0x0002;
1080pub const MSG_DONTROUTE: ::c_int = 0x0004;
1081pub const MSG_CTRUNC: ::c_int = 0x0020;
1082pub const MSG_TRUNC: ::c_int = 0x0010;
1083pub const MSG_DONTWAIT: ::c_int = 0x0080;
1084pub const MSG_EOR: ::c_int = 0x0008;
1085pub const MSG_WAITALL: ::c_int = 0x0040;
1086pub const MSG_NOSIGNAL: ::c_int = 0x0800;
1087pub const MSG_WAITFORONE: ::c_int = 0x2000;
1088
1089pub const IP_TOS: ::c_int = 3;
1090pub const IP_TTL: ::c_int = 4;
1091pub const IP_HDRINCL: ::c_int = 2;
1092pub const IP_OPTIONS: ::c_int = 1;
1093pub const IP_RECVOPTS: ::c_int = 5;
1094pub const IP_RETOPTS: ::c_int = 8;
1095pub const IP_PKTINFO: ::c_int = 25;
1096pub const IP_IPSEC_POLICY_COMPAT: ::c_int = 22;
1097pub const IP_MULTICAST_IF: ::c_int = 9;
1098pub const IP_MULTICAST_TTL: ::c_int = 10;
1099pub const IP_MULTICAST_LOOP: ::c_int = 11;
1100pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
1101pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
1102pub const IP_DEFAULT_MULTICAST_TTL: ::c_int = 1;
1103pub const IP_DEFAULT_MULTICAST_LOOP: ::c_int = 1;
1104
1105pub const IPPROTO_HOPOPTS: ::c_int = 0;
1106pub const IPPROTO_IGMP: ::c_int = 2;
1107pub const IPPROTO_IPIP: ::c_int = 4;
1108pub const IPPROTO_EGP: ::c_int = 8;
1109pub const IPPROTO_PUP: ::c_int = 12;
1110pub const IPPROTO_IDP: ::c_int = 22;
1111pub const IPPROTO_TP: ::c_int = 29;
1112pub const IPPROTO_ROUTING: ::c_int = 43;
1113pub const IPPROTO_FRAGMENT: ::c_int = 44;
1114pub const IPPROTO_RSVP: ::c_int = 46;
1115pub const IPPROTO_GRE: ::c_int = 47;
1116pub const IPPROTO_ESP: ::c_int = 50;
1117pub const IPPROTO_AH: ::c_int = 51;
1118pub const IPPROTO_NONE: ::c_int = 59;
1119pub const IPPROTO_DSTOPTS: ::c_int = 60;
1120pub const IPPROTO_ENCAP: ::c_int = 98;
1121pub const IPPROTO_PIM: ::c_int = 103;
1122pub const IPPROTO_SCTP: ::c_int = 132;
1123pub const IPPROTO_RAW: ::c_int = 255;
1124pub const IPPROTO_MAX: ::c_int = 256;
1125pub const IPPROTO_CARP: ::c_int = 112;
1126pub const IPPROTO_DIVERT: ::c_int = 259;
1127pub const IPPROTO_DONE: ::c_int = 257;
1128pub const IPPROTO_EON: ::c_int = 80;
1129pub const IPPROTO_ETHERIP: ::c_int = 97;
1130pub const IPPROTO_GGP: ::c_int = 3;
1131pub const IPPROTO_IPCOMP: ::c_int = 108;
1132pub const IPPROTO_MOBILE: ::c_int = 55;
1133
1134pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
1135pub const IPV6_RTHDR_STRICT: ::c_int = 1;
1136pub const IPV6_UNICAST_HOPS: ::c_int = 4;
1137pub const IPV6_MULTICAST_IF: ::c_int = 9;
1138pub const IPV6_MULTICAST_HOPS: ::c_int = 10;
1139pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
1140pub const IPV6_JOIN_GROUP: ::c_int = 12;
1141pub const IPV6_LEAVE_GROUP: ::c_int = 13;
1142pub const IPV6_CHECKSUM: ::c_int = 26;
1143pub const IPV6_V6ONLY: ::c_int = 27;
1144pub const IPV6_IPSEC_POLICY_COMPAT: ::c_int = 28;
1145pub const IPV6_RTHDRDSTOPTS: ::c_int = 35;
1146pub const IPV6_RECVPKTINFO: ::c_int = 36;
1147pub const IPV6_RECVHOPLIMIT: ::c_int = 37;
1148pub const IPV6_RECVRTHDR: ::c_int = 38;
1149pub const IPV6_RECVHOPOPTS: ::c_int = 39;
1150pub const IPV6_RECVDSTOPTS: ::c_int = 40;
1151pub const IPV6_RECVPATHMTU: ::c_int = 43;
1152pub const IPV6_PATHMTU: ::c_int = 44;
1153pub const IPV6_PKTINFO: ::c_int = 46;
1154pub const IPV6_HOPLIMIT: ::c_int = 47;
1155pub const IPV6_NEXTHOP: ::c_int = 48;
1156pub const IPV6_HOPOPTS: ::c_int = 49;
1157pub const IPV6_DSTOPTS: ::c_int = 50;
1158pub const IPV6_RECVTCLASS: ::c_int = 57;
1159pub const IPV6_TCLASS: ::c_int = 61;
1160pub const IPV6_DONTFRAG: ::c_int = 62;
1161
1162pub const TCP_NODELAY: ::c_int = 0x01;
1163pub const TCP_MAXSEG: ::c_int = 0x02;
1164pub const TCP_MD5SIG: ::c_int = 0x10;
1165pub const TCP_KEEPALIVE: ::c_int = 0x04;
1166
1167pub const SHUT_RD: ::c_int = 0;
1168pub const SHUT_WR: ::c_int = 1;
1169pub const SHUT_RDWR: ::c_int = 2;
1170
1171pub const LOCK_SH: ::c_int = 0x1;
1172pub const LOCK_EX: ::c_int = 0x2;
1173pub const LOCK_NB: ::c_int = 0x4;
1174pub const LOCK_UN: ::c_int = 0x8;
1175
1176pub const SS_ONSTACK: ::c_int = 1;
1177pub const SS_DISABLE: ::c_int = 2;
1178
1179pub const PATH_MAX: ::c_int = 1024;
1180
1181pub const UIO_MAXIOV: ::c_int = 1024;
1182
1183pub const FD_SETSIZE: usize = 256;
1184
1185pub const TCIOFF: ::c_int = 0x0002;
1186pub const TCION: ::c_int = 0x0003;
1187pub const TCOOFF: ::c_int = 0x0000;
1188pub const TCOON: ::c_int = 0x0001;
1189pub const TCIFLUSH: ::c_int = 0;
1190pub const TCOFLUSH: ::c_int = 1;
1191pub const TCIOFLUSH: ::c_int = 2;
1192pub const NL0: ::tcflag_t = 0x000;
1193pub const NL1: ::tcflag_t = 0x100;
1194pub const TAB0: ::tcflag_t = 0x0000;
1195pub const CR0: ::tcflag_t = 0x000;
1196pub const FF0: ::tcflag_t = 0x0000;
1197pub const BS0: ::tcflag_t = 0x0000;
1198pub const VT0: ::tcflag_t = 0x0000;
1199pub const VERASE: usize = 2;
1200pub const VKILL: usize = 3;
1201pub const VINTR: usize = 0;
1202pub const VQUIT: usize = 1;
1203pub const VLNEXT: usize = 15;
1204pub const IGNBRK: ::tcflag_t = 0x00000001;
1205pub const BRKINT: ::tcflag_t = 0x00000002;
1206pub const IGNPAR: ::tcflag_t = 0x00000004;
1207pub const PARMRK: ::tcflag_t = 0x00000008;
1208pub const INPCK: ::tcflag_t = 0x00000010;
1209pub const ISTRIP: ::tcflag_t = 0x00000020;
1210pub const INLCR: ::tcflag_t = 0x00000040;
1211pub const IGNCR: ::tcflag_t = 0x00000080;
1212pub const ICRNL: ::tcflag_t = 0x00000100;
1213pub const IXANY: ::tcflag_t = 0x00000800;
1214pub const IMAXBEL: ::tcflag_t = 0x00002000;
1215pub const OPOST: ::tcflag_t = 0x00000001;
1216pub const CS5: ::tcflag_t = 0x00;
1217pub const ECHO: ::tcflag_t = 0x00000008;
1218pub const OCRNL: ::tcflag_t = 0x00000008;
1219pub const ONOCR: ::tcflag_t = 0x00000010;
1220pub const ONLRET: ::tcflag_t = 0x00000020;
1221pub const OFILL: ::tcflag_t = 0x00000040;
1222pub const OFDEL: ::tcflag_t = 0x00000080;
1223
1224pub const WNOHANG: ::c_int = 0x0040;
1225pub const WUNTRACED: ::c_int = 0x0004;
1226pub const WSTOPPED: ::c_int = WUNTRACED;
1227pub const WEXITED: ::c_int = 0x0001;
1228pub const WCONTINUED: ::c_int = 0x0008;
1229pub const WNOWAIT: ::c_int = 0x0080;
1230pub const WTRAPPED: ::c_int = 0x0002;
1231
1232pub const RTLD_LOCAL: ::c_int = 0x0200;
1233pub const RTLD_LAZY: ::c_int = 0x0001;
1234
1235pub const POSIX_FADV_NORMAL: ::c_int = 0;
1236pub const POSIX_FADV_RANDOM: ::c_int = 2;
1237pub const POSIX_FADV_SEQUENTIAL: ::c_int = 1;
1238pub const POSIX_FADV_WILLNEED: ::c_int = 3;
1239
1240pub const AT_FDCWD: ::c_int = -100;
1241pub const AT_EACCESS: ::c_int = 0x0001;
1242pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0002;
1243pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0004;
1244pub const AT_REMOVEDIR: ::c_int = 0x0008;
1245
1246pub const LOG_CRON: ::c_int = 9 << 3;
1247pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
1248pub const LOG_FTP: ::c_int = 11 << 3;
1249pub const LOG_PERROR: ::c_int = 0x20;
1250
1251pub const PIPE_BUF: usize = 5120;
1252
1253pub const CLD_EXITED: ::c_int = 1;
1254pub const CLD_KILLED: ::c_int = 2;
1255pub const CLD_DUMPED: ::c_int = 3;
1256pub const CLD_TRAPPED: ::c_int = 4;
1257pub const CLD_STOPPED: ::c_int = 5;
1258pub const CLD_CONTINUED: ::c_int = 6;
1259
1260pub const UTIME_OMIT: c_long = 0x40000002;
1261pub const UTIME_NOW: c_long = 0x40000001;
1262
1263pub const POLLIN: ::c_short = POLLRDNORM | POLLRDBAND;
1264pub const POLLPRI: ::c_short = 0x0008;
1265pub const POLLOUT: ::c_short = 0x0002;
1266pub const POLLERR: ::c_short = 0x0020;
1267pub const POLLHUP: ::c_short = 0x0040;
1268pub const POLLNVAL: ::c_short = 0x1000;
1269pub const POLLRDNORM: ::c_short = 0x0001;
1270pub const POLLRDBAND: ::c_short = 0x0004;
1271
1272pub const IPTOS_LOWDELAY: u8 = 0x10;
1273pub const IPTOS_THROUGHPUT: u8 = 0x08;
1274pub const IPTOS_RELIABILITY: u8 = 0x04;
1275pub const IPTOS_MINCOST: u8 = 0x02;
1276
1277pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0;
1278pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0;
1279pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0;
1280pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80;
1281pub const IPTOS_PREC_FLASH: u8 = 0x60;
1282pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40;
1283pub const IPTOS_PREC_PRIORITY: u8 = 0x20;
1284pub const IPTOS_PREC_ROUTINE: u8 = 0x00;
1285
1286pub const IPTOS_ECN_MASK: u8 = 0x03;
1287pub const IPTOS_ECN_ECT1: u8 = 0x01;
1288pub const IPTOS_ECN_ECT0: u8 = 0x02;
1289pub const IPTOS_ECN_CE: u8 = 0x03;
1290
1291pub const IPOPT_CONTROL: u8 = 0x00;
1292pub const IPOPT_RESERVED1: u8 = 0x20;
1293pub const IPOPT_RESERVED2: u8 = 0x60;
1294pub const IPOPT_LSRR: u8 = 131;
1295pub const IPOPT_RR: u8 = 7;
1296pub const IPOPT_SSRR: u8 = 137;
1297pub const IPDEFTTL: u8 = 64;
1298pub const IPOPT_OPTVAL: u8 = 0;
1299pub const IPOPT_OLEN: u8 = 1;
1300pub const IPOPT_OFFSET: u8 = 2;
1301pub const IPOPT_MINOFF: u8 = 4;
1302pub const IPOPT_NOP: u8 = 1;
1303pub const IPOPT_EOL: u8 = 0;
1304pub const IPOPT_TS: u8 = 68;
1305pub const IPOPT_TS_TSONLY: u8 = 0;
1306pub const IPOPT_TS_TSANDADDR: u8 = 1;
1307pub const IPOPT_TS_PRESPEC: u8 = 3;
1308
1309pub const MAX_IPOPTLEN: u8 = 40;
1310pub const IPVERSION: u8 = 4;
1311pub const MAXTTL: u8 = 255;
1312
1313pub const ARPHRD_ETHER: u16 = 1;
1314pub const ARPHRD_IEEE802: u16 = 6;
1315pub const ARPHRD_ARCNET: u16 = 7;
1316pub const ARPHRD_IEEE1394: u16 = 24;
1317
1318pub const SOL_SOCKET: ::c_int = 0xffff;
1319
1320pub const SO_DEBUG: ::c_int = 0x0001;
1321pub const SO_REUSEADDR: ::c_int = 0x0004;
1322pub const SO_TYPE: ::c_int = 0x1008;
1323pub const SO_ERROR: ::c_int = 0x1007;
1324pub const SO_DONTROUTE: ::c_int = 0x0010;
1325pub const SO_BROADCAST: ::c_int = 0x0020;
1326pub const SO_SNDBUF: ::c_int = 0x1001;
1327pub const SO_RCVBUF: ::c_int = 0x1002;
1328pub const SO_KEEPALIVE: ::c_int = 0x0008;
1329pub const SO_OOBINLINE: ::c_int = 0x0100;
1330pub const SO_LINGER: ::c_int = 0x0080;
1331pub const SO_REUSEPORT: ::c_int = 0x0200;
1332pub const SO_RCVLOWAT: ::c_int = 0x1004;
1333pub const SO_SNDLOWAT: ::c_int = 0x1003;
1334pub const SO_RCVTIMEO: ::c_int = 0x1006;
1335pub const SO_SNDTIMEO: ::c_int = 0x1005;
1336pub const SO_BINDTODEVICE: ::c_int = 0x0800;
1337pub const SO_TIMESTAMP: ::c_int = 0x0400;
1338pub const SO_ACCEPTCONN: ::c_int = 0x0002;
1339
1340pub const TIOCM_LE: ::c_int = 0x0100;
1341pub const TIOCM_DTR: ::c_int = 0x0001;
1342pub const TIOCM_RTS: ::c_int = 0x0002;
1343pub const TIOCM_ST: ::c_int = 0x0200;
1344pub const TIOCM_SR: ::c_int = 0x0400;
1345pub const TIOCM_CTS: ::c_int = 0x1000;
1346pub const TIOCM_CAR: ::c_int = TIOCM_CD;
1347pub const TIOCM_CD: ::c_int = 0x8000;
1348pub const TIOCM_RNG: ::c_int = TIOCM_RI;
1349pub const TIOCM_RI: ::c_int = 0x4000;
1350pub const TIOCM_DSR: ::c_int = 0x2000;
1351
1352pub const SCHED_OTHER: ::c_int = 3;
1353pub const SCHED_FIFO: ::c_int = 1;
1354pub const SCHED_RR: ::c_int = 2;
1355
1356pub const IPC_PRIVATE: ::key_t = 0;
1357
1358pub const IPC_CREAT: ::c_int = 0o001000;
1359pub const IPC_EXCL: ::c_int = 0o002000;
1360pub const IPC_NOWAIT: ::c_int = 0o004000;
1361
1362pub const IPC_RMID: ::c_int = 0;
1363pub const IPC_SET: ::c_int = 1;
1364pub const IPC_STAT: ::c_int = 2;
1365
1366pub const MSG_NOERROR: ::c_int = 0o010000;
1367
1368pub const LOG_NFACILITIES: ::c_int = 24;
1369
1370pub const SEM_FAILED: *mut ::sem_t = 0xFFFFFFFFFFFFFFFF as *mut sem_t;
1371
1372pub const AI_PASSIVE: ::c_int = 0x00000001;
1373pub const AI_CANONNAME: ::c_int = 0x00000002;
1374pub const AI_NUMERICHOST: ::c_int = 0x00000004;
1375
1376pub const AI_NUMERICSERV: ::c_int = 0x00000008;
1377
1378pub const EAI_BADFLAGS: ::c_int = 3;
1379pub const EAI_NONAME: ::c_int = 8;
1380pub const EAI_AGAIN: ::c_int = 2;
1381pub const EAI_FAIL: ::c_int = 4;
1382pub const EAI_NODATA: ::c_int = 7;
1383pub const EAI_FAMILY: ::c_int = 5;
1384pub const EAI_SOCKTYPE: ::c_int = 10;
1385pub const EAI_SERVICE: ::c_int = 9;
1386pub const EAI_MEMORY: ::c_int = 6;
1387pub const EAI_SYSTEM: ::c_int = 11;
1388pub const EAI_OVERFLOW: ::c_int = 14;
1389
1390pub const NI_NUMERICHOST: ::c_int = 0x00000002;
1391pub const NI_NUMERICSERV: ::c_int = 0x00000008;
1392pub const NI_NOFQDN: ::c_int = 0x00000001;
1393pub const NI_NAMEREQD: ::c_int = 0x00000004;
1394pub const NI_DGRAM: ::c_int = 0x00000010;
1395
1396pub const AIO_CANCELED: ::c_int = 0;
1397pub const AIO_NOTCANCELED: ::c_int = 2;
1398pub const AIO_ALLDONE: ::c_int = 1;
1399pub const LIO_READ: ::c_int = 1;
1400pub const LIO_WRITE: ::c_int = 2;
1401pub const LIO_NOP: ::c_int = 0;
1402pub const LIO_WAIT: ::c_int = 1;
1403pub const LIO_NOWAIT: ::c_int = 0;
1404
1405pub const ITIMER_REAL: ::c_int = 0;
1406pub const ITIMER_VIRTUAL: ::c_int = 1;
1407pub const ITIMER_PROF: ::c_int = 2;
1408
1409pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x00000010;
1410pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x00000001;
1411pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x00000004;
1412pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x00000002;
1413pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x00000400;
1414pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x00000040;
1415
1416pub const IPTOS_ECN_NOT_ECT: u8 = 0x00;
1417
1418pub const RTF_UP: ::c_ushort = 0x0001;
1419pub const RTF_GATEWAY: ::c_ushort = 0x0002;
1420
1421pub const RTF_HOST: ::c_ushort = 0x0004;
1422pub const RTF_DYNAMIC: ::c_ushort = 0x0010;
1423pub const RTF_MODIFIED: ::c_ushort = 0x0020;
1424pub const RTF_REJECT: ::c_ushort = 0x0008;
1425pub const RTF_STATIC: ::c_ushort = 0x0800;
1426pub const RTF_XRESOLVE: ::c_ushort = 0x0200;
1427pub const RTF_BROADCAST: u32 = 0x80000;
1428pub const RTM_NEWADDR: u16 = 0xc;
1429pub const RTM_DELADDR: u16 = 0xd;
1430pub const RTA_DST: ::c_ushort = 0x1;
1431pub const RTA_GATEWAY: ::c_ushort = 0x2;
1432
1433pub const UDP_ENCAP: ::c_int = 100;
1434
1435pub const IN_ACCESS: u32 = 0x00000001;
1436pub const IN_MODIFY: u32 = 0x00000002;
1437pub const IN_ATTRIB: u32 = 0x00000004;
1438pub const IN_CLOSE_WRITE: u32 = 0x00000008;
1439pub const IN_CLOSE_NOWRITE: u32 = 0x00000010;
1440pub const IN_CLOSE: u32 = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE;
1441pub const IN_OPEN: u32 = 0x00000020;
1442pub const IN_MOVED_FROM: u32 = 0x00000040;
1443pub const IN_MOVED_TO: u32 = 0x00000080;
1444pub const IN_MOVE: u32 = IN_MOVED_FROM | IN_MOVED_TO;
1445pub const IN_CREATE: u32 = 0x00000100;
1446pub const IN_DELETE: u32 = 0x00000200;
1447pub const IN_DELETE_SELF: u32 = 0x00000400;
1448pub const IN_MOVE_SELF: u32 = 0x00000800;
1449pub const IN_UNMOUNT: u32 = 0x00002000;
1450pub const IN_Q_OVERFLOW: u32 = 0x00004000;
1451pub const IN_IGNORED: u32 = 0x00008000;
1452pub const IN_ONLYDIR: u32 = 0x01000000;
1453pub const IN_DONT_FOLLOW: u32 = 0x02000000;
1454
1455pub const IN_ISDIR: u32 = 0x40000000;
1456pub const IN_ONESHOT: u32 = 0x80000000;
1457
1458pub const REG_EXTENDED: ::c_int = 0o0001;
1459pub const REG_ICASE: ::c_int = 0o0002;
1460pub const REG_NEWLINE: ::c_int = 0o0010;
1461pub const REG_NOSUB: ::c_int = 0o0004;
1462
1463pub const REG_NOTBOL: ::c_int = 0o00001;
1464pub const REG_NOTEOL: ::c_int = 0o00002;
1465
1466pub const REG_ENOSYS: ::c_int = 17;
1467pub const REG_NOMATCH: ::c_int = 1;
1468pub const REG_BADPAT: ::c_int = 2;
1469pub const REG_ECOLLATE: ::c_int = 3;
1470pub const REG_ECTYPE: ::c_int = 4;
1471pub const REG_EESCAPE: ::c_int = 5;
1472pub const REG_ESUBREG: ::c_int = 6;
1473pub const REG_EBRACK: ::c_int = 7;
1474pub const REG_EPAREN: ::c_int = 8;
1475pub const REG_EBRACE: ::c_int = 9;
1476pub const REG_BADBR: ::c_int = 10;
1477pub const REG_ERANGE: ::c_int = 11;
1478pub const REG_ESPACE: ::c_int = 12;
1479pub const REG_BADRPT: ::c_int = 13;
1480
1481// errno.h
1482pub const EOK: ::c_int = 0;
1483pub const EWOULDBLOCK: ::c_int = EAGAIN;
1484pub const EPERM: ::c_int = 1;
1485pub const ENOENT: ::c_int = 2;
1486pub const ESRCH: ::c_int = 3;
1487pub const EINTR: ::c_int = 4;
1488pub const EIO: ::c_int = 5;
1489pub const ENXIO: ::c_int = 6;
1490pub const E2BIG: ::c_int = 7;
1491pub const ENOEXEC: ::c_int = 8;
1492pub const EBADF: ::c_int = 9;
1493pub const ECHILD: ::c_int = 10;
1494pub const EAGAIN: ::c_int = 11;
1495pub const ENOMEM: ::c_int = 12;
1496pub const EACCES: ::c_int = 13;
1497pub const EFAULT: ::c_int = 14;
1498pub const ENOTBLK: ::c_int = 15;
1499pub const EBUSY: ::c_int = 16;
1500pub const EEXIST: ::c_int = 17;
1501pub const EXDEV: ::c_int = 18;
1502pub const ENODEV: ::c_int = 19;
1503pub const ENOTDIR: ::c_int = 20;
1504pub const EISDIR: ::c_int = 21;
1505pub const EINVAL: ::c_int = 22;
1506pub const ENFILE: ::c_int = 23;
1507pub const EMFILE: ::c_int = 24;
1508pub const ENOTTY: ::c_int = 25;
1509pub const ETXTBSY: ::c_int = 26;
1510pub const EFBIG: ::c_int = 27;
1511pub const ENOSPC: ::c_int = 28;
1512pub const ESPIPE: ::c_int = 29;
1513pub const EROFS: ::c_int = 30;
1514pub const EMLINK: ::c_int = 31;
1515pub const EPIPE: ::c_int = 32;
1516pub const EDOM: ::c_int = 33;
1517pub const ERANGE: ::c_int = 34;
1518pub const ENOMSG: ::c_int = 35;
1519pub const EIDRM: ::c_int = 36;
1520pub const ECHRNG: ::c_int = 37;
1521pub const EL2NSYNC: ::c_int = 38;
1522pub const EL3HLT: ::c_int = 39;
1523pub const EL3RST: ::c_int = 40;
1524pub const ELNRNG: ::c_int = 41;
1525pub const EUNATCH: ::c_int = 42;
1526pub const ENOCSI: ::c_int = 43;
1527pub const EL2HLT: ::c_int = 44;
1528pub const EDEADLK: ::c_int = 45;
1529pub const ENOLCK: ::c_int = 46;
1530pub const ECANCELED: ::c_int = 47;
1531pub const EDQUOT: ::c_int = 49;
1532pub const EBADE: ::c_int = 50;
1533pub const EBADR: ::c_int = 51;
1534pub const EXFULL: ::c_int = 52;
1535pub const ENOANO: ::c_int = 53;
1536pub const EBADRQC: ::c_int = 54;
1537pub const EBADSLT: ::c_int = 55;
1538pub const EDEADLOCK: ::c_int = 56;
1539pub const EBFONT: ::c_int = 57;
1540pub const EOWNERDEAD: ::c_int = 58;
1541pub const ENOSTR: ::c_int = 60;
1542pub const ENODATA: ::c_int = 61;
1543pub const ETIME: ::c_int = 62;
1544pub const ENOSR: ::c_int = 63;
1545pub const ENONET: ::c_int = 64;
1546pub const ENOPKG: ::c_int = 65;
1547pub const EREMOTE: ::c_int = 66;
1548pub const ENOLINK: ::c_int = 67;
1549pub const EADV: ::c_int = 68;
1550pub const ESRMNT: ::c_int = 69;
1551pub const ECOMM: ::c_int = 70;
1552pub const EPROTO: ::c_int = 71;
1553pub const EMULTIHOP: ::c_int = 74;
1554pub const EBADMSG: ::c_int = 77;
1555pub const ENAMETOOLONG: ::c_int = 78;
1556pub const EOVERFLOW: ::c_int = 79;
1557pub const ENOTUNIQ: ::c_int = 80;
1558pub const EBADFD: ::c_int = 81;
1559pub const EREMCHG: ::c_int = 82;
1560pub const ELIBACC: ::c_int = 83;
1561pub const ELIBBAD: ::c_int = 84;
1562pub const ELIBSCN: ::c_int = 85;
1563pub const ELIBMAX: ::c_int = 86;
1564pub const ELIBEXEC: ::c_int = 87;
1565pub const EILSEQ: ::c_int = 88;
1566pub const ENOSYS: ::c_int = 89;
1567pub const ELOOP: ::c_int = 90;
1568pub const ERESTART: ::c_int = 91;
1569pub const ESTRPIPE: ::c_int = 92;
1570pub const ENOTEMPTY: ::c_int = 93;
1571pub const EUSERS: ::c_int = 94;
1572pub const ENOTRECOVERABLE: ::c_int = 95;
1573pub const EOPNOTSUPP: ::c_int = 103;
1574pub const EFPOS: ::c_int = 110;
1575pub const ESTALE: ::c_int = 122;
1576pub const EINPROGRESS: ::c_int = 236;
1577pub const EALREADY: ::c_int = 237;
1578pub const ENOTSOCK: ::c_int = 238;
1579pub const EDESTADDRREQ: ::c_int = 239;
1580pub const EMSGSIZE: ::c_int = 240;
1581pub const EPROTOTYPE: ::c_int = 241;
1582pub const ENOPROTOOPT: ::c_int = 242;
1583pub const EPROTONOSUPPORT: ::c_int = 243;
1584pub const ESOCKTNOSUPPORT: ::c_int = 244;
1585pub const EPFNOSUPPORT: ::c_int = 246;
1586pub const EAFNOSUPPORT: ::c_int = 247;
1587pub const EADDRINUSE: ::c_int = 248;
1588pub const EADDRNOTAVAIL: ::c_int = 249;
1589pub const ENETDOWN: ::c_int = 250;
1590pub const ENETUNREACH: ::c_int = 251;
1591pub const ENETRESET: ::c_int = 252;
1592pub const ECONNABORTED: ::c_int = 253;
1593pub const ECONNRESET: ::c_int = 254;
1594pub const ENOBUFS: ::c_int = 255;
1595pub const EISCONN: ::c_int = 256;
1596pub const ENOTCONN: ::c_int = 257;
1597pub const ESHUTDOWN: ::c_int = 258;
1598pub const ETOOMANYREFS: ::c_int = 259;
1599pub const ETIMEDOUT: ::c_int = 260;
1600pub const ECONNREFUSED: ::c_int = 261;
1601pub const EHOSTDOWN: ::c_int = 264;
1602pub const EHOSTUNREACH: ::c_int = 265;
1603pub const EBADRPC: ::c_int = 272;
1604pub const ERPCMISMATCH: ::c_int = 273;
1605pub const EPROGUNAVAIL: ::c_int = 274;
1606pub const EPROGMISMATCH: ::c_int = 275;
1607pub const EPROCUNAVAIL: ::c_int = 276;
1608pub const ENOREMOTE: ::c_int = 300;
1609pub const ENONDP: ::c_int = 301;
1610pub const EBADFSYS: ::c_int = 302;
1611pub const EMORE: ::c_int = 309;
1612pub const ECTRLTERM: ::c_int = 310;
1613pub const ENOLIC: ::c_int = 311;
1614pub const ESRVRFAULT: ::c_int = 312;
1615pub const EENDIAN: ::c_int = 313;
1616pub const ESECTYPEINVAL: ::c_int = 314;
1617
1618pub const RUSAGE_CHILDREN: ::c_int = -1;
1619pub const L_tmpnam: ::c_uint = 255;
1620
1621pub const _PC_LINK_MAX: ::c_int = 1;
1622pub const _PC_MAX_CANON: ::c_int = 2;
1623pub const _PC_MAX_INPUT: ::c_int = 3;
1624pub const _PC_NAME_MAX: ::c_int = 4;
1625pub const _PC_PATH_MAX: ::c_int = 5;
1626pub const _PC_PIPE_BUF: ::c_int = 6;
1627pub const _PC_CHOWN_RESTRICTED: ::c_int = 9;
1628pub const _PC_NO_TRUNC: ::c_int = 7;
1629pub const _PC_VDISABLE: ::c_int = 8;
1630pub const _PC_SYNC_IO: ::c_int = 14;
1631pub const _PC_ASYNC_IO: ::c_int = 12;
1632pub const _PC_PRIO_IO: ::c_int = 13;
1633pub const _PC_SOCK_MAXBUF: ::c_int = 15;
1634pub const _PC_FILESIZEBITS: ::c_int = 16;
1635pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 22;
1636pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 23;
1637pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 24;
1638pub const _PC_REC_XFER_ALIGN: ::c_int = 25;
1639pub const _PC_ALLOC_SIZE_MIN: ::c_int = 21;
1640pub const _PC_SYMLINK_MAX: ::c_int = 17;
1641pub const _PC_2_SYMLINKS: ::c_int = 20;
1642
1643pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
1644pub const _SC_ARG_MAX: ::c_int = 1;
1645pub const _SC_CHILD_MAX: ::c_int = 2;
1646pub const _SC_CLK_TCK: ::c_int = 3;
1647pub const _SC_NGROUPS_MAX: ::c_int = 4;
1648pub const _SC_OPEN_MAX: ::c_int = 5;
1649pub const _SC_JOB_CONTROL: ::c_int = 6;
1650pub const _SC_SAVED_IDS: ::c_int = 7;
1651pub const _SC_VERSION: ::c_int = 8;
1652pub const _SC_PASS_MAX: ::c_int = 9;
1653pub const _SC_PAGESIZE: ::c_int = 11;
1654pub const _SC_XOPEN_VERSION: ::c_int = 12;
1655pub const _SC_STREAM_MAX: ::c_int = 13;
1656pub const _SC_TZNAME_MAX: ::c_int = 14;
1657pub const _SC_AIO_LISTIO_MAX: ::c_int = 15;
1658pub const _SC_AIO_MAX: ::c_int = 16;
1659pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 17;
1660pub const _SC_DELAYTIMER_MAX: ::c_int = 18;
1661pub const _SC_MQ_OPEN_MAX: ::c_int = 19;
1662pub const _SC_MQ_PRIO_MAX: ::c_int = 20;
1663pub const _SC_RTSIG_MAX: ::c_int = 21;
1664pub const _SC_SEM_NSEMS_MAX: ::c_int = 22;
1665pub const _SC_SEM_VALUE_MAX: ::c_int = 23;
1666pub const _SC_SIGQUEUE_MAX: ::c_int = 24;
1667pub const _SC_TIMER_MAX: ::c_int = 25;
1668pub const _SC_ASYNCHRONOUS_IO: ::c_int = 26;
1669pub const _SC_FSYNC: ::c_int = 27;
1670pub const _SC_MAPPED_FILES: ::c_int = 28;
1671pub const _SC_MEMLOCK: ::c_int = 29;
1672pub const _SC_MEMLOCK_RANGE: ::c_int = 30;
1673pub const _SC_MEMORY_PROTECTION: ::c_int = 31;
1674pub const _SC_MESSAGE_PASSING: ::c_int = 32;
1675pub const _SC_PRIORITIZED_IO: ::c_int = 33;
1676pub const _SC_PRIORITY_SCHEDULING: ::c_int = 34;
1677pub const _SC_REALTIME_SIGNALS: ::c_int = 35;
1678pub const _SC_SEMAPHORES: ::c_int = 36;
1679pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 37;
1680pub const _SC_SYNCHRONIZED_IO: ::c_int = 38;
1681pub const _SC_TIMERS: ::c_int = 39;
1682pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 40;
1683pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 41;
1684pub const _SC_LOGIN_NAME_MAX: ::c_int = 42;
1685pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 43;
1686pub const _SC_THREAD_KEYS_MAX: ::c_int = 44;
1687pub const _SC_THREAD_STACK_MIN: ::c_int = 45;
1688pub const _SC_THREAD_THREADS_MAX: ::c_int = 46;
1689pub const _SC_TTY_NAME_MAX: ::c_int = 47;
1690pub const _SC_THREADS: ::c_int = 48;
1691pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 49;
1692pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 50;
1693pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 51;
1694pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 52;
1695pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 53;
1696pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 54;
1697pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 55;
1698pub const _SC_2_CHAR_TERM: ::c_int = 56;
1699pub const _SC_2_C_BIND: ::c_int = 57;
1700pub const _SC_2_C_DEV: ::c_int = 58;
1701pub const _SC_2_C_VERSION: ::c_int = 59;
1702pub const _SC_2_FORT_DEV: ::c_int = 60;
1703pub const _SC_2_FORT_RUN: ::c_int = 61;
1704pub const _SC_2_LOCALEDEF: ::c_int = 62;
1705pub const _SC_2_SW_DEV: ::c_int = 63;
1706pub const _SC_2_UPE: ::c_int = 64;
1707pub const _SC_2_VERSION: ::c_int = 65;
1708pub const _SC_ATEXIT_MAX: ::c_int = 66;
1709pub const _SC_AVPHYS_PAGES: ::c_int = 67;
1710pub const _SC_BC_BASE_MAX: ::c_int = 68;
1711pub const _SC_BC_DIM_MAX: ::c_int = 69;
1712pub const _SC_BC_SCALE_MAX: ::c_int = 70;
1713pub const _SC_BC_STRING_MAX: ::c_int = 71;
1714pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 72;
1715pub const _SC_CHAR_BIT: ::c_int = 73;
1716pub const _SC_CHAR_MAX: ::c_int = 74;
1717pub const _SC_CHAR_MIN: ::c_int = 75;
1718pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 76;
1719pub const _SC_EQUIV_CLASS_MAX: ::c_int = 77;
1720pub const _SC_EXPR_NEST_MAX: ::c_int = 78;
1721pub const _SC_INT_MAX: ::c_int = 79;
1722pub const _SC_INT_MIN: ::c_int = 80;
1723pub const _SC_LINE_MAX: ::c_int = 81;
1724pub const _SC_LONG_BIT: ::c_int = 82;
1725pub const _SC_MB_LEN_MAX: ::c_int = 83;
1726pub const _SC_NL_ARGMAX: ::c_int = 84;
1727pub const _SC_NL_LANGMAX: ::c_int = 85;
1728pub const _SC_NL_MSGMAX: ::c_int = 86;
1729pub const _SC_NL_NMAX: ::c_int = 87;
1730pub const _SC_NL_SETMAX: ::c_int = 88;
1731pub const _SC_NL_TEXTMAX: ::c_int = 89;
1732pub const _SC_NPROCESSORS_CONF: ::c_int = 90;
1733pub const _SC_NPROCESSORS_ONLN: ::c_int = 91;
1734pub const _SC_NZERO: ::c_int = 92;
1735pub const _SC_PHYS_PAGES: ::c_int = 93;
1736pub const _SC_PII: ::c_int = 94;
1737pub const _SC_PII_INTERNET: ::c_int = 95;
1738pub const _SC_PII_INTERNET_DGRAM: ::c_int = 96;
1739pub const _SC_PII_INTERNET_STREAM: ::c_int = 97;
1740pub const _SC_PII_OSI: ::c_int = 98;
1741pub const _SC_PII_OSI_CLTS: ::c_int = 99;
1742pub const _SC_PII_OSI_COTS: ::c_int = 100;
1743pub const _SC_PII_OSI_M: ::c_int = 101;
1744pub const _SC_PII_SOCKET: ::c_int = 102;
1745pub const _SC_PII_XTI: ::c_int = 103;
1746pub const _SC_POLL: ::c_int = 104;
1747pub const _SC_RE_DUP_MAX: ::c_int = 105;
1748pub const _SC_SCHAR_MAX: ::c_int = 106;
1749pub const _SC_SCHAR_MIN: ::c_int = 107;
1750pub const _SC_SELECT: ::c_int = 108;
1751pub const _SC_SHRT_MAX: ::c_int = 109;
1752pub const _SC_SHRT_MIN: ::c_int = 110;
1753pub const _SC_SSIZE_MAX: ::c_int = 111;
1754pub const _SC_T_IOV_MAX: ::c_int = 112;
1755pub const _SC_UCHAR_MAX: ::c_int = 113;
1756pub const _SC_UINT_MAX: ::c_int = 114;
1757pub const _SC_UIO_MAXIOV: ::c_int = 115;
1758pub const _SC_ULONG_MAX: ::c_int = 116;
1759pub const _SC_USHRT_MAX: ::c_int = 117;
1760pub const _SC_WORD_BIT: ::c_int = 118;
1761pub const _SC_XOPEN_CRYPT: ::c_int = 119;
1762pub const _SC_XOPEN_ENH_I18N: ::c_int = 120;
1763pub const _SC_XOPEN_SHM: ::c_int = 121;
1764pub const _SC_XOPEN_UNIX: ::c_int = 122;
1765pub const _SC_XOPEN_XCU_VERSION: ::c_int = 123;
1766pub const _SC_XOPEN_XPG2: ::c_int = 124;
1767pub const _SC_XOPEN_XPG3: ::c_int = 125;
1768pub const _SC_XOPEN_XPG4: ::c_int = 126;
1769pub const _SC_XBS5_ILP32_OFF32: ::c_int = 127;
1770pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 128;
1771pub const _SC_XBS5_LP64_OFF64: ::c_int = 129;
1772pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 130;
1773pub const _SC_ADVISORY_INFO: ::c_int = 131;
1774pub const _SC_CPUTIME: ::c_int = 132;
1775pub const _SC_SPAWN: ::c_int = 133;
1776pub const _SC_SPORADIC_SERVER: ::c_int = 134;
1777pub const _SC_THREAD_CPUTIME: ::c_int = 135;
1778pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 136;
1779pub const _SC_TIMEOUTS: ::c_int = 137;
1780pub const _SC_BARRIERS: ::c_int = 138;
1781pub const _SC_CLOCK_SELECTION: ::c_int = 139;
1782pub const _SC_MONOTONIC_CLOCK: ::c_int = 140;
1783pub const _SC_READER_WRITER_LOCKS: ::c_int = 141;
1784pub const _SC_SPIN_LOCKS: ::c_int = 142;
1785pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 143;
1786pub const _SC_TRACE_EVENT_FILTER: ::c_int = 144;
1787pub const _SC_TRACE: ::c_int = 145;
1788pub const _SC_TRACE_INHERIT: ::c_int = 146;
1789pub const _SC_TRACE_LOG: ::c_int = 147;
1790pub const _SC_2_PBS: ::c_int = 148;
1791pub const _SC_2_PBS_ACCOUNTING: ::c_int = 149;
1792pub const _SC_2_PBS_CHECKPOINT: ::c_int = 150;
1793pub const _SC_2_PBS_LOCATE: ::c_int = 151;
1794pub const _SC_2_PBS_MESSAGE: ::c_int = 152;
1795pub const _SC_2_PBS_TRACK: ::c_int = 153;
1796pub const _SC_HOST_NAME_MAX: ::c_int = 154;
1797pub const _SC_IOV_MAX: ::c_int = 155;
1798pub const _SC_IPV6: ::c_int = 156;
1799pub const _SC_RAW_SOCKETS: ::c_int = 157;
1800pub const _SC_REGEXP: ::c_int = 158;
1801pub const _SC_SHELL: ::c_int = 159;
1802pub const _SC_SS_REPL_MAX: ::c_int = 160;
1803pub const _SC_SYMLOOP_MAX: ::c_int = 161;
1804pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 162;
1805pub const _SC_TRACE_NAME_MAX: ::c_int = 163;
1806pub const _SC_TRACE_SYS_MAX: ::c_int = 164;
1807pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 165;
1808pub const _SC_V6_ILP32_OFF32: ::c_int = 166;
1809pub const _SC_V6_ILP32_OFFBIG: ::c_int = 167;
1810pub const _SC_V6_LP64_OFF64: ::c_int = 168;
1811pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 169;
1812pub const _SC_XOPEN_REALTIME: ::c_int = 170;
1813pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 171;
1814pub const _SC_XOPEN_LEGACY: ::c_int = 172;
1815pub const _SC_XOPEN_STREAMS: ::c_int = 173;
1816pub const _SC_V7_ILP32_OFF32: ::c_int = 176;
1817pub const _SC_V7_ILP32_OFFBIG: ::c_int = 177;
1818pub const _SC_V7_LP64_OFF64: ::c_int = 178;
1819pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 179;
1820
1821pub const GLOB_ERR: ::c_int = 0x0001;
1822pub const GLOB_MARK: ::c_int = 0x0002;
1823pub const GLOB_NOSORT: ::c_int = 0x0004;
1824pub const GLOB_DOOFFS: ::c_int = 0x0008;
1825pub const GLOB_NOCHECK: ::c_int = 0x0010;
1826pub const GLOB_APPEND: ::c_int = 0x0020;
1827pub const GLOB_NOESCAPE: ::c_int = 0x0040;
1828
1829pub const GLOB_NOSPACE: ::c_int = 1;
1830pub const GLOB_ABORTED: ::c_int = 2;
1831pub const GLOB_NOMATCH: ::c_int = 3;
1832
1833pub const S_IEXEC: mode_t = ::S_IXUSR;
1834pub const S_IWRITE: mode_t = ::S_IWUSR;
1835pub const S_IREAD: mode_t = ::S_IRUSR;
1836
1837pub const S_IFIFO: ::mode_t = 0x1000;
1838pub const S_IFCHR: ::mode_t = 0x2000;
1839pub const S_IFDIR: ::mode_t = 0x4000;
1840pub const S_IFBLK: ::mode_t = 0x6000;
1841pub const S_IFREG: ::mode_t = 0x8000;
1842pub const S_IFLNK: ::mode_t = 0xA000;
1843pub const S_IFSOCK: ::mode_t = 0xC000;
1844pub const S_IFMT: ::mode_t = 0xF000;
1845
1846pub const S_IXOTH: ::mode_t = 0o000001;
1847pub const S_IWOTH: ::mode_t = 0o000002;
1848pub const S_IROTH: ::mode_t = 0o000004;
1849pub const S_IRWXO: ::mode_t = 0o000007;
1850pub const S_IXGRP: ::mode_t = 0o000010;
1851pub const S_IWGRP: ::mode_t = 0o000020;
1852pub const S_IRGRP: ::mode_t = 0o000040;
1853pub const S_IRWXG: ::mode_t = 0o000070;
1854pub const S_IXUSR: ::mode_t = 0o000100;
1855pub const S_IWUSR: ::mode_t = 0o000200;
1856pub const S_IRUSR: ::mode_t = 0o000400;
1857pub const S_IRWXU: ::mode_t = 0o000700;
1858
1859pub const F_LOCK: ::c_int = 1;
1860pub const F_TEST: ::c_int = 3;
1861pub const F_TLOCK: ::c_int = 2;
1862pub const F_ULOCK: ::c_int = 0;
1863
1864pub const ST_RDONLY: ::c_ulong = 0x01;
1865pub const ST_NOSUID: ::c_ulong = 0x04;
1866pub const ST_NOEXEC: ::c_ulong = 0x02;
1867pub const ST_NOATIME: ::c_ulong = 0x20;
1868
1869pub const RTLD_NEXT: *mut ::c_void = -3i64 as *mut ::c_void;
1870pub const RTLD_DEFAULT: *mut ::c_void = -2i64 as *mut ::c_void;
1871pub const RTLD_NODELETE: ::c_int = 0x1000;
1872pub const RTLD_NOW: ::c_int = 0x0002;
1873
1874pub const EMPTY: ::c_short = 0;
1875pub const RUN_LVL: ::c_short = 1;
1876pub const BOOT_TIME: ::c_short = 2;
1877pub const NEW_TIME: ::c_short = 4;
1878pub const OLD_TIME: ::c_short = 3;
1879pub const INIT_PROCESS: ::c_short = 5;
1880pub const LOGIN_PROCESS: ::c_short = 6;
1881pub const USER_PROCESS: ::c_short = 7;
1882pub const DEAD_PROCESS: ::c_short = 8;
1883pub const ACCOUNTING: ::c_short = 9;
1884
1885pub const ENOTSUP: ::c_int = 48;
1886
1887pub const BUFSIZ: ::c_uint = 1024;
1888pub const TMP_MAX: ::c_uint = 26 * 26 * 26;
1889pub const FOPEN_MAX: ::c_uint = 16;
1890pub const FILENAME_MAX: ::c_uint = 255;
1891
1892pub const NI_MAXHOST: ::socklen_t = 1025;
1893pub const M_KEEP: ::c_int = 4;
1894pub const REG_STARTEND: ::c_int = 0o00004;
1895pub const VEOF: usize = 4;
1896
1897pub const RTLD_GLOBAL: ::c_int = 0x0100;
1898pub const RTLD_NOLOAD: ::c_int = 0x0004;
1899
1900pub const O_RDONLY: ::c_int = 0o000000;
1901pub const O_WRONLY: ::c_int = 0o000001;
1902pub const O_RDWR: ::c_int = 0o000002;
1903
1904pub const O_EXEC: ::c_int = 0o00003;
1905pub const O_ASYNC: ::c_int = 0o0200000;
1906pub const O_NDELAY: ::c_int = O_NONBLOCK;
1907pub const O_TRUNC: ::c_int = 0o001000;
1908pub const O_CLOEXEC: ::c_int = 0o020000;
1909pub const O_DIRECTORY: ::c_int = 0o4000000;
1910pub const O_ACCMODE: ::c_int = 0o000007;
1911pub const O_APPEND: ::c_int = 0o000010;
1912pub const O_CREAT: ::c_int = 0o000400;
1913pub const O_EXCL: ::c_int = 0o002000;
1914pub const O_NOCTTY: ::c_int = 0o004000;
1915pub const O_NONBLOCK: ::c_int = 0o000200;
1916pub const O_SYNC: ::c_int = 0o000040;
1917pub const O_RSYNC: ::c_int = 0o000100;
1918pub const O_DSYNC: ::c_int = 0o000020;
1919pub const O_NOFOLLOW: ::c_int = 0o010000;
1920
1921pub const POSIX_FADV_DONTNEED: ::c_int = 4;
1922pub const POSIX_FADV_NOREUSE: ::c_int = 5;
1923
1924pub const SOCK_SEQPACKET: ::c_int = 5;
1925pub const SOCK_STREAM: ::c_int = 1;
1926pub const SOCK_DGRAM: ::c_int = 2;
1927pub const SOCK_RAW: ::c_int = 3;
1928pub const SOCK_RDM: ::c_int = 4;
1929pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
1930
1931pub const SA_SIGINFO: ::c_int = 0x0002;
1932pub const SA_NOCLDWAIT: ::c_int = 0x0020;
1933pub const SA_NODEFER: ::c_int = 0x0010;
1934pub const SA_RESETHAND: ::c_int = 0x0004;
1935pub const SA_NOCLDSTOP: ::c_int = 0x0001;
1936
1937pub const SIGTTIN: ::c_int = 26;
1938pub const SIGTTOU: ::c_int = 27;
1939pub const SIGXCPU: ::c_int = 30;
1940pub const SIGXFSZ: ::c_int = 31;
1941pub const SIGVTALRM: ::c_int = 28;
1942pub const SIGPROF: ::c_int = 29;
1943pub const SIGWINCH: ::c_int = 20;
1944pub const SIGCHLD: ::c_int = 18;
1945pub const SIGBUS: ::c_int = 10;
1946pub const SIGUSR1: ::c_int = 16;
1947pub const SIGUSR2: ::c_int = 17;
1948pub const SIGCONT: ::c_int = 25;
1949pub const SIGSTOP: ::c_int = 23;
1950pub const SIGTSTP: ::c_int = 24;
1951pub const SIGURG: ::c_int = 21;
1952pub const SIGIO: ::c_int = SIGPOLL;
1953pub const SIGSYS: ::c_int = 12;
1954pub const SIGPOLL: ::c_int = 22;
1955pub const SIGPWR: ::c_int = 19;
1956pub const SIG_SETMASK: ::c_int = 2;
1957pub const SIG_BLOCK: ::c_int = 0;
1958pub const SIG_UNBLOCK: ::c_int = 1;
1959
1960pub const POLLWRNORM: ::c_short = ::POLLOUT;
1961pub const POLLWRBAND: ::c_short = 0x0010;
1962
1963pub const F_SETLK: ::c_int = 106;
1964pub const F_SETLKW: ::c_int = 107;
1965pub const F_ALLOCSP: ::c_int = 110;
1966pub const F_FREESP: ::c_int = 111;
1967pub const F_GETLK: ::c_int = 114;
1968
1969pub const F_RDLCK: ::c_int = 1;
1970pub const F_WRLCK: ::c_int = 2;
1971pub const F_UNLCK: ::c_int = 3;
1972
1973pub const NCCS: usize = 40;
1974
1975pub const MAP_ANON: ::c_int = MAP_ANONYMOUS;
1976pub const MAP_ANONYMOUS: ::c_int = 0x00080000;
1977
1978pub const MCL_CURRENT: ::c_int = 0x000000001;
1979pub const MCL_FUTURE: ::c_int = 0x000000002;
1980
1981pub const _TIO_CBAUD: ::tcflag_t = 15;
1982pub const CBAUD: ::tcflag_t = _TIO_CBAUD;
1983pub const TAB1: ::tcflag_t = 0x0800;
1984pub const TAB2: ::tcflag_t = 0x1000;
1985pub const TAB3: ::tcflag_t = 0x1800;
1986pub const CR1: ::tcflag_t = 0x200;
1987pub const CR2: ::tcflag_t = 0x400;
1988pub const CR3: ::tcflag_t = 0x600;
1989pub const FF1: ::tcflag_t = 0x8000;
1990pub const BS1: ::tcflag_t = 0x2000;
1991pub const VT1: ::tcflag_t = 0x4000;
1992pub const VWERASE: usize = 14;
1993pub const VREPRINT: usize = 12;
1994pub const VSUSP: usize = 10;
1995pub const VSTART: usize = 8;
1996pub const VSTOP: usize = 9;
1997pub const VDISCARD: usize = 13;
1998pub const VTIME: usize = 17;
1999pub const IXON: ::tcflag_t = 0x00000400;
2000pub const IXOFF: ::tcflag_t = 0x00001000;
2001pub const ONLCR: ::tcflag_t = 0x00000004;
2002pub const CSIZE: ::tcflag_t = 0x00000030;
2003pub const CS6: ::tcflag_t = 0x10;
2004pub const CS7: ::tcflag_t = 0x20;
2005pub const CS8: ::tcflag_t = 0x30;
2006pub const CSTOPB: ::tcflag_t = 0x00000040;
2007pub const CREAD: ::tcflag_t = 0x00000080;
2008pub const PARENB: ::tcflag_t = 0x00000100;
2009pub const PARODD: ::tcflag_t = 0x00000200;
2010pub const HUPCL: ::tcflag_t = 0x00000400;
2011pub const CLOCAL: ::tcflag_t = 0x00000800;
2012pub const ECHOKE: ::tcflag_t = 0x00000800;
2013pub const ECHOE: ::tcflag_t = 0x00000010;
2014pub const ECHOK: ::tcflag_t = 0x00000020;
2015pub const ECHONL: ::tcflag_t = 0x00000040;
2016pub const ECHOCTL: ::tcflag_t = 0x00000200;
2017pub const ISIG: ::tcflag_t = 0x00000001;
2018pub const ICANON: ::tcflag_t = 0x00000002;
2019pub const NOFLSH: ::tcflag_t = 0x00000080;
2020pub const OLCUC: ::tcflag_t = 0x00000002;
2021pub const NLDLY: ::tcflag_t = 0x00000100;
2022pub const CRDLY: ::tcflag_t = 0x00000600;
2023pub const TABDLY: ::tcflag_t = 0x00001800;
2024pub const BSDLY: ::tcflag_t = 0x00002000;
2025pub const FFDLY: ::tcflag_t = 0x00008000;
2026pub const VTDLY: ::tcflag_t = 0x00004000;
2027pub const XTABS: ::tcflag_t = 0x1800;
2028
2029pub const B0: ::speed_t = 0;
2030pub const B50: ::speed_t = 1;
2031pub const B75: ::speed_t = 2;
2032pub const B110: ::speed_t = 3;
2033pub const B134: ::speed_t = 4;
2034pub const B150: ::speed_t = 5;
2035pub const B200: ::speed_t = 6;
2036pub const B300: ::speed_t = 7;
2037pub const B600: ::speed_t = 8;
2038pub const B1200: ::speed_t = 9;
2039pub const B1800: ::speed_t = 10;
2040pub const B2400: ::speed_t = 11;
2041pub const B4800: ::speed_t = 12;
2042pub const B9600: ::speed_t = 13;
2043pub const B19200: ::speed_t = 14;
2044pub const B38400: ::speed_t = 15;
2045pub const EXTA: ::speed_t = 14;
2046pub const EXTB: ::speed_t = 15;
2047pub const B57600: ::speed_t = 57600;
2048pub const B115200: ::speed_t = 115200;
2049
2050pub const VEOL: usize = 5;
2051pub const VEOL2: usize = 6;
2052pub const VMIN: usize = 16;
2053pub const IEXTEN: ::tcflag_t = 0x00008000;
2054pub const TOSTOP: ::tcflag_t = 0x00000100;
2055
2056pub const TCSANOW: ::c_int = 0x0001;
2057pub const TCSADRAIN: ::c_int = 0x0002;
2058pub const TCSAFLUSH: ::c_int = 0x0004;
2059
2060pub const HW_MACHINE: ::c_int = 1;
2061pub const HW_MODEL: ::c_int = 2;
2062pub const HW_NCPU: ::c_int = 3;
2063pub const HW_BYTEORDER: ::c_int = 4;
2064pub const HW_PHYSMEM: ::c_int = 5;
2065pub const HW_USERMEM: ::c_int = 6;
2066pub const HW_PAGESIZE: ::c_int = 7;
2067pub const HW_DISKNAMES: ::c_int = 8;
2068pub const HW_IOSTATS: ::c_int = 9;
2069pub const HW_MACHINE_ARCH: ::c_int = 10;
2070pub const HW_ALIGNBYTES: ::c_int = 11;
2071pub const HW_CNMAGIC: ::c_int = 12;
2072pub const HW_PHYSMEM64: ::c_int = 13;
2073pub const HW_USERMEM64: ::c_int = 14;
2074pub const HW_IOSTATNAMES: ::c_int = 15;
2075pub const HW_MAXID: ::c_int = 15;
2076
2077pub const CTL_UNSPEC: ::c_int = 0;
2078pub const CTL_KERN: ::c_int = 1;
2079pub const CTL_VM: ::c_int = 2;
2080pub const CTL_VFS: ::c_int = 3;
2081pub const CTL_NET: ::c_int = 4;
2082pub const CTL_DEBUG: ::c_int = 5;
2083pub const CTL_HW: ::c_int = 6;
2084pub const CTL_MACHDEP: ::c_int = 7;
2085pub const CTL_USER: ::c_int = 8;
2086pub const CTL_QNX: ::c_int = 9;
2087pub const CTL_PROC: ::c_int = 10;
2088pub const CTL_VENDOR: ::c_int = 11;
2089pub const CTL_EMUL: ::c_int = 12;
2090pub const CTL_SECURITY: ::c_int = 13;
2091pub const CTL_MAXID: ::c_int = 14;
2092
2093pub const DAY_1: ::nl_item = 8;
2094pub const DAY_2: ::nl_item = 9;
2095pub const DAY_3: ::nl_item = 10;
2096pub const DAY_4: ::nl_item = 11;
2097pub const DAY_5: ::nl_item = 12;
2098pub const DAY_6: ::nl_item = 13;
2099pub const DAY_7: ::nl_item = 14;
2100
2101pub const MON_1: ::nl_item = 22;
2102pub const MON_2: ::nl_item = 23;
2103pub const MON_3: ::nl_item = 24;
2104pub const MON_4: ::nl_item = 25;
2105pub const MON_5: ::nl_item = 26;
2106pub const MON_6: ::nl_item = 27;
2107pub const MON_7: ::nl_item = 28;
2108pub const MON_8: ::nl_item = 29;
2109pub const MON_9: ::nl_item = 30;
2110pub const MON_10: ::nl_item = 31;
2111pub const MON_11: ::nl_item = 32;
2112pub const MON_12: ::nl_item = 33;
2113
2114pub const ABDAY_1: ::nl_item = 15;
2115pub const ABDAY_2: ::nl_item = 16;
2116pub const ABDAY_3: ::nl_item = 17;
2117pub const ABDAY_4: ::nl_item = 18;
2118pub const ABDAY_5: ::nl_item = 19;
2119pub const ABDAY_6: ::nl_item = 20;
2120pub const ABDAY_7: ::nl_item = 21;
2121
2122pub const ABMON_1: ::nl_item = 34;
2123pub const ABMON_2: ::nl_item = 35;
2124pub const ABMON_3: ::nl_item = 36;
2125pub const ABMON_4: ::nl_item = 37;
2126pub const ABMON_5: ::nl_item = 38;
2127pub const ABMON_6: ::nl_item = 39;
2128pub const ABMON_7: ::nl_item = 40;
2129pub const ABMON_8: ::nl_item = 41;
2130pub const ABMON_9: ::nl_item = 42;
2131pub const ABMON_10: ::nl_item = 43;
2132pub const ABMON_11: ::nl_item = 44;
2133pub const ABMON_12: ::nl_item = 45;
2134
2135pub const AF_ARP: ::c_int = 28;
2136pub const AF_CCITT: ::c_int = 10;
2137pub const AF_CHAOS: ::c_int = 5;
2138pub const AF_CNT: ::c_int = 21;
2139pub const AF_COIP: ::c_int = 20;
2140pub const AF_DATAKIT: ::c_int = 9;
2141pub const AF_DECnet: ::c_int = 12;
2142pub const AF_DLI: ::c_int = 13;
2143pub const AF_E164: ::c_int = 26;
2144pub const AF_ECMA: ::c_int = 8;
2145pub const AF_HYLINK: ::c_int = 15;
2146pub const AF_IEEE80211: ::c_int = 32;
2147pub const AF_IMPLINK: ::c_int = 3;
2148pub const AF_ISO: ::c_int = 7;
2149pub const AF_LAT: ::c_int = 14;
2150pub const AF_LINK: ::c_int = 18;
2151pub const AF_NATM: ::c_int = 27;
2152pub const AF_NS: ::c_int = 6;
2153pub const AF_OSI: ::c_int = 7;
2154pub const AF_PUP: ::c_int = 4;
2155pub const ALT_DIGITS: ::nl_item = 50;
2156pub const AM_STR: ::nl_item = 6;
2157pub const B76800: ::speed_t = 76800;
2158
2159pub const BIOCFLUSH: ::c_int = 17000;
2160pub const BIOCGBLEN: ::c_int = 1074020966;
2161pub const BIOCGDLT: ::c_int = 1074020970;
2162pub const BIOCGDLTLIST: ::c_int = -1072676233;
2163pub const BIOCGETIF: ::c_int = 1083196011;
2164pub const BIOCGHDRCMPLT: ::c_int = 1074020980;
2165pub const BIOCGRTIMEOUT: ::c_int = 1074807406;
2166pub const BIOCGSEESENT: ::c_int = 1074020984;
2167pub const BIOCGSTATS: ::c_int = 1082147439;
2168pub const BIOCIMMEDIATE: ::c_int = -2147204496;
2169pub const BIOCPROMISC: ::c_int = 17001;
2170pub const BIOCSBLEN: ::c_int = -1073462682;
2171pub const BIOCSDLT: ::c_int = -2147204490;
2172pub const BIOCSETF: ::c_int = -2146418073;
2173pub const BIOCSETIF: ::c_int = -2138029460;
2174pub const BIOCSHDRCMPLT: ::c_int = -2147204491;
2175pub const BIOCSRTIMEOUT: ::c_int = -2146418067;
2176pub const BIOCSSEESENT: ::c_int = -2147204487;
2177pub const BIOCVERSION: ::c_int = 1074020977;
2178
2179pub const BPF_ALIGNMENT: usize = ::mem::size_of::<::c_long>();
2180pub const CHAR_BIT: usize = 8;
2181pub const CODESET: ::nl_item = 1;
2182pub const CRNCYSTR: ::nl_item = 55;
2183
2184pub const D_FLAG_FILTER: ::c_int = 0x00000001;
2185pub const D_FLAG_STAT: ::c_int = 0x00000002;
2186pub const D_FLAG_STAT_FORM_MASK: ::c_int = 0x000000f0;
2187pub const D_FLAG_STAT_FORM_T32_2001: ::c_int = 0x00000010;
2188pub const D_FLAG_STAT_FORM_T32_2008: ::c_int = 0x00000020;
2189pub const D_FLAG_STAT_FORM_T64_2008: ::c_int = 0x00000030;
2190pub const D_FLAG_STAT_FORM_UNSET: ::c_int = 0x00000000;
2191
2192pub const D_FMT: ::nl_item = 3;
2193pub const D_GETFLAG: ::c_int = 1;
2194pub const D_SETFLAG: ::c_int = 2;
2195pub const D_T_FMT: ::nl_item = 2;
2196pub const ERA: ::nl_item = 46;
2197pub const ERA_D_FMT: ::nl_item = 47;
2198pub const ERA_D_T_FMT: ::nl_item = 48;
2199pub const ERA_T_FMT: ::nl_item = 49;
2200pub const RADIXCHAR: ::nl_item = 51;
2201pub const THOUSEP: ::nl_item = 52;
2202pub const YESEXPR: ::nl_item = 53;
2203pub const NOEXPR: ::nl_item = 54;
2204pub const F_GETOWN: ::c_int = 35;
2205
2206pub const FIONBIO: ::c_int = -2147195266;
2207pub const FIOASYNC: ::c_int = -2147195267;
2208pub const FIOCLEX: ::c_int = 26113;
2209pub const FIOGETOWN: ::c_int = 1074030203;
2210pub const FIONCLEX: ::c_int = 26114;
2211pub const FIONREAD: ::c_int = 1074030207;
2212pub const FIONSPACE: ::c_int = 1074030200;
2213pub const FIONWRITE: ::c_int = 1074030201;
2214pub const FIOSETOWN: ::c_int = -2147195268;
2215
2216pub const F_SETOWN: ::c_int = 36;
2217pub const IFF_ACCEPTRTADV: ::c_int = 0x40000000;
2218pub const IFF_IP6FORWARDING: ::c_int = 0x20000000;
2219pub const IFF_LINK0: ::c_int = 0x00001000;
2220pub const IFF_LINK1: ::c_int = 0x00002000;
2221pub const IFF_LINK2: ::c_int = 0x00004000;
2222pub const IFF_OACTIVE: ::c_int = 0x00000400;
2223pub const IFF_SHIM: ::c_int = 0x80000000;
2224pub const IFF_SIMPLEX: ::c_int = 0x00000800;
2225pub const IHFLOW: tcflag_t = 0x00000001;
2226pub const IIDLE: tcflag_t = 0x00000008;
2227pub const IP_RECVDSTADDR: ::c_int = 7;
2228pub const IP_RECVIF: ::c_int = 20;
2229pub const IPTOS_ECN_NOTECT: u8 = 0x00;
2230pub const IUCLC: tcflag_t = 0x00000200;
2231pub const IUTF8: tcflag_t = 0x0004000;
2232
2233pub const KERN_ARGMAX: ::c_int = 8;
2234pub const KERN_ARND: ::c_int = 81;
2235pub const KERN_BOOTTIME: ::c_int = 21;
2236pub const KERN_CLOCKRATE: ::c_int = 12;
2237pub const KERN_FILE: ::c_int = 15;
2238pub const KERN_HOSTID: ::c_int = 11;
2239pub const KERN_HOSTNAME: ::c_int = 10;
2240pub const KERN_IOV_MAX: ::c_int = 38;
2241pub const KERN_JOB_CONTROL: ::c_int = 19;
2242pub const KERN_LOGSIGEXIT: ::c_int = 46;
2243pub const KERN_MAXFILES: ::c_int = 7;
2244pub const KERN_MAXID: ::c_int = 83;
2245pub const KERN_MAXPROC: ::c_int = 6;
2246pub const KERN_MAXVNODES: ::c_int = 5;
2247pub const KERN_NGROUPS: ::c_int = 18;
2248pub const KERN_OSRELEASE: ::c_int = 2;
2249pub const KERN_OSREV: ::c_int = 3;
2250pub const KERN_OSTYPE: ::c_int = 1;
2251pub const KERN_POSIX1: ::c_int = 17;
2252pub const KERN_PROC: ::c_int = 14;
2253pub const KERN_PROC_ALL: ::c_int = 0;
2254pub const KERN_PROC_ARGS: ::c_int = 48;
2255pub const KERN_PROC_ENV: ::c_int = 3;
2256pub const KERN_PROC_GID: ::c_int = 7;
2257pub const KERN_PROC_PGRP: ::c_int = 2;
2258pub const KERN_PROC_PID: ::c_int = 1;
2259pub const KERN_PROC_RGID: ::c_int = 8;
2260pub const KERN_PROC_RUID: ::c_int = 6;
2261pub const KERN_PROC_SESSION: ::c_int = 3;
2262pub const KERN_PROC_TTY: ::c_int = 4;
2263pub const KERN_PROC_UID: ::c_int = 5;
2264pub const KERN_PROF: ::c_int = 16;
2265pub const KERN_SAVED_IDS: ::c_int = 20;
2266pub const KERN_SECURELVL: ::c_int = 9;
2267pub const KERN_VERSION: ::c_int = 4;
2268pub const KERN_VNODE: ::c_int = 13;
2269
2270pub const LC_ALL: ::c_int = 63;
2271pub const LC_COLLATE: ::c_int = 1;
2272pub const LC_CTYPE: ::c_int = 2;
2273pub const LC_MESSAGES: ::c_int = 32;
2274pub const LC_MONETARY: ::c_int = 4;
2275pub const LC_NUMERIC: ::c_int = 8;
2276pub const LC_TIME: ::c_int = 16;
2277
2278pub const LOCAL_CONNWAIT: ::c_int = 0x0002;
2279pub const LOCAL_CREDS: ::c_int = 0x0001;
2280pub const LOCAL_PEEREID: ::c_int = 0x0003;
2281
2282pub const MAP_STACK: ::c_int = 0x00001000;
2283pub const MNT_NOEXEC: ::c_int = 0x02;
2284pub const MNT_NOSUID: ::c_int = 0x04;
2285pub const MNT_RDONLY: ::c_int = 0x01;
2286
2287pub const MSG_NOTIFICATION: ::c_int = 0x0400;
2288
2289pub const NET_RT_DUMP: ::c_int = 1;
2290pub const NET_RT_FLAGS: ::c_int = 2;
2291pub const NET_RT_IFLIST: ::c_int = 4;
2292pub const NI_NUMERICSCOPE: ::c_int = 0x00000040;
2293pub const OHFLOW: tcflag_t = 0x00000002;
2294pub const P_ALL: idtype_t = 0;
2295pub const PARSTK: tcflag_t = 0x00000004;
2296pub const PF_ARP: ::c_int = 28;
2297pub const PF_CCITT: ::c_int = 10;
2298pub const PF_CHAOS: ::c_int = 5;
2299pub const PF_CNT: ::c_int = 21;
2300pub const PF_COIP: ::c_int = 20;
2301pub const PF_DATAKIT: ::c_int = 9;
2302pub const PF_DECnet: ::c_int = 12;
2303pub const PF_DLI: ::c_int = 13;
2304pub const PF_ECMA: ::c_int = 8;
2305pub const PF_HYLINK: ::c_int = 15;
2306pub const PF_IMPLINK: ::c_int = 3;
2307pub const PF_ISO: ::c_int = 7;
2308pub const PF_LAT: ::c_int = 14;
2309pub const PF_LINK: ::c_int = 18;
2310pub const PF_NATM: ::c_int = 27;
2311pub const PF_OSI: ::c_int = 7;
2312pub const PF_PIP: ::c_int = 25;
2313pub const PF_PUP: ::c_int = 4;
2314pub const PF_RTIP: ::c_int = 22;
2315pub const PF_XTP: ::c_int = 19;
2316pub const PM_STR: ::nl_item = 7;
2317pub const POSIX_MADV_DONTNEED: ::c_int = 4;
2318pub const POSIX_MADV_NORMAL: ::c_int = 0;
2319pub const POSIX_MADV_RANDOM: ::c_int = 2;
2320pub const POSIX_MADV_SEQUENTIAL: ::c_int = 1;
2321pub const POSIX_MADV_WILLNEED: ::c_int = 3;
2322pub const _POSIX_VDISABLE: ::c_int = 0;
2323pub const P_PGID: idtype_t = 2;
2324pub const P_PID: idtype_t = 1;
2325pub const PRIO_PGRP: ::c_int = 1;
2326pub const PRIO_PROCESS: ::c_int = 0;
2327pub const PRIO_USER: ::c_int = 2;
2328pub const pseudo_AF_HDRCMPLT: ::c_int = 30;
2329pub const pseudo_AF_PIP: ::c_int = 25;
2330pub const pseudo_AF_RTIP: ::c_int = 22;
2331pub const pseudo_AF_XTP: ::c_int = 19;
2332pub const REG_ASSERT: ::c_int = 15;
2333pub const REG_ATOI: ::c_int = 255;
2334pub const REG_BACKR: ::c_int = 0x400;
2335pub const REG_BASIC: ::c_int = 0x00;
2336pub const REG_DUMP: ::c_int = 0x80;
2337pub const REG_EMPTY: ::c_int = 14;
2338pub const REG_INVARG: ::c_int = 16;
2339pub const REG_ITOA: ::c_int = 0o400;
2340pub const REG_LARGE: ::c_int = 0x200;
2341pub const REG_NOSPEC: ::c_int = 0x10;
2342pub const REG_OK: ::c_int = 0;
2343pub const REG_PEND: ::c_int = 0x20;
2344pub const REG_TRACE: ::c_int = 0x100;
2345
2346pub const RLIMIT_AS: ::c_int = 6;
2347pub const RLIMIT_CORE: ::c_int = 4;
2348pub const RLIMIT_CPU: ::c_int = 0;
2349pub const RLIMIT_DATA: ::c_int = 2;
2350pub const RLIMIT_FSIZE: ::c_int = 1;
2351pub const RLIMIT_MEMLOCK: ::c_int = 7;
2352pub const RLIMIT_NOFILE: ::c_int = 5;
2353pub const RLIMIT_NPROC: ::c_int = 8;
2354pub const RLIMIT_RSS: ::c_int = 6;
2355pub const RLIMIT_STACK: ::c_int = 3;
2356pub const RLIMIT_VMEM: ::c_int = 6;
2357pub const RLIM_NLIMITS: ::c_int = 14;
2358
2359pub const SCHED_ADJTOHEAD: ::c_int = 5;
2360pub const SCHED_ADJTOTAIL: ::c_int = 6;
2361pub const SCHED_MAXPOLICY: ::c_int = 7;
2362pub const SCHED_SETPRIO: ::c_int = 7;
2363pub const SCHED_SPORADIC: ::c_int = 4;
2364
2365pub const SHM_ANON: *mut ::c_char = -1isize as *mut ::c_char;
2366pub const SIGCLD: ::c_int = SIGCHLD;
2367pub const SIGDEADLK: ::c_int = 7;
2368pub const SIGEMT: ::c_int = 7;
2369pub const SIGEV_NONE: ::c_int = 0;
2370pub const SIGEV_SIGNAL: ::c_int = 129;
2371pub const SIGEV_THREAD: ::c_int = 135;
2372pub const SIOCGIFADDR: ::c_int = -1064277727;
2373pub const SO_FIB: ::c_int = 0x100a;
2374pub const SO_OVERFLOWED: ::c_int = 0x1009;
2375pub const SO_SETFIB: ::c_int = 0x100a;
2376pub const SO_TXPRIO: ::c_int = 0x100b;
2377pub const SO_USELOOPBACK: ::c_int = 0x0040;
2378pub const SO_VLANPRIO: ::c_int = 0x100c;
2379pub const _SS_ALIGNSIZE: usize = ::mem::size_of::<i64>();
2380pub const _SS_MAXSIZE: usize = 128;
2381pub const _SS_PAD1SIZE: usize = _SS_ALIGNSIZE - 2;
2382pub const _SS_PAD2SIZE: usize = _SS_MAXSIZE - 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE;
2383pub const TC_CPOSIX: tcflag_t = CLOCAL | CREAD | CSIZE | CSTOPB | HUPCL | PARENB | PARODD;
2384pub const TCGETS: ::c_int = 0x404c540d;
2385pub const TC_IPOSIX: tcflag_t =
2386    BRKINT | ICRNL | IGNBRK | IGNPAR | INLCR | INPCK | ISTRIP | IXOFF | IXON | PARMRK;
2387pub const TC_LPOSIX: tcflag_t =
2388    ECHO | ECHOE | ECHOK | ECHONL | ICANON | IEXTEN | ISIG | NOFLSH | TOSTOP;
2389pub const TC_OPOSIX: tcflag_t = OPOST;
2390pub const T_FMT_AMPM: ::nl_item = 5;
2391
2392pub const TIOCCBRK: ::c_int = 29818;
2393pub const TIOCCDTR: ::c_int = 29816;
2394pub const TIOCDRAIN: ::c_int = 29790;
2395pub const TIOCEXCL: ::c_int = 29709;
2396pub const TIOCFLUSH: ::c_int = -2147191792;
2397pub const TIOCGETA: ::c_int = 1078752275;
2398pub const TIOCGPGRP: ::c_int = 1074033783;
2399pub const TIOCGWINSZ: ::c_int = 1074295912;
2400pub const TIOCMBIC: ::c_int = -2147191701;
2401pub const TIOCMBIS: ::c_int = -2147191700;
2402pub const TIOCMGET: ::c_int = 1074033770;
2403pub const TIOCMSET: ::c_int = -2147191699;
2404pub const TIOCNOTTY: ::c_int = 29809;
2405pub const TIOCNXCL: ::c_int = 29710;
2406pub const TIOCOUTQ: ::c_int = 1074033779;
2407pub const TIOCPKT: ::c_int = -2147191696;
2408pub const TIOCPKT_DATA: ::c_int = 0x00;
2409pub const TIOCPKT_DOSTOP: ::c_int = 0x20;
2410pub const TIOCPKT_FLUSHREAD: ::c_int = 0x01;
2411pub const TIOCPKT_FLUSHWRITE: ::c_int = 0x02;
2412pub const TIOCPKT_IOCTL: ::c_int = 0x40;
2413pub const TIOCPKT_NOSTOP: ::c_int = 0x10;
2414pub const TIOCPKT_START: ::c_int = 0x08;
2415pub const TIOCPKT_STOP: ::c_int = 0x04;
2416pub const TIOCSBRK: ::c_int = 29819;
2417pub const TIOCSCTTY: ::c_int = 29793;
2418pub const TIOCSDTR: ::c_int = 29817;
2419pub const TIOCSETA: ::c_int = -2142473196;
2420pub const TIOCSETAF: ::c_int = -2142473194;
2421pub const TIOCSETAW: ::c_int = -2142473195;
2422pub const TIOCSPGRP: ::c_int = -2147191690;
2423pub const TIOCSTART: ::c_int = 29806;
2424pub const TIOCSTI: ::c_int = -2147388302;
2425pub const TIOCSTOP: ::c_int = 29807;
2426pub const TIOCSWINSZ: ::c_int = -2146929561;
2427
2428pub const USER_CS_PATH: ::c_int = 1;
2429pub const USER_BC_BASE_MAX: ::c_int = 2;
2430pub const USER_BC_DIM_MAX: ::c_int = 3;
2431pub const USER_BC_SCALE_MAX: ::c_int = 4;
2432pub const USER_BC_STRING_MAX: ::c_int = 5;
2433pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
2434pub const USER_EXPR_NEST_MAX: ::c_int = 7;
2435pub const USER_LINE_MAX: ::c_int = 8;
2436pub const USER_RE_DUP_MAX: ::c_int = 9;
2437pub const USER_POSIX2_VERSION: ::c_int = 10;
2438pub const USER_POSIX2_C_BIND: ::c_int = 11;
2439pub const USER_POSIX2_C_DEV: ::c_int = 12;
2440pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
2441pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
2442pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
2443pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
2444pub const USER_POSIX2_SW_DEV: ::c_int = 17;
2445pub const USER_POSIX2_UPE: ::c_int = 18;
2446pub const USER_STREAM_MAX: ::c_int = 19;
2447pub const USER_TZNAME_MAX: ::c_int = 20;
2448pub const USER_ATEXIT_MAX: ::c_int = 21;
2449pub const USER_MAXID: ::c_int = 22;
2450
2451pub const VDOWN: usize = 31;
2452pub const VINS: usize = 32;
2453pub const VDEL: usize = 33;
2454pub const VRUB: usize = 34;
2455pub const VCAN: usize = 35;
2456pub const VHOME: usize = 36;
2457pub const VEND: usize = 37;
2458pub const VSPARE3: usize = 38;
2459pub const VSPARE4: usize = 39;
2460pub const VSWTCH: usize = 7;
2461pub const VDSUSP: usize = 11;
2462pub const VFWD: usize = 18;
2463pub const VLOGIN: usize = 19;
2464pub const VPREFIX: usize = 20;
2465pub const VSUFFIX: usize = 24;
2466pub const VLEFT: usize = 28;
2467pub const VRIGHT: usize = 29;
2468pub const VUP: usize = 30;
2469pub const XCASE: tcflag_t = 0x00000004;
2470
2471pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0x00;
2472pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x01;
2473
2474pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
2475pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
2476pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
2477pub const PTHREAD_STACK_MIN: ::size_t = 256;
2478pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0;
2479pub const PTHREAD_MUTEX_STALLED: ::c_int = 0x00;
2480pub const PTHREAD_MUTEX_ROBUST: ::c_int = 0x10;
2481pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0x00;
2482pub const PTHREAD_PROCESS_SHARED: ::c_int = 0x01;
2483
2484pub const PTHREAD_KEYS_MAX: usize = 128;
2485
2486pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2487    __u: 0x80000000,
2488    __owner: 0xffffffff,
2489};
2490pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2491    __u: CLOCK_REALTIME as u32,
2492    __owner: 0xfffffffb,
2493};
2494pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2495    __active: 0,
2496    __blockedwriters: 0,
2497    __blockedreaders: 0,
2498    __heavy: 0,
2499    __lock: PTHREAD_MUTEX_INITIALIZER,
2500    __rcond: PTHREAD_COND_INITIALIZER,
2501    __wcond: PTHREAD_COND_INITIALIZER,
2502    __owner: -2i32 as ::c_uint,
2503    __spare: 0,
2504};
2505
2506const_fn! {
2507    {const} fn _CMSG_ALIGN(len: usize) -> usize {
2508        len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
2509    }
2510
2511    {const} fn _ALIGN(p: usize, b: usize) -> usize {
2512        (p + b - 1) & !(b-1)
2513    }
2514}
2515
2516f! {
2517    pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
2518        if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
2519            (*mhdr).msg_control as *mut cmsghdr
2520        } else {
2521            0 as *mut cmsghdr
2522        }
2523    }
2524
2525    pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
2526        -> *mut ::cmsghdr
2527    {
2528        let msg = _CMSG_ALIGN((*cmsg).cmsg_len as usize);
2529        let next = cmsg as usize + msg + _CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
2530        if next > (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize {
2531           0 as *mut ::cmsghdr
2532        } else {
2533            (cmsg as usize + msg) as *mut ::cmsghdr
2534        }
2535    }
2536
2537    pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
2538        (cmsg as *mut ::c_uchar)
2539            .offset(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
2540    }
2541
2542    pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
2543        _CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
2544    }
2545
2546    pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
2547        (_CMSG_ALIGN(::mem::size_of::<cmsghdr>()) + _CMSG_ALIGN(length as usize) )
2548            as ::c_uint
2549    }
2550
2551    pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
2552        let fd = fd as usize;
2553        let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
2554        (*set).fds_bits[fd / size] &= !(1 << (fd % size));
2555        return
2556    }
2557
2558    pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
2559        let fd = fd as usize;
2560        let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
2561        return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
2562    }
2563
2564    pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
2565        let fd = fd as usize;
2566        let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
2567        (*set).fds_bits[fd / size] |= 1 << (fd % size);
2568        return
2569    }
2570
2571    pub fn FD_ZERO(set: *mut fd_set) -> () {
2572        for slot in (*set).fds_bits.iter_mut() {
2573            *slot = 0;
2574        }
2575    }
2576
2577    pub fn _DEXTRA_FIRST(_d: *const dirent) -> *mut ::dirent_extra {
2578        let _f = &((*(_d)).d_name) as *const _;
2579        let _s = _d as usize;
2580
2581        _ALIGN(_s + _f as usize - _s + (*_d).d_namelen as usize + 1, 8) as *mut ::dirent_extra
2582    }
2583
2584    pub fn _DEXTRA_VALID(_x: *const ::dirent_extra, _d: *const dirent) -> bool {
2585        let sz = _x as usize - _d as usize + ::mem::size_of::<::dirent_extra>();
2586        let rsz = (*_d).d_reclen as usize;
2587
2588        if sz > rsz || sz + (*_x).d_datalen as usize > rsz {
2589            false
2590        } else {
2591            true
2592        }
2593    }
2594
2595    pub fn _DEXTRA_NEXT(_x: *const ::dirent_extra) -> *mut ::dirent_extra {
2596        _ALIGN(
2597            _x as usize + ::mem::size_of::<::dirent_extra>() + (*_x).d_datalen as usize, 8
2598        ) as *mut ::dirent_extra
2599    }
2600
2601    pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
2602        let ngrps = if ngrps > 0 {
2603            ngrps - 1
2604        } else {
2605            0
2606        };
2607        ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
2608    }
2609}
2610
2611safe_f! {
2612    pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
2613        (status & 0xff) == 0x7f
2614    }
2615
2616    pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
2617        (status >> 8) & 0xff
2618    }
2619
2620    pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
2621        status == 0xffff
2622    }
2623
2624    pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
2625        ((status & 0x7f) + 1) as i8 >= 2
2626    }
2627
2628    pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
2629        status & 0x7f
2630    }
2631
2632    pub {const} fn WIFEXITED(status: ::c_int) -> bool {
2633        (status & 0x7f) == 0
2634    }
2635
2636    pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
2637        (status >> 8) & 0xff
2638    }
2639
2640    pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
2641        (status & 0x80) != 0
2642    }
2643
2644    pub {const} fn IPTOS_ECN(x: u8) -> u8 {
2645        x & ::IPTOS_ECN_MASK
2646    }
2647}
2648
2649// Network related functions are provided by libsocket and regex
2650// functions are provided by libregex.
2651#[link(name = "socket")]
2652#[link(name = "regex")]
2653
2654extern "C" {
2655    pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
2656    pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
2657    pub fn fdatasync(fd: ::c_int) -> ::c_int;
2658    pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
2659    pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
2660    pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
2661
2662    pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
2663    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
2664    pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
2665    pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int;
2666
2667    pub fn pthread_attr_getstack(
2668        attr: *const ::pthread_attr_t,
2669        stackaddr: *mut *mut ::c_void,
2670        stacksize: *mut ::size_t,
2671    ) -> ::c_int;
2672    pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
2673    pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
2674
2675    pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int;
2676    pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
2677    pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
2678
2679    pub fn utimensat(
2680        dirfd: ::c_int,
2681        path: *const ::c_char,
2682        times: *const ::timespec,
2683        flag: ::c_int,
2684    ) -> ::c_int;
2685
2686    pub fn pthread_condattr_getclock(
2687        attr: *const pthread_condattr_t,
2688        clock_id: *mut clockid_t,
2689    ) -> ::c_int;
2690    pub fn pthread_condattr_setclock(
2691        attr: *mut pthread_condattr_t,
2692        clock_id: ::clockid_t,
2693    ) -> ::c_int;
2694    pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int;
2695    pub fn pthread_mutexattr_setpshared(
2696        attr: *mut pthread_mutexattr_t,
2697        pshared: ::c_int,
2698    ) -> ::c_int;
2699    pub fn pthread_rwlockattr_getpshared(
2700        attr: *const pthread_rwlockattr_t,
2701        val: *mut ::c_int,
2702    ) -> ::c_int;
2703    pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int;
2704    pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> *mut ::c_char;
2705    pub fn clearenv() -> ::c_int;
2706    pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
2707        -> ::c_int;
2708    pub fn wait4(
2709        pid: ::pid_t,
2710        status: *mut ::c_int,
2711        options: ::c_int,
2712        rusage: *mut ::rusage,
2713    ) -> ::pid_t;
2714    pub fn execvpe(
2715        file: *const ::c_char,
2716        argv: *const *const ::c_char,
2717        envp: *const *const ::c_char,
2718    ) -> ::c_int;
2719
2720    pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
2721    pub fn freeifaddrs(ifa: *mut ::ifaddrs);
2722    pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
2723
2724    pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
2725    pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
2726
2727    pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
2728    pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
2729    pub fn openpty(
2730        amaster: *mut ::c_int,
2731        aslave: *mut ::c_int,
2732        name: *mut ::c_char,
2733        termp: *mut termios,
2734        winp: *mut ::winsize,
2735    ) -> ::c_int;
2736    pub fn forkpty(
2737        amaster: *mut ::c_int,
2738        name: *mut ::c_char,
2739        termp: *mut termios,
2740        winp: *mut ::winsize,
2741    ) -> ::pid_t;
2742    pub fn login_tty(fd: ::c_int) -> ::c_int;
2743
2744    pub fn uname(buf: *mut ::utsname) -> ::c_int;
2745
2746    pub fn getpeereid(socket: ::c_int, euid: *mut ::uid_t, egid: *mut ::gid_t) -> ::c_int;
2747
2748    pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
2749
2750    pub fn abs(i: ::c_int) -> ::c_int;
2751    pub fn atof(s: *const ::c_char) -> ::c_double;
2752    pub fn labs(i: ::c_long) -> ::c_long;
2753    pub fn rand() -> ::c_int;
2754    pub fn srand(seed: ::c_uint);
2755
2756    pub fn setpwent();
2757    pub fn endpwent();
2758    pub fn getpwent() -> *mut passwd;
2759    pub fn setgrent();
2760    pub fn endgrent();
2761    pub fn getgrent() -> *mut ::group;
2762    pub fn setspent();
2763    pub fn endspent();
2764
2765    pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;
2766
2767    pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
2768    pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
2769
2770    pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
2771    pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
2772    pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
2773    pub fn sigtimedwait(
2774        set: *const sigset_t,
2775        info: *mut siginfo_t,
2776        timeout: *const ::timespec,
2777    ) -> ::c_int;
2778    pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
2779    pub fn pthread_setschedprio(native: ::pthread_t, priority: ::c_int) -> ::c_int;
2780
2781    pub fn if_nameindex() -> *mut if_nameindex;
2782    pub fn if_freenameindex(ptr: *mut if_nameindex);
2783
2784    pub fn glob(
2785        pattern: *const c_char,
2786        flags: ::c_int,
2787        errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>,
2788        pglob: *mut ::glob_t,
2789    ) -> ::c_int;
2790    pub fn globfree(pglob: *mut ::glob_t);
2791
2792    pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
2793
2794    pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
2795
2796    pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
2797
2798    pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
2799
2800    pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
2801
2802    pub fn recvfrom(
2803        socket: ::c_int,
2804        buf: *mut ::c_void,
2805        len: ::size_t,
2806        flags: ::c_int,
2807        addr: *mut ::sockaddr,
2808        addrlen: *mut ::socklen_t,
2809    ) -> ::ssize_t;
2810    pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
2811
2812    pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
2813    pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
2814    pub fn sync();
2815    pub fn pthread_getschedparam(
2816        native: ::pthread_t,
2817        policy: *mut ::c_int,
2818        param: *mut ::sched_param,
2819    ) -> ::c_int;
2820    pub fn umount(target: *const ::c_char, flags: ::c_int) -> ::c_int;
2821    pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
2822    pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
2823    pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
2824    pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
2825    pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
2826    pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
2827    pub fn mount(
2828        special_device: *const ::c_char,
2829        mount_directory: *const ::c_char,
2830        flags: ::c_int,
2831        mount_type: *const ::c_char,
2832        mount_data: *const ::c_void,
2833        mount_datalen: ::c_int,
2834    ) -> ::c_int;
2835    pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
2836    pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int;
2837    pub fn pthread_mutex_timedlock(
2838        lock: *mut pthread_mutex_t,
2839        abstime: *const ::timespec,
2840    ) -> ::c_int;
2841    pub fn pthread_spin_init(lock: *mut ::pthread_spinlock_t, pshared: ::c_int) -> ::c_int;
2842    pub fn pthread_spin_destroy(lock: *mut ::pthread_spinlock_t) -> ::c_int;
2843    pub fn pthread_spin_lock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
2844    pub fn pthread_spin_trylock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
2845    pub fn pthread_spin_unlock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
2846    pub fn pthread_barrierattr_init(__attr: *mut ::pthread_barrierattr_t) -> ::c_int;
2847    pub fn pthread_barrierattr_destroy(__attr: *mut ::pthread_barrierattr_t) -> ::c_int;
2848    pub fn pthread_barrierattr_getpshared(
2849        __attr: *const ::pthread_barrierattr_t,
2850        __pshared: *mut ::c_int,
2851    ) -> ::c_int;
2852    pub fn pthread_barrierattr_setpshared(
2853        __attr: *mut ::pthread_barrierattr_t,
2854        __pshared: ::c_int,
2855    ) -> ::c_int;
2856    pub fn pthread_barrier_init(
2857        __barrier: *mut ::pthread_barrier_t,
2858        __attr: *const ::pthread_barrierattr_t,
2859        __count: ::c_uint,
2860    ) -> ::c_int;
2861    pub fn pthread_barrier_destroy(__barrier: *mut ::pthread_barrier_t) -> ::c_int;
2862    pub fn pthread_barrier_wait(__barrier: *mut ::pthread_barrier_t) -> ::c_int;
2863
2864    pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
2865    pub fn clock_nanosleep(
2866        clk_id: ::clockid_t,
2867        flags: ::c_int,
2868        rqtp: *const ::timespec,
2869        rmtp: *mut ::timespec,
2870    ) -> ::c_int;
2871    pub fn pthread_attr_getguardsize(
2872        attr: *const ::pthread_attr_t,
2873        guardsize: *mut ::size_t,
2874    ) -> ::c_int;
2875    pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
2876    pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
2877    pub fn pthread_condattr_getpshared(
2878        attr: *const pthread_condattr_t,
2879        pshared: *mut ::c_int,
2880    ) -> ::c_int;
2881    pub fn pthread_setschedparam(
2882        native: ::pthread_t,
2883        policy: ::c_int,
2884        param: *const ::sched_param,
2885    ) -> ::c_int;
2886    pub fn sched_setscheduler(
2887        pid: ::pid_t,
2888        policy: ::c_int,
2889        param: *const ::sched_param,
2890    ) -> ::c_int;
2891    pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
2892    pub fn getgrgid_r(
2893        gid: ::gid_t,
2894        grp: *mut ::group,
2895        buf: *mut ::c_char,
2896        buflen: ::size_t,
2897        result: *mut *mut ::group,
2898    ) -> ::c_int;
2899    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
2900    pub fn getdtablesize() -> ::c_int;
2901    pub fn getgrnam_r(
2902        name: *const ::c_char,
2903        grp: *mut ::group,
2904        buf: *mut ::c_char,
2905        buflen: ::size_t,
2906        result: *mut *mut ::group,
2907    ) -> ::c_int;
2908    pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
2909    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
2910    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
2911    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
2912    pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
2913    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
2914    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
2915    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
2916    pub fn getpwnam_r(
2917        name: *const ::c_char,
2918        pwd: *mut passwd,
2919        buf: *mut ::c_char,
2920        buflen: ::size_t,
2921        result: *mut *mut passwd,
2922    ) -> ::c_int;
2923    pub fn getpwuid_r(
2924        uid: ::uid_t,
2925        pwd: *mut passwd,
2926        buf: *mut ::c_char,
2927        buflen: ::size_t,
2928        result: *mut *mut passwd,
2929    ) -> ::c_int;
2930    pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
2931    pub fn pthread_atfork(
2932        prepare: ::Option<unsafe extern "C" fn()>,
2933        parent: ::Option<unsafe extern "C" fn()>,
2934        child: ::Option<unsafe extern "C" fn()>,
2935    ) -> ::c_int;
2936    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
2937    pub fn getgrouplist(
2938        user: *const ::c_char,
2939        group: ::gid_t,
2940        groups: *mut ::gid_t,
2941        ngroups: *mut ::c_int,
2942    ) -> ::c_int;
2943    pub fn pthread_mutexattr_getpshared(
2944        attr: *const pthread_mutexattr_t,
2945        pshared: *mut ::c_int,
2946    ) -> ::c_int;
2947    pub fn pthread_mutexattr_getrobust(
2948        attr: *const pthread_mutexattr_t,
2949        robustness: *mut ::c_int,
2950    ) -> ::c_int;
2951    pub fn pthread_mutexattr_setrobust(
2952        attr: *mut pthread_mutexattr_t,
2953        robustness: ::c_int,
2954    ) -> ::c_int;
2955    pub fn pthread_create(
2956        native: *mut ::pthread_t,
2957        attr: *const ::pthread_attr_t,
2958        f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
2959        value: *mut ::c_void,
2960    ) -> ::c_int;
2961    pub fn getitimer(which: ::c_int, curr_value: *mut ::itimerval) -> ::c_int;
2962    pub fn setitimer(
2963        which: ::c_int,
2964        value: *const ::itimerval,
2965        ovalue: *mut ::itimerval,
2966    ) -> ::c_int;
2967    pub fn posix_spawn(
2968        pid: *mut ::pid_t,
2969        path: *const ::c_char,
2970        file_actions: *const ::posix_spawn_file_actions_t,
2971        attrp: *const ::posix_spawnattr_t,
2972        argv: *const *mut ::c_char,
2973        envp: *const *mut ::c_char,
2974    ) -> ::c_int;
2975    pub fn posix_spawnp(
2976        pid: *mut ::pid_t,
2977        file: *const ::c_char,
2978        file_actions: *const ::posix_spawn_file_actions_t,
2979        attrp: *const ::posix_spawnattr_t,
2980        argv: *const *mut ::c_char,
2981        envp: *const *mut ::c_char,
2982    ) -> ::c_int;
2983    pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
2984    pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
2985    pub fn posix_spawnattr_getsigdefault(
2986        attr: *const posix_spawnattr_t,
2987        default: *mut ::sigset_t,
2988    ) -> ::c_int;
2989    pub fn posix_spawnattr_setsigdefault(
2990        attr: *mut posix_spawnattr_t,
2991        default: *const ::sigset_t,
2992    ) -> ::c_int;
2993    pub fn posix_spawnattr_getsigmask(
2994        attr: *const posix_spawnattr_t,
2995        default: *mut ::sigset_t,
2996    ) -> ::c_int;
2997    pub fn posix_spawnattr_setsigmask(
2998        attr: *mut posix_spawnattr_t,
2999        default: *const ::sigset_t,
3000    ) -> ::c_int;
3001    pub fn posix_spawnattr_getflags(
3002        attr: *const posix_spawnattr_t,
3003        flags: *mut ::c_short,
3004    ) -> ::c_int;
3005    pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
3006    pub fn posix_spawnattr_getpgroup(
3007        attr: *const posix_spawnattr_t,
3008        flags: *mut ::pid_t,
3009    ) -> ::c_int;
3010    pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int;
3011    pub fn posix_spawnattr_getschedpolicy(
3012        attr: *const posix_spawnattr_t,
3013        flags: *mut ::c_int,
3014    ) -> ::c_int;
3015    pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int;
3016    pub fn posix_spawnattr_getschedparam(
3017        attr: *const posix_spawnattr_t,
3018        param: *mut ::sched_param,
3019    ) -> ::c_int;
3020    pub fn posix_spawnattr_setschedparam(
3021        attr: *mut posix_spawnattr_t,
3022        param: *const ::sched_param,
3023    ) -> ::c_int;
3024
3025    pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
3026    pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
3027    pub fn posix_spawn_file_actions_addopen(
3028        actions: *mut posix_spawn_file_actions_t,
3029        fd: ::c_int,
3030        path: *const ::c_char,
3031        oflag: ::c_int,
3032        mode: ::mode_t,
3033    ) -> ::c_int;
3034    pub fn posix_spawn_file_actions_addclose(
3035        actions: *mut posix_spawn_file_actions_t,
3036        fd: ::c_int,
3037    ) -> ::c_int;
3038    pub fn posix_spawn_file_actions_adddup2(
3039        actions: *mut posix_spawn_file_actions_t,
3040        fd: ::c_int,
3041        newfd: ::c_int,
3042    ) -> ::c_int;
3043    pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
3044    pub fn faccessat(
3045        dirfd: ::c_int,
3046        pathname: *const ::c_char,
3047        mode: ::c_int,
3048        flags: ::c_int,
3049    ) -> ::c_int;
3050    pub fn inotify_rm_watch(fd: ::c_int, wd: ::c_int) -> ::c_int;
3051    pub fn inotify_init() -> ::c_int;
3052    pub fn inotify_add_watch(fd: ::c_int, path: *const ::c_char, mask: u32) -> ::c_int;
3053
3054    pub fn gettid() -> ::pid_t;
3055
3056    pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int;
3057
3058    pub fn getnameinfo(
3059        sa: *const ::sockaddr,
3060        salen: ::socklen_t,
3061        host: *mut ::c_char,
3062        hostlen: ::socklen_t,
3063        serv: *mut ::c_char,
3064        sevlen: ::socklen_t,
3065        flags: ::c_int,
3066    ) -> ::c_int;
3067
3068    pub fn sendmmsg(
3069        sockfd: ::c_int,
3070        msgvec: *mut ::mmsghdr,
3071        vlen: ::c_uint,
3072        flags: ::c_uint,
3073    ) -> ::c_int;
3074    pub fn recvmmsg(
3075        sockfd: ::c_int,
3076        msgvec: *mut ::mmsghdr,
3077        vlen: ::c_uint,
3078        flags: ::c_uint,
3079        timeout: *mut ::timespec,
3080    ) -> ::c_int;
3081
3082    pub fn mallopt(param: ::c_int, value: i64) -> ::c_int;
3083    pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
3084
3085    pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;
3086    pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
3087
3088    pub fn mallinfo() -> ::mallinfo;
3089    pub fn getpwent_r(
3090        pwd: *mut ::passwd,
3091        buf: *mut ::c_char,
3092        __bufsize: ::c_int,
3093        __result: *mut *mut ::passwd,
3094    ) -> ::c_int;
3095    pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::c_int) -> ::c_int;
3096    pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
3097
3098    pub fn sysctl(
3099        _: *const ::c_int,
3100        _: ::c_uint,
3101        _: *mut ::c_void,
3102        _: *mut ::size_t,
3103        _: *const ::c_void,
3104        _: ::size_t,
3105    ) -> ::c_int;
3106
3107    pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
3108    pub fn setrlimit(resource: ::c_int, rlp: *const ::rlimit) -> ::c_int;
3109
3110    pub fn lio_listio(
3111        __mode: ::c_int,
3112        __list: *const *mut aiocb,
3113        __nent: ::c_int,
3114        __sig: *mut sigevent,
3115    ) -> ::c_int;
3116
3117    pub fn dl_iterate_phdr(
3118        callback: ::Option<
3119            unsafe extern "C" fn(
3120                info: *const dl_phdr_info,
3121                size: ::size_t,
3122                data: *mut ::c_void,
3123            ) -> ::c_int,
3124        >,
3125        data: *mut ::c_void,
3126    ) -> ::c_int;
3127
3128    pub fn memset_s(s: *mut ::c_void, smax: ::size_t, c: ::c_int, n: ::size_t) -> ::c_int;
3129
3130    pub fn regcomp(
3131        __preg: *mut ::regex_t,
3132        __pattern: *const ::c_char,
3133        __cflags: ::c_int,
3134    ) -> ::c_int;
3135    pub fn regexec(
3136        __preg: *const ::regex_t,
3137        __str: *const ::c_char,
3138        __nmatch: ::size_t,
3139        __pmatch: *mut ::regmatch_t,
3140        __eflags: ::c_int,
3141    ) -> ::c_int;
3142    pub fn regerror(
3143        __errcode: ::c_int,
3144        __preg: *const ::regex_t,
3145        __errbuf: *mut ::c_char,
3146        __errbuf_size: ::size_t,
3147    ) -> ::size_t;
3148    pub fn regfree(__preg: *mut ::regex_t);
3149    pub fn dirfd(__dirp: *mut ::DIR) -> ::c_int;
3150    pub fn dircntl(dir: *mut ::DIR, cmd: ::c_int, ...) -> ::c_int;
3151
3152    pub fn aio_cancel(__fd: ::c_int, __aiocbp: *mut ::aiocb) -> ::c_int;
3153    pub fn aio_error(__aiocbp: *const ::aiocb) -> ::c_int;
3154    pub fn aio_fsync(__operation: ::c_int, __aiocbp: *mut ::aiocb) -> ::c_int;
3155    pub fn aio_read(__aiocbp: *mut ::aiocb) -> ::c_int;
3156    pub fn aio_return(__aiocpb: *mut ::aiocb) -> ::ssize_t;
3157    pub fn aio_suspend(
3158        __list: *const *const ::aiocb,
3159        __nent: ::c_int,
3160        __timeout: *const ::timespec,
3161    ) -> ::c_int;
3162    pub fn aio_write(__aiocpb: *mut ::aiocb) -> ::c_int;
3163
3164    pub fn mq_close(__mqdes: ::mqd_t) -> ::c_int;
3165    pub fn mq_getattr(__mqdes: ::mqd_t, __mqstat: *mut ::mq_attr) -> ::c_int;
3166    pub fn mq_notify(__mqdes: ::mqd_t, __notification: *const ::sigevent) -> ::c_int;
3167    pub fn mq_open(__name: *const ::c_char, __oflag: ::c_int, ...) -> ::mqd_t;
3168    pub fn mq_receive(
3169        __mqdes: ::mqd_t,
3170        __msg_ptr: *mut ::c_char,
3171        __msg_len: ::size_t,
3172        __msg_prio: *mut ::c_uint,
3173    ) -> ::ssize_t;
3174    pub fn mq_send(
3175        __mqdes: ::mqd_t,
3176        __msg_ptr: *const ::c_char,
3177        __msg_len: ::size_t,
3178        __msg_prio: ::c_uint,
3179    ) -> ::c_int;
3180    pub fn mq_setattr(
3181        __mqdes: ::mqd_t,
3182        __mqstat: *const mq_attr,
3183        __omqstat: *mut mq_attr,
3184    ) -> ::c_int;
3185    pub fn mq_timedreceive(
3186        __mqdes: ::mqd_t,
3187        __msg_ptr: *mut ::c_char,
3188        __msg_len: ::size_t,
3189        __msg_prio: *mut ::c_uint,
3190        __abs_timeout: *const ::timespec,
3191    ) -> ::ssize_t;
3192    pub fn mq_timedsend(
3193        __mqdes: ::mqd_t,
3194        __msg_ptr: *const ::c_char,
3195        __msg_len: ::size_t,
3196        __msg_prio: ::c_uint,
3197        __abs_timeout: *const ::timespec,
3198    ) -> ::c_int;
3199    pub fn mq_unlink(__name: *const ::c_char) -> ::c_int;
3200    pub fn __get_errno_ptr() -> *mut ::c_int;
3201
3202    // System page, see https://www.qnx.com/developers/docs/7.1#com.qnx.doc.neutrino.building/topic/syspage/syspage_about.html
3203    pub static mut _syspage_ptr: *mut syspage_entry;
3204
3205    // Function on the stack after a call to pthread_create().  This is used
3206    // as a sentinel to work around an infitnite loop in the unwinding code.
3207    pub fn __my_thread_exit(value_ptr: *mut *const ::c_void);
3208}
3209
3210// Models the implementation in stdlib.h.  Ctest will fail if trying to use the
3211// default symbol from libc
3212pub unsafe fn atexit(cb: extern "C" fn()) -> ::c_int {
3213    extern "C" {
3214        static __dso_handle: *mut ::c_void;
3215        pub fn __cxa_atexit(
3216            cb: extern "C" fn(),
3217            __arg: *mut ::c_void,
3218            __dso: *mut ::c_void,
3219        ) -> ::c_int;
3220    }
3221    __cxa_atexit(cb, 0 as *mut ::c_void, __dso_handle)
3222}
3223
3224impl siginfo_t {
3225    pub unsafe fn si_addr(&self) -> *mut ::c_void {
3226        #[repr(C)]
3227        struct siginfo_si_addr {
3228            _pad: [u8; 32],
3229            si_addr: *mut ::c_void,
3230        }
3231        (*(self as *const siginfo_t as *const siginfo_si_addr)).si_addr
3232    }
3233
3234    pub unsafe fn si_value(&self) -> ::sigval {
3235        #[repr(C)]
3236        struct siginfo_si_value {
3237            _pad: [u8; 32],
3238            si_value: ::sigval,
3239        }
3240        (*(self as *const siginfo_t as *const siginfo_si_value)).si_value
3241    }
3242
3243    pub unsafe fn si_pid(&self) -> ::pid_t {
3244        #[repr(C)]
3245        struct siginfo_si_pid {
3246            _pad: [u8; 16],
3247            si_pid: ::pid_t,
3248        }
3249        (*(self as *const siginfo_t as *const siginfo_si_pid)).si_pid
3250    }
3251
3252    pub unsafe fn si_uid(&self) -> ::uid_t {
3253        #[repr(C)]
3254        struct siginfo_si_uid {
3255            _pad: [u8; 24],
3256            si_uid: ::uid_t,
3257        }
3258        (*(self as *const siginfo_t as *const siginfo_si_uid)).si_uid
3259    }
3260
3261    pub unsafe fn si_status(&self) -> ::c_int {
3262        #[repr(C)]
3263        struct siginfo_si_status {
3264            _pad: [u8; 28],
3265            si_status: ::c_int,
3266        }
3267        (*(self as *const siginfo_t as *const siginfo_si_status)).si_status
3268    }
3269}
3270
3271cfg_if! {
3272    if #[cfg(target_arch = "x86_64")] {
3273        mod x86_64;
3274        pub use self::x86_64::*;
3275    }
3276    else if #[cfg(target_arch = "aarch64")] {
3277        mod aarch64;
3278        pub use self::aarch64::*;
3279    }
3280    else {
3281        panic!("Unsupported arch");
3282    }
3283}
3284
3285mod neutrino;
3286pub use self::neutrino::*;
3287