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