Debian Codegraph @

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

raw
1 use crate::prelude::*;
2 use crate::unix::bsd::O_SYNC;
3 use crate::{cmsghdr, off_t};
4
5 pub type clock_t = i64;
6 pub type suseconds_t = c_long;
7 pub type dev_t = i32;
8 pub type sigset_t = c_uint;
9 pub type blksize_t = i32;
10 pub type fsblkcnt_t = u64;
11 pub type fsfilcnt_t = u64;
12 pub type idtype_t = c_uint;
13 pub type pthread_attr_t = *mut c_void;
14 pub type pthread_mutex_t = *mut c_void;
15 pub type pthread_mutexattr_t = *mut c_void;
16 pub type pthread_cond_t = *mut c_void;
17 pub type pthread_condattr_t = *mut c_void;
18 pub type pthread_rwlock_t = *mut c_void;
19 pub type pthread_rwlockattr_t = *mut c_void;
20 pub type pthread_spinlock_t = crate::uintptr_t;
21 pub type caddr_t = *mut c_char;
22
23 // elf.h
24
25 pub type Elf32_Addr = u32;
26 pub type Elf32_Half = u16;
27 pub type Elf32_Lword = u64;
28 pub type Elf32_Off = u32;
29 pub type Elf32_Sword = i32;
30 pub type Elf32_Word = u32;
31
32 pub type Elf64_Addr = u64;
33 pub type Elf64_Half = u16;
34 pub type Elf64_Lword = u64;
35 pub type Elf64_Off = u64;
36 pub type Elf64_Sword = i32;
37 pub type Elf64_Sxword = i64;
38 pub type Elf64_Word = u32;
39 pub type Elf64_Xword = u64;
40
41 // search.h
42
43 pub type ENTRY = entry;
44 pub type ACTION = c_uint;
45
46 // spawn.h
47 pub type posix_spawnattr_t = *mut c_void;
48 pub type posix_spawn_file_actions_t = *mut c_void;
49
50 cfg_if! {
51 if #[cfg(target_pointer_width = "64")] {
52 type Elf_Addr = Elf64_Addr;
53 type Elf_Half = Elf64_Half;
54 type Elf_Phdr = Elf64_Phdr;
55 } else if #[cfg(target_pointer_width = "32")] {
56 type Elf_Addr = Elf32_Addr;
57 type Elf_Half = Elf32_Half;
58 type Elf_Phdr = Elf32_Phdr;
59 }
60 }
61
62 s! {
63 pub struct ip_mreqn {
64 pub imr_multiaddr: in_addr,
65 pub imr_address: in_addr,
66 pub imr_ifindex: c_int,
67 }
68
69 pub struct glob_t {
70 pub gl_pathc: size_t,
71 pub gl_matchc: size_t,
72 pub gl_offs: size_t,
73 pub gl_flags: c_int,
74 pub gl_pathv: *mut *mut c_char,
75 __unused1: *mut c_void,
76 __unused2: *mut c_void,
77 __unused3: *mut c_void,
78 __unused4: *mut c_void,
79 __unused5: *mut c_void,
80 __unused6: *mut c_void,
81 __unused7: *mut c_void,
82 }
83
84 pub struct lconv {
85 pub decimal_point: *mut c_char,
86 pub thousands_sep: *mut c_char,
87 pub grouping: *mut c_char,
88 pub int_curr_symbol: *mut c_char,
89 pub currency_symbol: *mut c_char,
90 pub mon_decimal_point: *mut c_char,
91 pub mon_thousands_sep: *mut c_char,
92 pub mon_grouping: *mut c_char,
93 pub positive_sign: *mut c_char,
94 pub negative_sign: *mut c_char,
95 pub int_frac_digits: c_char,
96 pub frac_digits: c_char,
97 pub p_cs_precedes: c_char,
98 pub p_sep_by_space: c_char,
99 pub n_cs_precedes: c_char,
100 pub n_sep_by_space: c_char,
101 pub p_sign_posn: c_char,
102 pub n_sign_posn: c_char,
103 pub int_p_cs_precedes: c_char,
104 pub int_p_sep_by_space: c_char,
105 pub int_n_cs_precedes: c_char,
106 pub int_n_sep_by_space: c_char,
107 pub int_p_sign_posn: c_char,
108 pub int_n_sign_posn: c_char,
109 }
110
111 pub struct ufs_args {
112 pub fspec: *mut c_char,
113 pub export_info: export_args,
114 }
115
116 pub struct mfs_args {
117 pub fspec: *mut c_char,
118 pub export_info: export_args,
119 // https://github.com/openbsd/src/blob/HEAD/sys/sys/types.h#L134
120 pub base: *mut c_char,
121 pub size: c_ulong,
122 }
123
124 pub struct iso_args {
125 pub fspec: *mut c_char,
126 pub export_info: export_args,
127 pub flags: c_int,
128 pub sess: c_int,
129 }
130
131 pub struct nfs_args {
132 pub version: c_int,
133 pub addr: *mut crate::sockaddr,
134 pub addrlen: c_int,
135 pub sotype: c_int,
136 pub proto: c_int,
137 pub fh: *mut c_uchar,
138 pub fhsize: c_int,
139 pub flags: c_int,
140 pub wsize: c_int,
141 pub rsize: c_int,
142 pub readdirsize: c_int,
143 pub timeo: c_int,
144 pub retrans: c_int,
145 pub maxgrouplist: c_int,
146 pub readahead: c_int,
147 pub leaseterm: c_int,
148 pub deadthresh: c_int,
149 pub hostname: *mut c_char,
150 pub acregmin: c_int,
151 pub acregmax: c_int,
152 pub acdirmin: c_int,
153 pub acdirmax: c_int,
154 }
155
156 pub struct msdosfs_args {
157 pub fspec: *mut c_char,
158 pub export_info: export_args,
159 pub uid: crate::uid_t,
160 pub gid: crate::gid_t,
161 pub mask: crate::mode_t,
162 pub flags: c_int,
163 }
164
165 pub struct ntfs_args {
166 pub fspec: *mut c_char,
167 pub export_info: export_args,
168 pub uid: crate::uid_t,
169 pub gid: crate::gid_t,
170 pub mode: crate::mode_t,
171 pub flag: c_ulong,
172 }
173
174 pub struct udf_args {
175 pub fspec: *mut c_char,
176 pub lastblock: u32,
177 }
178
179 pub struct tmpfs_args {
180 pub ta_version: c_int,
181 pub ta_nodes_max: crate::ino_t,
182 pub ta_size_max: off_t,
183 pub ta_root_uid: crate::uid_t,
184 pub ta_root_gid: crate::gid_t,
185 pub ta_root_mode: crate::mode_t,
186 }
187
188 pub struct fusefs_args {
189 pub name: *mut c_char,
190 pub fd: c_int,
191 pub max_read: c_int,
192 pub allow_other: c_int,
193 }
194
195 pub struct xucred {
196 pub cr_uid: crate::uid_t,
197 pub cr_gid: crate::gid_t,
198 pub cr_ngroups: c_short,
199 //https://github.com/openbsd/src/blob/HEAD/sys/sys/syslimits.h#L44
200 pub cr_groups: [crate::gid_t; 16],
201 }
202
203 pub struct export_args {
204 pub ex_flags: c_int,
205 pub ex_root: crate::uid_t,
206 pub ex_anon: xucred,
207 pub ex_addr: *mut crate::sockaddr,
208 pub ex_addrlen: c_int,
209 pub ex_mask: *mut crate::sockaddr,
210 pub ex_masklen: c_int,
211 }
212
213 pub struct ip_mreq {
214 pub imr_multiaddr: in_addr,
215 pub imr_interface: in_addr,
216 }
217
218 pub struct in_addr {
219 pub s_addr: crate::in_addr_t,
220 }
221
222 pub struct sockaddr_in {
223 pub sin_len: u8,
224 pub sin_family: crate::sa_family_t,
225 pub sin_port: crate::in_port_t,
226 pub sin_addr: crate::in_addr,
227 pub sin_zero: [i8; 8],
228 }
229
230 pub struct splice {
231 pub sp_fd: c_int,
232 pub sp_max: off_t,
233 pub sp_idle: crate::timeval,
234 }
235
236 pub struct kevent {
237 pub ident: crate::uintptr_t,
238 pub filter: c_short,
239 pub flags: c_ushort,
240 pub fflags: c_uint,
241 pub data: i64,
242 pub udata: *mut c_void,
243 }
244
245 pub struct stat {
246 pub st_mode: crate::mode_t,
247 pub st_dev: crate::dev_t,
248 pub st_ino: crate::ino_t,
249 pub st_nlink: crate::nlink_t,
250 pub st_uid: crate::uid_t,
251 pub st_gid: crate::gid_t,
252 pub st_rdev: crate::dev_t,
253 pub st_atime: crate::time_t,
254 pub st_atime_nsec: c_long,
255 pub st_mtime: crate::time_t,
256 pub st_mtime_nsec: c_long,
257 pub st_ctime: crate::time_t,
258 pub st_ctime_nsec: c_long,
259 pub st_size: off_t,
260 pub st_blocks: crate::blkcnt_t,
261 pub st_blksize: crate::blksize_t,
262 pub st_flags: u32,
263 pub st_gen: u32,
264 pub st_birthtime: crate::time_t,
265 pub st_birthtime_nsec: c_long,
266 }
267
268 pub struct statvfs {
269 pub f_bsize: c_ulong,
270 pub f_frsize: c_ulong,
271 pub f_blocks: crate::fsblkcnt_t,
272 pub f_bfree: crate::fsblkcnt_t,
273 pub f_bavail: crate::fsblkcnt_t,
274 pub f_files: crate::fsfilcnt_t,
275 pub f_ffree: crate::fsfilcnt_t,
276 pub f_favail: crate::fsfilcnt_t,
277 pub f_fsid: c_ulong,
278 pub f_flag: c_ulong,
279 pub f_namemax: c_ulong,
280 }
281
282 pub struct addrinfo {
283 pub ai_flags: c_int,
284 pub ai_family: c_int,
285 pub ai_socktype: c_int,
286 pub ai_protocol: c_int,
287 pub ai_addrlen: crate::socklen_t,
288 pub ai_addr: *mut crate::sockaddr,
289 pub ai_canonname: *mut c_char,
290 pub ai_next: *mut crate::addrinfo,
291 }
292
293 pub struct Dl_info {
294 pub dli_fname: *const c_char,
295 pub dli_fbase: *mut c_void,
296 pub dli_sname: *const c_char,
297 pub dli_saddr: *mut c_void,
298 }
299
300 pub struct if_data {
301 pub ifi_type: c_uchar,
302 pub ifi_addrlen: c_uchar,
303 pub ifi_hdrlen: c_uchar,
304 pub ifi_link_state: c_uchar,
305 pub ifi_mtu: u32,
306 pub ifi_metric: u32,
307 pub ifi_rdomain: u32,
308 pub ifi_baudrate: u64,
309 pub ifi_ipackets: u64,
310 pub ifi_ierrors: u64,
311 pub ifi_opackets: u64,
312 pub ifi_oerrors: u64,
313 pub ifi_collisions: u64,
314 pub ifi_ibytes: u64,
315 pub ifi_obytes: u64,
316 pub ifi_imcasts: u64,
317 pub ifi_omcasts: u64,
318 pub ifi_iqdrops: u64,
319 pub ifi_oqdrops: u64,
320 pub ifi_noproto: u64,
321 pub ifi_capabilities: u32,
322 pub ifi_lastchange: crate::timeval,
323 }
324
325 pub struct if_msghdr {
326 pub ifm_msglen: c_ushort,
327 pub ifm_version: c_uchar,
328 pub ifm_type: c_uchar,
329 pub ifm_hdrlen: c_ushort,
330 pub ifm_index: c_ushort,
331 pub ifm_tableid: c_ushort,
332 pub ifm_pad1: c_uchar,
333 pub ifm_pad2: c_uchar,
334 pub ifm_addrs: c_int,
335 pub ifm_flags: c_int,
336 pub ifm_xflags: c_int,
337 pub ifm_data: if_data,
338 }
339
340 pub struct sockaddr_dl {
341 pub sdl_len: c_uchar,
342 pub sdl_family: c_uchar,
343 pub sdl_index: c_ushort,
344 pub sdl_type: c_uchar,
345 pub sdl_nlen: c_uchar,
346 pub sdl_alen: c_uchar,
347 pub sdl_slen: c_uchar,
348 pub sdl_data: [c_char; 24],
349 }
350
351 pub struct sockpeercred {
352 pub uid: crate::uid_t,
353 pub gid: crate::gid_t,
354 pub pid: crate::pid_t,
355 }
356
357 pub struct arphdr {
358 pub ar_hrd: u16,
359 pub ar_pro: u16,
360 pub ar_hln: u8,
361 pub ar_pln: u8,
362 pub ar_op: u16,
363 }
364
365 pub struct shmid_ds {
366 pub shm_perm: crate::ipc_perm,
367 pub shm_segsz: c_int,
368 pub shm_lpid: crate::pid_t,
369 pub shm_cpid: crate::pid_t,
370 pub shm_nattch: c_short,
371 pub shm_atime: crate::time_t,
372 __shm_atimensec: c_long,
373 pub shm_dtime: crate::time_t,
374 __shm_dtimensec: c_long,
375 pub shm_ctime: crate::time_t,
376 __shm_ctimensec: c_long,
377 pub shm_internal: *mut c_void,
378 }
379
380 // elf.h
381 pub struct Elf32_Phdr {
382 pub p_type: Elf32_Word,
383 pub p_offset: Elf32_Off,
384 pub p_vaddr: Elf32_Addr,
385 pub p_paddr: Elf32_Addr,
386 pub p_filesz: Elf32_Word,
387 pub p_memsz: Elf32_Word,
388 pub p_flags: Elf32_Word,
389 pub p_align: Elf32_Word,
390 }
391
392 pub struct Elf64_Phdr {
393 pub p_type: Elf64_Word,
394 pub p_flags: Elf64_Word,
395 pub p_offset: Elf64_Off,
396 pub p_vaddr: Elf64_Addr,
397 pub p_paddr: Elf64_Addr,
398 pub p_filesz: Elf64_Xword,
399 pub p_memsz: Elf64_Xword,
400 pub p_align: Elf64_Xword,
401 }
402
403 // link.h
404
405 pub struct dl_phdr_info {
406 pub dlpi_addr: Elf_Addr,
407 pub dlpi_name: *const c_char,
408 pub dlpi_phdr: *const Elf_Phdr,
409 pub dlpi_phnum: Elf_Half,
410 }
411
412 // sys/sysctl.h
413 pub struct kinfo_proc {
414 pub p_forw: u64,
415 pub p_back: u64,
416 pub p_paddr: u64,
417 pub p_addr: u64,
418 pub p_fd: u64,
419 pub p_stats: u64,
420 pub p_limit: u64,
421 pub p_vmspace: u64,
422 pub p_sigacts: u64,
423 pub p_sess: u64,
424 pub p_tsess: u64,
425 pub p_ru: u64,
426 pub p_eflag: i32,
427 pub p_exitsig: i32,
428 pub p_flag: i32,
429 pub p_pid: i32,
430 pub p_ppid: i32,
431 pub p_sid: i32,
432 pub p__pgid: i32,
433 pub p_tpgid: i32,
434 pub p_uid: u32,
435 pub p_ruid: u32,
436 pub p_gid: u32,
437 pub p_rgid: u32,
438 pub p_groups: [u32; KI_NGROUPS as usize],
439 pub p_ngroups: i16,
440 pub p_jobc: i16,
441 pub p_tdev: u32,
442 pub p_estcpu: u32,
443 pub p_rtime_sec: u32,
444 pub p_rtime_usec: u32,
445 pub p_cpticks: i32,
446 pub p_pctcpu: u32,
447 pub p_swtime: u32,
448 pub p_slptime: u32,
449 pub p_schedflags: i32,
450 pub p_uticks: u64,
451 pub p_sticks: u64,
452 pub p_iticks: u64,
453 pub p_tracep: u64,
454 pub p_traceflag: i32,
455 pub p_holdcnt: i32,
456 pub p_siglist: i32,
457 pub p_sigmask: u32,
458 pub p_sigignore: u32,
459 pub p_sigcatch: u32,
460 pub p_stat: i8,
461 pub p_priority: u8,
462 pub p_usrpri: u8,
463 pub p_nice: u8,
464 pub p_xstat: u16,
465 pub p_spare: u16,
466 pub p_comm: [c_char; KI_MAXCOMLEN as usize],
467 pub p_wmesg: [c_char; KI_WMESGLEN as usize],
468 pub p_wchan: u64,
469 pub p_login: [c_char; KI_MAXLOGNAME as usize],
470 pub p_vm_rssize: i32,
471 pub p_vm_tsize: i32,
472 pub p_vm_dsize: i32,
473 pub p_vm_ssize: i32,
474 pub p_uvalid: i64,
475 pub p_ustart_sec: u64,
476 pub p_ustart_usec: u32,
477 pub p_uutime_sec: u32,
478 pub p_uutime_usec: u32,
479 pub p_ustime_sec: u32,
480 pub p_ustime_usec: u32,
481 pub p_uru_maxrss: u64,
482 pub p_uru_ixrss: u64,
483 pub p_uru_idrss: u64,
484 pub p_uru_isrss: u64,
485 pub p_uru_minflt: u64,
486 pub p_uru_majflt: u64,
487 pub p_uru_nswap: u64,
488 pub p_uru_inblock: u64,
489 pub p_uru_oublock: u64,
490 pub p_uru_msgsnd: u64,
491 pub p_uru_msgrcv: u64,
492 pub p_uru_nsignals: u64,
493 pub p_uru_nvcsw: u64,
494 pub p_uru_nivcsw: u64,
495 pub p_uctime_sec: u32,
496 pub p_uctime_usec: u32,
497 pub p_psflags: u32,
498 pub p_acflag: u32,
499 pub p_svuid: u32,
500 pub p_svgid: u32,
501 pub p_emul: [c_char; KI_EMULNAMELEN as usize],
502 pub p_rlim_rss_cur: u64,
503 pub p_cpuid: u64,
504 pub p_vm_map_size: u64,
505 pub p_tid: i32,
506 pub p_rtableid: u32,
507 pub p_pledge: u64,
508 pub p_name: [c_char; KI_MAXCOMLEN as usize],
509 }
510
511 pub struct kinfo_vmentry {
512 pub kve_start: c_ulong,
513 pub kve_end: c_ulong,
514 pub kve_guard: c_ulong,
515 pub kve_fspace: c_ulong,
516 pub kve_fspace_augment: c_ulong,
517 pub kve_offset: u64,
518 pub kve_wired_count: c_int,
519 pub kve_etype: c_int,
520 pub kve_protection: c_int,
521 pub kve_max_protection: c_int,
522 pub kve_advice: c_int,
523 pub kve_inheritance: c_int,
524 pub kve_flags: u8,
525 }
526
527 pub struct ptrace_state {
528 pub pe_report_event: c_int,
529 pub pe_other_pid: crate::pid_t,
530 pub pe_tid: crate::pid_t,
531 }
532
533 pub struct ptrace_thread_state {
534 pub pts_tid: crate::pid_t,
535 }
536
537 // search.h
538 pub struct entry {
539 pub key: *mut c_char,
540 pub data: *mut c_void,
541 }
542
543 pub struct ifreq {
544 pub ifr_name: [c_char; crate::IFNAMSIZ],
545 pub ifr_ifru: __c_anonymous_ifr_ifru,
546 }
547
548 pub struct tcp_info {
549 pub tcpi_state: u8,
550 pub __tcpi_ca_state: u8,
551 pub __tcpi_retransmits: u8,
552 pub __tcpi_probes: u8,
553 pub __tcpi_backoff: u8,
554 pub tcpi_options: u8,
555 pub tcpi_snd_wscale: u8,
556 pub tcpi_rcv_wscale: u8,
557 pub tcpi_rto: u32,
558 pub __tcpi_ato: u32,
559 pub tcpi_snd_mss: u32,
560 pub tcpi_rcv_mss: u32,
561 pub __tcpi_unacked: u32,
562 pub __tcpi_sacked: u32,
563 pub __tcpi_lost: u32,
564 pub __tcpi_retrans: u32,
565 pub __tcpi_fackets: u32,
566 pub tcpi_last_data_sent: u32,
567 pub tcpi_last_ack_sent: u32,
568 pub tcpi_last_data_recv: u32,
569 pub tcpi_last_ack_recv: u32,
570 pub __tcpi_pmtu: u32,
571 pub __tcpi_rcv_ssthresh: u32,
572 pub tcpi_rtt: u32,
573 pub tcpi_rttvar: u32,
574 pub tcpi_snd_ssthresh: u32,
575 pub tcpi_snd_cwnd: u32,
576 pub __tcpi_advmss: u32,
577 pub __tcpi_reordering: u32,
578 pub __tcpi_rcv_rtt: u32,
579 pub tcpi_rcv_space: u32,
580 pub tcpi_snd_wnd: u32,
581 pub tcpi_snd_nxt: u32,
582 pub tcpi_rcv_nxt: u32,
583 pub tcpi_toe_tid: u32,
584 pub tcpi_snd_rexmitpack: u32,
585 pub tcpi_rcv_ooopack: u32,
586 pub tcpi_snd_zerowin: u32,
587 pub tcpi_rttmin: u32,
588 pub tcpi_max_sndwnd: u32,
589 pub tcpi_rcv_adv: u32,
590 pub tcpi_rcv_up: u32,
591 pub tcpi_snd_una: u32,
592 pub tcpi_snd_up: u32,
593 pub tcpi_snd_wl1: u32,
594 pub tcpi_snd_wl2: u32,
595 pub tcpi_snd_max: u32,
596 pub tcpi_ts_recent: u32,
597 pub tcpi_ts_recent_age: u32,
598 pub tcpi_rfbuf_cnt: u32,
599 pub tcpi_rfbuf_ts: u32,
600 pub tcpi_so_rcv_sb_cc: u32,
601 pub tcpi_so_rcv_sb_hiwat: u32,
602 pub tcpi_so_rcv_sb_lowat: u32,
603 pub tcpi_so_rcv_sb_wat: u32,
604 pub tcpi_so_snd_sb_cc: u32,
605 pub tcpi_so_snd_sb_hiwat: u32,
606 pub tcpi_so_snd_sb_lowat: u32,
607 pub tcpi_so_snd_sb_wat: u32,
608 }
609 }
610
611 impl siginfo_t {
612 pub unsafe fn si_addr(&self) -> *mut c_char {
613 self.si_addr
614 }
615
616 pub unsafe fn si_code(&self) -> c_int {
617 self.si_code
618 }
619
620 pub unsafe fn si_errno(&self) -> c_int {
621 self.si_errno
622 }
623
624 pub unsafe fn si_pid(&self) -> crate::pid_t {
625 #[repr(C)]
626 struct siginfo_timer {
627 _si_signo: c_int,
628 _si_code: c_int,
629 _si_errno: c_int,
630 _pad: [c_int; SI_PAD],
631 _pid: crate::pid_t,
632 }
633 (*(self as *const siginfo_t as *const siginfo_timer))._pid
634 }
635
636 pub unsafe fn si_uid(&self) -> crate::uid_t {
637 #[repr(C)]
638 struct siginfo_timer {
639 _si_signo: c_int,
640 _si_code: c_int,
641 _si_errno: c_int,
642 _pad: [c_int; SI_PAD],
643 _pid: crate::pid_t,
644 _uid: crate::uid_t,
645 }
646 (*(self as *const siginfo_t as *const siginfo_timer))._uid
647 }
648
649 pub unsafe fn si_value(&self) -> crate::sigval {
650 #[repr(C)]
651 struct siginfo_timer {
652 _si_signo: c_int,
653 _si_code: c_int,
654 _si_errno: c_int,
655 _pad: [c_int; SI_PAD],
656 _pid: crate::pid_t,
657 _uid: crate::uid_t,
658 value: crate::sigval,
659 }
660 (*(self as *const siginfo_t as *const siginfo_timer)).value
661 }
662 }
663
664 s_no_extra_traits! {
665 pub struct dirent {
666 pub d_fileno: crate::ino_t,
667 pub d_off: off_t,
668 pub d_reclen: u16,
669 pub d_type: u8,
670 pub d_namlen: u8,
671 __d_padding: [u8; 4],
672 pub d_name: [c_char; 256],
673 }
674
675 pub struct sockaddr_storage {
676 pub ss_len: u8,
677 pub ss_family: crate::sa_family_t,
678 __ss_pad1: [u8; 6],
679 __ss_pad2: i64,
680 __ss_pad3: [u8; 240],
681 }
682
683 pub struct siginfo_t {
684 pub si_signo: c_int,
685 pub si_code: c_int,
686 pub si_errno: c_int,
687 pub si_addr: *mut c_char,
688 #[cfg(target_pointer_width = "32")]
689 __pad: [u8; 112],
690 #[cfg(target_pointer_width = "64")]
691 __pad: [u8; 108],
692 }
693
694 pub struct lastlog {
695 ll_time: crate::time_t,
696 ll_line: [c_char; UT_LINESIZE],
697 ll_host: [c_char; UT_HOSTSIZE],
698 }
699
700 pub struct utmp {
701 pub ut_line: [c_char; UT_LINESIZE],
702 pub ut_name: [c_char; UT_NAMESIZE],
703 pub ut_host: [c_char; UT_HOSTSIZE],
704 pub ut_time: crate::time_t,
705 }
706
707 pub union mount_info {
708 pub ufs_args: ufs_args,
709 pub mfs_args: mfs_args,
710 pub nfs_args: nfs_args,
711 pub iso_args: iso_args,
712 pub msdosfs_args: msdosfs_args,
713 pub ntfs_args: ntfs_args,
714 pub tmpfs_args: tmpfs_args,
715 align: [c_char; 160],
716 }
717
718 pub union __c_anonymous_ifr_ifru {
719 pub ifru_addr: crate::sockaddr,
720 pub ifru_dstaddr: crate::sockaddr,
721 pub ifru_broadaddr: crate::sockaddr,
722 pub ifru_flags: c_short,
723 pub ifru_metric: c_int,
724 pub ifru_vnetid: i64,
725 pub ifru_media: u64,
726 pub ifru_data: crate::caddr_t,
727 pub ifru_index: c_uint,
728 }
729
730 // This type uses the union mount_info:
731 pub struct statfs {
732 pub f_flags: u32,
733 pub f_bsize: u32,
734 pub f_iosize: u32,
735 pub f_blocks: u64,
736 pub f_bfree: u64,
737 pub f_bavail: i64,
738 pub f_files: u64,
739 pub f_ffree: u64,
740 pub f_favail: i64,
741 pub f_syncwrites: u64,
742 pub f_syncreads: u64,
743 pub f_asyncwrites: u64,
744 pub f_asyncreads: u64,
745 pub f_fsid: crate::fsid_t,
746 pub f_namemax: u32,
747 pub f_owner: crate::uid_t,
748 pub f_ctime: u64,
749 pub f_fstypename: [c_char; 16],
750 pub f_mntonname: [c_char; 90],
751 pub f_mntfromname: [c_char; 90],
752 pub f_mntfromspec: [c_char; 90],
753 pub mount_info: mount_info,
754 }
755 }
756
757 cfg_if! {
758 if #[cfg(feature = "extra_traits")] {
759 impl PartialEq for dirent {
760 fn eq(&self, other: &dirent) -> bool {
761 self.d_fileno == other.d_fileno
762 && self.d_off == other.d_off
763 && self.d_reclen == other.d_reclen
764 && self.d_type == other.d_type
765 && self.d_namlen == other.d_namlen
766 && self
767 .d_name
768 .iter()
769 .zip(other.d_name.iter())
770 .all(|(a, b)| a == b)
771 }
772 }
773
774 impl Eq for dirent {}
775
776 impl fmt::Debug for dirent {
777 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
778 f.debug_struct("dirent")
779 .field("d_fileno", &self.d_fileno)
780 .field("d_off", &self.d_off)
781 .field("d_reclen", &self.d_reclen)
782 .field("d_type", &self.d_type)
783 .field("d_namlen", &self.d_namlen)
784 // FIXME(debug): .field("d_name", &self.d_name)
785 .finish()
786 }
787 }
788
789 impl hash::Hash for dirent {
790 fn hash<H: hash::Hasher>(&self, state: &mut H) {
791 self.d_fileno.hash(state);
792 self.d_off.hash(state);
793 self.d_reclen.hash(state);
794 self.d_type.hash(state);
795 self.d_namlen.hash(state);
796 self.d_name.hash(state);
797 }
798 }
799
800 impl PartialEq for sockaddr_storage {
801 fn eq(&self, other: &sockaddr_storage) -> bool {
802 self.ss_len == other.ss_len && self.ss_family == other.ss_family
803 }
804 }
805
806 impl Eq for sockaddr_storage {}
807
808 impl fmt::Debug for sockaddr_storage {
809 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
810 f.debug_struct("sockaddr_storage")
811 .field("ss_len", &self.ss_len)
812 .field("ss_family", &self.ss_family)
813 .finish()
814 }
815 }
816
817 impl hash::Hash for sockaddr_storage {
818 fn hash<H: hash::Hasher>(&self, state: &mut H) {
819 self.ss_len.hash(state);
820 self.ss_family.hash(state);
821 }
822 }
823
824 impl PartialEq for siginfo_t {
825 fn eq(&self, other: &siginfo_t) -> bool {
826 self.si_signo == other.si_signo
827 && self.si_code == other.si_code
828 && self.si_errno == other.si_errno
829 && self.si_addr == other.si_addr
830 }
831 }
832
833 impl Eq for siginfo_t {}
834
835 impl fmt::Debug for siginfo_t {
836 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
837 f.debug_struct("siginfo_t")
838 .field("si_signo", &self.si_signo)
839 .field("si_code", &self.si_code)
840 .field("si_errno", &self.si_errno)
841 .field("si_addr", &self.si_addr)
842 .finish()
843 }
844 }
845
846 impl hash::Hash for siginfo_t {
847 fn hash<H: hash::Hasher>(&self, state: &mut H) {
848 self.si_signo.hash(state);
849 self.si_code.hash(state);
850 self.si_errno.hash(state);
851 self.si_addr.hash(state);
852 }
853 }
854
855 impl PartialEq for lastlog {
856 fn eq(&self, other: &lastlog) -> bool {
857 self.ll_time == other.ll_time
858 && self
859 .ll_line
860 .iter()
861 .zip(other.ll_line.iter())
862 .all(|(a, b)| a == b)
863 && self
864 .ll_host
865 .iter()
866 .zip(other.ll_host.iter())
867 .all(|(a, b)| a == b)
868 }
869 }
870
871 impl Eq for lastlog {}
872
873 impl fmt::Debug for lastlog {
874 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
875 f.debug_struct("lastlog")
876 .field("ll_time", &self.ll_time)
877 // FIXME(debug): .field("ll_line", &self.ll_line)
878 // FIXME(debug): .field("ll_host", &self.ll_host)
879 .finish()
880 }
881 }
882
883 impl hash::Hash for lastlog {
884 fn hash<H: hash::Hasher>(&self, state: &mut H) {
885 self.ll_time.hash(state);
886 self.ll_line.hash(state);
887 self.ll_host.hash(state);
888 }
889 }
890
891 impl PartialEq for utmp {
892 fn eq(&self, other: &utmp) -> bool {
893 self.ut_time == other.ut_time
894 && self
895 .ut_line
896 .iter()
897 .zip(other.ut_line.iter())
898 .all(|(a, b)| a == b)
899 && self
900 .ut_name
901 .iter()
902 .zip(other.ut_name.iter())
903 .all(|(a, b)| a == b)
904 && self
905 .ut_host
906 .iter()
907 .zip(other.ut_host.iter())
908 .all(|(a, b)| a == b)
909 }
910 }
911
912 impl Eq for utmp {}
913
914 impl fmt::Debug for utmp {
915 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
916 f.debug_struct("utmp")
917 // FIXME(debug): .field("ut_line", &self.ut_line)
918 // FIXME(debug): .field("ut_name", &self.ut_name)
919 // FIXME(debug): .field("ut_host", &self.ut_host)
920 .field("ut_time", &self.ut_time)
921 .finish()
922 }
923 }
924
925 impl hash::Hash for utmp {
926 fn hash<H: hash::Hasher>(&self, state: &mut H) {
927 self.ut_line.hash(state);
928 self.ut_name.hash(state);
929 self.ut_host.hash(state);
930 self.ut_time.hash(state);
931 }
932 }
933
934 impl PartialEq for mount_info {
935 fn eq(&self, other: &mount_info) -> bool {
936 unsafe {
937 self.align
938 .iter()
939 .zip(other.align.iter())
940 .all(|(a, b)| a == b)
941 }
942 }
943 }
944
945 impl Eq for mount_info {}
946
947 impl hash::Hash for mount_info {
948 fn hash<H: hash::Hasher>(&self, state: &mut H) {
949 unsafe { self.align.hash(state) };
950 }
951 }
952
953 impl PartialEq for __c_anonymous_ifr_ifru {
954 fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool {
955 unsafe {
956 self.ifru_addr == other.ifru_addr
957 && self.ifru_dstaddr == other.ifru_dstaddr
958 && self.ifru_broadaddr == other.ifru_broadaddr
959 && self.ifru_flags == other.ifru_flags
960 && self.ifru_metric == other.ifru_metric
961 && self.ifru_vnetid == other.ifru_vnetid
962 && self.ifru_media == other.ifru_media
963 && self.ifru_data == other.ifru_data
964 && self.ifru_index == other.ifru_index
965 }
966 }
967 }
968
969 impl Eq for __c_anonymous_ifr_ifru {}
970
971 impl hash::Hash for __c_anonymous_ifr_ifru {
972 fn hash<H: hash::Hasher>(&self, state: &mut H) {
973 unsafe {
974 self.ifru_addr.hash(state);
975 self.ifru_dstaddr.hash(state);
976 self.ifru_broadaddr.hash(state);
977 self.ifru_flags.hash(state);
978 self.ifru_metric.hash(state);
979 self.ifru_vnetid.hash(state);
980 self.ifru_media.hash(state);
981 self.ifru_data.hash(state);
982 self.ifru_index.hash(state);
983 }
984 }
985 }
986
987 impl PartialEq for statfs {
988 fn eq(&self, other: &statfs) -> bool {
989 self.f_flags == other.f_flags
990 && self.f_bsize == other.f_bsize
991 && self.f_iosize == other.f_iosize
992 && self.f_blocks == other.f_blocks
993 && self.f_bfree == other.f_bfree
994 && self.f_bavail == other.f_bavail
995 && self.f_files == other.f_files
996 && self.f_ffree == other.f_ffree
997 && self.f_favail == other.f_favail
998 && self.f_syncwrites == other.f_syncwrites
999 && self.f_syncreads == other.f_syncreads
1000 && self.f_asyncwrites == other.f_asyncwrites
1001 && self.f_asyncreads == other.f_asyncreads
1002 && self.f_fsid == other.f_fsid
1003 && self.f_namemax == other.f_namemax
1004 && self.f_owner == other.f_owner
1005 && self.f_ctime == other.f_ctime
1006 && self
1007 .f_fstypename
1008 .iter()
1009 .zip(other.f_fstypename.iter())
1010 .all(|(a, b)| a == b)
1011 && self
1012 .f_mntonname
1013 .iter()
1014 .zip(other.f_mntonname.iter())
1015 .all(|(a, b)| a == b)
1016 && self
1017 .f_mntfromname
1018 .iter()
1019 .zip(other.f_mntfromname.iter())
1020 .all(|(a, b)| a == b)
1021 && self
1022 .f_mntfromspec
1023 .iter()
1024 .zip(other.f_mntfromspec.iter())
1025 .all(|(a, b)| a == b)
1026 && self.mount_info == other.mount_info
1027 }
1028 }
1029
1030 impl Eq for statfs {}
1031
1032 impl fmt::Debug for statfs {
1033 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1034 f.debug_struct("statfs")
1035 .field("f_flags", &self.f_flags)
1036 .field("f_bsize", &self.f_bsize)
1037 .field("f_iosize", &self.f_iosize)
1038 .field("f_blocks", &self.f_blocks)
1039 .field("f_bfree", &self.f_bfree)
1040 .field("f_bavail", &self.f_bavail)
1041 .field("f_files", &self.f_files)
1042 .field("f_ffree", &self.f_ffree)
1043 .field("f_favail", &self.f_favail)
1044 .field("f_syncwrites", &self.f_syncwrites)
1045 .field("f_syncreads", &self.f_syncreads)
1046 .field("f_asyncwrites", &self.f_asyncwrites)
1047 .field("f_asyncreads", &self.f_asyncreads)
1048 .field("f_fsid", &self.f_fsid)
1049 .field("f_namemax", &self.f_namemax)
1050 .field("f_owner", &self.f_owner)
1051 .field("f_ctime", &self.f_ctime)
1052 // FIXME(debug): .field("f_fstypename", &self.f_fstypename)
1053 // FIXME(debug): .field("f_mntonname", &self.f_mntonname)
1054 // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname)
1055 // FIXME(debug): .field("f_mntfromspec", &self.f_mntfromspec)
1056 .field("mount_info", &self.mount_info)
1057 .finish()
1058 }
1059 }
1060
1061 impl hash::Hash for statfs {
1062 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1063 self.f_flags.hash(state);
1064 self.f_bsize.hash(state);
1065 self.f_iosize.hash(state);
1066 self.f_blocks.hash(state);
1067 self.f_bfree.hash(state);
1068 self.f_bavail.hash(state);
1069 self.f_files.hash(state);
1070 self.f_ffree.hash(state);
1071 self.f_favail.hash(state);
1072 self.f_syncwrites.hash(state);
1073 self.f_syncreads.hash(state);
1074 self.f_asyncwrites.hash(state);
1075 self.f_asyncreads.hash(state);
1076 self.f_fsid.hash(state);
1077 self.f_namemax.hash(state);
1078 self.f_owner.hash(state);
1079 self.f_ctime.hash(state);
1080 self.f_fstypename.hash(state);
1081 self.f_mntonname.hash(state);
1082 self.f_mntfromname.hash(state);
1083 self.f_mntfromspec.hash(state);
1084 self.mount_info.hash(state);
1085 }
1086 }
1087 }
1088 }
1089
1090 pub const UT_NAMESIZE: usize = 32;
1091 pub const UT_LINESIZE: usize = 8;
1092 pub const UT_HOSTSIZE: usize = 256;
1093
1094 pub const O_CLOEXEC: c_int = 0x10000;
1095 pub const O_DIRECTORY: c_int = 0x20000;
1096 pub const O_RSYNC: c_int = O_SYNC;
1097
1098 pub const MS_SYNC: c_int = 0x0002;
1099 pub const MS_INVALIDATE: c_int = 0x0004;
1100
1101 pub const POLLNORM: c_short = crate::POLLRDNORM;
1102
1103 pub const ENOATTR: c_int = 83;
1104 pub const EILSEQ: c_int = 84;
1105 pub const EOVERFLOW: c_int = 87;
1106 pub const ECANCELED: c_int = 88;
1107 pub const EIDRM: c_int = 89;
1108 pub const ENOMSG: c_int = 90;
1109 pub const ENOTSUP: c_int = 91;
1110 pub const EBADMSG: c_int = 92;
1111 pub const ENOTRECOVERABLE: c_int = 93;
1112 pub const EOWNERDEAD: c_int = 94;
1113 pub const EPROTO: c_int = 95;
1114 pub const ELAST: c_int = 95;
1115
1116 pub const F_DUPFD_CLOEXEC: c_int = 10;
1117
1118 pub const UTIME_OMIT: c_long = -1;
1119 pub const UTIME_NOW: c_long = -2;
1120
1121 pub const AT_FDCWD: c_int = -100;
1122 pub const AT_EACCESS: c_int = 0x01;
1123 pub const AT_SYMLINK_NOFOLLOW: c_int = 0x02;
1124 pub const AT_SYMLINK_FOLLOW: c_int = 0x04;
1125 pub const AT_REMOVEDIR: c_int = 0x08;
1126
1127 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1128 pub const RLIM_NLIMITS: c_int = 9;
1129
1130 pub const SO_TIMESTAMP: c_int = 0x0800;
1131 pub const SO_SNDTIMEO: c_int = 0x1005;
1132 pub const SO_RCVTIMEO: c_int = 0x1006;
1133 pub const SO_BINDANY: c_int = 0x1000;
1134 pub const SO_NETPROC: c_int = 0x1020;
1135 pub const SO_RTABLE: c_int = 0x1021;
1136 pub const SO_PEERCRED: c_int = 0x1022;
1137 pub const SO_SPLICE: c_int = 0x1023;
1138 pub const SO_DOMAIN: c_int = 0x1024;
1139 pub const SO_PROTOCOL: c_int = 0x1025;
1140
1141 // sys/netinet/in.h
1142 // Protocols (RFC 1700)
1143 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
1144
1145 // IPPROTO_IP defined in src/unix/mod.rs
1146 /// Hop-by-hop option header
1147 pub const IPPROTO_HOPOPTS: c_int = 0;
1148 // IPPROTO_ICMP defined in src/unix/mod.rs
1149 /// group mgmt protocol
1150 pub const IPPROTO_IGMP: c_int = 2;
1151 /// gateway^2 (deprecated)
1152 pub const IPPROTO_GGP: c_int = 3;
1153 /// for compatibility
1154 pub const IPPROTO_IPIP: c_int = 4;
1155 // IPPROTO_TCP defined in src/unix/mod.rs
1156 /// exterior gateway protocol
1157 pub const IPPROTO_EGP: c_int = 8;
1158 /// pup
1159 pub const IPPROTO_PUP: c_int = 12;
1160 // IPPROTO_UDP defined in src/unix/mod.rs
1161 /// xns idp
1162 pub const IPPROTO_IDP: c_int = 22;
1163 /// tp-4 w/ class negotiation
1164 pub const IPPROTO_TP: c_int = 29;
1165 // IPPROTO_IPV6 defined in src/unix/mod.rs
1166 /// IP6 routing header
1167 pub const IPPROTO_ROUTING: c_int = 43;
1168 /// IP6 fragmentation header
1169 pub const IPPROTO_FRAGMENT: c_int = 44;
1170 /// resource reservation
1171 pub const IPPROTO_RSVP: c_int = 46;
1172 /// General Routing Encap.
1173 pub const IPPROTO_GRE: c_int = 47;
1174 /// IP6 Encap Sec. Payload
1175 pub const IPPROTO_ESP: c_int = 50;
1176 /// IP6 Auth Header
1177 pub const IPPROTO_AH: c_int = 51;
1178 /// IP Mobility RFC 2004
1179 pub const IPPROTO_MOBILE: c_int = 55;
1180 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1181 /// IP6 no next header
1182 pub const IPPROTO_NONE: c_int = 59;
1183 /// IP6 destination option
1184 pub const IPPROTO_DSTOPTS: c_int = 60;
1185 /// ISO cnlp
1186 pub const IPPROTO_EON: c_int = 80;
1187 /// Ethernet-in-IP
1188 pub const IPPROTO_ETHERIP: c_int = 97;
1189 /// encapsulation header
1190 pub const IPPROTO_ENCAP: c_int = 98;
1191 /// Protocol indep. multicast
1192 pub const IPPROTO_PIM: c_int = 103;
1193 /// IP Payload Comp. Protocol
1194 pub const IPPROTO_IPCOMP: c_int = 108;
1195 /// CARP
1196 pub const IPPROTO_CARP: c_int = 112;
1197 /// unicast MPLS packet
1198 pub const IPPROTO_MPLS: c_int = 137;
1199 /// PFSYNC
1200 pub const IPPROTO_PFSYNC: c_int = 240;
1201 pub const IPPROTO_MAX: c_int = 256;
1202
1203 // Only used internally, so it can be outside the range of valid IP protocols
1204 pub const IPPROTO_DIVERT: c_int = 258;
1205
1206 pub const IP_RECVDSTADDR: c_int = 7;
1207 pub const IP_SENDSRCADDR: c_int = IP_RECVDSTADDR;
1208 pub const IP_RECVIF: c_int = 30;
1209
1210 // sys/netinet/in.h
1211 pub const TCP_MD5SIG: c_int = 0x04;
1212 pub const TCP_NOPUSH: c_int = 0x10;
1213
1214 pub const MSG_WAITFORONE: c_int = 0x1000;
1215
1216 pub const AF_ECMA: c_int = 8;
1217 pub const AF_ROUTE: c_int = 17;
1218 pub const AF_ENCAP: c_int = 28;
1219 pub const AF_SIP: c_int = 29;
1220 pub const AF_KEY: c_int = 30;
1221 pub const pseudo_AF_HDRCMPLT: c_int = 31;
1222 pub const AF_BLUETOOTH: c_int = 32;
1223 pub const AF_MPLS: c_int = 33;
1224 pub const pseudo_AF_PFLOW: c_int = 34;
1225 pub const pseudo_AF_PIPEX: c_int = 35;
1226 pub const NET_RT_DUMP: c_int = 1;
1227 pub const NET_RT_FLAGS: c_int = 2;
1228 pub const NET_RT_IFLIST: c_int = 3;
1229 pub const NET_RT_STATS: c_int = 4;
1230 pub const NET_RT_TABLE: c_int = 5;
1231 pub const NET_RT_IFNAMES: c_int = 6;
1232 #[doc(hidden)]
1233 #[deprecated(
1234 since = "0.2.95",
1235 note = "Possibly increasing over the releases and might not be so used in the field"
1236 )]
1237 pub const NET_RT_MAXID: c_int = 7;
1238
1239 pub const IPV6_JOIN_GROUP: c_int = 12;
1240 pub const IPV6_LEAVE_GROUP: c_int = 13;
1241
1242 pub const PF_ROUTE: c_int = AF_ROUTE;
1243 pub const PF_ECMA: c_int = AF_ECMA;
1244 pub const PF_ENCAP: c_int = AF_ENCAP;
1245 pub const PF_SIP: c_int = AF_SIP;
1246 pub const PF_KEY: c_int = AF_KEY;
1247 pub const PF_BPF: c_int = pseudo_AF_HDRCMPLT;
1248 pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
1249 pub const PF_MPLS: c_int = AF_MPLS;
1250 pub const PF_PFLOW: c_int = pseudo_AF_PFLOW;
1251 pub const PF_PIPEX: c_int = pseudo_AF_PIPEX;
1252
1253 pub const SCM_TIMESTAMP: c_int = 0x04;
1254
1255 pub const O_DSYNC: c_int = 128;
1256
1257 pub const MAP_RENAME: c_int = 0x0000;
1258 pub const MAP_NORESERVE: c_int = 0x0000;
1259 pub const MAP_HASSEMAPHORE: c_int = 0x0000;
1260 pub const MAP_TRYFIXED: c_int = 0;
1261
1262 pub const EIPSEC: c_int = 82;
1263 pub const ENOMEDIUM: c_int = 85;
1264 pub const EMEDIUMTYPE: c_int = 86;
1265
1266 pub const EAI_BADFLAGS: c_int = -1;
1267 pub const EAI_NONAME: c_int = -2;
1268 pub const EAI_AGAIN: c_int = -3;
1269 pub const EAI_FAIL: c_int = -4;
1270 pub const EAI_NODATA: c_int = -5;
1271 pub const EAI_FAMILY: c_int = -6;
1272 pub const EAI_SOCKTYPE: c_int = -7;
1273 pub const EAI_SERVICE: c_int = -8;
1274 pub const EAI_MEMORY: c_int = -10;
1275 pub const EAI_SYSTEM: c_int = -11;
1276 pub const EAI_OVERFLOW: c_int = -14;
1277
1278 pub const RUSAGE_THREAD: c_int = 1;
1279
1280 pub const MAP_COPY: c_int = 0x0002;
1281 pub const MAP_NOEXTEND: c_int = 0x0000;
1282
1283 pub const _PC_LINK_MAX: c_int = 1;
1284 pub const _PC_MAX_CANON: c_int = 2;
1285 pub const _PC_MAX_INPUT: c_int = 3;
1286 pub const _PC_NAME_MAX: c_int = 4;
1287 pub const _PC_PATH_MAX: c_int = 5;
1288 pub const _PC_PIPE_BUF: c_int = 6;
1289 pub const _PC_CHOWN_RESTRICTED: c_int = 7;
1290 pub const _PC_NO_TRUNC: c_int = 8;
1291 pub const _PC_VDISABLE: c_int = 9;
1292 pub const _PC_2_SYMLINKS: c_int = 10;
1293 pub const _PC_ALLOC_SIZE_MIN: c_int = 11;
1294 pub const _PC_ASYNC_IO: c_int = 12;
1295 pub const _PC_FILESIZEBITS: c_int = 13;
1296 pub const _PC_PRIO_IO: c_int = 14;
1297 pub const _PC_REC_INCR_XFER_SIZE: c_int = 15;
1298 pub const _PC_REC_MAX_XFER_SIZE: c_int = 16;
1299 pub const _PC_REC_MIN_XFER_SIZE: c_int = 17;
1300 pub const _PC_REC_XFER_ALIGN: c_int = 18;
1301 pub const _PC_SYMLINK_MAX: c_int = 19;
1302 pub const _PC_SYNC_IO: c_int = 20;
1303 pub const _PC_TIMESTAMP_RESOLUTION: c_int = 21;
1304
1305 pub const _SC_CLK_TCK: c_int = 3;
1306 pub const _SC_SEM_NSEMS_MAX: c_int = 31;
1307 pub const _SC_SEM_VALUE_MAX: c_int = 32;
1308 pub const _SC_HOST_NAME_MAX: c_int = 33;
1309 pub const _SC_MONOTONIC_CLOCK: c_int = 34;
1310 pub const _SC_2_PBS: c_int = 35;
1311 pub const _SC_2_PBS_ACCOUNTING: c_int = 36;
1312 pub const _SC_2_PBS_CHECKPOINT: c_int = 37;
1313 pub const _SC_2_PBS_LOCATE: c_int = 38;
1314 pub const _SC_2_PBS_MESSAGE: c_int = 39;
1315 pub const _SC_2_PBS_TRACK: c_int = 40;
1316 pub const _SC_ADVISORY_INFO: c_int = 41;
1317 pub const _SC_AIO_LISTIO_MAX: c_int = 42;
1318 pub const _SC_AIO_MAX: c_int = 43;
1319 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 44;
1320 pub const _SC_ASYNCHRONOUS_IO: c_int = 45;
1321 pub const _SC_ATEXIT_MAX: c_int = 46;
1322 pub const _SC_BARRIERS: c_int = 47;
1323 pub const _SC_CLOCK_SELECTION: c_int = 48;
1324 pub const _SC_CPUTIME: c_int = 49;
1325 pub const _SC_DELAYTIMER_MAX: c_int = 50;
1326 pub const _SC_IOV_MAX: c_int = 51;
1327 pub const _SC_IPV6: c_int = 52;
1328 pub const _SC_MAPPED_FILES: c_int = 53;
1329 pub const _SC_MEMLOCK: c_int = 54;
1330 pub const _SC_MEMLOCK_RANGE: c_int = 55;
1331 pub const _SC_MEMORY_PROTECTION: c_int = 56;
1332 pub const _SC_MESSAGE_PASSING: c_int = 57;
1333 pub const _SC_MQ_OPEN_MAX: c_int = 58;
1334 pub const _SC_MQ_PRIO_MAX: c_int = 59;
1335 pub const _SC_PRIORITIZED_IO: c_int = 60;
1336 pub const _SC_PRIORITY_SCHEDULING: c_int = 61;
1337 pub const _SC_RAW_SOCKETS: c_int = 62;
1338 pub const _SC_READER_WRITER_LOCKS: c_int = 63;
1339 pub const _SC_REALTIME_SIGNALS: c_int = 64;
1340 pub const _SC_REGEXP: c_int = 65;
1341 pub const _SC_RTSIG_MAX: c_int = 66;
1342 pub const _SC_SEMAPHORES: c_int = 67;
1343 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 68;
1344 pub const _SC_SHELL: c_int = 69;
1345 pub const _SC_SIGQUEUE_MAX: c_int = 70;
1346 pub const _SC_SPAWN: c_int = 71;
1347 pub const _SC_SPIN_LOCKS: c_int = 72;
1348 pub const _SC_SPORADIC_SERVER: c_int = 73;
1349 pub const _SC_SS_REPL_MAX: c_int = 74;
1350 pub const _SC_SYNCHRONIZED_IO: c_int = 75;
1351 pub const _SC_SYMLOOP_MAX: c_int = 76;
1352 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77;
1353 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78;
1354 pub const _SC_THREAD_CPUTIME: c_int = 79;
1355 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 80;
1356 pub const _SC_THREAD_KEYS_MAX: c_int = 81;
1357 pub const _SC_THREAD_PRIO_INHERIT: c_int = 82;
1358 pub const _SC_THREAD_PRIO_PROTECT: c_int = 83;
1359 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 84;
1360 pub const _SC_THREAD_PROCESS_SHARED: c_int = 85;
1361 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 86;
1362 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 87;
1363 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 88;
1364 pub const _SC_THREAD_STACK_MIN: c_int = 89;
1365 pub const _SC_THREAD_THREADS_MAX: c_int = 90;
1366 pub const _SC_THREADS: c_int = 91;
1367 pub const _SC_TIMEOUTS: c_int = 92;
1368 pub const _SC_TIMER_MAX: c_int = 93;
1369 pub const _SC_TIMERS: c_int = 94;
1370 pub const _SC_TRACE: c_int = 95;
1371 pub const _SC_TRACE_EVENT_FILTER: c_int = 96;
1372 pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 97;
1373 pub const _SC_TRACE_INHERIT: c_int = 98;
1374 pub const _SC_TRACE_LOG: c_int = 99;
1375 pub const _SC_GETGR_R_SIZE_MAX: c_int = 100;
1376 pub const _SC_GETPW_R_SIZE_MAX: c_int = 101;
1377 pub const _SC_LOGIN_NAME_MAX: c_int = 102;
1378 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 103;
1379 pub const _SC_TRACE_NAME_MAX: c_int = 104;
1380 pub const _SC_TRACE_SYS_MAX: c_int = 105;
1381 pub const _SC_TRACE_USER_EVENT_MAX: c_int = 106;
1382 pub const _SC_TTY_NAME_MAX: c_int = 107;
1383 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 108;
1384 pub const _SC_V6_ILP32_OFF32: c_int = 109;
1385 pub const _SC_V6_ILP32_OFFBIG: c_int = 110;
1386 pub const _SC_V6_LP64_OFF64: c_int = 111;
1387 pub const _SC_V6_LPBIG_OFFBIG: c_int = 112;
1388 pub const _SC_V7_ILP32_OFF32: c_int = 113;
1389 pub const _SC_V7_ILP32_OFFBIG: c_int = 114;
1390 pub const _SC_V7_LP64_OFF64: c_int = 115;
1391 pub const _SC_V7_LPBIG_OFFBIG: c_int = 116;
1392 pub const _SC_XOPEN_CRYPT: c_int = 117;
1393 pub const _SC_XOPEN_ENH_I18N: c_int = 118;
1394 pub const _SC_XOPEN_LEGACY: c_int = 119;
1395 pub const _SC_XOPEN_REALTIME: c_int = 120;
1396 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 121;
1397 pub const _SC_XOPEN_STREAMS: c_int = 122;
1398 pub const _SC_XOPEN_UNIX: c_int = 123;
1399 pub const _SC_XOPEN_UUCP: c_int = 124;
1400 pub const _SC_XOPEN_VERSION: c_int = 125;
1401 pub const _SC_PHYS_PAGES: c_int = 500;
1402 pub const _SC_AVPHYS_PAGES: c_int = 501;
1403 pub const _SC_NPROCESSORS_CONF: c_int = 502;
1404 pub const _SC_NPROCESSORS_ONLN: c_int = 503;
1405
1406 pub const FD_SETSIZE: usize = 1024;
1407
1408 pub const SCHED_FIFO: c_int = 1;
1409 pub const SCHED_OTHER: c_int = 2;
1410 pub const SCHED_RR: c_int = 3;
1411
1412 pub const ST_NOSUID: c_ulong = 2;
1413
1414 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
1415 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
1416 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
1417
1418 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
1419 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
1420 pub const PTHREAD_MUTEX_NORMAL: c_int = 3;
1421 pub const PTHREAD_MUTEX_STRICT_NP: c_int = 4;
1422 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_STRICT_NP;
1423
1424 pub const EVFILT_READ: i16 = -1;
1425 pub const EVFILT_WRITE: i16 = -2;
1426 pub const EVFILT_AIO: i16 = -3;
1427 pub const EVFILT_VNODE: i16 = -4;
1428 pub const EVFILT_PROC: i16 = -5;
1429 pub const EVFILT_SIGNAL: i16 = -6;
1430 pub const EVFILT_TIMER: i16 = -7;
1431 pub const EVFILT_DEVICE: i16 = -8;
1432 pub const EVFILT_EXCEPT: i16 = -9;
1433
1434 pub const EV_ADD: u16 = 0x1;
1435 pub const EV_DELETE: u16 = 0x2;
1436 pub const EV_ENABLE: u16 = 0x4;
1437 pub const EV_DISABLE: u16 = 0x8;
1438 pub const EV_ONESHOT: u16 = 0x10;
1439 pub const EV_CLEAR: u16 = 0x20;
1440 pub const EV_RECEIPT: u16 = 0x40;
1441 pub const EV_DISPATCH: u16 = 0x80;
1442 pub const EV_FLAG1: u16 = 0x2000;
1443 pub const EV_ERROR: u16 = 0x4000;
1444 pub const EV_EOF: u16 = 0x8000;
1445
1446 #[deprecated(since = "0.2.113", note = "Not stable across OS versions")]
1447 pub const EV_SYSFLAGS: u16 = 0xf800;
1448
1449 pub const NOTE_LOWAT: u32 = 0x00000001;
1450 pub const NOTE_EOF: u32 = 0x00000002;
1451 pub const NOTE_OOB: u32 = 0x00000004;
1452 pub const NOTE_DELETE: u32 = 0x00000001;
1453 pub const NOTE_WRITE: u32 = 0x00000002;
1454 pub const NOTE_EXTEND: u32 = 0x00000004;
1455 pub const NOTE_ATTRIB: u32 = 0x00000008;
1456 pub const NOTE_LINK: u32 = 0x00000010;
1457 pub const NOTE_RENAME: u32 = 0x00000020;
1458 pub const NOTE_REVOKE: u32 = 0x00000040;
1459 pub const NOTE_TRUNCATE: u32 = 0x00000080;
1460 pub const NOTE_EXIT: u32 = 0x80000000;
1461 pub const NOTE_FORK: u32 = 0x40000000;
1462 pub const NOTE_EXEC: u32 = 0x20000000;
1463 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
1464 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
1465 pub const NOTE_TRACK: u32 = 0x00000001;
1466 pub const NOTE_TRACKERR: u32 = 0x00000002;
1467 pub const NOTE_CHILD: u32 = 0x00000004;
1468 pub const NOTE_CHANGE: u32 = 0x00000001;
1469
1470 pub const TMP_MAX: c_uint = 0x7fffffff;
1471
1472 pub const AI_PASSIVE: c_int = 1;
1473 pub const AI_CANONNAME: c_int = 2;
1474 pub const AI_NUMERICHOST: c_int = 4;
1475 pub const AI_EXT: c_int = 8;
1476 pub const AI_NUMERICSERV: c_int = 16;
1477 pub const AI_FQDN: c_int = 32;
1478 pub const AI_ADDRCONFIG: c_int = 64;
1479
1480 pub const NI_NUMERICHOST: c_int = 1;
1481 pub const NI_NUMERICSERV: c_int = 2;
1482 pub const NI_NOFQDN: c_int = 4;
1483 pub const NI_NAMEREQD: c_int = 8;
1484 pub const NI_DGRAM: c_int = 16;
1485
1486 pub const NI_MAXHOST: size_t = 256;
1487
1488 pub const RTLD_LOCAL: c_int = 0;
1489
1490 pub const CTL_MAXNAME: c_int = 12;
1491
1492 pub const CTLTYPE_NODE: c_int = 1;
1493 pub const CTLTYPE_INT: c_int = 2;
1494 pub const CTLTYPE_STRING: c_int = 3;
1495 pub const CTLTYPE_QUAD: c_int = 4;
1496 pub const CTLTYPE_STRUCT: c_int = 5;
1497
1498 pub const CTL_UNSPEC: c_int = 0;
1499 pub const CTL_KERN: c_int = 1;
1500 pub const CTL_VM: c_int = 2;
1501 pub const CTL_FS: c_int = 3;
1502 pub const CTL_NET: c_int = 4;
1503 pub const CTL_DEBUG: c_int = 5;
1504 pub const CTL_HW: c_int = 6;
1505 pub const CTL_MACHDEP: c_int = 7;
1506 pub const CTL_DDB: c_int = 9;
1507 pub const CTL_VFS: c_int = 10;
1508 pub const CTL_MAXID: c_int = 11;
1509
1510 pub const HW_NCPUONLINE: c_int = 25;
1511
1512 pub const KERN_OSTYPE: c_int = 1;
1513 pub const KERN_OSRELEASE: c_int = 2;
1514 pub const KERN_OSREV: c_int = 3;
1515 pub const KERN_VERSION: c_int = 4;
1516 pub const KERN_MAXVNODES: c_int = 5;
1517 pub const KERN_MAXPROC: c_int = 6;
1518 pub const KERN_MAXFILES: c_int = 7;
1519 pub const KERN_ARGMAX: c_int = 8;
1520 pub const KERN_SECURELVL: c_int = 9;
1521 pub const KERN_HOSTNAME: c_int = 10;
1522 pub const KERN_HOSTID: c_int = 11;
1523 pub const KERN_CLOCKRATE: c_int = 12;
1524 pub const KERN_PROF: c_int = 16;
1525 pub const KERN_POSIX1: c_int = 17;
1526 pub const KERN_NGROUPS: c_int = 18;
1527 pub const KERN_JOB_CONTROL: c_int = 19;
1528 pub const KERN_SAVED_IDS: c_int = 20;
1529 pub const KERN_BOOTTIME: c_int = 21;
1530 pub const KERN_DOMAINNAME: c_int = 22;
1531 pub const KERN_MAXPARTITIONS: c_int = 23;
1532 pub const KERN_RAWPARTITION: c_int = 24;
1533 pub const KERN_MAXTHREAD: c_int = 25;
1534 pub const KERN_NTHREADS: c_int = 26;
1535 pub const KERN_OSVERSION: c_int = 27;
1536 pub const KERN_SOMAXCONN: c_int = 28;
1537 pub const KERN_SOMINCONN: c_int = 29;
1538 #[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")]
1539 pub const KERN_USERMOUNT: c_int = 30;
1540 pub const KERN_NOSUIDCOREDUMP: c_int = 32;
1541 pub const KERN_FSYNC: c_int = 33;
1542 pub const KERN_SYSVMSG: c_int = 34;
1543 pub const KERN_SYSVSEM: c_int = 35;
1544 pub const KERN_SYSVSHM: c_int = 36;
1545 #[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")]
1546 pub const KERN_ARND: c_int = 37;
1547 pub const KERN_MSGBUFSIZE: c_int = 38;
1548 pub const KERN_MALLOCSTATS: c_int = 39;
1549 pub const KERN_CPTIME: c_int = 40;
1550 pub const KERN_NCHSTATS: c_int = 41;
1551 pub const KERN_FORKSTAT: c_int = 42;
1552 pub const KERN_NSELCOLL: c_int = 43;
1553 pub const KERN_TTY: c_int = 44;
1554 pub const KERN_CCPU: c_int = 45;
1555 pub const KERN_FSCALE: c_int = 46;
1556 pub const KERN_NPROCS: c_int = 47;
1557 pub const KERN_MSGBUF: c_int = 48;
1558 pub const KERN_POOL: c_int = 49;
1559 pub const KERN_STACKGAPRANDOM: c_int = 50;
1560 pub const KERN_SYSVIPC_INFO: c_int = 51;
1561 pub const KERN_SPLASSERT: c_int = 54;
1562 pub const KERN_PROC_ARGS: c_int = 55;
1563 pub const KERN_NFILES: c_int = 56;
1564 pub const KERN_TTYCOUNT: c_int = 57;
1565 pub const KERN_NUMVNODES: c_int = 58;
1566 pub const KERN_MBSTAT: c_int = 59;
1567 pub const KERN_SEMINFO: c_int = 61;
1568 pub const KERN_SHMINFO: c_int = 62;
1569 pub const KERN_INTRCNT: c_int = 63;
1570 pub const KERN_WATCHDOG: c_int = 64;
1571 pub const KERN_PROC: c_int = 66;
1572 pub const KERN_MAXCLUSTERS: c_int = 67;
1573 pub const KERN_EVCOUNT: c_int = 68;
1574 pub const KERN_TIMECOUNTER: c_int = 69;
1575 pub const KERN_MAXLOCKSPERUID: c_int = 70;
1576 pub const KERN_CPTIME2: c_int = 71;
1577 pub const KERN_CACHEPCT: c_int = 72;
1578 pub const KERN_FILE: c_int = 73;
1579 pub const KERN_CONSDEV: c_int = 75;
1580 pub const KERN_NETLIVELOCKS: c_int = 76;
1581 pub const KERN_POOL_DEBUG: c_int = 77;
1582 pub const KERN_PROC_CWD: c_int = 78;
1583 pub const KERN_PROC_NOBROADCASTKILL: c_int = 79;
1584 pub const KERN_PROC_VMMAP: c_int = 80;
1585 pub const KERN_GLOBAL_PTRACE: c_int = 81;
1586 pub const KERN_CONSBUFSIZE: c_int = 82;
1587 pub const KERN_CONSBUF: c_int = 83;
1588 pub const KERN_AUDIO: c_int = 84;
1589 pub const KERN_CPUSTATS: c_int = 85;
1590 pub const KERN_PFSTATUS: c_int = 86;
1591 pub const KERN_TIMEOUT_STATS: c_int = 87;
1592 #[deprecated(
1593 since = "0.2.95",
1594 note = "Possibly increasing over the releases and might not be so used in the field"
1595 )]
1596 pub const KERN_MAXID: c_int = 88;
1597
1598 pub const KERN_PROC_ALL: c_int = 0;
1599 pub const KERN_PROC_PID: c_int = 1;
1600 pub const KERN_PROC_PGRP: c_int = 2;
1601 pub const KERN_PROC_SESSION: c_int = 3;
1602 pub const KERN_PROC_TTY: c_int = 4;
1603 pub const KERN_PROC_UID: c_int = 5;
1604 pub const KERN_PROC_RUID: c_int = 6;
1605 pub const KERN_PROC_KTHREAD: c_int = 7;
1606 pub const KERN_PROC_SHOW_THREADS: c_int = 0x40000000;
1607
1608 pub const KERN_SYSVIPC_MSG_INFO: c_int = 1;
1609 pub const KERN_SYSVIPC_SEM_INFO: c_int = 2;
1610 pub const KERN_SYSVIPC_SHM_INFO: c_int = 3;
1611
1612 pub const KERN_PROC_ARGV: c_int = 1;
1613 pub const KERN_PROC_NARGV: c_int = 2;
1614 pub const KERN_PROC_ENV: c_int = 3;
1615 pub const KERN_PROC_NENV: c_int = 4;
1616
1617 pub const KI_NGROUPS: c_int = 16;
1618 pub const KI_MAXCOMLEN: c_int = 24;
1619 pub const KI_WMESGLEN: c_int = 8;
1620 pub const KI_MAXLOGNAME: c_int = 32;
1621 pub const KI_EMULNAMELEN: c_int = 8;
1622
1623 pub const KVE_ET_OBJ: c_int = 0x00000001;
1624 pub const KVE_ET_SUBMAP: c_int = 0x00000002;
1625 pub const KVE_ET_COPYONWRITE: c_int = 0x00000004;
1626 pub const KVE_ET_NEEDSCOPY: c_int = 0x00000008;
1627 pub const KVE_ET_HOLE: c_int = 0x00000010;
1628 pub const KVE_ET_NOFAULT: c_int = 0x00000020;
1629 pub const KVE_ET_STACK: c_int = 0x00000040;
1630 pub const KVE_ET_WC: c_int = 0x000000080;
1631 pub const KVE_ET_CONCEAL: c_int = 0x000000100;
1632 pub const KVE_ET_SYSCALL: c_int = 0x000000200;
1633 pub const KVE_ET_FREEMAPPED: c_int = 0x000000800;
1634
1635 pub const KVE_PROT_NONE: c_int = 0x00000000;
1636 pub const KVE_PROT_READ: c_int = 0x00000001;
1637 pub const KVE_PROT_WRITE: c_int = 0x00000002;
1638 pub const KVE_PROT_EXEC: c_int = 0x00000004;
1639
1640 pub const KVE_ADV_NORMAL: c_int = 0x00000000;
1641 pub const KVE_ADV_RANDOM: c_int = 0x00000001;
1642 pub const KVE_ADV_SEQUENTIAL: c_int = 0x00000002;
1643
1644 pub const KVE_INH_SHARE: c_int = 0x00000000;
1645 pub const KVE_INH_COPY: c_int = 0x00000010;
1646 pub const KVE_INH_NONE: c_int = 0x00000020;
1647 pub const KVE_INH_ZERO: c_int = 0x00000030;
1648
1649 pub const KVE_F_STATIC: c_int = 0x1;
1650 pub const KVE_F_KMEM: c_int = 0x2;
1651
1652 pub const CHWFLOW: crate::tcflag_t = crate::MDMBUF | crate::CRTSCTS;
1653 pub const OLCUC: crate::tcflag_t = 0x20;
1654 pub const ONOCR: crate::tcflag_t = 0x40;
1655 pub const ONLRET: crate::tcflag_t = 0x80;
1656
1657 //https://github.com/openbsd/src/blob/HEAD/sys/sys/mount.h
1658 pub const ISOFSMNT_NORRIP: c_int = 0x1; // disable Rock Ridge Ext
1659 pub const ISOFSMNT_GENS: c_int = 0x2; // enable generation numbers
1660 pub const ISOFSMNT_EXTATT: c_int = 0x4; // enable extended attr
1661 pub const ISOFSMNT_NOJOLIET: c_int = 0x8; // disable Joliet Ext
1662 pub const ISOFSMNT_SESS: c_int = 0x10; // use iso_args.sess
1663
1664 pub const NFS_ARGSVERSION: c_int = 4; // change when nfs_args changes
1665
1666 pub const NFSMNT_RESVPORT: c_int = 0; // always use reserved ports
1667 pub const NFSMNT_SOFT: c_int = 0x1; // soft mount (hard is default)
1668 pub const NFSMNT_WSIZE: c_int = 0x2; // set write size
1669 pub const NFSMNT_RSIZE: c_int = 0x4; // set read size
1670 pub const NFSMNT_TIMEO: c_int = 0x8; // set initial timeout
1671 pub const NFSMNT_RETRANS: c_int = 0x10; // set number of request retries
1672 pub const NFSMNT_MAXGRPS: c_int = 0x20; // set maximum grouplist size
1673 pub const NFSMNT_INT: c_int = 0x40; // allow interrupts on hard mount
1674 pub const NFSMNT_NOCONN: c_int = 0x80; // Don't Connect the socket
1675 pub const NFSMNT_NQNFS: c_int = 0x100; // Use Nqnfs protocol
1676 pub const NFSMNT_NFSV3: c_int = 0x200; // Use NFS Version 3 protocol
1677 pub const NFSMNT_KERB: c_int = 0x400; // Use Kerberos authentication
1678 pub const NFSMNT_DUMBTIMR: c_int = 0x800; // Don't estimate rtt dynamically
1679 pub const NFSMNT_LEASETERM: c_int = 0x1000; // set lease term (nqnfs)
1680 pub const NFSMNT_READAHEAD: c_int = 0x2000; // set read ahead
1681 pub const NFSMNT_DEADTHRESH: c_int = 0x4000; // set dead server retry thresh
1682 pub const NFSMNT_NOAC: c_int = 0x8000; // disable attribute cache
1683 pub const NFSMNT_RDIRPLUS: c_int = 0x10000; // Use Readdirplus for V3
1684 pub const NFSMNT_READDIRSIZE: c_int = 0x20000; // Set readdir size
1685
1686 /* Flags valid only in mount syscall arguments */
1687 pub const NFSMNT_ACREGMIN: c_int = 0x40000; // acregmin field valid
1688 pub const NFSMNT_ACREGMAX: c_int = 0x80000; // acregmax field valid
1689 pub const NFSMNT_ACDIRMIN: c_int = 0x100000; // acdirmin field valid
1690 pub const NFSMNT_ACDIRMAX: c_int = 0x200000; // acdirmax field valid
1691
1692 /* Flags valid only in kernel */
1693 pub const NFSMNT_INTERNAL: c_int = 0xfffc0000; // Bits set internally
1694 pub const NFSMNT_HASWRITEVERF: c_int = 0x40000; // Has write verifier for V3
1695 pub const NFSMNT_GOTPATHCONF: c_int = 0x80000; // Got the V3 pathconf info
1696 pub const NFSMNT_GOTFSINFO: c_int = 0x100000; // Got the V3 fsinfo
1697 pub const NFSMNT_MNTD: c_int = 0x200000; // Mnt server for mnt point
1698 pub const NFSMNT_DISMINPROG: c_int = 0x400000; // Dismount in progress
1699 pub const NFSMNT_DISMNT: c_int = 0x800000; // Dismounted
1700 pub const NFSMNT_SNDLOCK: c_int = 0x1000000; // Send socket lock
1701 pub const NFSMNT_WANTSND: c_int = 0x2000000; // Want above
1702 pub const NFSMNT_RCVLOCK: c_int = 0x4000000; // Rcv socket lock
1703 pub const NFSMNT_WANTRCV: c_int = 0x8000000; // Want above
1704 pub const NFSMNT_WAITAUTH: c_int = 0x10000000; // Wait for authentication
1705 pub const NFSMNT_HASAUTH: c_int = 0x20000000; // Has authenticator
1706 pub const NFSMNT_WANTAUTH: c_int = 0x40000000; // Wants an authenticator
1707 pub const NFSMNT_AUTHERR: c_int = 0x80000000; // Authentication error
1708
1709 pub const MSDOSFSMNT_SHORTNAME: c_int = 0x1; // Force old DOS short names only
1710 pub const MSDOSFSMNT_LONGNAME: c_int = 0x2; // Force Win'95 long names
1711 pub const MSDOSFSMNT_NOWIN95: c_int = 0x4; // Completely ignore Win95 entries
1712
1713 pub const NTFS_MFLAG_CASEINS: c_int = 0x1;
1714 pub const NTFS_MFLAG_ALLNAMES: c_int = 0x2;
1715
1716 pub const TMPFS_ARGS_VERSION: c_int = 1;
1717
1718 const SI_MAXSZ: size_t = 128;
1719 const SI_PAD: size_t = (SI_MAXSZ / mem::size_of::<c_int>()) - 3;
1720
1721 pub const MAP_STACK: c_int = 0x4000;
1722 pub const MAP_CONCEAL: c_int = 0x8000;
1723
1724 // https://github.com/openbsd/src/blob/HEAD/sys/net/if.h#L187
1725 pub const IFF_UP: c_int = 0x1; // interface is up
1726 pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid
1727 pub const IFF_DEBUG: c_int = 0x4; // turn on debugging
1728 pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net
1729 pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link
1730 pub const IFF_STATICARP: c_int = 0x20; // only static ARP
1731 pub const IFF_RUNNING: c_int = 0x40; // resources allocated
1732 pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol
1733 pub const IFF_PROMISC: c_int = 0x100; // receive all packets
1734 pub const IFF_ALLMULTI: c_int = 0x200; // receive all multicast packets
1735 pub const IFF_OACTIVE: c_int = 0x400; // transmission in progress
1736 pub const IFF_SIMPLEX: c_int = 0x800; // can't hear own transmissions
1737 pub const IFF_LINK0: c_int = 0x1000; // per link layer defined bit
1738 pub const IFF_LINK1: c_int = 0x2000; // per link layer defined bit
1739 pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit
1740 pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast
1741
1742 pub const PTHREAD_STACK_MIN: size_t = 1_usize << _MAX_PAGE_SHIFT;
1743 pub const MINSIGSTKSZ: size_t = 3_usize << _MAX_PAGE_SHIFT;
1744 pub const SIGSTKSZ: size_t = MINSIGSTKSZ + (1_usize << _MAX_PAGE_SHIFT) * 4;
1745
1746 pub const PT_SET_EVENT_MASK: c_int = 12;
1747 pub const PT_GET_EVENT_MASK: c_int = 13;
1748 pub const PT_GET_PROCESS_STATE: c_int = 14;
1749 pub const PT_GET_THREAD_FIRST: c_int = 15;
1750 pub const PT_GET_THREAD_NEXT: c_int = 16;
1751 pub const PT_FIRSTMACH: c_int = 32;
1752
1753 pub const SOCK_CLOEXEC: c_int = 0x8000;
1754 pub const SOCK_NONBLOCK: c_int = 0x4000;
1755 pub const SOCK_DNS: c_int = 0x1000;
1756
1757 pub const BIOCGRSIG: c_ulong = 0x40044273;
1758 pub const BIOCSRSIG: c_ulong = 0x80044272;
1759 pub const BIOCSDLT: c_ulong = 0x8004427a;
1760
1761 pub const PTRACE_FORK: c_int = 0x0002;
1762
1763 pub const WCONTINUED: c_int = 0x08;
1764 pub const WEXITED: c_int = 0x04;
1765 pub const WSTOPPED: c_int = 0x02; // same as WUNTRACED
1766 pub const WNOWAIT: c_int = 0x10;
1767 pub const WTRAPPED: c_int = 0x20;
1768
1769 pub const P_ALL: crate::idtype_t = 0;
1770 pub const P_PGID: crate::idtype_t = 1;
1771 pub const P_PID: crate::idtype_t = 2;
1772
1773 // search.h
1774 pub const FIND: crate::ACTION = 0;
1775 pub const ENTER: crate::ACTION = 1;
1776
1777 // futex.h
1778 pub const FUTEX_WAIT: c_int = 1;
1779 pub const FUTEX_WAKE: c_int = 2;
1780 pub const FUTEX_REQUEUE: c_int = 3;
1781 pub const FUTEX_PRIVATE_FLAG: c_int = 128;
1782
1783 // sysctl.h, kinfo_proc p_eflag constants
1784 pub const EPROC_CTTY: i32 = 0x01; // controlling tty vnode active
1785 pub const EPROC_SLEADER: i32 = 0x02; // session leader
1786 pub const EPROC_UNVEIL: i32 = 0x04; // has unveil settings
1787 pub const EPROC_LKUNVEIL: i32 = 0x08; // unveil is locked
1788
1789 // Flags for chflags(2)
1790 pub const UF_SETTABLE: c_uint = 0x0000ffff;
1791 pub const UF_NODUMP: c_uint = 0x00000001;
1792 pub const UF_IMMUTABLE: c_uint = 0x00000002;
1793 pub const UF_APPEND: c_uint = 0x00000004;
1794 pub const UF_OPAQUE: c_uint = 0x00000008;
1795 pub const SF_SETTABLE: c_uint = 0xffff0000;
1796 pub const SF_ARCHIVED: c_uint = 0x00010000;
1797 pub const SF_IMMUTABLE: c_uint = 0x00020000;
1798 pub const SF_APPEND: c_uint = 0x00040000;
1799
1800 // sys/exec_elf.h - Legal values for p_type (segment type).
1801 pub const PT_NULL: u32 = 0;
1802 pub const PT_LOAD: u32 = 1;
1803 pub const PT_DYNAMIC: u32 = 2;
1804 pub const PT_INTERP: u32 = 3;
1805 pub const PT_NOTE: u32 = 4;
1806 pub const PT_SHLIB: u32 = 5;
1807 pub const PT_PHDR: u32 = 6;
1808 pub const PT_TLS: u32 = 7;
1809 pub const PT_LOOS: u32 = 0x60000000;
1810 pub const PT_HIOS: u32 = 0x6fffffff;
1811 pub const PT_LOPROC: u32 = 0x70000000;
1812 pub const PT_HIPROC: u32 = 0x7fffffff;
1813
1814 pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
1815 pub const PT_GNU_RELRO: u32 = 0x6474e552;
1816
1817 // sys/exec_elf.h - Legal values for p_flags (segment flags).
1818 pub const PF_X: u32 = 0x1;
1819 pub const PF_W: u32 = 0x2;
1820 pub const PF_R: u32 = 0x4;
1821 pub const PF_MASKOS: u32 = 0x0ff00000;
1822 pub const PF_MASKPROC: u32 = 0xf0000000;
1823
1824 // sys/mount.h
1825 pub const MNT_NOPERM: c_int = 0x00000020;
1826 pub const MNT_WXALLOWED: c_int = 0x00000800;
1827 pub const MNT_EXRDONLY: c_int = 0x00000080;
1828 pub const MNT_DEFEXPORTED: c_int = 0x00000200;
1829 pub const MNT_EXPORTANON: c_int = 0x00000400;
1830 pub const MNT_ROOTFS: c_int = 0x00004000;
1831 pub const MNT_NOATIME: c_int = 0x00008000;
1832 pub const MNT_DELEXPORT: c_int = 0x00020000;
1833 pub const MNT_STALLED: c_int = 0x00100000;
1834 pub const MNT_SWAPPABLE: c_int = 0x00200000;
1835 pub const MNT_WANTRDWR: c_int = 0x02000000;
1836 pub const MNT_SOFTDEP: c_int = 0x04000000;
1837 pub const MNT_DOOMED: c_int = 0x08000000;
1838
1839 // For use with vfs_fsync and getfsstat
1840 pub const MNT_WAIT: c_int = 1;
1841 pub const MNT_NOWAIT: c_int = 2;
1842 pub const MNT_LAZY: c_int = 3;
1843
1844 // sys/_time.h
1845 pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2;
1846 pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 4;
1847 pub const CLOCK_UPTIME: crate::clockid_t = 5;
1848 pub const CLOCK_BOOTTIME: crate::clockid_t = 6;
1849
1850 pub const LC_COLLATE_MASK: c_int = 1 << crate::LC_COLLATE;
1851 pub const LC_CTYPE_MASK: c_int = 1 << crate::LC_CTYPE;
1852 pub const LC_MONETARY_MASK: c_int = 1 << crate::LC_MONETARY;
1853 pub const LC_NUMERIC_MASK: c_int = 1 << crate::LC_NUMERIC;
1854 pub const LC_TIME_MASK: c_int = 1 << crate::LC_TIME;
1855 pub const LC_MESSAGES_MASK: c_int = 1 << crate::LC_MESSAGES;
1856
1857 const _LC_LAST: c_int = 7;
1858 pub const LC_ALL_MASK: c_int = (1 << _LC_LAST) - 2;
1859
1860 pub const LC_GLOBAL_LOCALE: crate::locale_t = -1isize as crate::locale_t;
1861
1862 // sys/reboot.h
1863 pub const RB_ASKNAME: c_int = 0x00001;
1864 pub const RB_SINGLE: c_int = 0x00002;
1865 pub const RB_NOSYNC: c_int = 0x00004;
1866 pub const RB_HALT: c_int = 0x00008;
1867 pub const RB_INITNAME: c_int = 0x00010;
1868 pub const RB_KDB: c_int = 0x00040;
1869 pub const RB_RDONLY: c_int = 0x00080;
1870 pub const RB_DUMP: c_int = 0x00100;
1871 pub const RB_MINIROOT: c_int = 0x00200;
1872 pub const RB_CONFIG: c_int = 0x00400;
1873 pub const RB_TIMEBAD: c_int = 0x00800;
1874 pub const RB_POWERDOWN: c_int = 0x01000;
1875 pub const RB_SERCONS: c_int = 0x02000;
1876 pub const RB_USERREQ: c_int = 0x04000;
1877 pub const RB_RESET: c_int = 0x08000;
1878 pub const RB_GOODRANDOM: c_int = 0x10000;
1879 pub const RB_UNHIBERNATE: c_int = 0x20000;
1880
1881 // net/route.h
1882 pub const RTF_CLONING: c_int = 0x100;
1883 pub const RTF_MULTICAST: c_int = 0x200;
1884 pub const RTF_LLINFO: c_int = 0x400;
1885 pub const RTF_PROTO3: c_int = 0x2000;
1886 pub const RTF_ANNOUNCE: c_int = crate::RTF_PROTO2;
1887
1888 pub const RTF_CLONED: c_int = 0x10000;
1889 pub const RTF_CACHED: c_int = 0x20000;
1890 pub const RTF_MPATH: c_int = 0x40000;
1891 pub const RTF_MPLS: c_int = 0x100000;
1892 pub const RTF_LOCAL: c_int = 0x200000;
1893 pub const RTF_BROADCAST: c_int = 0x400000;
1894 pub const RTF_CONNECTED: c_int = 0x800000;
1895 pub const RTF_BFD: c_int = 0x1000000;
1896 pub const RTF_FMASK: c_int = crate::RTF_LLINFO
1897 | crate::RTF_PROTO1
1898 | crate::RTF_PROTO2
1899 | crate::RTF_PROTO3
1900 | crate::RTF_BLACKHOLE
1901 | crate::RTF_REJECT
1902 | crate::RTF_STATIC
1903 | crate::RTF_MPLS
1904 | crate::RTF_BFD;
1905
1906 pub const RTM_VERSION: c_int = 5;
1907 pub const RTM_RESOLVE: c_int = 0xb;
1908 pub const RTM_NEWADDR: c_int = 0xc;
1909 pub const RTM_DELADDR: c_int = 0xd;
1910 pub const RTM_IFINFO: c_int = 0xe;
1911 pub const RTM_IFANNOUNCE: c_int = 0xf;
1912 pub const RTM_DESYNC: c_int = 0x10;
1913 pub const RTM_INVALIDATE: c_int = 0x11;
1914 pub const RTM_BFD: c_int = 0x12;
1915 pub const RTM_PROPOSAL: c_int = 0x13;
1916 pub const RTM_CHGADDRATTR: c_int = 0x14;
1917 pub const RTM_80211INFO: c_int = 0x15;
1918 pub const RTM_SOURCE: c_int = 0x16;
1919
1920 pub const RTA_SRC: c_int = 0x100;
1921 pub const RTA_SRCMASK: c_int = 0x200;
1922 pub const RTA_LABEL: c_int = 0x400;
1923 pub const RTA_BFD: c_int = 0x800;
1924 pub const RTA_DNS: c_int = 0x1000;
1925 pub const RTA_STATIC: c_int = 0x2000;
1926 pub const RTA_SEARCH: c_int = 0x4000;
1927
1928 pub const RTAX_SRC: c_int = 8;
1929 pub const RTAX_SRCMASK: c_int = 9;
1930 pub const RTAX_LABEL: c_int = 10;
1931 pub const RTAX_BFD: c_int = 11;
1932 pub const RTAX_DNS: c_int = 12;
1933 pub const RTAX_STATIC: c_int = 13;
1934 pub const RTAX_SEARCH: c_int = 14;
1935 pub const RTAX_MAX: c_int = 15;
1936
1937 const_fn! {
1938 {const} fn _ALIGN(p: usize) -> usize {
1939 (p + _ALIGNBYTES) & !_ALIGNBYTES
1940 }
1941 }
1942
1943 f! {
1944 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
1945 (cmsg as *mut c_uchar).offset(_ALIGN(mem::size_of::<cmsghdr>()) as isize)
1946 }
1947
1948 pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
1949 _ALIGN(mem::size_of::<cmsghdr>()) as c_uint + length
1950 }
1951
1952 pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
1953 if cmsg.is_null() {
1954 return crate::CMSG_FIRSTHDR(mhdr);
1955 };
1956 let next =
1957 cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(mem::size_of::<cmsghdr>());
1958 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
1959 if next > max {
1960 0 as *mut cmsghdr
1961 } else {
1962 (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
1963 }
1964 }
1965
1966 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
1967 (_ALIGN(mem::size_of::<cmsghdr>()) + _ALIGN(length as usize)) as c_uint
1968 }
1969 }
1970
1971 safe_f! {
1972 pub {const} fn WSTOPSIG(status: c_int) -> c_int {
1973 status >> 8
1974 }
1975
1976 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
1977 (status & 0o177) != 0o177 && (status & 0o177) != 0
1978 }
1979
1980 pub {const} fn WIFSTOPPED(status: c_int) -> bool {
1981 (status & 0xff) == 0o177
1982 }
1983
1984 pub {const} fn WIFCONTINUED(status: c_int) -> bool {
1985 (status & 0o177777) == 0o177777
1986 }
1987
1988 pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t {
1989 let major = major as crate::dev_t;
1990 let minor = minor as crate::dev_t;
1991 let mut dev = 0;
1992 dev |= (major & 0xff) << 8;
1993 dev |= minor & 0xff;
1994 dev |= (minor & 0xffff00) << 8;
1995 dev
1996 }
1997
1998 pub {const} fn major(dev: crate::dev_t) -> c_uint {
1999 ((dev as c_uint) >> 8) & 0xff
2000 }
2001
2002 pub {const} fn minor(dev: crate::dev_t) -> c_uint {
2003 let dev = dev as c_uint;
2004 let mut res = 0;
2005 res |= (dev) & 0xff;
2006 res |= ((dev) & 0xffff0000) >> 8;
2007 res
2008 }
2009 }
2010
2011 extern "C" {
2012 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int;
2013 pub fn settimeofday(tp: *const crate::timeval, tz: *const crate::timezone) -> c_int;
2014 pub fn pledge(promises: *const c_char, execpromises: *const c_char) -> c_int;
2015 pub fn unveil(path: *const c_char, permissions: *const c_char) -> c_int;
2016 pub fn strtonum(
2017 nptr: *const c_char,
2018 minval: c_longlong,
2019 maxval: c_longlong,
2020 errstr: *mut *const c_char,
2021 ) -> c_longlong;
2022 pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int;
2023 pub fn chflags(path: *const c_char, flags: c_uint) -> c_int;
2024 pub fn fchflags(fd: c_int, flags: c_uint) -> c_int;
2025 pub fn chflagsat(fd: c_int, path: *const c_char, flags: c_uint, atflag: c_int) -> c_int;
2026 pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
2027 pub fn getnameinfo(
2028 sa: *const crate::sockaddr,
2029 salen: crate::socklen_t,
2030 host: *mut c_char,
2031 hostlen: size_t,
2032 serv: *mut c_char,
2033 servlen: size_t,
2034 flags: c_int,
2035 ) -> c_int;
2036 pub fn getresgid(
2037 rgid: *mut crate::gid_t,
2038 egid: *mut crate::gid_t,
2039 sgid: *mut crate::gid_t,
2040 ) -> c_int;
2041 pub fn getresuid(
2042 ruid: *mut crate::uid_t,
2043 euid: *mut crate::uid_t,
2044 suid: *mut crate::uid_t,
2045 ) -> c_int;
2046 pub fn kevent(
2047 kq: c_int,
2048 changelist: *const crate::kevent,
2049 nchanges: c_int,
2050 eventlist: *mut crate::kevent,
2051 nevents: c_int,
2052 timeout: *const crate::timespec,
2053 ) -> c_int;
2054 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
2055 pub fn getthrid() -> crate::pid_t;
2056 pub fn pthread_attr_getguardsize(
2057 attr: *const crate::pthread_attr_t,
2058 guardsize: *mut size_t,
2059 ) -> c_int;
2060 pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
2061 pub fn pthread_attr_getstack(
2062 attr: *const crate::pthread_attr_t,
2063 stackaddr: *mut *mut c_void,
2064 stacksize: *mut size_t,
2065 ) -> c_int;
2066 pub fn pthread_main_np() -> c_int;
2067 pub fn pthread_get_name_np(tid: crate::pthread_t, name: *mut c_char, len: size_t);
2068 pub fn pthread_set_name_np(tid: crate::pthread_t, name: *const c_char);
2069 pub fn pthread_stackseg_np(thread: crate::pthread_t, sinfo: *mut crate::stack_t) -> c_int;
2070
2071 pub fn openpty(
2072 amaster: *mut c_int,
2073 aslave: *mut c_int,
2074 name: *mut c_char,
2075 termp: *const crate::termios,
2076 winp: *const crate::winsize,
2077 ) -> c_int;
2078 pub fn forkpty(
2079 amaster: *mut c_int,
2080 name: *mut c_char,
2081 termp: *const crate::termios,
2082 winp: *const crate::winsize,
2083 ) -> crate::pid_t;
2084
2085 pub fn sysctl(
2086 name: *const c_int,
2087 namelen: c_uint,
2088 oldp: *mut c_void,
2089 oldlenp: *mut size_t,
2090 newp: *mut c_void,
2091 newlen: size_t,
2092 ) -> c_int;
2093 pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int;
2094 pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int;
2095 pub fn ptrace(request: c_int, pid: crate::pid_t, addr: caddr_t, data: c_int) -> c_int;
2096 pub fn utrace(label: *const c_char, addr: *const c_void, len: size_t) -> c_int;
2097 pub fn memmem(
2098 haystack: *const c_void,
2099 haystacklen: size_t,
2100 needle: *const c_void,
2101 needlelen: size_t,
2102 ) -> *mut c_void;
2103 // #include <link.h>
2104 pub fn dl_iterate_phdr(
2105 callback: Option<
2106 unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int,
2107 >,
2108 data: *mut c_void,
2109 ) -> c_int;
2110 pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
2111 pub fn freelocale(loc: crate::locale_t);
2112 pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
2113 pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
2114
2115 // Added in `OpenBSD` 5.5
2116 pub fn explicit_bzero(s: *mut c_void, len: size_t);
2117
2118 pub fn setproctitle(fmt: *const c_char, ...);
2119
2120 pub fn freezero(ptr: *mut c_void, size: size_t);
2121 pub fn malloc_conceal(size: size_t) -> *mut c_void;
2122 pub fn calloc_conceal(nmemb: size_t, size: size_t) -> *mut c_void;
2123
2124 pub fn srand48_deterministic(seed: c_long);
2125 pub fn seed48_deterministic(xseed: *mut c_ushort) -> *mut c_ushort;
2126 pub fn lcong48_deterministic(p: *mut c_ushort);
2127
2128 pub fn lsearch(
2129 key: *const c_void,
2130 base: *mut c_void,
2131 nelp: *mut size_t,
2132 width: size_t,
2133 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
2134 ) -> *mut c_void;
2135 pub fn lfind(
2136 key: *const c_void,
2137 base: *const c_void,
2138 nelp: *mut size_t,
2139 width: size_t,
2140 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
2141 ) -> *mut c_void;
2142 pub fn hcreate(nelt: size_t) -> c_int;
2143 pub fn hdestroy();
2144 pub fn hsearch(entry: crate::ENTRY, action: crate::ACTION) -> *mut crate::ENTRY;
2145
2146 // futex.h
2147 pub fn futex(
2148 uaddr: *mut u32,
2149 op: c_int,
2150 val: c_int,
2151 timeout: *const crate::timespec,
2152 uaddr2: *mut u32,
2153 ) -> c_int;
2154
2155 pub fn mimmutable(addr: *mut c_void, len: size_t) -> c_int;
2156
2157 pub fn reboot(mode: c_int) -> c_int;
2158
2159 pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
2160 pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
2161 pub fn getmntinfo(mntbufp: *mut *mut crate::statfs, flags: c_int) -> c_int;
2162 pub fn getfsstat(buf: *mut statfs, bufsize: size_t, flags: c_int) -> c_int;
2163 }
2164
2165 #[link(name = "execinfo")]
2166 extern "C" {
2167 pub fn backtrace(addrlist: *mut *mut c_void, len: size_t) -> size_t;
2168 pub fn backtrace_symbols(addrlist: *const *mut c_void, len: size_t) -> *mut *mut c_char;
2169 pub fn backtrace_symbols_fd(addrlist: *const *mut c_void, len: size_t, fd: c_int) -> c_int;
2170 pub fn backtrace_symbols_fmt(
2171 addrlist: *const *mut c_void,
2172 len: size_t,
2173 fmt: *const c_char,
2174 ) -> *mut *mut c_char;
2175 }
2176
2177 cfg_if! {
2178 if #[cfg(target_arch = "aarch64")] {
2179 mod aarch64;
2180 pub use self::aarch64::*;
2181 } else if #[cfg(target_arch = "arm")] {
2182 mod arm;
2183 pub use self::arm::*;
2184 } else if #[cfg(target_arch = "mips64")] {
2185 mod mips64;
2186 pub use self::mips64::*;
2187 } else if #[cfg(target_arch = "powerpc")] {
2188 mod powerpc;
2189 pub use self::powerpc::*;
2190 } else if #[cfg(target_arch = "powerpc64")] {
2191 mod powerpc64;
2192 pub use self::powerpc64::*;
2193 } else if #[cfg(target_arch = "riscv64")] {
2194 mod riscv64;
2195 pub use self::riscv64::*;
2196 } else if #[cfg(target_arch = "sparc64")] {
2197 mod sparc64;
2198 pub use self::sparc64::*;
2199 } else if #[cfg(target_arch = "x86")] {
2200 mod x86;
2201 pub use self::x86::*;
2202 } else if #[cfg(target_arch = "x86_64")] {
2203 mod x86_64;
2204 pub use self::x86_64::*;
2205 } else {
2206 // Unknown target_arch
2207 }
2208 }