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