• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 pub type clock_t = ::c_uint;
2 pub type suseconds_t = ::c_int;
3 pub type dev_t = u64;
4 pub type blksize_t = i32;
5 pub type fsblkcnt_t = u64;
6 pub type fsfilcnt_t = u64;
7 pub type idtype_t = ::c_int;
8 pub type mqd_t = ::c_int;
9 type __pthread_spin_t = __cpu_simple_lock_nv_t;
10 pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
11 pub type lwpid_t = ::c_uint;
12 pub type shmatt_t = ::c_uint;
13 pub type cpuid_t = ::c_ulong;
14 pub type cpuset_t = _cpuset;
15 pub type pthread_spin_t = ::c_uchar;
16 pub type timer_t = ::c_int;
17 
18 // elf.h
19 
20 pub type Elf32_Addr = u32;
21 pub type Elf32_Half = u16;
22 pub type Elf32_Lword = u64;
23 pub type Elf32_Off = u32;
24 pub type Elf32_Sword = i32;
25 pub type Elf32_Word = u32;
26 
27 pub type Elf64_Addr = u64;
28 pub type Elf64_Half = u16;
29 pub type Elf64_Lword = u64;
30 pub type Elf64_Off = u64;
31 pub type Elf64_Sword = i32;
32 pub type Elf64_Sxword = i64;
33 pub type Elf64_Word = u32;
34 pub type Elf64_Xword = u64;
35 
36 pub type iconv_t = *mut ::c_void;
37 
38 e! {
39     pub enum fae_action {
40         FAE_OPEN,
41         FAE_DUP2,
42         FAE_CLOSE,
43     }
44 }
45 
46 cfg_if! {
47     if #[cfg(target_pointer_width = "64")] {
48         type Elf_Addr = Elf64_Addr;
49         type Elf_Half = Elf64_Half;
50         type Elf_Phdr = Elf64_Phdr;
51     } else if #[cfg(target_pointer_width = "32")] {
52         type Elf_Addr = Elf32_Addr;
53         type Elf_Half = Elf32_Half;
54         type Elf_Phdr = Elf32_Phdr;
55     }
56 }
57 
58 impl siginfo_t {
si_addr(&self) -> *mut ::c_void59     pub unsafe fn si_addr(&self) -> *mut ::c_void {
60         self.si_addr
61     }
62 
si_code(&self) -> ::c_int63     pub unsafe fn si_code(&self) -> ::c_int {
64         self.si_code
65     }
66 
si_errno(&self) -> ::c_int67     pub unsafe fn si_errno(&self) -> ::c_int {
68         self.si_errno
69     }
70 
si_pid(&self) -> ::pid_t71     pub unsafe fn si_pid(&self) -> ::pid_t {
72         #[repr(C)]
73         struct siginfo_timer {
74             _si_signo: ::c_int,
75             _si_errno: ::c_int,
76             _si_code: ::c_int,
77             __pad1: ::c_int,
78             _pid: ::pid_t,
79         }
80         (*(self as *const siginfo_t as *const siginfo_timer))._pid
81     }
82 
si_uid(&self) -> ::uid_t83     pub unsafe fn si_uid(&self) -> ::uid_t {
84         #[repr(C)]
85         struct siginfo_timer {
86             _si_signo: ::c_int,
87             _si_errno: ::c_int,
88             _si_code: ::c_int,
89             __pad1: ::c_int,
90             _pid: ::pid_t,
91             _uid: ::uid_t,
92         }
93         (*(self as *const siginfo_t as *const siginfo_timer))._uid
94     }
95 
si_value(&self) -> ::sigval96     pub unsafe fn si_value(&self) -> ::sigval {
97         #[repr(C)]
98         struct siginfo_timer {
99             _si_signo: ::c_int,
100             _si_errno: ::c_int,
101             _si_code: ::c_int,
102             __pad1: ::c_int,
103             _pid: ::pid_t,
104             _uid: ::uid_t,
105             value: ::sigval,
106         }
107         (*(self as *const siginfo_t as *const siginfo_timer)).value
108     }
109 
si_status(&self) -> ::c_int110     pub unsafe fn si_status(&self) -> ::c_int {
111         #[repr(C)]
112         struct siginfo_timer {
113             _si_signo: ::c_int,
114             _si_errno: ::c_int,
115             _si_code: ::c_int,
116             __pad1: ::c_int,
117             _pid: ::pid_t,
118             _uid: ::uid_t,
119             _value: ::sigval,
120             _cpid: ::pid_t,
121             _cuid: ::uid_t,
122             status: ::c_int,
123         }
124         (*(self as *const siginfo_t as *const siginfo_timer)).status
125     }
126 }
127 
128 s! {
129     pub struct aiocb {
130         pub aio_offset: ::off_t,
131         pub aio_buf: *mut ::c_void,
132         pub aio_nbytes: ::size_t,
133         pub aio_fildes: ::c_int,
134         pub aio_lio_opcode: ::c_int,
135         pub aio_reqprio: ::c_int,
136         pub aio_sigevent: ::sigevent,
137         _state: ::c_int,
138         _errno: ::c_int,
139         _retval: ::ssize_t
140     }
141 
142     pub struct glob_t {
143         pub gl_pathc:   ::size_t,
144         pub gl_matchc:  ::size_t,
145         pub gl_offs:    ::size_t,
146         pub gl_flags:   ::c_int,
147         pub gl_pathv:   *mut *mut ::c_char,
148 
149         __unused3: *mut ::c_void,
150 
151         __unused4: *mut ::c_void,
152         __unused5: *mut ::c_void,
153         __unused6: *mut ::c_void,
154         __unused7: *mut ::c_void,
155         __unused8: *mut ::c_void,
156     }
157 
158     pub struct mq_attr {
159         pub mq_flags: ::c_long,
160         pub mq_maxmsg: ::c_long,
161         pub mq_msgsize: ::c_long,
162         pub mq_curmsgs: ::c_long,
163     }
164 
165     pub struct itimerspec {
166         pub it_interval: ::timespec,
167         pub it_value: ::timespec,
168     }
169 
170     pub struct sigset_t {
171         __bits: [u32; 4],
172     }
173 
174     pub struct stat {
175         pub st_dev: ::dev_t,
176         pub st_mode: ::mode_t,
177         pub st_ino: ::ino_t,
178         pub st_nlink: ::nlink_t,
179         pub st_uid: ::uid_t,
180         pub st_gid: ::gid_t,
181         pub st_rdev: ::dev_t,
182         pub st_atime: ::time_t,
183         pub st_atimensec: ::c_long,
184         pub st_mtime: ::time_t,
185         pub st_mtimensec: ::c_long,
186         pub st_ctime: ::time_t,
187         pub st_ctimensec: ::c_long,
188         pub st_birthtime: ::time_t,
189         pub st_birthtimensec: ::c_long,
190         pub st_size: ::off_t,
191         pub st_blocks: ::blkcnt_t,
192         pub st_blksize: ::blksize_t,
193         pub st_flags: u32,
194         pub st_gen: u32,
195         pub st_spare: [u32; 2],
196     }
197 
198     pub struct addrinfo {
199         pub ai_flags: ::c_int,
200         pub ai_family: ::c_int,
201         pub ai_socktype: ::c_int,
202         pub ai_protocol: ::c_int,
203         pub ai_addrlen: ::socklen_t,
204         pub ai_canonname: *mut ::c_char,
205         pub ai_addr: *mut ::sockaddr,
206         pub ai_next: *mut ::addrinfo,
207     }
208 
209     pub struct siginfo_t {
210         pub si_signo: ::c_int,
211         pub si_code: ::c_int,
212         pub si_errno: ::c_int,
213         __pad1: ::c_int,
214         pub si_addr: *mut ::c_void,
215         __pad2: [u64; 13],
216     }
217 
218     pub struct pthread_attr_t {
219         pta_magic: ::c_uint,
220         pta_flags: ::c_int,
221         pta_private: *mut ::c_void,
222     }
223 
224     pub struct pthread_mutex_t {
225         ptm_magic: ::c_uint,
226         ptm_errorcheck: __pthread_spin_t,
227         #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
228                   target_arch = "x86", target_arch = "x86_64"))]
229         ptm_pad1: [u8; 3],
230         // actually a union with a non-unused, 0-initialized field
231         ptm_unused: __pthread_spin_t,
232         #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
233                   target_arch = "x86", target_arch = "x86_64"))]
234         ptm_pad2: [u8; 3],
235         ptm_owner: ::pthread_t,
236         ptm_waiters: *mut u8,
237         ptm_recursed: ::c_uint,
238         ptm_spare2: *mut ::c_void,
239     }
240 
241     pub struct pthread_mutexattr_t {
242         ptma_magic: ::c_uint,
243         ptma_private: *mut ::c_void,
244     }
245 
246     pub struct pthread_rwlockattr_t {
247         ptra_magic: ::c_uint,
248         ptra_private: *mut ::c_void,
249     }
250 
251     pub struct pthread_cond_t {
252         ptc_magic: ::c_uint,
253         ptc_lock: __pthread_spin_t,
254         ptc_waiters_first: *mut u8,
255         ptc_waiters_last: *mut u8,
256         ptc_mutex: *mut ::pthread_mutex_t,
257         ptc_private: *mut ::c_void,
258     }
259 
260     pub struct pthread_condattr_t {
261         ptca_magic: ::c_uint,
262         ptca_private: *mut ::c_void,
263     }
264 
265     pub struct pthread_rwlock_t {
266         ptr_magic: ::c_uint,
267         ptr_interlock: __pthread_spin_t,
268         ptr_rblocked_first: *mut u8,
269         ptr_rblocked_last: *mut u8,
270         ptr_wblocked_first: *mut u8,
271         ptr_wblocked_last: *mut u8,
272         ptr_nreaders: ::c_uint,
273         ptr_owner: ::pthread_t,
274         ptr_private: *mut ::c_void,
275     }
276 
277     pub struct pthread_spinlock_t {
278         pts_magic: ::c_uint,
279         pts_spin: ::pthread_spin_t,
280         pts_flags: ::c_int,
281     }
282 
283     pub struct kevent {
284         pub ident: ::uintptr_t,
285         pub filter: u32,
286         pub flags: u32,
287         pub fflags: u32,
288         pub data: i64,
289         pub udata: ::intptr_t, /* FIXME: NetBSD 10.0 will finally have same layout as other BSD */
290     }
291 
292     pub struct dqblk {
293         pub dqb_bhardlimit: u32,
294         pub dqb_bsoftlimit: u32,
295         pub dqb_curblocks: u32,
296         pub dqb_ihardlimit: u32,
297         pub dqb_isoftlimit: u32,
298         pub dqb_curinodes: u32,
299         pub dqb_btime: i32,
300         pub dqb_itime: i32,
301     }
302 
303     pub struct Dl_info {
304         pub dli_fname: *const ::c_char,
305         pub dli_fbase: *mut ::c_void,
306         pub dli_sname: *const ::c_char,
307         pub dli_saddr: *const ::c_void,
308     }
309 
310     pub struct lconv {
311         pub decimal_point: *mut ::c_char,
312         pub thousands_sep: *mut ::c_char,
313         pub grouping: *mut ::c_char,
314         pub int_curr_symbol: *mut ::c_char,
315         pub currency_symbol: *mut ::c_char,
316         pub mon_decimal_point: *mut ::c_char,
317         pub mon_thousands_sep: *mut ::c_char,
318         pub mon_grouping: *mut ::c_char,
319         pub positive_sign: *mut ::c_char,
320         pub negative_sign: *mut ::c_char,
321         pub int_frac_digits: ::c_char,
322         pub frac_digits: ::c_char,
323         pub p_cs_precedes: ::c_char,
324         pub p_sep_by_space: ::c_char,
325         pub n_cs_precedes: ::c_char,
326         pub n_sep_by_space: ::c_char,
327         pub p_sign_posn: ::c_char,
328         pub n_sign_posn: ::c_char,
329         pub int_p_cs_precedes: ::c_char,
330         pub int_n_cs_precedes: ::c_char,
331         pub int_p_sep_by_space: ::c_char,
332         pub int_n_sep_by_space: ::c_char,
333         pub int_p_sign_posn: ::c_char,
334         pub int_n_sign_posn: ::c_char,
335     }
336 
337     pub struct if_data {
338         pub ifi_type: ::c_uchar,
339         pub ifi_addrlen: ::c_uchar,
340         pub ifi_hdrlen: ::c_uchar,
341         pub ifi_link_state: ::c_int,
342         pub ifi_mtu: u64,
343         pub ifi_metric: u64,
344         pub ifi_baudrate: u64,
345         pub ifi_ipackets: u64,
346         pub ifi_ierrors: u64,
347         pub ifi_opackets: u64,
348         pub ifi_oerrors: u64,
349         pub ifi_collisions: u64,
350         pub ifi_ibytes: u64,
351         pub ifi_obytes: u64,
352         pub ifi_imcasts: u64,
353         pub ifi_omcasts: u64,
354         pub ifi_iqdrops: u64,
355         pub ifi_noproto: u64,
356         pub ifi_lastchange: ::timespec,
357     }
358 
359     pub struct if_msghdr {
360         pub ifm_msglen: ::c_ushort,
361         pub ifm_version: ::c_uchar,
362         pub ifm_type: ::c_uchar,
363         pub ifm_addrs: ::c_int,
364         pub ifm_flags: ::c_int,
365         pub ifm_index: ::c_ushort,
366         pub ifm_data: if_data,
367     }
368 
369     pub struct sockcred {
370         pub sc_pid: ::pid_t,
371         pub sc_uid: ::uid_t,
372         pub sc_euid: ::uid_t,
373         pub sc_gid: ::gid_t,
374         pub sc_egid: ::gid_t,
375         pub sc_ngroups: ::c_int,
376         pub sc_groups: [::gid_t; 1],
377     }
378 
379     pub struct uucred {
380         pub cr_unused: ::c_ushort,
381         pub cr_uid: ::uid_t,
382         pub cr_gid: ::gid_t,
383         pub cr_ngroups: ::c_int,
384         pub cr_groups: [::gid_t; NGROUPS_MAX as usize],
385     }
386 
387     pub struct unpcbid {
388         pub unp_pid: ::pid_t,
389         pub unp_euid: ::uid_t,
390         pub unp_egid: ::gid_t,
391     }
392 
393     pub struct sockaddr_dl {
394         pub sdl_len: ::c_uchar,
395         pub sdl_family: ::c_uchar,
396         pub sdl_index: ::c_ushort,
397         pub sdl_type: u8,
398         pub sdl_nlen: u8,
399         pub sdl_alen: u8,
400         pub sdl_slen: u8,
401         pub sdl_data: [::c_char; 12],
402     }
403 
404     pub struct __exit_status {
405         pub e_termination: u16,
406         pub e_exit: u16,
407     }
408 
409     pub struct shmid_ds {
410         pub shm_perm: ::ipc_perm,
411         pub shm_segsz: ::size_t,
412         pub shm_lpid: ::pid_t,
413         pub shm_cpid: ::pid_t,
414         pub shm_nattch: ::shmatt_t,
415         pub shm_atime: ::time_t,
416         pub shm_dtime: ::time_t,
417         pub shm_ctime: ::time_t,
418         _shm_internal: *mut ::c_void,
419     }
420 
421     pub struct utmp {
422         pub ut_line: [::c_char; UT_LINESIZE],
423         pub ut_name: [::c_char; UT_NAMESIZE],
424         pub ut_host: [::c_char; UT_HOSTSIZE],
425         pub ut_time: ::time_t
426     }
427 
428     pub struct lastlog {
429         pub ll_line: [::c_char; UT_LINESIZE],
430         pub ll_host: [::c_char; UT_HOSTSIZE],
431         pub ll_time: ::time_t
432     }
433 
434     pub struct timex {
435         pub modes: ::c_uint,
436         pub offset: ::c_long,
437         pub freq: ::c_long,
438         pub maxerror: ::c_long,
439         pub esterror: ::c_long,
440         pub status: ::c_int,
441         pub constant: ::c_long,
442         pub precision: ::c_long,
443         pub tolerance: ::c_long,
444         pub ppsfreq: ::c_long,
445         pub jitter: ::c_long,
446         pub shift: ::c_int,
447         pub stabil: ::c_long,
448         pub jitcnt: ::c_long,
449         pub calcnt: ::c_long,
450         pub errcnt: ::c_long,
451         pub stbcnt: ::c_long,
452     }
453 
454     pub struct ntptimeval {
455         pub time: ::timespec,
456         pub maxerror: ::c_long,
457         pub esterror: ::c_long,
458         pub tai: ::c_long,
459         pub time_state: ::c_int,
460     }
461 
462     // elf.h
463 
464     pub struct Elf32_Phdr {
465         pub p_type: Elf32_Word,
466         pub p_offset: Elf32_Off,
467         pub p_vaddr: Elf32_Addr,
468         pub p_paddr: Elf32_Addr,
469         pub p_filesz: Elf32_Word,
470         pub p_memsz: Elf32_Word,
471         pub p_flags: Elf32_Word,
472         pub p_align: Elf32_Word,
473     }
474 
475     pub struct Elf64_Phdr {
476         pub p_type: Elf64_Word,
477         pub p_flags: Elf64_Word,
478         pub p_offset: Elf64_Off,
479         pub p_vaddr: Elf64_Addr,
480         pub p_paddr: Elf64_Addr,
481         pub p_filesz: Elf64_Xword,
482         pub p_memsz: Elf64_Xword,
483         pub p_align: Elf64_Xword,
484     }
485 
486     pub struct Aux32Info {
487         pub a_type: Elf32_Word,
488         pub a_v: Elf32_Word,
489     }
490 
491     pub struct Aux64Info {
492         pub a_type: Elf64_Word,
493         pub a_v: Elf64_Xword,
494     }
495 
496     // link.h
497 
498     pub struct dl_phdr_info {
499         pub dlpi_addr: Elf_Addr,
500         pub dlpi_name: *const ::c_char,
501         pub dlpi_phdr: *const Elf_Phdr,
502         pub dlpi_phnum: Elf_Half,
503         pub dlpi_adds: ::c_ulonglong,
504         pub dlpi_subs: ::c_ulonglong,
505         pub dlpi_tls_modid: usize,
506         pub dlpi_tls_data: *mut ::c_void,
507     }
508 
509     pub struct _cpuset {
510         bits: [u32; 0]
511     }
512 
513     pub struct accept_filter_arg {
514         pub af_name: [::c_char; 16],
515         af_arg: [[::c_char; 10]; 24],
516     }
517 
518     pub struct ki_sigset_t {
519         pub __bits: [u32; 4],
520     }
521 
522     pub struct kinfo_proc2 {
523         pub p_forw: u64,
524         pub p_back: u64,
525         pub p_paddr: u64,
526         pub p_addr: u64,
527         pub p_fd: u64,
528         pub p_cwdi: u64,
529         pub p_stats: u64,
530         pub p_limit: u64,
531         pub p_vmspace: u64,
532         pub p_sigacts: u64,
533         pub p_sess: u64,
534         pub p_tsess: u64,
535         pub p_ru: u64,
536         pub p_eflag: i32,
537         pub p_exitsig: i32,
538         pub p_flag: i32,
539         pub p_pid: i32,
540         pub p_ppid: i32,
541         pub p_sid: i32,
542         pub p__pgid: i32,
543         pub p_tpgid: i32,
544         pub p_uid: u32,
545         pub p_ruid: u32,
546         pub p_gid: u32,
547         pub p_rgid: u32,
548         pub p_groups: [u32; KI_NGROUPS as usize],
549         pub p_ngroups: i16,
550         pub p_jobc: i16,
551         pub p_tdev: u32,
552         pub p_estcpu: u32,
553         pub p_rtime_sec: u32,
554         pub p_rtime_usec: u32,
555         pub p_cpticks: i32,
556         pub p_pctcpu: u32,
557         pub p_swtime: u32,
558         pub p_slptime: u32,
559         pub p_schedflags: i32,
560         pub p_uticks: u64,
561         pub p_sticks: u64,
562         pub p_iticks: u64,
563         pub p_tracep: u64,
564         pub p_traceflag: i32,
565         pub p_holdcnt: i32,
566         pub p_siglist: ki_sigset_t,
567         pub p_sigmask: ki_sigset_t,
568         pub p_sigignore: ki_sigset_t,
569         pub p_sigcatch: ki_sigset_t,
570         pub p_stat: i8,
571         pub p_priority: u8,
572         pub p_usrpri: u8,
573         pub p_nice: u8,
574         pub p_xstat: u16,
575         pub p_acflag: u16,
576         pub p_comm: [::c_char; KI_MAXCOMLEN as usize],
577         pub p_wmesg: [::c_char; KI_WMESGLEN as usize],
578         pub p_wchan: u64,
579         pub p_login: [::c_char; KI_MAXLOGNAME as usize],
580         pub p_vm_rssize: i32,
581         pub p_vm_tsize: i32,
582         pub p_vm_dsize: i32,
583         pub p_vm_ssize: i32,
584         pub p_uvalid: i64,
585         pub p_ustart_sec: u32,
586         pub p_ustart_usec: u32,
587         pub p_uutime_sec: u32,
588         pub p_uutime_usec: u32,
589         pub p_ustime_sec: u32,
590         pub p_ustime_usec: u32,
591         pub p_uru_maxrss: u64,
592         pub p_uru_ixrss: u64,
593         pub p_uru_idrss: u64,
594         pub p_uru_isrss: u64,
595         pub p_uru_minflt: u64,
596         pub p_uru_majflt: u64,
597         pub p_uru_nswap: u64,
598         pub p_uru_inblock: u64,
599         pub p_uru_oublock: u64,
600         pub p_uru_msgsnd: u64,
601         pub p_uru_msgrcv: u64,
602         pub p_uru_nsignals: u64,
603         pub p_uru_nvcsw: u64,
604         pub p_uru_nivcsw: u64,
605         pub p_uctime_sec: u32,
606         pub p_uctime_usec: u32,
607         pub p_cpuid: u64,
608         pub p_realflag: u64,
609         pub p_nlwps: u64,
610         pub p_nrlwps: u64,
611         pub p_realstat: u64,
612         pub p_svuid: u32,
613         pub p_svgid: u32,
614         pub p_ename: [::c_char; KI_MAXEMULLEN as usize],
615         pub p_vm_vsize: i64,
616         pub p_vm_msize: i64,
617     }
618 
619     pub struct kinfo_lwp {
620         pub l_forw: u64,
621         pub l_back: u64,
622         pub l_laddr: u64,
623         pub l_addr: u64,
624         pub l_lid: i32,
625         pub l_flag: i32,
626         pub l_swtime: u32,
627         pub l_slptime: u32,
628         pub l_schedflags: i32,
629         pub l_holdcnt: i32,
630         pub l_priority: u8,
631         pub l_usrpri: u8,
632         pub l_stat: i8,
633         l_pad1: i8,
634         l_pad2: i32,
635         pub l_wmesg: [::c_char; KI_WMESGLEN as usize],
636         pub l_wchan: u64,
637         pub l_cpuid: u64,
638         pub l_rtime_sec: u32,
639         pub l_rtime_usec: u32,
640         pub l_cpticks: u32,
641         pub l_pctcpu: u32,
642         pub l_pid: u32,
643         pub l_name: [::c_char; KI_LNAMELEN as usize],
644     }
645 
646     pub struct kinfo_vmentry {
647         pub kve_start: u64,
648         pub kve_end: u64,
649         pub kve_offset: u64,
650         pub kve_type: u32,
651         pub kve_flags: u32,
652         pub kve_count: u32,
653         pub kve_wired_count: u32,
654         pub kve_advice: u32,
655         pub kve_attributes: u32,
656         pub kve_protection: u32,
657         pub kve_max_protection: u32,
658         pub kve_ref_count: u32,
659         pub kve_inheritance: u32,
660         pub kve_vn_fileid: u64,
661         pub kve_vn_size: u64,
662         pub kve_vn_fsid: u64,
663         pub kve_vn_rdev: u64,
664         pub kve_vn_type: u32,
665         pub kve_vn_mode: u32,
666         pub kve_path: [[::c_char; 32]; 32],
667     }
668 
669     pub struct __c_anonymous_posix_spawn_fae_open {
670         pub path: *mut ::c_char,
671         pub oflag: ::c_int,
672         pub mode: ::mode_t,
673     }
674 
675     pub struct __c_anonymous_posix_spawn_fae_dup2 {
676         pub newfildes: ::c_int,
677     }
678 
679     pub struct posix_spawnattr_t {
680         pub sa_flags: ::c_short,
681         pub sa_pgroup: ::pid_t,
682         pub sa_schedparam: ::sched_param,
683         pub sa_schedpolicy: ::c_int,
684         pub sa_sigdefault: sigset_t,
685         pub sa_sigmask: sigset_t,
686     }
687 
688     pub struct posix_spawn_file_actions_entry_t {
689         pub fae_action: fae_action,
690         pub fae_fildes: ::c_int,
691         #[cfg(libc_union)]
692         pub fae_data: __c_anonymous_posix_spawn_fae,
693     }
694 
695     pub struct posix_spawn_file_actions_t {
696         pub size: ::c_uint,
697         pub len: ::c_uint,
698         #[cfg(libc_union)]
699         pub fae: *mut posix_spawn_file_actions_entry_t,
700     }
701 
702     pub struct ptrace_lwpinfo {
703         pub pl_lwpid: lwpid_t,
704         pub pl_event: ::c_int,
705     }
706 
707     pub struct ptrace_lwpstatus {
708         pub pl_lwpid: lwpid_t,
709         pub pl_sigpend: sigset_t,
710         pub pl_sigmask: sigset_t,
711         pub pl_name: [::c_char; 20],
712         pub pl_private: *mut ::c_void,
713     }
714 
715     pub struct ptrace_siginfo {
716         pub psi_siginfo: siginfo_t,
717         pub psi_lwpid: lwpid_t,
718     }
719 
720     pub struct ptrace_event {
721         pub pe_set_event: ::c_int,
722     }
723 
724     pub struct sysctldesc {
725         pub descr_num: i32,
726         pub descr_ver: u32,
727         pub descr_len: u32,
728         pub descr_str: [::c_char; 1],
729     }
730 
731     pub struct ifreq {
732         pub _priv: [[::c_char; 6]; 24],
733     }
734 
735     pub struct ifconf {
736         pub ifc_len: ::c_int,
737         #[cfg(libc_union)]
738         pub ifc_ifcu: __c_anonymous_ifc_ifcu,
739     }
740 
741     pub struct tcp_info {
742         pub tcpi_state: u8,
743         pub __tcpi_ca_state: u8,
744         pub __tcpi_retransmits: u8,
745         pub __tcpi_probes: u8,
746         pub __tcpi_backoff: u8,
747         pub tcpi_options: u8,
748         pub tcp_snd_wscale: u8,
749         pub tcp_rcv_wscale: u8,
750         pub tcpi_rto: u32,
751         pub __tcpi_ato: u32,
752         pub tcpi_snd_mss: u32,
753         pub tcpi_rcv_mss: u32,
754         pub __tcpi_unacked: u32,
755         pub __tcpi_sacked: u32,
756         pub __tcpi_lost: u32,
757         pub __tcpi_retrans: u32,
758         pub __tcpi_fackets: u32,
759         pub __tcpi_last_data_sent: u32,
760         pub __tcpi_last_ack_sent: u32,
761         pub tcpi_last_data_recv: u32,
762         pub __tcpi_last_ack_recv: u32,
763         pub __tcpi_pmtu: u32,
764         pub __tcpi_rcv_ssthresh: u32,
765         pub tcpi_rtt: u32,
766         pub tcpi_rttvar: u32,
767         pub tcpi_snd_ssthresh: u32,
768         pub tcpi_snd_cwnd: u32,
769         pub __tcpi_advmss: u32,
770         pub __tcpi_reordering: u32,
771         pub __tcpi_rcv_rtt: u32,
772         pub tcpi_rcv_space: u32,
773         pub tcpi_snd_wnd: u32,
774         pub tcpi_snd_bwnd: u32,
775         pub tcpi_snd_nxt: u32,
776         pub tcpi_rcv_nxt: u32,
777         pub tcpi_toe_tid: u32,
778         pub tcpi_snd_rexmitpack: u32,
779         pub tcpi_rcv_ooopack: u32,
780         pub tcpi_snd_zerowin: u32,
781         pub __tcpi_pad: [u32; 26],
782     }
783 }
784 
785 s_no_extra_traits! {
786 
787     pub struct utmpx {
788         pub ut_name: [::c_char; _UTX_USERSIZE],
789         pub ut_id: [::c_char; _UTX_IDSIZE],
790         pub ut_line: [::c_char; _UTX_LINESIZE],
791         pub ut_host: [::c_char; _UTX_HOSTSIZE],
792         pub ut_session: u16,
793         pub ut_type: u16,
794         pub ut_pid: ::pid_t,
795         pub ut_exit: __exit_status, // FIXME: when anonymous struct are supported
796         pub ut_ss: sockaddr_storage,
797         pub ut_tv: ::timeval,
798         pub ut_pad: [u8; _UTX_PADSIZE],
799     }
800 
801     pub struct lastlogx {
802         pub ll_tv: ::timeval,
803         pub ll_line: [::c_char; _UTX_LINESIZE],
804         pub ll_host: [::c_char; _UTX_HOSTSIZE],
805         pub ll_ss: sockaddr_storage,
806     }
807 
808     pub struct in_pktinfo {
809         pub ipi_addr: ::in_addr,
810         pub ipi_ifindex: ::c_uint,
811     }
812 
813     pub struct arphdr {
814         pub ar_hrd: u16,
815         pub ar_pro: u16,
816         pub ar_hln: u8,
817         pub ar_pln: u8,
818         pub ar_op: u16,
819     }
820 
821     pub struct in_addr {
822         pub s_addr: ::in_addr_t,
823     }
824 
825     pub struct ip_mreq {
826         pub imr_multiaddr: in_addr,
827         pub imr_interface: in_addr,
828     }
829 
830     pub struct sockaddr_in {
831         pub sin_len: u8,
832         pub sin_family: ::sa_family_t,
833         pub sin_port: ::in_port_t,
834         pub sin_addr: ::in_addr,
835         pub sin_zero: [i8; 8],
836     }
837 
838     pub struct dirent {
839         pub d_fileno: ::ino_t,
840         pub d_reclen: u16,
841         pub d_namlen: u16,
842         pub d_type: u8,
843         pub d_name: [::c_char; 512],
844     }
845 
846     pub struct statvfs {
847         pub f_flag: ::c_ulong,
848         pub f_bsize: ::c_ulong,
849         pub f_frsize: ::c_ulong,
850         pub f_iosize: ::c_ulong,
851 
852         pub f_blocks: ::fsblkcnt_t,
853         pub f_bfree: ::fsblkcnt_t,
854         pub f_bavail: ::fsblkcnt_t,
855         pub f_bresvd: ::fsblkcnt_t,
856 
857         pub f_files: ::fsfilcnt_t,
858         pub f_ffree: ::fsfilcnt_t,
859         pub f_favail: ::fsfilcnt_t,
860         pub f_fresvd: ::fsfilcnt_t,
861 
862         pub f_syncreads: u64,
863         pub f_syncwrites: u64,
864 
865         pub f_asyncreads: u64,
866         pub f_asyncwrites: u64,
867 
868         pub f_fsidx: ::fsid_t,
869         pub f_fsid: ::c_ulong,
870         pub f_namemax: ::c_ulong,
871         pub f_owner: ::uid_t,
872 
873         pub f_spare: [u32; 4],
874 
875         pub f_fstypename: [::c_char; 32],
876         pub f_mntonname: [::c_char; 1024],
877         pub f_mntfromname: [::c_char; 1024],
878     }
879 
880     pub struct sockaddr_storage {
881         pub ss_len: u8,
882         pub ss_family: ::sa_family_t,
883         __ss_pad1: [u8; 6],
884         __ss_pad2: i64,
885         __ss_pad3: [u8; 112],
886     }
887 
888     pub struct sigevent {
889         pub sigev_notify: ::c_int,
890         pub sigev_signo: ::c_int,
891         pub sigev_value: ::sigval,
892         __unused1: *mut ::c_void,       //actually a function pointer
893         pub sigev_notify_attributes: *mut ::c_void
894     }
895 
896     #[cfg(libc_union)]
897     pub union __c_anonymous_posix_spawn_fae {
898         pub open: __c_anonymous_posix_spawn_fae_open,
899         pub dup2: __c_anonymous_posix_spawn_fae_dup2,
900     }
901 
902     #[cfg(libc_union)]
903     pub union __c_anonymous_ifc_ifcu {
904         pub ifcu_buf: *mut ::c_void,
905         pub ifcu_req: *mut ifreq,
906     }
907 }
908 
909 cfg_if! {
910     if #[cfg(feature = "extra_traits")] {
911         impl PartialEq for utmpx {
912             fn eq(&self, other: &utmpx) -> bool {
913                 self.ut_type == other.ut_type
914                     && self.ut_pid == other.ut_pid
915                     && self.ut_name == other.ut_name
916                     && self.ut_line == other.ut_line
917                     && self.ut_id == other.ut_id
918                     && self.ut_exit == other.ut_exit
919                     && self.ut_session == other.ut_session
920                     && self.ut_tv == other.ut_tv
921                     && self.ut_ss == other.ut_ss
922                     && self
923                     .ut_pad
924                     .iter()
925                     .zip(other.ut_pad.iter())
926                     .all(|(a,b)| a == b)
927                     && self
928                     .ut_host
929                     .iter()
930                     .zip(other.ut_host.iter())
931                     .all(|(a,b)| a == b)
932             }
933         }
934 
935         impl Eq for utmpx {}
936 
937         impl ::fmt::Debug for utmpx {
938             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
939                 f.debug_struct("utmpx")
940                     .field("ut_name", &self.ut_name)
941                     .field("ut_id", &self.ut_id)
942                     .field("ut_line", &self.ut_line)
943                 // FIXME .field("ut_host", &self.ut_host)
944                     .field("ut_session", &self.ut_session)
945                     .field("ut_type", &self.ut_type)
946                     .field("ut_pid", &self.ut_pid)
947                     .field("ut_exit", &self.ut_exit)
948                     .field("ut_ss", &self.ut_ss)
949                     .field("ut_tv", &self.ut_tv)
950                 // FIXME .field("ut_pad", &self.ut_pad)
951                     .finish()
952             }
953         }
954 
955         impl ::hash::Hash for utmpx {
956             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
957                 self.ut_name.hash(state);
958                 self.ut_type.hash(state);
959                 self.ut_pid.hash(state);
960                 self.ut_line.hash(state);
961                 self.ut_id.hash(state);
962                 self.ut_host.hash(state);
963                 self.ut_exit.hash(state);
964                 self.ut_session.hash(state);
965                 self.ut_tv.hash(state);
966                 self.ut_ss.hash(state);
967                 self.ut_pad.hash(state);
968             }
969         }
970 
971         impl PartialEq for lastlogx {
972             fn eq(&self, other: &lastlogx) -> bool {
973                 self.ll_tv == other.ll_tv
974                     && self.ll_line == other.ll_line
975                     && self.ll_ss == other.ll_ss
976                     && self
977                     .ll_host
978                     .iter()
979                     .zip(other.ll_host.iter())
980                     .all(|(a,b)| a == b)
981             }
982         }
983 
984         impl Eq for lastlogx {}
985 
986         impl ::fmt::Debug for lastlogx {
987             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
988                 f.debug_struct("lastlogx")
989                     .field("ll_tv", &self.ll_tv)
990                     .field("ll_line", &self.ll_line)
991                 // FIXME.field("ll_host", &self.ll_host)
992                     .field("ll_ss", &self.ll_ss)
993                     .finish()
994             }
995         }
996 
997         impl ::hash::Hash for lastlogx {
998             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
999                 self.ll_tv.hash(state);
1000                 self.ll_line.hash(state);
1001                 self.ll_host.hash(state);
1002                 self.ll_ss.hash(state);
1003             }
1004         }
1005 
1006         impl PartialEq for in_pktinfo {
1007             fn eq(&self, other: &in_pktinfo) -> bool {
1008                 self.ipi_addr == other.ipi_addr
1009                     && self.ipi_ifindex == other.ipi_ifindex
1010             }
1011         }
1012         impl Eq for in_pktinfo {}
1013         impl ::fmt::Debug for in_pktinfo {
1014             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1015                 f.debug_struct("in_pktinfo")
1016                     .field("ipi_addr", &self.ipi_addr)
1017                     .field("ipi_ifindex", &self.ipi_ifindex)
1018                     .finish()
1019             }
1020         }
1021         impl ::hash::Hash for in_pktinfo {
1022             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1023                 self.ipi_addr.hash(state);
1024                 self.ipi_ifindex.hash(state);
1025             }
1026         }
1027 
1028         impl PartialEq for arphdr {
1029             fn eq(&self, other: &arphdr) -> bool {
1030                 self.ar_hrd == other.ar_hrd
1031                     && self.ar_pro == other.ar_pro
1032                     && self.ar_hln == other.ar_hln
1033                     && self.ar_pln == other.ar_pln
1034                     && self.ar_op == other.ar_op
1035             }
1036         }
1037         impl Eq for arphdr {}
1038         impl ::fmt::Debug for arphdr {
1039             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1040                 let ar_hrd = self.ar_hrd;
1041                 let ar_pro = self.ar_pro;
1042                 let ar_op = self.ar_op;
1043                 f.debug_struct("arphdr")
1044                     .field("ar_hrd", &ar_hrd)
1045                     .field("ar_pro", &ar_pro)
1046                     .field("ar_hln", &self.ar_hln)
1047                     .field("ar_pln", &self.ar_pln)
1048                     .field("ar_op", &ar_op)
1049                     .finish()
1050             }
1051         }
1052         impl ::hash::Hash for arphdr {
1053             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1054                 let ar_hrd = self.ar_hrd;
1055                 let ar_pro = self.ar_pro;
1056                 let ar_op = self.ar_op;
1057                 ar_hrd.hash(state);
1058                 ar_pro.hash(state);
1059                 self.ar_hln.hash(state);
1060                 self.ar_pln.hash(state);
1061                 ar_op.hash(state);
1062             }
1063         }
1064 
1065         impl PartialEq for in_addr {
1066             fn eq(&self, other: &in_addr) -> bool {
1067                 self.s_addr == other.s_addr
1068             }
1069         }
1070         impl Eq for in_addr {}
1071         impl ::fmt::Debug for in_addr {
1072             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1073                 let s_addr = self.s_addr;
1074                 f.debug_struct("in_addr")
1075                     .field("s_addr", &s_addr)
1076                     .finish()
1077             }
1078         }
1079         impl ::hash::Hash for in_addr {
1080             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1081                 let s_addr = self.s_addr;
1082                 s_addr.hash(state);
1083             }
1084         }
1085 
1086         impl PartialEq for ip_mreq {
1087             fn eq(&self, other: &ip_mreq) -> bool {
1088                 self.imr_multiaddr == other.imr_multiaddr
1089                     && self.imr_interface == other.imr_interface
1090             }
1091         }
1092         impl Eq for ip_mreq {}
1093         impl ::fmt::Debug for ip_mreq {
1094             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1095                 f.debug_struct("ip_mreq")
1096                     .field("imr_multiaddr", &self.imr_multiaddr)
1097                     .field("imr_interface", &self.imr_interface)
1098                     .finish()
1099             }
1100         }
1101         impl ::hash::Hash for ip_mreq {
1102             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1103                 self.imr_multiaddr.hash(state);
1104                 self.imr_interface.hash(state);
1105             }
1106         }
1107 
1108         impl PartialEq for sockaddr_in {
1109             fn eq(&self, other: &sockaddr_in) -> bool {
1110                 self.sin_len == other.sin_len
1111                     && self.sin_family == other.sin_family
1112                     && self.sin_port == other.sin_port
1113                     && self.sin_addr == other.sin_addr
1114                     && self.sin_zero == other.sin_zero
1115             }
1116         }
1117         impl Eq for sockaddr_in {}
1118         impl ::fmt::Debug for sockaddr_in {
1119             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1120                 f.debug_struct("sockaddr_in")
1121                     .field("sin_len", &self.sin_len)
1122                     .field("sin_family", &self.sin_family)
1123                     .field("sin_port", &self.sin_port)
1124                     .field("sin_addr", &self.sin_addr)
1125                     .field("sin_zero", &self.sin_zero)
1126                     .finish()
1127             }
1128         }
1129         impl ::hash::Hash for sockaddr_in {
1130             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1131                 self.sin_len.hash(state);
1132                 self.sin_family.hash(state);
1133                 self.sin_port.hash(state);
1134                 self.sin_addr.hash(state);
1135                 self.sin_zero.hash(state);
1136             }
1137         }
1138 
1139         impl PartialEq for dirent {
1140             fn eq(&self, other: &dirent) -> bool {
1141                 self.d_fileno == other.d_fileno
1142                     && self.d_reclen == other.d_reclen
1143                     && self.d_namlen == other.d_namlen
1144                     && self.d_type == other.d_type
1145                     && self
1146                     .d_name
1147                     .iter()
1148                     .zip(other.d_name.iter())
1149                     .all(|(a,b)| a == b)
1150             }
1151         }
1152         impl Eq for dirent {}
1153         impl ::fmt::Debug for dirent {
1154             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1155                 f.debug_struct("dirent")
1156                     .field("d_fileno", &self.d_fileno)
1157                     .field("d_reclen", &self.d_reclen)
1158                     .field("d_namlen", &self.d_namlen)
1159                     .field("d_type", &self.d_type)
1160                     // FIXME: .field("d_name", &self.d_name)
1161                     .finish()
1162             }
1163         }
1164         impl ::hash::Hash for dirent {
1165             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1166                 self.d_fileno.hash(state);
1167                 self.d_reclen.hash(state);
1168                 self.d_namlen.hash(state);
1169                 self.d_type.hash(state);
1170                 self.d_name.hash(state);
1171             }
1172         }
1173 
1174         impl PartialEq for statvfs {
1175             fn eq(&self, other: &statvfs) -> bool {
1176                 self.f_flag == other.f_flag
1177                     && self.f_bsize == other.f_bsize
1178                     && self.f_frsize == other.f_frsize
1179                     && self.f_iosize == other.f_iosize
1180                     && self.f_blocks == other.f_blocks
1181                     && self.f_bfree == other.f_bfree
1182                     && self.f_bavail == other.f_bavail
1183                     && self.f_bresvd == other.f_bresvd
1184                     && self.f_files == other.f_files
1185                     && self.f_ffree == other.f_ffree
1186                     && self.f_favail == other.f_favail
1187                     && self.f_fresvd == other.f_fresvd
1188                     && self.f_syncreads == other.f_syncreads
1189                     && self.f_syncwrites == other.f_syncwrites
1190                     && self.f_asyncreads == other.f_asyncreads
1191                     && self.f_asyncwrites == other.f_asyncwrites
1192                     && self.f_fsidx == other.f_fsidx
1193                     && self.f_fsid == other.f_fsid
1194                     && self.f_namemax == other.f_namemax
1195                     && self.f_owner == other.f_owner
1196                     && self.f_spare == other.f_spare
1197                     && self.f_fstypename == other.f_fstypename
1198                     && self
1199                     .f_mntonname
1200                     .iter()
1201                     .zip(other.f_mntonname.iter())
1202                     .all(|(a,b)| a == b)
1203                     && self
1204                     .f_mntfromname
1205                     .iter()
1206                     .zip(other.f_mntfromname.iter())
1207                     .all(|(a,b)| a == b)
1208             }
1209         }
1210         impl Eq for statvfs {}
1211         impl ::fmt::Debug for statvfs {
1212             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1213                 f.debug_struct("statvfs")
1214                     .field("f_flag", &self.f_flag)
1215                     .field("f_bsize", &self.f_bsize)
1216                     .field("f_frsize", &self.f_frsize)
1217                     .field("f_iosize", &self.f_iosize)
1218                     .field("f_blocks", &self.f_blocks)
1219                     .field("f_bfree", &self.f_bfree)
1220                     .field("f_bavail", &self.f_bavail)
1221                     .field("f_bresvd", &self.f_bresvd)
1222                     .field("f_files", &self.f_files)
1223                     .field("f_ffree", &self.f_ffree)
1224                     .field("f_favail", &self.f_favail)
1225                     .field("f_fresvd", &self.f_fresvd)
1226                     .field("f_syncreads", &self.f_syncreads)
1227                     .field("f_syncwrites", &self.f_syncwrites)
1228                     .field("f_asyncreads", &self.f_asyncreads)
1229                     .field("f_asyncwrites", &self.f_asyncwrites)
1230                     .field("f_fsidx", &self.f_fsidx)
1231                     .field("f_fsid", &self.f_fsid)
1232                     .field("f_namemax", &self.f_namemax)
1233                     .field("f_owner", &self.f_owner)
1234                     .field("f_spare", &self.f_spare)
1235                     .field("f_fstypename", &self.f_fstypename)
1236                     // FIXME: .field("f_mntonname", &self.f_mntonname)
1237                     // FIXME: .field("f_mntfromname", &self.f_mntfromname)
1238                     .finish()
1239             }
1240         }
1241         impl ::hash::Hash for statvfs {
1242             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1243                 self.f_flag.hash(state);
1244                 self.f_bsize.hash(state);
1245                 self.f_frsize.hash(state);
1246                 self.f_iosize.hash(state);
1247                 self.f_blocks.hash(state);
1248                 self.f_bfree.hash(state);
1249                 self.f_bavail.hash(state);
1250                 self.f_bresvd.hash(state);
1251                 self.f_files.hash(state);
1252                 self.f_ffree.hash(state);
1253                 self.f_favail.hash(state);
1254                 self.f_fresvd.hash(state);
1255                 self.f_syncreads.hash(state);
1256                 self.f_syncwrites.hash(state);
1257                 self.f_asyncreads.hash(state);
1258                 self.f_asyncwrites.hash(state);
1259                 self.f_fsidx.hash(state);
1260                 self.f_fsid.hash(state);
1261                 self.f_namemax.hash(state);
1262                 self.f_owner.hash(state);
1263                 self.f_spare.hash(state);
1264                 self.f_fstypename.hash(state);
1265                 self.f_mntonname.hash(state);
1266                 self.f_mntfromname.hash(state);
1267             }
1268         }
1269 
1270         impl PartialEq for sockaddr_storage {
1271             fn eq(&self, other: &sockaddr_storage) -> bool {
1272                 self.ss_len == other.ss_len
1273                     && self.ss_family == other.ss_family
1274                     && self.__ss_pad1 == other.__ss_pad1
1275                     && self.__ss_pad2 == other.__ss_pad2
1276                     && self
1277                     .__ss_pad3
1278                     .iter()
1279                     .zip(other.__ss_pad3.iter())
1280                     .all(|(a,b)| a == b)
1281             }
1282         }
1283         impl Eq for sockaddr_storage {}
1284         impl ::fmt::Debug for sockaddr_storage {
1285             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1286                 f.debug_struct("sockaddr_storage")
1287                     .field("ss_len", &self.ss_len)
1288                     .field("ss_family", &self.ss_family)
1289                     .field("__ss_pad1", &self.__ss_pad1)
1290                     .field("__ss_pad2", &self.__ss_pad2)
1291                     // FIXME: .field("__ss_pad3", &self.__ss_pad3)
1292                     .finish()
1293             }
1294         }
1295         impl ::hash::Hash for sockaddr_storage {
1296             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1297                 self.ss_len.hash(state);
1298                 self.ss_family.hash(state);
1299                 self.__ss_pad1.hash(state);
1300                 self.__ss_pad2.hash(state);
1301                 self.__ss_pad3.hash(state);
1302             }
1303         }
1304 
1305         impl PartialEq for sigevent {
1306             fn eq(&self, other: &sigevent) -> bool {
1307                 self.sigev_notify == other.sigev_notify
1308                     && self.sigev_signo == other.sigev_signo
1309                     && self.sigev_value == other.sigev_value
1310                     && self.sigev_notify_attributes
1311                         == other.sigev_notify_attributes
1312             }
1313         }
1314         impl Eq for sigevent {}
1315         impl ::fmt::Debug for sigevent {
1316             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1317                 f.debug_struct("sigevent")
1318                     .field("sigev_notify", &self.sigev_notify)
1319                     .field("sigev_signo", &self.sigev_signo)
1320                     .field("sigev_value", &self.sigev_value)
1321                     .field("sigev_notify_attributes",
1322                            &self.sigev_notify_attributes)
1323                     .finish()
1324             }
1325         }
1326         impl ::hash::Hash for sigevent {
1327             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1328                 self.sigev_notify.hash(state);
1329                 self.sigev_signo.hash(state);
1330                 self.sigev_value.hash(state);
1331                 self.sigev_notify_attributes.hash(state);
1332             }
1333         }
1334 
1335         #[cfg(libc_union)]
1336         impl Eq for __c_anonymous_posix_spawn_fae {}
1337 
1338         #[cfg(libc_union)]
1339         impl PartialEq for __c_anonymous_posix_spawn_fae {
1340             fn eq(&self, other: &__c_anonymous_posix_spawn_fae) -> bool {
1341                 unsafe {
1342                     self.open == other.open
1343                         || self.dup2 == other.dup2
1344                 }
1345             }
1346         }
1347 
1348         #[cfg(libc_union)]
1349         impl ::fmt::Debug for __c_anonymous_posix_spawn_fae {
1350             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1351                 unsafe {
1352                     f.debug_struct("__c_anonymous_posix_fae")
1353                         .field("open", &self.open)
1354                         .field("dup2", &self.dup2)
1355                         .finish()
1356                 }
1357             }
1358         }
1359 
1360         #[cfg(libc_union)]
1361         impl ::hash::Hash for __c_anonymous_posix_spawn_fae {
1362             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1363                 unsafe {
1364                     self.open.hash(state);
1365                     self.dup2.hash(state);
1366                 }
1367             }
1368         }
1369 
1370         #[cfg(libc_union)]
1371         impl Eq for __c_anonymous_ifc_ifcu {}
1372 
1373         #[cfg(libc_union)]
1374         impl PartialEq for __c_anonymous_ifc_ifcu {
1375             fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool {
1376                 unsafe {
1377                     self.ifcu_buf == other.ifcu_buf
1378                         || self.ifcu_req == other.ifcu_req
1379                 }
1380             }
1381         }
1382 
1383         #[cfg(libc_union)]
1384         impl ::fmt::Debug for __c_anonymous_ifc_ifcu {
1385             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1386                 unsafe {
1387                     f.debug_struct("__c_anonymous_ifc_ifcu")
1388                         .field("ifcu_buf", &self.ifcu_buf)
1389                         .field("ifcu_req", &self.ifcu_req)
1390                         .finish()
1391                 }
1392             }
1393         }
1394 
1395         #[cfg(libc_union)]
1396         impl ::hash::Hash for __c_anonymous_ifc_ifcu {
1397             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1398                 unsafe {
1399                     self.ifcu_buf.hash(state);
1400                     self.ifcu_req.hash(state);
1401                 }
1402             }
1403         }
1404     }
1405 }
1406 
1407 pub const AT_FDCWD: ::c_int = -100;
1408 pub const AT_EACCESS: ::c_int = 0x100;
1409 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
1410 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
1411 pub const AT_REMOVEDIR: ::c_int = 0x800;
1412 
1413 pub const AT_NULL: ::c_int = 0;
1414 pub const AT_IGNORE: ::c_int = 1;
1415 pub const AT_EXECFD: ::c_int = 2;
1416 pub const AT_PHDR: ::c_int = 3;
1417 pub const AT_PHENT: ::c_int = 4;
1418 pub const AT_PHNUM: ::c_int = 5;
1419 pub const AT_PAGESZ: ::c_int = 6;
1420 pub const AT_BASE: ::c_int = 7;
1421 pub const AT_FLAGS: ::c_int = 8;
1422 pub const AT_ENTRY: ::c_int = 9;
1423 pub const AT_DCACHEBSIZE: ::c_int = 10;
1424 pub const AT_ICACHEBSIZE: ::c_int = 11;
1425 pub const AT_UCACHEBSIZE: ::c_int = 12;
1426 pub const AT_STACKBASE: ::c_int = 13;
1427 pub const AT_EUID: ::c_int = 2000;
1428 pub const AT_RUID: ::c_int = 2001;
1429 pub const AT_EGID: ::c_int = 2002;
1430 pub const AT_RGID: ::c_int = 2003;
1431 pub const AT_SUN_LDELF: ::c_int = 2004;
1432 pub const AT_SUN_LDSHDR: ::c_int = 2005;
1433 pub const AT_SUN_LDNAME: ::c_int = 2006;
1434 pub const AT_SUN_LDPGSIZE: ::c_int = 2007;
1435 pub const AT_SUN_PLATFORM: ::c_int = 2008;
1436 pub const AT_SUN_HWCAP: ::c_int = 2009;
1437 pub const AT_SUN_IFLUSH: ::c_int = 2010;
1438 pub const AT_SUN_CPU: ::c_int = 2011;
1439 pub const AT_SUN_EMUL_ENTRY: ::c_int = 2012;
1440 pub const AT_SUN_EMUL_EXECFD: ::c_int = 2013;
1441 pub const AT_SUN_EXECNAME: ::c_int = 2014;
1442 
1443 pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
1444 pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
1445 
1446 pub const LC_COLLATE_MASK: ::c_int = 1 << ::LC_COLLATE;
1447 pub const LC_CTYPE_MASK: ::c_int = 1 << ::LC_CTYPE;
1448 pub const LC_MONETARY_MASK: ::c_int = 1 << ::LC_MONETARY;
1449 pub const LC_NUMERIC_MASK: ::c_int = 1 << ::LC_NUMERIC;
1450 pub const LC_TIME_MASK: ::c_int = 1 << ::LC_TIME;
1451 pub const LC_MESSAGES_MASK: ::c_int = 1 << ::LC_MESSAGES;
1452 pub const LC_ALL_MASK: ::c_int = !0;
1453 
1454 pub const ERA: ::nl_item = 52;
1455 pub const ERA_D_FMT: ::nl_item = 53;
1456 pub const ERA_D_T_FMT: ::nl_item = 54;
1457 pub const ERA_T_FMT: ::nl_item = 55;
1458 pub const ALT_DIGITS: ::nl_item = 56;
1459 
1460 pub const O_CLOEXEC: ::c_int = 0x400000;
1461 pub const O_ALT_IO: ::c_int = 0x40000;
1462 pub const O_NOSIGPIPE: ::c_int = 0x1000000;
1463 pub const O_SEARCH: ::c_int = 0x800000;
1464 pub const O_DIRECTORY: ::c_int = 0x200000;
1465 pub const O_DIRECT: ::c_int = 0x00080000;
1466 pub const O_RSYNC: ::c_int = 0x00020000;
1467 
1468 pub const MS_SYNC: ::c_int = 0x4;
1469 pub const MS_INVALIDATE: ::c_int = 0x2;
1470 
1471 // Here because they are not present on OpenBSD
1472 // (https://github.com/openbsd/src/blob/HEAD/sys/sys/resource.h)
1473 pub const RLIMIT_SBSIZE: ::c_int = 9;
1474 pub const RLIMIT_AS: ::c_int = 10;
1475 pub const RLIMIT_NTHR: ::c_int = 11;
1476 
1477 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1478 pub const RLIM_NLIMITS: ::c_int = 12;
1479 
1480 pub const EIDRM: ::c_int = 82;
1481 pub const ENOMSG: ::c_int = 83;
1482 pub const EOVERFLOW: ::c_int = 84;
1483 pub const EILSEQ: ::c_int = 85;
1484 pub const ENOTSUP: ::c_int = 86;
1485 pub const ECANCELED: ::c_int = 87;
1486 pub const EBADMSG: ::c_int = 88;
1487 pub const ENODATA: ::c_int = 89;
1488 pub const ENOSR: ::c_int = 90;
1489 pub const ENOSTR: ::c_int = 91;
1490 pub const ETIME: ::c_int = 92;
1491 pub const ENOATTR: ::c_int = 93;
1492 pub const EMULTIHOP: ::c_int = 94;
1493 pub const ENOLINK: ::c_int = 95;
1494 pub const EPROTO: ::c_int = 96;
1495 pub const EOWNERDEAD: ::c_int = 97;
1496 pub const ENOTRECOVERABLE: ::c_int = 98;
1497 #[deprecated(
1498     since = "0.2.143",
1499     note = "This value will always match the highest defined error number \
1500             and thus is not stable. \
1501             See #3040 for more info."
1502 )]
1503 pub const ELAST: ::c_int = 98;
1504 
1505 pub const F_DUPFD_CLOEXEC: ::c_int = 12;
1506 pub const F_CLOSEM: ::c_int = 10;
1507 pub const F_GETNOSIGPIPE: ::c_int = 13;
1508 pub const F_SETNOSIGPIPE: ::c_int = 14;
1509 pub const F_MAXFD: ::c_int = 11;
1510 pub const F_GETPATH: ::c_int = 15;
1511 
1512 pub const FUTEX_WAIT: ::c_int = 0;
1513 pub const FUTEX_WAKE: ::c_int = 1;
1514 pub const FUTEX_FD: ::c_int = 2;
1515 pub const FUTEX_REQUEUE: ::c_int = 3;
1516 pub const FUTEX_CMP_REQUEUE: ::c_int = 4;
1517 pub const FUTEX_WAKE_OP: ::c_int = 5;
1518 pub const FUTEX_LOCK_PI: ::c_int = 6;
1519 pub const FUTEX_UNLOCK_PI: ::c_int = 7;
1520 pub const FUTEX_TRYLOCK_PI: ::c_int = 8;
1521 pub const FUTEX_WAIT_BITSET: ::c_int = 9;
1522 pub const FUTEX_WAKE_BITSET: ::c_int = 10;
1523 pub const FUTEX_WAIT_REQUEUE_PI: ::c_int = 11;
1524 pub const FUTEX_CMP_REQUEUE_PI: ::c_int = 12;
1525 pub const FUTEX_PRIVATE_FLAG: ::c_int = 1 << 7;
1526 pub const FUTEX_CLOCK_REALTIME: ::c_int = 1 << 8;
1527 pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
1528 pub const FUTEX_WAITERS: u32 = 1 << 31;
1529 pub const FUTEX_OWNER_DIED: u32 = 1 << 30;
1530 pub const FUTEX_SYNCOBJ_1: u32 = 1 << 29;
1531 pub const FUTEX_SYNCOBJ_0: u32 = 1 << 28;
1532 pub const FUTEX_TID_MASK: u32 = (1 << 28) - 1;
1533 pub const FUTEX_BITSET_MATCH_ANY: u32 = !0;
1534 
1535 pub const IP_RECVDSTADDR: ::c_int = 7;
1536 pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR;
1537 pub const IP_RECVIF: ::c_int = 20;
1538 pub const IP_PKTINFO: ::c_int = 25;
1539 pub const IP_RECVPKTINFO: ::c_int = 26;
1540 pub const IPV6_JOIN_GROUP: ::c_int = 12;
1541 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
1542 
1543 pub const TCP_KEEPIDLE: ::c_int = 3;
1544 pub const TCP_KEEPINTVL: ::c_int = 5;
1545 pub const TCP_KEEPCNT: ::c_int = 6;
1546 pub const TCP_KEEPINIT: ::c_int = 7;
1547 pub const TCP_MD5SIG: ::c_int = 0x10;
1548 pub const TCP_CONGCTL: ::c_int = 0x20;
1549 
1550 pub const SOCK_CONN_DGRAM: ::c_int = 6;
1551 pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
1552 pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
1553 pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
1554 
1555 pub const SO_SNDTIMEO: ::c_int = 0x100b;
1556 pub const SO_RCVTIMEO: ::c_int = 0x100c;
1557 pub const SO_NOSIGPIPE: ::c_int = 0x0800;
1558 pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
1559 pub const SO_TIMESTAMP: ::c_int = 0x2000;
1560 pub const SO_OVERFLOWED: ::c_int = 0x1009;
1561 pub const SO_NOHEADER: ::c_int = 0x100a;
1562 
1563 // http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/un.h?annotate
1564 pub const LOCAL_OCREDS: ::c_int = 0x0001; // pass credentials to receiver
1565 pub const LOCAL_CONNWAIT: ::c_int = 0x0002; // connects block until accepted
1566 pub const LOCAL_PEEREID: ::c_int = 0x0003; // get peer identification
1567 pub const LOCAL_CREDS: ::c_int = 0x0004; // pass credentials to receiver
1568 
1569 // https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
1570 pub const IFF_UP: ::c_int = 0x0001; // interface is up
1571 pub const IFF_BROADCAST: ::c_int = 0x0002; // broadcast address valid
1572 pub const IFF_DEBUG: ::c_int = 0x0004; // turn on debugging
1573 pub const IFF_LOOPBACK: ::c_int = 0x0008; // is a loopback net
1574 pub const IFF_POINTOPOINT: ::c_int = 0x0010; // interface is point-to-point link
1575 pub const IFF_NOTRAILERS: ::c_int = 0x0020; // avoid use of trailers
1576 pub const IFF_RUNNING: ::c_int = 0x0040; // resources allocated
1577 pub const IFF_NOARP: ::c_int = 0x0080; // no address resolution protocol
1578 pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
1579 pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
1580 pub const IFF_OACTIVE: ::c_int = 0x0400; // transmission in progress
1581 pub const IFF_SIMPLEX: ::c_int = 0x0800; // can't hear own transmissions
1582 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
1583 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
1584 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
1585 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
1586 
1587 // sys/netinet/in.h
1588 // Protocols (RFC 1700)
1589 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
1590 
1591 // IPPROTO_IP defined in src/unix/mod.rs
1592 /// Hop-by-hop option header
1593 pub const IPPROTO_HOPOPTS: ::c_int = 0;
1594 // IPPROTO_ICMP defined in src/unix/mod.rs
1595 /// group mgmt protocol
1596 pub const IPPROTO_IGMP: ::c_int = 2;
1597 /// gateway^2 (deprecated)
1598 pub const IPPROTO_GGP: ::c_int = 3;
1599 /// for compatibility
1600 pub const IPPROTO_IPIP: ::c_int = 4;
1601 // IPPROTO_TCP defined in src/unix/mod.rs
1602 /// exterior gateway protocol
1603 pub const IPPROTO_EGP: ::c_int = 8;
1604 /// pup
1605 pub const IPPROTO_PUP: ::c_int = 12;
1606 // IPPROTO_UDP defined in src/unix/mod.rs
1607 /// xns idp
1608 pub const IPPROTO_IDP: ::c_int = 22;
1609 /// tp-4 w/ class negotiation
1610 pub const IPPROTO_TP: ::c_int = 29;
1611 /// DCCP
1612 pub const IPPROTO_DCCP: ::c_int = 33;
1613 // IPPROTO_IPV6 defined in src/unix/mod.rs
1614 /// IP6 routing header
1615 pub const IPPROTO_ROUTING: ::c_int = 43;
1616 /// IP6 fragmentation header
1617 pub const IPPROTO_FRAGMENT: ::c_int = 44;
1618 /// resource reservation
1619 pub const IPPROTO_RSVP: ::c_int = 46;
1620 /// General Routing Encap.
1621 pub const IPPROTO_GRE: ::c_int = 47;
1622 /// IP6 Encap Sec. Payload
1623 pub const IPPROTO_ESP: ::c_int = 50;
1624 /// IP6 Auth Header
1625 pub const IPPROTO_AH: ::c_int = 51;
1626 /// IP Mobility RFC 2004
1627 pub const IPPROTO_MOBILE: ::c_int = 55;
1628 /// IPv6 ICMP
1629 pub const IPPROTO_IPV6_ICMP: ::c_int = 58;
1630 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1631 /// IP6 no next header
1632 pub const IPPROTO_NONE: ::c_int = 59;
1633 /// IP6 destination option
1634 pub const IPPROTO_DSTOPTS: ::c_int = 60;
1635 /// ISO cnlp
1636 pub const IPPROTO_EON: ::c_int = 80;
1637 /// Ethernet-in-IP
1638 pub const IPPROTO_ETHERIP: ::c_int = 97;
1639 /// encapsulation header
1640 pub const IPPROTO_ENCAP: ::c_int = 98;
1641 /// Protocol indep. multicast
1642 pub const IPPROTO_PIM: ::c_int = 103;
1643 /// IP Payload Comp. Protocol
1644 pub const IPPROTO_IPCOMP: ::c_int = 108;
1645 /// VRRP RFC 2338
1646 pub const IPPROTO_VRRP: ::c_int = 112;
1647 /// Common Address Resolution Protocol
1648 pub const IPPROTO_CARP: ::c_int = 112;
1649 /// L2TPv3
1650 pub const IPPROTO_L2TP: ::c_int = 115;
1651 /// SCTP
1652 pub const IPPROTO_SCTP: ::c_int = 132;
1653 /// PFSYNC
1654 pub const IPPROTO_PFSYNC: ::c_int = 240;
1655 pub const IPPROTO_MAX: ::c_int = 256;
1656 
1657 /// last return value of *_input(), meaning "all job for this pkt is done".
1658 pub const IPPROTO_DONE: ::c_int = 257;
1659 
1660 /// sysctl placeholder for (FAST_)IPSEC
1661 pub const CTL_IPPROTO_IPSEC: ::c_int = 258;
1662 
1663 pub const AF_OROUTE: ::c_int = 17;
1664 pub const AF_ARP: ::c_int = 28;
1665 pub const pseudo_AF_KEY: ::c_int = 29;
1666 pub const pseudo_AF_HDRCMPLT: ::c_int = 30;
1667 pub const AF_BLUETOOTH: ::c_int = 31;
1668 pub const AF_IEEE80211: ::c_int = 32;
1669 pub const AF_MPLS: ::c_int = 33;
1670 pub const AF_ROUTE: ::c_int = 34;
1671 pub const NET_RT_DUMP: ::c_int = 1;
1672 pub const NET_RT_FLAGS: ::c_int = 2;
1673 pub const NET_RT_OOOIFLIST: ::c_int = 3;
1674 pub const NET_RT_OOIFLIST: ::c_int = 4;
1675 pub const NET_RT_OIFLIST: ::c_int = 5;
1676 pub const NET_RT_IFLIST: ::c_int = 6;
1677 pub const NET_RT_MAXID: ::c_int = 7;
1678 
1679 pub const PF_OROUTE: ::c_int = AF_OROUTE;
1680 pub const PF_ARP: ::c_int = AF_ARP;
1681 pub const PF_KEY: ::c_int = pseudo_AF_KEY;
1682 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1683 pub const PF_MPLS: ::c_int = AF_MPLS;
1684 pub const PF_ROUTE: ::c_int = AF_ROUTE;
1685 
1686 pub const MSG_NBIO: ::c_int = 0x1000;
1687 pub const MSG_WAITFORONE: ::c_int = 0x2000;
1688 pub const MSG_NOTIFICATION: ::c_int = 0x4000;
1689 
1690 pub const SCM_TIMESTAMP: ::c_int = 0x08;
1691 pub const SCM_CREDS: ::c_int = 0x10;
1692 
1693 pub const O_DSYNC: ::c_int = 0x10000;
1694 
1695 pub const MAP_RENAME: ::c_int = 0x20;
1696 pub const MAP_NORESERVE: ::c_int = 0x40;
1697 pub const MAP_HASSEMAPHORE: ::c_int = 0x200;
1698 pub const MAP_TRYFIXED: ::c_int = 0x400;
1699 pub const MAP_WIRED: ::c_int = 0x800;
1700 pub const MAP_STACK: ::c_int = 0x2000;
1701 // map alignment aliases for MAP_ALIGNED
1702 pub const MAP_ALIGNMENT_SHIFT: ::c_int = 24;
1703 pub const MAP_ALIGNMENT_MASK: ::c_int = 0xff << MAP_ALIGNMENT_SHIFT;
1704 pub const MAP_ALIGNMENT_64KB: ::c_int = 16 << MAP_ALIGNMENT_SHIFT;
1705 pub const MAP_ALIGNMENT_16MB: ::c_int = 24 << MAP_ALIGNMENT_SHIFT;
1706 pub const MAP_ALIGNMENT_4GB: ::c_int = 32 << MAP_ALIGNMENT_SHIFT;
1707 pub const MAP_ALIGNMENT_1TB: ::c_int = 40 << MAP_ALIGNMENT_SHIFT;
1708 pub const MAP_ALIGNMENT_256TB: ::c_int = 48 << MAP_ALIGNMENT_SHIFT;
1709 pub const MAP_ALIGNMENT_64PB: ::c_int = 56 << MAP_ALIGNMENT_SHIFT;
1710 // mremap flag
1711 pub const MAP_REMAPDUP: ::c_int = 0x004;
1712 
1713 pub const DCCP_TYPE_REQUEST: ::c_int = 0;
1714 pub const DCCP_TYPE_RESPONSE: ::c_int = 1;
1715 pub const DCCP_TYPE_DATA: ::c_int = 2;
1716 pub const DCCP_TYPE_ACK: ::c_int = 3;
1717 pub const DCCP_TYPE_DATAACK: ::c_int = 4;
1718 pub const DCCP_TYPE_CLOSEREQ: ::c_int = 5;
1719 pub const DCCP_TYPE_CLOSE: ::c_int = 6;
1720 pub const DCCP_TYPE_RESET: ::c_int = 7;
1721 pub const DCCP_TYPE_MOVE: ::c_int = 8;
1722 
1723 pub const DCCP_FEATURE_CC: ::c_int = 1;
1724 pub const DCCP_FEATURE_ECN: ::c_int = 2;
1725 pub const DCCP_FEATURE_ACKRATIO: ::c_int = 3;
1726 pub const DCCP_FEATURE_ACKVECTOR: ::c_int = 4;
1727 pub const DCCP_FEATURE_MOBILITY: ::c_int = 5;
1728 pub const DCCP_FEATURE_LOSSWINDOW: ::c_int = 6;
1729 pub const DCCP_FEATURE_CONN_NONCE: ::c_int = 8;
1730 pub const DCCP_FEATURE_IDENTREG: ::c_int = 7;
1731 
1732 pub const DCCP_OPT_PADDING: ::c_int = 0;
1733 pub const DCCP_OPT_DATA_DISCARD: ::c_int = 1;
1734 pub const DCCP_OPT_SLOW_RECV: ::c_int = 2;
1735 pub const DCCP_OPT_BUF_CLOSED: ::c_int = 3;
1736 pub const DCCP_OPT_CHANGE_L: ::c_int = 32;
1737 pub const DCCP_OPT_CONFIRM_L: ::c_int = 33;
1738 pub const DCCP_OPT_CHANGE_R: ::c_int = 34;
1739 pub const DCCP_OPT_CONFIRM_R: ::c_int = 35;
1740 pub const DCCP_OPT_INIT_COOKIE: ::c_int = 36;
1741 pub const DCCP_OPT_NDP_COUNT: ::c_int = 37;
1742 pub const DCCP_OPT_ACK_VECTOR0: ::c_int = 38;
1743 pub const DCCP_OPT_ACK_VECTOR1: ::c_int = 39;
1744 pub const DCCP_OPT_RECV_BUF_DROPS: ::c_int = 40;
1745 pub const DCCP_OPT_TIMESTAMP: ::c_int = 41;
1746 pub const DCCP_OPT_TIMESTAMP_ECHO: ::c_int = 42;
1747 pub const DCCP_OPT_ELAPSEDTIME: ::c_int = 43;
1748 pub const DCCP_OPT_DATACHECKSUM: ::c_int = 44;
1749 
1750 pub const DCCP_REASON_UNSPEC: ::c_int = 0;
1751 pub const DCCP_REASON_CLOSED: ::c_int = 1;
1752 pub const DCCP_REASON_INVALID: ::c_int = 2;
1753 pub const DCCP_REASON_OPTION_ERR: ::c_int = 3;
1754 pub const DCCP_REASON_FEA_ERR: ::c_int = 4;
1755 pub const DCCP_REASON_CONN_REF: ::c_int = 5;
1756 pub const DCCP_REASON_BAD_SNAME: ::c_int = 6;
1757 pub const DCCP_REASON_BAD_COOKIE: ::c_int = 7;
1758 pub const DCCP_REASON_INV_MOVE: ::c_int = 8;
1759 pub const DCCP_REASON_UNANSW_CH: ::c_int = 10;
1760 pub const DCCP_REASON_FRUITLESS_NEG: ::c_int = 11;
1761 
1762 pub const DCCP_CCID: ::c_int = 1;
1763 pub const DCCP_CSLEN: ::c_int = 2;
1764 pub const DCCP_MAXSEG: ::c_int = 4;
1765 pub const DCCP_SERVICE: ::c_int = 8;
1766 
1767 pub const DCCP_NDP_LIMIT: ::c_int = 16;
1768 pub const DCCP_SEQ_NUM_LIMIT: ::c_int = 16777216;
1769 pub const DCCP_MAX_OPTIONS: ::c_int = 32;
1770 pub const DCCP_MAX_PKTS: ::c_int = 100;
1771 
1772 pub const _PC_LINK_MAX: ::c_int = 1;
1773 pub const _PC_MAX_CANON: ::c_int = 2;
1774 pub const _PC_MAX_INPUT: ::c_int = 3;
1775 pub const _PC_NAME_MAX: ::c_int = 4;
1776 pub const _PC_PATH_MAX: ::c_int = 5;
1777 pub const _PC_PIPE_BUF: ::c_int = 6;
1778 pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
1779 pub const _PC_NO_TRUNC: ::c_int = 8;
1780 pub const _PC_VDISABLE: ::c_int = 9;
1781 pub const _PC_SYNC_IO: ::c_int = 10;
1782 pub const _PC_FILESIZEBITS: ::c_int = 11;
1783 pub const _PC_SYMLINK_MAX: ::c_int = 12;
1784 pub const _PC_2_SYMLINKS: ::c_int = 13;
1785 pub const _PC_ACL_EXTENDED: ::c_int = 14;
1786 pub const _PC_MIN_HOLE_SIZE: ::c_int = 15;
1787 
1788 pub const _SC_SYNCHRONIZED_IO: ::c_int = 31;
1789 pub const _SC_IOV_MAX: ::c_int = 32;
1790 pub const _SC_MAPPED_FILES: ::c_int = 33;
1791 pub const _SC_MEMLOCK: ::c_int = 34;
1792 pub const _SC_MEMLOCK_RANGE: ::c_int = 35;
1793 pub const _SC_MEMORY_PROTECTION: ::c_int = 36;
1794 pub const _SC_LOGIN_NAME_MAX: ::c_int = 37;
1795 pub const _SC_MONOTONIC_CLOCK: ::c_int = 38;
1796 pub const _SC_CLK_TCK: ::c_int = 39;
1797 pub const _SC_ATEXIT_MAX: ::c_int = 40;
1798 pub const _SC_THREADS: ::c_int = 41;
1799 pub const _SC_SEMAPHORES: ::c_int = 42;
1800 pub const _SC_BARRIERS: ::c_int = 43;
1801 pub const _SC_TIMERS: ::c_int = 44;
1802 pub const _SC_SPIN_LOCKS: ::c_int = 45;
1803 pub const _SC_READER_WRITER_LOCKS: ::c_int = 46;
1804 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 47;
1805 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 48;
1806 pub const _SC_CLOCK_SELECTION: ::c_int = 49;
1807 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 50;
1808 pub const _SC_AIO_LISTIO_MAX: ::c_int = 51;
1809 pub const _SC_AIO_MAX: ::c_int = 52;
1810 pub const _SC_MESSAGE_PASSING: ::c_int = 53;
1811 pub const _SC_MQ_OPEN_MAX: ::c_int = 54;
1812 pub const _SC_MQ_PRIO_MAX: ::c_int = 55;
1813 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 56;
1814 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 57;
1815 pub const _SC_THREAD_KEYS_MAX: ::c_int = 58;
1816 pub const _SC_THREAD_STACK_MIN: ::c_int = 59;
1817 pub const _SC_THREAD_THREADS_MAX: ::c_int = 60;
1818 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 61;
1819 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 62;
1820 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 63;
1821 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 64;
1822 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 65;
1823 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 66;
1824 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 67;
1825 pub const _SC_TTY_NAME_MAX: ::c_int = 68;
1826 pub const _SC_HOST_NAME_MAX: ::c_int = 69;
1827 pub const _SC_PASS_MAX: ::c_int = 70;
1828 pub const _SC_REGEXP: ::c_int = 71;
1829 pub const _SC_SHELL: ::c_int = 72;
1830 pub const _SC_SYMLOOP_MAX: ::c_int = 73;
1831 pub const _SC_V6_ILP32_OFF32: ::c_int = 74;
1832 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 75;
1833 pub const _SC_V6_LP64_OFF64: ::c_int = 76;
1834 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 77;
1835 pub const _SC_2_PBS: ::c_int = 80;
1836 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 81;
1837 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 82;
1838 pub const _SC_2_PBS_LOCATE: ::c_int = 83;
1839 pub const _SC_2_PBS_MESSAGE: ::c_int = 84;
1840 pub const _SC_2_PBS_TRACK: ::c_int = 85;
1841 pub const _SC_SPAWN: ::c_int = 86;
1842 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 87;
1843 pub const _SC_TIMER_MAX: ::c_int = 88;
1844 pub const _SC_SEM_NSEMS_MAX: ::c_int = 89;
1845 pub const _SC_CPUTIME: ::c_int = 90;
1846 pub const _SC_THREAD_CPUTIME: ::c_int = 91;
1847 pub const _SC_DELAYTIMER_MAX: ::c_int = 92;
1848 // These two variables will be supported in NetBSD 8.0
1849 // pub const _SC_SIGQUEUE_MAX : ::c_int = 93;
1850 // pub const _SC_REALTIME_SIGNALS : ::c_int = 94;
1851 pub const _SC_PHYS_PAGES: ::c_int = 121;
1852 pub const _SC_NPROCESSORS_CONF: ::c_int = 1001;
1853 pub const _SC_NPROCESSORS_ONLN: ::c_int = 1002;
1854 pub const _SC_SCHED_RT_TS: ::c_int = 2001;
1855 pub const _SC_SCHED_PRI_MIN: ::c_int = 2002;
1856 pub const _SC_SCHED_PRI_MAX: ::c_int = 2003;
1857 
1858 pub const FD_SETSIZE: usize = 0x100;
1859 
1860 pub const ST_NOSUID: ::c_ulong = 8;
1861 
1862 pub const BIOCGRSIG: ::c_ulong = 0x40044272;
1863 pub const BIOCSRSIG: ::c_ulong = 0x80044273;
1864 pub const BIOCSDLT: ::c_ulong = 0x80044278;
1865 pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
1866 pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
1867 
1868 // <sys/fstypes.h>
1869 pub const MNT_UNION: ::c_int = 0x00000020;
1870 pub const MNT_NOCOREDUMP: ::c_int = 0x00008000;
1871 pub const MNT_RELATIME: ::c_int = 0x00020000;
1872 pub const MNT_IGNORE: ::c_int = 0x00100000;
1873 pub const MNT_NFS4ACLS: ::c_int = 0x00200000;
1874 pub const MNT_DISCARD: ::c_int = 0x00800000;
1875 pub const MNT_EXTATTR: ::c_int = 0x01000000;
1876 pub const MNT_LOG: ::c_int = 0x02000000;
1877 pub const MNT_NOATIME: ::c_int = 0x04000000;
1878 pub const MNT_AUTOMOUNTED: ::c_int = 0x10000000;
1879 pub const MNT_SYMPERM: ::c_int = 0x20000000;
1880 pub const MNT_NODEVMTIME: ::c_int = 0x40000000;
1881 pub const MNT_SOFTDEP: ::c_int = 0x80000000;
1882 pub const MNT_POSIX1EACLS: ::c_int = 0x00000800;
1883 pub const MNT_ACLS: ::c_int = MNT_POSIX1EACLS;
1884 pub const MNT_WAIT: ::c_int = 1;
1885 pub const MNT_NOWAIT: ::c_int = 2;
1886 pub const MNT_LAZY: ::c_int = 3;
1887 
1888 //<sys/timex.h>
1889 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
1890 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 4;
1891 pub const NTP_API: ::c_int = 4;
1892 pub const MAXPHASE: ::c_long = 500000000;
1893 pub const MAXFREQ: ::c_long = 500000;
1894 pub const MINSEC: ::c_int = 256;
1895 pub const MAXSEC: ::c_int = 2048;
1896 pub const NANOSECOND: ::c_long = 1000000000;
1897 pub const SCALE_PPM: ::c_int = 65;
1898 pub const MAXTC: ::c_int = 10;
1899 pub const MOD_OFFSET: ::c_uint = 0x0001;
1900 pub const MOD_FREQUENCY: ::c_uint = 0x0002;
1901 pub const MOD_MAXERROR: ::c_uint = 0x0004;
1902 pub const MOD_ESTERROR: ::c_uint = 0x0008;
1903 pub const MOD_STATUS: ::c_uint = 0x0010;
1904 pub const MOD_TIMECONST: ::c_uint = 0x0020;
1905 pub const MOD_PPSMAX: ::c_uint = 0x0040;
1906 pub const MOD_TAI: ::c_uint = 0x0080;
1907 pub const MOD_MICRO: ::c_uint = 0x1000;
1908 pub const MOD_NANO: ::c_uint = 0x2000;
1909 pub const MOD_CLKB: ::c_uint = 0x4000;
1910 pub const MOD_CLKA: ::c_uint = 0x8000;
1911 pub const STA_PLL: ::c_int = 0x0001;
1912 pub const STA_PPSFREQ: ::c_int = 0x0002;
1913 pub const STA_PPSTIME: ::c_int = 0x0004;
1914 pub const STA_FLL: ::c_int = 0x0008;
1915 pub const STA_INS: ::c_int = 0x0010;
1916 pub const STA_DEL: ::c_int = 0x0020;
1917 pub const STA_UNSYNC: ::c_int = 0x0040;
1918 pub const STA_FREQHOLD: ::c_int = 0x0080;
1919 pub const STA_PPSSIGNAL: ::c_int = 0x0100;
1920 pub const STA_PPSJITTER: ::c_int = 0x0200;
1921 pub const STA_PPSWANDER: ::c_int = 0x0400;
1922 pub const STA_PPSERROR: ::c_int = 0x0800;
1923 pub const STA_CLOCKERR: ::c_int = 0x1000;
1924 pub const STA_NANO: ::c_int = 0x2000;
1925 pub const STA_MODE: ::c_int = 0x4000;
1926 pub const STA_CLK: ::c_int = 0x8000;
1927 pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
1928     | STA_PPSJITTER
1929     | STA_PPSWANDER
1930     | STA_PPSERROR
1931     | STA_CLOCKERR
1932     | STA_NANO
1933     | STA_MODE
1934     | STA_CLK;
1935 pub const TIME_OK: ::c_int = 0;
1936 pub const TIME_INS: ::c_int = 1;
1937 pub const TIME_DEL: ::c_int = 2;
1938 pub const TIME_OOP: ::c_int = 3;
1939 pub const TIME_WAIT: ::c_int = 4;
1940 pub const TIME_ERROR: ::c_int = 5;
1941 
1942 pub const LITTLE_ENDIAN: ::c_int = 1234;
1943 pub const BIG_ENDIAN: ::c_int = 4321;
1944 
1945 pub const PL_EVENT_NONE: ::c_int = 0;
1946 pub const PL_EVENT_SIGNAL: ::c_int = 1;
1947 pub const PL_EVENT_SUSPENDED: ::c_int = 2;
1948 
1949 cfg_if! {
1950     if #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
1951                  target_arch = "x86", target_arch = "x86_64"))] {
1952         pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1953           = pthread_mutex_t {
1954             ptm_magic: 0x33330003,
1955             ptm_errorcheck: 0,
1956             ptm_pad1: [0; 3],
1957             ptm_unused: 0,
1958             ptm_pad2: [0; 3],
1959             ptm_waiters: 0 as *mut _,
1960             ptm_owner: 0,
1961             ptm_recursed: 0,
1962             ptm_spare2: 0 as *mut _,
1963         };
1964     } else {
1965         pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t
1966           = pthread_mutex_t {
1967             ptm_magic: 0x33330003,
1968             ptm_errorcheck: 0,
1969             ptm_unused: 0,
1970             ptm_waiters: 0 as *mut _,
1971             ptm_owner: 0,
1972             ptm_recursed: 0,
1973             ptm_spare2: 0 as *mut _,
1974         };
1975     }
1976 }
1977 
1978 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1979     ptc_magic: 0x55550005,
1980     ptc_lock: 0,
1981     ptc_waiters_first: 0 as *mut _,
1982     ptc_waiters_last: 0 as *mut _,
1983     ptc_mutex: 0 as *mut _,
1984     ptc_private: 0 as *mut _,
1985 };
1986 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1987     ptr_magic: 0x99990009,
1988     ptr_interlock: 0,
1989     ptr_rblocked_first: 0 as *mut _,
1990     ptr_rblocked_last: 0 as *mut _,
1991     ptr_wblocked_first: 0 as *mut _,
1992     ptr_wblocked_last: 0 as *mut _,
1993     ptr_nreaders: 0,
1994     ptr_owner: 0,
1995     ptr_private: 0 as *mut _,
1996 };
1997 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
1998 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
1999 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
2000 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
2001 
2002 pub const SCHED_NONE: ::c_int = -1;
2003 pub const SCHED_OTHER: ::c_int = 0;
2004 pub const SCHED_FIFO: ::c_int = 1;
2005 pub const SCHED_RR: ::c_int = 2;
2006 
2007 pub const EVFILT_AIO: u32 = 2;
2008 pub const EVFILT_PROC: u32 = 4;
2009 pub const EVFILT_READ: u32 = 0;
2010 pub const EVFILT_SIGNAL: u32 = 5;
2011 pub const EVFILT_TIMER: u32 = 6;
2012 pub const EVFILT_VNODE: u32 = 3;
2013 pub const EVFILT_WRITE: u32 = 1;
2014 pub const EVFILT_FS: u32 = 7;
2015 pub const EVFILT_USER: u32 = 8;
2016 pub const EVFILT_EMPTY: u32 = 9;
2017 
2018 pub const EV_ADD: u32 = 0x1;
2019 pub const EV_DELETE: u32 = 0x2;
2020 pub const EV_ENABLE: u32 = 0x4;
2021 pub const EV_DISABLE: u32 = 0x8;
2022 pub const EV_ONESHOT: u32 = 0x10;
2023 pub const EV_CLEAR: u32 = 0x20;
2024 pub const EV_RECEIPT: u32 = 0x40;
2025 pub const EV_DISPATCH: u32 = 0x80;
2026 pub const EV_FLAG1: u32 = 0x2000;
2027 pub const EV_ERROR: u32 = 0x4000;
2028 pub const EV_EOF: u32 = 0x8000;
2029 pub const EV_SYSFLAGS: u32 = 0xf000;
2030 
2031 pub const NOTE_TRIGGER: u32 = 0x01000000;
2032 pub const NOTE_FFNOP: u32 = 0x00000000;
2033 pub const NOTE_FFAND: u32 = 0x40000000;
2034 pub const NOTE_FFOR: u32 = 0x80000000;
2035 pub const NOTE_FFCOPY: u32 = 0xc0000000;
2036 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
2037 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
2038 pub const NOTE_LOWAT: u32 = 0x00000001;
2039 pub const NOTE_DELETE: u32 = 0x00000001;
2040 pub const NOTE_WRITE: u32 = 0x00000002;
2041 pub const NOTE_EXTEND: u32 = 0x00000004;
2042 pub const NOTE_ATTRIB: u32 = 0x00000008;
2043 pub const NOTE_LINK: u32 = 0x00000010;
2044 pub const NOTE_RENAME: u32 = 0x00000020;
2045 pub const NOTE_REVOKE: u32 = 0x00000040;
2046 pub const NOTE_EXIT: u32 = 0x80000000;
2047 pub const NOTE_FORK: u32 = 0x40000000;
2048 pub const NOTE_EXEC: u32 = 0x20000000;
2049 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
2050 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
2051 pub const NOTE_TRACK: u32 = 0x00000001;
2052 pub const NOTE_TRACKERR: u32 = 0x00000002;
2053 pub const NOTE_CHILD: u32 = 0x00000004;
2054 pub const NOTE_MSECONDS: u32 = 0x00000000;
2055 pub const NOTE_SECONDS: u32 = 0x00000001;
2056 pub const NOTE_USECONDS: u32 = 0x00000002;
2057 pub const NOTE_NSECONDS: u32 = 0x00000003;
2058 pub const NOTE_ABSTIME: u32 = 0x000000010;
2059 
2060 pub const TMP_MAX: ::c_uint = 308915776;
2061 
2062 pub const AI_PASSIVE: ::c_int = 0x00000001;
2063 pub const AI_CANONNAME: ::c_int = 0x00000002;
2064 pub const AI_NUMERICHOST: ::c_int = 0x00000004;
2065 pub const AI_NUMERICSERV: ::c_int = 0x00000008;
2066 pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
2067 pub const AI_SRV: ::c_int = 0x00000800;
2068 
2069 pub const NI_MAXHOST: ::socklen_t = 1025;
2070 pub const NI_MAXSERV: ::socklen_t = 32;
2071 
2072 pub const NI_NOFQDN: ::c_int = 0x00000001;
2073 pub const NI_NUMERICHOST: ::c_int = 0x000000002;
2074 pub const NI_NAMEREQD: ::c_int = 0x000000004;
2075 pub const NI_NUMERICSERV: ::c_int = 0x000000008;
2076 pub const NI_DGRAM: ::c_int = 0x00000010;
2077 pub const NI_WITHSCOPEID: ::c_int = 0x00000020;
2078 pub const NI_NUMERICSCOPE: ::c_int = 0x00000040;
2079 
2080 pub const RTLD_NOLOAD: ::c_int = 0x2000;
2081 pub const RTLD_LOCAL: ::c_int = 0x200;
2082 
2083 pub const CTL_MAXNAME: ::c_int = 12;
2084 pub const SYSCTL_NAMELEN: ::c_int = 32;
2085 pub const SYSCTL_DEFSIZE: ::c_int = 8;
2086 pub const CTLTYPE_NODE: ::c_int = 1;
2087 pub const CTLTYPE_INT: ::c_int = 2;
2088 pub const CTLTYPE_STRING: ::c_int = 3;
2089 pub const CTLTYPE_QUAD: ::c_int = 4;
2090 pub const CTLTYPE_STRUCT: ::c_int = 5;
2091 pub const CTLTYPE_BOOL: ::c_int = 6;
2092 pub const CTLFLAG_READONLY: ::c_int = 0x00000000;
2093 pub const CTLFLAG_READWRITE: ::c_int = 0x00000070;
2094 pub const CTLFLAG_ANYWRITE: ::c_int = 0x00000080;
2095 pub const CTLFLAG_PRIVATE: ::c_int = 0x00000100;
2096 pub const CTLFLAG_PERMANENT: ::c_int = 0x00000200;
2097 pub const CTLFLAG_OWNDATA: ::c_int = 0x00000400;
2098 pub const CTLFLAG_IMMEDIATE: ::c_int = 0x00000800;
2099 pub const CTLFLAG_HEX: ::c_int = 0x00001000;
2100 pub const CTLFLAG_ROOT: ::c_int = 0x00002000;
2101 pub const CTLFLAG_ANYNUMBER: ::c_int = 0x00004000;
2102 pub const CTLFLAG_HIDDEN: ::c_int = 0x00008000;
2103 pub const CTLFLAG_ALIAS: ::c_int = 0x00010000;
2104 pub const CTLFLAG_MMAP: ::c_int = 0x00020000;
2105 pub const CTLFLAG_OWNDESC: ::c_int = 0x00040000;
2106 pub const CTLFLAG_UNSIGNED: ::c_int = 0x00080000;
2107 pub const SYSCTL_VERS_MASK: ::c_int = 0xff000000;
2108 pub const SYSCTL_VERS_0: ::c_int = 0x00000000;
2109 pub const SYSCTL_VERS_1: ::c_int = 0x01000000;
2110 pub const SYSCTL_VERSION: ::c_int = SYSCTL_VERS_1;
2111 pub const CTL_EOL: ::c_int = -1;
2112 pub const CTL_QUERY: ::c_int = -2;
2113 pub const CTL_CREATE: ::c_int = -3;
2114 pub const CTL_CREATESYM: ::c_int = -4;
2115 pub const CTL_DESTROY: ::c_int = -5;
2116 pub const CTL_MMAP: ::c_int = -6;
2117 pub const CTL_DESCRIBE: ::c_int = -7;
2118 pub const CTL_UNSPEC: ::c_int = 0;
2119 pub const CTL_KERN: ::c_int = 1;
2120 pub const CTL_VM: ::c_int = 2;
2121 pub const CTL_VFS: ::c_int = 3;
2122 pub const CTL_NET: ::c_int = 4;
2123 pub const CTL_DEBUG: ::c_int = 5;
2124 pub const CTL_HW: ::c_int = 6;
2125 pub const CTL_MACHDEP: ::c_int = 7;
2126 pub const CTL_USER: ::c_int = 8;
2127 pub const CTL_DDB: ::c_int = 9;
2128 pub const CTL_PROC: ::c_int = 10;
2129 pub const CTL_VENDOR: ::c_int = 11;
2130 pub const CTL_EMUL: ::c_int = 12;
2131 pub const CTL_SECURITY: ::c_int = 13;
2132 pub const CTL_MAXID: ::c_int = 14;
2133 pub const KERN_OSTYPE: ::c_int = 1;
2134 pub const KERN_OSRELEASE: ::c_int = 2;
2135 pub const KERN_OSREV: ::c_int = 3;
2136 pub const KERN_VERSION: ::c_int = 4;
2137 pub const KERN_MAXVNODES: ::c_int = 5;
2138 pub const KERN_MAXPROC: ::c_int = 6;
2139 pub const KERN_MAXFILES: ::c_int = 7;
2140 pub const KERN_ARGMAX: ::c_int = 8;
2141 pub const KERN_SECURELVL: ::c_int = 9;
2142 pub const KERN_HOSTNAME: ::c_int = 10;
2143 pub const KERN_HOSTID: ::c_int = 11;
2144 pub const KERN_CLOCKRATE: ::c_int = 12;
2145 pub const KERN_VNODE: ::c_int = 13;
2146 pub const KERN_PROC: ::c_int = 14;
2147 pub const KERN_FILE: ::c_int = 15;
2148 pub const KERN_PROF: ::c_int = 16;
2149 pub const KERN_POSIX1: ::c_int = 17;
2150 pub const KERN_NGROUPS: ::c_int = 18;
2151 pub const KERN_JOB_CONTROL: ::c_int = 19;
2152 pub const KERN_SAVED_IDS: ::c_int = 20;
2153 pub const KERN_OBOOTTIME: ::c_int = 21;
2154 pub const KERN_DOMAINNAME: ::c_int = 22;
2155 pub const KERN_MAXPARTITIONS: ::c_int = 23;
2156 pub const KERN_RAWPARTITION: ::c_int = 24;
2157 pub const KERN_NTPTIME: ::c_int = 25;
2158 pub const KERN_TIMEX: ::c_int = 26;
2159 pub const KERN_AUTONICETIME: ::c_int = 27;
2160 pub const KERN_AUTONICEVAL: ::c_int = 28;
2161 pub const KERN_RTC_OFFSET: ::c_int = 29;
2162 pub const KERN_ROOT_DEVICE: ::c_int = 30;
2163 pub const KERN_MSGBUFSIZE: ::c_int = 31;
2164 pub const KERN_FSYNC: ::c_int = 32;
2165 pub const KERN_OLDSYSVMSG: ::c_int = 33;
2166 pub const KERN_OLDSYSVSEM: ::c_int = 34;
2167 pub const KERN_OLDSYSVSHM: ::c_int = 35;
2168 pub const KERN_OLDSHORTCORENAME: ::c_int = 36;
2169 pub const KERN_SYNCHRONIZED_IO: ::c_int = 37;
2170 pub const KERN_IOV_MAX: ::c_int = 38;
2171 pub const KERN_MBUF: ::c_int = 39;
2172 pub const KERN_MAPPED_FILES: ::c_int = 40;
2173 pub const KERN_MEMLOCK: ::c_int = 41;
2174 pub const KERN_MEMLOCK_RANGE: ::c_int = 42;
2175 pub const KERN_MEMORY_PROTECTION: ::c_int = 43;
2176 pub const KERN_LOGIN_NAME_MAX: ::c_int = 44;
2177 pub const KERN_DEFCORENAME: ::c_int = 45;
2178 pub const KERN_LOGSIGEXIT: ::c_int = 46;
2179 pub const KERN_PROC2: ::c_int = 47;
2180 pub const KERN_PROC_ARGS: ::c_int = 48;
2181 pub const KERN_FSCALE: ::c_int = 49;
2182 pub const KERN_CCPU: ::c_int = 50;
2183 pub const KERN_CP_TIME: ::c_int = 51;
2184 pub const KERN_OLDSYSVIPC_INFO: ::c_int = 52;
2185 pub const KERN_MSGBUF: ::c_int = 53;
2186 pub const KERN_CONSDEV: ::c_int = 54;
2187 pub const KERN_MAXPTYS: ::c_int = 55;
2188 pub const KERN_PIPE: ::c_int = 56;
2189 pub const KERN_MAXPHYS: ::c_int = 57;
2190 pub const KERN_SBMAX: ::c_int = 58;
2191 pub const KERN_TKSTAT: ::c_int = 59;
2192 pub const KERN_MONOTONIC_CLOCK: ::c_int = 60;
2193 pub const KERN_URND: ::c_int = 61;
2194 pub const KERN_LABELSECTOR: ::c_int = 62;
2195 pub const KERN_LABELOFFSET: ::c_int = 63;
2196 pub const KERN_LWP: ::c_int = 64;
2197 pub const KERN_FORKFSLEEP: ::c_int = 65;
2198 pub const KERN_POSIX_THREADS: ::c_int = 66;
2199 pub const KERN_POSIX_SEMAPHORES: ::c_int = 67;
2200 pub const KERN_POSIX_BARRIERS: ::c_int = 68;
2201 pub const KERN_POSIX_TIMERS: ::c_int = 69;
2202 pub const KERN_POSIX_SPIN_LOCKS: ::c_int = 70;
2203 pub const KERN_POSIX_READER_WRITER_LOCKS: ::c_int = 71;
2204 pub const KERN_DUMP_ON_PANIC: ::c_int = 72;
2205 pub const KERN_SOMAXKVA: ::c_int = 73;
2206 pub const KERN_ROOT_PARTITION: ::c_int = 74;
2207 pub const KERN_DRIVERS: ::c_int = 75;
2208 pub const KERN_BUF: ::c_int = 76;
2209 pub const KERN_FILE2: ::c_int = 77;
2210 pub const KERN_VERIEXEC: ::c_int = 78;
2211 pub const KERN_CP_ID: ::c_int = 79;
2212 pub const KERN_HARDCLOCK_TICKS: ::c_int = 80;
2213 pub const KERN_ARND: ::c_int = 81;
2214 pub const KERN_SYSVIPC: ::c_int = 82;
2215 pub const KERN_BOOTTIME: ::c_int = 83;
2216 pub const KERN_EVCNT: ::c_int = 84;
2217 pub const KERN_MAXID: ::c_int = 85;
2218 pub const KERN_PROC_ALL: ::c_int = 0;
2219 pub const KERN_PROC_PID: ::c_int = 1;
2220 pub const KERN_PROC_PGRP: ::c_int = 2;
2221 pub const KERN_PROC_SESSION: ::c_int = 3;
2222 pub const KERN_PROC_TTY: ::c_int = 4;
2223 pub const KERN_PROC_UID: ::c_int = 5;
2224 pub const KERN_PROC_RUID: ::c_int = 6;
2225 pub const KERN_PROC_GID: ::c_int = 7;
2226 pub const KERN_PROC_RGID: ::c_int = 8;
2227 pub const KERN_PROC_ARGV: ::c_int = 1;
2228 pub const KERN_PROC_NARGV: ::c_int = 2;
2229 pub const KERN_PROC_ENV: ::c_int = 3;
2230 pub const KERN_PROC_NENV: ::c_int = 4;
2231 pub const KERN_PROC_PATHNAME: ::c_int = 5;
2232 pub const VM_PROC: ::c_int = 16;
2233 pub const VM_PROC_MAP: ::c_int = 1;
2234 
2235 pub const EAI_AGAIN: ::c_int = 2;
2236 pub const EAI_BADFLAGS: ::c_int = 3;
2237 pub const EAI_FAIL: ::c_int = 4;
2238 pub const EAI_FAMILY: ::c_int = 5;
2239 pub const EAI_MEMORY: ::c_int = 6;
2240 pub const EAI_NODATA: ::c_int = 7;
2241 pub const EAI_NONAME: ::c_int = 8;
2242 pub const EAI_SERVICE: ::c_int = 9;
2243 pub const EAI_SOCKTYPE: ::c_int = 10;
2244 pub const EAI_SYSTEM: ::c_int = 11;
2245 pub const EAI_OVERFLOW: ::c_int = 14;
2246 
2247 pub const AIO_CANCELED: ::c_int = 1;
2248 pub const AIO_NOTCANCELED: ::c_int = 2;
2249 pub const AIO_ALLDONE: ::c_int = 3;
2250 pub const LIO_NOP: ::c_int = 0;
2251 pub const LIO_WRITE: ::c_int = 1;
2252 pub const LIO_READ: ::c_int = 2;
2253 pub const LIO_WAIT: ::c_int = 1;
2254 pub const LIO_NOWAIT: ::c_int = 0;
2255 
2256 pub const SIGEV_NONE: ::c_int = 0;
2257 pub const SIGEV_SIGNAL: ::c_int = 1;
2258 pub const SIGEV_THREAD: ::c_int = 2;
2259 
2260 pub const WSTOPPED: ::c_int = 0x00000002; // same as WUNTRACED
2261 pub const WCONTINUED: ::c_int = 0x00000010;
2262 pub const WEXITED: ::c_int = 0x000000020;
2263 pub const WNOWAIT: ::c_int = 0x00010000;
2264 
2265 pub const WALTSIG: ::c_int = 0x00000004;
2266 pub const WALLSIG: ::c_int = 0x00000008;
2267 pub const WTRAPPED: ::c_int = 0x00000040;
2268 pub const WNOZOMBIE: ::c_int = 0x00020000;
2269 
2270 pub const P_ALL: idtype_t = 0;
2271 pub const P_PID: idtype_t = 1;
2272 pub const P_PGID: idtype_t = 4;
2273 
2274 pub const UTIME_OMIT: c_long = 1073741822;
2275 pub const UTIME_NOW: c_long = 1073741823;
2276 
2277 pub const B460800: ::speed_t = 460800;
2278 pub const B921600: ::speed_t = 921600;
2279 
2280 pub const ONOCR: ::tcflag_t = 0x20;
2281 pub const ONLRET: ::tcflag_t = 0x40;
2282 pub const CDTRCTS: ::tcflag_t = 0x00020000;
2283 pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
2284 
2285 // pub const _PATH_UTMPX: &[::c_char; 14] = b"/var/run/utmpx";
2286 // pub const _PATH_WTMPX: &[::c_char; 14] = b"/var/log/wtmpx";
2287 // pub const _PATH_LASTLOGX: &[::c_char; 17] = b"/var/log/lastlogx";
2288 // pub const _PATH_UTMP_UPDATE: &[::c_char; 24] = b"/usr/libexec/utmp_update";
2289 pub const UT_NAMESIZE: usize = 8;
2290 pub const UT_LINESIZE: usize = 8;
2291 pub const UT_HOSTSIZE: usize = 16;
2292 pub const _UTX_USERSIZE: usize = 32;
2293 pub const _UTX_LINESIZE: usize = 32;
2294 pub const _UTX_PADSIZE: usize = 40;
2295 pub const _UTX_IDSIZE: usize = 4;
2296 pub const _UTX_HOSTSIZE: usize = 256;
2297 pub const EMPTY: u16 = 0;
2298 pub const RUN_LVL: u16 = 1;
2299 pub const BOOT_TIME: u16 = 2;
2300 pub const OLD_TIME: u16 = 3;
2301 pub const NEW_TIME: u16 = 4;
2302 pub const INIT_PROCESS: u16 = 5;
2303 pub const LOGIN_PROCESS: u16 = 6;
2304 pub const USER_PROCESS: u16 = 7;
2305 pub const DEAD_PROCESS: u16 = 8;
2306 pub const ACCOUNTING: u16 = 9;
2307 pub const SIGNATURE: u16 = 10;
2308 pub const DOWN_TIME: u16 = 11;
2309 
2310 pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
2311 pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
2312 
2313 // Uncomment on next NetBSD release
2314 // pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
2315 // pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662;
2316 pub const OFIOGETBMAP: ::c_ulong = 0xc004667a;
2317 pub const FIOGETBMAP: ::c_ulong = 0xc008667a;
2318 pub const FIONWRITE: ::c_ulong = 0x40046679;
2319 pub const FIONSPACE: ::c_ulong = 0x40046678;
2320 pub const FIBMAP: ::c_ulong = 0xc008667a;
2321 
2322 pub const SIGSTKSZ: ::size_t = 40960;
2323 
2324 pub const REG_ENOSYS: ::c_int = 17;
2325 
2326 pub const PT_DUMPCORE: ::c_int = 12;
2327 pub const PT_LWPINFO: ::c_int = 13;
2328 pub const PT_SYSCALL: ::c_int = 14;
2329 pub const PT_SYSCALLEMU: ::c_int = 15;
2330 pub const PT_SET_EVENT_MASK: ::c_int = 16;
2331 pub const PT_GET_EVENT_MASK: ::c_int = 17;
2332 pub const PT_GET_PROCESS_STATE: ::c_int = 18;
2333 pub const PT_SET_SIGINFO: ::c_int = 19;
2334 pub const PT_GET_SIGINFO: ::c_int = 20;
2335 pub const PT_RESUME: ::c_int = 21;
2336 pub const PT_SUSPEND: ::c_int = 23;
2337 pub const PT_STOP: ::c_int = 23;
2338 pub const PT_LWPSTATUS: ::c_int = 24;
2339 pub const PT_LWPNEXT: ::c_int = 25;
2340 pub const PT_SET_SIGPASS: ::c_int = 26;
2341 pub const PT_GET_SIGPASS: ::c_int = 27;
2342 pub const PT_FIRSTMACH: ::c_int = 32;
2343 pub const POSIX_SPAWN_RETURNERROR: ::c_int = 0x40;
2344 
2345 // Flags for chflags(2)
2346 pub const SF_APPEND: ::c_ulong = 0x00040000;
2347 pub const SF_ARCHIVED: ::c_ulong = 0x00010000;
2348 pub const SF_IMMUTABLE: ::c_ulong = 0x00020000;
2349 pub const SF_LOG: ::c_ulong = 0x00400000;
2350 pub const SF_SETTABLE: ::c_ulong = 0xffff0000;
2351 pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
2352 pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
2353 pub const UF_APPEND: ::c_ulong = 0x00000004;
2354 pub const UF_IMMUTABLE: ::c_ulong = 0x00000002;
2355 pub const UF_NODUMP: ::c_ulong = 0x00000001;
2356 pub const UF_OPAQUE: ::c_ulong = 0x00000008;
2357 pub const UF_SETTABLE: ::c_ulong = 0x0000ffff;
2358 
2359 // sys/sysctl.h
2360 pub const KVME_PROT_READ: ::c_int = 0x00000001;
2361 pub const KVME_PROT_WRITE: ::c_int = 0x00000002;
2362 pub const KVME_PROT_EXEC: ::c_int = 0x00000004;
2363 
2364 pub const KVME_FLAG_COW: ::c_int = 0x00000001;
2365 pub const KVME_FLAG_NEEDS_COPY: ::c_int = 0x00000002;
2366 pub const KVME_FLAG_NOCOREDUMP: ::c_int = 0x000000004;
2367 pub const KVME_FLAG_PAGEABLE: ::c_int = 0x000000008;
2368 pub const KVME_FLAG_GROWS_UP: ::c_int = 0x000000010;
2369 pub const KVME_FLAG_GROWS_DOWN: ::c_int = 0x000000020;
2370 
2371 pub const NGROUPS_MAX: ::c_int = 16;
2372 
2373 pub const KI_NGROUPS: ::c_int = 16;
2374 pub const KI_MAXCOMLEN: ::c_int = 24;
2375 pub const KI_WMESGLEN: ::c_int = 8;
2376 pub const KI_MAXLOGNAME: ::c_int = 24;
2377 pub const KI_MAXEMULLEN: ::c_int = 16;
2378 pub const KI_LNAMELEN: ::c_int = 20;
2379 
2380 // sys/lwp.h
2381 pub const LSIDL: ::c_int = 1;
2382 pub const LSRUN: ::c_int = 2;
2383 pub const LSSLEEP: ::c_int = 3;
2384 pub const LSSTOP: ::c_int = 4;
2385 pub const LSZOMB: ::c_int = 5;
2386 pub const LSONPROC: ::c_int = 7;
2387 pub const LSSUSPENDED: ::c_int = 8;
2388 
2389 // sys/xattr.h
2390 pub const XATTR_CREATE: ::c_int = 0x01;
2391 pub const XATTR_REPLACE: ::c_int = 0x02;
2392 // sys/extattr.h
2393 pub const EXTATTR_NAMESPACE_EMPTY: ::c_int = 0;
2394 
2395 // For getrandom()
2396 pub const GRND_NONBLOCK: ::c_uint = 0x1;
2397 pub const GRND_RANDOM: ::c_uint = 0x2;
2398 pub const GRND_INSECURE: ::c_uint = 0x4;
2399 
2400 // sys/reboot.h
2401 pub const RB_ASKNAME: ::c_int = 0x000000001;
2402 pub const RB_SINGLE: ::c_int = 0x000000002;
2403 pub const RB_NOSYNC: ::c_int = 0x000000004;
2404 pub const RB_HALT: ::c_int = 0x000000008;
2405 pub const RB_INITNAME: ::c_int = 0x000000010;
2406 pub const RB_KDB: ::c_int = 0x000000040;
2407 pub const RB_RDONLY: ::c_int = 0x000000080;
2408 pub const RB_DUMP: ::c_int = 0x000000100;
2409 pub const RB_MINIROOT: ::c_int = 0x000000200;
2410 pub const RB_STRING: ::c_int = 0x000000400;
2411 pub const RB_POWERDOWN: ::c_int = RB_HALT | 0x000000800;
2412 pub const RB_USERCONF: ::c_int = 0x000001000;
2413 
2414 cfg_if! {
2415 
2416     if #[cfg(libc_const_extern_fn)] {
2417         pub const fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
2418             alignment << MAP_ALIGNMENT_SHIFT
2419         }
2420     } else {
2421         pub fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
2422             alignment << MAP_ALIGNMENT_SHIFT
2423         }
2424     }
2425 }
2426 
2427 // net/route.h
2428 pub const RTF_MASK: ::c_int = 0x80;
2429 pub const RTF_CONNECTED: ::c_int = 0x100;
2430 pub const RTF_ANNOUNCE: ::c_int = 0x20000;
2431 pub const RTF_SRC: ::c_int = 0x10000;
2432 pub const RTF_LOCAL: ::c_int = 0x40000;
2433 pub const RTF_BROADCAST: ::c_int = 0x80000;
2434 pub const RTF_UPDATING: ::c_int = 0x100000;
2435 pub const RTF_DONTCHANGEIFA: ::c_int = 0x200000;
2436 
2437 pub const RTM_VERSION: ::c_int = 4;
2438 pub const RTM_LOCK: ::c_int = 0x8;
2439 pub const RTM_IFANNOUNCE: ::c_int = 0x10;
2440 pub const RTM_IEEE80211: ::c_int = 0x11;
2441 pub const RTM_SETGATE: ::c_int = 0x12;
2442 pub const RTM_LLINFO_UPD: ::c_int = 0x13;
2443 pub const RTM_IFINFO: ::c_int = 0x14;
2444 pub const RTM_OCHGADDR: ::c_int = 0x15;
2445 pub const RTM_NEWADDR: ::c_int = 0x16;
2446 pub const RTM_DELADDR: ::c_int = 0x17;
2447 pub const RTM_CHGADDR: ::c_int = 0x18;
2448 
2449 pub const RTA_TAG: ::c_int = 0x100;
2450 
2451 pub const RTAX_TAG: ::c_int = 8;
2452 pub const RTAX_MAX: ::c_int = 9;
2453 
2454 const_fn! {
2455     {const} fn _ALIGN(p: usize) -> usize {
2456         (p + _ALIGNBYTES) & !_ALIGNBYTES
2457     }
2458 }
2459 
2460 f! {
2461     pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
2462         (cmsg as *mut ::c_uchar)
2463             .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
2464     }
2465 
2466     pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
2467         _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
2468     }
2469 
2470     pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
2471         -> *mut ::cmsghdr
2472     {
2473         if cmsg.is_null() {
2474             return ::CMSG_FIRSTHDR(mhdr);
2475         };
2476         let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
2477             + _ALIGN(::mem::size_of::<::cmsghdr>());
2478         let max = (*mhdr).msg_control as usize
2479             + (*mhdr).msg_controllen as usize;
2480         if next > max {
2481             0 as *mut ::cmsghdr
2482         } else {
2483             (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
2484                 as *mut ::cmsghdr
2485         }
2486     }
2487 
2488     pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
2489         (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
2490             as ::c_uint
2491     }
2492 
2493     // dirfd() is a macro on netbsd to access
2494     // the first field of the struct where dirp points to:
2495     // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
2496     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
2497         *(dirp as *const ::c_int)
2498     }
2499 
2500     pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
2501         let ngrps = if ngrps > 0 {
2502             ngrps - 1
2503         } else {
2504             0
2505         };
2506         ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
2507     }
2508 
2509     pub fn PROT_MPROTECT(x: ::c_int) -> ::c_int {
2510         x << 3
2511     }
2512 
2513     pub fn PROT_MPROTECT_EXTRACT(x: ::c_int) -> ::c_int {
2514         (x >> 3) & 0x7
2515     }
2516 
2517     pub fn major(dev: ::dev_t) -> ::c_int {
2518         (((dev as u32) & 0x000fff00) >>  8) as ::c_int
2519     }
2520 
2521     pub fn minor(dev: ::dev_t) -> ::c_int {
2522         let mut res = 0;
2523         res |= ((dev as u32) & 0xfff00000) >> 12;
2524         res |= (dev as u32) & 0x000000ff;
2525         res as ::c_int
2526     }
2527 }
2528 
2529 safe_f! {
2530     pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
2531         status >> 8
2532     }
2533 
2534     pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
2535         (status & 0o177) != 0o177 && (status & 0o177) != 0
2536     }
2537 
2538     pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
2539         (status & 0o177) == 0o177
2540     }
2541 
2542     pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
2543         status == 0xffff
2544     }
2545 
2546     pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
2547         let major = major as ::dev_t;
2548         let minor = minor as ::dev_t;
2549         let mut dev = 0;
2550         dev |= (major << 8) & 0x000ff00;
2551         dev |= (minor << 12) & 0xfff00000;
2552         dev |= minor & 0xff;
2553         dev
2554     }
2555 }
2556 
2557 extern "C" {
ntp_adjtime(buf: *mut timex) -> ::c_int2558     pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
ntp_gettime(buf: *mut ntptimeval) -> ::c_int2559     pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
clock_nanosleep( clk_id: ::clockid_t, flags: ::c_int, rqtp: *const ::timespec, rmtp: *mut ::timespec, ) -> ::c_int2560     pub fn clock_nanosleep(
2561         clk_id: ::clockid_t,
2562         flags: ::c_int,
2563         rqtp: *const ::timespec,
2564         rmtp: *mut ::timespec,
2565     ) -> ::c_int;
2566 
reallocarr(ptr: *mut ::c_void, number: ::size_t, size: ::size_t) -> ::c_int2567     pub fn reallocarr(ptr: *mut ::c_void, number: ::size_t, size: ::size_t) -> ::c_int;
2568 
chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int2569     pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int2570     pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int2571     pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
2572 
extattr_list_fd( fd: ::c_int, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t2573     pub fn extattr_list_fd(
2574         fd: ::c_int,
2575         attrnamespace: ::c_int,
2576         data: *mut ::c_void,
2577         nbytes: ::size_t,
2578     ) -> ::ssize_t;
extattr_list_file( path: *const ::c_char, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t2579     pub fn extattr_list_file(
2580         path: *const ::c_char,
2581         attrnamespace: ::c_int,
2582         data: *mut ::c_void,
2583         nbytes: ::size_t,
2584     ) -> ::ssize_t;
extattr_list_link( path: *const ::c_char, attrnamespace: ::c_int, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t2585     pub fn extattr_list_link(
2586         path: *const ::c_char,
2587         attrnamespace: ::c_int,
2588         data: *mut ::c_void,
2589         nbytes: ::size_t,
2590     ) -> ::ssize_t;
extattr_delete_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int2591     pub fn extattr_delete_fd(
2592         fd: ::c_int,
2593         attrnamespace: ::c_int,
2594         attrname: *const ::c_char,
2595     ) -> ::c_int;
extattr_delete_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int2596     pub fn extattr_delete_file(
2597         path: *const ::c_char,
2598         attrnamespace: ::c_int,
2599         attrname: *const ::c_char,
2600     ) -> ::c_int;
extattr_delete_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, ) -> ::c_int2601     pub fn extattr_delete_link(
2602         path: *const ::c_char,
2603         attrnamespace: ::c_int,
2604         attrname: *const ::c_char,
2605     ) -> ::c_int;
extattr_get_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t2606     pub fn extattr_get_fd(
2607         fd: ::c_int,
2608         attrnamespace: ::c_int,
2609         attrname: *const ::c_char,
2610         data: *mut ::c_void,
2611         nbytes: ::size_t,
2612     ) -> ::ssize_t;
extattr_get_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t2613     pub fn extattr_get_file(
2614         path: *const ::c_char,
2615         attrnamespace: ::c_int,
2616         attrname: *const ::c_char,
2617         data: *mut ::c_void,
2618         nbytes: ::size_t,
2619     ) -> ::ssize_t;
extattr_get_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *mut ::c_void, nbytes: ::size_t, ) -> ::ssize_t2620     pub fn extattr_get_link(
2621         path: *const ::c_char,
2622         attrnamespace: ::c_int,
2623         attrname: *const ::c_char,
2624         data: *mut ::c_void,
2625         nbytes: ::size_t,
2626     ) -> ::ssize_t;
extattr_namespace_to_string( attrnamespace: ::c_int, string: *mut *mut ::c_char, ) -> ::c_int2627     pub fn extattr_namespace_to_string(
2628         attrnamespace: ::c_int,
2629         string: *mut *mut ::c_char,
2630     ) -> ::c_int;
extattr_set_fd( fd: ::c_int, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int2631     pub fn extattr_set_fd(
2632         fd: ::c_int,
2633         attrnamespace: ::c_int,
2634         attrname: *const ::c_char,
2635         data: *const ::c_void,
2636         nbytes: ::size_t,
2637     ) -> ::c_int;
extattr_set_file( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int2638     pub fn extattr_set_file(
2639         path: *const ::c_char,
2640         attrnamespace: ::c_int,
2641         attrname: *const ::c_char,
2642         data: *const ::c_void,
2643         nbytes: ::size_t,
2644     ) -> ::c_int;
extattr_set_link( path: *const ::c_char, attrnamespace: ::c_int, attrname: *const ::c_char, data: *const ::c_void, nbytes: ::size_t, ) -> ::c_int2645     pub fn extattr_set_link(
2646         path: *const ::c_char,
2647         attrnamespace: ::c_int,
2648         attrname: *const ::c_char,
2649         data: *const ::c_void,
2650         nbytes: ::size_t,
2651     ) -> ::c_int;
extattr_string_to_namespace( string: *const ::c_char, attrnamespace: *mut ::c_int, ) -> ::c_int2652     pub fn extattr_string_to_namespace(
2653         string: *const ::c_char,
2654         attrnamespace: *mut ::c_int,
2655     ) -> ::c_int;
2656 
openpty( amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, termp: *mut ::termios, winp: *mut ::winsize, ) -> ::c_int2657     pub fn openpty(
2658         amaster: *mut ::c_int,
2659         aslave: *mut ::c_int,
2660         name: *mut ::c_char,
2661         termp: *mut ::termios,
2662         winp: *mut ::winsize,
2663     ) -> ::c_int;
forkpty( amaster: *mut ::c_int, name: *mut ::c_char, termp: *mut ::termios, winp: *mut ::winsize, ) -> ::pid_t2664     pub fn forkpty(
2665         amaster: *mut ::c_int,
2666         name: *mut ::c_char,
2667         termp: *mut ::termios,
2668         winp: *mut ::winsize,
2669     ) -> ::pid_t;
2670 
2671     #[link_name = "__lutimes50"]
lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int2672     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
2673     #[link_name = "__gettimeofday50"]
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int2674     pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
getnameinfo( sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int2675     pub fn getnameinfo(
2676         sa: *const ::sockaddr,
2677         salen: ::socklen_t,
2678         host: *mut ::c_char,
2679         hostlen: ::socklen_t,
2680         serv: *mut ::c_char,
2681         servlen: ::socklen_t,
2682         flags: ::c_int,
2683     ) -> ::c_int;
mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int2684     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
sysctl( name: *const ::c_int, namelen: ::c_uint, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *const ::c_void, newlen: ::size_t, ) -> ::c_int2685     pub fn sysctl(
2686         name: *const ::c_int,
2687         namelen: ::c_uint,
2688         oldp: *mut ::c_void,
2689         oldlenp: *mut ::size_t,
2690         newp: *const ::c_void,
2691         newlen: ::size_t,
2692     ) -> ::c_int;
sysctlbyname( name: *const ::c_char, oldp: *mut ::c_void, oldlenp: *mut ::size_t, newp: *const ::c_void, newlen: ::size_t, ) -> ::c_int2693     pub fn sysctlbyname(
2694         name: *const ::c_char,
2695         oldp: *mut ::c_void,
2696         oldlenp: *mut ::size_t,
2697         newp: *const ::c_void,
2698         newlen: ::size_t,
2699     ) -> ::c_int;
sysctlnametomib( sname: *const ::c_char, name: *mut ::c_int, namelenp: *mut ::size_t, ) -> ::c_int2700     pub fn sysctlnametomib(
2701         sname: *const ::c_char,
2702         name: *mut ::c_int,
2703         namelenp: *mut ::size_t,
2704     ) -> ::c_int;
2705     #[link_name = "__kevent50"]
kevent( kq: ::c_int, changelist: *const ::kevent, nchanges: ::size_t, eventlist: *mut ::kevent, nevents: ::size_t, timeout: *const ::timespec, ) -> ::c_int2706     pub fn kevent(
2707         kq: ::c_int,
2708         changelist: *const ::kevent,
2709         nchanges: ::size_t,
2710         eventlist: *mut ::kevent,
2711         nevents: ::size_t,
2712         timeout: *const ::timespec,
2713     ) -> ::c_int;
2714     #[link_name = "__mount50"]
mount( src: *const ::c_char, target: *const ::c_char, flags: ::c_int, data: *mut ::c_void, size: ::size_t, ) -> ::c_int2715     pub fn mount(
2716         src: *const ::c_char,
2717         target: *const ::c_char,
2718         flags: ::c_int,
2719         data: *mut ::c_void,
2720         size: ::size_t,
2721     ) -> ::c_int;
mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t2722     pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
mq_close(mqd: ::mqd_t) -> ::c_int2723     pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int2724     pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int2725     pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int;
mq_receive( mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msg_prio: *mut ::c_uint, ) -> ::ssize_t2726     pub fn mq_receive(
2727         mqd: ::mqd_t,
2728         msg_ptr: *mut ::c_char,
2729         msg_len: ::size_t,
2730         msg_prio: *mut ::c_uint,
2731     ) -> ::ssize_t;
mq_send( mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msg_prio: ::c_uint, ) -> ::c_int2732     pub fn mq_send(
2733         mqd: ::mqd_t,
2734         msg_ptr: *const ::c_char,
2735         msg_len: ::size_t,
2736         msg_prio: ::c_uint,
2737     ) -> ::c_int;
mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int2738     pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
2739     #[link_name = "__mq_timedreceive50"]
mq_timedreceive( mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msg_prio: *mut ::c_uint, abs_timeout: *const ::timespec, ) -> ::ssize_t2740     pub fn mq_timedreceive(
2741         mqd: ::mqd_t,
2742         msg_ptr: *mut ::c_char,
2743         msg_len: ::size_t,
2744         msg_prio: *mut ::c_uint,
2745         abs_timeout: *const ::timespec,
2746     ) -> ::ssize_t;
2747     #[link_name = "__mq_timedsend50"]
mq_timedsend( mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msg_prio: ::c_uint, abs_timeout: *const ::timespec, ) -> ::c_int2748     pub fn mq_timedsend(
2749         mqd: ::mqd_t,
2750         msg_ptr: *const ::c_char,
2751         msg_len: ::size_t,
2752         msg_prio: ::c_uint,
2753         abs_timeout: *const ::timespec,
2754     ) -> ::c_int;
mq_unlink(name: *const ::c_char) -> ::c_int2755     pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_void, data: ::c_int) -> ::c_int2756     pub fn ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_void, data: ::c_int) -> ::c_int;
utrace(label: *const ::c_char, addr: *mut ::c_void, len: ::size_t) -> ::c_int2757     pub fn utrace(label: *const ::c_char, addr: *mut ::c_void, len: ::size_t) -> ::c_int;
pthread_getname_np(t: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int2758     pub fn pthread_getname_np(t: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
pthread_setname_np( t: ::pthread_t, name: *const ::c_char, arg: *const ::c_void, ) -> ::c_int2759     pub fn pthread_setname_np(
2760         t: ::pthread_t,
2761         name: *const ::c_char,
2762         arg: *const ::c_void,
2763     ) -> ::c_int;
pthread_attr_get_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int2764     pub fn pthread_attr_get_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int2765     pub fn pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_getguardsize( attr: *const ::pthread_attr_t, guardsize: *mut ::size_t, ) -> ::c_int2766     pub fn pthread_attr_getguardsize(
2767         attr: *const ::pthread_attr_t,
2768         guardsize: *mut ::size_t,
2769     ) -> ::c_int;
pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int2770     pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pthread_attr_getstack( attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t, ) -> ::c_int2771     pub fn pthread_attr_getstack(
2772         attr: *const ::pthread_attr_t,
2773         stackaddr: *mut *mut ::c_void,
2774         stacksize: *mut ::size_t,
2775     ) -> ::c_int;
pthread_getaffinity_np( thread: ::pthread_t, size: ::size_t, set: *mut cpuset_t, ) -> ::c_int2776     pub fn pthread_getaffinity_np(
2777         thread: ::pthread_t,
2778         size: ::size_t,
2779         set: *mut cpuset_t,
2780     ) -> ::c_int;
pthread_setaffinity_np( thread: ::pthread_t, size: ::size_t, set: *mut cpuset_t, ) -> ::c_int2781     pub fn pthread_setaffinity_np(
2782         thread: ::pthread_t,
2783         size: ::size_t,
2784         set: *mut cpuset_t,
2785     ) -> ::c_int;
2786 
_cpuset_create() -> *mut cpuset_t2787     pub fn _cpuset_create() -> *mut cpuset_t;
_cpuset_destroy(set: *mut cpuset_t)2788     pub fn _cpuset_destroy(set: *mut cpuset_t);
_cpuset_clr(cpu: cpuid_t, set: *mut cpuset_t) -> ::c_int2789     pub fn _cpuset_clr(cpu: cpuid_t, set: *mut cpuset_t) -> ::c_int;
_cpuset_set(cpu: cpuid_t, set: *mut cpuset_t) -> ::c_int2790     pub fn _cpuset_set(cpu: cpuid_t, set: *mut cpuset_t) -> ::c_int;
_cpuset_isset(cpu: cpuid_t, set: *const cpuset_t) -> ::c_int2791     pub fn _cpuset_isset(cpu: cpuid_t, set: *const cpuset_t) -> ::c_int;
_cpuset_size(set: *const cpuset_t) -> ::size_t2792     pub fn _cpuset_size(set: *const cpuset_t) -> ::size_t;
_cpuset_zero(set: *mut cpuset_t)2793     pub fn _cpuset_zero(set: *mut cpuset_t);
2794     #[link_name = "__sigtimedwait50"]
sigtimedwait( set: *const sigset_t, info: *mut siginfo_t, timeout: *const ::timespec, ) -> ::c_int2795     pub fn sigtimedwait(
2796         set: *const sigset_t,
2797         info: *mut siginfo_t,
2798         timeout: *const ::timespec,
2799     ) -> ::c_int;
sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int2800     pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
2801 
duplocale(base: ::locale_t) -> ::locale_t2802     pub fn duplocale(base: ::locale_t) -> ::locale_t;
freelocale(loc: ::locale_t)2803     pub fn freelocale(loc: ::locale_t);
localeconv_l(loc: ::locale_t) -> *mut lconv2804     pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t2805     pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
2806     #[link_name = "__settimeofday50"]
settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int2807     pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
2808 
dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int2809     pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
2810 
kqueue1(flags: ::c_int) -> ::c_int2811     pub fn kqueue1(flags: ::c_int) -> ::c_int;
2812 
_lwp_self() -> lwpid_t2813     pub fn _lwp_self() -> lwpid_t;
memmem( haystack: *const ::c_void, haystacklen: ::size_t, needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void2814     pub fn memmem(
2815         haystack: *const ::c_void,
2816         haystacklen: ::size_t,
2817         needle: *const ::c_void,
2818         needlelen: ::size_t,
2819     ) -> *mut ::c_void;
2820 
2821     // link.h
2822 
dl_iterate_phdr( callback: ::Option< unsafe extern "C" fn( info: *mut dl_phdr_info, size: usize, data: *mut ::c_void, ) -> ::c_int, >, data: *mut ::c_void, ) -> ::c_int2823     pub fn dl_iterate_phdr(
2824         callback: ::Option<
2825             unsafe extern "C" fn(
2826                 info: *mut dl_phdr_info,
2827                 size: usize,
2828                 data: *mut ::c_void,
2829             ) -> ::c_int,
2830         >,
2831         data: *mut ::c_void,
2832     ) -> ::c_int;
2833 
2834     // dlfcn.h
2835 
_dlauxinfo() -> *mut ::c_void2836     pub fn _dlauxinfo() -> *mut ::c_void;
2837 
iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t2838     pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
iconv( cd: iconv_t, inbuf: *mut *mut ::c_char, inbytesleft: *mut ::size_t, outbuf: *mut *mut ::c_char, outbytesleft: *mut ::size_t, ) -> ::size_t2839     pub fn iconv(
2840         cd: iconv_t,
2841         inbuf: *mut *mut ::c_char,
2842         inbytesleft: *mut ::size_t,
2843         outbuf: *mut *mut ::c_char,
2844         outbytesleft: *mut ::size_t,
2845     ) -> ::size_t;
iconv_close(cd: iconv_t) -> ::c_int2846     pub fn iconv_close(cd: iconv_t) -> ::c_int;
2847 
timer_create( clockid: ::clockid_t, sevp: *mut ::sigevent, timerid: *mut ::timer_t, ) -> ::c_int2848     pub fn timer_create(
2849         clockid: ::clockid_t,
2850         sevp: *mut ::sigevent,
2851         timerid: *mut ::timer_t,
2852     ) -> ::c_int;
timer_delete(timerid: ::timer_t) -> ::c_int2853     pub fn timer_delete(timerid: ::timer_t) -> ::c_int;
timer_getoverrun(timerid: ::timer_t) -> ::c_int2854     pub fn timer_getoverrun(timerid: ::timer_t) -> ::c_int;
timer_gettime(timerid: ::timer_t, curr_value: *mut ::itimerspec) -> ::c_int2855     pub fn timer_gettime(timerid: ::timer_t, curr_value: *mut ::itimerspec) -> ::c_int;
timer_settime( timerid: ::timer_t, flags: ::c_int, new_value: *const ::itimerspec, old_value: *mut ::itimerspec, ) -> ::c_int2856     pub fn timer_settime(
2857         timerid: ::timer_t,
2858         flags: ::c_int,
2859         new_value: *const ::itimerspec,
2860         old_value: *mut ::itimerspec,
2861     ) -> ::c_int;
2862 
2863     // Added in `NetBSD` 7.0
explicit_memset(b: *mut ::c_void, c: ::c_int, len: ::size_t)2864     pub fn explicit_memset(b: *mut ::c_void, c: ::c_int, len: ::size_t);
consttime_memequal(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int2865     pub fn consttime_memequal(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
2866 
setproctitle(fmt: *const ::c_char, ...)2867     pub fn setproctitle(fmt: *const ::c_char, ...);
mremap( oldp: *mut ::c_void, oldsize: ::size_t, newp: *mut ::c_void, newsize: ::size_t, flags: ::c_int, ) -> *mut ::c_void2868     pub fn mremap(
2869         oldp: *mut ::c_void,
2870         oldsize: ::size_t,
2871         newp: *mut ::c_void,
2872         newsize: ::size_t,
2873         flags: ::c_int,
2874     ) -> *mut ::c_void;
2875 
sched_rr_get_interval(pid: ::pid_t, t: *mut ::timespec) -> ::c_int2876     pub fn sched_rr_get_interval(pid: ::pid_t, t: *mut ::timespec) -> ::c_int;
sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int2877     pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int2878     pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
sched_getscheduler(pid: ::pid_t) -> ::c_int2879     pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
sched_setscheduler( pid: ::pid_t, policy: ::c_int, param: *const ::sched_param, ) -> ::c_int2880     pub fn sched_setscheduler(
2881         pid: ::pid_t,
2882         policy: ::c_int,
2883         param: *const ::sched_param,
2884     ) -> ::c_int;
2885 
2886     #[link_name = "__pollts50"]
pollts( fds: *mut ::pollfd, nfds: ::nfds_t, ts: *const ::timespec, sigmask: *const ::sigset_t, ) -> ::c_int2887     pub fn pollts(
2888         fds: *mut ::pollfd,
2889         nfds: ::nfds_t,
2890         ts: *const ::timespec,
2891         sigmask: *const ::sigset_t,
2892     ) -> ::c_int;
ppoll( fds: *mut ::pollfd, nfds: ::nfds_t, ts: *const ::timespec, sigmask: *const ::sigset_t, ) -> ::c_int2893     pub fn ppoll(
2894         fds: *mut ::pollfd,
2895         nfds: ::nfds_t,
2896         ts: *const ::timespec,
2897         sigmask: *const ::sigset_t,
2898     ) -> ::c_int;
getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t2899     pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
2900 
reboot(mode: ::c_int, bootstr: *mut ::c_char) -> ::c_int2901     pub fn reboot(mode: ::c_int, bootstr: *mut ::c_char) -> ::c_int;
2902 
2903     #[link_name = "___lwp_park60"]
_lwp_park( clock: ::clockid_t, flags: ::c_int, ts: *const ::timespec, unpark: ::lwpid_t, hint: *const ::c_void, unparkhint: *mut ::c_void, ) -> ::c_int2904     pub fn _lwp_park(
2905         clock: ::clockid_t,
2906         flags: ::c_int,
2907         ts: *const ::timespec,
2908         unpark: ::lwpid_t,
2909         hint: *const ::c_void,
2910         unparkhint: *mut ::c_void,
2911     ) -> ::c_int;
_lwp_unpark(lwp: ::lwpid_t, hint: *const ::c_void) -> ::c_int2912     pub fn _lwp_unpark(lwp: ::lwpid_t, hint: *const ::c_void) -> ::c_int;
_lwp_unpark_all( targets: *const ::lwpid_t, ntargets: ::size_t, hint: *const ::c_void, ) -> ::c_int2913     pub fn _lwp_unpark_all(
2914         targets: *const ::lwpid_t,
2915         ntargets: ::size_t,
2916         hint: *const ::c_void,
2917     ) -> ::c_int;
2918 }
2919 
2920 #[link(name = "rt")]
2921 extern "C" {
aio_read(aiocbp: *mut aiocb) -> ::c_int2922     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
aio_write(aiocbp: *mut aiocb) -> ::c_int2923     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int2924     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
aio_error(aiocbp: *const aiocb) -> ::c_int2925     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
aio_return(aiocbp: *mut aiocb) -> ::ssize_t2926     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
2927     #[link_name = "__aio_suspend50"]
aio_suspend( aiocb_list: *const *const aiocb, nitems: ::c_int, timeout: *const ::timespec, ) -> ::c_int2928     pub fn aio_suspend(
2929         aiocb_list: *const *const aiocb,
2930         nitems: ::c_int,
2931         timeout: *const ::timespec,
2932     ) -> ::c_int;
aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int2933     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
lio_listio( mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent, ) -> ::c_int2934     pub fn lio_listio(
2935         mode: ::c_int,
2936         aiocb_list: *const *mut aiocb,
2937         nitems: ::c_int,
2938         sevp: *mut sigevent,
2939     ) -> ::c_int;
2940 }
2941 
2942 #[link(name = "util")]
2943 extern "C" {
2944     #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
getpwent_r( pwd: *mut ::passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::passwd, ) -> ::c_int2945     pub fn getpwent_r(
2946         pwd: *mut ::passwd,
2947         buf: *mut ::c_char,
2948         buflen: ::size_t,
2949         result: *mut *mut ::passwd,
2950     ) -> ::c_int;
getgrent_r( grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int2951     pub fn getgrent_r(
2952         grp: *mut ::group,
2953         buf: *mut ::c_char,
2954         buflen: ::size_t,
2955         result: *mut *mut ::group,
2956     ) -> ::c_int;
2957 
updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int2958     pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int;
getlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> *mut lastlogx2959     pub fn getlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> *mut lastlogx;
updlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> ::c_int2960     pub fn updlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> ::c_int;
utmpxname(file: *const ::c_char) -> ::c_int2961     pub fn utmpxname(file: *const ::c_char) -> ::c_int;
getutxent() -> *mut utmpx2962     pub fn getutxent() -> *mut utmpx;
getutxid(ut: *const utmpx) -> *mut utmpx2963     pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
getutxline(ut: *const utmpx) -> *mut utmpx2964     pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pututxline(ut: *const utmpx) -> *mut utmpx2965     pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
setutxent()2966     pub fn setutxent();
endutxent()2967     pub fn endutxent();
2968 
getutmp(ux: *const utmpx, u: *mut utmp)2969     pub fn getutmp(ux: *const utmpx, u: *mut utmp);
getutmpx(u: *const utmp, ux: *mut utmpx)2970     pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
2971 
utpname(file: *const ::c_char) -> ::c_int2972     pub fn utpname(file: *const ::c_char) -> ::c_int;
setutent()2973     pub fn setutent();
endutent()2974     pub fn endutent();
getutent() -> *mut utmp2975     pub fn getutent() -> *mut utmp;
2976 
efopen(p: *const ::c_char, m: *const ::c_char) -> ::FILE2977     pub fn efopen(p: *const ::c_char, m: *const ::c_char) -> ::FILE;
emalloc(n: ::size_t) -> *mut ::c_void2978     pub fn emalloc(n: ::size_t) -> *mut ::c_void;
ecalloc(n: ::size_t, c: ::size_t) -> *mut ::c_void2979     pub fn ecalloc(n: ::size_t, c: ::size_t) -> *mut ::c_void;
erealloc(p: *mut ::c_void, n: ::size_t) -> *mut ::c_void2980     pub fn erealloc(p: *mut ::c_void, n: ::size_t) -> *mut ::c_void;
ereallocarr(p: *mut ::c_void, n: ::size_t, s: ::size_t)2981     pub fn ereallocarr(p: *mut ::c_void, n: ::size_t, s: ::size_t);
estrdup(s: *const ::c_char) -> *mut ::c_char2982     pub fn estrdup(s: *const ::c_char) -> *mut ::c_char;
estrndup(s: *const ::c_char, len: ::size_t) -> *mut ::c_char2983     pub fn estrndup(s: *const ::c_char, len: ::size_t) -> *mut ::c_char;
estrlcpy(dst: *mut ::c_char, src: *const ::c_char, len: ::size_t) -> ::size_t2984     pub fn estrlcpy(dst: *mut ::c_char, src: *const ::c_char, len: ::size_t) -> ::size_t;
estrlcat(dst: *mut ::c_char, src: *const ::c_char, len: ::size_t) -> ::size_t2985     pub fn estrlcat(dst: *mut ::c_char, src: *const ::c_char, len: ::size_t) -> ::size_t;
estrtoi( nptr: *const ::c_char, base: ::c_int, lo: ::intmax_t, hi: ::intmax_t, ) -> ::intmax_t2986     pub fn estrtoi(
2987         nptr: *const ::c_char,
2988         base: ::c_int,
2989         lo: ::intmax_t,
2990         hi: ::intmax_t,
2991     ) -> ::intmax_t;
estrtou( nptr: *const ::c_char, base: ::c_int, lo: ::uintmax_t, hi: ::uintmax_t, ) -> ::uintmax_t2992     pub fn estrtou(
2993         nptr: *const ::c_char,
2994         base: ::c_int,
2995         lo: ::uintmax_t,
2996         hi: ::uintmax_t,
2997     ) -> ::uintmax_t;
easprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int2998     pub fn easprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int;
evasprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int2999     pub fn evasprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int;
esetfunc( cb: ::Option<unsafe extern "C" fn(::c_int, *const ::c_char, ...)>, ) -> ::Option<unsafe extern "C" fn(::c_int, *const ::c_char, ...)>3000     pub fn esetfunc(
3001         cb: ::Option<unsafe extern "C" fn(::c_int, *const ::c_char, ...)>,
3002     ) -> ::Option<unsafe extern "C" fn(::c_int, *const ::c_char, ...)>;
secure_path(path: *const ::c_char) -> ::c_int3003     pub fn secure_path(path: *const ::c_char) -> ::c_int;
snprintb( buf: *mut ::c_char, buflen: ::size_t, fmt: *const ::c_char, val: u64, ) -> ::c_int3004     pub fn snprintb(
3005         buf: *mut ::c_char,
3006         buflen: ::size_t,
3007         fmt: *const ::c_char,
3008         val: u64,
3009     ) -> ::c_int;
snprintb_m( buf: *mut ::c_char, buflen: ::size_t, fmt: *const ::c_char, val: u64, max: ::size_t, ) -> ::c_int3010     pub fn snprintb_m(
3011         buf: *mut ::c_char,
3012         buflen: ::size_t,
3013         fmt: *const ::c_char,
3014         val: u64,
3015         max: ::size_t,
3016     ) -> ::c_int;
3017 
getbootfile() -> *const ::c_char3018     pub fn getbootfile() -> *const ::c_char;
getbyteorder() -> ::c_int3019     pub fn getbyteorder() -> ::c_int;
getdiskrawname( buf: *mut ::c_char, buflen: ::size_t, name: *const ::c_char, ) -> *const ::c_char3020     pub fn getdiskrawname(
3021         buf: *mut ::c_char,
3022         buflen: ::size_t,
3023         name: *const ::c_char,
3024     ) -> *const ::c_char;
getdiskcookedname( buf: *mut ::c_char, buflen: ::size_t, name: *const ::c_char, ) -> *const ::c_char3025     pub fn getdiskcookedname(
3026         buf: *mut ::c_char,
3027         buflen: ::size_t,
3028         name: *const ::c_char,
3029     ) -> *const ::c_char;
getfsspecname( buf: *mut ::c_char, buflen: ::size_t, spec: *const ::c_char, ) -> *const ::c_char3030     pub fn getfsspecname(
3031         buf: *mut ::c_char,
3032         buflen: ::size_t,
3033         spec: *const ::c_char,
3034     ) -> *const ::c_char;
3035 
strpct( buf: *mut ::c_char, bufsiz: ::size_t, numerator: ::uintmax_t, denominator: ::uintmax_t, precision: ::size_t, ) -> *mut ::c_char3036     pub fn strpct(
3037         buf: *mut ::c_char,
3038         bufsiz: ::size_t,
3039         numerator: ::uintmax_t,
3040         denominator: ::uintmax_t,
3041         precision: ::size_t,
3042     ) -> *mut ::c_char;
strspct( buf: *mut ::c_char, bufsiz: ::size_t, numerator: ::intmax_t, denominator: ::intmax_t, precision: ::size_t, ) -> *mut ::c_char3043     pub fn strspct(
3044         buf: *mut ::c_char,
3045         bufsiz: ::size_t,
3046         numerator: ::intmax_t,
3047         denominator: ::intmax_t,
3048         precision: ::size_t,
3049     ) -> *mut ::c_char;
3050     #[link_name = "__login50"]
login(ut: *const utmp)3051     pub fn login(ut: *const utmp);
3052     #[link_name = "__loginx50"]
loginx(ut: *const utmpx)3053     pub fn loginx(ut: *const utmpx);
logout(line: *const ::c_char)3054     pub fn logout(line: *const ::c_char);
logoutx(line: *const ::c_char, status: ::c_int, tpe: ::c_int)3055     pub fn logoutx(line: *const ::c_char, status: ::c_int, tpe: ::c_int);
logwtmp(line: *const ::c_char, name: *const ::c_char, host: *const ::c_char)3056     pub fn logwtmp(line: *const ::c_char, name: *const ::c_char, host: *const ::c_char);
logwtmpx( line: *const ::c_char, name: *const ::c_char, host: *const ::c_char, status: ::c_int, tpe: ::c_int, )3057     pub fn logwtmpx(
3058         line: *const ::c_char,
3059         name: *const ::c_char,
3060         host: *const ::c_char,
3061         status: ::c_int,
3062         tpe: ::c_int,
3063     );
3064 
getxattr( path: *const ::c_char, name: *const ::c_char, value: *mut ::c_void, size: ::size_t, ) -> ::ssize_t3065     pub fn getxattr(
3066         path: *const ::c_char,
3067         name: *const ::c_char,
3068         value: *mut ::c_void,
3069         size: ::size_t,
3070     ) -> ::ssize_t;
lgetxattr( path: *const ::c_char, name: *const ::c_char, value: *mut ::c_void, size: ::size_t, ) -> ::ssize_t3071     pub fn lgetxattr(
3072         path: *const ::c_char,
3073         name: *const ::c_char,
3074         value: *mut ::c_void,
3075         size: ::size_t,
3076     ) -> ::ssize_t;
fgetxattr( filedes: ::c_int, name: *const ::c_char, value: *mut ::c_void, size: ::size_t, ) -> ::ssize_t3077     pub fn fgetxattr(
3078         filedes: ::c_int,
3079         name: *const ::c_char,
3080         value: *mut ::c_void,
3081         size: ::size_t,
3082     ) -> ::ssize_t;
setxattr( path: *const ::c_char, name: *const ::c_char, value: *const ::c_void, size: ::size_t, ) -> ::c_int3083     pub fn setxattr(
3084         path: *const ::c_char,
3085         name: *const ::c_char,
3086         value: *const ::c_void,
3087         size: ::size_t,
3088     ) -> ::c_int;
lsetxattr( path: *const ::c_char, name: *const ::c_char, value: *const ::c_void, size: ::size_t, ) -> ::c_int3089     pub fn lsetxattr(
3090         path: *const ::c_char,
3091         name: *const ::c_char,
3092         value: *const ::c_void,
3093         size: ::size_t,
3094     ) -> ::c_int;
fsetxattr( filedes: ::c_int, name: *const ::c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int, ) -> ::c_int3095     pub fn fsetxattr(
3096         filedes: ::c_int,
3097         name: *const ::c_char,
3098         value: *const ::c_void,
3099         size: ::size_t,
3100         flags: ::c_int,
3101     ) -> ::c_int;
listxattr(path: *const ::c_char, list: *mut ::c_char, size: ::size_t) -> ::ssize_t3102     pub fn listxattr(path: *const ::c_char, list: *mut ::c_char, size: ::size_t) -> ::ssize_t;
llistxattr(path: *const ::c_char, list: *mut ::c_char, size: ::size_t) -> ::ssize_t3103     pub fn llistxattr(path: *const ::c_char, list: *mut ::c_char, size: ::size_t) -> ::ssize_t;
flistxattr(filedes: ::c_int, list: *mut ::c_char, size: ::size_t) -> ::ssize_t3104     pub fn flistxattr(filedes: ::c_int, list: *mut ::c_char, size: ::size_t) -> ::ssize_t;
removexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int3105     pub fn removexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int;
lremovexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int3106     pub fn lremovexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int;
fremovexattr(fd: ::c_int, path: *const ::c_char, name: *const ::c_char) -> ::c_int3107     pub fn fremovexattr(fd: ::c_int, path: *const ::c_char, name: *const ::c_char) -> ::c_int;
3108 
string_to_flags( string_p: *mut *mut ::c_char, setp: *mut ::c_ulong, clrp: *mut ::c_ulong, ) -> ::c_int3109     pub fn string_to_flags(
3110         string_p: *mut *mut ::c_char,
3111         setp: *mut ::c_ulong,
3112         clrp: *mut ::c_ulong,
3113     ) -> ::c_int;
flags_to_string(flags: ::c_ulong, def: *const ::c_char) -> ::c_int3114     pub fn flags_to_string(flags: ::c_ulong, def: *const ::c_char) -> ::c_int;
3115 
kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry3116     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
3117 }
3118 
3119 #[link(name = "execinfo")]
3120 extern "C" {
backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t3121     pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char3122     pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
backtrace_symbols_fd( addrlist: *const *mut ::c_void, len: ::size_t, fd: ::c_int, ) -> ::c_int3123     pub fn backtrace_symbols_fd(
3124         addrlist: *const *mut ::c_void,
3125         len: ::size_t,
3126         fd: ::c_int,
3127     ) -> ::c_int;
backtrace_symbols_fmt( addrlist: *const *mut ::c_void, len: ::size_t, fmt: *const ::c_char, ) -> *mut *mut ::c_char3128     pub fn backtrace_symbols_fmt(
3129         addrlist: *const *mut ::c_void,
3130         len: ::size_t,
3131         fmt: *const ::c_char,
3132     ) -> *mut *mut ::c_char;
backtrace_symbols_fd_fmt( addrlist: *const *mut ::c_void, len: ::size_t, fd: ::c_int, fmt: *const ::c_char, ) -> ::c_int3133     pub fn backtrace_symbols_fd_fmt(
3134         addrlist: *const *mut ::c_void,
3135         len: ::size_t,
3136         fd: ::c_int,
3137         fmt: *const ::c_char,
3138     ) -> ::c_int;
3139 }
3140 
3141 cfg_if! {
3142     if #[cfg(libc_union)] {
3143         extern {
3144             // these functions use statvfs:
3145             pub fn getmntinfo(mntbufp: *mut *mut ::statvfs, flags: ::c_int) -> ::c_int;
3146             pub fn getvfsstat(buf: *mut statvfs, bufsize: ::size_t, flags: ::c_int) -> ::c_int;
3147         }
3148     }
3149 }
3150 
3151 cfg_if! {
3152     if #[cfg(target_arch = "aarch64")] {
3153         mod aarch64;
3154         pub use self::aarch64::*;
3155     } else if #[cfg(target_arch = "arm")] {
3156         mod arm;
3157         pub use self::arm::*;
3158     } else if #[cfg(target_arch = "powerpc")] {
3159         mod powerpc;
3160         pub use self::powerpc::*;
3161     } else if #[cfg(target_arch = "sparc64")] {
3162         mod sparc64;
3163         pub use self::sparc64::*;
3164     } else if #[cfg(target_arch = "x86_64")] {
3165         mod x86_64;
3166         pub use self::x86_64::*;
3167     } else if #[cfg(target_arch = "x86")] {
3168         mod x86;
3169         pub use self::x86::*;
3170     } else if #[cfg(target_arch = "mips")] {
3171         mod mips;
3172         pub use self::mips::*;
3173     } else if #[cfg(target_arch = "riscv64")] {
3174         mod riscv64;
3175         pub use self::riscv64::*;
3176     } else {
3177         // Unknown target_arch
3178     }
3179 }
3180