Debian Codegraph @

third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs

raw
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 {
62 pub unsafe fn si_addr(&self) -> *mut c_void {
63 self.si_addr
64 }
65
66 pub unsafe fn si_code(&self) -> c_int {
67 self.si_code
68 }
69
70 pub unsafe fn si_errno(&self) -> c_int {
71 self.si_errno
72 }
73
74 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
86 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
99 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
113 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 fmt::Debug for utmpx {
944 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
945 f.debug_struct("utmpx")
946 .field("ut_name", &self.ut_name)
947 .field("ut_id", &self.ut_id)
948 .field("ut_line", &self.ut_line)
949 // FIXME(debug) .field("ut_host", &self.ut_host)
950 .field("ut_session", &self.ut_session)
951 .field("ut_type", &self.ut_type)
952 .field("ut_pid", &self.ut_pid)
953 .field("ut_exit", &self.ut_exit)
954 .field("ut_ss", &self.ut_ss)
955 .field("ut_tv", &self.ut_tv)
956 // FIXME(debug) .field("ut_pad", &self.ut_pad)
957 .finish()
958 }
959 }
960
961 impl hash::Hash for utmpx {
962 fn hash<H: hash::Hasher>(&self, state: &mut H) {
963 self.ut_name.hash(state);
964 self.ut_type.hash(state);
965 self.ut_pid.hash(state);
966 self.ut_line.hash(state);
967 self.ut_id.hash(state);
968 self.ut_host.hash(state);
969 self.ut_exit.hash(state);
970 self.ut_session.hash(state);
971 self.ut_tv.hash(state);
972 self.ut_ss.hash(state);
973 self.ut_pad.hash(state);
974 }
975 }
976
977 impl PartialEq for lastlogx {
978 fn eq(&self, other: &lastlogx) -> bool {
979 self.ll_tv == other.ll_tv
980 && self.ll_line == other.ll_line
981 && self.ll_ss == other.ll_ss
982 && self
983 .ll_host
984 .iter()
985 .zip(other.ll_host.iter())
986 .all(|(a, b)| a == b)
987 }
988 }
989
990 impl Eq for lastlogx {}
991
992 impl fmt::Debug for lastlogx {
993 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
994 f.debug_struct("lastlogx")
995 .field("ll_tv", &self.ll_tv)
996 .field("ll_line", &self.ll_line)
997 // FIXME(debug).field("ll_host", &self.ll_host)
998 .field("ll_ss", &self.ll_ss)
999 .finish()
1000 }
1001 }
1002
1003 impl hash::Hash for lastlogx {
1004 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1005 self.ll_tv.hash(state);
1006 self.ll_line.hash(state);
1007 self.ll_host.hash(state);
1008 self.ll_ss.hash(state);
1009 }
1010 }
1011
1012 impl PartialEq for in_pktinfo {
1013 fn eq(&self, other: &in_pktinfo) -> bool {
1014 self.ipi_addr == other.ipi_addr && self.ipi_ifindex == other.ipi_ifindex
1015 }
1016 }
1017 impl Eq for in_pktinfo {}
1018 impl fmt::Debug for in_pktinfo {
1019 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1020 f.debug_struct("in_pktinfo")
1021 .field("ipi_addr", &self.ipi_addr)
1022 .field("ipi_ifindex", &self.ipi_ifindex)
1023 .finish()
1024 }
1025 }
1026 impl hash::Hash for in_pktinfo {
1027 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1028 self.ipi_addr.hash(state);
1029 self.ipi_ifindex.hash(state);
1030 }
1031 }
1032
1033 impl PartialEq for arphdr {
1034 fn eq(&self, other: &arphdr) -> bool {
1035 self.ar_hrd == other.ar_hrd
1036 && self.ar_pro == other.ar_pro
1037 && self.ar_hln == other.ar_hln
1038 && self.ar_pln == other.ar_pln
1039 && self.ar_op == other.ar_op
1040 }
1041 }
1042 impl Eq for arphdr {}
1043 impl fmt::Debug for arphdr {
1044 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1045 let ar_hrd = self.ar_hrd;
1046 let ar_pro = self.ar_pro;
1047 let ar_op = self.ar_op;
1048 f.debug_struct("arphdr")
1049 .field("ar_hrd", &ar_hrd)
1050 .field("ar_pro", &ar_pro)
1051 .field("ar_hln", &self.ar_hln)
1052 .field("ar_pln", &self.ar_pln)
1053 .field("ar_op", &ar_op)
1054 .finish()
1055 }
1056 }
1057 impl hash::Hash for arphdr {
1058 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1059 let ar_hrd = self.ar_hrd;
1060 let ar_pro = self.ar_pro;
1061 let ar_op = self.ar_op;
1062 ar_hrd.hash(state);
1063 ar_pro.hash(state);
1064 self.ar_hln.hash(state);
1065 self.ar_pln.hash(state);
1066 ar_op.hash(state);
1067 }
1068 }
1069
1070 impl PartialEq for in_addr {
1071 fn eq(&self, other: &in_addr) -> bool {
1072 self.s_addr == other.s_addr
1073 }
1074 }
1075 impl Eq for in_addr {}
1076 impl fmt::Debug for in_addr {
1077 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1078 let s_addr = self.s_addr;
1079 f.debug_struct("in_addr").field("s_addr", &s_addr).finish()
1080 }
1081 }
1082 impl hash::Hash for in_addr {
1083 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1084 let s_addr = self.s_addr;
1085 s_addr.hash(state);
1086 }
1087 }
1088
1089 impl PartialEq for ip_mreq {
1090 fn eq(&self, other: &ip_mreq) -> bool {
1091 self.imr_multiaddr == other.imr_multiaddr
1092 && self.imr_interface == other.imr_interface
1093 }
1094 }
1095 impl Eq for ip_mreq {}
1096 impl fmt::Debug for ip_mreq {
1097 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1098 f.debug_struct("ip_mreq")
1099 .field("imr_multiaddr", &self.imr_multiaddr)
1100 .field("imr_interface", &self.imr_interface)
1101 .finish()
1102 }
1103 }
1104 impl hash::Hash for ip_mreq {
1105 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1106 self.imr_multiaddr.hash(state);
1107 self.imr_interface.hash(state);
1108 }
1109 }
1110
1111 impl PartialEq for sockaddr_in {
1112 fn eq(&self, other: &sockaddr_in) -> bool {
1113 self.sin_len == other.sin_len
1114 && self.sin_family == other.sin_family
1115 && self.sin_port == other.sin_port
1116 && self.sin_addr == other.sin_addr
1117 && self.sin_zero == other.sin_zero
1118 }
1119 }
1120 impl Eq for sockaddr_in {}
1121 impl fmt::Debug for sockaddr_in {
1122 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1123 f.debug_struct("sockaddr_in")
1124 .field("sin_len", &self.sin_len)
1125 .field("sin_family", &self.sin_family)
1126 .field("sin_port", &self.sin_port)
1127 .field("sin_addr", &self.sin_addr)
1128 .field("sin_zero", &self.sin_zero)
1129 .finish()
1130 }
1131 }
1132 impl hash::Hash for sockaddr_in {
1133 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1134 self.sin_len.hash(state);
1135 self.sin_family.hash(state);
1136 self.sin_port.hash(state);
1137 self.sin_addr.hash(state);
1138 self.sin_zero.hash(state);
1139 }
1140 }
1141
1142 impl PartialEq for dirent {
1143 fn eq(&self, other: &dirent) -> bool {
1144 self.d_fileno == other.d_fileno
1145 && self.d_reclen == other.d_reclen
1146 && self.d_namlen == other.d_namlen
1147 && self.d_type == other.d_type
1148 && self
1149 .d_name
1150 .iter()
1151 .zip(other.d_name.iter())
1152 .all(|(a, b)| a == b)
1153 }
1154 }
1155 impl Eq for dirent {}
1156 impl fmt::Debug for dirent {
1157 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1158 f.debug_struct("dirent")
1159 .field("d_fileno", &self.d_fileno)
1160 .field("d_reclen", &self.d_reclen)
1161 .field("d_namlen", &self.d_namlen)
1162 .field("d_type", &self.d_type)
1163 // FIXME(debug): .field("d_name", &self.d_name)
1164 .finish()
1165 }
1166 }
1167 impl hash::Hash for dirent {
1168 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1169 self.d_fileno.hash(state);
1170 self.d_reclen.hash(state);
1171 self.d_namlen.hash(state);
1172 self.d_type.hash(state);
1173 self.d_name.hash(state);
1174 }
1175 }
1176
1177 impl PartialEq for statvfs {
1178 fn eq(&self, other: &statvfs) -> bool {
1179 self.f_flag == other.f_flag
1180 && self.f_bsize == other.f_bsize
1181 && self.f_frsize == other.f_frsize
1182 && self.f_iosize == other.f_iosize
1183 && self.f_blocks == other.f_blocks
1184 && self.f_bfree == other.f_bfree
1185 && self.f_bavail == other.f_bavail
1186 && self.f_bresvd == other.f_bresvd
1187 && self.f_files == other.f_files
1188 && self.f_ffree == other.f_ffree
1189 && self.f_favail == other.f_favail
1190 && self.f_fresvd == other.f_fresvd
1191 && self.f_syncreads == other.f_syncreads
1192 && self.f_syncwrites == other.f_syncwrites
1193 && self.f_asyncreads == other.f_asyncreads
1194 && self.f_asyncwrites == other.f_asyncwrites
1195 && self.f_fsidx == other.f_fsidx
1196 && self.f_fsid == other.f_fsid
1197 && self.f_namemax == other.f_namemax
1198 && self.f_owner == other.f_owner
1199 && self.f_spare == other.f_spare
1200 && self.f_fstypename == other.f_fstypename
1201 && self
1202 .f_mntonname
1203 .iter()
1204 .zip(other.f_mntonname.iter())
1205 .all(|(a, b)| a == b)
1206 && self
1207 .f_mntfromname
1208 .iter()
1209 .zip(other.f_mntfromname.iter())
1210 .all(|(a, b)| a == b)
1211 }
1212 }
1213 impl Eq for statvfs {}
1214 impl fmt::Debug for statvfs {
1215 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1216 f.debug_struct("statvfs")
1217 .field("f_flag", &self.f_flag)
1218 .field("f_bsize", &self.f_bsize)
1219 .field("f_frsize", &self.f_frsize)
1220 .field("f_iosize", &self.f_iosize)
1221 .field("f_blocks", &self.f_blocks)
1222 .field("f_bfree", &self.f_bfree)
1223 .field("f_bavail", &self.f_bavail)
1224 .field("f_bresvd", &self.f_bresvd)
1225 .field("f_files", &self.f_files)
1226 .field("f_ffree", &self.f_ffree)
1227 .field("f_favail", &self.f_favail)
1228 .field("f_fresvd", &self.f_fresvd)
1229 .field("f_syncreads", &self.f_syncreads)
1230 .field("f_syncwrites", &self.f_syncwrites)
1231 .field("f_asyncreads", &self.f_asyncreads)
1232 .field("f_asyncwrites", &self.f_asyncwrites)
1233 .field("f_fsidx", &self.f_fsidx)
1234 .field("f_fsid", &self.f_fsid)
1235 .field("f_namemax", &self.f_namemax)
1236 .field("f_owner", &self.f_owner)
1237 .field("f_spare", &self.f_spare)
1238 .field("f_fstypename", &self.f_fstypename)
1239 // FIXME(debug): .field("f_mntonname", &self.f_mntonname)
1240 // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname)
1241 .finish()
1242 }
1243 }
1244 impl hash::Hash for statvfs {
1245 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1246 self.f_flag.hash(state);
1247 self.f_bsize.hash(state);
1248 self.f_frsize.hash(state);
1249 self.f_iosize.hash(state);
1250 self.f_blocks.hash(state);
1251 self.f_bfree.hash(state);
1252 self.f_bavail.hash(state);
1253 self.f_bresvd.hash(state);
1254 self.f_files.hash(state);
1255 self.f_ffree.hash(state);
1256 self.f_favail.hash(state);
1257 self.f_fresvd.hash(state);
1258 self.f_syncreads.hash(state);
1259 self.f_syncwrites.hash(state);
1260 self.f_asyncreads.hash(state);
1261 self.f_asyncwrites.hash(state);
1262 self.f_fsidx.hash(state);
1263 self.f_fsid.hash(state);
1264 self.f_namemax.hash(state);
1265 self.f_owner.hash(state);
1266 self.f_spare.hash(state);
1267 self.f_fstypename.hash(state);
1268 self.f_mntonname.hash(state);
1269 self.f_mntfromname.hash(state);
1270 }
1271 }
1272
1273 impl PartialEq for sockaddr_storage {
1274 fn eq(&self, other: &sockaddr_storage) -> bool {
1275 self.ss_len == other.ss_len
1276 && self.ss_family == other.ss_family
1277 && self.__ss_pad1 == other.__ss_pad1
1278 && self.__ss_pad2 == other.__ss_pad2
1279 && self
1280 .__ss_pad3
1281 .iter()
1282 .zip(other.__ss_pad3.iter())
1283 .all(|(a, b)| a == b)
1284 }
1285 }
1286 impl Eq for sockaddr_storage {}
1287 impl fmt::Debug for sockaddr_storage {
1288 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1289 f.debug_struct("sockaddr_storage")
1290 .field("ss_len", &self.ss_len)
1291 .field("ss_family", &self.ss_family)
1292 .field("__ss_pad1", &self.__ss_pad1)
1293 .field("__ss_pad2", &self.__ss_pad2)
1294 // FIXME(debug): .field("__ss_pad3", &self.__ss_pad3)
1295 .finish()
1296 }
1297 }
1298 impl hash::Hash for sockaddr_storage {
1299 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1300 self.ss_len.hash(state);
1301 self.ss_family.hash(state);
1302 self.__ss_pad1.hash(state);
1303 self.__ss_pad2.hash(state);
1304 self.__ss_pad3.hash(state);
1305 }
1306 }
1307
1308 impl PartialEq for sigevent {
1309 fn eq(&self, other: &sigevent) -> bool {
1310 self.sigev_notify == other.sigev_notify
1311 && self.sigev_signo == other.sigev_signo
1312 && self.sigev_value == other.sigev_value
1313 && self.sigev_notify_attributes == other.sigev_notify_attributes
1314 }
1315 }
1316 impl Eq for sigevent {}
1317 impl fmt::Debug for sigevent {
1318 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1319 f.debug_struct("sigevent")
1320 .field("sigev_notify", &self.sigev_notify)
1321 .field("sigev_signo", &self.sigev_signo)
1322 .field("sigev_value", &self.sigev_value)
1323 .field("sigev_notify_attributes", &self.sigev_notify_attributes)
1324 .finish()
1325 }
1326 }
1327 impl hash::Hash for sigevent {
1328 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1329 self.sigev_notify.hash(state);
1330 self.sigev_signo.hash(state);
1331 self.sigev_value.hash(state);
1332 self.sigev_notify_attributes.hash(state);
1333 }
1334 }
1335
1336 impl Eq for __c_anonymous_posix_spawn_fae {}
1337
1338 impl PartialEq for __c_anonymous_posix_spawn_fae {
1339 fn eq(&self, other: &__c_anonymous_posix_spawn_fae) -> bool {
1340 unsafe { self.open == other.open || self.dup2 == other.dup2 }
1341 }
1342 }
1343
1344 impl hash::Hash for __c_anonymous_posix_spawn_fae {
1345 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1346 unsafe {
1347 self.open.hash(state);
1348 self.dup2.hash(state);
1349 }
1350 }
1351 }
1352
1353 impl Eq for __c_anonymous_ifc_ifcu {}
1354
1355 impl PartialEq for __c_anonymous_ifc_ifcu {
1356 fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool {
1357 unsafe { self.ifcu_buf == other.ifcu_buf || self.ifcu_req == other.ifcu_req }
1358 }
1359 }
1360
1361 impl hash::Hash for __c_anonymous_ifc_ifcu {
1362 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1363 unsafe {
1364 self.ifcu_buf.hash(state);
1365 self.ifcu_req.hash(state);
1366 }
1367 }
1368 }
1369 }
1370 }
1371
1372 pub const AT_FDCWD: c_int = -100;
1373 pub const AT_EACCESS: c_int = 0x100;
1374 pub const AT_SYMLINK_NOFOLLOW: c_int = 0x200;
1375 pub const AT_SYMLINK_FOLLOW: c_int = 0x400;
1376 pub const AT_REMOVEDIR: c_int = 0x800;
1377
1378 pub const AT_NULL: c_int = 0;
1379 pub const AT_IGNORE: c_int = 1;
1380 pub const AT_EXECFD: c_int = 2;
1381 pub const AT_PHDR: c_int = 3;
1382 pub const AT_PHENT: c_int = 4;
1383 pub const AT_PHNUM: c_int = 5;
1384 pub const AT_PAGESZ: c_int = 6;
1385 pub const AT_BASE: c_int = 7;
1386 pub const AT_FLAGS: c_int = 8;
1387 pub const AT_ENTRY: c_int = 9;
1388 pub const AT_DCACHEBSIZE: c_int = 10;
1389 pub const AT_ICACHEBSIZE: c_int = 11;
1390 pub const AT_UCACHEBSIZE: c_int = 12;
1391 pub const AT_STACKBASE: c_int = 13;
1392 pub const AT_EUID: c_int = 2000;
1393 pub const AT_RUID: c_int = 2001;
1394 pub const AT_EGID: c_int = 2002;
1395 pub const AT_RGID: c_int = 2003;
1396 pub const AT_SUN_LDELF: c_int = 2004;
1397 pub const AT_SUN_LDSHDR: c_int = 2005;
1398 pub const AT_SUN_LDNAME: c_int = 2006;
1399 pub const AT_SUN_LDPGSIZE: c_int = 2007;
1400 pub const AT_SUN_PLATFORM: c_int = 2008;
1401 pub const AT_SUN_HWCAP: c_int = 2009;
1402 pub const AT_SUN_IFLUSH: c_int = 2010;
1403 pub const AT_SUN_CPU: c_int = 2011;
1404 pub const AT_SUN_EMUL_ENTRY: c_int = 2012;
1405 pub const AT_SUN_EMUL_EXECFD: c_int = 2013;
1406 pub const AT_SUN_EXECNAME: c_int = 2014;
1407
1408 pub const EXTATTR_NAMESPACE_USER: c_int = 1;
1409 pub const EXTATTR_NAMESPACE_SYSTEM: c_int = 2;
1410
1411 pub const LC_COLLATE_MASK: c_int = 1 << crate::LC_COLLATE;
1412 pub const LC_CTYPE_MASK: c_int = 1 << crate::LC_CTYPE;
1413 pub const LC_MONETARY_MASK: c_int = 1 << crate::LC_MONETARY;
1414 pub const LC_NUMERIC_MASK: c_int = 1 << crate::LC_NUMERIC;
1415 pub const LC_TIME_MASK: c_int = 1 << crate::LC_TIME;
1416 pub const LC_MESSAGES_MASK: c_int = 1 << crate::LC_MESSAGES;
1417 pub const LC_ALL_MASK: c_int = !0;
1418
1419 pub const ERA: crate::nl_item = 52;
1420 pub const ERA_D_FMT: crate::nl_item = 53;
1421 pub const ERA_D_T_FMT: crate::nl_item = 54;
1422 pub const ERA_T_FMT: crate::nl_item = 55;
1423 pub const ALT_DIGITS: crate::nl_item = 56;
1424
1425 pub const O_CLOEXEC: c_int = 0x400000;
1426 pub const O_ALT_IO: c_int = 0x40000;
1427 pub const O_NOSIGPIPE: c_int = 0x1000000;
1428 pub const O_SEARCH: c_int = 0x800000;
1429 pub const O_DIRECTORY: c_int = 0x200000;
1430 pub const O_DIRECT: c_int = 0x00080000;
1431 pub const O_RSYNC: c_int = 0x00020000;
1432
1433 pub const MS_SYNC: c_int = 0x4;
1434 pub const MS_INVALIDATE: c_int = 0x2;
1435
1436 // Here because they are not present on OpenBSD
1437 // (https://github.com/openbsd/src/blob/HEAD/sys/sys/resource.h)
1438 pub const RLIMIT_SBSIZE: c_int = 9;
1439 pub const RLIMIT_AS: c_int = 10;
1440 pub const RLIMIT_NTHR: c_int = 11;
1441
1442 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1443 pub const RLIM_NLIMITS: c_int = 12;
1444
1445 pub const EIDRM: c_int = 82;
1446 pub const ENOMSG: c_int = 83;
1447 pub const EOVERFLOW: c_int = 84;
1448 pub const EILSEQ: c_int = 85;
1449 pub const ENOTSUP: c_int = 86;
1450 pub const ECANCELED: c_int = 87;
1451 pub const EBADMSG: c_int = 88;
1452 pub const ENODATA: c_int = 89;
1453 pub const ENOSR: c_int = 90;
1454 pub const ENOSTR: c_int = 91;
1455 pub const ETIME: c_int = 92;
1456 pub const ENOATTR: c_int = 93;
1457 pub const EMULTIHOP: c_int = 94;
1458 pub const ENOLINK: c_int = 95;
1459 pub const EPROTO: c_int = 96;
1460 pub const EOWNERDEAD: c_int = 97;
1461 pub const ENOTRECOVERABLE: c_int = 98;
1462 #[deprecated(
1463 since = "0.2.143",
1464 note = "This value will always match the highest defined error number \
1465 and thus is not stable. \
1466 See #3040 for more info."
1467 )]
1468 pub const ELAST: c_int = 98;
1469
1470 pub const F_DUPFD_CLOEXEC: c_int = 12;
1471 pub const F_CLOSEM: c_int = 10;
1472 pub const F_GETNOSIGPIPE: c_int = 13;
1473 pub const F_SETNOSIGPIPE: c_int = 14;
1474 pub const F_MAXFD: c_int = 11;
1475 pub const F_GETPATH: c_int = 15;
1476
1477 pub const FUTEX_WAIT: c_int = 0;
1478 pub const FUTEX_WAKE: c_int = 1;
1479 pub const FUTEX_FD: c_int = 2;
1480 pub const FUTEX_REQUEUE: c_int = 3;
1481 pub const FUTEX_CMP_REQUEUE: c_int = 4;
1482 pub const FUTEX_WAKE_OP: c_int = 5;
1483 pub const FUTEX_LOCK_PI: c_int = 6;
1484 pub const FUTEX_UNLOCK_PI: c_int = 7;
1485 pub const FUTEX_TRYLOCK_PI: c_int = 8;
1486 pub const FUTEX_WAIT_BITSET: c_int = 9;
1487 pub const FUTEX_WAKE_BITSET: c_int = 10;
1488 pub const FUTEX_WAIT_REQUEUE_PI: c_int = 11;
1489 pub const FUTEX_CMP_REQUEUE_PI: c_int = 12;
1490 pub const FUTEX_PRIVATE_FLAG: c_int = 1 << 7;
1491 pub const FUTEX_CLOCK_REALTIME: c_int = 1 << 8;
1492 pub const FUTEX_CMD_MASK: c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
1493 pub const FUTEX_WAITERS: u32 = 1 << 31;
1494 pub const FUTEX_OWNER_DIED: u32 = 1 << 30;
1495 pub const FUTEX_SYNCOBJ_1: u32 = 1 << 29;
1496 pub const FUTEX_SYNCOBJ_0: u32 = 1 << 28;
1497 pub const FUTEX_TID_MASK: u32 = (1 << 28) - 1;
1498 pub const FUTEX_BITSET_MATCH_ANY: u32 = !0;
1499
1500 pub const IP_RECVDSTADDR: c_int = 7;
1501 pub const IP_SENDSRCADDR: c_int = IP_RECVDSTADDR;
1502 pub const IP_RECVIF: c_int = 20;
1503 pub const IP_PKTINFO: c_int = 25;
1504 pub const IP_RECVPKTINFO: c_int = 26;
1505 pub const IPV6_JOIN_GROUP: c_int = 12;
1506 pub const IPV6_LEAVE_GROUP: c_int = 13;
1507
1508 pub const TCP_KEEPIDLE: c_int = 3;
1509 pub const TCP_KEEPINTVL: c_int = 5;
1510 pub const TCP_KEEPCNT: c_int = 6;
1511 pub const TCP_KEEPINIT: c_int = 7;
1512 pub const TCP_MD5SIG: c_int = 0x10;
1513 pub const TCP_CONGCTL: c_int = 0x20;
1514
1515 pub const SOCK_CONN_DGRAM: c_int = 6;
1516 pub const SOCK_DCCP: c_int = SOCK_CONN_DGRAM;
1517 pub const SOCK_NOSIGPIPE: c_int = 0x40000000;
1518 pub const SOCK_FLAGS_MASK: c_int = 0xf0000000;
1519
1520 pub const SO_SNDTIMEO: c_int = 0x100b;
1521 pub const SO_RCVTIMEO: c_int = 0x100c;
1522 pub const SO_NOSIGPIPE: c_int = 0x0800;
1523 pub const SO_ACCEPTFILTER: c_int = 0x1000;
1524 pub const SO_TIMESTAMP: c_int = 0x2000;
1525 pub const SO_OVERFLOWED: c_int = 0x1009;
1526 pub const SO_NOHEADER: c_int = 0x100a;
1527
1528 // http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/un.h?annotate
1529 pub const LOCAL_OCREDS: c_int = 0x0001; // pass credentials to receiver
1530 pub const LOCAL_CONNWAIT: c_int = 0x0002; // connects block until accepted
1531 pub const LOCAL_PEEREID: c_int = 0x0003; // get peer identification
1532 pub const LOCAL_CREDS: c_int = 0x0004; // pass credentials to receiver
1533
1534 // https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
1535 pub const IFF_UP: c_int = 0x0001; // interface is up
1536 pub const IFF_BROADCAST: c_int = 0x0002; // broadcast address valid
1537 pub const IFF_DEBUG: c_int = 0x0004; // turn on debugging
1538 pub const IFF_LOOPBACK: c_int = 0x0008; // is a loopback net
1539 pub const IFF_POINTOPOINT: c_int = 0x0010; // interface is point-to-point link
1540 pub const IFF_NOTRAILERS: c_int = 0x0020; // avoid use of trailers
1541 pub const IFF_RUNNING: c_int = 0x0040; // resources allocated
1542 pub const IFF_NOARP: c_int = 0x0080; // no address resolution protocol
1543 pub const IFF_PROMISC: c_int = 0x0100; // receive all packets
1544 pub const IFF_ALLMULTI: c_int = 0x0200; // receive all multicast packets
1545 pub const IFF_OACTIVE: c_int = 0x0400; // transmission in progress
1546 pub const IFF_SIMPLEX: c_int = 0x0800; // can't hear own transmissions
1547 pub const IFF_LINK0: c_int = 0x1000; // per link layer defined bit
1548 pub const IFF_LINK1: c_int = 0x2000; // per link layer defined bit
1549 pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit
1550 pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast
1551
1552 // sys/netinet/in.h
1553 // Protocols (RFC 1700)
1554 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
1555
1556 // IPPROTO_IP defined in src/unix/mod.rs
1557 /// Hop-by-hop option header
1558 pub const IPPROTO_HOPOPTS: c_int = 0;
1559 // IPPROTO_ICMP defined in src/unix/mod.rs
1560 /// group mgmt protocol
1561 pub const IPPROTO_IGMP: c_int = 2;
1562 /// gateway^2 (deprecated)
1563 pub const IPPROTO_GGP: c_int = 3;
1564 /// for compatibility
1565 pub const IPPROTO_IPIP: c_int = 4;
1566 // IPPROTO_TCP defined in src/unix/mod.rs
1567 /// exterior gateway protocol
1568 pub const IPPROTO_EGP: c_int = 8;
1569 /// pup
1570 pub const IPPROTO_PUP: c_int = 12;
1571 // IPPROTO_UDP defined in src/unix/mod.rs
1572 /// xns idp
1573 pub const IPPROTO_IDP: c_int = 22;
1574 /// tp-4 w/ class negotiation
1575 pub const IPPROTO_TP: c_int = 29;
1576 /// DCCP
1577 pub const IPPROTO_DCCP: c_int = 33;
1578 // IPPROTO_IPV6 defined in src/unix/mod.rs
1579 /// IP6 routing header
1580 pub const IPPROTO_ROUTING: c_int = 43;
1581 /// IP6 fragmentation header
1582 pub const IPPROTO_FRAGMENT: c_int = 44;
1583 /// resource reservation
1584 pub const IPPROTO_RSVP: c_int = 46;
1585 /// General Routing Encap.
1586 pub const IPPROTO_GRE: c_int = 47;
1587 /// IP6 Encap Sec. Payload
1588 pub const IPPROTO_ESP: c_int = 50;
1589 /// IP6 Auth Header
1590 pub const IPPROTO_AH: c_int = 51;
1591 /// IP Mobility RFC 2004
1592 pub const IPPROTO_MOBILE: c_int = 55;
1593 /// IPv6 ICMP
1594 pub const IPPROTO_IPV6_ICMP: c_int = 58;
1595 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1596 /// IP6 no next header
1597 pub const IPPROTO_NONE: c_int = 59;
1598 /// IP6 destination option
1599 pub const IPPROTO_DSTOPTS: c_int = 60;
1600 /// ISO cnlp
1601 pub const IPPROTO_EON: c_int = 80;
1602 /// Ethernet-in-IP
1603 pub const IPPROTO_ETHERIP: c_int = 97;
1604 /// encapsulation header
1605 pub const IPPROTO_ENCAP: c_int = 98;
1606 /// Protocol indep. multicast
1607 pub const IPPROTO_PIM: c_int = 103;
1608 /// IP Payload Comp. Protocol
1609 pub const IPPROTO_IPCOMP: c_int = 108;
1610 /// VRRP RFC 2338
1611 pub const IPPROTO_VRRP: c_int = 112;
1612 /// Common Address Resolution Protocol
1613 pub const IPPROTO_CARP: c_int = 112;
1614 /// L2TPv3
1615 pub const IPPROTO_L2TP: c_int = 115;
1616 /// SCTP
1617 pub const IPPROTO_SCTP: c_int = 132;
1618 /// PFSYNC
1619 pub const IPPROTO_PFSYNC: c_int = 240;
1620 pub const IPPROTO_MAX: c_int = 256;
1621
1622 /// last return value of *_input(), meaning "all job for this pkt is done".
1623 pub const IPPROTO_DONE: c_int = 257;
1624
1625 /// sysctl placeholder for (FAST_)IPSEC
1626 pub const CTL_IPPROTO_IPSEC: c_int = 258;
1627
1628 pub const AF_OROUTE: c_int = 17;
1629 pub const AF_ARP: c_int = 28;
1630 pub const pseudo_AF_KEY: c_int = 29;
1631 pub const pseudo_AF_HDRCMPLT: c_int = 30;
1632 pub const AF_BLUETOOTH: c_int = 31;
1633 pub const AF_IEEE80211: c_int = 32;
1634 pub const AF_MPLS: c_int = 33;
1635 pub const AF_ROUTE: c_int = 34;
1636 pub const NET_RT_DUMP: c_int = 1;
1637 pub const NET_RT_FLAGS: c_int = 2;
1638 pub const NET_RT_OOOIFLIST: c_int = 3;
1639 pub const NET_RT_OOIFLIST: c_int = 4;
1640 pub const NET_RT_OIFLIST: c_int = 5;
1641 pub const NET_RT_IFLIST: c_int = 6;
1642 pub const NET_RT_MAXID: c_int = 7;
1643
1644 pub const PF_OROUTE: c_int = AF_OROUTE;
1645 pub const PF_ARP: c_int = AF_ARP;
1646 pub const PF_KEY: c_int = pseudo_AF_KEY;
1647 pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
1648 pub const PF_MPLS: c_int = AF_MPLS;
1649 pub const PF_ROUTE: c_int = AF_ROUTE;
1650
1651 pub const MSG_NBIO: c_int = 0x1000;
1652 pub const MSG_WAITFORONE: c_int = 0x2000;
1653 pub const MSG_NOTIFICATION: c_int = 0x4000;
1654
1655 pub const SCM_TIMESTAMP: c_int = 0x08;
1656 pub const SCM_CREDS: c_int = 0x10;
1657
1658 pub const O_DSYNC: c_int = 0x10000;
1659
1660 pub const MAP_RENAME: c_int = 0x20;
1661 pub const MAP_NORESERVE: c_int = 0x40;
1662 pub const MAP_HASSEMAPHORE: c_int = 0x200;
1663 pub const MAP_TRYFIXED: c_int = 0x400;
1664 pub const MAP_WIRED: c_int = 0x800;
1665 pub const MAP_STACK: c_int = 0x2000;
1666 // map alignment aliases for MAP_ALIGNED
1667 pub const MAP_ALIGNMENT_SHIFT: c_int = 24;
1668 pub const MAP_ALIGNMENT_MASK: c_int = 0xff << MAP_ALIGNMENT_SHIFT;
1669 pub const MAP_ALIGNMENT_64KB: c_int = 16 << MAP_ALIGNMENT_SHIFT;
1670 pub const MAP_ALIGNMENT_16MB: c_int = 24 << MAP_ALIGNMENT_SHIFT;
1671 pub const MAP_ALIGNMENT_4GB: c_int = 32 << MAP_ALIGNMENT_SHIFT;
1672 pub const MAP_ALIGNMENT_1TB: c_int = 40 << MAP_ALIGNMENT_SHIFT;
1673 pub const MAP_ALIGNMENT_256TB: c_int = 48 << MAP_ALIGNMENT_SHIFT;
1674 pub const MAP_ALIGNMENT_64PB: c_int = 56 << MAP_ALIGNMENT_SHIFT;
1675 // mremap flag
1676 pub const MAP_REMAPDUP: c_int = 0x004;
1677
1678 pub const DCCP_TYPE_REQUEST: c_int = 0;
1679 pub const DCCP_TYPE_RESPONSE: c_int = 1;
1680 pub const DCCP_TYPE_DATA: c_int = 2;
1681 pub const DCCP_TYPE_ACK: c_int = 3;
1682 pub const DCCP_TYPE_DATAACK: c_int = 4;
1683 pub const DCCP_TYPE_CLOSEREQ: c_int = 5;
1684 pub const DCCP_TYPE_CLOSE: c_int = 6;
1685 pub const DCCP_TYPE_RESET: c_int = 7;
1686 pub const DCCP_TYPE_MOVE: c_int = 8;
1687
1688 pub const DCCP_FEATURE_CC: c_int = 1;
1689 pub const DCCP_FEATURE_ECN: c_int = 2;
1690 pub const DCCP_FEATURE_ACKRATIO: c_int = 3;
1691 pub const DCCP_FEATURE_ACKVECTOR: c_int = 4;
1692 pub const DCCP_FEATURE_MOBILITY: c_int = 5;
1693 pub const DCCP_FEATURE_LOSSWINDOW: c_int = 6;
1694 pub const DCCP_FEATURE_CONN_NONCE: c_int = 8;
1695 pub const DCCP_FEATURE_IDENTREG: c_int = 7;
1696
1697 pub const DCCP_OPT_PADDING: c_int = 0;
1698 pub const DCCP_OPT_DATA_DISCARD: c_int = 1;
1699 pub const DCCP_OPT_SLOW_RECV: c_int = 2;
1700 pub const DCCP_OPT_BUF_CLOSED: c_int = 3;
1701 pub const DCCP_OPT_CHANGE_L: c_int = 32;
1702 pub const DCCP_OPT_CONFIRM_L: c_int = 33;
1703 pub const DCCP_OPT_CHANGE_R: c_int = 34;
1704 pub const DCCP_OPT_CONFIRM_R: c_int = 35;
1705 pub const DCCP_OPT_INIT_COOKIE: c_int = 36;
1706 pub const DCCP_OPT_NDP_COUNT: c_int = 37;
1707 pub const DCCP_OPT_ACK_VECTOR0: c_int = 38;
1708 pub const DCCP_OPT_ACK_VECTOR1: c_int = 39;
1709 pub const DCCP_OPT_RECV_BUF_DROPS: c_int = 40;
1710 pub const DCCP_OPT_TIMESTAMP: c_int = 41;
1711 pub const DCCP_OPT_TIMESTAMP_ECHO: c_int = 42;
1712 pub const DCCP_OPT_ELAPSEDTIME: c_int = 43;
1713 pub const DCCP_OPT_DATACHECKSUM: c_int = 44;
1714
1715 pub const DCCP_REASON_UNSPEC: c_int = 0;
1716 pub const DCCP_REASON_CLOSED: c_int = 1;
1717 pub const DCCP_REASON_INVALID: c_int = 2;
1718 pub const DCCP_REASON_OPTION_ERR: c_int = 3;
1719 pub const DCCP_REASON_FEA_ERR: c_int = 4;
1720 pub const DCCP_REASON_CONN_REF: c_int = 5;
1721 pub const DCCP_REASON_BAD_SNAME: c_int = 6;
1722 pub const DCCP_REASON_BAD_COOKIE: c_int = 7;
1723 pub const DCCP_REASON_INV_MOVE: c_int = 8;
1724 pub const DCCP_REASON_UNANSW_CH: c_int = 10;
1725 pub const DCCP_REASON_FRUITLESS_NEG: c_int = 11;
1726
1727 pub const DCCP_CCID: c_int = 1;
1728 pub const DCCP_CSLEN: c_int = 2;
1729 pub const DCCP_MAXSEG: c_int = 4;
1730 pub const DCCP_SERVICE: c_int = 8;
1731
1732 pub const DCCP_NDP_LIMIT: c_int = 16;
1733 pub const DCCP_SEQ_NUM_LIMIT: c_int = 16777216;
1734 pub const DCCP_MAX_OPTIONS: c_int = 32;
1735 pub const DCCP_MAX_PKTS: c_int = 100;
1736
1737 pub const _PC_LINK_MAX: c_int = 1;
1738 pub const _PC_MAX_CANON: c_int = 2;
1739 pub const _PC_MAX_INPUT: c_int = 3;
1740 pub const _PC_NAME_MAX: c_int = 4;
1741 pub const _PC_PATH_MAX: c_int = 5;
1742 pub const _PC_PIPE_BUF: c_int = 6;
1743 pub const _PC_CHOWN_RESTRICTED: c_int = 7;
1744 pub const _PC_NO_TRUNC: c_int = 8;
1745 pub const _PC_VDISABLE: c_int = 9;
1746 pub const _PC_SYNC_IO: c_int = 10;
1747 pub const _PC_FILESIZEBITS: c_int = 11;
1748 pub const _PC_SYMLINK_MAX: c_int = 12;
1749 pub const _PC_2_SYMLINKS: c_int = 13;
1750 pub const _PC_ACL_EXTENDED: c_int = 14;
1751 pub const _PC_MIN_HOLE_SIZE: c_int = 15;
1752
1753 pub const _SC_SYNCHRONIZED_IO: c_int = 31;
1754 pub const _SC_IOV_MAX: c_int = 32;
1755 pub const _SC_MAPPED_FILES: c_int = 33;
1756 pub const _SC_MEMLOCK: c_int = 34;
1757 pub const _SC_MEMLOCK_RANGE: c_int = 35;
1758 pub const _SC_MEMORY_PROTECTION: c_int = 36;
1759 pub const _SC_LOGIN_NAME_MAX: c_int = 37;
1760 pub const _SC_MONOTONIC_CLOCK: c_int = 38;
1761 pub const _SC_CLK_TCK: c_int = 39;
1762 pub const _SC_ATEXIT_MAX: c_int = 40;
1763 pub const _SC_THREADS: c_int = 41;
1764 pub const _SC_SEMAPHORES: c_int = 42;
1765 pub const _SC_BARRIERS: c_int = 43;
1766 pub const _SC_TIMERS: c_int = 44;
1767 pub const _SC_SPIN_LOCKS: c_int = 45;
1768 pub const _SC_READER_WRITER_LOCKS: c_int = 46;
1769 pub const _SC_GETGR_R_SIZE_MAX: c_int = 47;
1770 pub const _SC_GETPW_R_SIZE_MAX: c_int = 48;
1771 pub const _SC_CLOCK_SELECTION: c_int = 49;
1772 pub const _SC_ASYNCHRONOUS_IO: c_int = 50;
1773 pub const _SC_AIO_LISTIO_MAX: c_int = 51;
1774 pub const _SC_AIO_MAX: c_int = 52;
1775 pub const _SC_MESSAGE_PASSING: c_int = 53;
1776 pub const _SC_MQ_OPEN_MAX: c_int = 54;
1777 pub const _SC_MQ_PRIO_MAX: c_int = 55;
1778 pub const _SC_PRIORITY_SCHEDULING: c_int = 56;
1779 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 57;
1780 pub const _SC_THREAD_KEYS_MAX: c_int = 58;
1781 pub const _SC_THREAD_STACK_MIN: c_int = 59;
1782 pub const _SC_THREAD_THREADS_MAX: c_int = 60;
1783 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 61;
1784 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 62;
1785 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 63;
1786 pub const _SC_THREAD_PRIO_INHERIT: c_int = 64;
1787 pub const _SC_THREAD_PRIO_PROTECT: c_int = 65;
1788 pub const _SC_THREAD_PROCESS_SHARED: c_int = 66;
1789 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 67;
1790 pub const _SC_TTY_NAME_MAX: c_int = 68;
1791 pub const _SC_HOST_NAME_MAX: c_int = 69;
1792 pub const _SC_PASS_MAX: c_int = 70;
1793 pub const _SC_REGEXP: c_int = 71;
1794 pub const _SC_SHELL: c_int = 72;
1795 pub const _SC_SYMLOOP_MAX: c_int = 73;
1796 pub const _SC_V6_ILP32_OFF32: c_int = 74;
1797 pub const _SC_V6_ILP32_OFFBIG: c_int = 75;
1798 pub const _SC_V6_LP64_OFF64: c_int = 76;
1799 pub const _SC_V6_LPBIG_OFFBIG: c_int = 77;
1800 pub const _SC_2_PBS: c_int = 80;
1801 pub const _SC_2_PBS_ACCOUNTING: c_int = 81;
1802 pub const _SC_2_PBS_CHECKPOINT: c_int = 82;
1803 pub const _SC_2_PBS_LOCATE: c_int = 83;
1804 pub const _SC_2_PBS_MESSAGE: c_int = 84;
1805 pub const _SC_2_PBS_TRACK: c_int = 85;
1806 pub const _SC_SPAWN: c_int = 86;
1807 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 87;
1808 pub const _SC_TIMER_MAX: c_int = 88;
1809 pub const _SC_SEM_NSEMS_MAX: c_int = 89;
1810 pub const _SC_CPUTIME: c_int = 90;
1811 pub const _SC_THREAD_CPUTIME: c_int = 91;
1812 pub const _SC_DELAYTIMER_MAX: c_int = 92;
1813 // These two variables will be supported in NetBSD 8.0
1814 // pub const _SC_SIGQUEUE_MAX : c_int = 93;
1815 // pub const _SC_REALTIME_SIGNALS : c_int = 94;
1816 pub const _SC_PHYS_PAGES: c_int = 121;
1817 pub const _SC_NPROCESSORS_CONF: c_int = 1001;
1818 pub const _SC_NPROCESSORS_ONLN: c_int = 1002;
1819 pub const _SC_SCHED_RT_TS: c_int = 2001;
1820 pub const _SC_SCHED_PRI_MIN: c_int = 2002;
1821 pub const _SC_SCHED_PRI_MAX: c_int = 2003;
1822
1823 pub const FD_SETSIZE: usize = 0x100;
1824
1825 pub const ST_NOSUID: c_ulong = 8;
1826
1827 pub const BIOCGRSIG: c_ulong = 0x40044272;
1828 pub const BIOCSRSIG: c_ulong = 0x80044273;
1829 pub const BIOCSDLT: c_ulong = 0x80044278;
1830 pub const BIOCGSEESENT: c_ulong = 0x40044276;
1831 pub const BIOCSSEESENT: c_ulong = 0x80044277;
1832
1833 // <sys/fstypes.h>
1834 pub const MNT_UNION: c_int = 0x00000020;
1835 pub const MNT_NOCOREDUMP: c_int = 0x00008000;
1836 pub const MNT_RELATIME: c_int = 0x00020000;
1837 pub const MNT_IGNORE: c_int = 0x00100000;
1838 pub const MNT_NFS4ACLS: c_int = 0x00200000;
1839 pub const MNT_DISCARD: c_int = 0x00800000;
1840 pub const MNT_EXTATTR: c_int = 0x01000000;
1841 pub const MNT_LOG: c_int = 0x02000000;
1842 pub const MNT_NOATIME: c_int = 0x04000000;
1843 pub const MNT_AUTOMOUNTED: c_int = 0x10000000;
1844 pub const MNT_SYMPERM: c_int = 0x20000000;
1845 pub const MNT_NODEVMTIME: c_int = 0x40000000;
1846 pub const MNT_SOFTDEP: c_int = 0x80000000;
1847 pub const MNT_POSIX1EACLS: c_int = 0x00000800;
1848 pub const MNT_ACLS: c_int = MNT_POSIX1EACLS;
1849 pub const MNT_WAIT: c_int = 1;
1850 pub const MNT_NOWAIT: c_int = 2;
1851 pub const MNT_LAZY: c_int = 3;
1852
1853 //<sys/timex.h>
1854 pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2;
1855 pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 4;
1856 pub const NTP_API: c_int = 4;
1857 pub const MAXPHASE: c_long = 500000000;
1858 pub const MAXFREQ: c_long = 500000;
1859 pub const MINSEC: c_int = 256;
1860 pub const MAXSEC: c_int = 2048;
1861 pub const NANOSECOND: c_long = 1000000000;
1862 pub const SCALE_PPM: c_int = 65;
1863 pub const MAXTC: c_int = 10;
1864 pub const MOD_OFFSET: c_uint = 0x0001;
1865 pub const MOD_FREQUENCY: c_uint = 0x0002;
1866 pub const MOD_MAXERROR: c_uint = 0x0004;
1867 pub const MOD_ESTERROR: c_uint = 0x0008;
1868 pub const MOD_STATUS: c_uint = 0x0010;
1869 pub const MOD_TIMECONST: c_uint = 0x0020;
1870 pub const MOD_PPSMAX: c_uint = 0x0040;
1871 pub const MOD_TAI: c_uint = 0x0080;
1872 pub const MOD_MICRO: c_uint = 0x1000;
1873 pub const MOD_NANO: c_uint = 0x2000;
1874 pub const MOD_CLKB: c_uint = 0x4000;
1875 pub const MOD_CLKA: c_uint = 0x8000;
1876 pub const STA_PLL: c_int = 0x0001;
1877 pub const STA_PPSFREQ: c_int = 0x0002;
1878 pub const STA_PPSTIME: c_int = 0x0004;
1879 pub const STA_FLL: c_int = 0x0008;
1880 pub const STA_INS: c_int = 0x0010;
1881 pub const STA_DEL: c_int = 0x0020;
1882 pub const STA_UNSYNC: c_int = 0x0040;
1883 pub const STA_FREQHOLD: c_int = 0x0080;
1884 pub const STA_PPSSIGNAL: c_int = 0x0100;
1885 pub const STA_PPSJITTER: c_int = 0x0200;
1886 pub const STA_PPSWANDER: c_int = 0x0400;
1887 pub const STA_PPSERROR: c_int = 0x0800;
1888 pub const STA_CLOCKERR: c_int = 0x1000;
1889 pub const STA_NANO: c_int = 0x2000;
1890 pub const STA_MODE: c_int = 0x4000;
1891 pub const STA_CLK: c_int = 0x8000;
1892 pub const STA_RONLY: c_int = STA_PPSSIGNAL
1893 | STA_PPSJITTER
1894 | STA_PPSWANDER
1895 | STA_PPSERROR
1896 | STA_CLOCKERR
1897 | STA_NANO
1898 | STA_MODE
1899 | STA_CLK;
1900 pub const TIME_OK: c_int = 0;
1901 pub const TIME_INS: c_int = 1;
1902 pub const TIME_DEL: c_int = 2;
1903 pub const TIME_OOP: c_int = 3;
1904 pub const TIME_WAIT: c_int = 4;
1905 pub const TIME_ERROR: c_int = 5;
1906
1907 pub const LITTLE_ENDIAN: c_int = 1234;
1908 pub const BIG_ENDIAN: c_int = 4321;
1909
1910 pub const PL_EVENT_NONE: c_int = 0;
1911 pub const PL_EVENT_SIGNAL: c_int = 1;
1912 pub const PL_EVENT_SUSPENDED: c_int = 2;
1913
1914 cfg_if! {
1915 if #[cfg(any(
1916 target_arch = "sparc",
1917 target_arch = "sparc64",
1918 target_arch = "x86",
1919 target_arch = "x86_64"
1920 ))] {
1921 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
1922 ptm_magic: 0x33330003,
1923 ptm_errorcheck: 0,
1924 ptm_pad1: [0; 3],
1925 ptm_unused: 0,
1926 ptm_pad2: [0; 3],
1927 ptm_waiters: 0 as *mut _,
1928 ptm_owner: 0,
1929 ptm_recursed: 0,
1930 ptm_spare2: 0 as *mut _,
1931 };
1932 } else {
1933 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
1934 ptm_magic: 0x33330003,
1935 ptm_errorcheck: 0,
1936 ptm_unused: 0,
1937 ptm_waiters: 0 as *mut _,
1938 ptm_owner: 0,
1939 ptm_recursed: 0,
1940 ptm_spare2: 0 as *mut _,
1941 };
1942 }
1943 }
1944
1945 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1946 ptc_magic: 0x55550005,
1947 ptc_lock: 0,
1948 ptc_waiters_first: 0 as *mut _,
1949 ptc_waiters_last: 0 as *mut _,
1950 ptc_mutex: 0 as *mut _,
1951 ptc_private: 0 as *mut _,
1952 };
1953 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1954 ptr_magic: 0x99990009,
1955 ptr_interlock: 0,
1956 ptr_rblocked_first: 0 as *mut _,
1957 ptr_rblocked_last: 0 as *mut _,
1958 ptr_wblocked_first: 0 as *mut _,
1959 ptr_wblocked_last: 0 as *mut _,
1960 ptr_nreaders: 0,
1961 ptr_owner: 0,
1962 ptr_private: 0 as *mut _,
1963 };
1964 pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
1965 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
1966 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
1967 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
1968
1969 pub const SCHED_NONE: c_int = -1;
1970 pub const SCHED_OTHER: c_int = 0;
1971 pub const SCHED_FIFO: c_int = 1;
1972 pub const SCHED_RR: c_int = 2;
1973
1974 pub const EVFILT_AIO: u32 = 2;
1975 pub const EVFILT_PROC: u32 = 4;
1976 pub const EVFILT_READ: u32 = 0;
1977 pub const EVFILT_SIGNAL: u32 = 5;
1978 pub const EVFILT_TIMER: u32 = 6;
1979 pub const EVFILT_VNODE: u32 = 3;
1980 pub const EVFILT_WRITE: u32 = 1;
1981 pub const EVFILT_FS: u32 = 7;
1982 pub const EVFILT_USER: u32 = 8;
1983 pub const EVFILT_EMPTY: u32 = 9;
1984
1985 pub const EV_ADD: u32 = 0x1;
1986 pub const EV_DELETE: u32 = 0x2;
1987 pub const EV_ENABLE: u32 = 0x4;
1988 pub const EV_DISABLE: u32 = 0x8;
1989 pub const EV_ONESHOT: u32 = 0x10;
1990 pub const EV_CLEAR: u32 = 0x20;
1991 pub const EV_RECEIPT: u32 = 0x40;
1992 pub const EV_DISPATCH: u32 = 0x80;
1993 pub const EV_FLAG1: u32 = 0x2000;
1994 pub const EV_ERROR: u32 = 0x4000;
1995 pub const EV_EOF: u32 = 0x8000;
1996 pub const EV_SYSFLAGS: u32 = 0xf000;
1997
1998 pub const NOTE_TRIGGER: u32 = 0x01000000;
1999 pub const NOTE_FFNOP: u32 = 0x00000000;
2000 pub const NOTE_FFAND: u32 = 0x40000000;
2001 pub const NOTE_FFOR: u32 = 0x80000000;
2002 pub const NOTE_FFCOPY: u32 = 0xc0000000;
2003 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
2004 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
2005 pub const NOTE_LOWAT: u32 = 0x00000001;
2006 pub const NOTE_DELETE: u32 = 0x00000001;
2007 pub const NOTE_WRITE: u32 = 0x00000002;
2008 pub const NOTE_EXTEND: u32 = 0x00000004;
2009 pub const NOTE_ATTRIB: u32 = 0x00000008;
2010 pub const NOTE_LINK: u32 = 0x00000010;
2011 pub const NOTE_RENAME: u32 = 0x00000020;
2012 pub const NOTE_REVOKE: u32 = 0x00000040;
2013 pub const NOTE_EXIT: u32 = 0x80000000;
2014 pub const NOTE_FORK: u32 = 0x40000000;
2015 pub const NOTE_EXEC: u32 = 0x20000000;
2016 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
2017 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
2018 pub const NOTE_TRACK: u32 = 0x00000001;
2019 pub const NOTE_TRACKERR: u32 = 0x00000002;
2020 pub const NOTE_CHILD: u32 = 0x00000004;
2021 pub const NOTE_MSECONDS: u32 = 0x00000000;
2022 pub const NOTE_SECONDS: u32 = 0x00000001;
2023 pub const NOTE_USECONDS: u32 = 0x00000002;
2024 pub const NOTE_NSECONDS: u32 = 0x00000003;
2025 pub const NOTE_ABSTIME: u32 = 0x000000010;
2026
2027 pub const TMP_MAX: c_uint = 308915776;
2028
2029 pub const AI_PASSIVE: c_int = 0x00000001;
2030 pub const AI_CANONNAME: c_int = 0x00000002;
2031 pub const AI_NUMERICHOST: c_int = 0x00000004;
2032 pub const AI_NUMERICSERV: c_int = 0x00000008;
2033 pub const AI_ADDRCONFIG: c_int = 0x00000400;
2034 pub const AI_SRV: c_int = 0x00000800;
2035
2036 pub const NI_MAXHOST: crate::socklen_t = 1025;
2037 pub const NI_MAXSERV: crate::socklen_t = 32;
2038
2039 pub const NI_NOFQDN: c_int = 0x00000001;
2040 pub const NI_NUMERICHOST: c_int = 0x000000002;
2041 pub const NI_NAMEREQD: c_int = 0x000000004;
2042 pub const NI_NUMERICSERV: c_int = 0x000000008;
2043 pub const NI_DGRAM: c_int = 0x00000010;
2044 pub const NI_WITHSCOPEID: c_int = 0x00000020;
2045 pub const NI_NUMERICSCOPE: c_int = 0x00000040;
2046
2047 pub const RTLD_NOLOAD: c_int = 0x2000;
2048 pub const RTLD_LOCAL: c_int = 0x200;
2049
2050 pub const CTL_MAXNAME: c_int = 12;
2051 pub const SYSCTL_NAMELEN: c_int = 32;
2052 pub const SYSCTL_DEFSIZE: c_int = 8;
2053 pub const CTLTYPE_NODE: c_int = 1;
2054 pub const CTLTYPE_INT: c_int = 2;
2055 pub const CTLTYPE_STRING: c_int = 3;
2056 pub const CTLTYPE_QUAD: c_int = 4;
2057 pub const CTLTYPE_STRUCT: c_int = 5;
2058 pub const CTLTYPE_BOOL: c_int = 6;
2059 pub const CTLFLAG_READONLY: c_int = 0x00000000;
2060 pub const CTLFLAG_READWRITE: c_int = 0x00000070;
2061 pub const CTLFLAG_ANYWRITE: c_int = 0x00000080;
2062 pub const CTLFLAG_PRIVATE: c_int = 0x00000100;
2063 pub const CTLFLAG_PERMANENT: c_int = 0x00000200;
2064 pub const CTLFLAG_OWNDATA: c_int = 0x00000400;
2065 pub const CTLFLAG_IMMEDIATE: c_int = 0x00000800;
2066 pub const CTLFLAG_HEX: c_int = 0x00001000;
2067 pub const CTLFLAG_ROOT: c_int = 0x00002000;
2068 pub const CTLFLAG_ANYNUMBER: c_int = 0x00004000;
2069 pub const CTLFLAG_HIDDEN: c_int = 0x00008000;
2070 pub const CTLFLAG_ALIAS: c_int = 0x00010000;
2071 pub const CTLFLAG_MMAP: c_int = 0x00020000;
2072 pub const CTLFLAG_OWNDESC: c_int = 0x00040000;
2073 pub const CTLFLAG_UNSIGNED: c_int = 0x00080000;
2074 pub const SYSCTL_VERS_MASK: c_int = 0xff000000;
2075 pub const SYSCTL_VERS_0: c_int = 0x00000000;
2076 pub const SYSCTL_VERS_1: c_int = 0x01000000;
2077 pub const SYSCTL_VERSION: c_int = SYSCTL_VERS_1;
2078 pub const CTL_EOL: c_int = -1;
2079 pub const CTL_QUERY: c_int = -2;
2080 pub const CTL_CREATE: c_int = -3;
2081 pub const CTL_CREATESYM: c_int = -4;
2082 pub const CTL_DESTROY: c_int = -5;
2083 pub const CTL_MMAP: c_int = -6;
2084 pub const CTL_DESCRIBE: c_int = -7;
2085 pub const CTL_UNSPEC: c_int = 0;
2086 pub const CTL_KERN: c_int = 1;
2087 pub const CTL_VM: c_int = 2;
2088 pub const CTL_VFS: c_int = 3;
2089 pub const CTL_NET: c_int = 4;
2090 pub const CTL_DEBUG: c_int = 5;
2091 pub const CTL_HW: c_int = 6;
2092 pub const CTL_MACHDEP: c_int = 7;
2093 pub const CTL_USER: c_int = 8;
2094 pub const CTL_DDB: c_int = 9;
2095 pub const CTL_PROC: c_int = 10;
2096 pub const CTL_VENDOR: c_int = 11;
2097 pub const CTL_EMUL: c_int = 12;
2098 pub const CTL_SECURITY: c_int = 13;
2099 pub const CTL_MAXID: c_int = 14;
2100 pub const KERN_OSTYPE: c_int = 1;
2101 pub const KERN_OSRELEASE: c_int = 2;
2102 pub const KERN_OSREV: c_int = 3;
2103 pub const KERN_VERSION: c_int = 4;
2104 pub const KERN_MAXVNODES: c_int = 5;
2105 pub const KERN_MAXPROC: c_int = 6;
2106 pub const KERN_MAXFILES: c_int = 7;
2107 pub const KERN_ARGMAX: c_int = 8;
2108 pub const KERN_SECURELVL: c_int = 9;
2109 pub const KERN_HOSTNAME: c_int = 10;
2110 pub const KERN_HOSTID: c_int = 11;
2111 pub const KERN_CLOCKRATE: c_int = 12;
2112 pub const KERN_VNODE: c_int = 13;
2113 pub const KERN_PROC: c_int = 14;
2114 pub const KERN_FILE: c_int = 15;
2115 pub const KERN_PROF: c_int = 16;
2116 pub const KERN_POSIX1: c_int = 17;
2117 pub const KERN_NGROUPS: c_int = 18;
2118 pub const KERN_JOB_CONTROL: c_int = 19;
2119 pub const KERN_SAVED_IDS: c_int = 20;
2120 pub const KERN_OBOOTTIME: c_int = 21;
2121 pub const KERN_DOMAINNAME: c_int = 22;
2122 pub const KERN_MAXPARTITIONS: c_int = 23;
2123 pub const KERN_RAWPARTITION: c_int = 24;
2124 pub const KERN_NTPTIME: c_int = 25;
2125 pub const KERN_TIMEX: c_int = 26;
2126 pub const KERN_AUTONICETIME: c_int = 27;
2127 pub const KERN_AUTONICEVAL: c_int = 28;
2128 pub const KERN_RTC_OFFSET: c_int = 29;
2129 pub const KERN_ROOT_DEVICE: c_int = 30;
2130 pub const KERN_MSGBUFSIZE: c_int = 31;
2131 pub const KERN_FSYNC: c_int = 32;
2132 pub const KERN_OLDSYSVMSG: c_int = 33;
2133 pub const KERN_OLDSYSVSEM: c_int = 34;
2134 pub const KERN_OLDSYSVSHM: c_int = 35;
2135 pub const KERN_OLDSHORTCORENAME: c_int = 36;
2136 pub const KERN_SYNCHRONIZED_IO: c_int = 37;
2137 pub const KERN_IOV_MAX: c_int = 38;
2138 pub const KERN_MBUF: c_int = 39;
2139 pub const KERN_MAPPED_FILES: c_int = 40;
2140 pub const KERN_MEMLOCK: c_int = 41;
2141 pub const KERN_MEMLOCK_RANGE: c_int = 42;
2142 pub const KERN_MEMORY_PROTECTION: c_int = 43;
2143 pub const KERN_LOGIN_NAME_MAX: c_int = 44;
2144 pub const KERN_DEFCORENAME: c_int = 45;
2145 pub const KERN_LOGSIGEXIT: c_int = 46;
2146 pub const KERN_PROC2: c_int = 47;
2147 pub const KERN_PROC_ARGS: c_int = 48;
2148 pub const KERN_FSCALE: c_int = 49;
2149 pub const KERN_CCPU: c_int = 50;
2150 pub const KERN_CP_TIME: c_int = 51;
2151 pub const KERN_OLDSYSVIPC_INFO: c_int = 52;
2152 pub const KERN_MSGBUF: c_int = 53;
2153 pub const KERN_CONSDEV: c_int = 54;
2154 pub const KERN_MAXPTYS: c_int = 55;
2155 pub const KERN_PIPE: c_int = 56;
2156 pub const KERN_MAXPHYS: c_int = 57;
2157 pub const KERN_SBMAX: c_int = 58;
2158 pub const KERN_TKSTAT: c_int = 59;
2159 pub const KERN_MONOTONIC_CLOCK: c_int = 60;
2160 pub const KERN_URND: c_int = 61;
2161 pub const KERN_LABELSECTOR: c_int = 62;
2162 pub const KERN_LABELOFFSET: c_int = 63;
2163 pub const KERN_LWP: c_int = 64;
2164 pub const KERN_FORKFSLEEP: c_int = 65;
2165 pub const KERN_POSIX_THREADS: c_int = 66;
2166 pub const KERN_POSIX_SEMAPHORES: c_int = 67;
2167 pub const KERN_POSIX_BARRIERS: c_int = 68;
2168 pub const KERN_POSIX_TIMERS: c_int = 69;
2169 pub const KERN_POSIX_SPIN_LOCKS: c_int = 70;
2170 pub const KERN_POSIX_READER_WRITER_LOCKS: c_int = 71;
2171 pub const KERN_DUMP_ON_PANIC: c_int = 72;
2172 pub const KERN_SOMAXKVA: c_int = 73;
2173 pub const KERN_ROOT_PARTITION: c_int = 74;
2174 pub const KERN_DRIVERS: c_int = 75;
2175 pub const KERN_BUF: c_int = 76;
2176 pub const KERN_FILE2: c_int = 77;
2177 pub const KERN_VERIEXEC: c_int = 78;
2178 pub const KERN_CP_ID: c_int = 79;
2179 pub const KERN_HARDCLOCK_TICKS: c_int = 80;
2180 pub const KERN_ARND: c_int = 81;
2181 pub const KERN_SYSVIPC: c_int = 82;
2182 pub const KERN_BOOTTIME: c_int = 83;
2183 pub const KERN_EVCNT: c_int = 84;
2184 pub const KERN_MAXID: c_int = 85;
2185 pub const KERN_PROC_ALL: c_int = 0;
2186 pub const KERN_PROC_PID: c_int = 1;
2187 pub const KERN_PROC_PGRP: c_int = 2;
2188 pub const KERN_PROC_SESSION: c_int = 3;
2189 pub const KERN_PROC_TTY: c_int = 4;
2190 pub const KERN_PROC_UID: c_int = 5;
2191 pub const KERN_PROC_RUID: c_int = 6;
2192 pub const KERN_PROC_GID: c_int = 7;
2193 pub const KERN_PROC_RGID: c_int = 8;
2194 pub const KERN_PROC_ARGV: c_int = 1;
2195 pub const KERN_PROC_NARGV: c_int = 2;
2196 pub const KERN_PROC_ENV: c_int = 3;
2197 pub const KERN_PROC_NENV: c_int = 4;
2198 pub const KERN_PROC_PATHNAME: c_int = 5;
2199 pub const VM_PROC: c_int = 16;
2200 pub const VM_PROC_MAP: c_int = 1;
2201
2202 pub const EAI_AGAIN: c_int = 2;
2203 pub const EAI_BADFLAGS: c_int = 3;
2204 pub const EAI_FAIL: c_int = 4;
2205 pub const EAI_FAMILY: c_int = 5;
2206 pub const EAI_MEMORY: c_int = 6;
2207 pub const EAI_NODATA: c_int = 7;
2208 pub const EAI_NONAME: c_int = 8;
2209 pub const EAI_SERVICE: c_int = 9;
2210 pub const EAI_SOCKTYPE: c_int = 10;
2211 pub const EAI_SYSTEM: c_int = 11;
2212 pub const EAI_OVERFLOW: c_int = 14;
2213
2214 pub const AIO_CANCELED: c_int = 1;
2215 pub const AIO_NOTCANCELED: c_int = 2;
2216 pub const AIO_ALLDONE: c_int = 3;
2217 pub const LIO_NOP: c_int = 0;
2218 pub const LIO_WRITE: c_int = 1;
2219 pub const LIO_READ: c_int = 2;
2220 pub const LIO_WAIT: c_int = 1;
2221 pub const LIO_NOWAIT: c_int = 0;
2222
2223 pub const SIGEV_NONE: c_int = 0;
2224 pub const SIGEV_SIGNAL: c_int = 1;
2225 pub const SIGEV_THREAD: c_int = 2;
2226
2227 pub const WSTOPPED: c_int = 0x00000002; // same as WUNTRACED
2228 pub const WCONTINUED: c_int = 0x00000010;
2229 pub const WEXITED: c_int = 0x000000020;
2230 pub const WNOWAIT: c_int = 0x00010000;
2231
2232 pub const WALTSIG: c_int = 0x00000004;
2233 pub const WALLSIG: c_int = 0x00000008;
2234 pub const WTRAPPED: c_int = 0x00000040;
2235 pub const WNOZOMBIE: c_int = 0x00020000;
2236
2237 pub const P_ALL: idtype_t = 0;
2238 pub const P_PID: idtype_t = 1;
2239 pub const P_PGID: idtype_t = 4;
2240
2241 pub const UTIME_OMIT: c_long = 1073741822;
2242 pub const UTIME_NOW: c_long = 1073741823;
2243
2244 pub const B460800: crate::speed_t = 460800;
2245 pub const B921600: crate::speed_t = 921600;
2246
2247 pub const ONOCR: crate::tcflag_t = 0x20;
2248 pub const ONLRET: crate::tcflag_t = 0x40;
2249 pub const CDTRCTS: crate::tcflag_t = 0x00020000;
2250 pub const CHWFLOW: crate::tcflag_t = crate::MDMBUF | crate::CRTSCTS | crate::CDTRCTS;
2251
2252 // pub const _PATH_UTMPX: &[c_char; 14] = b"/var/run/utmpx";
2253 // pub const _PATH_WTMPX: &[c_char; 14] = b"/var/log/wtmpx";
2254 // pub const _PATH_LASTLOGX: &[c_char; 17] = b"/var/log/lastlogx";
2255 // pub const _PATH_UTMP_UPDATE: &[c_char; 24] = b"/usr/libexec/utmp_update";
2256 pub const UT_NAMESIZE: usize = 8;
2257 pub const UT_LINESIZE: usize = 8;
2258 pub const UT_HOSTSIZE: usize = 16;
2259 pub const _UTX_USERSIZE: usize = 32;
2260 pub const _UTX_LINESIZE: usize = 32;
2261 pub const _UTX_PADSIZE: usize = 40;
2262 pub const _UTX_IDSIZE: usize = 4;
2263 pub const _UTX_HOSTSIZE: usize = 256;
2264 pub const EMPTY: u16 = 0;
2265 pub const RUN_LVL: u16 = 1;
2266 pub const BOOT_TIME: u16 = 2;
2267 pub const OLD_TIME: u16 = 3;
2268 pub const NEW_TIME: u16 = 4;
2269 pub const INIT_PROCESS: u16 = 5;
2270 pub const LOGIN_PROCESS: u16 = 6;
2271 pub const USER_PROCESS: u16 = 7;
2272 pub const DEAD_PROCESS: u16 = 8;
2273 pub const ACCOUNTING: u16 = 9;
2274 pub const SIGNATURE: u16 = 10;
2275 pub const DOWN_TIME: u16 = 11;
2276
2277 pub const SOCK_CLOEXEC: c_int = 0x10000000;
2278 pub const SOCK_NONBLOCK: c_int = 0x20000000;
2279
2280 // Uncomment on next NetBSD release
2281 // pub const FIOSEEKDATA: c_ulong = 0xc0086661;
2282 // pub const FIOSEEKHOLE: c_ulong = 0xc0086662;
2283 pub const OFIOGETBMAP: c_ulong = 0xc004667a;
2284 pub const FIOGETBMAP: c_ulong = 0xc008667a;
2285 pub const FIONWRITE: c_ulong = 0x40046679;
2286 pub const FIONSPACE: c_ulong = 0x40046678;
2287 pub const FIBMAP: c_ulong = 0xc008667a;
2288
2289 pub const SIGSTKSZ: size_t = 40960;
2290
2291 pub const REG_ENOSYS: c_int = 17;
2292
2293 pub const PT_DUMPCORE: c_int = 12;
2294 pub const PT_LWPINFO: c_int = 13;
2295 pub const PT_SYSCALL: c_int = 14;
2296 pub const PT_SYSCALLEMU: c_int = 15;
2297 pub const PT_SET_EVENT_MASK: c_int = 16;
2298 pub const PT_GET_EVENT_MASK: c_int = 17;
2299 pub const PT_GET_PROCESS_STATE: c_int = 18;
2300 pub const PT_SET_SIGINFO: c_int = 19;
2301 pub const PT_GET_SIGINFO: c_int = 20;
2302 pub const PT_RESUME: c_int = 21;
2303 pub const PT_SUSPEND: c_int = 23;
2304 pub const PT_STOP: c_int = 23;
2305 pub const PT_LWPSTATUS: c_int = 24;
2306 pub const PT_LWPNEXT: c_int = 25;
2307 pub const PT_SET_SIGPASS: c_int = 26;
2308 pub const PT_GET_SIGPASS: c_int = 27;
2309 pub const PT_FIRSTMACH: c_int = 32;
2310 pub const POSIX_SPAWN_RETURNERROR: c_int = 0x40;
2311
2312 // Flags for chflags(2)
2313 pub const SF_APPEND: c_ulong = 0x00040000;
2314 pub const SF_ARCHIVED: c_ulong = 0x00010000;
2315 pub const SF_IMMUTABLE: c_ulong = 0x00020000;
2316 pub const SF_LOG: c_ulong = 0x00400000;
2317 pub const SF_SETTABLE: c_ulong = 0xffff0000;
2318 pub const SF_SNAPINVAL: c_ulong = 0x00800000;
2319 pub const SF_SNAPSHOT: c_ulong = 0x00200000;
2320 pub const UF_APPEND: c_ulong = 0x00000004;
2321 pub const UF_IMMUTABLE: c_ulong = 0x00000002;
2322 pub const UF_NODUMP: c_ulong = 0x00000001;
2323 pub const UF_OPAQUE: c_ulong = 0x00000008;
2324 pub const UF_SETTABLE: c_ulong = 0x0000ffff;
2325
2326 // sys/sysctl.h
2327 pub const KVME_PROT_READ: c_int = 0x00000001;
2328 pub const KVME_PROT_WRITE: c_int = 0x00000002;
2329 pub const KVME_PROT_EXEC: c_int = 0x00000004;
2330
2331 pub const KVME_FLAG_COW: c_int = 0x00000001;
2332 pub const KVME_FLAG_NEEDS_COPY: c_int = 0x00000002;
2333 pub const KVME_FLAG_NOCOREDUMP: c_int = 0x000000004;
2334 pub const KVME_FLAG_PAGEABLE: c_int = 0x000000008;
2335 pub const KVME_FLAG_GROWS_UP: c_int = 0x000000010;
2336 pub const KVME_FLAG_GROWS_DOWN: c_int = 0x000000020;
2337
2338 pub const NGROUPS_MAX: c_int = 16;
2339
2340 pub const KI_NGROUPS: c_int = 16;
2341 pub const KI_MAXCOMLEN: c_int = 24;
2342 pub const KI_WMESGLEN: c_int = 8;
2343 pub const KI_MAXLOGNAME: c_int = 24;
2344 pub const KI_MAXEMULLEN: c_int = 16;
2345 pub const KI_LNAMELEN: c_int = 20;
2346
2347 // sys/lwp.h
2348 pub const LSIDL: c_int = 1;
2349 pub const LSRUN: c_int = 2;
2350 pub const LSSLEEP: c_int = 3;
2351 pub const LSSTOP: c_int = 4;
2352 pub const LSZOMB: c_int = 5;
2353 pub const LSONPROC: c_int = 7;
2354 pub const LSSUSPENDED: c_int = 8;
2355
2356 // sys/xattr.h
2357 pub const XATTR_CREATE: c_int = 0x01;
2358 pub const XATTR_REPLACE: c_int = 0x02;
2359 // sys/extattr.h
2360 pub const EXTATTR_NAMESPACE_EMPTY: c_int = 0;
2361
2362 // For getrandom()
2363 pub const GRND_NONBLOCK: c_uint = 0x1;
2364 pub const GRND_RANDOM: c_uint = 0x2;
2365 pub const GRND_INSECURE: c_uint = 0x4;
2366
2367 // sys/reboot.h
2368 pub const RB_ASKNAME: c_int = 0x000000001;
2369 pub const RB_SINGLE: c_int = 0x000000002;
2370 pub const RB_NOSYNC: c_int = 0x000000004;
2371 pub const RB_HALT: c_int = 0x000000008;
2372 pub const RB_INITNAME: c_int = 0x000000010;
2373 pub const RB_KDB: c_int = 0x000000040;
2374 pub const RB_RDONLY: c_int = 0x000000080;
2375 pub const RB_DUMP: c_int = 0x000000100;
2376 pub const RB_MINIROOT: c_int = 0x000000200;
2377 pub const RB_STRING: c_int = 0x000000400;
2378 pub const RB_POWERDOWN: c_int = RB_HALT | 0x000000800;
2379 pub const RB_USERCONF: c_int = 0x000001000;
2380
2381 pub const fn MAP_ALIGNED(alignment: c_int) -> c_int {
2382 alignment << MAP_ALIGNMENT_SHIFT
2383 }
2384
2385 // net/route.h
2386 pub const RTF_MASK: c_int = 0x80;
2387 pub const RTF_CONNECTED: c_int = 0x100;
2388 pub const RTF_ANNOUNCE: c_int = 0x20000;
2389 pub const RTF_SRC: c_int = 0x10000;
2390 pub const RTF_LOCAL: c_int = 0x40000;
2391 pub const RTF_BROADCAST: c_int = 0x80000;
2392 pub const RTF_UPDATING: c_int = 0x100000;
2393 pub const RTF_DONTCHANGEIFA: c_int = 0x200000;
2394
2395 pub const RTM_VERSION: c_int = 4;
2396 pub const RTM_LOCK: c_int = 0x8;
2397 pub const RTM_IFANNOUNCE: c_int = 0x10;
2398 pub const RTM_IEEE80211: c_int = 0x11;
2399 pub const RTM_SETGATE: c_int = 0x12;
2400 pub const RTM_LLINFO_UPD: c_int = 0x13;
2401 pub const RTM_IFINFO: c_int = 0x14;
2402 pub const RTM_OCHGADDR: c_int = 0x15;
2403 pub const RTM_NEWADDR: c_int = 0x16;
2404 pub const RTM_DELADDR: c_int = 0x17;
2405 pub const RTM_CHGADDR: c_int = 0x18;
2406
2407 pub const RTA_TAG: c_int = 0x100;
2408
2409 pub const RTAX_TAG: c_int = 8;
2410 pub const RTAX_MAX: c_int = 9;
2411
2412 const_fn! {
2413 {const} fn _ALIGN(p: usize) -> usize {
2414 (p + _ALIGNBYTES) & !_ALIGNBYTES
2415 }
2416 }
2417
2418 f! {
2419 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
2420 (cmsg as *mut c_uchar).offset(_ALIGN(mem::size_of::<cmsghdr>()) as isize)
2421 }
2422
2423 pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
2424 _ALIGN(mem::size_of::<cmsghdr>()) as c_uint + length
2425 }
2426
2427 pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
2428 if cmsg.is_null() {
2429 return crate::CMSG_FIRSTHDR(mhdr);
2430 };
2431 let next =
2432 cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(mem::size_of::<cmsghdr>());
2433 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
2434 if next > max {
2435 0 as *mut cmsghdr
2436 } else {
2437 (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
2438 }
2439 }
2440
2441 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
2442 (_ALIGN(mem::size_of::<cmsghdr>()) + _ALIGN(length as usize)) as c_uint
2443 }
2444
2445 // dirfd() is a macro on netbsd to access
2446 // the first field of the struct where dirp points to:
2447 // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
2448 pub fn dirfd(dirp: *mut crate::DIR) -> c_int {
2449 *(dirp as *const c_int)
2450 }
2451
2452 pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
2453 let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 };
2454 mem::size_of::<sockcred>() + mem::size_of::<crate::gid_t>() * ngrps
2455 }
2456
2457 pub fn PROT_MPROTECT(x: c_int) -> c_int {
2458 x << 3
2459 }
2460
2461 pub fn PROT_MPROTECT_EXTRACT(x: c_int) -> c_int {
2462 (x >> 3) & 0x7
2463 }
2464 }
2465
2466 safe_f! {
2467 pub {const} fn WSTOPSIG(status: c_int) -> c_int {
2468 status >> 8
2469 }
2470
2471 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
2472 (status & 0o177) != 0o177 && (status & 0o177) != 0
2473 }
2474
2475 pub {const} fn WIFSTOPPED(status: c_int) -> bool {
2476 (status & 0o177) == 0o177
2477 }
2478
2479 pub {const} fn WIFCONTINUED(status: c_int) -> bool {
2480 status == 0xffff
2481 }
2482
2483 pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t {
2484 let major = major as crate::dev_t;
2485 let minor = minor as crate::dev_t;
2486 let mut dev = 0;
2487 dev |= (major << 8) & 0x000ff00;
2488 dev |= (minor << 12) & 0xfff00000;
2489 dev |= minor & 0xff;
2490 dev
2491 }
2492
2493 pub {const} fn major(dev: crate::dev_t) -> c_int {
2494 (((dev as u32) & 0x000fff00) >> 8) as c_int
2495 }
2496
2497 pub {const} fn minor(dev: crate::dev_t) -> c_int {
2498 let mut res = 0;
2499 res |= ((dev as u32) & 0xfff00000) >> 12;
2500 res |= (dev as u32) & 0x000000ff;
2501 res as c_int
2502 }
2503 }
2504
2505 extern "C" {
2506 pub fn ntp_adjtime(buf: *mut timex) -> c_int;
2507 pub fn ntp_gettime(buf: *mut ntptimeval) -> c_int;
2508 pub fn clock_nanosleep(
2509 clk_id: crate::clockid_t,
2510 flags: c_int,
2511 rqtp: *const crate::timespec,
2512 rmtp: *mut crate::timespec,
2513 ) -> c_int;
2514
2515 pub fn reallocarr(ptr: *mut c_void, number: size_t, size: size_t) -> c_int;
2516
2517 pub fn chflags(path: *const c_char, flags: c_ulong) -> c_int;
2518 pub fn fchflags(fd: c_int, flags: c_ulong) -> c_int;
2519 pub fn lchflags(path: *const c_char, flags: c_ulong) -> c_int;
2520
2521 pub fn extattr_list_fd(
2522 fd: c_int,
2523 attrnamespace: c_int,
2524 data: *mut c_void,
2525 nbytes: size_t,
2526 ) -> ssize_t;
2527 pub fn extattr_list_file(
2528 path: *const c_char,
2529 attrnamespace: c_int,
2530 data: *mut c_void,
2531 nbytes: size_t,
2532 ) -> ssize_t;
2533 pub fn extattr_list_link(
2534 path: *const c_char,
2535 attrnamespace: c_int,
2536 data: *mut c_void,
2537 nbytes: size_t,
2538 ) -> ssize_t;
2539 pub fn extattr_delete_fd(fd: c_int, attrnamespace: c_int, attrname: *const c_char) -> c_int;
2540 pub fn extattr_delete_file(
2541 path: *const c_char,
2542 attrnamespace: c_int,
2543 attrname: *const c_char,
2544 ) -> c_int;
2545 pub fn extattr_delete_link(
2546 path: *const c_char,
2547 attrnamespace: c_int,
2548 attrname: *const c_char,
2549 ) -> c_int;
2550 pub fn extattr_get_fd(
2551 fd: c_int,
2552 attrnamespace: c_int,
2553 attrname: *const c_char,
2554 data: *mut c_void,
2555 nbytes: size_t,
2556 ) -> ssize_t;
2557 pub fn extattr_get_file(
2558 path: *const c_char,
2559 attrnamespace: c_int,
2560 attrname: *const c_char,
2561 data: *mut c_void,
2562 nbytes: size_t,
2563 ) -> ssize_t;
2564 pub fn extattr_get_link(
2565 path: *const c_char,
2566 attrnamespace: c_int,
2567 attrname: *const c_char,
2568 data: *mut c_void,
2569 nbytes: size_t,
2570 ) -> ssize_t;
2571 pub fn extattr_namespace_to_string(attrnamespace: c_int, string: *mut *mut c_char) -> c_int;
2572 pub fn extattr_set_fd(
2573 fd: c_int,
2574 attrnamespace: c_int,
2575 attrname: *const c_char,
2576 data: *const c_void,
2577 nbytes: size_t,
2578 ) -> c_int;
2579 pub fn extattr_set_file(
2580 path: *const c_char,
2581 attrnamespace: c_int,
2582 attrname: *const c_char,
2583 data: *const c_void,
2584 nbytes: size_t,
2585 ) -> c_int;
2586 pub fn extattr_set_link(
2587 path: *const c_char,
2588 attrnamespace: c_int,
2589 attrname: *const c_char,
2590 data: *const c_void,
2591 nbytes: size_t,
2592 ) -> c_int;
2593 pub fn extattr_string_to_namespace(string: *const c_char, attrnamespace: *mut c_int) -> c_int;
2594
2595 pub fn openpty(
2596 amaster: *mut c_int,
2597 aslave: *mut c_int,
2598 name: *mut c_char,
2599 termp: *mut crate::termios,
2600 winp: *mut crate::winsize,
2601 ) -> c_int;
2602 pub fn forkpty(
2603 amaster: *mut c_int,
2604 name: *mut c_char,
2605 termp: *mut crate::termios,
2606 winp: *mut crate::winsize,
2607 ) -> crate::pid_t;
2608
2609 #[link_name = "__lutimes50"]
2610 pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
2611 #[link_name = "__gettimeofday50"]
2612 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
2613 pub fn getnameinfo(
2614 sa: *const crate::sockaddr,
2615 salen: crate::socklen_t,
2616 host: *mut c_char,
2617 hostlen: crate::socklen_t,
2618 serv: *mut c_char,
2619 servlen: crate::socklen_t,
2620 flags: c_int,
2621 ) -> c_int;
2622 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
2623 pub fn sysctl(
2624 name: *const c_int,
2625 namelen: c_uint,
2626 oldp: *mut c_void,
2627 oldlenp: *mut size_t,
2628 newp: *const c_void,
2629 newlen: size_t,
2630 ) -> c_int;
2631 pub fn sysctlbyname(
2632 name: *const c_char,
2633 oldp: *mut c_void,
2634 oldlenp: *mut size_t,
2635 newp: *const c_void,
2636 newlen: size_t,
2637 ) -> c_int;
2638 pub fn sysctlnametomib(sname: *const c_char, name: *mut c_int, namelenp: *mut size_t) -> c_int;
2639 #[link_name = "__kevent50"]
2640 pub fn kevent(
2641 kq: c_int,
2642 changelist: *const crate::kevent,
2643 nchanges: size_t,
2644 eventlist: *mut crate::kevent,
2645 nevents: size_t,
2646 timeout: *const crate::timespec,
2647 ) -> c_int;
2648 #[link_name = "__mount50"]
2649 pub fn mount(
2650 src: *const c_char,
2651 target: *const c_char,
2652 flags: c_int,
2653 data: *mut c_void,
2654 size: size_t,
2655 ) -> c_int;
2656 pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t;
2657 pub fn mq_close(mqd: crate::mqd_t) -> c_int;
2658 pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
2659 pub fn mq_notify(mqd: crate::mqd_t, notification: *const crate::sigevent) -> c_int;
2660 pub fn mq_receive(
2661 mqd: crate::mqd_t,
2662 msg_ptr: *mut c_char,
2663 msg_len: size_t,
2664 msg_prio: *mut c_uint,
2665 ) -> ssize_t;
2666 pub fn mq_send(
2667 mqd: crate::mqd_t,
2668 msg_ptr: *const c_char,
2669 msg_len: size_t,
2670 msg_prio: c_uint,
2671 ) -> c_int;
2672 pub fn mq_setattr(
2673 mqd: crate::mqd_t,
2674 newattr: *const crate::mq_attr,
2675 oldattr: *mut crate::mq_attr,
2676 ) -> c_int;
2677 #[link_name = "__mq_timedreceive50"]
2678 pub fn mq_timedreceive(
2679 mqd: crate::mqd_t,
2680 msg_ptr: *mut c_char,
2681 msg_len: size_t,
2682 msg_prio: *mut c_uint,
2683 abs_timeout: *const crate::timespec,
2684 ) -> ssize_t;
2685 #[link_name = "__mq_timedsend50"]
2686 pub fn mq_timedsend(
2687 mqd: crate::mqd_t,
2688 msg_ptr: *const c_char,
2689 msg_len: size_t,
2690 msg_prio: c_uint,
2691 abs_timeout: *const crate::timespec,
2692 ) -> c_int;
2693 pub fn mq_unlink(name: *const c_char) -> c_int;
2694 pub fn ptrace(request: c_int, pid: crate::pid_t, addr: *mut c_void, data: c_int) -> c_int;
2695 pub fn utrace(label: *const c_char, addr: *mut c_void, len: size_t) -> c_int;
2696 pub fn pthread_getname_np(t: crate::pthread_t, name: *mut c_char, len: size_t) -> c_int;
2697 pub fn pthread_setname_np(
2698 t: crate::pthread_t,
2699 name: *const c_char,
2700 arg: *const c_void,
2701 ) -> c_int;
2702 pub fn pthread_attr_get_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t)
2703 -> c_int;
2704 pub fn pthread_getattr_np(native: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
2705 pub fn pthread_attr_getguardsize(
2706 attr: *const crate::pthread_attr_t,
2707 guardsize: *mut size_t,
2708 ) -> c_int;
2709 pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
2710 pub fn pthread_attr_getstack(
2711 attr: *const crate::pthread_attr_t,
2712 stackaddr: *mut *mut c_void,
2713 stacksize: *mut size_t,
2714 ) -> c_int;
2715 pub fn pthread_getaffinity_np(
2716 thread: crate::pthread_t,
2717 size: size_t,
2718 set: *mut cpuset_t,
2719 ) -> c_int;
2720 pub fn pthread_setaffinity_np(
2721 thread: crate::pthread_t,
2722 size: size_t,
2723 set: *mut cpuset_t,
2724 ) -> c_int;
2725
2726 pub fn _cpuset_create() -> *mut cpuset_t;
2727 pub fn _cpuset_destroy(set: *mut cpuset_t);
2728 pub fn _cpuset_clr(cpu: cpuid_t, set: *mut cpuset_t) -> c_int;
2729 pub fn _cpuset_set(cpu: cpuid_t, set: *mut cpuset_t) -> c_int;
2730 pub fn _cpuset_isset(cpu: cpuid_t, set: *const cpuset_t) -> c_int;
2731 pub fn _cpuset_size(set: *const cpuset_t) -> size_t;
2732 pub fn _cpuset_zero(set: *mut cpuset_t);
2733 #[link_name = "__sigtimedwait50"]
2734 pub fn sigtimedwait(
2735 set: *const sigset_t,
2736 info: *mut siginfo_t,
2737 timeout: *const crate::timespec,
2738 ) -> c_int;
2739 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
2740
2741 pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
2742 pub fn freelocale(loc: crate::locale_t);
2743 pub fn localeconv_l(loc: crate::locale_t) -> *mut lconv;
2744 pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
2745 #[link_name = "__settimeofday50"]
2746 pub fn settimeofday(tv: *const crate::timeval, tz: *const c_void) -> c_int;
2747
2748 pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int;
2749
2750 pub fn kqueue1(flags: c_int) -> c_int;
2751
2752 pub fn _lwp_self() -> lwpid_t;
2753 pub fn memmem(
2754 haystack: *const c_void,
2755 haystacklen: size_t,
2756 needle: *const c_void,
2757 needlelen: size_t,
2758 ) -> *mut c_void;
2759
2760 // link.h
2761
2762 pub fn dl_iterate_phdr(
2763 callback: Option<
2764 unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int,
2765 >,
2766 data: *mut c_void,
2767 ) -> c_int;
2768
2769 // dlfcn.h
2770
2771 pub fn _dlauxinfo() -> *mut c_void;
2772
2773 pub fn iconv_open(tocode: *const c_char, fromcode: *const c_char) -> iconv_t;
2774 pub fn iconv(
2775 cd: iconv_t,
2776 inbuf: *mut *mut c_char,
2777 inbytesleft: *mut size_t,
2778 outbuf: *mut *mut c_char,
2779 outbytesleft: *mut size_t,
2780 ) -> size_t;
2781 pub fn iconv_close(cd: iconv_t) -> c_int;
2782
2783 pub fn timer_create(
2784 clockid: crate::clockid_t,
2785 sevp: *mut crate::sigevent,
2786 timerid: *mut crate::timer_t,
2787 ) -> c_int;
2788 pub fn timer_delete(timerid: crate::timer_t) -> c_int;
2789 pub fn timer_getoverrun(timerid: crate::timer_t) -> c_int;
2790 pub fn timer_gettime(timerid: crate::timer_t, curr_value: *mut crate::itimerspec) -> c_int;
2791 pub fn timer_settime(
2792 timerid: crate::timer_t,
2793 flags: c_int,
2794 new_value: *const crate::itimerspec,
2795 old_value: *mut crate::itimerspec,
2796 ) -> c_int;
2797
2798 // Added in `NetBSD` 7.0
2799 pub fn explicit_memset(b: *mut c_void, c: c_int, len: size_t);
2800 pub fn consttime_memequal(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
2801
2802 pub fn setproctitle(fmt: *const c_char, ...);
2803 pub fn mremap(
2804 oldp: *mut c_void,
2805 oldsize: size_t,
2806 newp: *mut c_void,
2807 newsize: size_t,
2808 flags: c_int,
2809 ) -> *mut c_void;
2810
2811 pub fn sched_rr_get_interval(pid: crate::pid_t, t: *mut crate::timespec) -> c_int;
2812 pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int;
2813 pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int;
2814 pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
2815 pub fn sched_setscheduler(
2816 pid: crate::pid_t,
2817 policy: c_int,
2818 param: *const crate::sched_param,
2819 ) -> c_int;
2820
2821 #[link_name = "__pollts50"]
2822 pub fn pollts(
2823 fds: *mut crate::pollfd,
2824 nfds: crate::nfds_t,
2825 ts: *const crate::timespec,
2826 sigmask: *const crate::sigset_t,
2827 ) -> c_int;
2828 pub fn ppoll(
2829 fds: *mut crate::pollfd,
2830 nfds: crate::nfds_t,
2831 ts: *const crate::timespec,
2832 sigmask: *const crate::sigset_t,
2833 ) -> c_int;
2834 pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
2835
2836 pub fn reboot(mode: c_int, bootstr: *mut c_char) -> c_int;
2837
2838 #[link_name = "___lwp_park60"]
2839 pub fn _lwp_park(
2840 clock: crate::clockid_t,
2841 flags: c_int,
2842 ts: *const crate::timespec,
2843 unpark: crate::lwpid_t,
2844 hint: *const c_void,
2845 unparkhint: *mut c_void,
2846 ) -> c_int;
2847 pub fn _lwp_unpark(lwp: crate::lwpid_t, hint: *const c_void) -> c_int;
2848 pub fn _lwp_unpark_all(
2849 targets: *const crate::lwpid_t,
2850 ntargets: size_t,
2851 hint: *const c_void,
2852 ) -> c_int;
2853 #[link_name = "__getmntinfo13"]
2854 pub fn getmntinfo(mntbufp: *mut *mut crate::statvfs, flags: c_int) -> c_int;
2855 pub fn getvfsstat(buf: *mut statvfs, bufsize: size_t, flags: c_int) -> c_int;
2856 }
2857
2858 #[link(name = "rt")]
2859 extern "C" {
2860 pub fn aio_read(aiocbp: *mut aiocb) -> c_int;
2861 pub fn aio_write(aiocbp: *mut aiocb) -> c_int;
2862 pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int;
2863 pub fn aio_error(aiocbp: *const aiocb) -> c_int;
2864 pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t;
2865 #[link_name = "__aio_suspend50"]
2866 pub fn aio_suspend(
2867 aiocb_list: *const *const aiocb,
2868 nitems: c_int,
2869 timeout: *const crate::timespec,
2870 ) -> c_int;
2871 pub fn aio_cancel(fd: c_int, aiocbp: *mut aiocb) -> c_int;
2872 pub fn lio_listio(
2873 mode: c_int,
2874 aiocb_list: *const *mut aiocb,
2875 nitems: c_int,
2876 sevp: *mut sigevent,
2877 ) -> c_int;
2878 }
2879
2880 #[link(name = "util")]
2881 extern "C" {
2882 #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
2883 pub fn getpwent_r(
2884 pwd: *mut crate::passwd,
2885 buf: *mut c_char,
2886 buflen: size_t,
2887 result: *mut *mut crate::passwd,
2888 ) -> c_int;
2889 pub fn getgrent_r(
2890 grp: *mut crate::group,
2891 buf: *mut c_char,
2892 buflen: size_t,
2893 result: *mut *mut crate::group,
2894 ) -> c_int;
2895
2896 pub fn updwtmpx(file: *const c_char, ut: *const utmpx) -> c_int;
2897 pub fn getlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx)
2898 -> *mut lastlogx;
2899 pub fn updlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx) -> c_int;
2900 pub fn utmpxname(file: *const c_char) -> c_int;
2901 pub fn getutxent() -> *mut utmpx;
2902 pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
2903 pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
2904 pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
2905 pub fn setutxent();
2906 pub fn endutxent();
2907
2908 pub fn getutmp(ux: *const utmpx, u: *mut utmp);
2909 pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
2910
2911 pub fn utpname(file: *const c_char) -> c_int;
2912 pub fn setutent();
2913 pub fn endutent();
2914 pub fn getutent() -> *mut utmp;
2915
2916 pub fn efopen(p: *const c_char, m: *const c_char) -> crate::FILE;
2917 pub fn emalloc(n: size_t) -> *mut c_void;
2918 pub fn ecalloc(n: size_t, c: size_t) -> *mut c_void;
2919 pub fn erealloc(p: *mut c_void, n: size_t) -> *mut c_void;
2920 pub fn ereallocarr(p: *mut c_void, n: size_t, s: size_t);
2921 pub fn estrdup(s: *const c_char) -> *mut c_char;
2922 pub fn estrndup(s: *const c_char, len: size_t) -> *mut c_char;
2923 pub fn estrlcpy(dst: *mut c_char, src: *const c_char, len: size_t) -> size_t;
2924 pub fn estrlcat(dst: *mut c_char, src: *const c_char, len: size_t) -> size_t;
2925 pub fn estrtoi(
2926 nptr: *const c_char,
2927 base: c_int,
2928 lo: crate::intmax_t,
2929 hi: crate::intmax_t,
2930 ) -> crate::intmax_t;
2931 pub fn estrtou(
2932 nptr: *const c_char,
2933 base: c_int,
2934 lo: crate::uintmax_t,
2935 hi: crate::uintmax_t,
2936 ) -> crate::uintmax_t;
2937 pub fn easprintf(string: *mut *mut c_char, fmt: *const c_char, ...) -> c_int;
2938 pub fn evasprintf(string: *mut *mut c_char, fmt: *const c_char, ...) -> c_int;
2939 pub fn esetfunc(
2940 cb: Option<unsafe extern "C" fn(c_int, *const c_char, ...)>,
2941 ) -> Option<unsafe extern "C" fn(c_int, *const c_char, ...)>;
2942 pub fn secure_path(path: *const c_char) -> c_int;
2943 pub fn snprintb(buf: *mut c_char, buflen: size_t, fmt: *const c_char, val: u64) -> c_int;
2944 pub fn snprintb_m(
2945 buf: *mut c_char,
2946 buflen: size_t,
2947 fmt: *const c_char,
2948 val: u64,
2949 max: size_t,
2950 ) -> c_int;
2951
2952 pub fn getbootfile() -> *const c_char;
2953 pub fn getbyteorder() -> c_int;
2954 pub fn getdiskrawname(buf: *mut c_char, buflen: size_t, name: *const c_char) -> *const c_char;
2955 pub fn getdiskcookedname(
2956 buf: *mut c_char,
2957 buflen: size_t,
2958 name: *const c_char,
2959 ) -> *const c_char;
2960 pub fn getfsspecname(buf: *mut c_char, buflen: size_t, spec: *const c_char) -> *const c_char;
2961
2962 pub fn strpct(
2963 buf: *mut c_char,
2964 bufsiz: size_t,
2965 numerator: crate::uintmax_t,
2966 denominator: crate::uintmax_t,
2967 precision: size_t,
2968 ) -> *mut c_char;
2969 pub fn strspct(
2970 buf: *mut c_char,
2971 bufsiz: size_t,
2972 numerator: crate::intmax_t,
2973 denominator: crate::intmax_t,
2974 precision: size_t,
2975 ) -> *mut c_char;
2976 #[link_name = "__login50"]
2977 pub fn login(ut: *const utmp);
2978 #[link_name = "__loginx50"]
2979 pub fn loginx(ut: *const utmpx);
2980 pub fn logout(line: *const c_char);
2981 pub fn logoutx(line: *const c_char, status: c_int, tpe: c_int);
2982 pub fn logwtmp(line: *const c_char, name: *const c_char, host: *const c_char);
2983 pub fn logwtmpx(
2984 line: *const c_char,
2985 name: *const c_char,
2986 host: *const c_char,
2987 status: c_int,
2988 tpe: c_int,
2989 );
2990
2991 pub fn getxattr(
2992 path: *const c_char,
2993 name: *const c_char,
2994 value: *mut c_void,
2995 size: size_t,
2996 ) -> ssize_t;
2997 pub fn lgetxattr(
2998 path: *const c_char,
2999 name: *const c_char,
3000 value: *mut c_void,
3001 size: size_t,
3002 ) -> ssize_t;
3003 pub fn fgetxattr(
3004 filedes: c_int,
3005 name: *const c_char,
3006 value: *mut c_void,
3007 size: size_t,
3008 ) -> ssize_t;
3009 pub fn setxattr(
3010 path: *const c_char,
3011 name: *const c_char,
3012 value: *const c_void,
3013 size: size_t,
3014 ) -> c_int;
3015 pub fn lsetxattr(
3016 path: *const c_char,
3017 name: *const c_char,
3018 value: *const c_void,
3019 size: size_t,
3020 ) -> c_int;
3021 pub fn fsetxattr(
3022 filedes: c_int,
3023 name: *const c_char,
3024 value: *const c_void,
3025 size: size_t,
3026 flags: c_int,
3027 ) -> c_int;
3028 pub fn listxattr(path: *const c_char, list: *mut c_char, size: size_t) -> ssize_t;
3029 pub fn llistxattr(path: *const c_char, list: *mut c_char, size: size_t) -> ssize_t;
3030 pub fn flistxattr(filedes: c_int, list: *mut c_char, size: size_t) -> ssize_t;
3031 pub fn removexattr(path: *const c_char, name: *const c_char) -> c_int;
3032 pub fn lremovexattr(path: *const c_char, name: *const c_char) -> c_int;
3033 pub fn fremovexattr(fd: c_int, path: *const c_char, name: *const c_char) -> c_int;
3034
3035 pub fn string_to_flags(
3036 string_p: *mut *mut c_char,
3037 setp: *mut c_ulong,
3038 clrp: *mut c_ulong,
3039 ) -> c_int;
3040 pub fn flags_to_string(flags: c_ulong, def: *const c_char) -> c_int;
3041
3042 pub fn kinfo_getvmmap(pid: crate::pid_t, cntp: *mut size_t) -> *mut kinfo_vmentry;
3043 }
3044
3045 #[link(name = "execinfo")]
3046 extern "C" {
3047 pub fn backtrace(addrlist: *mut *mut c_void, len: size_t) -> size_t;
3048 pub fn backtrace_symbols(addrlist: *const *mut c_void, len: size_t) -> *mut *mut c_char;
3049 pub fn backtrace_symbols_fd(addrlist: *const *mut c_void, len: size_t, fd: c_int) -> c_int;
3050 pub fn backtrace_symbols_fmt(
3051 addrlist: *const *mut c_void,
3052 len: size_t,
3053 fmt: *const c_char,
3054 ) -> *mut *mut c_char;
3055 pub fn backtrace_symbols_fd_fmt(
3056 addrlist: *const *mut c_void,
3057 len: size_t,
3058 fd: c_int,
3059 fmt: *const c_char,
3060 ) -> c_int;
3061 }
3062
3063 cfg_if! {
3064 if #[cfg(target_arch = "aarch64")] {
3065 mod aarch64;
3066 pub use self::aarch64::*;
3067 } else if #[cfg(target_arch = "arm")] {
3068 mod arm;
3069 pub use self::arm::*;
3070 } else if #[cfg(target_arch = "powerpc")] {
3071 mod powerpc;
3072 pub use self::powerpc::*;
3073 } else if #[cfg(target_arch = "sparc64")] {
3074 mod sparc64;
3075 pub use self::sparc64::*;
3076 } else if #[cfg(target_arch = "x86_64")] {
3077 mod x86_64;
3078 pub use self::x86_64::*;
3079 } else if #[cfg(target_arch = "x86")] {
3080 mod x86;
3081 pub use self::x86::*;
3082 } else if #[cfg(target_arch = "mips")] {
3083 mod mips;
3084 pub use self::mips::*;
3085 } else if #[cfg(target_arch = "riscv64")] {
3086 mod riscv64;
3087 pub use self::riscv64::*;
3088 } else {
3089 // Unknown target_arch
3090 }
3091 }