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