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