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