]> git.proxmox.com Git - rustc.git/blob - vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs
New upstream version 1.59.0+dfsg1
[rustc.git] / vendor / libc / src / unix / bsd / netbsdlike / openbsd / mod.rs
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 pthread_attr_t = *mut ::c_void;
11 pub type pthread_mutex_t = *mut ::c_void;
12 pub type pthread_mutexattr_t = *mut ::c_void;
13 pub type pthread_cond_t = *mut ::c_void;
14 pub type pthread_condattr_t = *mut ::c_void;
15 pub type pthread_rwlock_t = *mut ::c_void;
16 pub type pthread_rwlockattr_t = *mut ::c_void;
17 pub type pthread_spinlock_t = ::uintptr_t;
18 pub type caddr_t = *mut ::c_char;
19
20 // elf.h
21
22 pub type Elf32_Addr = u32;
23 pub type Elf32_Half = u16;
24 pub type Elf32_Lword = u64;
25 pub type Elf32_Off = u32;
26 pub type Elf32_Sword = i32;
27 pub type Elf32_Word = u32;
28
29 pub type Elf64_Addr = u64;
30 pub type Elf64_Half = u16;
31 pub type Elf64_Lword = u64;
32 pub type Elf64_Off = u64;
33 pub type Elf64_Sword = i32;
34 pub type Elf64_Sxword = i64;
35 pub type Elf64_Word = u32;
36 pub type Elf64_Xword = u64;
37
38 cfg_if! {
39 if #[cfg(target_pointer_width = "64")] {
40 type Elf_Addr = Elf64_Addr;
41 type Elf_Half = Elf64_Half;
42 type Elf_Phdr = Elf64_Phdr;
43 } else if #[cfg(target_pointer_width = "32")] {
44 type Elf_Addr = Elf32_Addr;
45 type Elf_Half = Elf32_Half;
46 type Elf_Phdr = Elf32_Phdr;
47 }
48 }
49
50 s! {
51 pub struct glob_t {
52 pub gl_pathc: ::size_t,
53 pub gl_matchc: ::size_t,
54 pub gl_offs: ::size_t,
55 pub gl_flags: ::c_int,
56 pub gl_pathv: *mut *mut ::c_char,
57 __unused1: *mut ::c_void,
58 __unused2: *mut ::c_void,
59 __unused3: *mut ::c_void,
60 __unused4: *mut ::c_void,
61 __unused5: *mut ::c_void,
62 __unused6: *mut ::c_void,
63 __unused7: *mut ::c_void,
64 }
65
66 pub struct lconv {
67 pub decimal_point: *mut ::c_char,
68 pub thousands_sep: *mut ::c_char,
69 pub grouping: *mut ::c_char,
70 pub int_curr_symbol: *mut ::c_char,
71 pub currency_symbol: *mut ::c_char,
72 pub mon_decimal_point: *mut ::c_char,
73 pub mon_thousands_sep: *mut ::c_char,
74 pub mon_grouping: *mut ::c_char,
75 pub positive_sign: *mut ::c_char,
76 pub negative_sign: *mut ::c_char,
77 pub int_frac_digits: ::c_char,
78 pub frac_digits: ::c_char,
79 pub p_cs_precedes: ::c_char,
80 pub p_sep_by_space: ::c_char,
81 pub n_cs_precedes: ::c_char,
82 pub n_sep_by_space: ::c_char,
83 pub p_sign_posn: ::c_char,
84 pub n_sign_posn: ::c_char,
85 pub int_p_cs_precedes: ::c_char,
86 pub int_p_sep_by_space: ::c_char,
87 pub int_n_cs_precedes: ::c_char,
88 pub int_n_sep_by_space: ::c_char,
89 pub int_p_sign_posn: ::c_char,
90 pub int_n_sign_posn: ::c_char,
91 }
92
93 pub struct ufs_args {
94 pub fspec: *mut ::c_char,
95 pub export_info: export_args,
96 }
97
98 pub struct mfs_args {
99 pub fspec: *mut ::c_char,
100 pub export_info: export_args,
101 // https://github.com/openbsd/src/blob/master/sys/sys/types.h#L134
102 pub base: *mut ::c_char,
103 pub size: ::c_ulong,
104 }
105
106 pub struct iso_args {
107 pub fspec: *mut ::c_char,
108 pub export_info: export_args,
109 pub flags: ::c_int,
110 pub sess: ::c_int,
111 }
112
113 pub struct nfs_args {
114 pub version: ::c_int,
115 pub addr: *mut ::sockaddr,
116 pub addrlen: ::c_int,
117 pub sotype: ::c_int,
118 pub proto: ::c_int,
119 pub fh: *mut ::c_uchar,
120 pub fhsize: ::c_int,
121 pub flags: ::c_int,
122 pub wsize: ::c_int,
123 pub rsize: ::c_int,
124 pub readdirsize: ::c_int,
125 pub timeo: ::c_int,
126 pub retrans: ::c_int,
127 pub maxgrouplist: ::c_int,
128 pub readahead: ::c_int,
129 pub leaseterm: ::c_int,
130 pub deadthresh: ::c_int,
131 pub hostname: *mut ::c_char,
132 pub acregmin: ::c_int,
133 pub acregmax: ::c_int,
134 pub acdirmin: ::c_int,
135 pub acdirmax: ::c_int,
136 }
137
138 pub struct msdosfs_args {
139 pub fspec: *mut ::c_char,
140 pub export_info: export_args,
141 pub uid: ::uid_t,
142 pub gid: ::gid_t,
143 pub mask: ::mode_t,
144 pub flags: ::c_int,
145 }
146
147 pub struct ntfs_args {
148 pub fspec: *mut ::c_char,
149 pub export_info: export_args,
150 pub uid: ::uid_t,
151 pub gid: ::gid_t,
152 pub mode: ::mode_t,
153 pub flag: ::c_ulong,
154 }
155
156 pub struct udf_args {
157 pub fspec: *mut ::c_char,
158 pub lastblock: u32,
159 }
160
161 pub struct tmpfs_args {
162 pub ta_version: ::c_int,
163 pub ta_nodes_max: ::ino_t,
164 pub ta_size_max: ::off_t,
165 pub ta_root_uid: ::uid_t,
166 pub ta_root_gid: ::gid_t,
167 pub ta_root_mode: ::mode_t,
168 }
169
170 pub struct fusefs_args {
171 pub name: *mut ::c_char,
172 pub fd: ::c_int,
173 pub max_read: ::c_int,
174 pub allow_other: ::c_int,
175 }
176
177 pub struct xucred {
178 pub cr_uid: ::uid_t,
179 pub cr_gid: ::gid_t,
180 pub cr_ngroups: ::c_short,
181 //https://github.com/openbsd/src/blob/master/sys/sys/syslimits.h#L44
182 pub cr_groups: [::gid_t; 16],
183 }
184
185 pub struct export_args {
186 pub ex_flags: ::c_int,
187 pub ex_root: ::uid_t,
188 pub ex_anon: xucred,
189 pub ex_addr: *mut ::sockaddr,
190 pub ex_addrlen: ::c_int,
191 pub ex_mask: *mut ::sockaddr,
192 pub ex_masklen: ::c_int,
193 }
194
195 pub struct ip_mreq {
196 pub imr_multiaddr: in_addr,
197 pub imr_interface: in_addr,
198 }
199
200 pub struct in_addr {
201 pub s_addr: ::in_addr_t,
202 }
203
204 pub struct sockaddr_in {
205 pub sin_len: u8,
206 pub sin_family: ::sa_family_t,
207 pub sin_port: ::in_port_t,
208 pub sin_addr: ::in_addr,
209 pub sin_zero: [i8; 8],
210 }
211
212 pub struct kevent {
213 pub ident: ::uintptr_t,
214 pub filter: ::c_short,
215 pub flags: ::c_ushort,
216 pub fflags: ::c_uint,
217 pub data: i64,
218 pub udata: *mut ::c_void,
219 }
220
221 pub struct stat {
222 pub st_mode: ::mode_t,
223 pub st_dev: ::dev_t,
224 pub st_ino: ::ino_t,
225 pub st_nlink: ::nlink_t,
226 pub st_uid: ::uid_t,
227 pub st_gid: ::gid_t,
228 pub st_rdev: ::dev_t,
229 pub st_atime: ::time_t,
230 pub st_atime_nsec: ::c_long,
231 pub st_mtime: ::time_t,
232 pub st_mtime_nsec: ::c_long,
233 pub st_ctime: ::time_t,
234 pub st_ctime_nsec: ::c_long,
235 pub st_size: ::off_t,
236 pub st_blocks: ::blkcnt_t,
237 pub st_blksize: ::blksize_t,
238 pub st_flags: u32,
239 pub st_gen: u32,
240 pub st_birthtime: ::time_t,
241 pub st_birthtime_nsec: ::c_long,
242 }
243
244 pub struct statvfs {
245 pub f_bsize: ::c_ulong,
246 pub f_frsize: ::c_ulong,
247 pub f_blocks: ::fsblkcnt_t,
248 pub f_bfree: ::fsblkcnt_t,
249 pub f_bavail: ::fsblkcnt_t,
250 pub f_files: ::fsfilcnt_t,
251 pub f_ffree: ::fsfilcnt_t,
252 pub f_favail: ::fsfilcnt_t,
253 pub f_fsid: ::c_ulong,
254 pub f_flag: ::c_ulong,
255 pub f_namemax: ::c_ulong,
256 }
257
258 pub struct addrinfo {
259 pub ai_flags: ::c_int,
260 pub ai_family: ::c_int,
261 pub ai_socktype: ::c_int,
262 pub ai_protocol: ::c_int,
263 pub ai_addrlen: ::socklen_t,
264 pub ai_addr: *mut ::sockaddr,
265 pub ai_canonname: *mut ::c_char,
266 pub ai_next: *mut ::addrinfo,
267 }
268
269 pub struct Dl_info {
270 pub dli_fname: *const ::c_char,
271 pub dli_fbase: *mut ::c_void,
272 pub dli_sname: *const ::c_char,
273 pub dli_saddr: *mut ::c_void,
274 }
275
276 pub struct if_data {
277 pub ifi_type: ::c_uchar,
278 pub ifi_addrlen: ::c_uchar,
279 pub ifi_hdrlen: ::c_uchar,
280 pub ifi_link_state: ::c_uchar,
281 pub ifi_mtu: u32,
282 pub ifi_metric: u32,
283 pub ifi_rdomain: u32,
284 pub ifi_baudrate: u64,
285 pub ifi_ipackets: u64,
286 pub ifi_ierrors: u64,
287 pub ifi_opackets: u64,
288 pub ifi_oerrors: u64,
289 pub ifi_collisions: u64,
290 pub ifi_ibytes: u64,
291 pub ifi_obytes: u64,
292 pub ifi_imcasts: u64,
293 pub ifi_omcasts: u64,
294 pub ifi_iqdrops: u64,
295 pub ifi_oqdrops: u64,
296 pub ifi_noproto: u64,
297 pub ifi_capabilities: u32,
298 pub ifi_lastchange: ::timeval,
299 }
300
301 pub struct if_msghdr {
302 pub ifm_msglen: ::c_ushort,
303 pub ifm_version: ::c_uchar,
304 pub ifm_type: ::c_uchar,
305 pub ifm_hdrlen: ::c_ushort,
306 pub ifm_index: ::c_ushort,
307 pub ifm_tableid: ::c_ushort,
308 pub ifm_pad1: ::c_uchar,
309 pub ifm_pad2: ::c_uchar,
310 pub ifm_addrs: ::c_int,
311 pub ifm_flags: ::c_int,
312 pub ifm_xflags: ::c_int,
313 pub ifm_data: if_data,
314 }
315
316 pub struct sockaddr_dl {
317 pub sdl_len: ::c_uchar,
318 pub sdl_family: ::c_uchar,
319 pub sdl_index: ::c_ushort,
320 pub sdl_type: ::c_uchar,
321 pub sdl_nlen: ::c_uchar,
322 pub sdl_alen: ::c_uchar,
323 pub sdl_slen: ::c_uchar,
324 pub sdl_data: [::c_char; 24],
325 }
326
327 pub struct sockpeercred {
328 pub uid: ::uid_t,
329 pub gid: ::gid_t,
330 pub pid: ::pid_t,
331 }
332
333 pub struct arphdr {
334 pub ar_hrd: u16,
335 pub ar_pro: u16,
336 pub ar_hln: u8,
337 pub ar_pln: u8,
338 pub ar_op: u16,
339 }
340
341 pub struct shmid_ds {
342 pub shm_perm: ::ipc_perm,
343 pub shm_segsz: ::c_int,
344 pub shm_lpid: ::pid_t,
345 pub shm_cpid: ::pid_t,
346 pub shm_nattch: ::c_short,
347 pub shm_atime: ::time_t,
348 __shm_atimensec: c_long,
349 pub shm_dtime: ::time_t,
350 __shm_dtimensec: c_long,
351 pub shm_ctime: ::time_t,
352 __shm_ctimensec: c_long,
353 pub shm_internal: *mut ::c_void,
354 }
355
356 // elf.h
357 pub struct Elf32_Phdr {
358 pub p_type: Elf32_Word,
359 pub p_offset: Elf32_Off,
360 pub p_vaddr: Elf32_Addr,
361 pub p_paddr: Elf32_Addr,
362 pub p_filesz: Elf32_Word,
363 pub p_memsz: Elf32_Word,
364 pub p_flags: Elf32_Word,
365 pub p_align: Elf32_Word,
366 }
367
368 pub struct Elf64_Phdr {
369 pub p_type: Elf64_Word,
370 pub p_flags: Elf64_Word,
371 pub p_offset: Elf64_Off,
372 pub p_vaddr: Elf64_Addr,
373 pub p_paddr: Elf64_Addr,
374 pub p_filesz: Elf64_Xword,
375 pub p_memsz: Elf64_Xword,
376 pub p_align: Elf64_Xword,
377 }
378
379 // link.h
380
381 pub struct dl_phdr_info {
382 pub dlpi_addr: Elf_Addr,
383 pub dlpi_name: *const ::c_char,
384 pub dlpi_phdr: *const Elf_Phdr,
385 pub dlpi_phnum: Elf_Half,
386 }
387
388 // sys/sysctl.h
389 pub struct kinfo_vmentry {
390 pub kve_start: ::c_ulong,
391 pub kve_end: ::c_ulong,
392 pub kve_guard: ::c_ulong,
393 pub kve_fspace: ::c_ulong,
394 pub kve_fspace_augment: ::c_ulong,
395 pub kve_offset: u64,
396 pub kve_wired_count: ::c_int,
397 pub kve_etype: ::c_int,
398 pub kve_protection: ::c_int,
399 pub kve_max_protection: ::c_int,
400 pub kve_advice: ::c_int,
401 pub kve_inheritance: ::c_int,
402 pub kve_flags: u8,
403 }
404
405 pub struct ptrace_state {
406 pub pe_report_event: ::c_int,
407 pub pe_other_pid: ::pid_t,
408 pub pe_tid: ::pid_t,
409 }
410
411 pub struct ptrace_thread_state {
412 pub pts_tid: ::pid_t,
413 }
414 }
415
416 impl siginfo_t {
417 pub unsafe fn si_addr(&self) -> *mut ::c_char {
418 self.si_addr
419 }
420
421 pub unsafe fn si_value(&self) -> ::sigval {
422 #[repr(C)]
423 struct siginfo_timer {
424 _si_signo: ::c_int,
425 _si_errno: ::c_int,
426 _si_code: ::c_int,
427 _pid: ::pid_t,
428 _uid: ::uid_t,
429 value: ::sigval,
430 }
431 (*(self as *const siginfo_t as *const siginfo_timer)).value
432 }
433 }
434
435 s_no_extra_traits! {
436 pub struct dirent {
437 pub d_fileno: ::ino_t,
438 pub d_off: ::off_t,
439 pub d_reclen: u16,
440 pub d_type: u8,
441 pub d_namlen: u8,
442 __d_padding: [u8; 4],
443 pub d_name: [::c_char; 256],
444 }
445
446 pub struct sockaddr_storage {
447 pub ss_len: u8,
448 pub ss_family: ::sa_family_t,
449 __ss_pad1: [u8; 6],
450 __ss_pad2: i64,
451 __ss_pad3: [u8; 240],
452 }
453
454 pub struct siginfo_t {
455 pub si_signo: ::c_int,
456 pub si_code: ::c_int,
457 pub si_errno: ::c_int,
458 pub si_addr: *mut ::c_char,
459 #[cfg(target_pointer_width = "32")]
460 __pad: [u8; 112],
461 #[cfg(target_pointer_width = "64")]
462 __pad: [u8; 108],
463 }
464
465 pub struct lastlog {
466 ll_time: ::time_t,
467 ll_line: [::c_char; UT_LINESIZE],
468 ll_host: [::c_char; UT_HOSTSIZE],
469 }
470
471 pub struct utmp {
472 pub ut_line: [::c_char; UT_LINESIZE],
473 pub ut_name: [::c_char; UT_NAMESIZE],
474 pub ut_host: [::c_char; UT_HOSTSIZE],
475 pub ut_time: ::time_t,
476 }
477
478 pub union mount_info {
479 pub ufs_args: ufs_args,
480 pub mfs_args: mfs_args,
481 pub nfs_args: nfs_args,
482 pub iso_args: iso_args,
483 pub msdosfs_args: msdosfs_args,
484 pub ntfs_args: ntfs_args,
485 pub tmpfs_args: tmpfs_args,
486 align: [::c_char; 160],
487 }
488
489 }
490
491 cfg_if! {
492 if #[cfg(feature = "extra_traits")] {
493 impl PartialEq for dirent {
494 fn eq(&self, other: &dirent) -> bool {
495 self.d_fileno == other.d_fileno
496 && self.d_off == other.d_off
497 && self.d_reclen == other.d_reclen
498 && self.d_type == other.d_type
499 && self.d_namlen == other.d_namlen
500 && self
501 .d_name
502 .iter()
503 .zip(other.d_name.iter())
504 .all(|(a,b)| a == b)
505 }
506 }
507
508 impl Eq for dirent {}
509
510 impl ::fmt::Debug for dirent {
511 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
512 f.debug_struct("dirent")
513 .field("d_fileno", &self.d_fileno)
514 .field("d_off", &self.d_off)
515 .field("d_reclen", &self.d_reclen)
516 .field("d_type", &self.d_type)
517 .field("d_namlen", &self.d_namlen)
518 // FIXME: .field("d_name", &self.d_name)
519 .finish()
520 }
521 }
522
523 impl ::hash::Hash for dirent {
524 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
525 self.d_fileno.hash(state);
526 self.d_off.hash(state);
527 self.d_reclen.hash(state);
528 self.d_type.hash(state);
529 self.d_namlen.hash(state);
530 self.d_name.hash(state);
531 }
532 }
533
534 impl PartialEq for sockaddr_storage {
535 fn eq(&self, other: &sockaddr_storage) -> bool {
536 self.ss_len == other.ss_len
537 && self.ss_family == other.ss_family
538 }
539 }
540
541 impl Eq for sockaddr_storage {}
542
543 impl ::fmt::Debug for sockaddr_storage {
544 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
545 f.debug_struct("sockaddr_storage")
546 .field("ss_len", &self.ss_len)
547 .field("ss_family", &self.ss_family)
548 .finish()
549 }
550 }
551
552 impl ::hash::Hash for sockaddr_storage {
553 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
554 self.ss_len.hash(state);
555 self.ss_family.hash(state);
556 }
557 }
558
559 impl PartialEq for siginfo_t {
560 fn eq(&self, other: &siginfo_t) -> bool {
561 self.si_signo == other.si_signo
562 && self.si_code == other.si_code
563 && self.si_errno == other.si_errno
564 && self.si_addr == other.si_addr
565 }
566 }
567
568 impl Eq for siginfo_t {}
569
570 impl ::fmt::Debug for siginfo_t {
571 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
572 f.debug_struct("siginfo_t")
573 .field("si_signo", &self.si_signo)
574 .field("si_code", &self.si_code)
575 .field("si_errno", &self.si_errno)
576 .field("si_addr", &self.si_addr)
577 .finish()
578 }
579 }
580
581 impl ::hash::Hash for siginfo_t {
582 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
583 self.si_signo.hash(state);
584 self.si_code.hash(state);
585 self.si_errno.hash(state);
586 self.si_addr.hash(state);
587 }
588 }
589
590 impl PartialEq for lastlog {
591 fn eq(&self, other: &lastlog) -> bool {
592 self.ll_time == other.ll_time
593 && self
594 .ll_line
595 .iter()
596 .zip(other.ll_line.iter())
597 .all(|(a,b)| a == b)
598 && self
599 .ll_host
600 .iter()
601 .zip(other.ll_host.iter())
602 .all(|(a,b)| a == b)
603 }
604 }
605
606 impl Eq for lastlog {}
607
608 impl ::fmt::Debug for lastlog {
609 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
610 f.debug_struct("lastlog")
611 .field("ll_time", &self.ll_time)
612 // FIXME: .field("ll_line", &self.ll_line)
613 // FIXME: .field("ll_host", &self.ll_host)
614 .finish()
615 }
616 }
617
618 impl ::hash::Hash for lastlog {
619 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
620 self.ll_time.hash(state);
621 self.ll_line.hash(state);
622 self.ll_host.hash(state);
623 }
624 }
625
626 impl PartialEq for utmp {
627 fn eq(&self, other: &utmp) -> bool {
628 self.ut_time == other.ut_time
629 && self
630 .ut_line
631 .iter()
632 .zip(other.ut_line.iter())
633 .all(|(a,b)| a == b)
634 && self
635 .ut_name
636 .iter()
637 .zip(other.ut_name.iter())
638 .all(|(a,b)| a == b)
639 && self
640 .ut_host
641 .iter()
642 .zip(other.ut_host.iter())
643 .all(|(a,b)| a == b)
644 }
645 }
646
647 impl Eq for utmp {}
648
649 impl ::fmt::Debug for utmp {
650 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
651 f.debug_struct("utmp")
652 // FIXME: .field("ut_line", &self.ut_line)
653 // FIXME: .field("ut_name", &self.ut_name)
654 // FIXME: .field("ut_host", &self.ut_host)
655 .field("ut_time", &self.ut_time)
656 .finish()
657 }
658 }
659
660 impl ::hash::Hash for utmp {
661 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
662 self.ut_line.hash(state);
663 self.ut_name.hash(state);
664 self.ut_host.hash(state);
665 self.ut_time.hash(state);
666 }
667 }
668
669 impl PartialEq for mount_info {
670 fn eq(&self, other: &mount_info) -> bool {
671 unsafe {
672 self.align
673 .iter()
674 .zip(other.align.iter())
675 .all(|(a,b)| a == b)
676 }
677 }
678 }
679
680 impl Eq for mount_info { }
681
682 impl ::fmt::Debug for mount_info {
683 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
684 f.debug_struct("mount_info")
685 // FIXME: .field("align", &self.align)
686 .finish()
687 }
688 }
689
690 impl ::hash::Hash for mount_info {
691 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
692 unsafe { self.align.hash(state) };
693 }
694 }
695 }
696 }
697
698 cfg_if! {
699 if #[cfg(libc_union)] {
700 s_no_extra_traits! {
701 // This type uses the union mount_info:
702 pub struct statfs {
703 pub f_flags: u32,
704 pub f_bsize: u32,
705 pub f_iosize: u32,
706 pub f_blocks: u64,
707 pub f_bfree: u64,
708 pub f_bavail: i64,
709 pub f_files: u64,
710 pub f_ffree: u64,
711 pub f_favail: i64,
712 pub f_syncwrites: u64,
713 pub f_syncreads: u64,
714 pub f_asyncwrites: u64,
715 pub f_asyncreads: u64,
716 pub f_fsid: ::fsid_t,
717 pub f_namemax: u32,
718 pub f_owner: ::uid_t,
719 pub f_ctime: u64,
720 pub f_fstypename: [::c_char; 16],
721 pub f_mntonname: [::c_char; 90],
722 pub f_mntfromname: [::c_char; 90],
723 pub f_mntfromspec: [::c_char; 90],
724 pub mount_info: mount_info,
725 }
726 }
727
728 cfg_if! {
729 if #[cfg(feature = "extra_traits")] {
730 impl PartialEq for statfs {
731 fn eq(&self, other: &statfs) -> bool {
732 self.f_flags == other.f_flags
733 && self.f_bsize == other.f_bsize
734 && self.f_iosize == other.f_iosize
735 && self.f_blocks == other.f_blocks
736 && self.f_bfree == other.f_bfree
737 && self.f_bavail == other.f_bavail
738 && self.f_files == other.f_files
739 && self.f_ffree == other.f_ffree
740 && self.f_favail == other.f_favail
741 && self.f_syncwrites == other.f_syncwrites
742 && self.f_syncreads == other.f_syncreads
743 && self.f_asyncwrites == other.f_asyncwrites
744 && self.f_asyncreads == other.f_asyncreads
745 && self.f_fsid == other.f_fsid
746 && self.f_namemax == other.f_namemax
747 && self.f_owner == other.f_owner
748 && self.f_ctime == other.f_ctime
749 && self.f_fstypename
750 .iter()
751 .zip(other.f_fstypename.iter())
752 .all(|(a,b)| a == b)
753 && self.f_mntonname
754 .iter()
755 .zip(other.f_mntonname.iter())
756 .all(|(a,b)| a == b)
757 && self.f_mntfromname
758 .iter()
759 .zip(other.f_mntfromname.iter())
760 .all(|(a,b)| a == b)
761 && self.f_mntfromspec
762 .iter()
763 .zip(other.f_mntfromspec.iter())
764 .all(|(a,b)| a == b)
765 && self.mount_info == other.mount_info
766 }
767 }
768
769 impl Eq for statfs { }
770
771 impl ::fmt::Debug for statfs {
772 fn fmt(&self, f: &mut ::fmt::Formatter)
773 -> ::fmt::Result {
774 f.debug_struct("statfs")
775 .field("f_flags", &self.f_flags)
776 .field("f_bsize", &self.f_bsize)
777 .field("f_iosize", &self.f_iosize)
778 .field("f_blocks", &self.f_blocks)
779 .field("f_bfree", &self.f_bfree)
780 .field("f_bavail", &self.f_bavail)
781 .field("f_files", &self.f_files)
782 .field("f_ffree", &self.f_ffree)
783 .field("f_favail", &self.f_favail)
784 .field("f_syncwrites", &self.f_syncwrites)
785 .field("f_syncreads", &self.f_syncreads)
786 .field("f_asyncwrites", &self.f_asyncwrites)
787 .field("f_asyncreads", &self.f_asyncreads)
788 .field("f_fsid", &self.f_fsid)
789 .field("f_namemax", &self.f_namemax)
790 .field("f_owner", &self.f_owner)
791 .field("f_ctime", &self.f_ctime)
792 // FIXME: .field("f_fstypename", &self.f_fstypename)
793 // FIXME: .field("f_mntonname", &self.f_mntonname)
794 // FIXME: .field("f_mntfromname", &self.f_mntfromname)
795 // FIXME: .field("f_mntfromspec", &self.f_mntfromspec)
796 .field("mount_info", &self.mount_info)
797 .finish()
798 }
799 }
800
801 impl ::hash::Hash for statfs {
802 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
803 self.f_flags.hash(state);
804 self.f_bsize.hash(state);
805 self.f_iosize.hash(state);
806 self.f_blocks.hash(state);
807 self.f_bfree.hash(state);
808 self.f_bavail.hash(state);
809 self.f_files.hash(state);
810 self.f_ffree.hash(state);
811 self.f_favail.hash(state);
812 self.f_syncwrites.hash(state);
813 self.f_syncreads.hash(state);
814 self.f_asyncwrites.hash(state);
815 self.f_asyncreads.hash(state);
816 self.f_fsid.hash(state);
817 self.f_namemax.hash(state);
818 self.f_owner.hash(state);
819 self.f_ctime.hash(state);
820 self.f_fstypename.hash(state);
821 self.f_mntonname.hash(state);
822 self.f_mntfromname.hash(state);
823 self.f_mntfromspec.hash(state);
824 self.mount_info.hash(state);
825 }
826 }
827 }
828 }
829 }
830 }
831
832 pub const UT_NAMESIZE: usize = 32;
833 pub const UT_LINESIZE: usize = 8;
834 pub const UT_HOSTSIZE: usize = 256;
835
836 pub const O_CLOEXEC: ::c_int = 0x10000;
837 pub const O_DIRECTORY: ::c_int = 0x20000;
838 pub const O_RSYNC: ::c_int = O_SYNC;
839
840 pub const MS_SYNC: ::c_int = 0x0002;
841 pub const MS_INVALIDATE: ::c_int = 0x0004;
842
843 pub const POLLNORM: ::c_short = ::POLLRDNORM;
844
845 pub const ENOATTR: ::c_int = 83;
846 pub const EILSEQ: ::c_int = 84;
847 pub const EOVERFLOW: ::c_int = 87;
848 pub const ECANCELED: ::c_int = 88;
849 pub const EIDRM: ::c_int = 89;
850 pub const ENOMSG: ::c_int = 90;
851 pub const ENOTSUP: ::c_int = 91;
852 pub const EBADMSG: ::c_int = 92;
853 pub const ENOTRECOVERABLE: ::c_int = 93;
854 pub const EOWNERDEAD: ::c_int = 94;
855 pub const EPROTO: ::c_int = 95;
856 pub const ELAST: ::c_int = 95;
857
858 pub const F_DUPFD_CLOEXEC: ::c_int = 10;
859
860 pub const UTIME_OMIT: c_long = -1;
861 pub const UTIME_NOW: c_long = -2;
862
863 pub const AT_FDCWD: ::c_int = -100;
864 pub const AT_EACCESS: ::c_int = 0x01;
865 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x02;
866 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x04;
867 pub const AT_REMOVEDIR: ::c_int = 0x08;
868
869 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
870 pub const RLIM_NLIMITS: ::c_int = 9;
871
872 pub const SO_TIMESTAMP: ::c_int = 0x0800;
873 pub const SO_SNDTIMEO: ::c_int = 0x1005;
874 pub const SO_RCVTIMEO: ::c_int = 0x1006;
875 pub const SO_BINDANY: ::c_int = 0x1000;
876 pub const SO_NETPROC: ::c_int = 0x1020;
877 pub const SO_RTABLE: ::c_int = 0x1021;
878 pub const SO_PEERCRED: ::c_int = 0x1022;
879 pub const SO_SPLICE: ::c_int = 0x1023;
880
881 // sys/netinet/in.h
882 // Protocols (RFC 1700)
883 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
884
885 // IPPROTO_IP defined in src/unix/mod.rs
886 /// Hop-by-hop option header
887 pub const IPPROTO_HOPOPTS: ::c_int = 0;
888 // IPPROTO_ICMP defined in src/unix/mod.rs
889 /// group mgmt protocol
890 pub const IPPROTO_IGMP: ::c_int = 2;
891 /// gateway^2 (deprecated)
892 pub const IPPROTO_GGP: ::c_int = 3;
893 /// for compatibility
894 pub const IPPROTO_IPIP: ::c_int = 4;
895 // IPPROTO_TCP defined in src/unix/mod.rs
896 /// exterior gateway protocol
897 pub const IPPROTO_EGP: ::c_int = 8;
898 /// pup
899 pub const IPPROTO_PUP: ::c_int = 12;
900 // IPPROTO_UDP defined in src/unix/mod.rs
901 /// xns idp
902 pub const IPPROTO_IDP: ::c_int = 22;
903 /// tp-4 w/ class negotiation
904 pub const IPPROTO_TP: ::c_int = 29;
905 // IPPROTO_IPV6 defined in src/unix/mod.rs
906 /// IP6 routing header
907 pub const IPPROTO_ROUTING: ::c_int = 43;
908 /// IP6 fragmentation header
909 pub const IPPROTO_FRAGMENT: ::c_int = 44;
910 /// resource reservation
911 pub const IPPROTO_RSVP: ::c_int = 46;
912 /// General Routing Encap.
913 pub const IPPROTO_GRE: ::c_int = 47;
914 /// IP6 Encap Sec. Payload
915 pub const IPPROTO_ESP: ::c_int = 50;
916 /// IP6 Auth Header
917 pub const IPPROTO_AH: ::c_int = 51;
918 /// IP Mobility RFC 2004
919 pub const IPPROTO_MOBILE: ::c_int = 55;
920 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
921 /// IP6 no next header
922 pub const IPPROTO_NONE: ::c_int = 59;
923 /// IP6 destination option
924 pub const IPPROTO_DSTOPTS: ::c_int = 60;
925 /// ISO cnlp
926 pub const IPPROTO_EON: ::c_int = 80;
927 /// Ethernet-in-IP
928 pub const IPPROTO_ETHERIP: ::c_int = 97;
929 /// encapsulation header
930 pub const IPPROTO_ENCAP: ::c_int = 98;
931 /// Protocol indep. multicast
932 pub const IPPROTO_PIM: ::c_int = 103;
933 /// IP Payload Comp. Protocol
934 pub const IPPROTO_IPCOMP: ::c_int = 108;
935 /// CARP
936 pub const IPPROTO_CARP: ::c_int = 112;
937 /// unicast MPLS packet
938 pub const IPPROTO_MPLS: ::c_int = 137;
939 /// PFSYNC
940 pub const IPPROTO_PFSYNC: ::c_int = 240;
941 pub const IPPROTO_MAX: ::c_int = 256;
942
943 // Only used internally, so it can be outside the range of valid IP protocols
944 pub const IPPROTO_DIVERT: ::c_int = 258;
945
946 pub const IP_RECVDSTADDR: ::c_int = 7;
947 pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR;
948 pub const IP_RECVIF: ::c_int = 30;
949
950 // sys/netinet/in.h
951 pub const TCP_MD5SIG: ::c_int = 0x04;
952 pub const TCP_NOPUSH: ::c_int = 0x10;
953
954 pub const AF_ECMA: ::c_int = 8;
955 pub const AF_ROUTE: ::c_int = 17;
956 pub const AF_ENCAP: ::c_int = 28;
957 pub const AF_SIP: ::c_int = 29;
958 pub const AF_KEY: ::c_int = 30;
959 pub const pseudo_AF_HDRCMPLT: ::c_int = 31;
960 pub const AF_BLUETOOTH: ::c_int = 32;
961 pub const AF_MPLS: ::c_int = 33;
962 pub const pseudo_AF_PFLOW: ::c_int = 34;
963 pub const pseudo_AF_PIPEX: ::c_int = 35;
964 pub const NET_RT_DUMP: ::c_int = 1;
965 pub const NET_RT_FLAGS: ::c_int = 2;
966 pub const NET_RT_IFLIST: ::c_int = 3;
967 pub const NET_RT_STATS: ::c_int = 4;
968 pub const NET_RT_TABLE: ::c_int = 5;
969 pub const NET_RT_IFNAMES: ::c_int = 6;
970 #[doc(hidden)]
971 #[deprecated(
972 since = "0.2.95",
973 note = "Possibly increasing over the releases and might not be so used in the field"
974 )]
975 pub const NET_RT_MAXID: ::c_int = 7;
976
977 pub const IPV6_JOIN_GROUP: ::c_int = 12;
978 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
979
980 pub const PF_ROUTE: ::c_int = AF_ROUTE;
981 pub const PF_ECMA: ::c_int = AF_ECMA;
982 pub const PF_ENCAP: ::c_int = AF_ENCAP;
983 pub const PF_SIP: ::c_int = AF_SIP;
984 pub const PF_KEY: ::c_int = AF_KEY;
985 pub const PF_BPF: ::c_int = pseudo_AF_HDRCMPLT;
986 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
987 pub const PF_MPLS: ::c_int = AF_MPLS;
988 pub const PF_PFLOW: ::c_int = pseudo_AF_PFLOW;
989 pub const PF_PIPEX: ::c_int = pseudo_AF_PIPEX;
990
991 pub const SCM_TIMESTAMP: ::c_int = 0x04;
992
993 pub const O_DSYNC: ::c_int = 128;
994
995 pub const MAP_RENAME: ::c_int = 0x0000;
996 pub const MAP_NORESERVE: ::c_int = 0x0000;
997 pub const MAP_HASSEMAPHORE: ::c_int = 0x0000;
998
999 pub const EIPSEC: ::c_int = 82;
1000 pub const ENOMEDIUM: ::c_int = 85;
1001 pub const EMEDIUMTYPE: ::c_int = 86;
1002
1003 pub const EAI_BADFLAGS: ::c_int = -1;
1004 pub const EAI_NONAME: ::c_int = -2;
1005 pub const EAI_AGAIN: ::c_int = -3;
1006 pub const EAI_FAIL: ::c_int = -4;
1007 pub const EAI_NODATA: ::c_int = -5;
1008 pub const EAI_FAMILY: ::c_int = -6;
1009 pub const EAI_SOCKTYPE: ::c_int = -7;
1010 pub const EAI_SERVICE: ::c_int = -8;
1011 pub const EAI_MEMORY: ::c_int = -10;
1012 pub const EAI_SYSTEM: ::c_int = -11;
1013 pub const EAI_OVERFLOW: ::c_int = -14;
1014
1015 pub const RUSAGE_THREAD: ::c_int = 1;
1016
1017 pub const MAP_COPY: ::c_int = 0x0002;
1018 pub const MAP_NOEXTEND: ::c_int = 0x0000;
1019
1020 pub const _PC_LINK_MAX: ::c_int = 1;
1021 pub const _PC_MAX_CANON: ::c_int = 2;
1022 pub const _PC_MAX_INPUT: ::c_int = 3;
1023 pub const _PC_NAME_MAX: ::c_int = 4;
1024 pub const _PC_PATH_MAX: ::c_int = 5;
1025 pub const _PC_PIPE_BUF: ::c_int = 6;
1026 pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
1027 pub const _PC_NO_TRUNC: ::c_int = 8;
1028 pub const _PC_VDISABLE: ::c_int = 9;
1029 pub const _PC_2_SYMLINKS: ::c_int = 10;
1030 pub const _PC_ALLOC_SIZE_MIN: ::c_int = 11;
1031 pub const _PC_ASYNC_IO: ::c_int = 12;
1032 pub const _PC_FILESIZEBITS: ::c_int = 13;
1033 pub const _PC_PRIO_IO: ::c_int = 14;
1034 pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 15;
1035 pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 16;
1036 pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 17;
1037 pub const _PC_REC_XFER_ALIGN: ::c_int = 18;
1038 pub const _PC_SYMLINK_MAX: ::c_int = 19;
1039 pub const _PC_SYNC_IO: ::c_int = 20;
1040 pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 21;
1041
1042 pub const _SC_CLK_TCK: ::c_int = 3;
1043 pub const _SC_SEM_NSEMS_MAX: ::c_int = 31;
1044 pub const _SC_SEM_VALUE_MAX: ::c_int = 32;
1045 pub const _SC_HOST_NAME_MAX: ::c_int = 33;
1046 pub const _SC_MONOTONIC_CLOCK: ::c_int = 34;
1047 pub const _SC_2_PBS: ::c_int = 35;
1048 pub const _SC_2_PBS_ACCOUNTING: ::c_int = 36;
1049 pub const _SC_2_PBS_CHECKPOINT: ::c_int = 37;
1050 pub const _SC_2_PBS_LOCATE: ::c_int = 38;
1051 pub const _SC_2_PBS_MESSAGE: ::c_int = 39;
1052 pub const _SC_2_PBS_TRACK: ::c_int = 40;
1053 pub const _SC_ADVISORY_INFO: ::c_int = 41;
1054 pub const _SC_AIO_LISTIO_MAX: ::c_int = 42;
1055 pub const _SC_AIO_MAX: ::c_int = 43;
1056 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44;
1057 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 45;
1058 pub const _SC_ATEXIT_MAX: ::c_int = 46;
1059 pub const _SC_BARRIERS: ::c_int = 47;
1060 pub const _SC_CLOCK_SELECTION: ::c_int = 48;
1061 pub const _SC_CPUTIME: ::c_int = 49;
1062 pub const _SC_DELAYTIMER_MAX: ::c_int = 50;
1063 pub const _SC_IOV_MAX: ::c_int = 51;
1064 pub const _SC_IPV6: ::c_int = 52;
1065 pub const _SC_MAPPED_FILES: ::c_int = 53;
1066 pub const _SC_MEMLOCK: ::c_int = 54;
1067 pub const _SC_MEMLOCK_RANGE: ::c_int = 55;
1068 pub const _SC_MEMORY_PROTECTION: ::c_int = 56;
1069 pub const _SC_MESSAGE_PASSING: ::c_int = 57;
1070 pub const _SC_MQ_OPEN_MAX: ::c_int = 58;
1071 pub const _SC_MQ_PRIO_MAX: ::c_int = 59;
1072 pub const _SC_PRIORITIZED_IO: ::c_int = 60;
1073 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 61;
1074 pub const _SC_RAW_SOCKETS: ::c_int = 62;
1075 pub const _SC_READER_WRITER_LOCKS: ::c_int = 63;
1076 pub const _SC_REALTIME_SIGNALS: ::c_int = 64;
1077 pub const _SC_REGEXP: ::c_int = 65;
1078 pub const _SC_RTSIG_MAX: ::c_int = 66;
1079 pub const _SC_SEMAPHORES: ::c_int = 67;
1080 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 68;
1081 pub const _SC_SHELL: ::c_int = 69;
1082 pub const _SC_SIGQUEUE_MAX: ::c_int = 70;
1083 pub const _SC_SPAWN: ::c_int = 71;
1084 pub const _SC_SPIN_LOCKS: ::c_int = 72;
1085 pub const _SC_SPORADIC_SERVER: ::c_int = 73;
1086 pub const _SC_SS_REPL_MAX: ::c_int = 74;
1087 pub const _SC_SYNCHRONIZED_IO: ::c_int = 75;
1088 pub const _SC_SYMLOOP_MAX: ::c_int = 76;
1089 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
1090 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
1091 pub const _SC_THREAD_CPUTIME: ::c_int = 79;
1092 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 80;
1093 pub const _SC_THREAD_KEYS_MAX: ::c_int = 81;
1094 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 82;
1095 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 83;
1096 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 84;
1097 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 85;
1098 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 86;
1099 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 87;
1100 pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 88;
1101 pub const _SC_THREAD_STACK_MIN: ::c_int = 89;
1102 pub const _SC_THREAD_THREADS_MAX: ::c_int = 90;
1103 pub const _SC_THREADS: ::c_int = 91;
1104 pub const _SC_TIMEOUTS: ::c_int = 92;
1105 pub const _SC_TIMER_MAX: ::c_int = 93;
1106 pub const _SC_TIMERS: ::c_int = 94;
1107 pub const _SC_TRACE: ::c_int = 95;
1108 pub const _SC_TRACE_EVENT_FILTER: ::c_int = 96;
1109 pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 97;
1110 pub const _SC_TRACE_INHERIT: ::c_int = 98;
1111 pub const _SC_TRACE_LOG: ::c_int = 99;
1112 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 100;
1113 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 101;
1114 pub const _SC_LOGIN_NAME_MAX: ::c_int = 102;
1115 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 103;
1116 pub const _SC_TRACE_NAME_MAX: ::c_int = 104;
1117 pub const _SC_TRACE_SYS_MAX: ::c_int = 105;
1118 pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 106;
1119 pub const _SC_TTY_NAME_MAX: ::c_int = 107;
1120 pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 108;
1121 pub const _SC_V6_ILP32_OFF32: ::c_int = 109;
1122 pub const _SC_V6_ILP32_OFFBIG: ::c_int = 110;
1123 pub const _SC_V6_LP64_OFF64: ::c_int = 111;
1124 pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 112;
1125 pub const _SC_V7_ILP32_OFF32: ::c_int = 113;
1126 pub const _SC_V7_ILP32_OFFBIG: ::c_int = 114;
1127 pub const _SC_V7_LP64_OFF64: ::c_int = 115;
1128 pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 116;
1129 pub const _SC_XOPEN_CRYPT: ::c_int = 117;
1130 pub const _SC_XOPEN_ENH_I18N: ::c_int = 118;
1131 pub const _SC_XOPEN_LEGACY: ::c_int = 119;
1132 pub const _SC_XOPEN_REALTIME: ::c_int = 120;
1133 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 121;
1134 pub const _SC_XOPEN_STREAMS: ::c_int = 122;
1135 pub const _SC_XOPEN_UNIX: ::c_int = 123;
1136 pub const _SC_XOPEN_UUCP: ::c_int = 124;
1137 pub const _SC_XOPEN_VERSION: ::c_int = 125;
1138 pub const _SC_PHYS_PAGES: ::c_int = 500;
1139 pub const _SC_AVPHYS_PAGES: ::c_int = 501;
1140 pub const _SC_NPROCESSORS_CONF: ::c_int = 502;
1141 pub const _SC_NPROCESSORS_ONLN: ::c_int = 503;
1142
1143 pub const FD_SETSIZE: usize = 1024;
1144
1145 pub const ST_NOSUID: ::c_ulong = 2;
1146
1147 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
1148 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
1149 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
1150
1151 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
1152 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
1153 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
1154 pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4;
1155 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP;
1156
1157 pub const EVFILT_AIO: i16 = -3;
1158 pub const EVFILT_PROC: i16 = -5;
1159 pub const EVFILT_READ: i16 = -1;
1160 pub const EVFILT_SIGNAL: i16 = -6;
1161 pub const EVFILT_TIMER: i16 = -7;
1162 pub const EVFILT_VNODE: i16 = -4;
1163 pub const EVFILT_WRITE: i16 = -2;
1164
1165 pub const EV_ADD: u16 = 0x1;
1166 pub const EV_DELETE: u16 = 0x2;
1167 pub const EV_ENABLE: u16 = 0x4;
1168 pub const EV_DISABLE: u16 = 0x8;
1169 pub const EV_ONESHOT: u16 = 0x10;
1170 pub const EV_CLEAR: u16 = 0x20;
1171 pub const EV_RECEIPT: u16 = 0x40;
1172 pub const EV_DISPATCH: u16 = 0x80;
1173 pub const EV_FLAG1: u16 = 0x2000;
1174 pub const EV_ERROR: u16 = 0x4000;
1175 pub const EV_EOF: u16 = 0x8000;
1176 pub const EV_SYSFLAGS: u16 = 0xf000;
1177
1178 pub const NOTE_LOWAT: u32 = 0x00000001;
1179 pub const NOTE_EOF: u32 = 0x00000002;
1180 pub const NOTE_DELETE: u32 = 0x00000001;
1181 pub const NOTE_WRITE: u32 = 0x00000002;
1182 pub const NOTE_EXTEND: u32 = 0x00000004;
1183 pub const NOTE_ATTRIB: u32 = 0x00000008;
1184 pub const NOTE_LINK: u32 = 0x00000010;
1185 pub const NOTE_RENAME: u32 = 0x00000020;
1186 pub const NOTE_REVOKE: u32 = 0x00000040;
1187 pub const NOTE_TRUNCATE: u32 = 0x00000080;
1188 pub const NOTE_EXIT: u32 = 0x80000000;
1189 pub const NOTE_FORK: u32 = 0x40000000;
1190 pub const NOTE_EXEC: u32 = 0x20000000;
1191 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
1192 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
1193 pub const NOTE_TRACK: u32 = 0x00000001;
1194 pub const NOTE_TRACKERR: u32 = 0x00000002;
1195 pub const NOTE_CHILD: u32 = 0x00000004;
1196
1197 pub const TMP_MAX: ::c_uint = 0x7fffffff;
1198
1199 pub const AI_PASSIVE: ::c_int = 1;
1200 pub const AI_CANONNAME: ::c_int = 2;
1201 pub const AI_NUMERICHOST: ::c_int = 4;
1202 pub const AI_EXT: ::c_int = 8;
1203 pub const AI_NUMERICSERV: ::c_int = 16;
1204 pub const AI_FQDN: ::c_int = 32;
1205 pub const AI_ADDRCONFIG: ::c_int = 64;
1206
1207 pub const NI_NUMERICHOST: ::c_int = 1;
1208 pub const NI_NUMERICSERV: ::c_int = 2;
1209 pub const NI_NOFQDN: ::c_int = 4;
1210 pub const NI_NAMEREQD: ::c_int = 8;
1211 pub const NI_DGRAM: ::c_int = 16;
1212
1213 pub const NI_MAXHOST: ::size_t = 256;
1214
1215 pub const RTLD_LOCAL: ::c_int = 0;
1216
1217 pub const CTL_MAXNAME: ::c_int = 12;
1218
1219 pub const CTLTYPE_NODE: ::c_int = 1;
1220 pub const CTLTYPE_INT: ::c_int = 2;
1221 pub const CTLTYPE_STRING: ::c_int = 3;
1222 pub const CTLTYPE_QUAD: ::c_int = 4;
1223 pub const CTLTYPE_STRUCT: ::c_int = 5;
1224
1225 pub const CTL_UNSPEC: ::c_int = 0;
1226 pub const CTL_KERN: ::c_int = 1;
1227 pub const CTL_VM: ::c_int = 2;
1228 pub const CTL_FS: ::c_int = 3;
1229 pub const CTL_NET: ::c_int = 4;
1230 pub const CTL_DEBUG: ::c_int = 5;
1231 pub const CTL_HW: ::c_int = 6;
1232 pub const CTL_MACHDEP: ::c_int = 7;
1233 pub const CTL_DDB: ::c_int = 9;
1234 pub const CTL_VFS: ::c_int = 10;
1235 pub const CTL_MAXID: ::c_int = 11;
1236
1237 pub const HW_NCPUONLINE: ::c_int = 25;
1238
1239 pub const KERN_OSTYPE: ::c_int = 1;
1240 pub const KERN_OSRELEASE: ::c_int = 2;
1241 pub const KERN_OSREV: ::c_int = 3;
1242 pub const KERN_VERSION: ::c_int = 4;
1243 pub const KERN_MAXVNODES: ::c_int = 5;
1244 pub const KERN_MAXPROC: ::c_int = 6;
1245 pub const KERN_MAXFILES: ::c_int = 7;
1246 pub const KERN_ARGMAX: ::c_int = 8;
1247 pub const KERN_SECURELVL: ::c_int = 9;
1248 pub const KERN_HOSTNAME: ::c_int = 10;
1249 pub const KERN_HOSTID: ::c_int = 11;
1250 pub const KERN_CLOCKRATE: ::c_int = 12;
1251 pub const KERN_PROF: ::c_int = 16;
1252 pub const KERN_POSIX1: ::c_int = 17;
1253 pub const KERN_NGROUPS: ::c_int = 18;
1254 pub const KERN_JOB_CONTROL: ::c_int = 19;
1255 pub const KERN_SAVED_IDS: ::c_int = 20;
1256 pub const KERN_BOOTTIME: ::c_int = 21;
1257 pub const KERN_DOMAINNAME: ::c_int = 22;
1258 pub const KERN_MAXPARTITIONS: ::c_int = 23;
1259 pub const KERN_RAWPARTITION: ::c_int = 24;
1260 pub const KERN_MAXTHREAD: ::c_int = 25;
1261 pub const KERN_NTHREADS: ::c_int = 26;
1262 pub const KERN_OSVERSION: ::c_int = 27;
1263 pub const KERN_SOMAXCONN: ::c_int = 28;
1264 pub const KERN_SOMINCONN: ::c_int = 29;
1265 #[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")]
1266 pub const KERN_USERMOUNT: ::c_int = 30;
1267 pub const KERN_NOSUIDCOREDUMP: ::c_int = 32;
1268 pub const KERN_FSYNC: ::c_int = 33;
1269 pub const KERN_SYSVMSG: ::c_int = 34;
1270 pub const KERN_SYSVSEM: ::c_int = 35;
1271 pub const KERN_SYSVSHM: ::c_int = 36;
1272 #[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")]
1273 pub const KERN_ARND: ::c_int = 37;
1274 pub const KERN_MSGBUFSIZE: ::c_int = 38;
1275 pub const KERN_MALLOCSTATS: ::c_int = 39;
1276 pub const KERN_CPTIME: ::c_int = 40;
1277 pub const KERN_NCHSTATS: ::c_int = 41;
1278 pub const KERN_FORKSTAT: ::c_int = 42;
1279 pub const KERN_NSELCOLL: ::c_int = 43;
1280 pub const KERN_TTY: ::c_int = 44;
1281 pub const KERN_CCPU: ::c_int = 45;
1282 pub const KERN_FSCALE: ::c_int = 46;
1283 pub const KERN_NPROCS: ::c_int = 47;
1284 pub const KERN_MSGBUF: ::c_int = 48;
1285 pub const KERN_POOL: ::c_int = 49;
1286 pub const KERN_STACKGAPRANDOM: ::c_int = 50;
1287 pub const KERN_SYSVIPC_INFO: ::c_int = 51;
1288 pub const KERN_SPLASSERT: ::c_int = 54;
1289 pub const KERN_PROC_ARGS: ::c_int = 55;
1290 pub const KERN_NFILES: ::c_int = 56;
1291 pub const KERN_TTYCOUNT: ::c_int = 57;
1292 pub const KERN_NUMVNODES: ::c_int = 58;
1293 pub const KERN_MBSTAT: ::c_int = 59;
1294 pub const KERN_SEMINFO: ::c_int = 61;
1295 pub const KERN_SHMINFO: ::c_int = 62;
1296 pub const KERN_INTRCNT: ::c_int = 63;
1297 pub const KERN_WATCHDOG: ::c_int = 64;
1298 pub const KERN_PROC: ::c_int = 66;
1299 pub const KERN_MAXCLUSTERS: ::c_int = 67;
1300 pub const KERN_EVCOUNT: ::c_int = 68;
1301 pub const KERN_TIMECOUNTER: ::c_int = 69;
1302 pub const KERN_MAXLOCKSPERUID: ::c_int = 70;
1303 pub const KERN_CPTIME2: ::c_int = 71;
1304 pub const KERN_CACHEPCT: ::c_int = 72;
1305 pub const KERN_FILE: ::c_int = 73;
1306 pub const KERN_CONSDEV: ::c_int = 75;
1307 pub const KERN_NETLIVELOCKS: ::c_int = 76;
1308 pub const KERN_POOL_DEBUG: ::c_int = 77;
1309 pub const KERN_PROC_CWD: ::c_int = 78;
1310 pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79;
1311 pub const KERN_PROC_VMMAP: ::c_int = 80;
1312 pub const KERN_GLOBAL_PTRACE: ::c_int = 81;
1313 pub const KERN_CONSBUFSIZE: ::c_int = 82;
1314 pub const KERN_CONSBUF: ::c_int = 83;
1315 pub const KERN_AUDIO: ::c_int = 84;
1316 pub const KERN_CPUSTATS: ::c_int = 85;
1317 pub const KERN_PFSTATUS: ::c_int = 86;
1318 pub const KERN_TIMEOUT_STATS: ::c_int = 87;
1319 #[deprecated(
1320 since = "0.2.95",
1321 note = "Possibly increasing over the releases and might not be so used in the field"
1322 )]
1323 pub const KERN_MAXID: ::c_int = 88;
1324
1325 pub const KERN_PROC_ALL: ::c_int = 0;
1326 pub const KERN_PROC_PID: ::c_int = 1;
1327 pub const KERN_PROC_PGRP: ::c_int = 2;
1328 pub const KERN_PROC_SESSION: ::c_int = 3;
1329 pub const KERN_PROC_TTY: ::c_int = 4;
1330 pub const KERN_PROC_UID: ::c_int = 5;
1331 pub const KERN_PROC_RUID: ::c_int = 6;
1332 pub const KERN_PROC_KTHREAD: ::c_int = 7;
1333 pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000;
1334
1335 pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1;
1336 pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2;
1337 pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3;
1338
1339 pub const KERN_PROC_ARGV: ::c_int = 1;
1340 pub const KERN_PROC_NARGV: ::c_int = 2;
1341 pub const KERN_PROC_ENV: ::c_int = 3;
1342 pub const KERN_PROC_NENV: ::c_int = 4;
1343
1344 pub const KI_NGROUPS: ::c_int = 16;
1345 pub const KI_MAXCOMLEN: ::c_int = 24;
1346 pub const KI_WMESGLEN: ::c_int = 8;
1347 pub const KI_MAXLOGNAME: ::c_int = 32;
1348 pub const KI_EMULNAMELEN: ::c_int = 8;
1349
1350 pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS;
1351 pub const OLCUC: ::tcflag_t = 0x20;
1352 pub const ONOCR: ::tcflag_t = 0x40;
1353 pub const ONLRET: ::tcflag_t = 0x80;
1354
1355 //https://github.com/openbsd/src/blob/master/sys/sys/mount.h
1356 pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext
1357 pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers
1358 pub const ISOFSMNT_EXTATT: ::c_int = 0x4; // enable extended attr
1359 pub const ISOFSMNT_NOJOLIET: ::c_int = 0x8; // disable Joliet Ext
1360 pub const ISOFSMNT_SESS: ::c_int = 0x10; // use iso_args.sess
1361
1362 pub const NFS_ARGSVERSION: ::c_int = 4; // change when nfs_args changes
1363
1364 pub const NFSMNT_RESVPORT: ::c_int = 0; // always use reserved ports
1365 pub const NFSMNT_SOFT: ::c_int = 0x1; // soft mount (hard is default)
1366 pub const NFSMNT_WSIZE: ::c_int = 0x2; // set write size
1367 pub const NFSMNT_RSIZE: ::c_int = 0x4; // set read size
1368 pub const NFSMNT_TIMEO: ::c_int = 0x8; // set initial timeout
1369 pub const NFSMNT_RETRANS: ::c_int = 0x10; // set number of request retries
1370 pub const NFSMNT_MAXGRPS: ::c_int = 0x20; // set maximum grouplist size
1371 pub const NFSMNT_INT: ::c_int = 0x40; // allow interrupts on hard mount
1372 pub const NFSMNT_NOCONN: ::c_int = 0x80; // Don't Connect the socket
1373 pub const NFSMNT_NQNFS: ::c_int = 0x100; // Use Nqnfs protocol
1374 pub const NFSMNT_NFSV3: ::c_int = 0x200; // Use NFS Version 3 protocol
1375 pub const NFSMNT_KERB: ::c_int = 0x400; // Use Kerberos authentication
1376 pub const NFSMNT_DUMBTIMR: ::c_int = 0x800; // Don't estimate rtt dynamically
1377 pub const NFSMNT_LEASETERM: ::c_int = 0x1000; // set lease term (nqnfs)
1378 pub const NFSMNT_READAHEAD: ::c_int = 0x2000; // set read ahead
1379 pub const NFSMNT_DEADTHRESH: ::c_int = 0x4000; // set dead server retry thresh
1380 pub const NFSMNT_NOAC: ::c_int = 0x8000; // disable attribute cache
1381 pub const NFSMNT_RDIRPLUS: ::c_int = 0x10000; // Use Readdirplus for V3
1382 pub const NFSMNT_READDIRSIZE: ::c_int = 0x20000; // Set readdir size
1383
1384 /* Flags valid only in mount syscall arguments */
1385 pub const NFSMNT_ACREGMIN: ::c_int = 0x40000; // acregmin field valid
1386 pub const NFSMNT_ACREGMAX: ::c_int = 0x80000; // acregmax field valid
1387 pub const NFSMNT_ACDIRMIN: ::c_int = 0x100000; // acdirmin field valid
1388 pub const NFSMNT_ACDIRMAX: ::c_int = 0x200000; // acdirmax field valid
1389
1390 /* Flags valid only in kernel */
1391 pub const NFSMNT_INTERNAL: ::c_int = 0xfffc0000; // Bits set internally
1392 pub const NFSMNT_HASWRITEVERF: ::c_int = 0x40000; // Has write verifier for V3
1393 pub const NFSMNT_GOTPATHCONF: ::c_int = 0x80000; // Got the V3 pathconf info
1394 pub const NFSMNT_GOTFSINFO: ::c_int = 0x100000; // Got the V3 fsinfo
1395 pub const NFSMNT_MNTD: ::c_int = 0x200000; // Mnt server for mnt point
1396 pub const NFSMNT_DISMINPROG: ::c_int = 0x400000; // Dismount in progress
1397 pub const NFSMNT_DISMNT: ::c_int = 0x800000; // Dismounted
1398 pub const NFSMNT_SNDLOCK: ::c_int = 0x1000000; // Send socket lock
1399 pub const NFSMNT_WANTSND: ::c_int = 0x2000000; // Want above
1400 pub const NFSMNT_RCVLOCK: ::c_int = 0x4000000; // Rcv socket lock
1401 pub const NFSMNT_WANTRCV: ::c_int = 0x8000000; // Want above
1402 pub const NFSMNT_WAITAUTH: ::c_int = 0x10000000; // Wait for authentication
1403 pub const NFSMNT_HASAUTH: ::c_int = 0x20000000; // Has authenticator
1404 pub const NFSMNT_WANTAUTH: ::c_int = 0x40000000; // Wants an authenticator
1405 pub const NFSMNT_AUTHERR: ::c_int = 0x80000000; // Authentication error
1406
1407 pub const MSDOSFSMNT_SHORTNAME: ::c_int = 0x1; // Force old DOS short names only
1408 pub const MSDOSFSMNT_LONGNAME: ::c_int = 0x2; // Force Win'95 long names
1409 pub const MSDOSFSMNT_NOWIN95: ::c_int = 0x4; // Completely ignore Win95 entries
1410
1411 pub const NTFS_MFLAG_CASEINS: ::c_int = 0x1;
1412 pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2;
1413
1414 pub const TMPFS_ARGS_VERSION: ::c_int = 1;
1415
1416 pub const MAP_STACK: ::c_int = 0x4000;
1417 pub const MAP_CONCEAL: ::c_int = 0x8000;
1418
1419 // https://github.com/openbsd/src/blob/master/sys/net/if.h#L187
1420 pub const IFF_UP: ::c_int = 0x1; // interface is up
1421 pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
1422 pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
1423 pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
1424 pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
1425 pub const IFF_STATICARP: ::c_int = 0x20; // only static ARP
1426 pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
1427 pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
1428 pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
1429 pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
1430 pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
1431 pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
1432 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
1433 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
1434 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
1435 pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
1436
1437 pub const PTHREAD_STACK_MIN: ::size_t = 1_usize << _MAX_PAGE_SHIFT;
1438 pub const MINSIGSTKSZ: ::size_t = 3_usize << _MAX_PAGE_SHIFT;
1439 pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + (1_usize << _MAX_PAGE_SHIFT) * 4;
1440
1441 pub const PT_SET_EVENT_MASK: ::c_int = 12;
1442 pub const PT_GET_EVENT_MASK: ::c_int = 13;
1443 pub const PT_GET_PROCESS_STATE: ::c_int = 14;
1444 pub const PT_GET_THREAD_FIRST: ::c_int = 15;
1445 pub const PT_GET_THREAD_NEXT: ::c_int = 16;
1446 pub const PT_FIRSTMACH: ::c_int = 32;
1447
1448 pub const SOCK_CLOEXEC: ::c_int = 0x8000;
1449 pub const SOCK_NONBLOCK: ::c_int = 0x4000;
1450 pub const SOCK_DNS: ::c_int = 0x1000;
1451
1452 pub const BIOCGRSIG: ::c_ulong = 0x40044273;
1453 pub const BIOCSRSIG: ::c_ulong = 0x80044272;
1454 pub const BIOCSDLT: ::c_ulong = 0x8004427a;
1455
1456 pub const PTRACE_FORK: ::c_int = 0x0002;
1457
1458 pub const WCONTINUED: ::c_int = 8;
1459
1460 const_fn! {
1461 {const} fn _ALIGN(p: usize) -> usize {
1462 (p + _ALIGNBYTES) & !_ALIGNBYTES
1463 }
1464 }
1465
1466 f! {
1467 pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
1468 (cmsg as *mut ::c_uchar)
1469 .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1470 }
1471
1472 pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1473 _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
1474 }
1475
1476 pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
1477 -> *mut ::cmsghdr
1478 {
1479 if cmsg.is_null() {
1480 return ::CMSG_FIRSTHDR(mhdr);
1481 };
1482 let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
1483 + _ALIGN(::mem::size_of::<::cmsghdr>());
1484 let max = (*mhdr).msg_control as usize
1485 + (*mhdr).msg_controllen as usize;
1486 if next > max {
1487 0 as *mut ::cmsghdr
1488 } else {
1489 (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
1490 as *mut ::cmsghdr
1491 }
1492 }
1493
1494 pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1495 (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
1496 as ::c_uint
1497 }
1498 }
1499
1500 safe_f! {
1501 pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
1502 status >> 8
1503 }
1504
1505 pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1506 (status & 0o177) != 0o177 && (status & 0o177) != 0
1507 }
1508
1509 pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
1510 (status & 0xff) == 0o177
1511 }
1512
1513 pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
1514 (status & 0o177777) == 0o177777
1515 }
1516 }
1517
1518 extern "C" {
1519 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
1520 pub fn settimeofday(tp: *const ::timeval, tz: *const ::timezone) -> ::c_int;
1521 pub fn execvpe(
1522 file: *const ::c_char,
1523 argv: *const *const ::c_char,
1524 envp: *const *const ::c_char,
1525 ) -> ::c_int;
1526 pub fn pledge(promises: *const ::c_char, execpromises: *const ::c_char) -> ::c_int;
1527 pub fn unveil(path: *const ::c_char, permissions: *const ::c_char) -> ::c_int;
1528 pub fn strtonum(
1529 nptr: *const ::c_char,
1530 minval: ::c_longlong,
1531 maxval: ::c_longlong,
1532 errstr: *mut *const ::c_char,
1533 ) -> ::c_longlong;
1534 pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
1535 pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int;
1536 pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int;
1537 pub fn chflagsat(
1538 fd: ::c_int,
1539 path: *const ::c_char,
1540 flags: ::c_uint,
1541 atflag: ::c_int,
1542 ) -> ::c_int;
1543 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
1544 pub fn getnameinfo(
1545 sa: *const ::sockaddr,
1546 salen: ::socklen_t,
1547 host: *mut ::c_char,
1548 hostlen: ::size_t,
1549 serv: *mut ::c_char,
1550 servlen: ::size_t,
1551 flags: ::c_int,
1552 ) -> ::c_int;
1553 pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int;
1554 pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int;
1555 pub fn kevent(
1556 kq: ::c_int,
1557 changelist: *const ::kevent,
1558 nchanges: ::c_int,
1559 eventlist: *mut ::kevent,
1560 nevents: ::c_int,
1561 timeout: *const ::timespec,
1562 ) -> ::c_int;
1563 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
1564 pub fn getthrid() -> ::pid_t;
1565 pub fn pthread_attr_getguardsize(
1566 attr: *const ::pthread_attr_t,
1567 guardsize: *mut ::size_t,
1568 ) -> ::c_int;
1569 pub fn pthread_attr_getstack(
1570 attr: *const ::pthread_attr_t,
1571 stackaddr: *mut *mut ::c_void,
1572 stacksize: *mut ::size_t,
1573 ) -> ::c_int;
1574 pub fn pthread_main_np() -> ::c_int;
1575 pub fn pthread_get_name_np(tid: ::pthread_t, name: *mut ::c_char, len: ::size_t);
1576 pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
1577 pub fn pthread_stackseg_np(thread: ::pthread_t, sinfo: *mut ::stack_t) -> ::c_int;
1578
1579 pub fn sysctl(
1580 name: *const ::c_int,
1581 namelen: ::c_uint,
1582 oldp: *mut ::c_void,
1583 oldlenp: *mut ::size_t,
1584 newp: *mut ::c_void,
1585 newlen: ::size_t,
1586 ) -> ::c_int;
1587 pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
1588 pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1589 pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
1590 pub fn ptrace(request: ::c_int, pid: ::pid_t, addr: caddr_t, data: ::c_int) -> ::c_int;
1591 pub fn utrace(label: *const ::c_char, addr: *const ::c_void, len: ::size_t) -> ::c_int;
1592 pub fn memmem(
1593 haystack: *const ::c_void,
1594 haystacklen: ::size_t,
1595 needle: *const ::c_void,
1596 needlelen: ::size_t,
1597 ) -> *mut ::c_void;
1598 // #include <link.h>
1599 pub fn dl_iterate_phdr(
1600 callback: ::Option<
1601 unsafe extern "C" fn(
1602 info: *mut dl_phdr_info,
1603 size: usize,
1604 data: *mut ::c_void,
1605 ) -> ::c_int,
1606 >,
1607 data: *mut ::c_void,
1608 ) -> ::c_int;
1609 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
1610 pub fn freelocale(loc: ::locale_t);
1611 pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
1612 pub fn duplocale(base: ::locale_t) -> ::locale_t;
1613
1614 // Added in `OpenBSD` 5.5
1615 pub fn explicit_bzero(s: *mut ::c_void, len: ::size_t);
1616
1617 pub fn setproctitle(fmt: *const ::c_char, ...);
1618
1619 pub fn freezero(ptr: *mut ::c_void, size: ::size_t);
1620 pub fn malloc_conceal(size: ::size_t) -> *mut ::c_void;
1621 pub fn calloc_conceal(nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
1622 }
1623
1624 #[link(name = "execinfo")]
1625 extern "C" {
1626 pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
1627 pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
1628 pub fn backtrace_symbols_fd(
1629 addrlist: *const *mut ::c_void,
1630 len: ::size_t,
1631 fd: ::c_int,
1632 ) -> ::c_int;
1633 pub fn backtrace_symbols_fmt(
1634 addrlist: *const *mut ::c_void,
1635 len: ::size_t,
1636 fmt: *const ::c_char,
1637 ) -> *mut *mut ::c_char;
1638 }
1639
1640 cfg_if! {
1641 if #[cfg(libc_union)] {
1642 extern {
1643 // these functions use statfs which uses the union mount_info:
1644 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
1645 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
1646 }
1647 }
1648 }
1649
1650 cfg_if! {
1651 if #[cfg(target_arch = "aarch64")] {
1652 mod aarch64;
1653 pub use self::aarch64::*;
1654 } else if #[cfg(target_arch = "arm")] {
1655 mod arm;
1656 pub use self::arm::*;
1657 } else if #[cfg(target_arch = "mips64")] {
1658 mod mips64;
1659 pub use self::mips64::*;
1660 } else if #[cfg(target_arch = "powerpc")] {
1661 mod powerpc;
1662 pub use self::powerpc::*;
1663 } else if #[cfg(target_arch = "powerpc64")] {
1664 mod powerpc64;
1665 pub use self::powerpc64::*;
1666 } else if #[cfg(target_arch = "riscv64")] {
1667 mod riscv64;
1668 pub use self::riscv64::*;
1669 } else if #[cfg(target_arch = "sparc64")] {
1670 mod sparc64;
1671 pub use self::sparc64::*;
1672 } else if #[cfg(target_arch = "x86")] {
1673 mod x86;
1674 pub use self::x86::*;
1675 } else if #[cfg(target_arch = "x86_64")] {
1676 mod x86_64;
1677 pub use self::x86_64::*;
1678 } else {
1679 // Unknown target_arch
1680 }
1681 }