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