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