Debian Codegraph @

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

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