Debian Codegraph @

third_party/rust/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs

raw
1 use crate::prelude::*;
2 use crate::{cmsghdr, off_t};
3
4 pub type dev_t = u32;
5 pub type wchar_t = i32;
6 pub type clock_t = u64;
7 pub type ino_t = u64;
8 pub type lwpid_t = i32;
9 pub type nlink_t = u32;
10 pub type blksize_t = i64;
11 pub type clockid_t = c_ulong;
12
13 pub type time_t = i64;
14 pub type suseconds_t = i64;
15
16 pub type uuid_t = crate::uuid;
17
18 pub type fsblkcnt_t = u64;
19 pub type fsfilcnt_t = u64;
20 pub type idtype_t = c_uint;
21 pub type shmatt_t = c_uint;
22
23 pub type mqd_t = c_int;
24 pub type sem_t = *mut sem;
25
26 pub type cpuset_t = cpumask_t;
27 pub type cpu_set_t = cpumask_t;
28
29 pub type register_t = c_long;
30 pub type umtx_t = c_int;
31 pub type pthread_barrierattr_t = c_int;
32 pub type pthread_barrier_t = crate::uintptr_t;
33 pub type pthread_spinlock_t = crate::uintptr_t;
34
35 pub type segsz_t = usize;
36
37 pub type vm_prot_t = u8;
38 pub type vm_maptype_t = u8;
39 pub type vm_inherit_t = i8;
40 pub type vm_subsys_t = c_int;
41 pub type vm_eflags_t = c_uint;
42
43 pub type vm_map_t = *mut __c_anonymous_vm_map;
44 pub type vm_map_entry_t = *mut vm_map_entry;
45
46 pub type pmap = __c_anonymous_pmap;
47
48 #[cfg_attr(feature = "extra_traits", derive(Debug))]
49 pub enum sem {}
50 impl Copy for sem {}
51 impl Clone for sem {
52 fn clone(&self) -> sem {
53 *self
54 }
55 }
56
57 e! {
58 #[repr(u32)]
59 pub enum lwpstat {
60 LSRUN = 1,
61 LSSTOP = 2,
62 LSSLEEP = 3,
63 }
64
65 #[repr(u32)]
66 pub enum procstat {
67 SIDL = 1,
68 SACTIVE = 2,
69 SSTOP = 3,
70 SZOMB = 4,
71 SCORE = 5,
72 }
73 }
74
75 s! {
76 pub struct kevent {
77 pub ident: crate::uintptr_t,
78 pub filter: c_short,
79 pub flags: c_ushort,
80 pub fflags: c_uint,
81 pub data: intptr_t,
82 pub udata: *mut c_void,
83 }
84
85 pub struct exit_status {
86 pub e_termination: u16,
87 pub e_exit: u16,
88 }
89
90 pub struct aiocb {
91 pub aio_fildes: c_int,
92 pub aio_offset: off_t,
93 pub aio_buf: *mut c_void,
94 pub aio_nbytes: size_t,
95 pub aio_sigevent: sigevent,
96 pub aio_lio_opcode: c_int,
97 pub aio_reqprio: c_int,
98 _aio_val: c_int,
99 _aio_err: c_int,
100 }
101
102 pub struct uuid {
103 pub time_low: u32,
104 pub time_mid: u16,
105 pub time_hi_and_version: u16,
106 pub clock_seq_hi_and_reserved: u8,
107 pub clock_seq_low: u8,
108 pub node: [u8; 6],
109 }
110
111 pub struct mq_attr {
112 pub mq_flags: c_long,
113 pub mq_maxmsg: c_long,
114 pub mq_msgsize: c_long,
115 pub mq_curmsgs: c_long,
116 }
117
118 pub struct statvfs {
119 pub f_bsize: c_ulong,
120 pub f_frsize: c_ulong,
121 pub f_blocks: crate::fsblkcnt_t,
122 pub f_bfree: crate::fsblkcnt_t,
123 pub f_bavail: crate::fsblkcnt_t,
124 pub f_files: crate::fsfilcnt_t,
125 pub f_ffree: crate::fsfilcnt_t,
126 pub f_favail: crate::fsfilcnt_t,
127 pub f_fsid: c_ulong,
128 pub f_flag: c_ulong,
129 pub f_namemax: c_ulong,
130 pub f_owner: crate::uid_t,
131 pub f_type: c_uint,
132 pub f_syncreads: u64,
133 pub f_syncwrites: u64,
134 pub f_asyncreads: u64,
135 pub f_asyncwrites: u64,
136 pub f_fsid_uuid: crate::uuid_t,
137 pub f_uid_uuid: crate::uuid_t,
138 }
139
140 pub struct stat {
141 pub st_ino: crate::ino_t,
142 pub st_nlink: crate::nlink_t,
143 pub st_dev: crate::dev_t,
144 pub st_mode: crate::mode_t,
145 pub st_padding1: u16,
146 pub st_uid: crate::uid_t,
147 pub st_gid: crate::gid_t,
148 pub st_rdev: crate::dev_t,
149 pub st_atime: crate::time_t,
150 pub st_atime_nsec: c_long,
151 pub st_mtime: crate::time_t,
152 pub st_mtime_nsec: c_long,
153 pub st_ctime: crate::time_t,
154 pub st_ctime_nsec: c_long,
155 pub st_size: off_t,
156 pub st_blocks: i64,
157 pub __old_st_blksize: u32,
158 pub st_flags: u32,
159 pub st_gen: u32,
160 pub st_lspare: i32,
161 pub st_blksize: i64,
162 pub st_qspare2: i64,
163 }
164
165 pub struct if_data {
166 pub ifi_type: c_uchar,
167 pub ifi_physical: c_uchar,
168 pub ifi_addrlen: c_uchar,
169 pub ifi_hdrlen: c_uchar,
170 pub ifi_recvquota: c_uchar,
171 pub ifi_xmitquota: c_uchar,
172 pub ifi_mtu: c_ulong,
173 pub ifi_metric: c_ulong,
174 pub ifi_link_state: c_ulong,
175 pub ifi_baudrate: u64,
176 pub ifi_ipackets: c_ulong,
177 pub ifi_ierrors: c_ulong,
178 pub ifi_opackets: c_ulong,
179 pub ifi_oerrors: c_ulong,
180 pub ifi_collisions: c_ulong,
181 pub ifi_ibytes: c_ulong,
182 pub ifi_obytes: c_ulong,
183 pub ifi_imcasts: c_ulong,
184 pub ifi_omcasts: c_ulong,
185 pub ifi_iqdrops: c_ulong,
186 pub ifi_noproto: c_ulong,
187 pub ifi_hwassist: c_ulong,
188 pub ifi_oqdrops: c_ulong,
189 pub ifi_lastchange: crate::timeval,
190 }
191
192 pub struct if_msghdr {
193 pub ifm_msglen: c_ushort,
194 pub ifm_version: c_uchar,
195 pub ifm_type: c_uchar,
196 pub ifm_addrs: c_int,
197 pub ifm_flags: c_int,
198 pub ifm_index: c_ushort,
199 pub ifm_data: if_data,
200 }
201
202 pub struct sockaddr_dl {
203 pub sdl_len: c_uchar,
204 pub sdl_family: c_uchar,
205 pub sdl_index: c_ushort,
206 pub sdl_type: c_uchar,
207 pub sdl_nlen: c_uchar,
208 pub sdl_alen: c_uchar,
209 pub sdl_slen: c_uchar,
210 pub sdl_data: [c_char; 12],
211 pub sdl_rcf: c_ushort,
212 pub sdl_route: [c_ushort; 16],
213 }
214
215 pub struct xucred {
216 pub cr_version: c_uint,
217 pub cr_uid: crate::uid_t,
218 pub cr_ngroups: c_short,
219 pub cr_groups: [crate::gid_t; 16],
220 __cr_unused1: *mut c_void,
221 }
222
223 pub struct stack_t {
224 pub ss_sp: *mut c_void,
225 pub ss_size: size_t,
226 pub ss_flags: c_int,
227 }
228
229 pub struct cpumask_t {
230 ary: [u64; 4],
231 }
232
233 pub struct shmid_ds {
234 pub shm_perm: crate::ipc_perm,
235 pub shm_segsz: size_t,
236 pub shm_lpid: crate::pid_t,
237 pub shm_cpid: crate::pid_t,
238 pub shm_nattch: crate::shmatt_t,
239 pub shm_atime: crate::time_t,
240 pub shm_dtime: crate::time_t,
241 pub shm_ctime: crate::time_t,
242 shm_internal: *mut c_void,
243 }
244
245 pub struct kinfo_file {
246 pub f_size: size_t,
247 pub f_pid: crate::pid_t,
248 pub f_uid: crate::uid_t,
249 pub f_fd: c_int,
250 pub f_file: *mut c_void,
251 pub f_type: c_short,
252 pub f_count: c_int,
253 pub f_msgcount: c_int,
254 pub f_offset: off_t,
255 pub f_data: *mut c_void,
256 pub f_flag: c_uint,
257 }
258
259 pub struct kinfo_cputime {
260 pub cp_user: u64,
261 pub cp_nice: u64,
262 pub cp_sys: u64,
263 pub cp_intr: u64,
264 pub cp_idel: u64,
265 cp_unused01: u64,
266 cp_unused02: u64,
267 pub cp_sample_pc: u64,
268 pub cp_sample_sp: u64,
269 pub cp_msg: [c_char; 32],
270 }
271
272 pub struct kinfo_lwp {
273 pub kl_pid: crate::pid_t,
274 pub kl_tid: crate::lwpid_t,
275 pub kl_flags: c_int,
276 pub kl_stat: crate::lwpstat,
277 pub kl_lock: c_int,
278 pub kl_tdflags: c_int,
279 pub kl_mpcount: c_int,
280 pub kl_prio: c_int,
281 pub kl_tdprio: c_int,
282 pub kl_rtprio: crate::rtprio,
283 pub kl_uticks: u64,
284 pub kl_sticks: u64,
285 pub kl_iticks: u64,
286 pub kl_cpticks: u64,
287 pub kl_pctcpu: c_uint,
288 pub kl_slptime: c_uint,
289 pub kl_origcpu: c_int,
290 pub kl_estcpu: c_int,
291 pub kl_cpuid: c_int,
292 pub kl_ru: crate::rusage,
293 pub kl_siglist: crate::sigset_t,
294 pub kl_sigmask: crate::sigset_t,
295 pub kl_wchan: crate::uintptr_t,
296 pub kl_wmesg: [c_char; 9],
297 pub kl_comm: [c_char; MAXCOMLEN + 1],
298 }
299
300 pub struct kinfo_proc {
301 pub kp_paddr: crate::uintptr_t,
302 pub kp_flags: c_int,
303 pub kp_stat: crate::procstat,
304 pub kp_lock: c_int,
305 pub kp_acflag: c_int,
306 pub kp_traceflag: c_int,
307 pub kp_fd: crate::uintptr_t,
308 pub kp_siglist: crate::sigset_t,
309 pub kp_sigignore: crate::sigset_t,
310 pub kp_sigcatch: crate::sigset_t,
311 pub kp_sigflag: c_int,
312 pub kp_start: crate::timeval,
313 pub kp_comm: [c_char; MAXCOMLEN + 1],
314 pub kp_uid: crate::uid_t,
315 pub kp_ngroups: c_short,
316 pub kp_groups: [crate::gid_t; NGROUPS],
317 pub kp_ruid: crate::uid_t,
318 pub kp_svuid: crate::uid_t,
319 pub kp_rgid: crate::gid_t,
320 pub kp_svgid: crate::gid_t,
321 pub kp_pid: crate::pid_t,
322 pub kp_ppid: crate::pid_t,
323 pub kp_pgid: crate::pid_t,
324 pub kp_jobc: c_int,
325 pub kp_sid: crate::pid_t,
326 pub kp_login: [c_char; 40], // MAXNAMELEN rounded up to the nearest sizeof(long)
327 pub kp_tdev: crate::dev_t,
328 pub kp_tpgid: crate::pid_t,
329 pub kp_tsid: crate::pid_t,
330 pub kp_exitstat: c_ushort,
331 pub kp_nthreads: c_int,
332 pub kp_nice: c_int,
333 pub kp_swtime: c_uint,
334 pub kp_vm_map_size: size_t,
335 pub kp_vm_rssize: crate::segsz_t,
336 pub kp_vm_swrss: crate::segsz_t,
337 pub kp_vm_tsize: crate::segsz_t,
338 pub kp_vm_dsize: crate::segsz_t,
339 pub kp_vm_ssize: crate::segsz_t,
340 pub kp_vm_prssize: c_uint,
341 pub kp_jailid: c_int,
342 pub kp_ru: crate::rusage,
343 pub kp_cru: crate::rusage,
344 pub kp_auxflags: c_int,
345 pub kp_lwp: crate::kinfo_lwp,
346 pub kp_ktaddr: crate::uintptr_t,
347 kp_spare: [c_int; 2],
348 }
349
350 pub struct __c_anonymous_vm_map {
351 _priv: [crate::uintptr_t; 36],
352 }
353
354 pub struct vm_map_entry {
355 _priv: [crate::uintptr_t; 15],
356 pub eflags: crate::vm_eflags_t,
357 pub maptype: crate::vm_maptype_t,
358 pub protection: crate::vm_prot_t,
359 pub max_protection: crate::vm_prot_t,
360 pub inheritance: crate::vm_inherit_t,
361 pub wired_count: c_int,
362 pub id: crate::vm_subsys_t,
363 }
364
365 pub struct __c_anonymous_pmap {
366 _priv1: [crate::uintptr_t; 32],
367 _priv2: [crate::uintptr_t; 32],
368 _priv3: [crate::uintptr_t; 32],
369 _priv4: [crate::uintptr_t; 32],
370 _priv5: [crate::uintptr_t; 8],
371 }
372
373 pub struct vmspace {
374 vm_map: __c_anonymous_vm_map,
375 vm_pmap: __c_anonymous_pmap,
376 pub vm_flags: c_int,
377 pub vm_shm: *mut c_char,
378 pub vm_rssize: crate::segsz_t,
379 pub vm_swrss: crate::segsz_t,
380 pub vm_tsize: crate::segsz_t,
381 pub vm_dsize: crate::segsz_t,
382 pub vm_ssize: crate::segsz_t,
383 pub vm_taddr: *mut c_char,
384 pub vm_daddr: *mut c_char,
385 pub vm_maxsaddr: *mut c_char,
386 pub vm_minsaddr: *mut c_char,
387 _unused1: c_int,
388 _unused2: c_int,
389 pub vm_pagesupply: c_int,
390 pub vm_holdcnt: c_uint,
391 pub vm_refcnt: c_uint,
392 }
393
394 pub struct cpuctl_msr_args_t {
395 pub msr: c_int,
396 pub data: u64,
397 }
398
399 pub struct cpuctl_cpuid_args_t {
400 pub level: c_int,
401 pub data: [u32; 4],
402 }
403
404 pub struct cpuctl_cpuid_count_args_t {
405 pub level: c_int,
406 pub level_type: c_int,
407 pub data: [u32; 4],
408 }
409
410 pub struct cpuctl_update_args_t {
411 pub data: *mut c_void,
412 pub size: size_t,
413 }
414 }
415
416 s_no_extra_traits! {
417 pub struct utmpx {
418 pub ut_name: [c_char; 32],
419 pub ut_id: [c_char; 4],
420
421 pub ut_line: [c_char; 32],
422 pub ut_host: [c_char; 256],
423
424 pub ut_unused: [u8; 16],
425 pub ut_session: u16,
426 pub ut_type: u16,
427 pub ut_pid: crate::pid_t,
428 ut_exit: exit_status,
429 ut_ss: crate::sockaddr_storage,
430 pub ut_tv: crate::timeval,
431 pub ut_unused2: [u8; 16],
432 }
433
434 pub struct lastlogx {
435 pub ll_tv: crate::timeval,
436 pub ll_line: [c_char; _UTX_LINESIZE],
437 pub ll_host: [c_char; _UTX_HOSTSIZE],
438 pub ll_ss: crate::sockaddr_storage,
439 }
440
441 pub struct dirent {
442 pub d_fileno: crate::ino_t,
443 pub d_namlen: u16,
444 pub d_type: u8,
445 __unused1: u8,
446 __unused2: u32,
447 pub d_name: [c_char; 256],
448 }
449
450 pub struct statfs {
451 __spare2: c_long,
452 pub f_bsize: c_long,
453 pub f_iosize: c_long,
454 pub f_blocks: c_long,
455 pub f_bfree: c_long,
456 pub f_bavail: c_long,
457 pub f_files: c_long,
458 pub f_ffree: c_long,
459 pub f_fsid: crate::fsid_t,
460 pub f_owner: crate::uid_t,
461 pub f_type: c_int,
462 pub f_flags: c_int,
463 pub f_syncwrites: c_long,
464 pub f_asyncwrites: c_long,
465 pub f_fstypename: [c_char; 16],
466 pub f_mntonname: [c_char; 80],
467 pub f_syncreads: c_long,
468 pub f_asyncreads: c_long,
469 __spares1: c_short,
470 pub f_mntfromname: [c_char; 80],
471 __spares2: c_short,
472 __spare: [c_long; 2],
473 }
474
475 pub struct sigevent {
476 pub sigev_notify: c_int,
477 // The union is 8-byte in size, so it is aligned at a 8-byte offset.
478 #[cfg(target_pointer_width = "64")]
479 __unused1: c_int,
480 pub sigev_signo: c_int, //actually a union
481 // pad the union
482 #[cfg(target_pointer_width = "64")]
483 __unused2: c_int,
484 pub sigev_value: crate::sigval,
485 __unused3: *mut c_void, //actually a function pointer
486 }
487
488 pub struct mcontext_t {
489 pub mc_onstack: register_t,
490 pub mc_rdi: register_t,
491 pub mc_rsi: register_t,
492 pub mc_rdx: register_t,
493 pub mc_rcx: register_t,
494 pub mc_r8: register_t,
495 pub mc_r9: register_t,
496 pub mc_rax: register_t,
497 pub mc_rbx: register_t,
498 pub mc_rbp: register_t,
499 pub mc_r10: register_t,
500 pub mc_r11: register_t,
501 pub mc_r12: register_t,
502 pub mc_r13: register_t,
503 pub mc_r14: register_t,
504 pub mc_r15: register_t,
505 pub mc_xflags: register_t,
506 pub mc_trapno: register_t,
507 pub mc_addr: register_t,
508 pub mc_flags: register_t,
509 pub mc_err: register_t,
510 pub mc_rip: register_t,
511 pub mc_cs: register_t,
512 pub mc_rflags: register_t,
513 pub mc_rsp: register_t,
514 pub mc_ss: register_t,
515 pub mc_len: c_uint,
516 pub mc_fpformat: c_uint,
517 pub mc_ownedfp: c_uint,
518 __reserved: c_uint,
519 __unused: [c_uint; 8],
520 pub mc_fpregs: [[c_uint; 8]; 32],
521 }
522
523 pub struct ucontext_t {
524 pub uc_sigmask: crate::sigset_t,
525 pub uc_mcontext: mcontext_t,
526 pub uc_link: *mut ucontext_t,
527 pub uc_stack: stack_t,
528 pub uc_cofunc: Option<unsafe extern "C" fn(uc: *mut ucontext_t, arg: *mut c_void)>,
529 pub uc_arg: *mut c_void,
530 __pad: [c_int; 4],
531 }
532 }
533
534 cfg_if! {
535 if #[cfg(feature = "extra_traits")] {
536 impl PartialEq for utmpx {
537 fn eq(&self, other: &utmpx) -> bool {
538 self.ut_name == other.ut_name
539 && self.ut_id == other.ut_id
540 && self.ut_line == other.ut_line
541 && self
542 .ut_host
543 .iter()
544 .zip(other.ut_host.iter())
545 .all(|(a, b)| a == b)
546 && self.ut_unused == other.ut_unused
547 && self.ut_session == other.ut_session
548 && self.ut_type == other.ut_type
549 && self.ut_pid == other.ut_pid
550 && self.ut_exit == other.ut_exit
551 && self.ut_ss == other.ut_ss
552 && self.ut_tv == other.ut_tv
553 && self.ut_unused2 == other.ut_unused2
554 }
555 }
556 impl Eq for utmpx {}
557 impl fmt::Debug for utmpx {
558 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
559 f.debug_struct("utmpx")
560 .field("ut_name", &self.ut_name)
561 .field("ut_id", &self.ut_id)
562 .field("ut_line", &self.ut_line)
563 // FIXME(debug): .field("ut_host", &self.ut_host)
564 .field("ut_unused", &self.ut_unused)
565 .field("ut_session", &self.ut_session)
566 .field("ut_type", &self.ut_type)
567 .field("ut_pid", &self.ut_pid)
568 .field("ut_exit", &self.ut_exit)
569 .field("ut_ss", &self.ut_ss)
570 .field("ut_tv", &self.ut_tv)
571 .field("ut_unused2", &self.ut_unused2)
572 .finish()
573 }
574 }
575 impl hash::Hash for utmpx {
576 fn hash<H: hash::Hasher>(&self, state: &mut H) {
577 self.ut_name.hash(state);
578 self.ut_id.hash(state);
579 self.ut_line.hash(state);
580 self.ut_host.hash(state);
581 self.ut_unused.hash(state);
582 self.ut_session.hash(state);
583 self.ut_type.hash(state);
584 self.ut_pid.hash(state);
585 self.ut_exit.hash(state);
586 self.ut_ss.hash(state);
587 self.ut_tv.hash(state);
588 self.ut_unused2.hash(state);
589 }
590 }
591 impl PartialEq for lastlogx {
592 fn eq(&self, other: &lastlogx) -> bool {
593 self.ll_tv == other.ll_tv
594 && self.ll_line == other.ll_line
595 && self.ll_host == other.ll_host
596 && self.ll_ss == other.ll_ss
597 }
598 }
599 impl Eq for lastlogx {}
600 impl fmt::Debug for lastlogx {
601 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
602 f.debug_struct("lastlogx")
603 .field("ll_tv", &self.ll_tv)
604 .field("ll_line", &self.ll_line)
605 .field("ll_host", &self.ll_host)
606 .field("ll_ss", &self.ll_ss)
607 .finish()
608 }
609 }
610 impl hash::Hash for lastlogx {
611 fn hash<H: hash::Hasher>(&self, state: &mut H) {
612 self.ll_tv.hash(state);
613 self.ll_line.hash(state);
614 self.ll_host.hash(state);
615 self.ll_ss.hash(state);
616 }
617 }
618
619 impl PartialEq for dirent {
620 fn eq(&self, other: &dirent) -> bool {
621 self.d_fileno == other.d_fileno
622 && self.d_namlen == other.d_namlen
623 && self.d_type == other.d_type
624 // Ignore __unused1
625 // Ignore __unused2
626 && self
627 .d_name
628 .iter()
629 .zip(other.d_name.iter())
630 .all(|(a,b)| a == b)
631 }
632 }
633 impl Eq for dirent {}
634 impl fmt::Debug for dirent {
635 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
636 f.debug_struct("dirent")
637 .field("d_fileno", &self.d_fileno)
638 .field("d_namlen", &self.d_namlen)
639 .field("d_type", &self.d_type)
640 // Ignore __unused1
641 // Ignore __unused2
642 // FIXME(debug): .field("d_name", &self.d_name)
643 .finish()
644 }
645 }
646 impl hash::Hash for dirent {
647 fn hash<H: hash::Hasher>(&self, state: &mut H) {
648 self.d_fileno.hash(state);
649 self.d_namlen.hash(state);
650 self.d_type.hash(state);
651 // Ignore __unused1
652 // Ignore __unused2
653 self.d_name.hash(state);
654 }
655 }
656
657 impl PartialEq for statfs {
658 fn eq(&self, other: &statfs) -> bool {
659 self.f_bsize == other.f_bsize
660 && self.f_iosize == other.f_iosize
661 && self.f_blocks == other.f_blocks
662 && self.f_bfree == other.f_bfree
663 && self.f_bavail == other.f_bavail
664 && self.f_files == other.f_files
665 && self.f_ffree == other.f_ffree
666 && self.f_fsid == other.f_fsid
667 && self.f_owner == other.f_owner
668 && self.f_type == other.f_type
669 && self.f_flags == other.f_flags
670 && self.f_syncwrites == other.f_syncwrites
671 && self.f_asyncwrites == other.f_asyncwrites
672 && self.f_fstypename == other.f_fstypename
673 && self
674 .f_mntonname
675 .iter()
676 .zip(other.f_mntonname.iter())
677 .all(|(a, b)| a == b)
678 && self.f_syncreads == other.f_syncreads
679 && self.f_asyncreads == other.f_asyncreads
680 && self
681 .f_mntfromname
682 .iter()
683 .zip(other.f_mntfromname.iter())
684 .all(|(a, b)| a == b)
685 }
686 }
687 impl Eq for statfs {}
688 impl fmt::Debug for statfs {
689 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
690 f.debug_struct("statfs")
691 .field("f_bsize", &self.f_bsize)
692 .field("f_iosize", &self.f_iosize)
693 .field("f_blocks", &self.f_blocks)
694 .field("f_bfree", &self.f_bfree)
695 .field("f_bavail", &self.f_bavail)
696 .field("f_files", &self.f_files)
697 .field("f_ffree", &self.f_ffree)
698 .field("f_fsid", &self.f_fsid)
699 .field("f_owner", &self.f_owner)
700 .field("f_type", &self.f_type)
701 .field("f_flags", &self.f_flags)
702 .field("f_syncwrites", &self.f_syncwrites)
703 .field("f_asyncwrites", &self.f_asyncwrites)
704 // FIXME(debug): .field("f_mntonname", &self.f_mntonname)
705 .field("f_syncreads", &self.f_syncreads)
706 .field("f_asyncreads", &self.f_asyncreads)
707 // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname)
708 .finish()
709 }
710 }
711 impl hash::Hash for statfs {
712 fn hash<H: hash::Hasher>(&self, state: &mut H) {
713 self.f_bsize.hash(state);
714 self.f_iosize.hash(state);
715 self.f_blocks.hash(state);
716 self.f_bfree.hash(state);
717 self.f_bavail.hash(state);
718 self.f_files.hash(state);
719 self.f_ffree.hash(state);
720 self.f_fsid.hash(state);
721 self.f_owner.hash(state);
722 self.f_type.hash(state);
723 self.f_flags.hash(state);
724 self.f_syncwrites.hash(state);
725 self.f_asyncwrites.hash(state);
726 self.f_fstypename.hash(state);
727 self.f_mntonname.hash(state);
728 self.f_syncreads.hash(state);
729 self.f_asyncreads.hash(state);
730 self.f_mntfromname.hash(state);
731 }
732 }
733
734 impl PartialEq for sigevent {
735 fn eq(&self, other: &sigevent) -> bool {
736 self.sigev_notify == other.sigev_notify
737 && self.sigev_signo == other.sigev_signo
738 && self.sigev_value == other.sigev_value
739 }
740 }
741 impl Eq for sigevent {}
742 impl fmt::Debug for sigevent {
743 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
744 f.debug_struct("sigevent")
745 .field("sigev_notify", &self.sigev_notify)
746 .field("sigev_signo", &self.sigev_signo)
747 .field("sigev_value", &self.sigev_value)
748 .finish()
749 }
750 }
751 impl hash::Hash for sigevent {
752 fn hash<H: hash::Hasher>(&self, state: &mut H) {
753 self.sigev_notify.hash(state);
754 self.sigev_signo.hash(state);
755 self.sigev_value.hash(state);
756 }
757 }
758 impl PartialEq for mcontext_t {
759 fn eq(&self, other: &mcontext_t) -> bool {
760 self.mc_onstack == other.mc_onstack
761 && self.mc_rdi == other.mc_rdi
762 && self.mc_rsi == other.mc_rsi
763 && self.mc_rdx == other.mc_rdx
764 && self.mc_rcx == other.mc_rcx
765 && self.mc_r8 == other.mc_r8
766 && self.mc_r9 == other.mc_r9
767 && self.mc_rax == other.mc_rax
768 && self.mc_rbx == other.mc_rbx
769 && self.mc_rbp == other.mc_rbp
770 && self.mc_r10 == other.mc_r10
771 && self.mc_r11 == other.mc_r11
772 && self.mc_r12 == other.mc_r12
773 && self.mc_r13 == other.mc_r13
774 && self.mc_r14 == other.mc_r14
775 && self.mc_r15 == other.mc_r15
776 && self.mc_xflags == other.mc_xflags
777 && self.mc_trapno == other.mc_trapno
778 && self.mc_addr == other.mc_addr
779 && self.mc_flags == other.mc_flags
780 && self.mc_err == other.mc_err
781 && self.mc_rip == other.mc_rip
782 && self.mc_cs == other.mc_cs
783 && self.mc_rflags == other.mc_rflags
784 && self.mc_rsp == other.mc_rsp
785 && self.mc_ss == other.mc_ss
786 && self.mc_len == other.mc_len
787 && self.mc_fpformat == other.mc_fpformat
788 && self.mc_ownedfp == other.mc_ownedfp
789 && self.mc_fpregs == other.mc_fpregs
790 }
791 }
792 impl Eq for mcontext_t {}
793 impl fmt::Debug for mcontext_t {
794 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
795 f.debug_struct("mcontext_t")
796 .field("mc_onstack", &self.mc_onstack)
797 .field("mc_rdi", &self.mc_rdi)
798 .field("mc_rsi", &self.mc_rsi)
799 .field("mc_rdx", &self.mc_rdx)
800 .field("mc_rcx", &self.mc_rcx)
801 .field("mc_r8", &self.mc_r8)
802 .field("mc_r9", &self.mc_r9)
803 .field("mc_rax", &self.mc_rax)
804 .field("mc_rbx", &self.mc_rbx)
805 .field("mc_rbp", &self.mc_rbp)
806 .field("mc_r10", &self.mc_r10)
807 .field("mc_r11", &self.mc_r11)
808 .field("mc_r12", &self.mc_r12)
809 .field("mc_r13", &self.mc_r13)
810 .field("mc_r14", &self.mc_r14)
811 .field("mc_r15", &self.mc_r15)
812 .field("mc_xflags", &self.mc_xflags)
813 .field("mc_trapno", &self.mc_trapno)
814 .field("mc_addr", &self.mc_addr)
815 .field("mc_flags", &self.mc_flags)
816 .field("mc_err", &self.mc_err)
817 .field("mc_rip", &self.mc_rip)
818 .field("mc_cs", &self.mc_cs)
819 .field("mc_rflags", &self.mc_rflags)
820 .field("mc_rsp", &self.mc_rsp)
821 .field("mc_ss", &self.mc_ss)
822 .field("mc_len", &self.mc_len)
823 .field("mc_fpformat", &self.mc_fpformat)
824 .field("mc_ownedfp", &self.mc_ownedfp)
825 .field("mc_fpregs", &self.mc_fpregs)
826 .finish()
827 }
828 }
829 impl hash::Hash for mcontext_t {
830 fn hash<H: hash::Hasher>(&self, state: &mut H) {
831 self.mc_onstack.hash(state);
832 self.mc_rdi.hash(state);
833 self.mc_rsi.hash(state);
834 self.mc_rdx.hash(state);
835 self.mc_rcx.hash(state);
836 self.mc_r8.hash(state);
837 self.mc_r9.hash(state);
838 self.mc_rax.hash(state);
839 self.mc_rbx.hash(state);
840 self.mc_rbp.hash(state);
841 self.mc_r10.hash(state);
842 self.mc_r11.hash(state);
843 self.mc_r10.hash(state);
844 self.mc_r11.hash(state);
845 self.mc_r12.hash(state);
846 self.mc_r13.hash(state);
847 self.mc_r14.hash(state);
848 self.mc_r15.hash(state);
849 self.mc_xflags.hash(state);
850 self.mc_trapno.hash(state);
851 self.mc_addr.hash(state);
852 self.mc_flags.hash(state);
853 self.mc_err.hash(state);
854 self.mc_rip.hash(state);
855 self.mc_cs.hash(state);
856 self.mc_rflags.hash(state);
857 self.mc_rsp.hash(state);
858 self.mc_ss.hash(state);
859 self.mc_len.hash(state);
860 self.mc_fpformat.hash(state);
861 self.mc_ownedfp.hash(state);
862 self.mc_fpregs.hash(state);
863 }
864 }
865 // FIXME(msrv): suggested method was added in 1.85
866 #[allow(unpredictable_function_pointer_comparisons)]
867 impl PartialEq for ucontext_t {
868 fn eq(&self, other: &ucontext_t) -> bool {
869 self.uc_sigmask == other.uc_sigmask
870 && self.uc_mcontext == other.uc_mcontext
871 && self.uc_link == other.uc_link
872 && self.uc_stack == other.uc_stack
873 && self.uc_cofunc == other.uc_cofunc
874 && self.uc_arg == other.uc_arg
875 }
876 }
877 impl Eq for ucontext_t {}
878 impl fmt::Debug for ucontext_t {
879 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
880 f.debug_struct("ucontext_t")
881 .field("uc_sigmask", &self.uc_sigmask)
882 .field("uc_mcontext", &self.uc_mcontext)
883 .field("uc_link", &self.uc_link)
884 .field("uc_stack", &self.uc_stack)
885 .field("uc_cofunc", &self.uc_cofunc)
886 .field("uc_arg", &self.uc_arg)
887 .finish()
888 }
889 }
890 impl hash::Hash for ucontext_t {
891 fn hash<H: hash::Hasher>(&self, state: &mut H) {
892 self.uc_sigmask.hash(state);
893 self.uc_mcontext.hash(state);
894 self.uc_link.hash(state);
895 self.uc_stack.hash(state);
896 self.uc_cofunc.hash(state);
897 self.uc_arg.hash(state);
898 }
899 }
900 }
901 }
902
903 pub const RAND_MAX: c_int = 0x7fff_ffff;
904 pub const PTHREAD_STACK_MIN: size_t = 16384;
905 pub const SIGSTKSZ: size_t = 40960;
906 pub const SIGCKPT: c_int = 33;
907 pub const SIGCKPTEXIT: c_int = 34;
908 pub const CKPT_FREEZE: c_int = 0x1;
909 pub const CKPT_THAW: c_int = 0x2;
910 pub const MADV_INVAL: c_int = 10;
911 pub const MADV_SETMAP: c_int = 11;
912 pub const O_CLOEXEC: c_int = 0x00020000;
913 pub const O_DIRECTORY: c_int = 0x08000000;
914 pub const F_GETLK: c_int = 7;
915 pub const F_SETLK: c_int = 8;
916 pub const F_SETLKW: c_int = 9;
917 pub const F_GETPATH: c_int = 19;
918 pub const ENOMEDIUM: c_int = 93;
919 pub const ENOTRECOVERABLE: c_int = 94;
920 pub const EOWNERDEAD: c_int = 95;
921 pub const EASYNC: c_int = 99;
922 pub const ELAST: c_int = 99;
923 pub const RLIMIT_POSIXLOCKS: c_int = 11;
924 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
925 pub const RLIM_NLIMITS: crate::rlim_t = 12;
926
927 pub const Q_GETQUOTA: c_int = 0x300;
928 pub const Q_SETQUOTA: c_int = 0x400;
929
930 pub const CTL_UNSPEC: c_int = 0;
931 pub const CTL_KERN: c_int = 1;
932 pub const CTL_VM: c_int = 2;
933 pub const CTL_VFS: c_int = 3;
934 pub const CTL_NET: c_int = 4;
935 pub const CTL_DEBUG: c_int = 5;
936 pub const CTL_HW: c_int = 6;
937 pub const CTL_MACHDEP: c_int = 7;
938 pub const CTL_USER: c_int = 8;
939 pub const CTL_P1003_1B: c_int = 9;
940 pub const CTL_LWKT: c_int = 10;
941 pub const CTL_MAXID: c_int = 11;
942 pub const KERN_OSTYPE: c_int = 1;
943 pub const KERN_OSRELEASE: c_int = 2;
944 pub const KERN_OSREV: c_int = 3;
945 pub const KERN_VERSION: c_int = 4;
946 pub const KERN_MAXVNODES: c_int = 5;
947 pub const KERN_MAXPROC: c_int = 6;
948 pub const KERN_MAXFILES: c_int = 7;
949 pub const KERN_ARGMAX: c_int = 8;
950 pub const KERN_SECURELVL: c_int = 9;
951 pub const KERN_HOSTNAME: c_int = 10;
952 pub const KERN_HOSTID: c_int = 11;
953 pub const KERN_CLOCKRATE: c_int = 12;
954 pub const KERN_VNODE: c_int = 13;
955 pub const KERN_PROC: c_int = 14;
956 pub const KERN_FILE: c_int = 15;
957 pub const KERN_PROF: c_int = 16;
958 pub const KERN_POSIX1: c_int = 17;
959 pub const KERN_NGROUPS: c_int = 18;
960 pub const KERN_JOB_CONTROL: c_int = 19;
961 pub const KERN_SAVED_IDS: c_int = 20;
962 pub const KERN_BOOTTIME: c_int = 21;
963 pub const KERN_NISDOMAINNAME: c_int = 22;
964 pub const KERN_UPDATEINTERVAL: c_int = 23;
965 pub const KERN_OSRELDATE: c_int = 24;
966 pub const KERN_NTP_PLL: c_int = 25;
967 pub const KERN_BOOTFILE: c_int = 26;
968 pub const KERN_MAXFILESPERPROC: c_int = 27;
969 pub const KERN_MAXPROCPERUID: c_int = 28;
970 pub const KERN_DUMPDEV: c_int = 29;
971 pub const KERN_IPC: c_int = 30;
972 pub const KERN_DUMMY: c_int = 31;
973 pub const KERN_PS_STRINGS: c_int = 32;
974 pub const KERN_USRSTACK: c_int = 33;
975 pub const KERN_LOGSIGEXIT: c_int = 34;
976 pub const KERN_IOV_MAX: c_int = 35;
977 pub const KERN_MAXPOSIXLOCKSPERUID: c_int = 36;
978 pub const KERN_MAXID: c_int = 37;
979 pub const KERN_PROC_ALL: c_int = 0;
980 pub const KERN_PROC_PID: c_int = 1;
981 pub const KERN_PROC_PGRP: c_int = 2;
982 pub const KERN_PROC_SESSION: c_int = 3;
983 pub const KERN_PROC_TTY: c_int = 4;
984 pub const KERN_PROC_UID: c_int = 5;
985 pub const KERN_PROC_RUID: c_int = 6;
986 pub const KERN_PROC_ARGS: c_int = 7;
987 pub const KERN_PROC_CWD: c_int = 8;
988 pub const KERN_PROC_PATHNAME: c_int = 9;
989 pub const KERN_PROC_FLAGMASK: c_int = 0x10;
990 pub const KERN_PROC_FLAG_LWP: c_int = 0x10;
991 pub const KIPC_MAXSOCKBUF: c_int = 1;
992 pub const KIPC_SOCKBUF_WASTE: c_int = 2;
993 pub const KIPC_SOMAXCONN: c_int = 3;
994 pub const KIPC_MAX_LINKHDR: c_int = 4;
995 pub const KIPC_MAX_PROTOHDR: c_int = 5;
996 pub const KIPC_MAX_HDR: c_int = 6;
997 pub const KIPC_MAX_DATALEN: c_int = 7;
998 pub const KIPC_MBSTAT: c_int = 8;
999 pub const KIPC_NMBCLUSTERS: c_int = 9;
1000 pub const HW_MACHINE: c_int = 1;
1001 pub const HW_MODEL: c_int = 2;
1002 pub const HW_NCPU: c_int = 3;
1003 pub const HW_BYTEORDER: c_int = 4;
1004 pub const HW_PHYSMEM: c_int = 5;
1005 pub const HW_USERMEM: c_int = 6;
1006 pub const HW_PAGESIZE: c_int = 7;
1007 pub const HW_DISKNAMES: c_int = 8;
1008 pub const HW_DISKSTATS: c_int = 9;
1009 pub const HW_FLOATINGPT: c_int = 10;
1010 pub const HW_MACHINE_ARCH: c_int = 11;
1011 pub const HW_MACHINE_PLATFORM: c_int = 12;
1012 pub const HW_SENSORS: c_int = 13;
1013 pub const HW_MAXID: c_int = 14;
1014 pub const USER_CS_PATH: c_int = 1;
1015 pub const USER_BC_BASE_MAX: c_int = 2;
1016 pub const USER_BC_DIM_MAX: c_int = 3;
1017 pub const USER_BC_SCALE_MAX: c_int = 4;
1018 pub const USER_BC_STRING_MAX: c_int = 5;
1019 pub const USER_COLL_WEIGHTS_MAX: c_int = 6;
1020 pub const USER_EXPR_NEST_MAX: c_int = 7;
1021 pub const USER_LINE_MAX: c_int = 8;
1022 pub const USER_RE_DUP_MAX: c_int = 9;
1023 pub const USER_POSIX2_VERSION: c_int = 10;
1024 pub const USER_POSIX2_C_BIND: c_int = 11;
1025 pub const USER_POSIX2_C_DEV: c_int = 12;
1026 pub const USER_POSIX2_CHAR_TERM: c_int = 13;
1027 pub const USER_POSIX2_FORT_DEV: c_int = 14;
1028 pub const USER_POSIX2_FORT_RUN: c_int = 15;
1029 pub const USER_POSIX2_LOCALEDEF: c_int = 16;
1030 pub const USER_POSIX2_SW_DEV: c_int = 17;
1031 pub const USER_POSIX2_UPE: c_int = 18;
1032 pub const USER_STREAM_MAX: c_int = 19;
1033 pub const USER_TZNAME_MAX: c_int = 20;
1034 pub const USER_MAXID: c_int = 21;
1035 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: c_int = 1;
1036 pub const CTL_P1003_1B_MAPPED_FILES: c_int = 2;
1037 pub const CTL_P1003_1B_MEMLOCK: c_int = 3;
1038 pub const CTL_P1003_1B_MEMLOCK_RANGE: c_int = 4;
1039 pub const CTL_P1003_1B_MEMORY_PROTECTION: c_int = 5;
1040 pub const CTL_P1003_1B_MESSAGE_PASSING: c_int = 6;
1041 pub const CTL_P1003_1B_PRIORITIZED_IO: c_int = 7;
1042 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: c_int = 8;
1043 pub const CTL_P1003_1B_REALTIME_SIGNALS: c_int = 9;
1044 pub const CTL_P1003_1B_SEMAPHORES: c_int = 10;
1045 pub const CTL_P1003_1B_FSYNC: c_int = 11;
1046 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: c_int = 12;
1047 pub const CTL_P1003_1B_SYNCHRONIZED_IO: c_int = 13;
1048 pub const CTL_P1003_1B_TIMERS: c_int = 14;
1049 pub const CTL_P1003_1B_AIO_LISTIO_MAX: c_int = 15;
1050 pub const CTL_P1003_1B_AIO_MAX: c_int = 16;
1051 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: c_int = 17;
1052 pub const CTL_P1003_1B_DELAYTIMER_MAX: c_int = 18;
1053 pub const CTL_P1003_1B_UNUSED1: c_int = 19;
1054 pub const CTL_P1003_1B_PAGESIZE: c_int = 20;
1055 pub const CTL_P1003_1B_RTSIG_MAX: c_int = 21;
1056 pub const CTL_P1003_1B_SEM_NSEMS_MAX: c_int = 22;
1057 pub const CTL_P1003_1B_SEM_VALUE_MAX: c_int = 23;
1058 pub const CTL_P1003_1B_SIGQUEUE_MAX: c_int = 24;
1059 pub const CTL_P1003_1B_TIMER_MAX: c_int = 25;
1060 pub const CTL_P1003_1B_MAXID: c_int = 26;
1061
1062 pub const CPUCTL_RSMSR: c_int = 0xc0106301;
1063 pub const CPUCTL_WRMSR: c_int = 0xc0106302;
1064 pub const CPUCTL_CPUID: c_int = 0xc0106303;
1065 pub const CPUCTL_UPDATE: c_int = 0xc0106304;
1066 pub const CPUCTL_MSRSBIT: c_int = 0xc0106305;
1067 pub const CPUCTL_MSRCBIT: c_int = 0xc0106306;
1068 pub const CPUCTL_CPUID_COUNT: c_int = 0xc0106307;
1069
1070 pub const CPU_SETSIZE: size_t = mem::size_of::<crate::cpumask_t>() * 8;
1071
1072 pub const EVFILT_READ: i16 = -1;
1073 pub const EVFILT_WRITE: i16 = -2;
1074 pub const EVFILT_AIO: i16 = -3;
1075 pub const EVFILT_VNODE: i16 = -4;
1076 pub const EVFILT_PROC: i16 = -5;
1077 pub const EVFILT_SIGNAL: i16 = -6;
1078 pub const EVFILT_TIMER: i16 = -7;
1079 pub const EVFILT_EXCEPT: i16 = -8;
1080 pub const EVFILT_USER: i16 = -9;
1081 pub const EVFILT_FS: i16 = -10;
1082
1083 pub const EV_ADD: u16 = 0x1;
1084 pub const EV_DELETE: u16 = 0x2;
1085 pub const EV_ENABLE: u16 = 0x4;
1086 pub const EV_DISABLE: u16 = 0x8;
1087 pub const EV_ONESHOT: u16 = 0x10;
1088 pub const EV_CLEAR: u16 = 0x20;
1089 pub const EV_RECEIPT: u16 = 0x40;
1090 pub const EV_DISPATCH: u16 = 0x80;
1091 pub const EV_NODATA: u16 = 0x1000;
1092 pub const EV_FLAG1: u16 = 0x2000;
1093 pub const EV_ERROR: u16 = 0x4000;
1094 pub const EV_EOF: u16 = 0x8000;
1095 pub const EV_HUP: u16 = 0x8000;
1096 pub const EV_SYSFLAGS: u16 = 0xf000;
1097
1098 pub const FIODNAME: c_ulong = 0x80106678;
1099
1100 pub const NOTE_TRIGGER: u32 = 0x01000000;
1101 pub const NOTE_FFNOP: u32 = 0x00000000;
1102 pub const NOTE_FFAND: u32 = 0x40000000;
1103 pub const NOTE_FFOR: u32 = 0x80000000;
1104 pub const NOTE_FFCOPY: u32 = 0xc0000000;
1105 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
1106 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
1107 pub const NOTE_LOWAT: u32 = 0x00000001;
1108 pub const NOTE_OOB: u32 = 0x00000002;
1109 pub const NOTE_DELETE: u32 = 0x00000001;
1110 pub const NOTE_WRITE: u32 = 0x00000002;
1111 pub const NOTE_EXTEND: u32 = 0x00000004;
1112 pub const NOTE_ATTRIB: u32 = 0x00000008;
1113 pub const NOTE_LINK: u32 = 0x00000010;
1114 pub const NOTE_RENAME: u32 = 0x00000020;
1115 pub const NOTE_REVOKE: u32 = 0x00000040;
1116 pub const NOTE_EXIT: u32 = 0x80000000;
1117 pub const NOTE_FORK: u32 = 0x40000000;
1118 pub const NOTE_EXEC: u32 = 0x20000000;
1119 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
1120 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
1121 pub const NOTE_TRACK: u32 = 0x00000001;
1122 pub const NOTE_TRACKERR: u32 = 0x00000002;
1123 pub const NOTE_CHILD: u32 = 0x00000004;
1124
1125 pub const SO_SNDSPACE: c_int = 0x100a;
1126 pub const SO_CPUHINT: c_int = 0x1030;
1127 pub const SO_PASSCRED: c_int = 0x4000;
1128
1129 pub const PT_FIRSTMACH: c_int = 32;
1130
1131 pub const PROC_REAP_ACQUIRE: c_int = 0x0001;
1132 pub const PROC_REAP_RELEASE: c_int = 0x0002;
1133 pub const PROC_REAP_STATUS: c_int = 0x0003;
1134 pub const PROC_PDEATHSIG_CTL: c_int = 0x0004;
1135 pub const PROC_PDEATHSIG_STATUS: c_int = 0x0005;
1136
1137 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/HEAD/sys/net/if.h#L101
1138 pub const IFF_UP: c_int = 0x1; // interface is up
1139 pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid
1140 pub const IFF_DEBUG: c_int = 0x4; // turn on debugging
1141 pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net
1142 pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link
1143 pub const IFF_SMART: c_int = 0x20; // interface manages own routes
1144 pub const IFF_RUNNING: c_int = 0x40; // resources allocated
1145 pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol
1146 pub const IFF_PROMISC: c_int = 0x100; // receive all packets
1147 pub const IFF_ALLMULTI: c_int = 0x200; // receive all multicast packets
1148 pub const IFF_OACTIVE_COMPAT: c_int = 0x400; // was transmission in progress
1149 pub const IFF_SIMPLEX: c_int = 0x800; // can't hear own transmissions
1150 pub const IFF_LINK0: c_int = 0x1000; // per link layer defined bit
1151 pub const IFF_LINK1: c_int = 0x2000; // per link layer defined bit
1152 pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit
1153 pub const IFF_ALTPHYS: c_int = IFF_LINK2; // use alternate physical connection
1154 pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast
1155 // was interface is in polling mode
1156 pub const IFF_POLLING_COMPAT: c_int = 0x10000;
1157 pub const IFF_PPROMISC: c_int = 0x20000; // user-requested promisc mode
1158 pub const IFF_MONITOR: c_int = 0x40000; // user-requested monitor mode
1159 pub const IFF_STATICARP: c_int = 0x80000; // static ARP
1160 pub const IFF_NPOLLING: c_int = 0x100000; // interface is in polling mode
1161 pub const IFF_IDIRECT: c_int = 0x200000; // direct input
1162
1163 //
1164 // sys/netinet/in.h
1165 // Protocols (RFC 1700)
1166 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
1167
1168 // IPPROTO_IP defined in src/unix/mod.rs
1169 /// IP6 hop-by-hop options
1170 pub const IPPROTO_HOPOPTS: c_int = 0;
1171 // IPPROTO_ICMP defined in src/unix/mod.rs
1172 /// group mgmt protocol
1173 pub const IPPROTO_IGMP: c_int = 2;
1174 /// gateway^2 (deprecated)
1175 pub const IPPROTO_GGP: c_int = 3;
1176 /// for compatibility
1177 pub const IPPROTO_IPIP: c_int = 4;
1178 // IPPROTO_TCP defined in src/unix/mod.rs
1179 /// Stream protocol II.
1180 pub const IPPROTO_ST: c_int = 7;
1181 /// exterior gateway protocol
1182 pub const IPPROTO_EGP: c_int = 8;
1183 /// private interior gateway
1184 pub const IPPROTO_PIGP: c_int = 9;
1185 /// BBN RCC Monitoring
1186 pub const IPPROTO_RCCMON: c_int = 10;
1187 /// network voice protocol
1188 pub const IPPROTO_NVPII: c_int = 11;
1189 /// pup
1190 pub const IPPROTO_PUP: c_int = 12;
1191 /// Argus
1192 pub const IPPROTO_ARGUS: c_int = 13;
1193 /// EMCON
1194 pub const IPPROTO_EMCON: c_int = 14;
1195 /// Cross Net Debugger
1196 pub const IPPROTO_XNET: c_int = 15;
1197 /// Chaos
1198 pub const IPPROTO_CHAOS: c_int = 16;
1199 // IPPROTO_UDP defined in src/unix/mod.rs
1200 /// Multiplexing
1201 pub const IPPROTO_MUX: c_int = 18;
1202 /// DCN Measurement Subsystems
1203 pub const IPPROTO_MEAS: c_int = 19;
1204 /// Host Monitoring
1205 pub const IPPROTO_HMP: c_int = 20;
1206 /// Packet Radio Measurement
1207 pub const IPPROTO_PRM: c_int = 21;
1208 /// xns idp
1209 pub const IPPROTO_IDP: c_int = 22;
1210 /// Trunk-1
1211 pub const IPPROTO_TRUNK1: c_int = 23;
1212 /// Trunk-2
1213 pub const IPPROTO_TRUNK2: c_int = 24;
1214 /// Leaf-1
1215 pub const IPPROTO_LEAF1: c_int = 25;
1216 /// Leaf-2
1217 pub const IPPROTO_LEAF2: c_int = 26;
1218 /// Reliable Data
1219 pub const IPPROTO_RDP: c_int = 27;
1220 /// Reliable Transaction
1221 pub const IPPROTO_IRTP: c_int = 28;
1222 /// tp-4 w/ class negotiation
1223 pub const IPPROTO_TP: c_int = 29;
1224 /// Bulk Data Transfer
1225 pub const IPPROTO_BLT: c_int = 30;
1226 /// Network Services
1227 pub const IPPROTO_NSP: c_int = 31;
1228 /// Merit Internodal
1229 pub const IPPROTO_INP: c_int = 32;
1230 /// Sequential Exchange
1231 pub const IPPROTO_SEP: c_int = 33;
1232 /// Third Party Connect
1233 pub const IPPROTO_3PC: c_int = 34;
1234 /// InterDomain Policy Routing
1235 pub const IPPROTO_IDPR: c_int = 35;
1236 /// XTP
1237 pub const IPPROTO_XTP: c_int = 36;
1238 /// Datagram Delivery
1239 pub const IPPROTO_DDP: c_int = 37;
1240 /// Control Message Transport
1241 pub const IPPROTO_CMTP: c_int = 38;
1242 /// TP++ Transport
1243 pub const IPPROTO_TPXX: c_int = 39;
1244 /// IL transport protocol
1245 pub const IPPROTO_IL: c_int = 40;
1246 // IPPROTO_IPV6 defined in src/unix/mod.rs
1247 /// Source Demand Routing
1248 pub const IPPROTO_SDRP: c_int = 42;
1249 /// IP6 routing header
1250 pub const IPPROTO_ROUTING: c_int = 43;
1251 /// IP6 fragmentation header
1252 pub const IPPROTO_FRAGMENT: c_int = 44;
1253 /// InterDomain Routing
1254 pub const IPPROTO_IDRP: c_int = 45;
1255 /// resource reservation
1256 pub const IPPROTO_RSVP: c_int = 46;
1257 /// General Routing Encap.
1258 pub const IPPROTO_GRE: c_int = 47;
1259 /// Mobile Host Routing
1260 pub const IPPROTO_MHRP: c_int = 48;
1261 /// BHA
1262 pub const IPPROTO_BHA: c_int = 49;
1263 /// IP6 Encap Sec. Payload
1264 pub const IPPROTO_ESP: c_int = 50;
1265 /// IP6 Auth Header
1266 pub const IPPROTO_AH: c_int = 51;
1267 /// Integ. Net Layer Security
1268 pub const IPPROTO_INLSP: c_int = 52;
1269 /// IP with encryption
1270 pub const IPPROTO_SWIPE: c_int = 53;
1271 /// Next Hop Resolution
1272 pub const IPPROTO_NHRP: c_int = 54;
1273 /// IP Mobility
1274 pub const IPPROTO_MOBILE: c_int = 55;
1275 /// Transport Layer Security
1276 pub const IPPROTO_TLSP: c_int = 56;
1277 /// SKIP
1278 pub const IPPROTO_SKIP: c_int = 57;
1279 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
1280 /// IP6 no next header
1281 pub const IPPROTO_NONE: c_int = 59;
1282 /// IP6 destination option
1283 pub const IPPROTO_DSTOPTS: c_int = 60;
1284 /// any host internal protocol
1285 pub const IPPROTO_AHIP: c_int = 61;
1286 /// CFTP
1287 pub const IPPROTO_CFTP: c_int = 62;
1288 /// "hello" routing protocol
1289 pub const IPPROTO_HELLO: c_int = 63;
1290 /// SATNET/Backroom EXPAK
1291 pub const IPPROTO_SATEXPAK: c_int = 64;
1292 /// Kryptolan
1293 pub const IPPROTO_KRYPTOLAN: c_int = 65;
1294 /// Remote Virtual Disk
1295 pub const IPPROTO_RVD: c_int = 66;
1296 /// Pluribus Packet Core
1297 pub const IPPROTO_IPPC: c_int = 67;
1298 /// Any distributed FS
1299 pub const IPPROTO_ADFS: c_int = 68;
1300 /// Satnet Monitoring
1301 pub const IPPROTO_SATMON: c_int = 69;
1302 /// VISA Protocol
1303 pub const IPPROTO_VISA: c_int = 70;
1304 /// Packet Core Utility
1305 pub const IPPROTO_IPCV: c_int = 71;
1306 /// Comp. Prot. Net. Executive
1307 pub const IPPROTO_CPNX: c_int = 72;
1308 /// Comp. Prot. HeartBeat
1309 pub const IPPROTO_CPHB: c_int = 73;
1310 /// Wang Span Network
1311 pub const IPPROTO_WSN: c_int = 74;
1312 /// Packet Video Protocol
1313 pub const IPPROTO_PVP: c_int = 75;
1314 /// BackRoom SATNET Monitoring
1315 pub const IPPROTO_BRSATMON: c_int = 76;
1316 /// Sun net disk proto (temp.)
1317 pub const IPPROTO_ND: c_int = 77;
1318 /// WIDEBAND Monitoring
1319 pub const IPPROTO_WBMON: c_int = 78;
1320 /// WIDEBAND EXPAK
1321 pub const IPPROTO_WBEXPAK: c_int = 79;
1322 /// ISO cnlp
1323 pub const IPPROTO_EON: c_int = 80;
1324 /// VMTP
1325 pub const IPPROTO_VMTP: c_int = 81;
1326 /// Secure VMTP
1327 pub const IPPROTO_SVMTP: c_int = 82;
1328 /// Banyon VINES
1329 pub const IPPROTO_VINES: c_int = 83;
1330 /// TTP
1331 pub const IPPROTO_TTP: c_int = 84;
1332 /// NSFNET-IGP
1333 pub const IPPROTO_IGP: c_int = 85;
1334 /// dissimilar gateway prot.
1335 pub const IPPROTO_DGP: c_int = 86;
1336 /// TCF
1337 pub const IPPROTO_TCF: c_int = 87;
1338 /// Cisco/GXS IGRP
1339 pub const IPPROTO_IGRP: c_int = 88;
1340 /// OSPFIGP
1341 pub const IPPROTO_OSPFIGP: c_int = 89;
1342 /// Strite RPC protocol
1343 pub const IPPROTO_SRPC: c_int = 90;
1344 /// Locus Address Resoloution
1345 pub const IPPROTO_LARP: c_int = 91;
1346 /// Multicast Transport
1347 pub const IPPROTO_MTP: c_int = 92;
1348 /// AX.25 Frames
1349 pub const IPPROTO_AX25: c_int = 93;
1350 /// IP encapsulated in IP
1351 pub const IPPROTO_IPEIP: c_int = 94;
1352 /// Mobile Int.ing control
1353 pub const IPPROTO_MICP: c_int = 95;
1354 /// Semaphore Comm. security
1355 pub const IPPROTO_SCCSP: c_int = 96;
1356 /// Ethernet IP encapsulation
1357 pub const IPPROTO_ETHERIP: c_int = 97;
1358 /// encapsulation header
1359 pub const IPPROTO_ENCAP: c_int = 98;
1360 /// any private encr. scheme
1361 pub const IPPROTO_APES: c_int = 99;
1362 /// GMTP
1363 pub const IPPROTO_GMTP: c_int = 100;
1364 /// payload compression (IPComp)
1365 pub const IPPROTO_IPCOMP: c_int = 108;
1366
1367 /* 101-254: Partly Unassigned */
1368 /// Protocol Independent Mcast
1369 pub const IPPROTO_PIM: c_int = 103;
1370 /// CARP
1371 pub const IPPROTO_CARP: c_int = 112;
1372 /// PGM
1373 pub const IPPROTO_PGM: c_int = 113;
1374 /// PFSYNC
1375 pub const IPPROTO_PFSYNC: c_int = 240;
1376
1377 /* 255: Reserved */
1378 /* BSD Private, local use, namespace incursion, no longer used */
1379 /// divert pseudo-protocol
1380 pub const IPPROTO_DIVERT: c_int = 254;
1381 pub const IPPROTO_MAX: c_int = 256;
1382 /// last return value of *_input(), meaning "all job for this pkt is done".
1383 pub const IPPROTO_DONE: c_int = 257;
1384
1385 /// Used by RSS: the layer3 protocol is unknown
1386 pub const IPPROTO_UNKNOWN: c_int = 258;
1387
1388 // sys/netinet/tcp.h
1389 pub const TCP_SIGNATURE_ENABLE: c_int = 16;
1390 pub const TCP_KEEPINIT: c_int = 32;
1391 pub const TCP_FASTKEEP: c_int = 128;
1392
1393 pub const AF_BLUETOOTH: c_int = 33;
1394 pub const AF_MPLS: c_int = 34;
1395 pub const AF_IEEE80211: c_int = 35;
1396
1397 pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
1398
1399 pub const NET_RT_DUMP: c_int = 1;
1400 pub const NET_RT_FLAGS: c_int = 2;
1401 pub const NET_RT_IFLIST: c_int = 3;
1402 pub const NET_RT_MAXID: c_int = 4;
1403
1404 pub const SOMAXOPT_SIZE: c_int = 65536;
1405
1406 pub const MSG_UNUSED09: c_int = 0x00000200;
1407 pub const MSG_NOSIGNAL: c_int = 0x00000400;
1408 pub const MSG_SYNC: c_int = 0x00000800;
1409 pub const MSG_CMSG_CLOEXEC: c_int = 0x00001000;
1410 pub const MSG_FBLOCKING: c_int = 0x00010000;
1411 pub const MSG_FNONBLOCKING: c_int = 0x00020000;
1412 pub const MSG_FMASK: c_int = 0xFFFF0000;
1413
1414 // sys/mount.h
1415 pub const MNT_NODEV: c_int = 0x00000010;
1416 pub const MNT_AUTOMOUNTED: c_int = 0x00000020;
1417 pub const MNT_TRIM: c_int = 0x01000000;
1418 pub const MNT_LOCAL: c_int = 0x00001000;
1419 pub const MNT_QUOTA: c_int = 0x00002000;
1420 pub const MNT_ROOTFS: c_int = 0x00004000;
1421 pub const MNT_USER: c_int = 0x00008000;
1422 pub const MNT_IGNORE: c_int = 0x00800000;
1423
1424 // utmpx entry types
1425 pub const EMPTY: c_short = 0;
1426 pub const RUN_LVL: c_short = 1;
1427 pub const BOOT_TIME: c_short = 2;
1428 pub const OLD_TIME: c_short = 3;
1429 pub const NEW_TIME: c_short = 4;
1430 pub const INIT_PROCESS: c_short = 5;
1431 pub const LOGIN_PROCESS: c_short = 6;
1432 pub const USER_PROCESS: c_short = 7;
1433 pub const DEAD_PROCESS: c_short = 8;
1434 pub const ACCOUNTING: c_short = 9;
1435 pub const SIGNATURE: c_short = 10;
1436 pub const DOWNTIME: c_short = 11;
1437 // utmpx database types
1438 pub const UTX_DB_UTMPX: c_uint = 0;
1439 pub const UTX_DB_WTMPX: c_uint = 1;
1440 pub const UTX_DB_LASTLOG: c_uint = 2;
1441 pub const _UTX_LINESIZE: usize = 32;
1442 pub const _UTX_USERSIZE: usize = 32;
1443 pub const _UTX_IDSIZE: usize = 4;
1444 pub const _UTX_HOSTSIZE: usize = 256;
1445
1446 pub const LC_COLLATE_MASK: c_int = 1 << 0;
1447 pub const LC_CTYPE_MASK: c_int = 1 << 1;
1448 pub const LC_MONETARY_MASK: c_int = 1 << 2;
1449 pub const LC_NUMERIC_MASK: c_int = 1 << 3;
1450 pub const LC_TIME_MASK: c_int = 1 << 4;
1451 pub const LC_MESSAGES_MASK: c_int = 1 << 5;
1452 pub const LC_ALL_MASK: c_int = LC_COLLATE_MASK
1453 | LC_CTYPE_MASK
1454 | LC_MESSAGES_MASK
1455 | LC_MONETARY_MASK
1456 | LC_NUMERIC_MASK
1457 | LC_TIME_MASK;
1458
1459 pub const TIOCSIG: c_ulong = 0x2000745f;
1460 pub const BTUARTDISC: c_int = 0x7;
1461 pub const TIOCDCDTIMESTAMP: c_ulong = 0x40107458;
1462 pub const TIOCISPTMASTER: c_ulong = 0x20007455;
1463 pub const TIOCMODG: c_ulong = 0x40047403;
1464 pub const TIOCMODS: c_ulong = 0x80047404;
1465 pub const TIOCREMOTE: c_ulong = 0x80047469;
1466 pub const TIOCTIMESTAMP: c_ulong = 0x40107459;
1467
1468 // Constants used by "at" family of system calls.
1469 pub const AT_FDCWD: c_int = 0xFFFAFDCD; // invalid file descriptor
1470 pub const AT_SYMLINK_NOFOLLOW: c_int = 1;
1471 pub const AT_REMOVEDIR: c_int = 2;
1472 pub const AT_EACCESS: c_int = 4;
1473 pub const AT_SYMLINK_FOLLOW: c_int = 8;
1474
1475 pub const VCHECKPT: usize = 19;
1476
1477 pub const _PC_2_SYMLINKS: c_int = 22;
1478 pub const _PC_TIMESTAMP_RESOLUTION: c_int = 23;
1479
1480 pub const _SC_V7_ILP32_OFF32: c_int = 122;
1481 pub const _SC_V7_ILP32_OFFBIG: c_int = 123;
1482 pub const _SC_V7_LP64_OFF64: c_int = 124;
1483 pub const _SC_V7_LPBIG_OFFBIG: c_int = 125;
1484 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 126;
1485 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 127;
1486
1487 pub const WCONTINUED: c_int = 0x4;
1488 pub const WSTOPPED: c_int = 0x2;
1489 pub const WNOWAIT: c_int = 0x8;
1490 pub const WEXITED: c_int = 0x10;
1491 pub const WTRAPPED: c_int = 0x20;
1492
1493 // Similar to FreeBSD, only the standardized ones are exposed.
1494 // There are more.
1495 pub const P_PID: idtype_t = 0;
1496 pub const P_PGID: idtype_t = 2;
1497 pub const P_ALL: idtype_t = 7;
1498
1499 // Values for struct rtprio (type_ field)
1500 pub const RTP_PRIO_REALTIME: c_ushort = 0;
1501 pub const RTP_PRIO_NORMAL: c_ushort = 1;
1502 pub const RTP_PRIO_IDLE: c_ushort = 2;
1503 pub const RTP_PRIO_THREAD: c_ushort = 3;
1504
1505 // Flags for chflags(2)
1506 pub const UF_NOHISTORY: c_ulong = 0x00000040;
1507 pub const UF_CACHE: c_ulong = 0x00000080;
1508 pub const UF_XLINK: c_ulong = 0x00000100;
1509 pub const SF_NOHISTORY: c_ulong = 0x00400000;
1510 pub const SF_CACHE: c_ulong = 0x00800000;
1511 pub const SF_XLINK: c_ulong = 0x01000000;
1512
1513 // timespec constants
1514 pub const UTIME_OMIT: c_long = -2;
1515 pub const UTIME_NOW: c_long = -1;
1516
1517 pub const MINCORE_SUPER: c_int = 0x20;
1518
1519 // kinfo_proc constants
1520 pub const MAXCOMLEN: usize = 16;
1521 pub const MAXLOGNAME: usize = 33;
1522 pub const NGROUPS: usize = 16;
1523
1524 pub const RB_PAUSE: c_int = 0x40000;
1525 pub const RB_VIDEO: c_int = 0x20000000;
1526
1527 // net/route.h
1528 pub const RTF_CLONING: c_int = 0x100;
1529 pub const RTF_PRCLONING: c_int = 0x10000;
1530 pub const RTF_WASCLONED: c_int = 0x20000;
1531 pub const RTF_MPLSOPS: c_int = 0x1000000;
1532
1533 pub const RTM_VERSION: c_int = 7;
1534
1535 pub const RTAX_MPLS1: c_int = 8;
1536 pub const RTAX_MPLS2: c_int = 9;
1537 pub const RTAX_MPLS3: c_int = 10;
1538 pub const RTAX_MAX: c_int = 11;
1539
1540 const_fn! {
1541 {const} fn _CMSG_ALIGN(n: usize) -> usize {
1542 (n + (mem::size_of::<c_long>() - 1)) & !(mem::size_of::<c_long>() - 1)
1543 }
1544 }
1545
1546 f! {
1547 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
1548 (cmsg as *mut c_uchar).offset(_CMSG_ALIGN(mem::size_of::<cmsghdr>()) as isize)
1549 }
1550
1551 pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
1552 (_CMSG_ALIGN(mem::size_of::<cmsghdr>()) + length as usize) as c_uint
1553 }
1554
1555 pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
1556 let next = cmsg as usize
1557 + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
1558 + _CMSG_ALIGN(mem::size_of::<cmsghdr>());
1559 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
1560 if next <= max {
1561 (cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
1562 } else {
1563 0 as *mut cmsghdr
1564 }
1565 }
1566
1567 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
1568 (_CMSG_ALIGN(mem::size_of::<cmsghdr>()) + _CMSG_ALIGN(length as usize)) as c_uint
1569 }
1570
1571 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1572 for slot in cpuset.ary.iter_mut() {
1573 *slot = 0;
1574 }
1575 }
1576
1577 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1578 let (idx, offset) = ((cpu >> 6) & 3, cpu & 63);
1579 cpuset.ary[idx] |= 1 << offset;
1580 ()
1581 }
1582
1583 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1584 let (idx, offset) = ((cpu >> 6) & 3, cpu & 63);
1585 cpuset.ary[idx] &= !(1 << offset);
1586 ()
1587 }
1588
1589 pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
1590 let (idx, offset) = ((cpu >> 6) & 3, cpu & 63);
1591 0 != cpuset.ary[idx] & (1 << offset)
1592 }
1593 }
1594
1595 safe_f! {
1596 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
1597 (status & 0o177) != 0o177 && (status & 0o177) != 0
1598 }
1599
1600 pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t {
1601 let major = major as crate::dev_t;
1602 let minor = minor as crate::dev_t;
1603 let mut dev = 0;
1604 dev |= major << 8;
1605 dev |= minor;
1606 dev
1607 }
1608
1609 pub {const} fn major(dev: crate::dev_t) -> c_int {
1610 ((dev >> 8) & 0xff) as c_int
1611 }
1612
1613 pub {const} fn minor(dev: crate::dev_t) -> c_int {
1614 (dev & 0xffff00ff) as c_int
1615 }
1616 }
1617
1618 extern "C" {
1619 pub fn __errno_location() -> *mut c_int;
1620 pub fn setgrent();
1621 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
1622
1623 pub fn setutxdb(_type: c_uint, file: *mut c_char) -> c_int;
1624
1625 pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut crate::timespec) -> c_int;
1626
1627 pub fn devname_r(
1628 dev: crate::dev_t,
1629 mode: crate::mode_t,
1630 buf: *mut c_char,
1631 len: size_t,
1632 ) -> *mut c_char;
1633
1634 pub fn waitid(
1635 idtype: idtype_t,
1636 id: crate::id_t,
1637 infop: *mut crate::siginfo_t,
1638 options: c_int,
1639 ) -> c_int;
1640
1641 pub fn freelocale(loc: crate::locale_t);
1642
1643 pub fn lwp_rtprio(
1644 function: c_int,
1645 pid: crate::pid_t,
1646 lwpid: lwpid_t,
1647 rtp: *mut super::rtprio,
1648 ) -> c_int;
1649
1650 pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
1651 pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
1652 pub fn uname(buf: *mut crate::utsname) -> c_int;
1653 pub fn memmem(
1654 haystack: *const c_void,
1655 haystacklen: size_t,
1656 needle: *const c_void,
1657 needlelen: size_t,
1658 ) -> *mut c_void;
1659 pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int;
1660 pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int;
1661 pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int;
1662 pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int;
1663 pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int;
1664
1665 pub fn sched_getaffinity(pid: crate::pid_t, cpusetsize: size_t, mask: *mut cpu_set_t) -> c_int;
1666 pub fn sched_setaffinity(
1667 pid: crate::pid_t,
1668 cpusetsize: size_t,
1669 mask: *const cpu_set_t,
1670 ) -> c_int;
1671 pub fn sched_getcpu() -> c_int;
1672 pub fn setproctitle(fmt: *const c_char, ...);
1673
1674 pub fn shmget(key: crate::key_t, size: size_t, shmflg: c_int) -> c_int;
1675 pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void;
1676 pub fn shmdt(shmaddr: *const c_void) -> c_int;
1677 pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int;
1678 pub fn procctl(
1679 idtype: crate::idtype_t,
1680 id: crate::id_t,
1681 cmd: c_int,
1682 data: *mut c_void,
1683 ) -> c_int;
1684
1685 pub fn updwtmpx(file: *const c_char, ut: *const utmpx) -> c_int;
1686 pub fn getlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx)
1687 -> *mut lastlogx;
1688 pub fn updlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx) -> c_int;
1689 pub fn getutxuser(name: *const c_char) -> utmpx;
1690 pub fn utmpxname(file: *const c_char) -> c_int;
1691
1692 pub fn sys_checkpoint(tpe: c_int, fd: c_int, pid: crate::pid_t, retval: c_int) -> c_int;
1693
1694 pub fn umtx_sleep(ptr: *const c_int, value: c_int, timeout: c_int) -> c_int;
1695 pub fn umtx_wakeup(ptr: *const c_int, count: c_int) -> c_int;
1696
1697 pub fn dirname(path: *mut c_char) -> *mut c_char;
1698 pub fn basename(path: *mut c_char) -> *mut c_char;
1699 pub fn getmntinfo(mntbufp: *mut *mut crate::statfs, flags: c_int) -> c_int;
1700 pub fn getmntvinfo(
1701 mntbufp: *mut *mut crate::statfs,
1702 mntvbufp: *mut *mut crate::statvfs,
1703 flags: c_int,
1704 ) -> c_int;
1705
1706 pub fn closefrom(lowfd: c_int) -> c_int;
1707 }
1708
1709 #[link(name = "rt")]
1710 extern "C" {
1711 pub fn aio_cancel(fd: c_int, aiocbp: *mut aiocb) -> c_int;
1712 pub fn aio_error(aiocbp: *const aiocb) -> c_int;
1713 pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int;
1714 pub fn aio_read(aiocbp: *mut aiocb) -> c_int;
1715 pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t;
1716 pub fn aio_suspend(
1717 aiocb_list: *const *const aiocb,
1718 nitems: c_int,
1719 timeout: *const crate::timespec,
1720 ) -> c_int;
1721 pub fn aio_write(aiocbp: *mut aiocb) -> c_int;
1722 pub fn lio_listio(
1723 mode: c_int,
1724 aiocb_list: *const *mut aiocb,
1725 nitems: c_int,
1726 sevp: *mut sigevent,
1727 ) -> c_int;
1728
1729 pub fn reallocf(ptr: *mut c_void, size: size_t) -> *mut c_void;
1730 pub fn freezero(ptr: *mut c_void, size: size_t);
1731 }
1732
1733 #[link(name = "kvm")]
1734 extern "C" {
1735 pub fn kvm_vm_map_entry_first(
1736 kvm: *mut crate::kvm_t,
1737 map: vm_map_t,
1738 entry: vm_map_entry_t,
1739 ) -> vm_map_entry_t;
1740 pub fn kvm_vm_map_entry_next(
1741 kvm: *mut crate::kvm_t,
1742 map: vm_map_entry_t,
1743 entry: vm_map_entry_t,
1744 ) -> vm_map_entry_t;
1745 }
1746
1747 // DIFF(main): module removed in de76fee6
1748 cfg_if! {
1749 if #[cfg(libc_thread_local)] {
1750 mod errno;
1751 pub use self::errno::*;
1752 }
1753 }