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