Debian Codegraph @

.cargo/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs

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