1 //! Apple (ios/darwin)-specific definitions
2 //!
3 //! This covers *-apple-* triples currently
4 pub type c_char = i8;
5 pub type clock_t = c_ulong;
6 pub type time_t = c_long;
7 pub type suseconds_t = i32;
8 pub type dev_t = i32;
9 pub type ino_t = u64;
10 pub type mode_t = u16;
11 pub type nlink_t = u16;
12 pub type blksize_t = i32;
13 pub type rlim_t = u64;
14 pub type mach_timebase_info_data_t = mach_timebase_info;
15 pub type pthread_key_t = c_ulong;
16 pub type sigset_t = u32;
17 pub type clockid_t = ::c_uint;
18 pub type fsblkcnt_t = ::c_uint;
19 pub type fsfilcnt_t = ::c_uint;
20 pub type speed_t = ::c_ulong;
21 pub type tcflag_t = ::c_ulong;
22 pub type nl_item = ::c_int;
23 pub type id_t = ::c_uint;
24 pub type sem_t = ::c_int;
25 pub type idtype_t = ::c_uint;
26 pub type integer_t = ::c_int;
27 pub type cpu_type_t = integer_t;
28 pub type cpu_subtype_t = integer_t;
29 pub type vm_prot_t = ::c_int;
30 pub type posix_spawnattr_t = *mut ::c_void;
31 pub type posix_spawn_file_actions_t = *mut ::c_void;
32 pub type key_t = ::c_int;
33 pub type shmatt_t = ::c_ushort;
34 
35 #[cfg_attr(feature = "extra_traits", derive(Debug))]
36 pub enum timezone {}
37 impl ::Copy for timezone {}
38 impl ::Clone for timezone {
clone(&self) -> timezone39     fn clone(&self) -> timezone { *self }
40 }
41 
42 s! {
43     pub struct ip_mreq {
44         pub imr_multiaddr: in_addr,
45         pub imr_interface: in_addr,
46     }
47 
48     pub struct aiocb {
49         pub aio_fildes: ::c_int,
50         pub aio_offset: ::off_t,
51         pub aio_buf: *mut ::c_void,
52         pub aio_nbytes: ::size_t,
53         pub aio_reqprio: ::c_int,
54         pub aio_sigevent: sigevent,
55         pub aio_lio_opcode: ::c_int
56     }
57 
58     pub struct glob_t {
59         pub gl_pathc:  ::size_t,
60         __unused1: ::c_int,
61         pub gl_offs:   ::size_t,
62         __unused2: ::c_int,
63         pub gl_pathv:  *mut *mut ::c_char,
64 
65         __unused3: *mut ::c_void,
66 
67         __unused4: *mut ::c_void,
68         __unused5: *mut ::c_void,
69         __unused6: *mut ::c_void,
70         __unused7: *mut ::c_void,
71         __unused8: *mut ::c_void,
72     }
73 
74     pub struct addrinfo {
75         pub ai_flags: ::c_int,
76         pub ai_family: ::c_int,
77         pub ai_socktype: ::c_int,
78         pub ai_protocol: ::c_int,
79         pub ai_addrlen: ::socklen_t,
80         pub ai_canonname: *mut ::c_char,
81         pub ai_addr: *mut ::sockaddr,
82         pub ai_next: *mut addrinfo,
83     }
84 
85     pub struct mach_timebase_info {
86         pub numer: u32,
87         pub denom: u32,
88     }
89 
90     pub struct stat {
91         pub st_dev: dev_t,
92         pub st_mode: mode_t,
93         pub st_nlink: nlink_t,
94         pub st_ino: ino_t,
95         pub st_uid: ::uid_t,
96         pub st_gid: ::gid_t,
97         pub st_rdev: dev_t,
98         pub st_atime: time_t,
99         pub st_atime_nsec: c_long,
100         pub st_mtime: time_t,
101         pub st_mtime_nsec: c_long,
102         pub st_ctime: time_t,
103         pub st_ctime_nsec: c_long,
104         pub st_birthtime: time_t,
105         pub st_birthtime_nsec: c_long,
106         pub st_size: ::off_t,
107         pub st_blocks: ::blkcnt_t,
108         pub st_blksize: blksize_t,
109         pub st_flags: ::uint32_t,
110         pub st_gen: ::uint32_t,
111         pub st_lspare: ::int32_t,
112         pub st_qspare: [::int64_t; 2],
113     }
114 
115     pub struct pthread_mutexattr_t {
116         __sig: ::c_long,
117         __opaque: [u8; 8],
118     }
119 
120     pub struct pthread_condattr_t {
121         __sig: ::c_long,
122         __opaque: [u8; __PTHREAD_CONDATTR_SIZE__],
123     }
124 
125     pub struct pthread_rwlockattr_t {
126         __sig: ::c_long,
127         __opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
128     }
129 
130     pub struct siginfo_t {
131         pub si_signo: ::c_int,
132         pub si_errno: ::c_int,
133         pub si_code: ::c_int,
134         pub si_pid: ::pid_t,
135         pub si_uid: ::uid_t,
136         pub si_status: ::c_int,
137         pub si_addr: *mut ::c_void,
138         _pad: [usize; 9],
139     }
140 
141     pub struct sigaction {
142         // FIXME: this field is actually a union
143         pub sa_sigaction: ::sighandler_t,
144         pub sa_mask: sigset_t,
145         pub sa_flags: ::c_int,
146     }
147 
148     pub struct stack_t {
149         pub ss_sp: *mut ::c_void,
150         pub ss_size: ::size_t,
151         pub ss_flags: ::c_int,
152     }
153 
154     pub struct fstore_t {
155         pub fst_flags: ::c_uint,
156         pub fst_posmode: ::c_int,
157         pub fst_offset: ::off_t,
158         pub fst_length: ::off_t,
159         pub fst_bytesalloc: ::off_t,
160     }
161 
162     pub struct radvisory {
163         pub ra_offset: ::off_t,
164         pub ra_count: ::c_int,
165     }
166 
167     pub struct statvfs {
168         pub f_bsize: ::c_ulong,
169         pub f_frsize: ::c_ulong,
170         pub f_blocks: ::fsblkcnt_t,
171         pub f_bfree: ::fsblkcnt_t,
172         pub f_bavail: ::fsblkcnt_t,
173         pub f_files: ::fsfilcnt_t,
174         pub f_ffree: ::fsfilcnt_t,
175         pub f_favail: ::fsfilcnt_t,
176         pub f_fsid: ::c_ulong,
177         pub f_flag: ::c_ulong,
178         pub f_namemax: ::c_ulong,
179     }
180 
181     pub struct Dl_info {
182         pub dli_fname: *const ::c_char,
183         pub dli_fbase: *mut ::c_void,
184         pub dli_sname: *const ::c_char,
185         pub dli_saddr: *mut ::c_void,
186     }
187 
188     pub struct sockaddr_in {
189         pub sin_len: u8,
190         pub sin_family: ::sa_family_t,
191         pub sin_port: ::in_port_t,
192         pub sin_addr: ::in_addr,
193         pub sin_zero: [::c_char; 8],
194     }
195 
196     pub struct kevent64_s {
197         pub ident: ::uint64_t,
198         pub filter: ::int16_t,
199         pub flags: ::uint16_t,
200         pub fflags: ::uint32_t,
201         pub data: ::int64_t,
202         pub udata: ::uint64_t,
203         pub ext: [::uint64_t; 2],
204     }
205 
206     pub struct dqblk {
207         pub dqb_bhardlimit: ::uint64_t,
208         pub dqb_bsoftlimit: ::uint64_t,
209         pub dqb_curbytes: ::uint64_t,
210         pub dqb_ihardlimit: ::uint32_t,
211         pub dqb_isoftlimit: ::uint32_t,
212         pub dqb_curinodes: ::uint32_t,
213         pub dqb_btime: ::uint32_t,
214         pub dqb_itime: ::uint32_t,
215         pub dqb_id: ::uint32_t,
216         pub dqb_spare: [::uint32_t; 4],
217     }
218 
219     pub struct if_msghdr {
220         pub ifm_msglen: ::c_ushort,
221         pub ifm_version: ::c_uchar,
222         pub ifm_type: ::c_uchar,
223         pub ifm_addrs: ::c_int,
224         pub ifm_flags: ::c_int,
225         pub ifm_index: ::c_ushort,
226         pub ifm_data: if_data,
227     }
228 
229     pub struct termios {
230         pub c_iflag: ::tcflag_t,
231         pub c_oflag: ::tcflag_t,
232         pub c_cflag: ::tcflag_t,
233         pub c_lflag: ::tcflag_t,
234         pub c_cc: [::cc_t; ::NCCS],
235         pub c_ispeed: ::speed_t,
236         pub c_ospeed: ::speed_t,
237     }
238 
239     pub struct flock {
240         pub l_start: ::off_t,
241         pub l_len: ::off_t,
242         pub l_pid: ::pid_t,
243         pub l_type: ::c_short,
244         pub l_whence: ::c_short,
245     }
246 
247     pub struct sf_hdtr {
248         pub headers: *mut ::iovec,
249         pub hdr_cnt: ::c_int,
250         pub trailers: *mut ::iovec,
251         pub trl_cnt: ::c_int,
252     }
253 
254     pub struct lconv {
255         pub decimal_point: *mut ::c_char,
256         pub thousands_sep: *mut ::c_char,
257         pub grouping: *mut ::c_char,
258         pub int_curr_symbol: *mut ::c_char,
259         pub currency_symbol: *mut ::c_char,
260         pub mon_decimal_point: *mut ::c_char,
261         pub mon_thousands_sep: *mut ::c_char,
262         pub mon_grouping: *mut ::c_char,
263         pub positive_sign: *mut ::c_char,
264         pub negative_sign: *mut ::c_char,
265         pub int_frac_digits: ::c_char,
266         pub frac_digits: ::c_char,
267         pub p_cs_precedes: ::c_char,
268         pub p_sep_by_space: ::c_char,
269         pub n_cs_precedes: ::c_char,
270         pub n_sep_by_space: ::c_char,
271         pub p_sign_posn: ::c_char,
272         pub n_sign_posn: ::c_char,
273         pub int_p_cs_precedes: ::c_char,
274         pub int_n_cs_precedes: ::c_char,
275         pub int_p_sep_by_space: ::c_char,
276         pub int_n_sep_by_space: ::c_char,
277         pub int_p_sign_posn: ::c_char,
278         pub int_n_sign_posn: ::c_char,
279     }
280 
281     pub struct sigevent {
282         pub sigev_notify: ::c_int,
283         pub sigev_signo: ::c_int,
284         pub sigev_value: ::sigval,
285         __unused1: *mut ::c_void,       //actually a function pointer
286         pub sigev_notify_attributes: *mut ::pthread_attr_t
287     }
288 
289     pub struct proc_taskinfo {
290         pub pti_virtual_size: u64,
291         pub pti_resident_size: u64,
292         pub pti_total_user: u64,
293         pub pti_total_system: u64,
294         pub pti_threads_user: u64,
295         pub pti_threads_system: u64,
296         pub pti_policy: i32,
297         pub pti_faults: i32,
298         pub pti_pageins: i32,
299         pub pti_cow_faults: i32,
300         pub pti_messages_sent: i32,
301         pub pti_messages_received: i32,
302         pub pti_syscalls_mach: i32,
303         pub pti_syscalls_unix: i32,
304         pub pti_csw: i32,
305         pub pti_threadnum: i32,
306         pub pti_numrunning: i32,
307         pub pti_priority: i32,
308     }
309 
310     pub struct proc_bsdinfo {
311         pub pbi_flags: u32,
312         pub pbi_status: u32,
313         pub pbi_xstatus: u32,
314         pub pbi_pid: u32,
315         pub pbi_ppid: u32,
316         pub pbi_uid: ::uid_t,
317         pub pbi_gid: ::gid_t,
318         pub pbi_ruid: ::uid_t,
319         pub pbi_rgid: ::gid_t,
320         pub pbi_svuid: ::uid_t,
321         pub pbi_svgid: ::gid_t,
322         pub rfu_1: u32,
323         pub pbi_comm: [::c_char; MAXCOMLEN],
324         pub pbi_name: [::c_char; 32], // MAXCOMLEN * 2, but macro isn't happy...
325         pub pbi_nfiles: u32,
326         pub pbi_pgid: u32,
327         pub pbi_pjobc: u32,
328         pub e_tdev: u32,
329         pub e_tpgid: u32,
330         pub pbi_nice: i32,
331         pub pbi_start_tvsec: u64,
332         pub pbi_start_tvusec: u64,
333     }
334 
335     pub struct proc_taskallinfo {
336         pub pbsd: proc_bsdinfo,
337         pub ptinfo: proc_taskinfo,
338     }
339 
340     pub struct xsw_usage {
341         pub xsu_total: u64,
342         pub xsu_avail: u64,
343         pub xsu_used: u64,
344         pub xsu_pagesize: u32,
345         pub xsu_encrypted: ::boolean_t,
346     }
347 
348     pub struct xucred {
349         pub cr_version: ::c_uint,
350         pub cr_uid: ::uid_t,
351         pub cr_ngroups: ::c_short,
352         pub cr_groups: [::gid_t;16]
353     }
354 
355     pub struct mach_header {
356         pub magic: u32,
357         pub cputype: cpu_type_t,
358         pub cpusubtype: cpu_subtype_t,
359         pub filetype: u32,
360         pub ncmds: u32,
361         pub sizeofcmds: u32,
362         pub flags: u32,
363     }
364 
365     pub struct mach_header_64 {
366         pub magic: u32,
367         pub cputype: cpu_type_t,
368         pub cpusubtype: cpu_subtype_t,
369         pub filetype: u32,
370         pub ncmds: u32,
371         pub sizeofcmds: u32,
372         pub flags: u32,
373         pub reserved: u32,
374     }
375 
376     pub struct segment_command {
377         pub cmd: u32,
378         pub cmdsize: u32,
379         pub segname: [::c_char; 16],
380         pub vmaddr: u32,
381         pub vmsize: u32,
382         pub fileoff: u32,
383         pub filesize: u32,
384         pub maxprot: vm_prot_t,
385         pub initprot: vm_prot_t,
386         pub nsects: u32,
387         pub flags: u32,
388     }
389 
390     pub struct segment_command_64 {
391         pub cmd: u32,
392         pub cmdsize: u32,
393         pub segname: [::c_char; 16],
394         pub vmaddr: u64,
395         pub vmsize: u64,
396         pub fileoff: u64,
397         pub filesize: u64,
398         pub maxprot: vm_prot_t,
399         pub initprot: vm_prot_t,
400         pub nsects: u32,
401         pub flags: u32,
402     }
403 
404     pub struct load_command {
405         pub cmd: u32,
406         pub cmdsize: u32,
407     }
408 
409     pub struct sockaddr_dl {
410         pub sdl_len: ::c_uchar,
411         pub sdl_family: ::c_uchar,
412         pub sdl_index: ::c_ushort,
413         pub sdl_type: ::c_uchar,
414         pub sdl_nlen: ::c_uchar,
415         pub sdl_alen: ::c_uchar,
416         pub sdl_slen: ::c_uchar,
417         pub sdl_data: [::c_char; 12],
418     }
419 
420     pub struct sockaddr_inarp {
421         pub sin_len: ::c_uchar,
422         pub sin_family: ::c_uchar,
423         pub sin_port: ::c_ushort,
424         pub sin_addr: ::in_addr,
425         pub sin_srcaddr: ::in_addr,
426         pub sin_tos: ::c_ushort,
427         pub sin_other: ::c_ushort,
428     }
429 
430     pub struct sockaddr_ctl {
431         pub sc_len: ::c_uchar,
432         pub sc_family: ::c_uchar,
433         pub ss_sysaddr: ::uint16_t,
434         pub sc_id: ::uint32_t,
435         pub sc_unit: ::uint32_t,
436         pub sc_reserved: [::uint32_t; 5],
437     }
438 
439     pub struct in_pktinfo {
440         pub ipi_ifindex: ::c_uint,
441         pub ipi_spec_dst: ::in_addr,
442         pub ipi_addr: ::in_addr,
443     }
444 
445     pub struct in6_pktinfo {
446         pub ipi6_addr: ::in6_addr,
447         pub ipi6_ifindex: ::c_uint,
448     }
449 
450     // sys/ipc.h:
451 
452     pub struct ipc_perm {
453         pub uid: ::uid_t,
454         pub gid: ::gid_t,
455         pub cuid: ::uid_t,
456         pub cgid: ::gid_t,
457         pub mode: ::mode_t,
458         pub _seq: ::c_ushort,
459         pub _key: ::key_t,
460     }
461 
462     // sys/sem.h
463 
464     pub struct sembuf {
465         pub sem_num: ::c_ushort,
466         pub sem_op: ::c_short,
467         pub sem_flg: ::c_short,
468     }
469 
470     // sys/shm.h
471 
472     pub struct arphdr {
473         pub ar_hrd: u16,
474         pub ar_pro: u16,
475         pub ar_hln: u8,
476         pub ar_pln: u8,
477         pub ar_op: u16,
478     }
479 
480     pub struct in_addr {
481         pub s_addr: ::in_addr_t,
482     }
483 }
484 
485 s_no_extra_traits!{
486     // FIXME: https://github.com/rust-lang/libc/issues/1243
487     #[allow(missing_debug_implementations)]
488     #[cfg_attr(libc_packedN, repr(packed(4)))]
489     pub struct kevent {
490         pub ident: ::uintptr_t,
491         pub filter: ::int16_t,
492         pub flags: ::uint16_t,
493         pub fflags: ::uint32_t,
494         pub data: ::intptr_t,
495         pub udata: *mut ::c_void,
496     }
497 
498     // FIXME: https://github.com/rust-lang/libc/issues/1243
499     #[allow(missing_debug_implementations)]
500     #[cfg_attr(libc_packedN, repr(packed(4)))]
501     pub struct semid_ds {
502         // Note the manpage shows different types than the system header.
503         pub sem_perm: ipc_perm,
504         pub sem_base: ::int32_t,
505         pub sem_nsems: ::c_ushort,
506         pub sem_otime: ::time_t,
507         pub sem_pad1: ::int32_t,
508         pub sem_ctime: ::time_t,
509         pub sem_pad2: ::int32_t,
510         pub sem_pad3: [::int32_t; 4],
511     }
512 
513     // FIXME: https://github.com/rust-lang/libc/issues/1243
514     #[allow(missing_debug_implementations)]
515     #[cfg_attr(libc_packedN, repr(packed(4)))]
516     pub struct shmid_ds {
517         pub shm_perm: ipc_perm,
518         pub shm_segsz: ::size_t,
519         pub shm_lpid: ::pid_t,
520         pub shm_cpid: ::pid_t,
521         pub shm_nattch: ::shmatt_t,
522         pub shm_atime: ::time_t,  // FIXME: 64-bit wrong align => wrong offset
523         pub shm_dtime: ::time_t,  // FIXME: 64-bit wrong align => wrong offset
524         pub shm_ctime: ::time_t,  // FIXME: 64-bit wrong align => wrong offset
525         // FIXME: 64-bit wrong align => wrong offset:
526         pub shm_internal: *mut ::c_void,
527     }
528 
529     pub struct proc_threadinfo {
530         pub pth_user_time: u64,
531         pub pth_system_time: u64,
532         pub pth_cpu_usage: i32,
533         pub pth_policy: i32,
534         pub pth_run_state: i32,
535         pub pth_flags: i32,
536         pub pth_sleep_time: i32,
537         pub pth_curpri: i32,
538         pub pth_priority: i32,
539         pub pth_maxpriority: i32,
540         pub pth_name: [::c_char; MAXTHREADNAMESIZE],
541     }
542 
543     pub struct statfs {
544         pub f_bsize: ::uint32_t,
545         pub f_iosize: ::int32_t,
546         pub f_blocks: ::uint64_t,
547         pub f_bfree: ::uint64_t,
548         pub f_bavail: ::uint64_t,
549         pub f_files: ::uint64_t,
550         pub f_ffree: ::uint64_t,
551         pub f_fsid: ::fsid_t,
552         pub f_owner: ::uid_t,
553         pub f_type: ::uint32_t,
554         pub f_flags: ::uint32_t,
555         pub f_fssubtype: ::uint32_t,
556         pub f_fstypename: [::c_char; 16],
557         pub f_mntonname: [::c_char; 1024],
558         pub f_mntfromname: [::c_char; 1024],
559         pub f_reserved: [::uint32_t; 8],
560     }
561 
562     pub struct dirent {
563         pub d_ino: u64,
564         pub d_seekoff: u64,
565         pub d_reclen: u16,
566         pub d_namlen: u16,
567         pub d_type: u8,
568         pub d_name: [::c_char; 1024],
569     }
570 
571     pub struct pthread_rwlock_t {
572         __sig: ::c_long,
573         __opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
574     }
575 
576     pub struct pthread_mutex_t {
577         __sig: ::c_long,
578         __opaque: [u8; __PTHREAD_MUTEX_SIZE__],
579     }
580 
581     pub struct pthread_cond_t {
582         __sig: ::c_long,
583         __opaque: [u8; __PTHREAD_COND_SIZE__],
584     }
585 
586     pub struct sockaddr_storage {
587         pub ss_len: u8,
588         pub ss_family: ::sa_family_t,
589         __ss_pad1: [u8; 6],
590         __ss_align: i64,
591         __ss_pad2: [u8; 112],
592     }
593 
594     pub struct utmpx {
595         pub ut_user: [::c_char; _UTX_USERSIZE],
596         pub ut_id: [::c_char; _UTX_IDSIZE],
597         pub ut_line: [::c_char; _UTX_LINESIZE],
598         pub ut_pid: ::pid_t,
599         pub ut_type: ::c_short,
600         pub ut_tv: ::timeval,
601         pub ut_host: [::c_char; _UTX_HOSTSIZE],
602         ut_pad: [::uint32_t; 16],
603     }
604 }
605 
606 cfg_if! {
607     if #[cfg(libc_union)] {
608         s_no_extra_traits! {
609             pub union semun {
610                 pub val: ::c_int,
611                 pub buf: *mut semid_ds,
612                 pub array: *mut ::c_ushort,
613             }
614         }
615 
616         cfg_if! {
617             if #[cfg(feature = "extra_traits")] {
618                 impl PartialEq for semun {
619                     fn eq(&self, other: &semun) -> bool {
620                         unsafe { self.val == other.val }
621                     }
622                 }
623                 impl Eq for semun {}
624                 impl ::fmt::Debug for semun {
625                     fn fmt(&self, f: &mut ::fmt::Formatter)
626                            -> ::fmt::Result {
627                         f.debug_struct("semun")
628                             .field("val", unsafe { &self.val })
629                             .finish()
630                     }
631                 }
632                 impl ::hash::Hash for semun {
633                     fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
634                         unsafe { self.val.hash(state) };
635                     }
636                 }
637             }
638         }
639     }
640 }
641 
642 cfg_if! {
643     if #[cfg(feature = "extra_traits")] {
644         impl PartialEq for proc_threadinfo {
645             fn eq(&self, other: &proc_threadinfo) -> bool {
646                 self.pth_user_time == other.pth_user_time
647                     && self.pth_system_time == other.pth_system_time
648                     && self.pth_cpu_usage == other.pth_cpu_usage
649                     && self.pth_policy == other.pth_policy
650                     && self.pth_run_state == other.pth_run_state
651                     && self.pth_flags == other.pth_flags
652                     && self.pth_sleep_time == other.pth_sleep_time
653                     && self.pth_curpri == other.pth_curpri
654                     && self.pth_priority == other.pth_priority
655                     && self.pth_maxpriority == other.pth_maxpriority
656                     && self.pth_name
657                            .iter()
658                            .zip(other.pth_name.iter())
659                            .all(|(a,b)| a == b)
660             }
661         }
662         impl Eq for proc_threadinfo {}
663         impl ::fmt::Debug for proc_threadinfo {
664             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
665                 f.debug_struct("proc_threadinfo")
666                     .field("pth_user_time", &self.pth_user_time)
667                     .field("pth_system_time", &self.pth_system_time)
668                     .field("pth_cpu_usage", &self.pth_cpu_usage)
669                     .field("pth_policy", &self.pth_policy)
670                     .field("pth_run_state", &self.pth_run_state)
671                     .field("pth_flags", &self.pth_flags)
672                     .field("pth_sleep_time", &self.pth_sleep_time)
673                     .field("pth_curpri", &self.pth_curpri)
674                     .field("pth_priority", &self.pth_priority)
675                     .field("pth_maxpriority", &self.pth_maxpriority)
676                       // FIXME: .field("pth_name", &self.pth_name)
677                     .finish()
678             }
679         }
680 
681         impl ::hash::Hash for proc_threadinfo {
682             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
683                 self.pth_user_time.hash(state);
684                 self.pth_system_time.hash(state);
685                 self.pth_cpu_usage.hash(state);
686                 self.pth_policy.hash(state);
687                 self.pth_run_state.hash(state);
688                 self.pth_flags.hash(state);
689                 self.pth_sleep_time.hash(state);
690                 self.pth_curpri.hash(state);
691                 self.pth_priority.hash(state);
692                 self.pth_maxpriority.hash(state);
693                 self.pth_name.hash(state);
694             }
695         }
696 
697         impl PartialEq for statfs {
698             fn eq(&self, other: &statfs) -> bool {
699                 self.f_bsize == other.f_bsize
700                     && self.f_iosize == other.f_iosize
701                     && self.f_blocks == other.f_blocks
702                     && self.f_bfree == other.f_bfree
703                     && self.f_bavail == other.f_bavail
704                     && self.f_files == other.f_files
705                     && self.f_ffree == other.f_ffree
706                     && self.f_fsid == other.f_fsid
707                     && self.f_owner == other.f_owner
708                     && self.f_flags == other.f_flags
709                     && self.f_fssubtype == other.f_fssubtype
710                     && self.f_fstypename == other.f_fstypename
711                     && self.f_type == other.f_type
712                     && self
713                     .f_mntonname
714                     .iter()
715                     .zip(other.f_mntonname.iter())
716                     .all(|(a,b)| a == b)
717                     && self
718                     .f_mntfromname
719                     .iter()
720                     .zip(other.f_mntfromname.iter())
721                     .all(|(a,b)| a == b)
722                     && self.f_reserved == other.f_reserved
723             }
724         }
725 
726         impl Eq for statfs {}
727         impl ::fmt::Debug for statfs {
728             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
729                 f.debug_struct("statfs")
730                     .field("f_bsize", &self.f_bsize)
731                     .field("f_iosize", &self.f_iosize)
732                     .field("f_blocks", &self.f_blocks)
733                     .field("f_bfree", &self.f_bfree)
734                     .field("f_bavail", &self.f_bavail)
735                     .field("f_files", &self.f_files)
736                     .field("f_ffree", &self.f_ffree)
737                     .field("f_fsid", &self.f_fsid)
738                     .field("f_owner", &self.f_owner)
739                     .field("f_flags", &self.f_flags)
740                     .field("f_fssubtype", &self.f_fssubtype)
741                     .field("f_fstypename", &self.f_fstypename)
742                     .field("f_type", &self.f_type)
743                 // FIXME: .field("f_mntonname", &self.f_mntonname)
744                 // FIXME: .field("f_mntfromname", &self.f_mntfromname)
745                     .field("f_reserved", &self.f_reserved)
746                     .finish()
747             }
748         }
749 
750         impl ::hash::Hash for statfs {
751             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
752                 self.f_bsize.hash(state);
753                 self.f_iosize.hash(state);
754                 self.f_blocks.hash(state);
755                 self.f_bfree.hash(state);
756                 self.f_bavail.hash(state);
757                 self.f_files.hash(state);
758                 self.f_ffree.hash(state);
759                 self.f_fsid.hash(state);
760                 self.f_owner.hash(state);
761                 self.f_flags.hash(state);
762                 self.f_fssubtype.hash(state);
763                 self.f_fstypename.hash(state);
764                 self.f_type.hash(state);
765                 self.f_mntonname.hash(state);
766                 self.f_mntfromname.hash(state);
767                 self.f_reserved.hash(state);
768             }
769         }
770 
771         impl PartialEq for dirent {
772             fn eq(&self, other: &dirent) -> bool {
773                 self.d_ino == other.d_ino
774                     && self.d_seekoff == other.d_seekoff
775                     && self.d_reclen == other.d_reclen
776                     && self.d_namlen == other.d_namlen
777                     && self.d_type == other.d_type
778                     && self
779                     .d_name
780                     .iter()
781                     .zip(other.d_name.iter())
782                     .all(|(a,b)| a == b)
783             }
784         }
785         impl Eq for dirent {}
786         impl ::fmt::Debug for dirent {
787             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
788                 f.debug_struct("dirent")
789                     .field("d_ino", &self.d_ino)
790                     .field("d_seekoff", &self.d_seekoff)
791                     .field("d_reclen", &self.d_reclen)
792                     .field("d_namlen", &self.d_namlen)
793                     .field("d_type", &self.d_type)
794                     // FIXME: .field("d_name", &self.d_name)
795                     .finish()
796             }
797         }
798         impl ::hash::Hash for dirent {
799             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
800                 self.d_ino.hash(state);
801                 self.d_seekoff.hash(state);
802                 self.d_reclen.hash(state);
803                 self.d_namlen.hash(state);
804                 self.d_type.hash(state);
805                 self.d_name.hash(state);
806             }
807         }
808         impl PartialEq for pthread_rwlock_t {
809             fn eq(&self, other: &pthread_rwlock_t) -> bool {
810                 self.__sig == other.__sig
811                     && self.
812                     __opaque
813                     .iter()
814                     .zip(other.__opaque.iter())
815                     .all(|(a,b)| a == b)
816             }
817         }
818         impl Eq for pthread_rwlock_t {}
819         impl ::fmt::Debug for pthread_rwlock_t {
820             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
821                 f.debug_struct("pthread_rwlock_t")
822                     .field("__sig", &self.__sig)
823                     // FIXME: .field("__opaque", &self.__opaque)
824                     .finish()
825             }
826         }
827         impl ::hash::Hash for pthread_rwlock_t {
828             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
829                 self.__sig.hash(state);
830                 self.__opaque.hash(state);
831             }
832         }
833 
834         impl PartialEq for pthread_mutex_t {
835             fn eq(&self, other: &pthread_mutex_t) -> bool {
836                 self.__sig == other.__sig
837                     && self.
838                     __opaque
839                     .iter()
840                     .zip(other.__opaque.iter())
841                     .all(|(a,b)| a == b)
842             }
843         }
844 
845         impl Eq for pthread_mutex_t {}
846 
847         impl ::fmt::Debug for pthread_mutex_t {
848             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
849                 f.debug_struct("pthread_mutex_t")
850                     .field("__sig", &self.__sig)
851                     // FIXME: .field("__opaque", &self.__opaque)
852                     .finish()
853             }
854         }
855 
856         impl ::hash::Hash for pthread_mutex_t {
857             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
858                 self.__sig.hash(state);
859                 self.__opaque.hash(state);
860             }
861         }
862 
863         impl PartialEq for pthread_cond_t {
864             fn eq(&self, other: &pthread_cond_t) -> bool {
865                 self.__sig == other.__sig
866                     && self.
867                     __opaque
868                     .iter()
869                     .zip(other.__opaque.iter())
870                     .all(|(a,b)| a == b)
871             }
872         }
873 
874         impl Eq for pthread_cond_t {}
875 
876         impl ::fmt::Debug for pthread_cond_t {
877             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
878                 f.debug_struct("pthread_cond_t")
879                     .field("__sig", &self.__sig)
880                     // FIXME: .field("__opaque", &self.__opaque)
881                     .finish()
882             }
883         }
884 
885         impl ::hash::Hash for pthread_cond_t {
886             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
887                 self.__sig.hash(state);
888                 self.__opaque.hash(state);
889             }
890         }
891 
892         impl PartialEq for sockaddr_storage {
893             fn eq(&self, other: &sockaddr_storage) -> bool {
894                 self.ss_len == other.ss_len
895                     && self.ss_family == other.ss_family
896                     && self
897                     .__ss_pad1
898                     .iter()
899                     .zip(other.__ss_pad1.iter())
900                     .all(|(a, b)| a == b)
901                     && self.__ss_align == other.__ss_align
902                     && self
903                     .__ss_pad2
904                     .iter()
905                     .zip(other.__ss_pad2.iter())
906                     .all(|(a, b)| a == b)
907             }
908         }
909 
910         impl Eq for sockaddr_storage {}
911 
912         impl ::fmt::Debug for sockaddr_storage {
913             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
914                 f.debug_struct("sockaddr_storage")
915                     .field("ss_len", &self.ss_len)
916                     .field("ss_family", &self.ss_family)
917                     .field("__ss_pad1", &self.__ss_pad1)
918                     .field("__ss_align", &self.__ss_align)
919                     // FIXME: .field("__ss_pad2", &self.__ss_pad2)
920                     .finish()
921             }
922         }
923 
924         impl ::hash::Hash for sockaddr_storage {
925             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
926                 self.ss_len.hash(state);
927                 self.ss_family.hash(state);
928                 self.__ss_pad1.hash(state);
929                 self.__ss_align.hash(state);
930                 self.__ss_pad2.hash(state);
931             }
932         }
933 
934         impl PartialEq for utmpx {
935             fn eq(&self, other: &utmpx) -> bool {
936                 self.ut_user
937                     .iter()
938                     .zip(other.ut_user.iter())
939                     .all(|(a,b)| a == b)
940                     && self.ut_id == other.ut_id
941                     && self.ut_line == other.ut_line
942                     && self.ut_pid == other.ut_pid
943                     && self.ut_type == other.ut_type
944                     && self.ut_tv == other.ut_tv
945                     && self
946                     .ut_host
947                     .iter()
948                     .zip(other.ut_host.iter())
949                     .all(|(a,b)| a == b)
950                     && self.ut_pad == other.ut_pad
951             }
952         }
953 
954         impl Eq for utmpx {}
955 
956         impl ::fmt::Debug for utmpx {
957             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
958                 f.debug_struct("utmpx")
959                     // FIXME: .field("ut_user", &self.ut_user)
960                     .field("ut_id", &self.ut_id)
961                     .field("ut_line", &self.ut_line)
962                     .field("ut_pid", &self.ut_pid)
963                     .field("ut_type", &self.ut_type)
964                     .field("ut_tv", &self.ut_tv)
965                     // FIXME: .field("ut_host", &self.ut_host)
966                     .field("ut_pad", &self.ut_pad)
967                     .finish()
968             }
969         }
970 
971         impl ::hash::Hash for utmpx {
972             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
973                 self.ut_user.hash(state);
974                 self.ut_id.hash(state);
975                 self.ut_line.hash(state);
976                 self.ut_pid.hash(state);
977                 self.ut_type.hash(state);
978                 self.ut_tv.hash(state);
979                 self.ut_host.hash(state);
980                 self.ut_pad.hash(state);
981             }
982         }
983     }
984 }
985 
986 pub const _UTX_USERSIZE: usize = 256;
987 pub const _UTX_LINESIZE: usize = 32;
988 pub const _UTX_IDSIZE: usize = 4;
989 pub const _UTX_HOSTSIZE: usize = 256;
990 
991 pub const EMPTY: ::c_short = 0;
992 pub const RUN_LVL: ::c_short = 1;
993 pub const BOOT_TIME: ::c_short = 2;
994 pub const OLD_TIME: ::c_short = 3;
995 pub const NEW_TIME: ::c_short = 4;
996 pub const INIT_PROCESS: ::c_short = 5;
997 pub const LOGIN_PROCESS: ::c_short = 6;
998 pub const USER_PROCESS: ::c_short = 7;
999 pub const DEAD_PROCESS: ::c_short = 8;
1000 pub const ACCOUNTING: ::c_short = 9;
1001 pub const SIGNATURE: ::c_short = 10;
1002 pub const SHUTDOWN_TIME: ::c_short = 11;
1003 
1004 pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
1005 pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
1006 pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
1007 pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
1008 pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
1009 pub const LC_TIME_MASK: ::c_int = (1 << 5);
1010 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
1011                                | LC_CTYPE_MASK
1012                                | LC_MESSAGES_MASK
1013                                | LC_MONETARY_MASK
1014                                | LC_NUMERIC_MASK
1015                                | LC_TIME_MASK;
1016 
1017 pub const CODESET: ::nl_item = 0;
1018 pub const D_T_FMT: ::nl_item = 1;
1019 pub const D_FMT: ::nl_item = 2;
1020 pub const T_FMT: ::nl_item = 3;
1021 pub const T_FMT_AMPM: ::nl_item = 4;
1022 pub const AM_STR: ::nl_item = 5;
1023 pub const PM_STR: ::nl_item = 6;
1024 
1025 pub const DAY_1: ::nl_item = 7;
1026 pub const DAY_2: ::nl_item = 8;
1027 pub const DAY_3: ::nl_item = 9;
1028 pub const DAY_4: ::nl_item = 10;
1029 pub const DAY_5: ::nl_item = 11;
1030 pub const DAY_6: ::nl_item = 12;
1031 pub const DAY_7: ::nl_item = 13;
1032 
1033 pub const ABDAY_1: ::nl_item = 14;
1034 pub const ABDAY_2: ::nl_item = 15;
1035 pub const ABDAY_3: ::nl_item = 16;
1036 pub const ABDAY_4: ::nl_item = 17;
1037 pub const ABDAY_5: ::nl_item = 18;
1038 pub const ABDAY_6: ::nl_item = 19;
1039 pub const ABDAY_7: ::nl_item = 20;
1040 
1041 pub const MON_1: ::nl_item = 21;
1042 pub const MON_2: ::nl_item = 22;
1043 pub const MON_3: ::nl_item = 23;
1044 pub const MON_4: ::nl_item = 24;
1045 pub const MON_5: ::nl_item = 25;
1046 pub const MON_6: ::nl_item = 26;
1047 pub const MON_7: ::nl_item = 27;
1048 pub const MON_8: ::nl_item = 28;
1049 pub const MON_9: ::nl_item = 29;
1050 pub const MON_10: ::nl_item = 30;
1051 pub const MON_11: ::nl_item = 31;
1052 pub const MON_12: ::nl_item = 32;
1053 
1054 pub const ABMON_1: ::nl_item = 33;
1055 pub const ABMON_2: ::nl_item = 34;
1056 pub const ABMON_3: ::nl_item = 35;
1057 pub const ABMON_4: ::nl_item = 36;
1058 pub const ABMON_5: ::nl_item = 37;
1059 pub const ABMON_6: ::nl_item = 38;
1060 pub const ABMON_7: ::nl_item = 39;
1061 pub const ABMON_8: ::nl_item = 40;
1062 pub const ABMON_9: ::nl_item = 41;
1063 pub const ABMON_10: ::nl_item = 42;
1064 pub const ABMON_11: ::nl_item = 43;
1065 pub const ABMON_12: ::nl_item = 44;
1066 
1067 pub const CLOCK_REALTIME: ::clockid_t = 0;
1068 pub const CLOCK_MONOTONIC: ::clockid_t = 6;
1069 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 12;
1070 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 16;
1071 
1072 pub const ERA: ::nl_item = 45;
1073 pub const ERA_D_FMT: ::nl_item = 46;
1074 pub const ERA_D_T_FMT: ::nl_item = 47;
1075 pub const ERA_T_FMT: ::nl_item = 48;
1076 pub const ALT_DIGITS: ::nl_item = 49;
1077 
1078 pub const RADIXCHAR: ::nl_item = 50;
1079 pub const THOUSEP: ::nl_item = 51;
1080 
1081 pub const YESEXPR: ::nl_item = 52;
1082 pub const NOEXPR: ::nl_item = 53;
1083 
1084 pub const YESSTR: ::nl_item = 54;
1085 pub const NOSTR: ::nl_item = 55;
1086 
1087 pub const CRNCYSTR: ::nl_item = 56;
1088 
1089 pub const D_MD_ORDER: ::nl_item = 57;
1090 
1091 pub const EXIT_FAILURE: ::c_int = 1;
1092 pub const EXIT_SUCCESS: ::c_int = 0;
1093 pub const RAND_MAX: ::c_int = 2147483647;
1094 pub const EOF: ::c_int = -1;
1095 pub const SEEK_SET: ::c_int = 0;
1096 pub const SEEK_CUR: ::c_int = 1;
1097 pub const SEEK_END: ::c_int = 2;
1098 pub const _IOFBF: ::c_int = 0;
1099 pub const _IONBF: ::c_int = 2;
1100 pub const _IOLBF: ::c_int = 1;
1101 pub const BUFSIZ: ::c_uint = 1024;
1102 pub const FOPEN_MAX: ::c_uint = 20;
1103 pub const FILENAME_MAX: ::c_uint = 1024;
1104 pub const L_tmpnam: ::c_uint = 1024;
1105 pub const TMP_MAX: ::c_uint = 308915776;
1106 pub const _PC_LINK_MAX: ::c_int = 1;
1107 pub const _PC_MAX_CANON: ::c_int = 2;
1108 pub const _PC_MAX_INPUT: ::c_int = 3;
1109 pub const _PC_NAME_MAX: ::c_int = 4;
1110 pub const _PC_PATH_MAX: ::c_int = 5;
1111 pub const _PC_PIPE_BUF: ::c_int = 6;
1112 pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
1113 pub const _PC_NO_TRUNC: ::c_int = 8;
1114 pub const _PC_VDISABLE: ::c_int = 9;
1115 pub const O_DSYNC: ::c_int = 0x400000;
1116 pub const O_NOCTTY: ::c_int = 0x20000;
1117 pub const O_CLOEXEC: ::c_int = 0x1000000;
1118 pub const O_DIRECTORY: ::c_int = 0x100000;
1119 pub const S_IFIFO: mode_t = 4096;
1120 pub const S_IFCHR: mode_t = 8192;
1121 pub const S_IFBLK: mode_t = 24576;
1122 pub const S_IFDIR: mode_t = 16384;
1123 pub const S_IFREG: mode_t = 32768;
1124 pub const S_IFLNK: mode_t = 40960;
1125 pub const S_IFSOCK: mode_t = 49152;
1126 pub const S_IFMT: mode_t = 61440;
1127 pub const S_IEXEC: mode_t = 64;
1128 pub const S_IWRITE: mode_t = 128;
1129 pub const S_IREAD: mode_t = 256;
1130 pub const S_IRWXU: mode_t = 448;
1131 pub const S_IXUSR: mode_t = 64;
1132 pub const S_IWUSR: mode_t = 128;
1133 pub const S_IRUSR: mode_t = 256;
1134 pub const S_IRWXG: mode_t = 56;
1135 pub const S_IXGRP: mode_t = 8;
1136 pub const S_IWGRP: mode_t = 16;
1137 pub const S_IRGRP: mode_t = 32;
1138 pub const S_IRWXO: mode_t = 7;
1139 pub const S_IXOTH: mode_t = 1;
1140 pub const S_IWOTH: mode_t = 2;
1141 pub const S_IROTH: mode_t = 4;
1142 pub const F_OK: ::c_int = 0;
1143 pub const R_OK: ::c_int = 4;
1144 pub const W_OK: ::c_int = 2;
1145 pub const X_OK: ::c_int = 1;
1146 pub const STDIN_FILENO: ::c_int = 0;
1147 pub const STDOUT_FILENO: ::c_int = 1;
1148 pub const STDERR_FILENO: ::c_int = 2;
1149 pub const F_LOCK: ::c_int = 1;
1150 pub const F_TEST: ::c_int = 3;
1151 pub const F_TLOCK: ::c_int = 2;
1152 pub const F_ULOCK: ::c_int = 0;
1153 pub const F_GETLK: ::c_int = 7;
1154 pub const F_SETLK: ::c_int = 8;
1155 pub const F_SETLKW: ::c_int = 9;
1156 pub const SIGHUP: ::c_int = 1;
1157 pub const SIGINT: ::c_int = 2;
1158 pub const SIGQUIT: ::c_int = 3;
1159 pub const SIGILL: ::c_int = 4;
1160 pub const SIGABRT: ::c_int = 6;
1161 pub const SIGEMT: ::c_int = 7;
1162 pub const SIGFPE: ::c_int = 8;
1163 pub const SIGKILL: ::c_int = 9;
1164 pub const SIGSEGV: ::c_int = 11;
1165 pub const SIGPIPE: ::c_int = 13;
1166 pub const SIGALRM: ::c_int = 14;
1167 pub const SIGTERM: ::c_int = 15;
1168 
1169 pub const PROT_NONE: ::c_int = 0;
1170 pub const PROT_READ: ::c_int = 1;
1171 pub const PROT_WRITE: ::c_int = 2;
1172 pub const PROT_EXEC: ::c_int = 4;
1173 
1174 pub const PT_TRACE_ME: ::c_int = 0;
1175 pub const PT_READ_I: ::c_int = 1;
1176 pub const PT_READ_D: ::c_int = 2;
1177 pub const PT_READ_U: ::c_int = 3;
1178 pub const PT_WRITE_I: ::c_int = 4;
1179 pub const PT_WRITE_D: ::c_int = 5;
1180 pub const PT_WRITE_U: ::c_int = 6;
1181 pub const PT_CONTINUE: ::c_int = 7;
1182 pub const PT_KILL: ::c_int = 8;
1183 pub const PT_STEP: ::c_int = 9;
1184 pub const PT_ATTACH: ::c_int = 10;
1185 pub const PT_DETACH: ::c_int = 11;
1186 pub const PT_SIGEXC: ::c_int = 12;
1187 pub const PT_THUPDATE: ::c_int = 13;
1188 pub const PT_ATTACHEXC: ::c_int = 14;
1189 
1190 pub const PT_FORCEQUOTA: ::c_int = 30;
1191 pub const PT_DENY_ATTACH: ::c_int = 31;
1192 pub const PT_FIRSTMACH: ::c_int = 32;
1193 
1194 pub const MAP_FILE: ::c_int = 0x0000;
1195 pub const MAP_SHARED: ::c_int = 0x0001;
1196 pub const MAP_PRIVATE: ::c_int = 0x0002;
1197 pub const MAP_FIXED: ::c_int = 0x0010;
1198 pub const MAP_ANON: ::c_int = 0x1000;
1199 pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
1200 
1201 pub const VM_FLAGS_FIXED: ::c_int = 0x0000;
1202 pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001;
1203 pub const VM_FLAGS_PURGABLE: ::c_int = 0x0002;
1204 pub const VM_FLAGS_RANDOM_ADDR: ::c_int = 0x0008;
1205 pub const VM_FLAGS_NO_CACHE: ::c_int = 0x0010;
1206 pub const VM_FLAGS_RESILIENT_CODESIGN: ::c_int = 0x0020;
1207 pub const VM_FLAGS_RESILIENT_MEDIA: ::c_int = 0x0040;
1208 pub const VM_FLAGS_OVERWRITE: ::c_int = 0x4000;
1209 pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000;
1210 pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000;
1211 pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000;
1212 pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000;
1213 pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401f;
1214 pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401f;
1215 pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED | VM_FLAGS_ANYWHERE |
1216                                         VM_FLAGS_RANDOM_ADDR |
1217                                         VM_FLAGS_OVERWRITE |
1218                                         VM_FLAGS_RETURN_DATA_ADDR |
1219                                         VM_FLAGS_RESILIENT_CODESIGN;
1220 
1221 pub const VM_FLAGS_SUPERPAGE_SHIFT: ::c_int = 16;
1222 pub const SUPERPAGE_NONE: ::c_int = 0;
1223 pub const SUPERPAGE_SIZE_ANY: ::c_int = 1;
1224 pub const VM_FLAGS_SUPERPAGE_NONE: ::c_int = SUPERPAGE_NONE <<
1225                                              VM_FLAGS_SUPERPAGE_SHIFT;
1226 pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: ::c_int = SUPERPAGE_SIZE_ANY <<
1227                                                  VM_FLAGS_SUPERPAGE_SHIFT;
1228 pub const SUPERPAGE_SIZE_2MB: ::c_int = 2;
1229 pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: ::c_int = SUPERPAGE_SIZE_2MB <<
1230                                                  VM_FLAGS_SUPERPAGE_SHIFT;
1231 
1232 pub const VM_MEMORY_MALLOC: ::c_int = 1;
1233 pub const VM_MEMORY_MALLOC_SMALL: ::c_int = 2;
1234 pub const VM_MEMORY_MALLOC_LARGE: ::c_int = 3;
1235 pub const VM_MEMORY_MALLOC_HUGE: ::c_int = 4;
1236 pub const VM_MEMORY_SBRK: ::c_int = 5;
1237 pub const VM_MEMORY_REALLOC: ::c_int = 6;
1238 pub const VM_MEMORY_MALLOC_TINY: ::c_int = 7;
1239 pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: ::c_int = 8;
1240 pub const VM_MEMORY_MALLOC_LARGE_REUSED: ::c_int = 9;
1241 pub const VM_MEMORY_ANALYSIS_TOOL: ::c_int = 10;
1242 pub const VM_MEMORY_MALLOC_NANO: ::c_int = 11;
1243 pub const VM_MEMORY_MACH_MSG: ::c_int = 20;
1244 pub const VM_MEMORY_IOKIT: ::c_int = 21;
1245 pub const VM_MEMORY_STACK: ::c_int = 30;
1246 pub const VM_MEMORY_GUARD: ::c_int = 31;
1247 pub const VM_MEMORY_SHARED_PMAP: ::c_int = 32;
1248 pub const VM_MEMORY_DYLIB: ::c_int = 33;
1249 pub const VM_MEMORY_OBJC_DISPATCHERS: ::c_int = 34;
1250 pub const VM_MEMORY_UNSHARED_PMAP: ::c_int = 35;
1251 pub const VM_MEMORY_APPKIT: ::c_int = 40;
1252 pub const VM_MEMORY_FOUNDATION: ::c_int = 41;
1253 pub const VM_MEMORY_COREGRAPHICS: ::c_int = 42;
1254 pub const VM_MEMORY_CORESERVICES: ::c_int = 43;
1255 pub const VM_MEMORY_CARBON: ::c_int = VM_MEMORY_CORESERVICES;
1256 pub const VM_MEMORY_JAVA: ::c_int = 44;
1257 pub const VM_MEMORY_COREDATA: ::c_int = 45;
1258 pub const VM_MEMORY_COREDATA_OBJECTIDS: ::c_int = 46;
1259 pub const VM_MEMORY_ATS: ::c_int = 50;
1260 pub const VM_MEMORY_LAYERKIT: ::c_int = 51;
1261 pub const VM_MEMORY_CGIMAGE: ::c_int = 52;
1262 pub const VM_MEMORY_TCMALLOC: ::c_int = 53;
1263 pub const VM_MEMORY_COREGRAPHICS_DATA: ::c_int = 54;
1264 pub const VM_MEMORY_COREGRAPHICS_SHARED: ::c_int = 55;
1265 pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: ::c_int = 56;
1266 pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: ::c_int = 57;
1267 pub const VM_MEMORY_COREGRAPHICS_XALLOC: ::c_int = 58;
1268 pub const VM_MEMORY_COREGRAPHICS_MISC: ::c_int = VM_MEMORY_COREGRAPHICS;
1269 pub const VM_MEMORY_DYLD: ::c_int = 60;
1270 pub const VM_MEMORY_DYLD_MALLOC: ::c_int = 61;
1271 pub const VM_MEMORY_SQLITE: ::c_int = 62;
1272 pub const VM_MEMORY_JAVASCRIPT_CORE: ::c_int = 63;
1273 pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: ::c_int = 64;
1274 pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: ::c_int = 65;
1275 pub const VM_MEMORY_GLSL: ::c_int = 66;
1276 pub const VM_MEMORY_OPENCL: ::c_int = 67;
1277 pub const VM_MEMORY_COREIMAGE: ::c_int = 68;
1278 pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: ::c_int = 69;
1279 pub const VM_MEMORY_IMAGEIO: ::c_int = 70;
1280 pub const VM_MEMORY_COREPROFILE: ::c_int = 71;
1281 pub const VM_MEMORY_ASSETSD: ::c_int = 72;
1282 pub const VM_MEMORY_OS_ALLOC_ONCE: ::c_int = 73;
1283 pub const VM_MEMORY_LIBDISPATCH: ::c_int = 74;
1284 pub const VM_MEMORY_ACCELERATE: ::c_int = 75;
1285 pub const VM_MEMORY_COREUI: ::c_int = 76;
1286 pub const VM_MEMORY_COREUIFILE: ::c_int = 77;
1287 pub const VM_MEMORY_GENEALOGY: ::c_int = 78;
1288 pub const VM_MEMORY_RAWCAMERA: ::c_int = 79;
1289 pub const VM_MEMORY_CORPSEINFO: ::c_int = 80;
1290 pub const VM_MEMORY_ASL: ::c_int = 81;
1291 pub const VM_MEMORY_SWIFT_RUNTIME: ::c_int = 82;
1292 pub const VM_MEMORY_SWIFT_METADATA: ::c_int = 83;
1293 pub const VM_MEMORY_DHMM: ::c_int = 84;
1294 pub const VM_MEMORY_SCENEKIT: ::c_int = 86;
1295 pub const VM_MEMORY_SKYWALK: ::c_int = 87;
1296 pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::c_int = 240;
1297 pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::c_int = 255;
1298 
1299 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
1300 
1301 pub const MCL_CURRENT: ::c_int = 0x0001;
1302 pub const MCL_FUTURE: ::c_int = 0x0002;
1303 
1304 pub const MS_ASYNC: ::c_int = 0x0001;
1305 pub const MS_INVALIDATE: ::c_int = 0x0002;
1306 pub const MS_SYNC: ::c_int = 0x0010;
1307 
1308 pub const MS_KILLPAGES: ::c_int = 0x0004;
1309 pub const MS_DEACTIVATE: ::c_int = 0x0008;
1310 
1311 pub const EPERM: ::c_int = 1;
1312 pub const ENOENT: ::c_int = 2;
1313 pub const ESRCH: ::c_int = 3;
1314 pub const EINTR: ::c_int = 4;
1315 pub const EIO: ::c_int = 5;
1316 pub const ENXIO: ::c_int = 6;
1317 pub const E2BIG: ::c_int = 7;
1318 pub const ENOEXEC: ::c_int = 8;
1319 pub const EBADF: ::c_int = 9;
1320 pub const ECHILD: ::c_int = 10;
1321 pub const EDEADLK: ::c_int = 11;
1322 pub const ENOMEM: ::c_int = 12;
1323 pub const EACCES: ::c_int = 13;
1324 pub const EFAULT: ::c_int = 14;
1325 pub const ENOTBLK: ::c_int = 15;
1326 pub const EBUSY: ::c_int = 16;
1327 pub const EEXIST: ::c_int = 17;
1328 pub const EXDEV: ::c_int = 18;
1329 pub const ENODEV: ::c_int = 19;
1330 pub const ENOTDIR: ::c_int = 20;
1331 pub const EISDIR: ::c_int = 21;
1332 pub const EINVAL: ::c_int = 22;
1333 pub const ENFILE: ::c_int = 23;
1334 pub const EMFILE: ::c_int = 24;
1335 pub const ENOTTY: ::c_int = 25;
1336 pub const ETXTBSY: ::c_int = 26;
1337 pub const EFBIG: ::c_int = 27;
1338 pub const ENOSPC: ::c_int = 28;
1339 pub const ESPIPE: ::c_int = 29;
1340 pub const EROFS: ::c_int = 30;
1341 pub const EMLINK: ::c_int = 31;
1342 pub const EPIPE: ::c_int = 32;
1343 pub const EDOM: ::c_int = 33;
1344 pub const ERANGE: ::c_int = 34;
1345 pub const EAGAIN: ::c_int = 35;
1346 pub const EWOULDBLOCK: ::c_int = EAGAIN;
1347 pub const EINPROGRESS: ::c_int = 36;
1348 pub const EALREADY: ::c_int = 37;
1349 pub const ENOTSOCK: ::c_int = 38;
1350 pub const EDESTADDRREQ: ::c_int = 39;
1351 pub const EMSGSIZE: ::c_int = 40;
1352 pub const EPROTOTYPE: ::c_int = 41;
1353 pub const ENOPROTOOPT: ::c_int = 42;
1354 pub const EPROTONOSUPPORT: ::c_int = 43;
1355 pub const ESOCKTNOSUPPORT: ::c_int = 44;
1356 pub const ENOTSUP: ::c_int = 45;
1357 pub const EPFNOSUPPORT: ::c_int = 46;
1358 pub const EAFNOSUPPORT: ::c_int = 47;
1359 pub const EADDRINUSE: ::c_int = 48;
1360 pub const EADDRNOTAVAIL: ::c_int = 49;
1361 pub const ENETDOWN: ::c_int = 50;
1362 pub const ENETUNREACH: ::c_int = 51;
1363 pub const ENETRESET: ::c_int = 52;
1364 pub const ECONNABORTED: ::c_int = 53;
1365 pub const ECONNRESET: ::c_int = 54;
1366 pub const ENOBUFS: ::c_int = 55;
1367 pub const EISCONN: ::c_int = 56;
1368 pub const ENOTCONN: ::c_int = 57;
1369 pub const ESHUTDOWN: ::c_int = 58;
1370 pub const ETOOMANYREFS: ::c_int = 59;
1371 pub const ETIMEDOUT: ::c_int = 60;
1372 pub const ECONNREFUSED: ::c_int = 61;
1373 pub const ELOOP: ::c_int = 62;
1374 pub const ENAMETOOLONG: ::c_int = 63;
1375 pub const EHOSTDOWN: ::c_int = 64;
1376 pub const EHOSTUNREACH: ::c_int = 65;
1377 pub const ENOTEMPTY: ::c_int = 66;
1378 pub const EPROCLIM: ::c_int = 67;
1379 pub const EUSERS: ::c_int = 68;
1380 pub const EDQUOT: ::c_int = 69;
1381 pub const ESTALE: ::c_int = 70;
1382 pub const EREMOTE: ::c_int = 71;
1383 pub const EBADRPC: ::c_int = 72;
1384 pub const ERPCMISMATCH: ::c_int = 73;
1385 pub const EPROGUNAVAIL: ::c_int = 74;
1386 pub const EPROGMISMATCH: ::c_int = 75;
1387 pub const EPROCUNAVAIL: ::c_int = 76;
1388 pub const ENOLCK: ::c_int = 77;
1389 pub const ENOSYS: ::c_int = 78;
1390 pub const EFTYPE: ::c_int = 79;
1391 pub const EAUTH: ::c_int = 80;
1392 pub const ENEEDAUTH: ::c_int = 81;
1393 pub const EPWROFF: ::c_int = 82;
1394 pub const EDEVERR: ::c_int = 83;
1395 pub const EOVERFLOW: ::c_int = 84;
1396 pub const EBADEXEC: ::c_int = 85;
1397 pub const EBADARCH: ::c_int = 86;
1398 pub const ESHLIBVERS: ::c_int = 87;
1399 pub const EBADMACHO: ::c_int = 88;
1400 pub const ECANCELED: ::c_int = 89;
1401 pub const EIDRM: ::c_int = 90;
1402 pub const ENOMSG: ::c_int = 91;
1403 pub const EILSEQ: ::c_int = 92;
1404 pub const ENOATTR: ::c_int = 93;
1405 pub const EBADMSG: ::c_int = 94;
1406 pub const EMULTIHOP: ::c_int = 95;
1407 pub const ENODATA: ::c_int = 96;
1408 pub const ENOLINK: ::c_int = 97;
1409 pub const ENOSR: ::c_int = 98;
1410 pub const ENOSTR: ::c_int = 99;
1411 pub const EPROTO: ::c_int = 100;
1412 pub const ETIME: ::c_int = 101;
1413 pub const EOPNOTSUPP: ::c_int = 102;
1414 pub const ENOPOLICY: ::c_int = 103;
1415 pub const ENOTRECOVERABLE: ::c_int = 104;
1416 pub const EOWNERDEAD: ::c_int = 105;
1417 pub const EQFULL: ::c_int = 106;
1418 pub const ELAST: ::c_int = 106;
1419 
1420 pub const EAI_AGAIN: ::c_int = 2;
1421 pub const EAI_BADFLAGS: ::c_int = 3;
1422 pub const EAI_FAIL: ::c_int = 4;
1423 pub const EAI_FAMILY: ::c_int = 5;
1424 pub const EAI_MEMORY: ::c_int = 6;
1425 pub const EAI_NODATA: ::c_int = 7;
1426 pub const EAI_NONAME: ::c_int = 8;
1427 pub const EAI_SERVICE: ::c_int = 9;
1428 pub const EAI_SOCKTYPE: ::c_int = 10;
1429 pub const EAI_SYSTEM: ::c_int = 11;
1430 pub const EAI_OVERFLOW: ::c_int = 14;
1431 
1432 pub const F_DUPFD: ::c_int = 0;
1433 pub const F_DUPFD_CLOEXEC: ::c_int = 67;
1434 pub const F_GETFD: ::c_int = 1;
1435 pub const F_SETFD: ::c_int = 2;
1436 pub const F_GETFL: ::c_int = 3;
1437 pub const F_SETFL: ::c_int = 4;
1438 pub const F_PREALLOCATE: ::c_int = 42;
1439 pub const F_RDADVISE: ::c_int = 44;
1440 pub const F_RDAHEAD: ::c_int = 45;
1441 pub const F_NOCACHE: ::c_int = 48;
1442 pub const F_GETPATH: ::c_int = 50;
1443 pub const F_FULLFSYNC: ::c_int = 51;
1444 pub const F_FREEZE_FS: ::c_int = 53;
1445 pub const F_THAW_FS: ::c_int = 54;
1446 pub const F_GLOBAL_NOCACHE: ::c_int = 55;
1447 pub const F_NODIRECT: ::c_int = 62;
1448 
1449 pub const F_ALLOCATECONTIG: ::c_uint = 0x02;
1450 pub const F_ALLOCATEALL: ::c_uint = 0x04;
1451 
1452 pub const F_PEOFPOSMODE: ::c_int = 3;
1453 pub const F_VOLPOSMODE: ::c_int = 4;
1454 
1455 pub const AT_FDCWD: ::c_int = -2;
1456 pub const AT_EACCESS: ::c_int = 0x0010;
1457 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
1458 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
1459 pub const AT_REMOVEDIR: ::c_int = 0x0080;
1460 
1461 pub const TIOCMODG: ::c_ulong = 0x40047403;
1462 pub const TIOCMODS: ::c_ulong = 0x80047404;
1463 pub const TIOCM_LE: ::c_int = 0x1;
1464 pub const TIOCM_DTR: ::c_int = 0x2;
1465 pub const TIOCM_RTS: ::c_int = 0x4;
1466 pub const TIOCM_ST: ::c_int = 0x8;
1467 pub const TIOCM_SR: ::c_int = 0x10;
1468 pub const TIOCM_CTS: ::c_int = 0x20;
1469 pub const TIOCM_CAR: ::c_int = 0x40;
1470 pub const TIOCM_CD: ::c_int = 0x40;
1471 pub const TIOCM_RNG: ::c_int = 0x80;
1472 pub const TIOCM_RI: ::c_int = 0x80;
1473 pub const TIOCM_DSR: ::c_int = 0x100;
1474 pub const TIOCEXCL: ::c_int = 0x2000740d;
1475 pub const TIOCNXCL: ::c_int = 0x2000740e;
1476 pub const TIOCFLUSH: ::c_ulong = 0x80047410;
1477 pub const TIOCGETD: ::c_ulong = 0x4004741a;
1478 pub const TIOCSETD: ::c_ulong = 0x8004741b;
1479 pub const TIOCIXON: ::c_uint = 0x20007481;
1480 pub const TIOCIXOFF: ::c_uint = 0x20007480;
1481 pub const TIOCSBRK: ::c_uint = 0x2000747b;
1482 pub const TIOCCBRK: ::c_uint = 0x2000747a;
1483 pub const TIOCSDTR: ::c_uint = 0x20007479;
1484 pub const TIOCCDTR: ::c_uint = 0x20007478;
1485 pub const TIOCGPGRP: ::c_ulong = 0x40047477;
1486 pub const TIOCSPGRP: ::c_ulong = 0x80047476;
1487 pub const TIOCOUTQ: ::c_ulong = 0x40047473;
1488 pub const TIOCSTI: ::c_ulong = 0x80017472;
1489 pub const TIOCNOTTY: ::c_uint = 0x20007471;
1490 pub const TIOCPKT: ::c_ulong = 0x80047470;
1491 pub const TIOCPKT_DATA: ::c_int = 0x0;
1492 pub const TIOCPKT_FLUSHREAD: ::c_int = 0x1;
1493 pub const TIOCPKT_FLUSHWRITE: ::c_int = 0x2;
1494 pub const TIOCPKT_STOP: ::c_int = 0x4;
1495 pub const TIOCPKT_START: ::c_int = 0x8;
1496 pub const TIOCPKT_NOSTOP: ::c_int = 0x10;
1497 pub const TIOCPKT_DOSTOP: ::c_int = 0x20;
1498 pub const TIOCPKT_IOCTL: ::c_int = 0x40;
1499 pub const TIOCSTOP: ::c_uint = 0x2000746f;
1500 pub const TIOCSTART: ::c_uint = 0x2000746e;
1501 pub const TIOCMSET: ::c_ulong = 0x8004746d;
1502 pub const TIOCMBIS: ::c_ulong = 0x8004746c;
1503 pub const TIOCMBIC: ::c_ulong = 0x8004746b;
1504 pub const TIOCMGET: ::c_ulong = 0x4004746a;
1505 pub const TIOCREMOTE: ::c_ulong = 0x80047469;
1506 pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
1507 pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
1508 pub const TIOCUCNTL: ::c_ulong = 0x80047466;
1509 pub const TIOCSTAT: ::c_uint = 0x20007465;
1510 pub const TIOCSCONS: ::c_uint = 0x20007463;
1511 pub const TIOCCONS: ::c_ulong = 0x80047462;
1512 pub const TIOCSCTTY: ::c_uint = 0x20007461;
1513 pub const TIOCEXT: ::c_ulong = 0x80047460;
1514 pub const TIOCSIG: ::c_uint = 0x2000745f;
1515 pub const TIOCDRAIN: ::c_uint = 0x2000745e;
1516 pub const TIOCMSDTRWAIT: ::c_ulong = 0x8004745b;
1517 pub const TIOCMGDTRWAIT: ::c_ulong = 0x4004745a;
1518 pub const TIOCSDRAINWAIT: ::c_ulong = 0x80047457;
1519 pub const TIOCGDRAINWAIT: ::c_ulong = 0x40047456;
1520 pub const TIOCDSIMICROCODE: ::c_uint = 0x20007455;
1521 pub const TIOCPTYGRANT: ::c_uint = 0x20007454;
1522 pub const TIOCPTYGNAME: ::c_uint = 0x40807453;
1523 pub const TIOCPTYUNLK: ::c_uint = 0x20007452;
1524 
1525 pub const FIONCLEX: ::c_uint = 0x20006602;
1526 pub const FIONREAD: ::c_ulong = 0x4004667f;
1527 pub const FIOASYNC: ::c_ulong = 0x8004667d;
1528 pub const FIOSETOWN: ::c_ulong = 0x8004667c;
1529 pub const FIOGETOWN: ::c_ulong = 0x4004667b;
1530 pub const FIODTYPE: ::c_ulong = 0x4004667a;
1531 
1532 pub const B0: speed_t = 0;
1533 pub const B50: speed_t = 50;
1534 pub const B75: speed_t = 75;
1535 pub const B110: speed_t = 110;
1536 pub const B134: speed_t = 134;
1537 pub const B150: speed_t = 150;
1538 pub const B200: speed_t = 200;
1539 pub const B300: speed_t = 300;
1540 pub const B600: speed_t = 600;
1541 pub const B1200: speed_t = 1200;
1542 pub const B1800: speed_t = 1800;
1543 pub const B2400: speed_t = 2400;
1544 pub const B4800: speed_t = 4800;
1545 pub const B9600: speed_t = 9600;
1546 pub const B19200: speed_t = 19200;
1547 pub const B38400: speed_t = 38400;
1548 pub const B7200: speed_t = 7200;
1549 pub const B14400: speed_t = 14400;
1550 pub const B28800: speed_t = 28800;
1551 pub const B57600: speed_t = 57600;
1552 pub const B76800: speed_t = 76800;
1553 pub const B115200: speed_t = 115200;
1554 pub const B230400: speed_t = 230400;
1555 pub const EXTA: speed_t = 19200;
1556 pub const EXTB: speed_t = 38400;
1557 
1558 pub const SIGTRAP: ::c_int = 5;
1559 
1560 pub const GLOB_APPEND  : ::c_int = 0x0001;
1561 pub const GLOB_DOOFFS  : ::c_int = 0x0002;
1562 pub const GLOB_ERR     : ::c_int = 0x0004;
1563 pub const GLOB_MARK    : ::c_int = 0x0008;
1564 pub const GLOB_NOCHECK : ::c_int = 0x0010;
1565 pub const GLOB_NOSORT  : ::c_int = 0x0020;
1566 pub const GLOB_NOESCAPE: ::c_int = 0x2000;
1567 
1568 pub const GLOB_NOSPACE : ::c_int = -1;
1569 pub const GLOB_ABORTED : ::c_int = -2;
1570 pub const GLOB_NOMATCH : ::c_int = -3;
1571 
1572 pub const POSIX_MADV_NORMAL: ::c_int = 0;
1573 pub const POSIX_MADV_RANDOM: ::c_int = 1;
1574 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
1575 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
1576 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
1577 
1578 pub const _SC_IOV_MAX: ::c_int = 56;
1579 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
1580 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
1581 pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
1582 pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
1583 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
1584 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
1585 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
1586 pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
1587 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
1588 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
1589 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
1590 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
1591 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
1592 pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
1593 pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
1594 pub const _SC_THREADS: ::c_int = 96;
1595 pub const _SC_TTY_NAME_MAX: ::c_int = 101;
1596 pub const _SC_ATEXIT_MAX: ::c_int = 107;
1597 pub const _SC_XOPEN_CRYPT: ::c_int = 108;
1598 pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
1599 pub const _SC_XOPEN_LEGACY: ::c_int = 110;
1600 pub const _SC_XOPEN_REALTIME: ::c_int = 111;
1601 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
1602 pub const _SC_XOPEN_SHM: ::c_int = 113;
1603 pub const _SC_XOPEN_UNIX: ::c_int = 115;
1604 pub const _SC_XOPEN_VERSION: ::c_int = 116;
1605 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
1606 pub const _SC_PHYS_PAGES: ::c_int = 200;
1607 
1608 pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 2;
1609 pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
1610 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
1611 pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
1612 pub const PTHREAD_STACK_MIN: ::size_t = 8192;
1613 
1614 pub const RLIMIT_CPU: ::c_int = 0;
1615 pub const RLIMIT_FSIZE: ::c_int = 1;
1616 pub const RLIMIT_DATA: ::c_int = 2;
1617 pub const RLIMIT_STACK: ::c_int = 3;
1618 pub const RLIMIT_CORE: ::c_int = 4;
1619 pub const RLIMIT_AS: ::c_int = 5;
1620 pub const RLIMIT_RSS: ::c_int = RLIMIT_AS;
1621 pub const RLIMIT_MEMLOCK: ::c_int = 6;
1622 pub const RLIMIT_NPROC: ::c_int = 7;
1623 pub const RLIMIT_NOFILE: ::c_int = 8;
1624 pub const RLIM_NLIMITS: ::c_int = 9;
1625 pub const _RLIMIT_POSIX_FLAG: ::c_int = 0x1000;
1626 
1627 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
1628 
1629 pub const RUSAGE_SELF: ::c_int = 0;
1630 pub const RUSAGE_CHILDREN: ::c_int = -1;
1631 
1632 pub const MADV_NORMAL: ::c_int = 0;
1633 pub const MADV_RANDOM: ::c_int = 1;
1634 pub const MADV_SEQUENTIAL: ::c_int = 2;
1635 pub const MADV_WILLNEED: ::c_int = 3;
1636 pub const MADV_DONTNEED: ::c_int = 4;
1637 pub const MADV_FREE: ::c_int = 5;
1638 pub const MADV_ZERO_WIRED_PAGES: ::c_int = 6;
1639 pub const MADV_FREE_REUSABLE: ::c_int = 7;
1640 pub const MADV_FREE_REUSE: ::c_int = 8;
1641 pub const MADV_CAN_REUSE: ::c_int = 9;
1642 
1643 pub const MINCORE_INCORE: ::c_int =  0x1;
1644 pub const MINCORE_REFERENCED: ::c_int = 0x2;
1645 pub const MINCORE_MODIFIED: ::c_int = 0x4;
1646 pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
1647 pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
1648 
1649 //
1650 // sys/netinet/in.h
1651 // Protocols (RFC 1700)
1652 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
1653 
1654 // IPPROTO_IP defined in src/unix/mod.rs
1655 /// IP6 hop-by-hop options
1656 pub const IPPROTO_HOPOPTS: ::c_int = 0;
1657 // IPPROTO_ICMP defined in src/unix/mod.rs
1658 /// group mgmt protocol
1659 pub const IPPROTO_IGMP: ::c_int = 2;
1660 /// gateway<sup>2</sup> (deprecated)
1661 pub const IPPROTO_GGP: ::c_int = 3;
1662 /// for compatibility
1663 pub const IPPROTO_IPIP: ::c_int = 4;
1664 // IPPROTO_TCP defined in src/unix/mod.rs
1665 /// Stream protocol II.
1666 pub const IPPROTO_ST: ::c_int = 7;
1667 /// exterior gateway protocol
1668 pub const IPPROTO_EGP: ::c_int = 8;
1669 /// private interior gateway
1670 pub const IPPROTO_PIGP: ::c_int = 9;
1671 /// BBN RCC Monitoring
1672 pub const IPPROTO_RCCMON: ::c_int = 10;
1673 /// network voice protocol
1674 pub const IPPROTO_NVPII: ::c_int = 11;
1675 /// pup
1676 pub const IPPROTO_PUP: ::c_int = 12;
1677 /// Argus
1678 pub const IPPROTO_ARGUS: ::c_int = 13;
1679 /// EMCON
1680 pub const IPPROTO_EMCON: ::c_int = 14;
1681 /// Cross Net Debugger
1682 pub const IPPROTO_XNET: ::c_int = 15;
1683 /// Chaos
1684 pub const IPPROTO_CHAOS: ::c_int = 16;
1685 // IPPROTO_UDP defined in src/unix/mod.rs
1686 /// Multiplexing
1687 pub const IPPROTO_MUX: ::c_int = 18;
1688 /// DCN Measurement Subsystems
1689 pub const IPPROTO_MEAS: ::c_int = 19;
1690 /// Host Monitoring
1691 pub const IPPROTO_HMP: ::c_int = 20;
1692 /// Packet Radio Measurement
1693 pub const IPPROTO_PRM: ::c_int = 21;
1694 /// xns idp
1695 pub const IPPROTO_IDP: ::c_int = 22;
1696 /// Trunk-1
1697 pub const IPPROTO_TRUNK1: ::c_int = 23;
1698 /// Trunk-2
1699 pub const IPPROTO_TRUNK2: ::c_int = 24;
1700 /// Leaf-1
1701 pub const IPPROTO_LEAF1: ::c_int = 25;
1702 /// Leaf-2
1703 pub const IPPROTO_LEAF2: ::c_int = 26;
1704 /// Reliable Data
1705 pub const IPPROTO_RDP: ::c_int = 27;
1706 /// Reliable Transaction
1707 pub const IPPROTO_IRTP: ::c_int = 28;
1708 /// tp-4 w/ class negotiation
1709 pub const IPPROTO_TP: ::c_int = 29;
1710 /// Bulk Data Transfer
1711 pub const IPPROTO_BLT: ::c_int = 30;
1712 /// Network Services
1713 pub const IPPROTO_NSP: ::c_int = 31;
1714 /// Merit Internodal
1715 pub const IPPROTO_INP: ::c_int = 32;
1716 /// Sequential Exchange
1717 pub const IPPROTO_SEP: ::c_int = 33;
1718 /// Third Party Connect
1719 pub const IPPROTO_3PC: ::c_int = 34;
1720 /// InterDomain Policy Routing
1721 pub const IPPROTO_IDPR: ::c_int = 35;
1722 /// XTP
1723 pub const IPPROTO_XTP: ::c_int = 36;
1724 /// Datagram Delivery
1725 pub const IPPROTO_DDP: ::c_int = 37;
1726 /// Control Message Transport
1727 pub const IPPROTO_CMTP: ::c_int = 38;
1728 /// TP++ Transport
1729 pub const IPPROTO_TPXX: ::c_int = 39;
1730 /// IL transport protocol
1731 pub const IPPROTO_IL: ::c_int = 40;
1732 // IPPROTO_IPV6 defined in src/unix/mod.rs
1733 /// Source Demand Routing
1734 pub const IPPROTO_SDRP: ::c_int = 42;
1735 /// IP6 routing header
1736 pub const IPPROTO_ROUTING: ::c_int = 43;
1737 /// IP6 fragmentation header
1738 pub const IPPROTO_FRAGMENT: ::c_int = 44;
1739 /// InterDomain Routing
1740 pub const IPPROTO_IDRP: ::c_int = 45;
1741 /// resource reservation
1742 pub const IPPROTO_RSVP: ::c_int = 46;
1743 /// General Routing Encap.
1744 pub const IPPROTO_GRE: ::c_int = 47;
1745 /// Mobile Host Routing
1746 pub const IPPROTO_MHRP: ::c_int = 48;
1747 /// BHA
1748 pub const IPPROTO_BHA: ::c_int = 49;
1749 /// IP6 Encap Sec. Payload
1750 pub const IPPROTO_ESP: ::c_int = 50;
1751 /// IP6 Auth Header
1752 pub const IPPROTO_AH: ::c_int = 51;
1753 /// Integ. Net Layer Security
1754 pub const IPPROTO_INLSP: ::c_int = 52;
1755 /// IP with encryption
1756 pub const IPPROTO_SWIPE: ::c_int = 53;
1757 /// Next Hop Resolution
1758 pub const IPPROTO_NHRP: ::c_int = 54;
1759 /* 55-57: Unassigned */
1760 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1761 /// IP6 no next header
1762 pub const IPPROTO_NONE: ::c_int = 59;
1763 /// IP6 destination option
1764 pub const IPPROTO_DSTOPTS: ::c_int = 60;
1765 /// any host internal protocol
1766 pub const IPPROTO_AHIP: ::c_int = 61;
1767 /// CFTP
1768 pub const IPPROTO_CFTP: ::c_int = 62;
1769 /// "hello" routing protocol
1770 pub const IPPROTO_HELLO: ::c_int = 63;
1771 /// SATNET/Backroom EXPAK
1772 pub const IPPROTO_SATEXPAK: ::c_int = 64;
1773 /// Kryptolan
1774 pub const IPPROTO_KRYPTOLAN: ::c_int = 65;
1775 /// Remote Virtual Disk
1776 pub const IPPROTO_RVD: ::c_int = 66;
1777 /// Pluribus Packet Core
1778 pub const IPPROTO_IPPC: ::c_int = 67;
1779 /// Any distributed FS
1780 pub const IPPROTO_ADFS: ::c_int = 68;
1781 /// Satnet Monitoring
1782 pub const IPPROTO_SATMON: ::c_int = 69;
1783 /// VISA Protocol
1784 pub const IPPROTO_VISA: ::c_int = 70;
1785 /// Packet Core Utility
1786 pub const IPPROTO_IPCV: ::c_int = 71;
1787 /// Comp. Prot. Net. Executive
1788 pub const IPPROTO_CPNX: ::c_int = 72;
1789 /// Comp. Prot. HeartBeat
1790 pub const IPPROTO_CPHB: ::c_int = 73;
1791 /// Wang Span Network
1792 pub const IPPROTO_WSN: ::c_int = 74;
1793 /// Packet Video Protocol
1794 pub const IPPROTO_PVP: ::c_int = 75;
1795 /// BackRoom SATNET Monitoring
1796 pub const IPPROTO_BRSATMON: ::c_int = 76;
1797 /// Sun net disk proto (temp.)
1798 pub const IPPROTO_ND: ::c_int = 77;
1799 /// WIDEBAND Monitoring
1800 pub const IPPROTO_WBMON: ::c_int = 78;
1801 /// WIDEBAND EXPAK
1802 pub const IPPROTO_WBEXPAK: ::c_int = 79;
1803 /// ISO cnlp
1804 pub const IPPROTO_EON: ::c_int = 80;
1805 /// VMTP
1806 pub const IPPROTO_VMTP: ::c_int = 81;
1807 /// Secure VMTP
1808 pub const IPPROTO_SVMTP: ::c_int = 82;
1809 /// Banyon VINES
1810 pub const IPPROTO_VINES: ::c_int = 83;
1811 /// TTP
1812 pub const IPPROTO_TTP: ::c_int = 84;
1813 /// NSFNET-IGP
1814 pub const IPPROTO_IGP: ::c_int = 85;
1815 /// dissimilar gateway prot.
1816 pub const IPPROTO_DGP: ::c_int = 86;
1817 /// TCF
1818 pub const IPPROTO_TCF: ::c_int = 87;
1819 /// Cisco/GXS IGRP
1820 pub const IPPROTO_IGRP: ::c_int = 88;
1821 /// OSPFIGP
1822 pub const IPPROTO_OSPFIGP: ::c_int = 89;
1823 /// Strite RPC protocol
1824 pub const IPPROTO_SRPC: ::c_int = 90;
1825 /// Locus Address Resoloution
1826 pub const IPPROTO_LARP: ::c_int = 91;
1827 /// Multicast Transport
1828 pub const IPPROTO_MTP: ::c_int = 92;
1829 /// AX.25 Frames
1830 pub const IPPROTO_AX25: ::c_int = 93;
1831 /// IP encapsulated in IP
1832 pub const IPPROTO_IPEIP: ::c_int = 94;
1833 /// Mobile Int.ing control
1834 pub const IPPROTO_MICP: ::c_int = 95;
1835 /// Semaphore Comm. security
1836 pub const IPPROTO_SCCSP: ::c_int = 96;
1837 /// Ethernet IP encapsulation
1838 pub const IPPROTO_ETHERIP: ::c_int = 97;
1839 /// encapsulation header
1840 pub const IPPROTO_ENCAP: ::c_int = 98;
1841 /// any private encr. scheme
1842 pub const IPPROTO_APES: ::c_int = 99;
1843 /// GMTP
1844 pub const IPPROTO_GMTP: ::c_int = 100;
1845 
1846 /* 101-254: Partly Unassigned */
1847 /// Protocol Independent Mcast
1848 pub const IPPROTO_PIM: ::c_int = 103;
1849 /// payload compression (IPComp)
1850 pub const IPPROTO_IPCOMP: ::c_int = 108;
1851 /// PGM
1852 pub const IPPROTO_PGM: ::c_int = 113;
1853 /// SCTP
1854 pub const IPPROTO_SCTP: ::c_int = 132;
1855 
1856 /* 255: Reserved */
1857 /* BSD Private, local use, namespace incursion */
1858 /// divert pseudo-protocol
1859 pub const IPPROTO_DIVERT: ::c_int = 254;
1860 /// raw IP packet
1861 pub const IPPROTO_RAW: ::c_int = 255;
1862 pub const IPPROTO_MAX: ::c_int = 256;
1863 /// last return value of *_input(), meaning "all job for this pkt is done".
1864 pub const IPPROTO_DONE: ::c_int = 257;
1865 
1866 pub const AF_UNSPEC: ::c_int = 0;
1867 pub const AF_LOCAL: ::c_int = 1;
1868 pub const AF_UNIX: ::c_int = AF_LOCAL;
1869 pub const AF_INET: ::c_int = 2;
1870 pub const AF_IMPLINK: ::c_int = 3;
1871 pub const AF_PUP: ::c_int = 4;
1872 pub const AF_CHAOS: ::c_int = 5;
1873 pub const AF_NS: ::c_int = 6;
1874 pub const AF_ISO: ::c_int = 7;
1875 pub const AF_OSI: ::c_int = AF_ISO;
1876 pub const AF_ECMA: ::c_int = 8;
1877 pub const AF_DATAKIT: ::c_int = 9;
1878 pub const AF_CCITT: ::c_int = 10;
1879 pub const AF_SNA: ::c_int = 11;
1880 pub const AF_DECnet: ::c_int = 12;
1881 pub const AF_DLI: ::c_int = 13;
1882 pub const AF_LAT: ::c_int = 14;
1883 pub const AF_HYLINK: ::c_int = 15;
1884 pub const AF_APPLETALK: ::c_int = 16;
1885 pub const AF_ROUTE: ::c_int = 17;
1886 pub const AF_LINK: ::c_int = 18;
1887 pub const pseudo_AF_XTP: ::c_int = 19;
1888 pub const AF_COIP: ::c_int = 20;
1889 pub const AF_CNT: ::c_int = 21;
1890 pub const pseudo_AF_RTIP: ::c_int = 22;
1891 pub const AF_IPX: ::c_int = 23;
1892 pub const AF_SIP: ::c_int = 24;
1893 pub const pseudo_AF_PIP: ::c_int = 25;
1894 pub const AF_ISDN: ::c_int = 28;
1895 pub const AF_E164: ::c_int = AF_ISDN;
1896 pub const pseudo_AF_KEY: ::c_int = 29;
1897 pub const AF_INET6: ::c_int = 30;
1898 pub const AF_NATM: ::c_int = 31;
1899 pub const AF_SYSTEM: ::c_int = 32;
1900 pub const AF_NETBIOS: ::c_int = 33;
1901 pub const AF_PPP: ::c_int = 34;
1902 pub const pseudo_AF_HDRCMPLT: ::c_int = 35;
1903 #[doc(hidden)]
1904 pub const AF_MAX: ::c_int = 40;
1905 pub const AF_SYS_CONTROL: ::c_int = 2;
1906 
1907 pub const SYSPROTO_EVENT: ::c_int = 1;
1908 pub const SYSPROTO_CONTROL: ::c_int = 2;
1909 
1910 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
1911 pub const PF_LOCAL: ::c_int = AF_LOCAL;
1912 pub const PF_UNIX: ::c_int =  PF_LOCAL;
1913 pub const PF_INET: ::c_int =  AF_INET;
1914 pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
1915 pub const PF_PUP: ::c_int =  AF_PUP;
1916 pub const PF_CHAOS: ::c_int = AF_CHAOS;
1917 pub const PF_NS: ::c_int =  AF_NS;
1918 pub const PF_ISO: ::c_int =  AF_ISO;
1919 pub const PF_OSI: ::c_int =  AF_ISO;
1920 pub const PF_ECMA: ::c_int =  AF_ECMA;
1921 pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
1922 pub const PF_CCITT: ::c_int = AF_CCITT;
1923 pub const PF_SNA: ::c_int =  AF_SNA;
1924 pub const PF_DECnet: ::c_int = AF_DECnet;
1925 pub const PF_DLI: ::c_int =  AF_DLI;
1926 pub const PF_LAT: ::c_int =  AF_LAT;
1927 pub const PF_HYLINK: ::c_int = AF_HYLINK;
1928 pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
1929 pub const PF_ROUTE: ::c_int = AF_ROUTE;
1930 pub const PF_LINK: ::c_int =  AF_LINK;
1931 pub const PF_XTP: ::c_int =  pseudo_AF_XTP;
1932 pub const PF_COIP: ::c_int =  AF_COIP;
1933 pub const PF_CNT: ::c_int =  AF_CNT;
1934 pub const PF_SIP: ::c_int =  AF_SIP;
1935 pub const PF_IPX: ::c_int =  AF_IPX;
1936 pub const PF_RTIP: ::c_int =  pseudo_AF_RTIP;
1937 pub const PF_PIP: ::c_int =  pseudo_AF_PIP;
1938 pub const PF_ISDN: ::c_int =  AF_ISDN;
1939 pub const PF_KEY: ::c_int =  pseudo_AF_KEY;
1940 pub const PF_INET6: ::c_int = AF_INET6;
1941 pub const PF_NATM: ::c_int =  AF_NATM;
1942 pub const PF_SYSTEM: ::c_int = AF_SYSTEM;
1943 pub const PF_NETBIOS: ::c_int = AF_NETBIOS;
1944 pub const PF_PPP: ::c_int =  AF_PPP;
1945 #[doc(hidden)]
1946 pub const PF_MAX: ::c_int =  AF_MAX;
1947 
1948 #[doc(hidden)]
1949 pub const NET_MAXID: ::c_int = AF_MAX;
1950 
1951 pub const NET_RT_DUMP: ::c_int = 1;
1952 pub const NET_RT_FLAGS: ::c_int = 2;
1953 pub const NET_RT_IFLIST: ::c_int = 3;
1954 #[doc(hidden)]
1955 pub const NET_RT_MAXID: ::c_int = 10;
1956 
1957 pub const SOMAXCONN: ::c_int = 128;
1958 
1959 pub const SOCK_MAXADDRLEN: ::c_int = 255;
1960 
1961 pub const SOCK_STREAM: ::c_int = 1;
1962 pub const SOCK_DGRAM: ::c_int = 2;
1963 pub const SOCK_RAW: ::c_int = 3;
1964 pub const SOCK_RDM: ::c_int = 4;
1965 pub const SOCK_SEQPACKET: ::c_int = 5;
1966 pub const IP_TTL: ::c_int = 4;
1967 pub const IP_HDRINCL: ::c_int = 2;
1968 pub const IP_RECVDSTADDR: ::c_int = 7;
1969 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
1970 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
1971 pub const IP_RECVIF: ::c_int = 20;
1972 pub const IP_PKTINFO: ::c_int = 26;
1973 pub const IP_RECVTOS: ::c_int = 27;
1974 pub const IPV6_JOIN_GROUP: ::c_int = 12;
1975 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
1976 pub const IPV6_RECVTCLASS: ::c_int = 35;
1977 pub const IPV6_TCLASS: ::c_int = 36;
1978 pub const IPV6_PKTINFO: ::c_int = 46;
1979 pub const IPV6_RECVPKTINFO: ::c_int = 61;
1980 
1981 pub const TCP_NOPUSH: ::c_int = 4;
1982 pub const TCP_NOOPT: ::c_int = 8;
1983 pub const TCP_KEEPALIVE: ::c_int = 0x10;
1984 
1985 pub const SOL_LOCAL: ::c_int = 0;
1986 
1987 pub const LOCAL_PEERCRED: ::c_int = 0x001;
1988 pub const LOCAL_PEERPID: ::c_int = 0x002;
1989 pub const LOCAL_PEEREPID: ::c_int = 0x003;
1990 pub const LOCAL_PEERUUID: ::c_int = 0x004;
1991 pub const LOCAL_PEEREUUID: ::c_int = 0x005;
1992 
1993 pub const SOL_SOCKET: ::c_int = 0xffff;
1994 
1995 pub const SO_DEBUG: ::c_int = 0x01;
1996 pub const SO_ACCEPTCONN: ::c_int = 0x0002;
1997 pub const SO_REUSEADDR: ::c_int = 0x0004;
1998 pub const SO_KEEPALIVE: ::c_int = 0x0008;
1999 pub const SO_DONTROUTE: ::c_int = 0x0010;
2000 pub const SO_BROADCAST: ::c_int = 0x0020;
2001 pub const SO_USELOOPBACK: ::c_int = 0x0040;
2002 pub const SO_LINGER: ::c_int = 0x0080;
2003 pub const SO_OOBINLINE: ::c_int = 0x0100;
2004 pub const SO_REUSEPORT: ::c_int = 0x0200;
2005 pub const SO_TIMESTAMP: ::c_int = 0x0400;
2006 pub const SO_TIMESTAMP_MONOTONIC: ::c_int = 0x0800;
2007 pub const SO_DONTTRUNC: ::c_int = 0x2000;
2008 pub const SO_WANTMORE: ::c_int = 0x4000;
2009 pub const SO_WANTOOBFLAG: ::c_int = 0x8000;
2010 pub const SO_SNDBUF: ::c_int = 0x1001;
2011 pub const SO_RCVBUF: ::c_int = 0x1002;
2012 pub const SO_SNDLOWAT: ::c_int = 0x1003;
2013 pub const SO_RCVLOWAT: ::c_int = 0x1004;
2014 pub const SO_SNDTIMEO: ::c_int = 0x1005;
2015 pub const SO_RCVTIMEO: ::c_int = 0x1006;
2016 pub const SO_ERROR: ::c_int = 0x1007;
2017 pub const SO_TYPE: ::c_int = 0x1008;
2018 pub const SO_LABEL: ::c_int = 0x1010;
2019 pub const SO_PEERLABEL: ::c_int = 0x1011;
2020 pub const SO_NREAD: ::c_int = 0x1020;
2021 pub const SO_NKE: ::c_int = 0x1021;
2022 pub const SO_NOSIGPIPE: ::c_int = 0x1022;
2023 pub const SO_NOADDRERR: ::c_int = 0x1023;
2024 pub const SO_NWRITE: ::c_int = 0x1024;
2025 pub const SO_REUSESHAREUID: ::c_int = 0x1025;
2026 pub const SO_NOTIFYCONFLICT: ::c_int = 0x1026;
2027 pub const SO_RANDOMPORT: ::c_int = 0x1082;
2028 pub const SO_NP_EXTENSIONS: ::c_int = 0x1083;
2029 
2030 pub const MSG_OOB: ::c_int =  0x1;
2031 pub const MSG_PEEK: ::c_int = 0x2;
2032 pub const MSG_DONTROUTE: ::c_int = 0x4;
2033 pub const MSG_EOR: ::c_int =  0x8;
2034 pub const MSG_TRUNC: ::c_int = 0x10;
2035 pub const MSG_CTRUNC: ::c_int = 0x20;
2036 pub const MSG_WAITALL: ::c_int = 0x40;
2037 pub const MSG_DONTWAIT: ::c_int = 0x80;
2038 pub const MSG_EOF: ::c_int =  0x100;
2039 pub const MSG_FLUSH: ::c_int = 0x400;
2040 pub const MSG_HOLD: ::c_int = 0x800;
2041 pub const MSG_SEND: ::c_int = 0x1000;
2042 pub const MSG_HAVEMORE: ::c_int = 0x2000;
2043 pub const MSG_RCVMORE: ::c_int = 0x4000;
2044 // pub const MSG_COMPAT: ::c_int = 0x8000;
2045 
2046 pub const SCM_TIMESTAMP: ::c_int = 0x02;
2047 pub const SCM_CREDS: ::c_int = 0x03;
2048 
2049 // https://github.com/aosm/xnu/blob/master/bsd/net/if.h#L140-L156
2050 pub const IFF_UP: ::c_int          = 0x1;  // interface is up
2051 pub const IFF_BROADCAST: ::c_int   = 0x2;  // broadcast address valid
2052 pub const IFF_DEBUG: ::c_int       = 0x4;  // turn on debugging
2053 pub const IFF_LOOPBACK: ::c_int    = 0x8;  // is a loopback net
2054 pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
2055 pub const IFF_NOTRAILERS: ::c_int  = 0x20; // obsolete: avoid use of trailers
2056 pub const IFF_RUNNING: ::c_int     = 0x40; // resources allocated
2057 pub const IFF_NOARP: ::c_int       = 0x80; // no address resolution protocol
2058 pub const IFF_PROMISC: ::c_int     = 0x100;// receive all packets
2059 pub const IFF_ALLMULTI: ::c_int    = 0x200;// receive all multicast packets
2060 pub const IFF_OACTIVE: ::c_int     = 0x400;// transmission in progress
2061 pub const IFF_SIMPLEX: ::c_int     = 0x800;// can't hear own transmissions
2062 pub const IFF_LINK0: ::c_int       = 0x1000;// per link layer defined bit
2063 pub const IFF_LINK1: ::c_int   = 0x2000;// per link layer defined bit
2064 pub const IFF_LINK2: ::c_int   = 0x4000;// per link layer defined bit
2065 pub const IFF_ALTPHYS: ::c_int = IFF_LINK2;// use alternate physical connection
2066 pub const IFF_MULTICAST: ::c_int = 0x8000;// supports multicast
2067 
2068 pub const SHUT_RD: ::c_int = 0;
2069 pub const SHUT_WR: ::c_int = 1;
2070 pub const SHUT_RDWR: ::c_int = 2;
2071 
2072 pub const LOCK_SH: ::c_int = 1;
2073 pub const LOCK_EX: ::c_int = 2;
2074 pub const LOCK_NB: ::c_int = 4;
2075 pub const LOCK_UN: ::c_int = 8;
2076 
2077 pub const MAP_COPY: ::c_int = 0x0002;
2078 pub const MAP_RENAME: ::c_int = 0x0020;
2079 pub const MAP_NORESERVE: ::c_int = 0x0040;
2080 pub const MAP_NOEXTEND: ::c_int = 0x0100;
2081 pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
2082 pub const MAP_NOCACHE: ::c_int = 0x0400;
2083 pub const MAP_JIT: ::c_int = 0x0800;
2084 
2085 pub const _SC_ARG_MAX: ::c_int = 1;
2086 pub const _SC_CHILD_MAX: ::c_int = 2;
2087 pub const _SC_CLK_TCK: ::c_int = 3;
2088 pub const _SC_NGROUPS_MAX: ::c_int = 4;
2089 pub const _SC_OPEN_MAX: ::c_int = 5;
2090 pub const _SC_JOB_CONTROL: ::c_int = 6;
2091 pub const _SC_SAVED_IDS: ::c_int = 7;
2092 pub const _SC_VERSION: ::c_int = 8;
2093 pub const _SC_BC_BASE_MAX: ::c_int = 9;
2094 pub const _SC_BC_DIM_MAX: ::c_int = 10;
2095 pub const _SC_BC_SCALE_MAX: ::c_int = 11;
2096 pub const _SC_BC_STRING_MAX: ::c_int = 12;
2097 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13;
2098 pub const _SC_EXPR_NEST_MAX: ::c_int = 14;
2099 pub const _SC_LINE_MAX: ::c_int = 15;
2100 pub const _SC_RE_DUP_MAX: ::c_int = 16;
2101 pub const _SC_2_VERSION: ::c_int = 17;
2102 pub const _SC_2_C_BIND: ::c_int = 18;
2103 pub const _SC_2_C_DEV: ::c_int = 19;
2104 pub const _SC_2_CHAR_TERM: ::c_int = 20;
2105 pub const _SC_2_FORT_DEV: ::c_int = 21;
2106 pub const _SC_2_FORT_RUN: ::c_int = 22;
2107 pub const _SC_2_LOCALEDEF: ::c_int = 23;
2108 pub const _SC_2_SW_DEV: ::c_int = 24;
2109 pub const _SC_2_UPE: ::c_int = 25;
2110 pub const _SC_STREAM_MAX: ::c_int = 26;
2111 pub const _SC_TZNAME_MAX: ::c_int = 27;
2112 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28;
2113 pub const _SC_PAGESIZE: ::c_int = 29;
2114 pub const _SC_MEMLOCK: ::c_int = 30;
2115 pub const _SC_MEMLOCK_RANGE: ::c_int = 31;
2116 pub const _SC_MEMORY_PROTECTION: ::c_int = 32;
2117 pub const _SC_MESSAGE_PASSING: ::c_int = 33;
2118 pub const _SC_PRIORITIZED_IO: ::c_int = 34;
2119 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35;
2120 pub const _SC_REALTIME_SIGNALS: ::c_int = 36;
2121 pub const _SC_SEMAPHORES: ::c_int = 37;
2122 pub const _SC_FSYNC: ::c_int = 38;
2123 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39;
2124 pub const _SC_SYNCHRONIZED_IO: ::c_int = 40;
2125 pub const _SC_TIMERS: ::c_int = 41;
2126 pub const _SC_AIO_LISTIO_MAX: ::c_int = 42;
2127 pub const _SC_AIO_MAX: ::c_int = 43;
2128 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44;
2129 pub const _SC_DELAYTIMER_MAX: ::c_int = 45;
2130 pub const _SC_MQ_OPEN_MAX: ::c_int = 46;
2131 pub const _SC_MAPPED_FILES: ::c_int = 47;
2132 pub const _SC_RTSIG_MAX: ::c_int = 48;
2133 pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
2134 pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
2135 pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
2136 pub const _SC_TIMER_MAX: ::c_int = 52;
2137 pub const _SC_NPROCESSORS_CONF: ::c_int = 57;
2138 pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
2139 pub const _SC_2_PBS: ::c_int = 59;
2140 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60;
2141 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61;
2142 pub const _SC_2_PBS_LOCATE: ::c_int = 62;
2143 pub const _SC_2_PBS_MESSAGE: ::c_int = 63;
2144 pub const _SC_2_PBS_TRACK: ::c_int = 64;
2145 pub const _SC_ADVISORY_INFO: ::c_int = 65;
2146 pub const _SC_BARRIERS: ::c_int = 66;
2147 pub const _SC_CLOCK_SELECTION: ::c_int = 67;
2148 pub const _SC_CPUTIME: ::c_int = 68;
2149 pub const _SC_FILE_LOCKING: ::c_int = 69;
2150 pub const _SC_HOST_NAME_MAX: ::c_int = 72;
2151 pub const _SC_MONOTONIC_CLOCK: ::c_int = 74;
2152 pub const _SC_READER_WRITER_LOCKS: ::c_int = 76;
2153 pub const _SC_REGEXP: ::c_int = 77;
2154 pub const _SC_SHELL: ::c_int = 78;
2155 pub const _SC_SPAWN: ::c_int = 79;
2156 pub const _SC_SPIN_LOCKS: ::c_int = 80;
2157 pub const _SC_SPORADIC_SERVER: ::c_int = 81;
2158 pub const _SC_THREAD_CPUTIME: ::c_int = 84;
2159 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92;
2160 pub const _SC_TIMEOUTS: ::c_int = 95;
2161 pub const _SC_TRACE: ::c_int = 97;
2162 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98;
2163 pub const _SC_TRACE_INHERIT: ::c_int = 99;
2164 pub const _SC_TRACE_LOG: ::c_int = 100;
2165 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102;
2166 pub const _SC_V6_ILP32_OFF32: ::c_int = 103;
2167 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104;
2168 pub const _SC_V6_LP64_OFF64: ::c_int = 105;
2169 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106;
2170 pub const _SC_IPV6: ::c_int = 118;
2171 pub const _SC_RAW_SOCKETS: ::c_int = 119;
2172 pub const _SC_SYMLOOP_MAX: ::c_int = 120;
2173 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
2174 pub const _SC_XOPEN_STREAMS: ::c_int = 114;
2175 pub const _SC_XBS5_ILP32_OFF32: ::c_int = 122;
2176 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 123;
2177 pub const _SC_XBS5_LP64_OFF64: ::c_int = 124;
2178 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 125;
2179 pub const _SC_SS_REPL_MAX: ::c_int = 126;
2180 pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 127;
2181 pub const _SC_TRACE_NAME_MAX: ::c_int = 128;
2182 pub const _SC_TRACE_SYS_MAX: ::c_int = 129;
2183 pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 130;
2184 pub const _SC_PASS_MAX: ::c_int = 131;
2185 
2186 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
2187 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
2188 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
2189 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
2190 pub const _PTHREAD_MUTEX_SIG_init: ::c_long = 0x32AAABA7;
2191 pub const _PTHREAD_COND_SIG_init: ::c_long = 0x3CB0B1BB;
2192 pub const _PTHREAD_RWLOCK_SIG_init: ::c_long = 0x2DA8B3B4;
2193 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2194     __sig: _PTHREAD_MUTEX_SIG_init,
2195     __opaque: [0; __PTHREAD_MUTEX_SIZE__],
2196 };
2197 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2198     __sig: _PTHREAD_COND_SIG_init,
2199     __opaque: [0; __PTHREAD_COND_SIZE__],
2200 };
2201 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2202     __sig: _PTHREAD_RWLOCK_SIG_init,
2203     __opaque: [0; __PTHREAD_RWLOCK_SIZE__],
2204 };
2205 
2206 pub const SIGSTKSZ: ::size_t = 131072;
2207 
2208 pub const FD_SETSIZE: usize = 1024;
2209 
2210 pub const ST_NOSUID: ::c_ulong = 2;
2211 
2212 pub const EVFILT_READ: ::int16_t = -1;
2213 pub const EVFILT_WRITE: ::int16_t = -2;
2214 pub const EVFILT_AIO: ::int16_t = -3;
2215 pub const EVFILT_VNODE: ::int16_t = -4;
2216 pub const EVFILT_PROC: ::int16_t = -5;
2217 pub const EVFILT_SIGNAL: ::int16_t = -6;
2218 pub const EVFILT_TIMER: ::int16_t = -7;
2219 pub const EVFILT_MACHPORT: ::int16_t = -8;
2220 pub const EVFILT_FS: ::int16_t = -9;
2221 pub const EVFILT_USER: ::int16_t = -10;
2222 pub const EVFILT_VM: ::int16_t = -12;
2223 
2224 pub const EV_ADD: ::uint16_t = 0x1;
2225 pub const EV_DELETE: ::uint16_t = 0x2;
2226 pub const EV_ENABLE: ::uint16_t = 0x4;
2227 pub const EV_DISABLE: ::uint16_t = 0x8;
2228 pub const EV_ONESHOT: ::uint16_t = 0x10;
2229 pub const EV_CLEAR: ::uint16_t = 0x20;
2230 pub const EV_RECEIPT: ::uint16_t = 0x40;
2231 pub const EV_DISPATCH: ::uint16_t = 0x80;
2232 pub const EV_FLAG0: ::uint16_t = 0x1000;
2233 pub const EV_POLL: ::uint16_t = 0x1000;
2234 pub const EV_FLAG1: ::uint16_t = 0x2000;
2235 pub const EV_OOBAND: ::uint16_t = 0x2000;
2236 pub const EV_ERROR: ::uint16_t = 0x4000;
2237 pub const EV_EOF: ::uint16_t = 0x8000;
2238 pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
2239 
2240 pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
2241 pub const NOTE_FFNOP: ::uint32_t = 0x00000000;
2242 pub const NOTE_FFAND: ::uint32_t = 0x40000000;
2243 pub const NOTE_FFOR: ::uint32_t = 0x80000000;
2244 pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
2245 pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
2246 pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
2247 pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
2248 pub const NOTE_DELETE: ::uint32_t = 0x00000001;
2249 pub const NOTE_WRITE: ::uint32_t = 0x00000002;
2250 pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
2251 pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
2252 pub const NOTE_LINK: ::uint32_t = 0x00000010;
2253 pub const NOTE_RENAME: ::uint32_t = 0x00000020;
2254 pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
2255 pub const NOTE_NONE: ::uint32_t = 0x00000080;
2256 pub const NOTE_EXIT: ::uint32_t = 0x80000000;
2257 pub const NOTE_FORK: ::uint32_t = 0x40000000;
2258 pub const NOTE_EXEC: ::uint32_t = 0x20000000;
2259 #[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")]
2260 pub const NOTE_REAP: ::uint32_t = 0x10000000;
2261 pub const NOTE_SIGNAL: ::uint32_t = 0x08000000;
2262 pub const NOTE_EXITSTATUS: ::uint32_t = 0x04000000;
2263 pub const NOTE_EXIT_DETAIL: ::uint32_t = 0x02000000;
2264 pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
2265 pub const NOTE_PCTRLMASK: ::uint32_t = 0xfff00000;
2266 #[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")]
2267 pub const NOTE_EXIT_REPARENTED: ::uint32_t = 0x00080000;
2268 pub const NOTE_EXIT_DETAIL_MASK: ::uint32_t = 0x00070000;
2269 pub const NOTE_EXIT_DECRYPTFAIL: ::uint32_t = 0x00010000;
2270 pub const NOTE_EXIT_MEMORY: ::uint32_t = 0x00020000;
2271 pub const NOTE_EXIT_CSERROR: ::uint32_t = 0x00040000;
2272 pub const NOTE_VM_PRESSURE: ::uint32_t = 0x80000000;
2273 pub const NOTE_VM_PRESSURE_TERMINATE: ::uint32_t = 0x40000000;
2274 pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: ::uint32_t = 0x20000000;
2275 pub const NOTE_VM_ERROR: ::uint32_t = 0x10000000;
2276 pub const NOTE_SECONDS: ::uint32_t = 0x00000001;
2277 pub const NOTE_USECONDS: ::uint32_t = 0x00000002;
2278 pub const NOTE_NSECONDS: ::uint32_t = 0x00000004;
2279 pub const NOTE_ABSOLUTE: ::uint32_t = 0x00000008;
2280 pub const NOTE_LEEWAY: ::uint32_t = 0x00000010;
2281 pub const NOTE_CRITICAL: ::uint32_t = 0x00000020;
2282 pub const NOTE_BACKGROUND: ::uint32_t = 0x00000040;
2283 pub const NOTE_TRACK: ::uint32_t = 0x00000001;
2284 pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
2285 pub const NOTE_CHILD: ::uint32_t = 0x00000004;
2286 
2287 pub const OCRNL: ::c_int = 0x00000010;
2288 pub const ONOCR: ::c_int = 0x00000020;
2289 pub const ONLRET: ::c_int = 0x00000040;
2290 pub const OFILL: ::c_int = 0x00000080;
2291 pub const NLDLY: ::c_int = 0x00000300;
2292 pub const TABDLY: ::c_int = 0x00000c04;
2293 pub const CRDLY: ::c_int = 0x00003000;
2294 pub const FFDLY: ::c_int = 0x00004000;
2295 pub const BSDLY: ::c_int = 0x00008000;
2296 pub const VTDLY: ::c_int = 0x00010000;
2297 pub const OFDEL: ::c_int = 0x00020000;
2298 
2299 pub const NL0: ::c_int  = 0x00000000;
2300 pub const NL1: ::c_int  = 0x00000100;
2301 pub const TAB0: ::c_int = 0x00000000;
2302 pub const TAB1: ::c_int = 0x00000400;
2303 pub const TAB2: ::c_int = 0x00000800;
2304 pub const CR0: ::c_int  = 0x00000000;
2305 pub const CR1: ::c_int  = 0x00001000;
2306 pub const CR2: ::c_int  = 0x00002000;
2307 pub const CR3: ::c_int  = 0x00003000;
2308 pub const FF0: ::c_int  = 0x00000000;
2309 pub const FF1: ::c_int  = 0x00004000;
2310 pub const BS0: ::c_int  = 0x00000000;
2311 pub const BS1: ::c_int  = 0x00008000;
2312 pub const TAB3: ::c_int = 0x00000004;
2313 pub const VT0: ::c_int  = 0x00000000;
2314 pub const VT1: ::c_int  = 0x00010000;
2315 pub const IUTF8: ::tcflag_t = 0x00004000;
2316 pub const CRTSCTS: ::tcflag_t = 0x00030000;
2317 
2318 pub const NI_MAXHOST: ::socklen_t = 1025;
2319 pub const NI_MAXSERV: ::socklen_t = 32;
2320 pub const NI_NOFQDN: ::c_int = 0x00000001;
2321 pub const NI_NUMERICHOST: ::c_int = 0x00000002;
2322 pub const NI_NAMEREQD: ::c_int = 0x00000004;
2323 pub const NI_NUMERICSERV: ::c_int = 0x00000008;
2324 pub const NI_NUMERICSCOPE: ::c_int = 0x00000100;
2325 pub const NI_DGRAM: ::c_int = 0x00000010;
2326 
2327 pub const Q_GETQUOTA: ::c_int = 0x300;
2328 pub const Q_SETQUOTA: ::c_int = 0x400;
2329 
2330 pub const RENAME_SWAP: ::c_uint = 0x00000002;
2331 pub const RENAME_EXCL: ::c_uint = 0x00000004;
2332 
2333 pub const RTLD_LOCAL: ::c_int = 0x4;
2334 pub const RTLD_FIRST: ::c_int = 0x100;
2335 pub const RTLD_NODELETE: ::c_int = 0x80;
2336 pub const RTLD_NOLOAD: ::c_int = 0x10;
2337 pub const RTLD_GLOBAL: ::c_int = 0x8;
2338 
2339 pub const _WSTOPPED: ::c_int = 0o177;
2340 
2341 pub const LOG_NETINFO: ::c_int = 12 << 3;
2342 pub const LOG_REMOTEAUTH: ::c_int = 13 << 3;
2343 pub const LOG_INSTALL: ::c_int = 14 << 3;
2344 pub const LOG_RAS: ::c_int = 15 << 3;
2345 pub const LOG_LAUNCHD: ::c_int = 24 << 3;
2346 pub const LOG_NFACILITIES: ::c_int = 25;
2347 
2348 pub const CTLTYPE: ::c_int = 0xf;
2349 pub const CTLTYPE_NODE: ::c_int = 1;
2350 pub const CTLTYPE_INT: ::c_int = 2;
2351 pub const CTLTYPE_STRING: ::c_int = 3;
2352 pub const CTLTYPE_QUAD: ::c_int = 4;
2353 pub const CTLTYPE_OPAQUE: ::c_int = 5;
2354 pub const CTLTYPE_STRUCT: ::c_int = CTLTYPE_OPAQUE;
2355 pub const CTLFLAG_RD: ::c_int = 0x80000000;
2356 pub const CTLFLAG_WR: ::c_int = 0x40000000;
2357 pub const CTLFLAG_RW: ::c_int = CTLFLAG_RD | CTLFLAG_WR;
2358 pub const CTLFLAG_NOLOCK: ::c_int = 0x20000000;
2359 pub const CTLFLAG_ANYBODY: ::c_int = 0x10000000;
2360 pub const CTLFLAG_SECURE: ::c_int = 0x08000000;
2361 pub const CTLFLAG_MASKED: ::c_int = 0x04000000;
2362 pub const CTLFLAG_NOAUTO: ::c_int = 0x02000000;
2363 pub const CTLFLAG_KERN: ::c_int = 0x01000000;
2364 pub const CTLFLAG_LOCKED: ::c_int = 0x00800000;
2365 pub const CTLFLAG_OID2: ::c_int = 0x00400000;
2366 pub const CTL_UNSPEC: ::c_int = 0;
2367 pub const CTL_KERN: ::c_int = 1;
2368 pub const CTL_VM: ::c_int = 2;
2369 pub const CTL_VFS: ::c_int = 3;
2370 pub const CTL_NET: ::c_int = 4;
2371 pub const CTL_DEBUG: ::c_int = 5;
2372 pub const CTL_HW: ::c_int = 6;
2373 pub const CTL_MACHDEP: ::c_int = 7;
2374 pub const CTL_USER: ::c_int = 8;
2375 pub const CTL_MAXID: ::c_int = 9;
2376 pub const KERN_OSTYPE: ::c_int = 1;
2377 pub const KERN_OSRELEASE: ::c_int = 2;
2378 pub const KERN_OSREV: ::c_int = 3;
2379 pub const KERN_VERSION: ::c_int = 4;
2380 pub const KERN_MAXVNODES: ::c_int = 5;
2381 pub const KERN_MAXPROC: ::c_int = 6;
2382 pub const KERN_MAXFILES: ::c_int = 7;
2383 pub const KERN_ARGMAX: ::c_int = 8;
2384 pub const KERN_SECURELVL: ::c_int = 9;
2385 pub const KERN_HOSTNAME: ::c_int = 10;
2386 pub const KERN_HOSTID: ::c_int = 11;
2387 pub const KERN_CLOCKRATE: ::c_int = 12;
2388 pub const KERN_VNODE: ::c_int = 13;
2389 pub const KERN_PROC: ::c_int = 14;
2390 pub const KERN_FILE: ::c_int = 15;
2391 pub const KERN_PROF: ::c_int = 16;
2392 pub const KERN_POSIX1: ::c_int = 17;
2393 pub const KERN_NGROUPS: ::c_int = 18;
2394 pub const KERN_JOB_CONTROL: ::c_int = 19;
2395 pub const KERN_SAVED_IDS: ::c_int = 20;
2396 pub const KERN_BOOTTIME: ::c_int = 21;
2397 pub const KERN_NISDOMAINNAME: ::c_int = 22;
2398 pub const KERN_DOMAINNAME: ::c_int = KERN_NISDOMAINNAME;
2399 pub const KERN_MAXPARTITIONS: ::c_int = 23;
2400 pub const KERN_KDEBUG: ::c_int = 24;
2401 pub const KERN_UPDATEINTERVAL: ::c_int = 25;
2402 pub const KERN_OSRELDATE: ::c_int = 26;
2403 pub const KERN_NTP_PLL: ::c_int = 27;
2404 pub const KERN_BOOTFILE: ::c_int = 28;
2405 pub const KERN_MAXFILESPERPROC: ::c_int = 29;
2406 pub const KERN_MAXPROCPERUID: ::c_int = 30;
2407 pub const KERN_DUMPDEV: ::c_int = 31;
2408 pub const KERN_IPC: ::c_int = 32;
2409 pub const KERN_DUMMY: ::c_int = 33;
2410 pub const KERN_PS_STRINGS: ::c_int = 34;
2411 pub const KERN_USRSTACK32: ::c_int = 35;
2412 pub const KERN_LOGSIGEXIT: ::c_int = 36;
2413 pub const KERN_SYMFILE: ::c_int = 37;
2414 pub const KERN_PROCARGS: ::c_int = 38;
2415 pub const KERN_NETBOOT: ::c_int = 40;
2416 pub const KERN_SYSV: ::c_int = 42;
2417 pub const KERN_AFFINITY: ::c_int = 43;
2418 pub const KERN_TRANSLATE: ::c_int = 44;
2419 pub const KERN_CLASSIC: ::c_int = KERN_TRANSLATE;
2420 pub const KERN_EXEC: ::c_int = 45;
2421 pub const KERN_CLASSICHANDLER: ::c_int = KERN_EXEC;
2422 pub const KERN_AIOMAX: ::c_int = 46;
2423 pub const KERN_AIOPROCMAX: ::c_int = 47;
2424 pub const KERN_AIOTHREADS: ::c_int = 48;
2425 pub const KERN_COREFILE: ::c_int = 50;
2426 pub const KERN_COREDUMP: ::c_int = 51;
2427 pub const KERN_SUGID_COREDUMP: ::c_int = 52;
2428 pub const KERN_PROCDELAYTERM: ::c_int = 53;
2429 pub const KERN_SHREG_PRIVATIZABLE: ::c_int = 54;
2430 pub const KERN_LOW_PRI_WINDOW: ::c_int = 56;
2431 pub const KERN_LOW_PRI_DELAY: ::c_int = 57;
2432 pub const KERN_POSIX: ::c_int = 58;
2433 pub const KERN_USRSTACK64: ::c_int = 59;
2434 pub const KERN_NX_PROTECTION: ::c_int = 60;
2435 pub const KERN_TFP: ::c_int = 61;
2436 pub const KERN_PROCNAME: ::c_int = 62;
2437 pub const KERN_THALTSTACK: ::c_int = 63;
2438 pub const KERN_SPECULATIVE_READS: ::c_int = 64;
2439 pub const KERN_OSVERSION: ::c_int = 65;
2440 pub const KERN_SAFEBOOT: ::c_int = 66;
2441 pub const KERN_RAGEVNODE: ::c_int = 68;
2442 pub const KERN_TTY: ::c_int = 69;
2443 pub const KERN_CHECKOPENEVT: ::c_int = 70;
2444 pub const KERN_THREADNAME: ::c_int = 71;
2445 pub const KERN_MAXID: ::c_int = 72;
2446 pub const KERN_RAGE_PROC: ::c_int = 1;
2447 pub const KERN_RAGE_THREAD: ::c_int = 2;
2448 pub const KERN_UNRAGE_PROC: ::c_int = 3;
2449 pub const KERN_UNRAGE_THREAD: ::c_int = 4;
2450 pub const KERN_OPENEVT_PROC: ::c_int = 1;
2451 pub const KERN_UNOPENEVT_PROC: ::c_int = 2;
2452 pub const KERN_TFP_POLICY: ::c_int = 1;
2453 pub const KERN_TFP_POLICY_DENY: ::c_int = 0;
2454 pub const KERN_TFP_POLICY_DEFAULT: ::c_int = 2;
2455 pub const KERN_KDEFLAGS: ::c_int = 1;
2456 pub const KERN_KDDFLAGS: ::c_int = 2;
2457 pub const KERN_KDENABLE: ::c_int = 3;
2458 pub const KERN_KDSETBUF: ::c_int = 4;
2459 pub const KERN_KDGETBUF: ::c_int = 5;
2460 pub const KERN_KDSETUP: ::c_int = 6;
2461 pub const KERN_KDREMOVE: ::c_int = 7;
2462 pub const KERN_KDSETREG: ::c_int = 8;
2463 pub const KERN_KDGETREG: ::c_int = 9;
2464 pub const KERN_KDREADTR: ::c_int = 10;
2465 pub const KERN_KDPIDTR: ::c_int = 11;
2466 pub const KERN_KDTHRMAP: ::c_int = 12;
2467 pub const KERN_KDPIDEX: ::c_int = 14;
2468 pub const KERN_KDSETRTCDEC: ::c_int = 15;
2469 pub const KERN_KDGETENTROPY: ::c_int = 16;
2470 pub const KERN_KDWRITETR: ::c_int = 17;
2471 pub const KERN_KDWRITEMAP: ::c_int = 18;
2472 #[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")]
2473 pub const KERN_KDENABLE_BG_TRACE: ::c_int = 19;
2474 #[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")]
2475 pub const KERN_KDDISABLE_BG_TRACE: ::c_int = 20;
2476 pub const KERN_KDREADCURTHRMAP: ::c_int = 21;
2477 pub const KERN_KDSET_TYPEFILTER: ::c_int = 22;
2478 pub const KERN_KDBUFWAIT: ::c_int = 23;
2479 pub const KERN_KDCPUMAP: ::c_int = 24;
2480 pub const KERN_PROC_ALL: ::c_int = 0;
2481 pub const KERN_PROC_PID: ::c_int = 1;
2482 pub const KERN_PROC_PGRP: ::c_int = 2;
2483 pub const KERN_PROC_SESSION: ::c_int = 3;
2484 pub const KERN_PROC_TTY: ::c_int = 4;
2485 pub const KERN_PROC_UID: ::c_int = 5;
2486 pub const KERN_PROC_RUID: ::c_int = 6;
2487 pub const KERN_PROC_LCID: ::c_int = 7;
2488 pub const KIPC_MAXSOCKBUF: ::c_int = 1;
2489 pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
2490 pub const KIPC_SOMAXCONN: ::c_int = 3;
2491 pub const KIPC_MAX_LINKHDR: ::c_int = 4;
2492 pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
2493 pub const KIPC_MAX_HDR: ::c_int = 6;
2494 pub const KIPC_MAX_DATALEN: ::c_int = 7;
2495 pub const KIPC_MBSTAT: ::c_int = 8;
2496 pub const KIPC_NMBCLUSTERS: ::c_int = 9;
2497 pub const KIPC_SOQLIMITCOMPAT: ::c_int = 10;
2498 pub const VM_METER: ::c_int = 1;
2499 pub const VM_LOADAVG: ::c_int = 2;
2500 pub const VM_MACHFACTOR: ::c_int = 4;
2501 pub const VM_SWAPUSAGE: ::c_int = 5;
2502 pub const VM_MAXID: ::c_int = 6;
2503 pub const HW_MACHINE: ::c_int = 1;
2504 pub const HW_MODEL: ::c_int = 2;
2505 pub const HW_NCPU: ::c_int = 3;
2506 pub const HW_BYTEORDER: ::c_int = 4;
2507 pub const HW_PHYSMEM: ::c_int = 5;
2508 pub const HW_USERMEM: ::c_int = 6;
2509 pub const HW_PAGESIZE: ::c_int = 7;
2510 pub const HW_DISKNAMES: ::c_int = 8;
2511 pub const HW_DISKSTATS: ::c_int = 9;
2512 pub const HW_EPOCH: ::c_int = 10;
2513 pub const HW_FLOATINGPT: ::c_int = 11;
2514 pub const HW_MACHINE_ARCH: ::c_int = 12;
2515 pub const HW_VECTORUNIT: ::c_int = 13;
2516 pub const HW_BUS_FREQ: ::c_int = 14;
2517 pub const HW_CPU_FREQ: ::c_int = 15;
2518 pub const HW_CACHELINE: ::c_int = 16;
2519 pub const HW_L1ICACHESIZE: ::c_int = 17;
2520 pub const HW_L1DCACHESIZE: ::c_int = 18;
2521 pub const HW_L2SETTINGS: ::c_int = 19;
2522 pub const HW_L2CACHESIZE: ::c_int = 20;
2523 pub const HW_L3SETTINGS: ::c_int = 21;
2524 pub const HW_L3CACHESIZE: ::c_int = 22;
2525 pub const HW_TB_FREQ: ::c_int = 23;
2526 pub const HW_MEMSIZE: ::c_int = 24;
2527 pub const HW_AVAILCPU: ::c_int = 25;
2528 pub const HW_MAXID: ::c_int = 26;
2529 pub const USER_CS_PATH: ::c_int = 1;
2530 pub const USER_BC_BASE_MAX: ::c_int = 2;
2531 pub const USER_BC_DIM_MAX: ::c_int = 3;
2532 pub const USER_BC_SCALE_MAX: ::c_int = 4;
2533 pub const USER_BC_STRING_MAX: ::c_int = 5;
2534 pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
2535 pub const USER_EXPR_NEST_MAX: ::c_int = 7;
2536 pub const USER_LINE_MAX: ::c_int = 8;
2537 pub const USER_RE_DUP_MAX: ::c_int = 9;
2538 pub const USER_POSIX2_VERSION: ::c_int = 10;
2539 pub const USER_POSIX2_C_BIND: ::c_int = 11;
2540 pub const USER_POSIX2_C_DEV: ::c_int = 12;
2541 pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
2542 pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
2543 pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
2544 pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
2545 pub const USER_POSIX2_SW_DEV: ::c_int = 17;
2546 pub const USER_POSIX2_UPE: ::c_int = 18;
2547 pub const USER_STREAM_MAX: ::c_int = 19;
2548 pub const USER_TZNAME_MAX: ::c_int = 20;
2549 pub const USER_MAXID: ::c_int = 21;
2550 pub const CTL_DEBUG_NAME: ::c_int = 0;
2551 pub const CTL_DEBUG_VALUE: ::c_int = 1;
2552 pub const CTL_DEBUG_MAXID: ::c_int = 20;
2553 
2554 pub const PRIO_DARWIN_THREAD: ::c_int = 3;
2555 pub const PRIO_DARWIN_PROCESS: ::c_int = 4;
2556 pub const PRIO_DARWIN_BG: ::c_int = 0x1000;
2557 pub const PRIO_DARWIN_NONUI: ::c_int = 0x1001;
2558 
2559 pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t;
2560 
2561 pub const AI_PASSIVE: ::c_int = 0x00000001;
2562 pub const AI_CANONNAME: ::c_int = 0x00000002;
2563 pub const AI_NUMERICHOST: ::c_int = 0x00000004;
2564 pub const AI_NUMERICSERV: ::c_int = 0x00001000;
2565 pub const AI_MASK: ::c_int = AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST |
2566                              AI_NUMERICSERV | AI_ADDRCONFIG;
2567 pub const AI_ALL: ::c_int = 0x00000100;
2568 pub const AI_V4MAPPED_CFG: ::c_int = 0x00000200;
2569 pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
2570 pub const AI_V4MAPPED: ::c_int = 0x00000800;
2571 pub const AI_DEFAULT: ::c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG;
2572 pub const AI_UNUSABLE: ::c_int = 0x10000000;
2573 
2574 pub const SIGEV_NONE: ::c_int = 0;
2575 pub const SIGEV_SIGNAL: ::c_int = 1;
2576 pub const SIGEV_THREAD: ::c_int = 3;
2577 
2578 pub const AIO_CANCELED: ::c_int = 2;
2579 pub const AIO_NOTCANCELED: ::c_int = 4;
2580 pub const AIO_ALLDONE: ::c_int = 1;
2581 pub const AIO_LISTIO_MAX: ::c_int = 16;
2582 pub const LIO_NOP: ::c_int = 0;
2583 pub const LIO_WRITE: ::c_int = 2;
2584 pub const LIO_READ: ::c_int = 1;
2585 pub const LIO_WAIT: ::c_int = 2;
2586 pub const LIO_NOWAIT: ::c_int = 1;
2587 
2588 pub const WEXITED: ::c_int = 0x00000004;
2589 pub const WSTOPPED: ::c_int = 0x00000008;
2590 pub const WCONTINUED: ::c_int = 0x00000010;
2591 pub const WNOWAIT: ::c_int = 0x00000020;
2592 
2593 pub const P_ALL: idtype_t = 0;
2594 pub const P_PID: idtype_t = 1;
2595 pub const P_PGID: idtype_t = 2;
2596 
2597 pub const XATTR_NOFOLLOW: ::c_int = 0x0001;
2598 pub const XATTR_CREATE: ::c_int = 0x0002;
2599 pub const XATTR_REPLACE: ::c_int = 0x0004;
2600 pub const XATTR_NOSECURITY: ::c_int = 0x0008;
2601 pub const XATTR_NODEFAULT: ::c_int = 0x0010;
2602 pub const XATTR_SHOWCOMPRESSION: ::c_int = 0x0020;
2603 
2604 pub const NET_RT_IFLIST2: ::c_int = 0x0006;
2605 
2606 // net/route.h
2607 pub const RTF_UP: ::c_int = 0x1;
2608 pub const RTF_GATEWAY: ::c_int = 0x2;
2609 pub const RTF_HOST: ::c_int = 0x4;
2610 pub const RTF_REJECT: ::c_int = 0x8;
2611 pub const RTF_DYNAMIC: ::c_int = 0x10;
2612 pub const RTF_MODIFIED: ::c_int = 0x20;
2613 pub const RTF_DONE: ::c_int = 0x40;
2614 pub const RTF_DELCLONE: ::c_int = 0x80;
2615 pub const RTF_CLONING: ::c_int = 0x100;
2616 pub const RTF_XRESOLVE: ::c_int = 0x200;
2617 pub const RTF_LLINFO: ::c_int = 0x400;
2618 pub const RTF_STATIC: ::c_int = 0x800;
2619 pub const RTF_BLACKHOLE: ::c_int = 0x1000;
2620 pub const RTF_NOIFREF: ::c_int = 0x2000;
2621 pub const RTF_PROTO2: ::c_int = 0x4000;
2622 pub const RTF_PROTO1: ::c_int = 0x8000;
2623 pub const RTF_PRCLONING: ::c_int = 0x10000;
2624 pub const RTF_WASCLONED: ::c_int = 0x20000;
2625 pub const RTF_PROTO3: ::c_int = 0x40000;
2626 pub const RTF_PINNED: ::c_int = 0x100000;
2627 pub const RTF_LOCAL: ::c_int = 0x200000;
2628 pub const RTF_BROADCAST: ::c_int = 0x400000;
2629 pub const RTF_MULTICAST: ::c_int = 0x800000;
2630 pub const RTF_IFSCOPE: ::c_int = 0x1000000;
2631 pub const RTF_CONDEMNED: ::c_int = 0x2000000;
2632 pub const RTF_IFREF: ::c_int = 0x4000000;
2633 pub const RTF_PROXY: ::c_int = 0x8000000;
2634 pub const RTF_ROUTER: ::c_int = 0x10000000;
2635 
2636 pub const RTM_VERSION: ::c_int = 5;
2637 
2638 // Message types
2639 pub const RTM_ADD: ::c_int = 0x1;
2640 pub const RTM_DELETE: ::c_int = 0x2;
2641 pub const RTM_CHANGE: ::c_int = 0x3;
2642 pub const RTM_GET: ::c_int = 0x4;
2643 pub const RTM_LOSING: ::c_int = 0x5;
2644 pub const RTM_REDIRECT: ::c_int = 0x6;
2645 pub const RTM_MISS: ::c_int = 0x7;
2646 pub const RTM_LOCK: ::c_int = 0x8;
2647 pub const RTM_OLDADD: ::c_int = 0x9;
2648 pub const RTM_OLDDEL: ::c_int = 0xa;
2649 pub const RTM_RESOLVE: ::c_int = 0xb;
2650 pub const RTM_NEWADDR: ::c_int = 0xc;
2651 pub const RTM_DELADDR: ::c_int = 0xd;
2652 pub const RTM_IFINFO: ::c_int = 0xe;
2653 pub const RTM_NEWMADDR: ::c_int = 0xf;
2654 pub const RTM_DELMADDR: ::c_int = 0x10;
2655 pub const RTM_IFINFO2: ::c_int = 0x12;
2656 pub const RTM_NEWMADDR2: ::c_int = 0x13;
2657 pub const RTM_GET2: ::c_int = 0x14;
2658 
2659 // Bitmask values for rtm_inits and rmx_locks.
2660 pub const RTV_MTU: ::c_int = 0x1;
2661 pub const RTV_HOPCOUNT: ::c_int = 0x2;
2662 pub const RTV_EXPIRE: ::c_int = 0x4;
2663 pub const RTV_RPIPE: ::c_int = 0x8;
2664 pub const RTV_SPIPE: ::c_int = 0x10;
2665 pub const RTV_SSTHRESH: ::c_int = 0x20;
2666 pub const RTV_RTT: ::c_int = 0x40;
2667 pub const RTV_RTTVAR: ::c_int = 0x80;
2668 
2669 // Bitmask values for rtm_addrs.
2670 pub const RTA_DST: ::c_int = 0x1;
2671 pub const RTA_GATEWAY: ::c_int = 0x2;
2672 pub const RTA_NETMASK: ::c_int = 0x4;
2673 pub const RTA_GENMASK: ::c_int = 0x8;
2674 pub const RTA_IFP: ::c_int = 0x10;
2675 pub const RTA_IFA: ::c_int = 0x20;
2676 pub const RTA_AUTHOR: ::c_int = 0x40;
2677 pub const RTA_BRD: ::c_int = 0x80;
2678 
2679 // Index offsets for sockaddr array for alternate internal encoding.
2680 pub const RTAX_DST: ::c_int = 0;
2681 pub const RTAX_GATEWAY: ::c_int = 1;
2682 pub const RTAX_NETMASK: ::c_int = 2;
2683 pub const RTAX_GENMASK: ::c_int = 3;
2684 pub const RTAX_IFP: ::c_int = 4;
2685 pub const RTAX_IFA: ::c_int = 5;
2686 pub const RTAX_AUTHOR: ::c_int = 6;
2687 pub const RTAX_BRD: ::c_int = 7;
2688 pub const RTAX_MAX: ::c_int = 8;
2689 
2690 pub const KERN_PROCARGS2: ::c_int = 49;
2691 
2692 pub const PROC_PIDTASKALLINFO: ::c_int = 2;
2693 pub const PROC_PIDTASKINFO: ::c_int = 4;
2694 pub const PROC_PIDTHREADINFO: ::c_int = 5;
2695 pub const MAXCOMLEN: usize = 16;
2696 pub const MAXTHREADNAMESIZE: usize = 64;
2697 
2698 pub const XUCRED_VERSION: ::c_uint = 0;
2699 
2700 pub const LC_SEGMENT: u32 = 0x1;
2701 pub const LC_SEGMENT_64: u32 = 0x19;
2702 
2703 pub const MH_MAGIC: u32 = 0xfeedface;
2704 pub const MH_MAGIC_64: u32 = 0xfeedfacf;
2705 
2706 // net/if_utun.h
2707 pub const UTUN_OPT_FLAGS: ::c_int = 1;
2708 pub const UTUN_OPT_IFNAME: ::c_int = 2;
2709 
2710 // net/bpf.h
2711 pub const DLT_NULL: ::c_uint = 0;         // no link-layer encapsulation
2712 pub const DLT_EN10MB: ::c_uint = 1;       // Ethernet (10Mb)
2713 pub const DLT_EN3MB: ::c_uint = 2;        // Experimental Ethernet (3Mb)
2714 pub const DLT_AX25: ::c_uint = 3;         // Amateur Radio AX.25
2715 pub const DLT_PRONET: ::c_uint = 4;       // Proteon ProNET Token Ring
2716 pub const DLT_CHAOS: ::c_uint = 5;        // Chaos
2717 pub const DLT_IEEE802: ::c_uint = 6;      // IEEE 802 Networks
2718 pub const DLT_ARCNET: ::c_uint = 7;       // ARCNET
2719 pub const DLT_SLIP: ::c_uint = 8;         // Serial Line IP
2720 pub const DLT_PPP: ::c_uint = 9;          // Point-to-point Protocol
2721 pub const DLT_FDDI: ::c_uint = 10;        // FDDI
2722 pub const DLT_ATM_RFC1483: ::c_uint = 11; // LLC/SNAP encapsulated atm
2723 pub const DLT_RAW: ::c_uint = 12;         // raw IP
2724 pub const DLT_LOOP: ::c_uint = 108;
2725 
2726 // https://github.com/apple/darwin-xnu/blob/master/bsd/net/bpf.h#L100
2727 // sizeof(int32_t)
2728 pub const BPF_ALIGNMENT: ::c_int = 4;
2729 
2730 // sys/spawn.h:
2731 pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
2732 pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
2733 pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
2734 pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
2735 pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
2736 pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
2737 pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;
2738 
2739 // sys/ipc.h:
2740 pub const IPC_CREAT: ::c_int = 0x200;
2741 pub const IPC_EXCL: ::c_int = 0x400;
2742 pub const IPC_NOWAIT: ::c_int = 0x800;
2743 pub const IPC_PRIVATE: key_t = 0;
2744 
2745 pub const IPC_RMID: ::c_int = 0;
2746 pub const IPC_SET: ::c_int = 1;
2747 pub const IPC_STAT: ::c_int = 2;
2748 
2749 pub const IPC_R: ::c_int = 0x100;
2750 pub const IPC_W: ::c_int = 0x80;
2751 pub const IPC_M: ::c_int = 0x1000;
2752 
2753 // sys/sem.h
2754 pub const SEM_UNDO: ::c_int = 0o10000;
2755 
2756 pub const GETNCNT: ::c_int = 3;
2757 pub const GETPID: ::c_int = 4;
2758 pub const GETVAL: ::c_int = 5;
2759 pub const GETALL: ::c_int = 6;
2760 pub const GETZCNT: ::c_int = 7;
2761 pub const SETVAL: ::c_int = 8;
2762 pub const SETALL: ::c_int = 9;
2763 
2764 // sys/shm.h
2765 pub const SHM_RDONLY: ::c_int = 0x1000;
2766 pub const SHM_RND: ::c_int = 0x2000;
2767 pub const SHMLBA: ::c_int = 4096;
2768 pub const SHM_R: ::c_int = IPC_R;
2769 pub const SHM_W: ::c_int = IPC_W;
2770 
2771 // Flags for chflags(2)
2772 pub const UF_SETTABLE:      ::c_uint = 0x0000ffff;
2773 pub const UF_NODUMP:        ::c_uint = 0x00000001;
2774 pub const UF_IMMUTABLE:     ::c_uint = 0x00000002;
2775 pub const UF_APPEND:        ::c_uint = 0x00000004;
2776 pub const UF_OPAQUE:        ::c_uint = 0x00000008;
2777 pub const UF_COMPRESSED:    ::c_uint = 0x00000020;
2778 pub const UF_TRACKED:       ::c_uint = 0x00000040;
2779 pub const SF_SETTABLE:      ::c_uint = 0xffff0000;
2780 pub const SF_ARCHIVED:      ::c_uint = 0x00010000;
2781 pub const SF_IMMUTABLE:     ::c_uint = 0x00020000;
2782 pub const SF_APPEND:        ::c_uint = 0x00040000;
2783 pub const UF_HIDDEN:        ::c_uint = 0x00008000;
2784 
2785 cfg_if! {
2786     if #[cfg(libc_const_size_of)] {
2787         fn __DARWIN_ALIGN32(p: usize) -> usize {
2788             const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
2789             p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
2790         }
2791     } else {
2792         fn __DARWIN_ALIGN32(p: usize) -> usize {
2793             let __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
2794             p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
2795         }
2796     }
2797 }
2798 
2799 f! {
2800     pub fn CMSG_NXTHDR(mhdr: *const ::msghdr,
2801                        cmsg: *const ::cmsghdr) -> *mut ::cmsghdr {
2802         if cmsg.is_null() {
2803             return ::CMSG_FIRSTHDR(mhdr);
2804         };
2805         let cmsg_len = (*cmsg).cmsg_len as usize;
2806         let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize);
2807         let max = (*mhdr).msg_control as usize
2808                    + (*mhdr).msg_controllen as usize;
2809         if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max {
2810             0 as *mut ::cmsghdr
2811         } else {
2812             next as *mut ::cmsghdr
2813         }
2814     }
2815 
2816     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
2817         (cmsg as *mut ::c_uchar)
2818             .offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize)
2819     }
2820 
2821     pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
2822         (__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>())
2823             + __DARWIN_ALIGN32(length as usize))
2824             as ::c_uint
2825     }
2826 
2827     pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
2828         (__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) + length as usize)
2829             as ::c_uint
2830     }
2831 
2832     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
2833         status >> 8
2834     }
2835 
2836     pub fn _WSTATUS(status: ::c_int) -> ::c_int {
2837         status & 0x7f
2838     }
2839 
2840     pub fn WIFCONTINUED(status: ::c_int) -> bool {
2841         _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) == 0x13
2842     }
2843 
2844     pub fn WIFSIGNALED(status: ::c_int) -> bool {
2845         _WSTATUS(status) != _WSTOPPED && _WSTATUS(status) != 0
2846     }
2847 
2848     pub fn WIFSTOPPED(status: ::c_int) -> bool {
2849         _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) != 0x13
2850     }
2851 }
2852 
2853 extern {
2854     #[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.5")]
2855     #[link_name = "daemon$1050"]
daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int2856     pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
2857     #[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")]
sem_destroy(sem: *mut sem_t) -> ::c_int2858     pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
2859     #[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")]
sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int2860     pub fn sem_init(sem: *mut sem_t,
2861                     pshared: ::c_int,
2862                     value: ::c_uint)
2863                     -> ::c_int;
aio_read(aiocbp: *mut aiocb) -> ::c_int2864     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int2865     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int2866     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int2867     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t2868     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
2869     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
2870                link_name = "aio_suspend$UNIX2003")]
aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec) -> ::c_int2871     pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
2872                        timeout: *const ::timespec) -> ::c_int;
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int2873     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int2874     pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int;
fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int2875     pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int;
clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int2876     pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int2877     pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent) -> ::c_int2878     pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
2879                       nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
2880 
dirfd(dirp: *mut ::DIR) -> ::c_int2881     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
2882 
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int2883     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
2884 
getutxent() -> *mut utmpx2885     pub fn getutxent() -> *mut utmpx;
getutxid(ut: *const utmpx) -> *mut utmpx2886     pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
getutxline(ut: *const utmpx) -> *mut utmpx2887     pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pututxline(ut: *const utmpx) -> *mut utmpx2888     pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
setutxent()2889     pub fn setutxent();
endutxent()2890     pub fn endutxent();
utmpxname(file: *const ::c_char) -> ::c_int2891     pub fn utmpxname(file: *const ::c_char) -> ::c_int;
2892 
getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, sevlen: ::socklen_t, flags: ::c_int) -> ::c_int2893     pub fn getnameinfo(sa: *const ::sockaddr,
2894                        salen: ::socklen_t,
2895                        host: *mut ::c_char,
2896                        hostlen: ::socklen_t,
2897                        serv: *mut ::c_char,
2898                        sevlen: ::socklen_t,
2899                        flags: ::c_int) -> ::c_int;
mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int2900     pub fn mincore(addr: *const ::c_void, len: ::size_t,
2901                    vec: *mut ::c_char) -> ::c_int;
sysctlnametomib(name: *const ::c_char, mibp: *mut ::c_int, sizep: *mut ::size_t) -> ::c_int2902     pub fn sysctlnametomib(name: *const ::c_char,
2903                            mibp: *mut ::c_int,
2904                            sizep: *mut ::size_t)
2905                            -> ::c_int;
2906     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
2907                link_name = "mprotect$UNIX2003")]
mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int2908     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
2909                     -> ::c_int;
semget(key: key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int2910     pub fn semget(key: key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int;
2911     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
2912                link_name = "semctl$UNIX2003")]
semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int2913     pub fn semctl(semid: ::c_int,
2914                   semnum: ::c_int,
2915                   cmd: ::c_int, ...) -> ::c_int;
semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int2916     pub fn semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int;
shm_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::c_int2917     pub fn shm_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::c_int;
ftok(pathname : *const c_char, proj_id : ::c_int) -> key_t2918     pub fn ftok(pathname : *const c_char, proj_id : ::c_int) -> key_t;
shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void2919     pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void,
2920                  shmflg: ::c_int) -> *mut ::c_void;
shmdt(shmaddr: *const ::c_void) -> ::c_int2921     pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
2922     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
2923                link_name = "shmctl$UNIX2003")]
shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int2924     pub fn shmctl(shmid: ::c_int, cmd: ::c_int,
2925                   buf: *mut ::shmid_ds) -> ::c_int;
shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int2926     pub fn shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
sysctl(name: *mut ::c_int, namelen: ::c_uint, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *mut ::c_void, newlen: ::size_t) -> ::c_int2927     pub fn sysctl(name: *mut ::c_int,
2928                   namelen: ::c_uint,
2929                   oldp: *mut ::c_void,
2930                   oldlenp: *mut ::size_t,
2931                   newp: *mut ::c_void,
2932                   newlen: ::size_t)
2933                   -> ::c_int;
sysctlbyname(name: *const ::c_char, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *mut ::c_void, newlen: ::size_t) -> ::c_int2934     pub fn sysctlbyname(name: *const ::c_char,
2935                         oldp: *mut ::c_void,
2936                         oldlenp: *mut ::size_t,
2937                         newp: *mut ::c_void,
2938                         newlen: ::size_t)
2939                         -> ::c_int;
mach_absolute_time() -> u642940     pub fn mach_absolute_time() -> u64;
mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int2941     pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int;
pthread_setname_np(name: *const ::c_char) -> ::c_int2942     pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int;
pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void2943     pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void;
pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t2944     pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t;
pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int2945     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
2946                                        pshared: ::c_int) -> ::c_int;
pthread_condattr_getpshared(attr: *const pthread_condattr_t, pshared: *mut ::c_int) -> ::c_int2947     pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
2948                                        pshared: *mut ::c_int) -> ::c_int;
pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: ::c_int) -> ::c_int2949     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
2950                                         pshared: ::c_int) -> ::c_int;
pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, pshared: *mut ::c_int) -> ::c_int2951     pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
2952                                         pshared: *mut ::c_int) -> ::c_int;
pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, val: *mut ::c_int) -> ::c_int2953     pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
2954                                          val: *mut ::c_int) -> ::c_int;
pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int2955     pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
2956                                          val: ::c_int) -> ::c_int;
__error() -> *mut ::c_int2957     pub fn __error() -> *mut ::c_int;
backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int2958     pub fn backtrace(buf: *mut *mut ::c_void,
2959                      sz: ::c_int) -> ::c_int;
2960     #[cfg_attr(target_os = "macos", link_name = "statfs$INODE64")]
statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int2961     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
2962     #[cfg_attr(target_os = "macos", link_name = "fstatfs$INODE64")]
fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int2963     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
kevent(kq: ::c_int, changelist: *const ::kevent, nchanges: ::c_int, eventlist: *mut ::kevent, nevents: ::c_int, timeout: *const ::timespec) -> ::c_int2964     pub fn kevent(kq: ::c_int,
2965                   changelist: *const ::kevent,
2966                   nchanges: ::c_int,
2967                   eventlist: *mut ::kevent,
2968                   nevents: ::c_int,
2969                   timeout: *const ::timespec) -> ::c_int;
kevent64(kq: ::c_int, changelist: *const ::kevent64_s, nchanges: ::c_int, eventlist: *mut ::kevent64_s, nevents: ::c_int, flags: ::c_uint, timeout: *const ::timespec) -> ::c_int2970     pub fn kevent64(kq: ::c_int,
2971                     changelist: *const ::kevent64_s,
2972                     nchanges: ::c_int,
2973                     eventlist: *mut ::kevent64_s,
2974                     nevents: ::c_int,
2975                     flags: ::c_uint,
2976                     timeout: *const ::timespec) -> ::c_int;
mount(src: *const ::c_char, target: *const ::c_char, flags: ::c_int, data: *mut ::c_void) -> ::c_int2977     pub fn mount(src: *const ::c_char,
2978                  target: *const ::c_char,
2979                  flags: ::c_int,
2980                  data: *mut ::c_void) -> ::c_int;
ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_char, data: ::c_int) -> ::c_int2981     pub fn ptrace(request: ::c_int,
2982                   pid: ::pid_t,
2983                   addr: *mut ::c_char,
2984                   data: ::c_int) -> ::c_int;
quotactl(special: *const ::c_char, cmd: ::c_int, id: ::c_int, data: *mut ::c_char) -> ::c_int2985     pub fn quotactl(special: *const ::c_char,
2986                     cmd: ::c_int,
2987                     id: ::c_int,
2988                     data: *mut ::c_char) -> ::c_int;
sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int2989     pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
sendfile(fd: ::c_int, s: ::c_int, offset: ::off_t, len: *mut ::off_t, hdtr: *mut ::sf_hdtr, flags: ::c_int) -> ::c_int2990     pub fn sendfile(fd: ::c_int,
2991                     s: ::c_int,
2992                     offset: ::off_t,
2993                     len: *mut ::off_t,
2994                     hdtr: *mut ::sf_hdtr,
2995                     flags: ::c_int) -> ::c_int;
futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int2996     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
utimensat(dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int) -> ::c_int2997     pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
2998                      times: *const ::timespec, flag: ::c_int) -> ::c_int;
openpty(amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize) -> ::c_int2999     pub fn openpty(amaster: *mut ::c_int,
3000                    aslave: *mut ::c_int,
3001                    name: *mut ::c_char,
3002                    termp: *mut termios,
3003                    winp: *mut ::winsize) -> ::c_int;
forkpty(amaster: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize) -> ::pid_t3004     pub fn forkpty(amaster: *mut ::c_int,
3005                    name: *mut ::c_char,
3006                    termp: *mut termios,
3007                    winp: *mut ::winsize) -> ::pid_t;
duplocale(base: ::locale_t) -> ::locale_t3008     pub fn duplocale(base: ::locale_t) -> ::locale_t;
freelocale(loc: ::locale_t) -> ::c_int3009     pub fn freelocale(loc: ::locale_t) -> ::c_int;
localeconv_l(loc: ::locale_t) -> *mut lconv3010     pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t3011     pub fn newlocale(mask: ::c_int,
3012                      locale: *const ::c_char,
3013                      base: ::locale_t) -> ::locale_t;
uselocale(loc: ::locale_t) -> ::locale_t3014     pub fn uselocale(loc: ::locale_t) -> ::locale_t;
querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char3015     pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
getpriority(which: ::c_int, who: ::id_t) -> ::c_int3016     pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int3017     pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int3018     pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int3019     pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int;
getxattr(path: *const ::c_char, name: *const ::c_char, value: *mut ::c_void, size: ::size_t, position: u32, flags: ::c_int) -> ::ssize_t3020     pub fn getxattr(path: *const ::c_char, name: *const ::c_char,
3021                     value: *mut ::c_void, size: ::size_t, position: u32,
3022                     flags: ::c_int) -> ::ssize_t;
fgetxattr(filedes: ::c_int, name: *const ::c_char, value: *mut ::c_void, size: ::size_t, position: u32, flags: ::c_int) -> ::ssize_t3023     pub fn fgetxattr(filedes: ::c_int, name: *const ::c_char,
3024                      value: *mut ::c_void, size: ::size_t, position: u32,
3025                      flags: ::c_int) -> ::ssize_t;
setxattr(path: *const ::c_char, name: *const ::c_char, value: *const ::c_void, size: ::size_t, position: u32, flags: ::c_int) -> ::c_int3026     pub fn setxattr(path: *const ::c_char, name: *const ::c_char,
3027                     value: *const ::c_void, size: ::size_t, position: u32,
3028                     flags: ::c_int) -> ::c_int;
fsetxattr(filedes: ::c_int, name: *const ::c_char, value: *const ::c_void, size: ::size_t, position: u32, flags: ::c_int) -> ::c_int3029     pub fn fsetxattr(filedes: ::c_int, name: *const ::c_char,
3030                      value: *const ::c_void, size: ::size_t, position: u32,
3031                      flags: ::c_int) -> ::c_int;
listxattr(path: *const ::c_char, list: *mut ::c_char, size: ::size_t, flags: ::c_int) -> ::ssize_t3032     pub fn listxattr(path: *const ::c_char, list: *mut ::c_char,
3033                      size: ::size_t, flags: ::c_int) -> ::ssize_t;
flistxattr(filedes: ::c_int, list: *mut ::c_char, size: ::size_t, flags: ::c_int) -> ::ssize_t3034     pub fn flistxattr(filedes: ::c_int, list: *mut ::c_char,
3035                       size: ::size_t, flags: ::c_int) -> ::ssize_t;
removexattr(path: *const ::c_char, name: *const ::c_char, flags: ::c_int) -> ::c_int3036     pub fn removexattr(path: *const ::c_char, name: *const ::c_char,
3037                        flags: ::c_int) -> ::c_int;
renamex_np(from: *const ::c_char, to: *const ::c_char, flags: ::c_uint) -> ::c_int3038     pub fn renamex_np(from: *const ::c_char, to: *const ::c_char,
3039                       flags: ::c_uint) -> ::c_int;
renameatx_np(fromfd: ::c_int, from: *const ::c_char, tofd: ::c_int, to: *const ::c_char, flags: ::c_uint) -> ::c_int3040     pub fn renameatx_np(fromfd: ::c_int, from: *const ::c_char,
3041                         tofd: ::c_int, to: *const ::c_char,
3042                         flags: ::c_uint) -> ::c_int;
fremovexattr(filedes: ::c_int, name: *const ::c_char, flags: ::c_int) -> ::c_int3043     pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char,
3044                         flags: ::c_int) -> ::c_int;
3045 
getgrouplist(name: *const ::c_char, basegid: ::c_int, groups: *mut ::c_int, ngroups: *mut ::c_int) -> ::c_int3046     pub fn getgrouplist(name: *const ::c_char,
3047                         basegid: ::c_int,
3048                         groups: *mut ::c_int,
3049                         ngroups: *mut ::c_int) -> ::c_int;
initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int3050     pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;
3051 
3052     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
3053                link_name = "waitid$UNIX2003")]
waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int3054     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
3055                   options: ::c_int) -> ::c_int;
brk(addr: *const ::c_void) -> *mut ::c_void3056     pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
sbrk(increment: ::c_int) -> *mut ::c_void3057     pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int3058     pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
_dyld_image_count() -> u323059     pub fn _dyld_image_count() -> u32;
_dyld_get_image_header(image_index: u32) -> *const mach_header3060     pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header;
_dyld_get_image_vmaddr_slide(image_index: u32) -> ::intptr_t3061     pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> ::intptr_t;
_dyld_get_image_name(image_index: u32) -> *const ::c_char3062     pub fn _dyld_get_image_name(image_index: u32) -> *const ::c_char;
3063 
posix_spawn(pid: *mut ::pid_t, path: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int3064     pub fn posix_spawn(pid: *mut ::pid_t,
3065                        path: *const ::c_char,
3066                        file_actions: *const ::posix_spawn_file_actions_t,
3067                        attrp: *const ::posix_spawnattr_t,
3068                        argv: *const *mut ::c_char,
3069                        envp: *const *mut ::c_char) -> ::c_int;
posix_spawnp(pid: *mut ::pid_t, file: *const ::c_char, file_actions: *const ::posix_spawn_file_actions_t, attrp: *const ::posix_spawnattr_t, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int3070     pub fn posix_spawnp(pid: *mut ::pid_t,
3071                        file: *const ::c_char,
3072                         file_actions: *const ::posix_spawn_file_actions_t,
3073                         attrp: *const ::posix_spawnattr_t,
3074                         argv: *const *mut ::c_char,
3075                         envp: *const *mut ::c_char) -> ::c_int;
posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int3076     pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int3077     pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t, default: *mut ::sigset_t) -> ::c_int3078     pub fn posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t,
3079                                          default: *mut ::sigset_t) -> ::c_int;
posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t, default: *const ::sigset_t) -> ::c_int3080     pub fn posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t,
3081                                          default: *const ::sigset_t) -> ::c_int;
posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t, default: *mut ::sigset_t) -> ::c_int3082     pub fn posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t,
3083                                       default: *mut ::sigset_t) -> ::c_int;
posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t, default: *const ::sigset_t) -> ::c_int3084     pub fn posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t,
3085                                       default: *const ::sigset_t) -> ::c_int;
posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut ::c_short) -> ::c_int3086     pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t,
3087                                     flags: *mut ::c_short) -> ::c_int;
posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int3088     pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t,
3089                                     flags: ::c_short) -> ::c_int;
posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, flags: *mut ::pid_t) -> ::c_int3090     pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t,
3091                                      flags: *mut ::pid_t) -> ::c_int;
posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int3092     pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t,
3093                                      flags: ::pid_t) -> ::c_int;
3094 
posix_spawn_file_actions_init( actions: *mut posix_spawn_file_actions_t, ) -> ::c_int3095     pub fn posix_spawn_file_actions_init(
3096         actions: *mut posix_spawn_file_actions_t,
3097     ) -> ::c_int;
posix_spawn_file_actions_destroy( actions: *mut posix_spawn_file_actions_t, ) -> ::c_int3098     pub fn posix_spawn_file_actions_destroy(
3099         actions: *mut posix_spawn_file_actions_t,
3100     ) -> ::c_int;
posix_spawn_file_actions_addopen( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, path: *const ::c_char, oflag: ::c_int, mode: ::mode_t, ) -> ::c_int3101     pub fn posix_spawn_file_actions_addopen(
3102         actions: *mut posix_spawn_file_actions_t,
3103         fd: ::c_int,
3104         path: *const ::c_char,
3105         oflag: ::c_int,
3106         mode: ::mode_t,
3107     ) -> ::c_int;
posix_spawn_file_actions_addclose( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, ) -> ::c_int3108     pub fn posix_spawn_file_actions_addclose(
3109         actions: *mut posix_spawn_file_actions_t,
3110         fd: ::c_int,
3111     ) -> ::c_int;
posix_spawn_file_actions_adddup2( actions: *mut posix_spawn_file_actions_t, fd: ::c_int, newfd: ::c_int, ) -> ::c_int3112     pub fn posix_spawn_file_actions_adddup2(
3113         actions: *mut posix_spawn_file_actions_t,
3114         fd: ::c_int,
3115         newfd: ::c_int,
3116     ) -> ::c_int;
uname(buf: *mut ::utsname) -> ::c_int3117     pub fn uname(buf: *mut ::utsname) -> ::c_int;
3118 }
3119 
3120 cfg_if! {
3121     if #[cfg(any(target_arch = "arm", target_arch = "x86"))] {
3122         mod b32;
3123         pub use self::b32::*;
3124     } else if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
3125         mod b64;
3126         pub use self::b64::*;
3127     } else {
3128         // Unknown target_arch
3129     }
3130 }
3131