Debian Codegraph @

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

raw
1 use crate::prelude::*;
2 use crate::{cmsghdr, off_t};
3
4 pub type fflags_t = u32;
5
6 pub type vm_prot_t = u_char;
7 pub type kvaddr_t = u64;
8 pub type segsz_t = isize;
9 pub type __fixpt_t = u32;
10 pub type fixpt_t = __fixpt_t;
11 pub type __lwpid_t = i32;
12 pub type lwpid_t = __lwpid_t;
13 pub type blksize_t = i32;
14 pub type clockid_t = c_int;
15 pub type sem_t = _sem;
16 pub type timer_t = *mut __c_anonymous__timer;
17
18 pub type fsblkcnt_t = u64;
19 pub type fsfilcnt_t = u64;
20 pub type idtype_t = c_uint;
21
22 pub type msglen_t = c_ulong;
23 pub type msgqnum_t = c_ulong;
24
25 pub type cpulevel_t = c_int;
26 pub type cpuwhich_t = c_int;
27
28 pub type mqd_t = *mut c_void;
29
30 pub type pthread_spinlock_t = *mut __c_anonymous_pthread_spinlock;
31 pub type pthread_barrierattr_t = *mut __c_anonymous_pthread_barrierattr;
32 pub type pthread_barrier_t = *mut __c_anonymous_pthread_barrier;
33
34 pub type uuid_t = crate::uuid;
35 pub type u_int = c_uint;
36 pub type u_char = c_uchar;
37 pub type u_long = c_ulong;
38 pub type u_short = c_ushort;
39
40 pub type caddr_t = *mut c_char;
41
42 pub type fhandle_t = fhandle;
43
44 pub type au_id_t = crate::uid_t;
45 pub type au_asid_t = crate::pid_t;
46
47 pub type cpusetid_t = c_int;
48
49 pub type sctp_assoc_t = u32;
50
51 pub type eventfd_t = u64;
52
53 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
54 #[repr(u32)]
55 pub enum devstat_support_flags {
56 DEVSTAT_ALL_SUPPORTED = 0x00,
57 DEVSTAT_NO_BLOCKSIZE = 0x01,
58 DEVSTAT_NO_ORDERED_TAGS = 0x02,
59 DEVSTAT_BS_UNAVAILABLE = 0x04,
60 }
61 impl Copy for devstat_support_flags {}
62 impl Clone for devstat_support_flags {
63 fn clone(&self) -> devstat_support_flags {
64 *self
65 }
66 }
67
68 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
69 #[repr(u32)]
70 pub enum devstat_trans_flags {
71 DEVSTAT_NO_DATA = 0x00,
72 DEVSTAT_READ = 0x01,
73 DEVSTAT_WRITE = 0x02,
74 DEVSTAT_FREE = 0x03,
75 }
76
77 impl Copy for devstat_trans_flags {}
78 impl Clone for devstat_trans_flags {
79 fn clone(&self) -> devstat_trans_flags {
80 *self
81 }
82 }
83
84 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
85 #[repr(u32)]
86 pub enum devstat_tag_type {
87 DEVSTAT_TAG_SIMPLE = 0x00,
88 DEVSTAT_TAG_HEAD = 0x01,
89 DEVSTAT_TAG_ORDERED = 0x02,
90 DEVSTAT_TAG_NONE = 0x03,
91 }
92 impl Copy for devstat_tag_type {}
93 impl Clone for devstat_tag_type {
94 fn clone(&self) -> devstat_tag_type {
95 *self
96 }
97 }
98
99 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
100 #[repr(u32)]
101 pub enum devstat_match_flags {
102 DEVSTAT_MATCH_NONE = 0x00,
103 DEVSTAT_MATCH_TYPE = 0x01,
104 DEVSTAT_MATCH_IF = 0x02,
105 DEVSTAT_MATCH_PASS = 0x04,
106 }
107 impl Copy for devstat_match_flags {}
108 impl Clone for devstat_match_flags {
109 fn clone(&self) -> devstat_match_flags {
110 *self
111 }
112 }
113
114 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
115 #[repr(u32)]
116 pub enum devstat_priority {
117 DEVSTAT_PRIORITY_MIN = 0x000,
118 DEVSTAT_PRIORITY_OTHER = 0x020,
119 DEVSTAT_PRIORITY_PASS = 0x030,
120 DEVSTAT_PRIORITY_FD = 0x040,
121 DEVSTAT_PRIORITY_WFD = 0x050,
122 DEVSTAT_PRIORITY_TAPE = 0x060,
123 DEVSTAT_PRIORITY_CD = 0x090,
124 DEVSTAT_PRIORITY_DISK = 0x110,
125 DEVSTAT_PRIORITY_ARRAY = 0x120,
126 DEVSTAT_PRIORITY_MAX = 0xfff,
127 }
128 impl Copy for devstat_priority {}
129 impl Clone for devstat_priority {
130 fn clone(&self) -> devstat_priority {
131 *self
132 }
133 }
134
135 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
136 #[repr(u32)]
137 pub enum devstat_type_flags {
138 DEVSTAT_TYPE_DIRECT = 0x000,
139 DEVSTAT_TYPE_SEQUENTIAL = 0x001,
140 DEVSTAT_TYPE_PRINTER = 0x002,
141 DEVSTAT_TYPE_PROCESSOR = 0x003,
142 DEVSTAT_TYPE_WORM = 0x004,
143 DEVSTAT_TYPE_CDROM = 0x005,
144 DEVSTAT_TYPE_SCANNER = 0x006,
145 DEVSTAT_TYPE_OPTICAL = 0x007,
146 DEVSTAT_TYPE_CHANGER = 0x008,
147 DEVSTAT_TYPE_COMM = 0x009,
148 DEVSTAT_TYPE_ASC0 = 0x00a,
149 DEVSTAT_TYPE_ASC1 = 0x00b,
150 DEVSTAT_TYPE_STORARRAY = 0x00c,
151 DEVSTAT_TYPE_ENCLOSURE = 0x00d,
152 DEVSTAT_TYPE_FLOPPY = 0x00e,
153 DEVSTAT_TYPE_MASK = 0x00f,
154 DEVSTAT_TYPE_IF_SCSI = 0x010,
155 DEVSTAT_TYPE_IF_IDE = 0x020,
156 DEVSTAT_TYPE_IF_OTHER = 0x030,
157 DEVSTAT_TYPE_IF_MASK = 0x0f0,
158 DEVSTAT_TYPE_PASS = 0x100,
159 }
160 impl Copy for devstat_type_flags {}
161 impl Clone for devstat_type_flags {
162 fn clone(&self) -> devstat_type_flags {
163 *self
164 }
165 }
166
167 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
168 #[repr(u32)]
169 pub enum devstat_metric {
170 DSM_NONE,
171 DSM_TOTAL_BYTES,
172 DSM_TOTAL_BYTES_READ,
173 DSM_TOTAL_BYTES_WRITE,
174 DSM_TOTAL_TRANSFERS,
175 DSM_TOTAL_TRANSFERS_READ,
176 DSM_TOTAL_TRANSFERS_WRITE,
177 DSM_TOTAL_TRANSFERS_OTHER,
178 DSM_TOTAL_BLOCKS,
179 DSM_TOTAL_BLOCKS_READ,
180 DSM_TOTAL_BLOCKS_WRITE,
181 DSM_KB_PER_TRANSFER,
182 DSM_KB_PER_TRANSFER_READ,
183 DSM_KB_PER_TRANSFER_WRITE,
184 DSM_TRANSFERS_PER_SECOND,
185 DSM_TRANSFERS_PER_SECOND_READ,
186 DSM_TRANSFERS_PER_SECOND_WRITE,
187 DSM_TRANSFERS_PER_SECOND_OTHER,
188 DSM_MB_PER_SECOND,
189 DSM_MB_PER_SECOND_READ,
190 DSM_MB_PER_SECOND_WRITE,
191 DSM_BLOCKS_PER_SECOND,
192 DSM_BLOCKS_PER_SECOND_READ,
193 DSM_BLOCKS_PER_SECOND_WRITE,
194 DSM_MS_PER_TRANSACTION,
195 DSM_MS_PER_TRANSACTION_READ,
196 DSM_MS_PER_TRANSACTION_WRITE,
197 DSM_SKIP,
198 DSM_TOTAL_BYTES_FREE,
199 DSM_TOTAL_TRANSFERS_FREE,
200 DSM_TOTAL_BLOCKS_FREE,
201 DSM_KB_PER_TRANSFER_FREE,
202 DSM_MB_PER_SECOND_FREE,
203 DSM_TRANSFERS_PER_SECOND_FREE,
204 DSM_BLOCKS_PER_SECOND_FREE,
205 DSM_MS_PER_TRANSACTION_OTHER,
206 DSM_MS_PER_TRANSACTION_FREE,
207 DSM_BUSY_PCT,
208 DSM_QUEUE_LENGTH,
209 DSM_TOTAL_DURATION,
210 DSM_TOTAL_DURATION_READ,
211 DSM_TOTAL_DURATION_WRITE,
212 DSM_TOTAL_DURATION_FREE,
213 DSM_TOTAL_DURATION_OTHER,
214 DSM_TOTAL_BUSY_TIME,
215 DSM_MAX,
216 }
217 impl Copy for devstat_metric {}
218 impl Clone for devstat_metric {
219 fn clone(&self) -> devstat_metric {
220 *self
221 }
222 }
223
224 #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))]
225 #[repr(u32)]
226 pub enum devstat_select_mode {
227 DS_SELECT_ADD,
228 DS_SELECT_ONLY,
229 DS_SELECT_REMOVE,
230 DS_SELECT_ADDONLY,
231 }
232 impl Copy for devstat_select_mode {}
233 impl Clone for devstat_select_mode {
234 fn clone(&self) -> devstat_select_mode {
235 *self
236 }
237 }
238
239 s! {
240 pub struct aiocb {
241 pub aio_fildes: c_int,
242 pub aio_offset: off_t,
243 pub aio_buf: *mut c_void,
244 pub aio_nbytes: size_t,
245 __unused1: [c_int; 2],
246 __unused2: *mut c_void,
247 pub aio_lio_opcode: c_int,
248 pub aio_reqprio: c_int,
249 // unused 3 through 5 are the __aiocb_private structure
250 __unused3: c_long,
251 __unused4: c_long,
252 __unused5: *mut c_void,
253 pub aio_sigevent: sigevent,
254 }
255
256 pub struct jail {
257 pub version: u32,
258 pub path: *mut c_char,
259 pub hostname: *mut c_char,
260 pub jailname: *mut c_char,
261 pub ip4s: c_uint,
262 pub ip6s: c_uint,
263 pub ip4: *mut crate::in_addr,
264 pub ip6: *mut crate::in6_addr,
265 }
266
267 pub struct statvfs {
268 pub f_bavail: crate::fsblkcnt_t,
269 pub f_bfree: crate::fsblkcnt_t,
270 pub f_blocks: crate::fsblkcnt_t,
271 pub f_favail: crate::fsfilcnt_t,
272 pub f_ffree: crate::fsfilcnt_t,
273 pub f_files: crate::fsfilcnt_t,
274 pub f_bsize: c_ulong,
275 pub f_flag: c_ulong,
276 pub f_frsize: c_ulong,
277 pub f_fsid: c_ulong,
278 pub f_namemax: c_ulong,
279 }
280
281 // internal structure has changed over time
282 pub struct _sem {
283 data: [u32; 4],
284 }
285 pub struct sembuf {
286 pub sem_num: c_ushort,
287 pub sem_op: c_short,
288 pub sem_flg: c_short,
289 }
290
291 pub struct input_event {
292 pub time: crate::timeval,
293 pub type_: crate::u_short,
294 pub code: crate::u_short,
295 pub value: i32,
296 }
297
298 pub struct input_absinfo {
299 pub value: i32,
300 pub minimum: i32,
301 pub maximum: i32,
302 pub fuzz: i32,
303 pub flat: i32,
304 pub resolution: i32,
305 }
306
307 pub struct msqid_ds {
308 pub msg_perm: crate::ipc_perm,
309 __unused1: *mut c_void,
310 __unused2: *mut c_void,
311 pub msg_cbytes: crate::msglen_t,
312 pub msg_qnum: crate::msgqnum_t,
313 pub msg_qbytes: crate::msglen_t,
314 pub msg_lspid: crate::pid_t,
315 pub msg_lrpid: crate::pid_t,
316 pub msg_stime: crate::time_t,
317 pub msg_rtime: crate::time_t,
318 pub msg_ctime: crate::time_t,
319 }
320
321 pub struct stack_t {
322 pub ss_sp: *mut c_void,
323 pub ss_size: size_t,
324 pub ss_flags: c_int,
325 }
326
327 pub struct mmsghdr {
328 pub msg_hdr: crate::msghdr,
329 pub msg_len: ssize_t,
330 }
331
332 pub struct sockcred {
333 pub sc_uid: crate::uid_t,
334 pub sc_euid: crate::uid_t,
335 pub sc_gid: crate::gid_t,
336 pub sc_egid: crate::gid_t,
337 pub sc_ngroups: c_int,
338 pub sc_groups: [crate::gid_t; 1],
339 }
340
341 pub struct ptrace_vm_entry {
342 pub pve_entry: c_int,
343 pub pve_timestamp: c_int,
344 pub pve_start: c_ulong,
345 pub pve_end: c_ulong,
346 pub pve_offset: c_ulong,
347 pub pve_prot: c_uint,
348 pub pve_pathlen: c_uint,
349 pub pve_fileid: c_long,
350 pub pve_fsid: u32,
351 pub pve_path: *mut c_char,
352 }
353
354 pub struct ptrace_lwpinfo {
355 pub pl_lwpid: lwpid_t,
356 pub pl_event: c_int,
357 pub pl_flags: c_int,
358 pub pl_sigmask: crate::sigset_t,
359 pub pl_siglist: crate::sigset_t,
360 pub pl_siginfo: crate::siginfo_t,
361 pub pl_tdname: [c_char; crate::MAXCOMLEN as usize + 1],
362 pub pl_child_pid: crate::pid_t,
363 pub pl_syscall_code: c_uint,
364 pub pl_syscall_narg: c_uint,
365 }
366
367 pub struct ptrace_sc_ret {
368 pub sr_retval: [crate::register_t; 2],
369 pub sr_error: c_int,
370 }
371
372 pub struct ptrace_coredump {
373 pub pc_fd: c_int,
374 pub pc_flags: u32,
375 pub pc_limit: off_t,
376 }
377
378 pub struct ptrace_sc_remote {
379 pub pscr_ret: ptrace_sc_ret,
380 pub pscr_syscall: c_uint,
381 pub pscr_nargs: c_uint,
382 pub pscr_args: *mut crate::register_t,
383 }
384
385 pub struct cpuset_t {
386 #[cfg(all(any(freebsd15, freebsd14), target_pointer_width = "64"))]
387 __bits: [c_long; 16],
388 #[cfg(all(any(freebsd15, freebsd14), target_pointer_width = "32"))]
389 __bits: [c_long; 32],
390 #[cfg(all(not(any(freebsd15, freebsd14)), target_pointer_width = "64"))]
391 __bits: [c_long; 4],
392 #[cfg(all(not(any(freebsd15, freebsd14)), target_pointer_width = "32"))]
393 __bits: [c_long; 8],
394 }
395
396 pub struct cap_rights_t {
397 cr_rights: [u64; 2],
398 }
399
400 pub struct umutex {
401 m_owner: crate::lwpid_t,
402 m_flags: u32,
403 m_ceilings: [u32; 2],
404 m_rb_link: crate::uintptr_t,
405 #[cfg(target_pointer_width = "32")]
406 m_pad: u32,
407 m_spare: [u32; 2],
408 }
409
410 pub struct ucond {
411 c_has_waiters: u32,
412 c_flags: u32,
413 c_clockid: u32,
414 c_spare: [u32; 1],
415 }
416
417 pub struct uuid {
418 pub time_low: u32,
419 pub time_mid: u16,
420 pub time_hi_and_version: u16,
421 pub clock_seq_hi_and_reserved: u8,
422 pub clock_seq_low: u8,
423 pub node: [u8; _UUID_NODE_LEN],
424 }
425
426 pub struct __c_anonymous_pthread_spinlock {
427 s_clock: umutex,
428 }
429
430 pub struct __c_anonymous_pthread_barrierattr {
431 pshared: c_int,
432 }
433
434 pub struct __c_anonymous_pthread_barrier {
435 b_lock: umutex,
436 b_cv: ucond,
437 b_cycle: i64,
438 b_count: c_int,
439 b_waiters: c_int,
440 b_refcount: c_int,
441 b_destroying: c_int,
442 }
443
444 pub struct kinfo_vmentry {
445 pub kve_structsize: c_int,
446 pub kve_type: c_int,
447 pub kve_start: u64,
448 pub kve_end: u64,
449 pub kve_offset: u64,
450 pub kve_vn_fileid: u64,
451 #[cfg(not(freebsd11))]
452 pub kve_vn_fsid_freebsd11: u32,
453 #[cfg(freebsd11)]
454 pub kve_vn_fsid: u32,
455 pub kve_flags: c_int,
456 pub kve_resident: c_int,
457 pub kve_private_resident: c_int,
458 pub kve_protection: c_int,
459 pub kve_ref_count: c_int,
460 pub kve_shadow_count: c_int,
461 pub kve_vn_type: c_int,
462 pub kve_vn_size: u64,
463 #[cfg(not(freebsd11))]
464 pub kve_vn_rdev_freebsd11: u32,
465 #[cfg(freebsd11)]
466 pub kve_vn_rdev: u32,
467 pub kve_vn_mode: u16,
468 pub kve_status: u16,
469 #[cfg(not(freebsd11))]
470 pub kve_vn_fsid: u64,
471 #[cfg(not(freebsd11))]
472 pub kve_vn_rdev: u64,
473 #[cfg(not(freebsd11))]
474 _kve_is_spare: [c_int; 8],
475 #[cfg(freebsd11)]
476 _kve_is_spare: [c_int; 12],
477 pub kve_path: [[c_char; 32]; 32],
478 }
479
480 pub struct __c_anonymous_filestat {
481 pub stqe_next: *mut filestat,
482 }
483
484 pub struct filestat {
485 pub fs_type: c_int,
486 pub fs_flags: c_int,
487 pub fs_fflags: c_int,
488 pub fs_uflags: c_int,
489 pub fs_fd: c_int,
490 pub fs_ref_count: c_int,
491 pub fs_offset: off_t,
492 pub fs_typedep: *mut c_void,
493 pub fs_path: *mut c_char,
494 pub next: __c_anonymous_filestat,
495 pub fs_cap_rights: cap_rights_t,
496 }
497
498 pub struct filestat_list {
499 pub stqh_first: *mut filestat,
500 pub stqh_last: *mut *mut filestat,
501 }
502
503 pub struct procstat {
504 pub tpe: c_int,
505 pub kd: crate::uintptr_t,
506 pub vmentries: *mut c_void,
507 pub files: *mut c_void,
508 pub argv: *mut c_void,
509 pub envv: *mut c_void,
510 pub core: crate::uintptr_t,
511 }
512
513 pub struct itimerspec {
514 pub it_interval: crate::timespec,
515 pub it_value: crate::timespec,
516 }
517
518 pub struct __c_anonymous__timer {
519 _priv: [c_int; 3],
520 }
521
522 /// Used to hold a copy of the command line, if it had a sane length.
523 pub struct pargs {
524 /// Reference count.
525 pub ar_ref: u_int,
526 /// Length.
527 pub ar_length: u_int,
528 /// Arguments.
529 pub ar_args: [c_uchar; 1],
530 }
531
532 pub struct priority {
533 /// Scheduling class.
534 pub pri_class: u_char,
535 /// Normal priority level.
536 pub pri_level: u_char,
537 /// Priority before propagation.
538 pub pri_native: u_char,
539 /// User priority based on p_cpu and p_nice.
540 pub pri_user: u_char,
541 }
542
543 pub struct kvm_swap {
544 pub ksw_devname: [c_char; 32],
545 pub ksw_used: u_int,
546 pub ksw_total: u_int,
547 pub ksw_flags: c_int,
548 pub ksw_reserved1: u_int,
549 pub ksw_reserved2: u_int,
550 }
551
552 pub struct nlist {
553 /// symbol name (in memory)
554 pub n_name: *const c_char,
555 /// type defines
556 pub n_type: c_uchar,
557 /// "type" and binding information
558 pub n_other: c_char,
559 /// used by stab entries
560 pub n_desc: c_short,
561 pub n_value: c_ulong,
562 }
563
564 pub struct kvm_nlist {
565 pub n_name: *const c_char,
566 pub n_type: c_uchar,
567 pub n_value: crate::kvaddr_t,
568 }
569
570 pub struct __c_anonymous_sem {
571 _priv: crate::uintptr_t,
572 }
573
574 pub struct semid_ds {
575 pub sem_perm: crate::ipc_perm,
576 pub __sem_base: *mut __c_anonymous_sem,
577 pub sem_nsems: c_ushort,
578 pub sem_otime: crate::time_t,
579 pub sem_ctime: crate::time_t,
580 }
581
582 pub struct vmtotal {
583 pub t_vm: u64,
584 pub t_avm: u64,
585 pub t_rm: u64,
586 pub t_arm: u64,
587 pub t_vmshr: u64,
588 pub t_avmshr: u64,
589 pub t_rmshr: u64,
590 pub t_armshr: u64,
591 pub t_free: u64,
592 pub t_rq: i16,
593 pub t_dw: i16,
594 pub t_pw: i16,
595 pub t_sl: i16,
596 pub t_sw: i16,
597 pub t_pad: [u16; 3],
598 }
599
600 pub struct sockstat {
601 pub inp_ppcb: u64,
602 pub so_addr: u64,
603 pub so_pcb: u64,
604 pub unp_conn: u64,
605 pub dom_family: c_int,
606 pub proto: c_int,
607 pub so_rcv_sb_state: c_int,
608 pub so_snd_sb_state: c_int,
609 /// Socket address.
610 pub sa_local: crate::sockaddr_storage,
611 /// Peer address.
612 pub sa_peer: crate::sockaddr_storage,
613 pub type_: c_int,
614 pub dname: [c_char; 32],
615 #[cfg(any(freebsd12, freebsd13, freebsd14, freebsd15))]
616 pub sendq: c_uint,
617 #[cfg(any(freebsd12, freebsd13, freebsd14, freebsd15))]
618 pub recvq: c_uint,
619 }
620
621 pub struct shmstat {
622 pub size: u64,
623 pub mode: u16,
624 }
625
626 pub struct spacectl_range {
627 pub r_offset: off_t,
628 pub r_len: off_t,
629 }
630
631 pub struct rusage_ext {
632 pub rux_runtime: u64,
633 pub rux_uticks: u64,
634 pub rux_sticks: u64,
635 pub rux_iticks: u64,
636 pub rux_uu: u64,
637 pub rux_su: u64,
638 pub rux_tu: u64,
639 }
640
641 pub struct if_clonereq {
642 pub ifcr_total: c_int,
643 pub ifcr_count: c_int,
644 pub ifcr_buffer: *mut c_char,
645 }
646
647 pub struct if_msghdr {
648 /// to skip over non-understood messages
649 pub ifm_msglen: c_ushort,
650 /// future binary compatibility
651 pub ifm_version: c_uchar,
652 /// message type
653 pub ifm_type: c_uchar,
654 /// like rtm_addrs
655 pub ifm_addrs: c_int,
656 /// value of if_flags
657 pub ifm_flags: c_int,
658 /// index for associated ifp
659 pub ifm_index: c_ushort,
660 pub _ifm_spare1: c_ushort,
661 /// statistics and other data about if
662 pub ifm_data: if_data,
663 }
664
665 pub struct if_msghdrl {
666 /// to skip over non-understood messages
667 pub ifm_msglen: c_ushort,
668 /// future binary compatibility
669 pub ifm_version: c_uchar,
670 /// message type
671 pub ifm_type: c_uchar,
672 /// like rtm_addrs
673 pub ifm_addrs: c_int,
674 /// value of if_flags
675 pub ifm_flags: c_int,
676 /// index for associated ifp
677 pub ifm_index: c_ushort,
678 /// spare space to grow if_index, see if_var.h
679 pub _ifm_spare1: c_ushort,
680 /// length of if_msghdrl incl. if_data
681 pub ifm_len: c_ushort,
682 /// offset of if_data from beginning
683 pub ifm_data_off: c_ushort,
684 pub _ifm_spare2: c_int,
685 /// statistics and other data about if
686 pub ifm_data: if_data,
687 }
688
689 pub struct ifa_msghdr {
690 /// to skip over non-understood messages
691 pub ifam_msglen: c_ushort,
692 /// future binary compatibility
693 pub ifam_version: c_uchar,
694 /// message type
695 pub ifam_type: c_uchar,
696 /// like rtm_addrs
697 pub ifam_addrs: c_int,
698 /// value of ifa_flags
699 pub ifam_flags: c_int,
700 /// index for associated ifp
701 pub ifam_index: c_ushort,
702 pub _ifam_spare1: c_ushort,
703 /// value of ifa_ifp->if_metric
704 pub ifam_metric: c_int,
705 }
706
707 pub struct ifa_msghdrl {
708 /// to skip over non-understood messages
709 pub ifam_msglen: c_ushort,
710 /// future binary compatibility
711 pub ifam_version: c_uchar,
712 /// message type
713 pub ifam_type: c_uchar,
714 /// like rtm_addrs
715 pub ifam_addrs: c_int,
716 /// value of ifa_flags
717 pub ifam_flags: c_int,
718 /// index for associated ifp
719 pub ifam_index: c_ushort,
720 /// spare space to grow if_index, see if_var.h
721 pub _ifam_spare1: c_ushort,
722 /// length of ifa_msghdrl incl. if_data
723 pub ifam_len: c_ushort,
724 /// offset of if_data from beginning
725 pub ifam_data_off: c_ushort,
726 /// value of ifa_ifp->if_metric
727 pub ifam_metric: c_int,
728 /// statistics and other data about if or address
729 pub ifam_data: if_data,
730 }
731
732 pub struct ifma_msghdr {
733 /// to skip over non-understood messages
734 pub ifmam_msglen: c_ushort,
735 /// future binary compatibility
736 pub ifmam_version: c_uchar,
737 /// message type
738 pub ifmam_type: c_uchar,
739 /// like rtm_addrs
740 pub ifmam_addrs: c_int,
741 /// value of ifa_flags
742 pub ifmam_flags: c_int,
743 /// index for associated ifp
744 pub ifmam_index: c_ushort,
745 pub _ifmam_spare1: c_ushort,
746 }
747
748 pub struct if_announcemsghdr {
749 /// to skip over non-understood messages
750 pub ifan_msglen: c_ushort,
751 /// future binary compatibility
752 pub ifan_version: c_uchar,
753 /// message type
754 pub ifan_type: c_uchar,
755 /// index for associated ifp
756 pub ifan_index: c_ushort,
757 /// if name, e.g. "en0"
758 pub ifan_name: [c_char; crate::IFNAMSIZ as usize],
759 /// what type of announcement
760 pub ifan_what: c_ushort,
761 }
762
763 pub struct ifreq_buffer {
764 pub length: size_t,
765 pub buffer: *mut c_void,
766 }
767
768 pub struct ifaliasreq {
769 /// if name, e.g. "en0"
770 pub ifra_name: [c_char; crate::IFNAMSIZ as usize],
771 pub ifra_addr: crate::sockaddr,
772 pub ifra_broadaddr: crate::sockaddr,
773 pub ifra_mask: crate::sockaddr,
774 pub ifra_vhid: c_int,
775 }
776
777 /// 9.x compat
778 pub struct oifaliasreq {
779 /// if name, e.g. "en0"
780 pub ifra_name: [c_char; crate::IFNAMSIZ as usize],
781 pub ifra_addr: crate::sockaddr,
782 pub ifra_broadaddr: crate::sockaddr,
783 pub ifra_mask: crate::sockaddr,
784 }
785
786 pub struct ifmediareq {
787 /// if name, e.g. "en0"
788 pub ifm_name: [c_char; crate::IFNAMSIZ as usize],
789 /// current media options
790 pub ifm_current: c_int,
791 /// don't care mask
792 pub ifm_mask: c_int,
793 /// media status
794 pub ifm_status: c_int,
795 /// active options
796 pub ifm_active: c_int,
797 /// # entries in ifm_ulist array
798 pub ifm_count: c_int,
799 /// media words
800 pub ifm_ulist: *mut c_int,
801 }
802
803 pub struct ifdrv {
804 /// if name, e.g. "en0"
805 pub ifd_name: [c_char; crate::IFNAMSIZ as usize],
806 pub ifd_cmd: c_ulong,
807 pub ifd_len: size_t,
808 pub ifd_data: *mut c_void,
809 }
810
811 pub struct ifi2creq {
812 /// i2c address (0xA0, 0xA2)
813 pub dev_addr: u8,
814 /// read offset
815 pub offset: u8,
816 /// read length
817 pub len: u8,
818 pub spare0: u8,
819 pub spare1: u32,
820 /// read buffer
821 pub data: [u8; 8],
822 }
823
824 pub struct ifrsshash {
825 /// if name, e.g. "en0"
826 pub ifrh_name: [c_char; crate::IFNAMSIZ as usize],
827 /// RSS_FUNC_
828 pub ifrh_func: u8,
829 pub ifrh_spare0: u8,
830 pub ifrh_spare1: u16,
831 /// RSS_TYPE_
832 pub ifrh_types: u32,
833 }
834
835 pub struct ifmibdata {
836 /// name of interface
837 pub ifmd_name: [c_char; crate::IFNAMSIZ as usize],
838 /// number of promiscuous listeners
839 pub ifmd_pcount: c_int,
840 /// interface flags
841 pub ifmd_flags: c_int,
842 /// instantaneous length of send queue
843 pub ifmd_snd_len: c_int,
844 /// maximum length of send queue
845 pub ifmd_snd_maxlen: c_int,
846 /// number of drops in send queue
847 pub ifmd_snd_drops: c_int,
848 /// for future expansion
849 pub ifmd_filler: [c_int; 4],
850 /// generic information and statistics
851 pub ifmd_data: if_data,
852 }
853
854 pub struct ifmib_iso_8802_3 {
855 pub dot3StatsAlignmentErrors: u32,
856 pub dot3StatsFCSErrors: u32,
857 pub dot3StatsSingleCollisionFrames: u32,
858 pub dot3StatsMultipleCollisionFrames: u32,
859 pub dot3StatsSQETestErrors: u32,
860 pub dot3StatsDeferredTransmissions: u32,
861 pub dot3StatsLateCollisions: u32,
862 pub dot3StatsExcessiveCollisions: u32,
863 pub dot3StatsInternalMacTransmitErrors: u32,
864 pub dot3StatsCarrierSenseErrors: u32,
865 pub dot3StatsFrameTooLongs: u32,
866 pub dot3StatsInternalMacReceiveErrors: u32,
867 pub dot3StatsEtherChipSet: u32,
868 pub dot3StatsMissedFrames: u32,
869 pub dot3StatsCollFrequencies: [u32; 16],
870 pub dot3Compliance: u32,
871 }
872
873 pub struct __c_anonymous_ph {
874 pub ph1: u64,
875 pub ph2: u64,
876 }
877
878 pub struct fid {
879 pub fid_len: c_ushort,
880 pub fid_data0: c_ushort,
881 pub fid_data: [c_char; crate::MAXFIDSZ as usize],
882 }
883
884 pub struct fhandle {
885 pub fh_fsid: crate::fsid_t,
886 pub fh_fid: fid,
887 }
888
889 pub struct bintime {
890 pub sec: crate::time_t,
891 pub frac: u64,
892 }
893
894 pub struct clockinfo {
895 /// clock frequency
896 pub hz: c_int,
897 /// micro-seconds per hz tick
898 pub tick: c_int,
899 pub spare: c_int,
900 /// statistics clock frequency
901 pub stathz: c_int,
902 /// profiling clock frequency
903 pub profhz: c_int,
904 }
905
906 pub struct __c_anonymous_stailq_entry_devstat {
907 pub stqe_next: *mut devstat,
908 }
909
910 pub struct devstat {
911 /// Update sequence
912 pub sequence0: crate::u_int,
913 /// Allocated entry
914 pub allocated: c_int,
915 /// started ops
916 pub start_count: crate::u_int,
917 /// completed ops
918 pub end_count: crate::u_int,
919 /// busy time unaccounted for since this time
920 pub busy_from: bintime,
921 pub dev_links: __c_anonymous_stailq_entry_devstat,
922 /// Devstat device number.
923 pub device_number: u32,
924 pub device_name: [c_char; DEVSTAT_NAME_LEN as usize],
925 pub unit_number: c_int,
926 pub bytes: [u64; DEVSTAT_N_TRANS_FLAGS as usize],
927 pub operations: [u64; DEVSTAT_N_TRANS_FLAGS as usize],
928 pub duration: [bintime; DEVSTAT_N_TRANS_FLAGS as usize],
929 pub busy_time: bintime,
930 /// Time the device was created.
931 pub creation_time: bintime,
932 /// Block size, bytes
933 pub block_size: u32,
934 /// The number of simple, ordered, and head of queue tags sent.
935 pub tag_types: [u64; 3],
936 /// Which statistics are supported by a given device.
937 pub flags: devstat_support_flags,
938 /// Device type
939 pub device_type: devstat_type_flags,
940 /// Controls list pos.
941 pub priority: devstat_priority,
942 /// Identification for GEOM nodes
943 pub id: *const c_void,
944 /// Update sequence
945 pub sequence1: crate::u_int,
946 }
947
948 pub struct devstat_match {
949 pub match_fields: devstat_match_flags,
950 pub device_type: devstat_type_flags,
951 pub num_match_categories: c_int,
952 }
953
954 pub struct devstat_match_table {
955 pub match_str: *const c_char,
956 pub type_: devstat_type_flags,
957 pub match_field: devstat_match_flags,
958 }
959
960 pub struct device_selection {
961 pub device_number: u32,
962 pub device_name: [c_char; DEVSTAT_NAME_LEN as usize],
963 pub unit_number: c_int,
964 pub selected: c_int,
965 pub bytes: u64,
966 pub position: c_int,
967 }
968
969 pub struct devinfo {
970 pub devices: *mut devstat,
971 pub mem_ptr: *mut u8,
972 pub generation: c_long,
973 pub numdevs: c_int,
974 }
975
976 pub struct sockcred2 {
977 pub sc_version: c_int,
978 pub sc_pid: crate::pid_t,
979 pub sc_uid: crate::uid_t,
980 pub sc_euid: crate::uid_t,
981 pub sc_gid: crate::gid_t,
982 pub sc_egid: crate::gid_t,
983 pub sc_ngroups: c_int,
984 pub sc_groups: [crate::gid_t; 1],
985 }
986
987 pub struct ifconf {
988 pub ifc_len: c_int,
989 pub ifc_ifcu: __c_anonymous_ifc_ifcu,
990 }
991
992 pub struct au_mask_t {
993 pub am_success: c_uint,
994 pub am_failure: c_uint,
995 }
996
997 pub struct au_tid_t {
998 pub port: u32,
999 pub machine: u32,
1000 }
1001
1002 pub struct auditinfo_t {
1003 pub ai_auid: crate::au_id_t,
1004 pub ai_mask: crate::au_mask_t,
1005 pub ai_termid: au_tid_t,
1006 pub ai_asid: crate::au_asid_t,
1007 }
1008
1009 pub struct tcp_fastopen {
1010 pub enable: c_int,
1011 pub psk: [u8; crate::TCP_FASTOPEN_PSK_LEN as usize],
1012 }
1013
1014 pub struct tcp_function_set {
1015 pub function_set_name: [c_char; crate::TCP_FUNCTION_NAME_LEN_MAX as usize],
1016 pub pcbcnt: u32,
1017 }
1018
1019 // Note: this structure will change in a backwards-incompatible way in
1020 // FreeBSD 15.
1021 pub struct tcp_info {
1022 pub tcpi_state: u8,
1023 pub __tcpi_ca_state: u8,
1024 pub __tcpi_retransmits: u8,
1025 pub __tcpi_probes: u8,
1026 pub __tcpi_backoff: u8,
1027 pub tcpi_options: u8,
1028 pub tcp_snd_wscale: u8,
1029 pub tcp_rcv_wscale: u8,
1030 pub tcpi_rto: u32,
1031 pub __tcpi_ato: u32,
1032 pub tcpi_snd_mss: u32,
1033 pub tcpi_rcv_mss: u32,
1034 pub __tcpi_unacked: u32,
1035 pub __tcpi_sacked: u32,
1036 pub __tcpi_lost: u32,
1037 pub __tcpi_retrans: u32,
1038 pub __tcpi_fackets: u32,
1039 pub __tcpi_last_data_sent: u32,
1040 pub __tcpi_last_ack_sent: u32,
1041 pub tcpi_last_data_recv: u32,
1042 pub __tcpi_last_ack_recv: u32,
1043 pub __tcpi_pmtu: u32,
1044 pub __tcpi_rcv_ssthresh: u32,
1045 pub tcpi_rtt: u32,
1046 pub tcpi_rttvar: u32,
1047 pub tcpi_snd_ssthresh: u32,
1048 pub tcpi_snd_cwnd: u32,
1049 pub __tcpi_advmss: u32,
1050 pub __tcpi_reordering: u32,
1051 pub __tcpi_rcv_rtt: u32,
1052 pub tcpi_rcv_space: u32,
1053 pub tcpi_snd_wnd: u32,
1054 pub tcpi_snd_bwnd: u32,
1055 pub tcpi_snd_nxt: u32,
1056 pub tcpi_rcv_nxt: u32,
1057 pub tcpi_toe_tid: u32,
1058 pub tcpi_snd_rexmitpack: u32,
1059 pub tcpi_rcv_ooopack: u32,
1060 pub tcpi_snd_zerowin: u32,
1061 #[cfg(any(freebsd15, freebsd14))]
1062 pub tcpi_delivered_ce: u32,
1063 #[cfg(any(freebsd15, freebsd14))]
1064 pub tcpi_received_ce: u32,
1065 #[cfg(any(freebsd15, freebsd14))]
1066 pub __tcpi_delivered_e1_bytes: u32,
1067 #[cfg(any(freebsd15, freebsd14))]
1068 pub __tcpi_delivered_e0_bytes: u32,
1069 #[cfg(any(freebsd15, freebsd14))]
1070 pub __tcpi_delivered_ce_bytes: u32,
1071 #[cfg(any(freebsd15, freebsd14))]
1072 pub __tcpi_received_e1_bytes: u32,
1073 #[cfg(any(freebsd15, freebsd14))]
1074 pub __tcpi_received_e0_bytes: u32,
1075 #[cfg(any(freebsd15, freebsd14))]
1076 pub __tcpi_received_ce_bytes: u32,
1077 #[cfg(any(freebsd15, freebsd14))]
1078 pub tcpi_total_tlp: u32,
1079 #[cfg(any(freebsd15, freebsd14))]
1080 pub tcpi_total_tlp_bytes: u64,
1081 #[cfg(any(freebsd15, freebsd14))]
1082 pub tcpi_snd_una: u32,
1083 #[cfg(any(freebsd15, freebsd14))]
1084 pub tcpi_snd_max: u32,
1085 #[cfg(any(freebsd15, freebsd14))]
1086 pub tcpi_rcv_numsacks: u32,
1087 #[cfg(any(freebsd15, freebsd14))]
1088 pub tcpi_rcv_adv: u32,
1089 #[cfg(any(freebsd15, freebsd14))]
1090 pub tcpi_dupacks: u32,
1091 #[cfg(freebsd14)]
1092 pub __tcpi_pad: [u32; 10],
1093 #[cfg(freebsd15)]
1094 pub __tcpi_pad: [u32; 14],
1095 #[cfg(not(any(freebsd15, freebsd14)))]
1096 pub __tcpi_pad: [u32; 26],
1097 }
1098
1099 pub struct _umtx_time {
1100 pub _timeout: crate::timespec,
1101 pub _flags: u32,
1102 pub _clockid: u32,
1103 }
1104
1105 pub struct shm_largepage_conf {
1106 pub psind: c_int,
1107 pub alloc_policy: c_int,
1108 __pad: [c_int; 10],
1109 }
1110
1111 pub struct memory_type {
1112 __priva: [crate::uintptr_t; 32],
1113 __privb: [crate::uintptr_t; 26],
1114 }
1115
1116 pub struct memory_type_list {
1117 __priv: [crate::uintptr_t; 2],
1118 }
1119
1120 pub struct pidfh {
1121 __priva: [[crate::uintptr_t; 32]; 8],
1122 __privb: [crate::uintptr_t; 2],
1123 }
1124
1125 pub struct sctp_event {
1126 pub se_assoc_id: crate::sctp_assoc_t,
1127 pub se_type: u16,
1128 pub se_on: u8,
1129 }
1130
1131 pub struct sctp_event_subscribe {
1132 pub sctp_data_io_event: u8,
1133 pub sctp_association_event: u8,
1134 pub sctp_address_event: u8,
1135 pub sctp_send_failure_event: u8,
1136 pub sctp_peer_error_event: u8,
1137 pub sctp_shutdown_event: u8,
1138 pub sctp_partial_delivery_event: u8,
1139 pub sctp_adaptation_layer_event: u8,
1140 pub sctp_authentication_event: u8,
1141 pub sctp_sender_dry_event: u8,
1142 pub sctp_stream_reset_event: u8,
1143 }
1144
1145 pub struct sctp_initmsg {
1146 pub sinit_num_ostreams: u16,
1147 pub sinit_max_instreams: u16,
1148 pub sinit_max_attempts: u16,
1149 pub sinit_max_init_timeo: u16,
1150 }
1151
1152 pub struct sctp_sndrcvinfo {
1153 pub sinfo_stream: u16,
1154 pub sinfo_ssn: u16,
1155 pub sinfo_flags: u16,
1156 pub sinfo_ppid: u32,
1157 pub sinfo_context: u32,
1158 pub sinfo_timetolive: u32,
1159 pub sinfo_tsn: u32,
1160 pub sinfo_cumtsn: u32,
1161 pub sinfo_assoc_id: crate::sctp_assoc_t,
1162 pub sinfo_keynumber: u16,
1163 pub sinfo_keynumber_valid: u16,
1164 pub __reserve_pad: [[u8; 23]; 4],
1165 }
1166
1167 pub struct sctp_extrcvinfo {
1168 pub sinfo_stream: u16,
1169 pub sinfo_ssn: u16,
1170 pub sinfo_flags: u16,
1171 pub sinfo_ppid: u32,
1172 pub sinfo_context: u32,
1173 pub sinfo_timetolive: u32,
1174 pub sinfo_tsn: u32,
1175 pub sinfo_cumtsn: u32,
1176 pub sinfo_assoc_id: crate::sctp_assoc_t,
1177 pub serinfo_next_flags: u16,
1178 pub serinfo_next_stream: u16,
1179 pub serinfo_next_aid: u32,
1180 pub serinfo_next_length: u32,
1181 pub serinfo_next_ppid: u32,
1182 pub sinfo_keynumber: u16,
1183 pub sinfo_keynumber_valid: u16,
1184 pub __reserve_pad: [[u8; 19]; 4],
1185 }
1186
1187 pub struct sctp_sndinfo {
1188 pub snd_sid: u16,
1189 pub snd_flags: u16,
1190 pub snd_ppid: u32,
1191 pub snd_context: u32,
1192 pub snd_assoc_id: crate::sctp_assoc_t,
1193 }
1194
1195 pub struct sctp_prinfo {
1196 pub pr_policy: u16,
1197 pub pr_value: u32,
1198 }
1199
1200 pub struct sctp_default_prinfo {
1201 pub pr_policy: u16,
1202 pub pr_value: u32,
1203 pub pr_assoc_id: crate::sctp_assoc_t,
1204 }
1205
1206 pub struct sctp_authinfo {
1207 pub auth_keynumber: u16,
1208 }
1209
1210 pub struct sctp_rcvinfo {
1211 pub rcv_sid: u16,
1212 pub rcv_ssn: u16,
1213 pub rcv_flags: u16,
1214 pub rcv_ppid: u32,
1215 pub rcv_tsn: u32,
1216 pub rcv_cumtsn: u32,
1217 pub rcv_context: u32,
1218 pub rcv_assoc_id: crate::sctp_assoc_t,
1219 }
1220
1221 pub struct sctp_nxtinfo {
1222 pub nxt_sid: u16,
1223 pub nxt_flags: u16,
1224 pub nxt_ppid: u32,
1225 pub nxt_length: u32,
1226 pub nxt_assoc_id: crate::sctp_assoc_t,
1227 }
1228
1229 pub struct sctp_recvv_rn {
1230 pub recvv_rcvinfo: sctp_rcvinfo,
1231 pub recvv_nxtinfo: sctp_nxtinfo,
1232 }
1233
1234 pub struct sctp_sendv_spa {
1235 pub sendv_flags: u32,
1236 pub sendv_sndinfo: sctp_sndinfo,
1237 pub sendv_prinfo: sctp_prinfo,
1238 pub sendv_authinfo: sctp_authinfo,
1239 }
1240
1241 pub struct sctp_snd_all_completes {
1242 pub sall_stream: u16,
1243 pub sall_flags: u16,
1244 pub sall_ppid: u32,
1245 pub sall_context: u32,
1246 pub sall_num_sent: u32,
1247 pub sall_num_failed: u32,
1248 }
1249
1250 pub struct sctp_pcbinfo {
1251 pub ep_count: u32,
1252 pub asoc_count: u32,
1253 pub laddr_count: u32,
1254 pub raddr_count: u32,
1255 pub chk_count: u32,
1256 pub readq_count: u32,
1257 pub free_chunks: u32,
1258 pub stream_oque: u32,
1259 }
1260
1261 pub struct sctp_sockstat {
1262 pub ss_assoc_id: crate::sctp_assoc_t,
1263 pub ss_total_sndbuf: u32,
1264 pub ss_total_recv_buf: u32,
1265 }
1266
1267 pub struct sctp_assoc_change {
1268 pub sac_type: u16,
1269 pub sac_flags: u16,
1270 pub sac_length: u32,
1271 pub sac_state: u16,
1272 pub sac_error: u16,
1273 pub sac_outbound_streams: u16,
1274 pub sac_inbound_streams: u16,
1275 pub sac_assoc_id: crate::sctp_assoc_t,
1276 pub sac_info: [u8; 0],
1277 }
1278
1279 pub struct sctp_paddr_change {
1280 pub spc_type: u16,
1281 pub spc_flags: u16,
1282 pub spc_length: u32,
1283 pub spc_aaddr: crate::sockaddr_storage,
1284 pub spc_state: u32,
1285 pub spc_error: u32,
1286 pub spc_assoc_id: crate::sctp_assoc_t,
1287 }
1288
1289 pub struct sctp_remote_error {
1290 pub sre_type: u16,
1291 pub sre_flags: u16,
1292 pub sre_length: u32,
1293 pub sre_error: u16,
1294 pub sre_assoc_id: crate::sctp_assoc_t,
1295 pub sre_data: [u8; 0],
1296 }
1297
1298 pub struct sctp_send_failed_event {
1299 pub ssfe_type: u16,
1300 pub ssfe_flags: u16,
1301 pub ssfe_length: u32,
1302 pub ssfe_error: u32,
1303 pub ssfe_info: sctp_sndinfo,
1304 pub ssfe_assoc_id: crate::sctp_assoc_t,
1305 pub ssfe_data: [u8; 0],
1306 }
1307
1308 pub struct sctp_shutdown_event {
1309 pub sse_type: u16,
1310 pub sse_flags: u16,
1311 pub sse_length: u32,
1312 pub sse_assoc_id: crate::sctp_assoc_t,
1313 }
1314
1315 pub struct sctp_adaptation_event {
1316 pub sai_type: u16,
1317 pub sai_flags: u16,
1318 pub sai_length: u32,
1319 pub sai_adaptation_ind: u32,
1320 pub sai_assoc_id: crate::sctp_assoc_t,
1321 }
1322
1323 pub struct sctp_setadaptation {
1324 pub ssb_adaptation_ind: u32,
1325 }
1326
1327 pub struct sctp_pdapi_event {
1328 pub pdapi_type: u16,
1329 pub pdapi_flags: u16,
1330 pub pdapi_length: u32,
1331 pub pdapi_indication: u32,
1332 pub pdapi_stream: u16,
1333 pub pdapi_seq: u16,
1334 pub pdapi_assoc_id: crate::sctp_assoc_t,
1335 }
1336
1337 pub struct sctp_sender_dry_event {
1338 pub sender_dry_type: u16,
1339 pub sender_dry_flags: u16,
1340 pub sender_dry_length: u32,
1341 pub sender_dry_assoc_id: crate::sctp_assoc_t,
1342 }
1343
1344 pub struct sctp_stream_reset_event {
1345 pub strreset_type: u16,
1346 pub strreset_flags: u16,
1347 pub strreset_length: u32,
1348 pub strreset_assoc_id: crate::sctp_assoc_t,
1349 pub strreset_stream_list: [u16; 0],
1350 }
1351
1352 pub struct sctp_stream_change_event {
1353 pub strchange_type: u16,
1354 pub strchange_flags: u16,
1355 pub strchange_length: u32,
1356 pub strchange_assoc_id: crate::sctp_assoc_t,
1357 pub strchange_instrms: u16,
1358 pub strchange_outstrms: u16,
1359 }
1360 }
1361
1362 s_no_extra_traits! {
1363 pub struct utmpx {
1364 pub ut_type: c_short,
1365 pub ut_tv: crate::timeval,
1366 pub ut_id: [c_char; 8],
1367 pub ut_pid: crate::pid_t,
1368 pub ut_user: [c_char; 32],
1369 pub ut_line: [c_char; 16],
1370 pub ut_host: [c_char; 128],
1371 pub __ut_spare: [c_char; 64],
1372 }
1373
1374 pub union __c_anonymous_cr_pid {
1375 __cr_unused: *mut c_void,
1376 pub cr_pid: crate::pid_t,
1377 }
1378
1379 pub struct xucred {
1380 pub cr_version: c_uint,
1381 pub cr_uid: crate::uid_t,
1382 pub cr_ngroups: c_short,
1383 pub cr_groups: [crate::gid_t; 16],
1384 pub cr_pid__c_anonymous_union: __c_anonymous_cr_pid,
1385 }
1386
1387 pub struct sockaddr_dl {
1388 pub sdl_len: c_uchar,
1389 pub sdl_family: c_uchar,
1390 pub sdl_index: c_ushort,
1391 pub sdl_type: c_uchar,
1392 pub sdl_nlen: c_uchar,
1393 pub sdl_alen: c_uchar,
1394 pub sdl_slen: c_uchar,
1395 pub sdl_data: [c_char; 46],
1396 }
1397
1398 pub struct mq_attr {
1399 pub mq_flags: c_long,
1400 pub mq_maxmsg: c_long,
1401 pub mq_msgsize: c_long,
1402 pub mq_curmsgs: c_long,
1403 __reserved: [c_long; 4],
1404 }
1405
1406 pub struct sigevent {
1407 pub sigev_notify: c_int,
1408 pub sigev_signo: c_int,
1409 pub sigev_value: crate::sigval,
1410 //The rest of the structure is actually a union. We expose only
1411 //sigev_notify_thread_id because it's the most useful union member.
1412 pub sigev_notify_thread_id: crate::lwpid_t,
1413 #[cfg(target_pointer_width = "64")]
1414 __unused1: c_int,
1415 __unused2: [c_long; 7],
1416 }
1417
1418 pub struct ptsstat {
1419 #[cfg(any(freebsd12, freebsd13, freebsd14, freebsd15))]
1420 pub dev: u64,
1421 #[cfg(not(any(freebsd12, freebsd13, freebsd14, freebsd15)))]
1422 pub dev: u32,
1423 pub devname: [c_char; SPECNAMELEN as usize + 1],
1424 }
1425
1426 pub union __c_anonymous_elf32_auxv_union {
1427 pub a_val: c_int,
1428 }
1429
1430 pub struct Elf32_Auxinfo {
1431 pub a_type: c_int,
1432 pub a_un: __c_anonymous_elf32_auxv_union,
1433 }
1434
1435 pub union __c_anonymous_ifi_epoch {
1436 pub tt: crate::time_t,
1437 pub ph: u64,
1438 }
1439
1440 pub union __c_anonymous_ifi_lastchange {
1441 pub tv: crate::timeval,
1442 pub ph: __c_anonymous_ph,
1443 }
1444
1445 pub struct if_data {
1446 /// ethernet, tokenring, etc
1447 pub ifi_type: u8,
1448 /// e.g., AUI, Thinnet, 10base-T, etc
1449 pub ifi_physical: u8,
1450 /// media address length
1451 pub ifi_addrlen: u8,
1452 /// media header length
1453 pub ifi_hdrlen: u8,
1454 /// current link state
1455 pub ifi_link_state: u8,
1456 /// carp vhid
1457 pub ifi_vhid: u8,
1458 /// length of this data struct
1459 pub ifi_datalen: u16,
1460 /// maximum transmission unit
1461 pub ifi_mtu: u32,
1462 /// routing metric (external only)
1463 pub ifi_metric: u32,
1464 /// linespeed
1465 pub ifi_baudrate: u64,
1466 /// packets received on interface
1467 pub ifi_ipackets: u64,
1468 /// input errors on interface
1469 pub ifi_ierrors: u64,
1470 /// packets sent on interface
1471 pub ifi_opackets: u64,
1472 /// output errors on interface
1473 pub ifi_oerrors: u64,
1474 /// collisions on csma interfaces
1475 pub ifi_collisions: u64,
1476 /// total number of octets received
1477 pub ifi_ibytes: u64,
1478 /// total number of octets sent
1479 pub ifi_obytes: u64,
1480 /// packets received via multicast
1481 pub ifi_imcasts: u64,
1482 /// packets sent via multicast
1483 pub ifi_omcasts: u64,
1484 /// dropped on input
1485 pub ifi_iqdrops: u64,
1486 /// dropped on output
1487 pub ifi_oqdrops: u64,
1488 /// destined for unsupported protocol
1489 pub ifi_noproto: u64,
1490 /// HW offload capabilities, see IFCAP
1491 pub ifi_hwassist: u64,
1492 /// uptime at attach or stat reset
1493 pub __ifi_epoch: __c_anonymous_ifi_epoch,
1494 /// time of last administrative change
1495 pub __ifi_lastchange: __c_anonymous_ifi_lastchange,
1496 }
1497
1498 pub union __c_anonymous_ifr_ifru {
1499 pub ifru_addr: crate::sockaddr,
1500 pub ifru_dstaddr: crate::sockaddr,
1501 pub ifru_broadaddr: crate::sockaddr,
1502 pub ifru_buffer: ifreq_buffer,
1503 pub ifru_flags: [c_short; 2],
1504 pub ifru_index: c_short,
1505 pub ifru_jid: c_int,
1506 pub ifru_metric: c_int,
1507 pub ifru_mtu: c_int,
1508 pub ifru_phys: c_int,
1509 pub ifru_media: c_int,
1510 pub ifru_data: crate::caddr_t,
1511 pub ifru_cap: [c_int; 2],
1512 pub ifru_fib: c_uint,
1513 pub ifru_vlan_pcp: c_uchar,
1514 }
1515
1516 pub struct ifreq {
1517 /// if name, e.g. "en0"
1518 pub ifr_name: [c_char; crate::IFNAMSIZ],
1519 pub ifr_ifru: __c_anonymous_ifr_ifru,
1520 }
1521
1522 pub union __c_anonymous_ifc_ifcu {
1523 pub ifcu_buf: crate::caddr_t,
1524 pub ifcu_req: *mut ifreq,
1525 }
1526
1527 pub struct ifstat {
1528 /// if name, e.g. "en0"
1529 pub ifs_name: [c_char; crate::IFNAMSIZ as usize],
1530 pub ascii: [c_char; crate::IFSTATMAX as usize + 1],
1531 }
1532
1533 pub struct ifrsskey {
1534 /// if name, e.g. "en0"
1535 pub ifrk_name: [c_char; crate::IFNAMSIZ as usize],
1536 /// RSS_FUNC_
1537 pub ifrk_func: u8,
1538 pub ifrk_spare0: u8,
1539 pub ifrk_keylen: u16,
1540 pub ifrk_key: [u8; crate::RSS_KEYLEN as usize],
1541 }
1542
1543 pub struct ifdownreason {
1544 pub ifdr_name: [c_char; crate::IFNAMSIZ as usize],
1545 pub ifdr_reason: u32,
1546 pub ifdr_vendor: u32,
1547 pub ifdr_msg: [c_char; crate::IFDR_MSG_SIZE as usize],
1548 }
1549
1550 #[repr(packed)]
1551 pub struct sctphdr {
1552 pub src_port: u16,
1553 pub dest_port: u16,
1554 pub v_tag: u32,
1555 pub checksum: u32,
1556 }
1557
1558 #[repr(packed)]
1559 pub struct sctp_chunkhdr {
1560 pub chunk_type: u8,
1561 pub chunk_flags: u8,
1562 pub chunk_length: u16,
1563 }
1564
1565 #[repr(packed)]
1566 pub struct sctp_paramhdr {
1567 pub param_type: u16,
1568 pub param_length: u16,
1569 }
1570
1571 #[repr(packed)]
1572 pub struct sctp_gen_error_cause {
1573 pub code: u16,
1574 pub length: u16,
1575 pub info: [u8; 0],
1576 }
1577
1578 #[repr(packed)]
1579 pub struct sctp_error_cause {
1580 pub code: u16,
1581 pub length: u16,
1582 }
1583
1584 #[repr(packed)]
1585 pub struct sctp_error_invalid_stream {
1586 pub cause: sctp_error_cause,
1587 pub stream_id: u16,
1588 __reserved: u16,
1589 }
1590
1591 #[repr(packed)]
1592 pub struct sctp_error_missing_param {
1593 pub cause: sctp_error_cause,
1594 pub num_missing_params: u32,
1595 pub tpe: [u8; 0],
1596 }
1597
1598 #[repr(packed)]
1599 pub struct sctp_error_stale_cookie {
1600 pub cause: sctp_error_cause,
1601 pub stale_time: u32,
1602 }
1603
1604 #[repr(packed)]
1605 pub struct sctp_error_out_of_resource {
1606 pub cause: sctp_error_cause,
1607 }
1608
1609 #[repr(packed)]
1610 pub struct sctp_error_unresolv_addr {
1611 pub cause: sctp_error_cause,
1612 }
1613
1614 #[repr(packed)]
1615 pub struct sctp_error_unrecognized_chunk {
1616 pub cause: sctp_error_cause,
1617 pub ch: sctp_chunkhdr,
1618 }
1619
1620 #[repr(packed)]
1621 pub struct sctp_error_no_user_data {
1622 pub cause: sctp_error_cause,
1623 pub tsn: u32,
1624 }
1625
1626 #[repr(packed)]
1627 pub struct sctp_error_auth_invalid_hmac {
1628 pub cause: sctp_error_cause,
1629 pub hmac_id: u16,
1630 }
1631
1632 pub struct kinfo_file {
1633 pub kf_structsize: c_int,
1634 pub kf_type: c_int,
1635 pub kf_fd: c_int,
1636 pub kf_ref_count: c_int,
1637 pub kf_flags: c_int,
1638 _kf_pad0: c_int,
1639 pub kf_offset: i64,
1640 _priv: [u8; 304], // FIXME(freebsd): this is really a giant union
1641 pub kf_status: u16,
1642 _kf_pad1: u16,
1643 _kf_ispare0: c_int,
1644 pub kf_cap_rights: crate::cap_rights_t,
1645 _kf_cap_spare: u64,
1646 pub kf_path: [c_char; crate::PATH_MAX as usize],
1647 }
1648
1649 pub struct ucontext_t {
1650 pub uc_sigmask: crate::sigset_t,
1651 pub uc_mcontext: crate::mcontext_t,
1652 pub uc_link: *mut crate::ucontext_t,
1653 pub uc_stack: crate::stack_t,
1654 pub uc_flags: c_int,
1655 __spare__: [c_int; 4],
1656 }
1657 }
1658
1659 cfg_if! {
1660 if #[cfg(feature = "extra_traits")] {
1661 impl PartialEq for utmpx {
1662 fn eq(&self, other: &utmpx) -> bool {
1663 self.ut_type == other.ut_type
1664 && self.ut_tv == other.ut_tv
1665 && self.ut_id == other.ut_id
1666 && self.ut_pid == other.ut_pid
1667 && self.ut_user == other.ut_user
1668 && self.ut_line == other.ut_line
1669 && self
1670 .ut_host
1671 .iter()
1672 .zip(other.ut_host.iter())
1673 .all(|(a, b)| a == b)
1674 && self
1675 .__ut_spare
1676 .iter()
1677 .zip(other.__ut_spare.iter())
1678 .all(|(a, b)| a == b)
1679 }
1680 }
1681 impl Eq for utmpx {}
1682 impl fmt::Debug for utmpx {
1683 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1684 f.debug_struct("utmpx")
1685 .field("ut_type", &self.ut_type)
1686 .field("ut_tv", &self.ut_tv)
1687 .field("ut_id", &self.ut_id)
1688 .field("ut_pid", &self.ut_pid)
1689 .field("ut_user", &self.ut_user)
1690 .field("ut_line", &self.ut_line)
1691 // FIXME(debug): .field("ut_host", &self.ut_host)
1692 // FIXME(debug): .field("__ut_spare", &self.__ut_spare)
1693 .finish()
1694 }
1695 }
1696 impl hash::Hash for utmpx {
1697 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1698 self.ut_type.hash(state);
1699 self.ut_tv.hash(state);
1700 self.ut_id.hash(state);
1701 self.ut_pid.hash(state);
1702 self.ut_user.hash(state);
1703 self.ut_line.hash(state);
1704 self.ut_host.hash(state);
1705 self.__ut_spare.hash(state);
1706 }
1707 }
1708
1709 impl PartialEq for __c_anonymous_cr_pid {
1710 fn eq(&self, other: &__c_anonymous_cr_pid) -> bool {
1711 unsafe { self.cr_pid == other.cr_pid }
1712 }
1713 }
1714 impl Eq for __c_anonymous_cr_pid {}
1715 impl hash::Hash for __c_anonymous_cr_pid {
1716 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1717 unsafe { self.cr_pid.hash(state) };
1718 }
1719 }
1720
1721 impl PartialEq for xucred {
1722 fn eq(&self, other: &xucred) -> bool {
1723 self.cr_version == other.cr_version
1724 && self.cr_uid == other.cr_uid
1725 && self.cr_ngroups == other.cr_ngroups
1726 && self.cr_groups == other.cr_groups
1727 && self.cr_pid__c_anonymous_union == other.cr_pid__c_anonymous_union
1728 }
1729 }
1730 impl Eq for xucred {}
1731 impl fmt::Debug for xucred {
1732 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1733 f.debug_struct("xucred")
1734 .field("cr_version", &self.cr_version)
1735 .field("cr_uid", &self.cr_uid)
1736 .field("cr_ngroups", &self.cr_ngroups)
1737 .field("cr_groups", &self.cr_groups)
1738 .field("cr_pid__c_anonymous_union", &self.cr_pid__c_anonymous_union)
1739 .finish()
1740 }
1741 }
1742 impl hash::Hash for xucred {
1743 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1744 self.cr_version.hash(state);
1745 self.cr_uid.hash(state);
1746 self.cr_ngroups.hash(state);
1747 self.cr_groups.hash(state);
1748 self.cr_pid__c_anonymous_union.hash(state);
1749 }
1750 }
1751
1752 impl PartialEq for sockaddr_dl {
1753 fn eq(&self, other: &sockaddr_dl) -> bool {
1754 self.sdl_len == other.sdl_len
1755 && self.sdl_family == other.sdl_family
1756 && self.sdl_index == other.sdl_index
1757 && self.sdl_type == other.sdl_type
1758 && self.sdl_nlen == other.sdl_nlen
1759 && self.sdl_alen == other.sdl_alen
1760 && self.sdl_slen == other.sdl_slen
1761 && self
1762 .sdl_data
1763 .iter()
1764 .zip(other.sdl_data.iter())
1765 .all(|(a, b)| a == b)
1766 }
1767 }
1768 impl Eq for sockaddr_dl {}
1769 impl fmt::Debug for sockaddr_dl {
1770 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1771 f.debug_struct("sockaddr_dl")
1772 .field("sdl_len", &self.sdl_len)
1773 .field("sdl_family", &self.sdl_family)
1774 .field("sdl_index", &self.sdl_index)
1775 .field("sdl_type", &self.sdl_type)
1776 .field("sdl_nlen", &self.sdl_nlen)
1777 .field("sdl_alen", &self.sdl_alen)
1778 .field("sdl_slen", &self.sdl_slen)
1779 // FIXME(debug): .field("sdl_data", &self.sdl_data)
1780 .finish()
1781 }
1782 }
1783 impl hash::Hash for sockaddr_dl {
1784 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1785 self.sdl_len.hash(state);
1786 self.sdl_family.hash(state);
1787 self.sdl_index.hash(state);
1788 self.sdl_type.hash(state);
1789 self.sdl_nlen.hash(state);
1790 self.sdl_alen.hash(state);
1791 self.sdl_slen.hash(state);
1792 self.sdl_data.hash(state);
1793 }
1794 }
1795
1796 impl PartialEq for mq_attr {
1797 fn eq(&self, other: &mq_attr) -> bool {
1798 self.mq_flags == other.mq_flags
1799 && self.mq_maxmsg == other.mq_maxmsg
1800 && self.mq_msgsize == other.mq_msgsize
1801 && self.mq_curmsgs == other.mq_curmsgs
1802 }
1803 }
1804 impl Eq for mq_attr {}
1805 impl fmt::Debug for mq_attr {
1806 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1807 f.debug_struct("mq_attr")
1808 .field("mq_flags", &self.mq_flags)
1809 .field("mq_maxmsg", &self.mq_maxmsg)
1810 .field("mq_msgsize", &self.mq_msgsize)
1811 .field("mq_curmsgs", &self.mq_curmsgs)
1812 .finish()
1813 }
1814 }
1815 impl hash::Hash for mq_attr {
1816 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1817 self.mq_flags.hash(state);
1818 self.mq_maxmsg.hash(state);
1819 self.mq_msgsize.hash(state);
1820 self.mq_curmsgs.hash(state);
1821 }
1822 }
1823
1824 impl PartialEq for sigevent {
1825 fn eq(&self, other: &sigevent) -> bool {
1826 self.sigev_notify == other.sigev_notify
1827 && self.sigev_signo == other.sigev_signo
1828 && self.sigev_value == other.sigev_value
1829 && self.sigev_notify_thread_id == other.sigev_notify_thread_id
1830 }
1831 }
1832 impl Eq for sigevent {}
1833 impl fmt::Debug for sigevent {
1834 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1835 f.debug_struct("sigevent")
1836 .field("sigev_notify", &self.sigev_notify)
1837 .field("sigev_signo", &self.sigev_signo)
1838 .field("sigev_value", &self.sigev_value)
1839 .field("sigev_notify_thread_id", &self.sigev_notify_thread_id)
1840 .finish()
1841 }
1842 }
1843 impl hash::Hash for sigevent {
1844 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1845 self.sigev_notify.hash(state);
1846 self.sigev_signo.hash(state);
1847 self.sigev_value.hash(state);
1848 self.sigev_notify_thread_id.hash(state);
1849 }
1850 }
1851
1852 impl PartialEq for ptsstat {
1853 fn eq(&self, other: &ptsstat) -> bool {
1854 let self_devname: &[c_char] = &self.devname;
1855 let other_devname: &[c_char] = &other.devname;
1856
1857 self.dev == other.dev && self_devname == other_devname
1858 }
1859 }
1860 impl Eq for ptsstat {}
1861 impl fmt::Debug for ptsstat {
1862 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1863 let self_devname: &[c_char] = &self.devname;
1864
1865 f.debug_struct("ptsstat")
1866 .field("dev", &self.dev)
1867 .field("devname", &self_devname)
1868 .finish()
1869 }
1870 }
1871 impl hash::Hash for ptsstat {
1872 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1873 let self_devname: &[c_char] = &self.devname;
1874
1875 self.dev.hash(state);
1876 self_devname.hash(state);
1877 }
1878 }
1879
1880 impl PartialEq for __c_anonymous_elf32_auxv_union {
1881 fn eq(&self, other: &__c_anonymous_elf32_auxv_union) -> bool {
1882 unsafe { self.a_val == other.a_val }
1883 }
1884 }
1885 impl Eq for __c_anonymous_elf32_auxv_union {}
1886 impl PartialEq for Elf32_Auxinfo {
1887 fn eq(&self, other: &Elf32_Auxinfo) -> bool {
1888 self.a_type == other.a_type && self.a_un == other.a_un
1889 }
1890 }
1891 impl Eq for Elf32_Auxinfo {}
1892 impl fmt::Debug for Elf32_Auxinfo {
1893 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1894 f.debug_struct("Elf32_Auxinfo")
1895 .field("a_type", &self.a_type)
1896 .field("a_un", &self.a_un)
1897 .finish()
1898 }
1899 }
1900
1901 impl PartialEq for __c_anonymous_ifr_ifru {
1902 fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool {
1903 unsafe {
1904 self.ifru_addr == other.ifru_addr
1905 && self.ifru_dstaddr == other.ifru_dstaddr
1906 && self.ifru_broadaddr == other.ifru_broadaddr
1907 && self.ifru_buffer == other.ifru_buffer
1908 && self.ifru_flags == other.ifru_flags
1909 && self.ifru_index == other.ifru_index
1910 && self.ifru_jid == other.ifru_jid
1911 && self.ifru_metric == other.ifru_metric
1912 && self.ifru_mtu == other.ifru_mtu
1913 && self.ifru_phys == other.ifru_phys
1914 && self.ifru_media == other.ifru_media
1915 && self.ifru_data == other.ifru_data
1916 && self.ifru_cap == other.ifru_cap
1917 && self.ifru_fib == other.ifru_fib
1918 && self.ifru_vlan_pcp == other.ifru_vlan_pcp
1919 }
1920 }
1921 }
1922 impl Eq for __c_anonymous_ifr_ifru {}
1923 impl hash::Hash for __c_anonymous_ifr_ifru {
1924 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1925 unsafe { self.ifru_addr.hash(state) };
1926 unsafe { self.ifru_dstaddr.hash(state) };
1927 unsafe { self.ifru_broadaddr.hash(state) };
1928 unsafe { self.ifru_buffer.hash(state) };
1929 unsafe { self.ifru_flags.hash(state) };
1930 unsafe { self.ifru_index.hash(state) };
1931 unsafe { self.ifru_jid.hash(state) };
1932 unsafe { self.ifru_metric.hash(state) };
1933 unsafe { self.ifru_mtu.hash(state) };
1934 unsafe { self.ifru_phys.hash(state) };
1935 unsafe { self.ifru_media.hash(state) };
1936 unsafe { self.ifru_data.hash(state) };
1937 unsafe { self.ifru_cap.hash(state) };
1938 unsafe { self.ifru_fib.hash(state) };
1939 unsafe { self.ifru_vlan_pcp.hash(state) };
1940 }
1941 }
1942
1943 impl PartialEq for ifreq {
1944 fn eq(&self, other: &ifreq) -> bool {
1945 self.ifr_name == other.ifr_name && self.ifr_ifru == other.ifr_ifru
1946 }
1947 }
1948 impl Eq for ifreq {}
1949 impl fmt::Debug for ifreq {
1950 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1951 f.debug_struct("ifreq")
1952 .field("ifr_name", &self.ifr_name)
1953 .field("ifr_ifru", &self.ifr_ifru)
1954 .finish()
1955 }
1956 }
1957 impl hash::Hash for ifreq {
1958 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1959 self.ifr_name.hash(state);
1960 self.ifr_ifru.hash(state);
1961 }
1962 }
1963
1964 impl Eq for __c_anonymous_ifc_ifcu {}
1965
1966 impl PartialEq for __c_anonymous_ifc_ifcu {
1967 fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool {
1968 unsafe { self.ifcu_buf == other.ifcu_buf && self.ifcu_req == other.ifcu_req }
1969 }
1970 }
1971
1972 impl hash::Hash for __c_anonymous_ifc_ifcu {
1973 fn hash<H: hash::Hasher>(&self, state: &mut H) {
1974 unsafe { self.ifcu_buf.hash(state) };
1975 unsafe { self.ifcu_req.hash(state) };
1976 }
1977 }
1978
1979 impl PartialEq for ifstat {
1980 fn eq(&self, other: &ifstat) -> bool {
1981 let self_ascii: &[c_char] = &self.ascii;
1982 let other_ascii: &[c_char] = &other.ascii;
1983
1984 self.ifs_name == other.ifs_name && self_ascii == other_ascii
1985 }
1986 }
1987 impl Eq for ifstat {}
1988 impl fmt::Debug for ifstat {
1989 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1990 let ascii: &[c_char] = &self.ascii;
1991
1992 f.debug_struct("ifstat")
1993 .field("ifs_name", &self.ifs_name)
1994 .field("ascii", &ascii)
1995 .finish()
1996 }
1997 }
1998 impl hash::Hash for ifstat {
1999 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2000 self.ifs_name.hash(state);
2001 self.ascii.hash(state);
2002 }
2003 }
2004
2005 impl PartialEq for ifrsskey {
2006 fn eq(&self, other: &ifrsskey) -> bool {
2007 let self_ifrk_key: &[u8] = &self.ifrk_key;
2008 let other_ifrk_key: &[u8] = &other.ifrk_key;
2009
2010 self.ifrk_name == other.ifrk_name
2011 && self.ifrk_func == other.ifrk_func
2012 && self.ifrk_spare0 == other.ifrk_spare0
2013 && self.ifrk_keylen == other.ifrk_keylen
2014 && self_ifrk_key == other_ifrk_key
2015 }
2016 }
2017 impl Eq for ifrsskey {}
2018 impl fmt::Debug for ifrsskey {
2019 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2020 let ifrk_key: &[u8] = &self.ifrk_key;
2021
2022 f.debug_struct("ifrsskey")
2023 .field("ifrk_name", &self.ifrk_name)
2024 .field("ifrk_func", &self.ifrk_func)
2025 .field("ifrk_spare0", &self.ifrk_spare0)
2026 .field("ifrk_keylen", &self.ifrk_keylen)
2027 .field("ifrk_key", &ifrk_key)
2028 .finish()
2029 }
2030 }
2031 impl hash::Hash for ifrsskey {
2032 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2033 self.ifrk_name.hash(state);
2034 self.ifrk_func.hash(state);
2035 self.ifrk_spare0.hash(state);
2036 self.ifrk_keylen.hash(state);
2037 self.ifrk_key.hash(state);
2038 }
2039 }
2040
2041 impl PartialEq for ifdownreason {
2042 fn eq(&self, other: &ifdownreason) -> bool {
2043 let self_ifdr_msg: &[c_char] = &self.ifdr_msg;
2044 let other_ifdr_msg: &[c_char] = &other.ifdr_msg;
2045
2046 self.ifdr_name == other.ifdr_name
2047 && self.ifdr_reason == other.ifdr_reason
2048 && self.ifdr_vendor == other.ifdr_vendor
2049 && self_ifdr_msg == other_ifdr_msg
2050 }
2051 }
2052 impl Eq for ifdownreason {}
2053 impl fmt::Debug for ifdownreason {
2054 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2055 let ifdr_msg: &[c_char] = &self.ifdr_msg;
2056
2057 f.debug_struct("ifdownreason")
2058 .field("ifdr_name", &self.ifdr_name)
2059 .field("ifdr_reason", &self.ifdr_reason)
2060 .field("ifdr_vendor", &self.ifdr_vendor)
2061 .field("ifdr_msg", &ifdr_msg)
2062 .finish()
2063 }
2064 }
2065 impl hash::Hash for ifdownreason {
2066 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2067 self.ifdr_name.hash(state);
2068 self.ifdr_reason.hash(state);
2069 self.ifdr_vendor.hash(state);
2070 self.ifdr_msg.hash(state);
2071 }
2072 }
2073
2074 impl PartialEq for __c_anonymous_ifi_epoch {
2075 fn eq(&self, other: &__c_anonymous_ifi_epoch) -> bool {
2076 unsafe { self.tt == other.tt && self.ph == other.ph }
2077 }
2078 }
2079 impl Eq for __c_anonymous_ifi_epoch {}
2080 impl hash::Hash for __c_anonymous_ifi_epoch {
2081 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2082 unsafe {
2083 self.tt.hash(state);
2084 self.ph.hash(state);
2085 }
2086 }
2087 }
2088
2089 impl PartialEq for __c_anonymous_ifi_lastchange {
2090 fn eq(&self, other: &__c_anonymous_ifi_lastchange) -> bool {
2091 unsafe { self.tv == other.tv && self.ph == other.ph }
2092 }
2093 }
2094 impl Eq for __c_anonymous_ifi_lastchange {}
2095 impl hash::Hash for __c_anonymous_ifi_lastchange {
2096 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2097 unsafe {
2098 self.tv.hash(state);
2099 self.ph.hash(state);
2100 }
2101 }
2102 }
2103
2104 impl PartialEq for if_data {
2105 fn eq(&self, other: &if_data) -> bool {
2106 self.ifi_type == other.ifi_type
2107 && self.ifi_physical == other.ifi_physical
2108 && self.ifi_addrlen == other.ifi_addrlen
2109 && self.ifi_hdrlen == other.ifi_hdrlen
2110 && self.ifi_link_state == other.ifi_link_state
2111 && self.ifi_vhid == other.ifi_vhid
2112 && self.ifi_datalen == other.ifi_datalen
2113 && self.ifi_mtu == other.ifi_mtu
2114 && self.ifi_metric == other.ifi_metric
2115 && self.ifi_baudrate == other.ifi_baudrate
2116 && self.ifi_ipackets == other.ifi_ipackets
2117 && self.ifi_ierrors == other.ifi_ierrors
2118 && self.ifi_opackets == other.ifi_opackets
2119 && self.ifi_oerrors == other.ifi_oerrors
2120 && self.ifi_collisions == other.ifi_collisions
2121 && self.ifi_ibytes == other.ifi_ibytes
2122 && self.ifi_obytes == other.ifi_obytes
2123 && self.ifi_imcasts == other.ifi_imcasts
2124 && self.ifi_omcasts == other.ifi_omcasts
2125 && self.ifi_iqdrops == other.ifi_iqdrops
2126 && self.ifi_oqdrops == other.ifi_oqdrops
2127 && self.ifi_noproto == other.ifi_noproto
2128 && self.ifi_hwassist == other.ifi_hwassist
2129 && self.__ifi_epoch == other.__ifi_epoch
2130 && self.__ifi_lastchange == other.__ifi_lastchange
2131 }
2132 }
2133 impl Eq for if_data {}
2134 impl fmt::Debug for if_data {
2135 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2136 f.debug_struct("if_data")
2137 .field("ifi_type", &self.ifi_type)
2138 .field("ifi_physical", &self.ifi_physical)
2139 .field("ifi_addrlen", &self.ifi_addrlen)
2140 .field("ifi_hdrlen", &self.ifi_hdrlen)
2141 .field("ifi_link_state", &self.ifi_link_state)
2142 .field("ifi_vhid", &self.ifi_vhid)
2143 .field("ifi_datalen", &self.ifi_datalen)
2144 .field("ifi_mtu", &self.ifi_mtu)
2145 .field("ifi_metric", &self.ifi_metric)
2146 .field("ifi_baudrate", &self.ifi_baudrate)
2147 .field("ifi_ipackets", &self.ifi_ipackets)
2148 .field("ifi_ierrors", &self.ifi_ierrors)
2149 .field("ifi_opackets", &self.ifi_opackets)
2150 .field("ifi_oerrors", &self.ifi_oerrors)
2151 .field("ifi_collisions", &self.ifi_collisions)
2152 .field("ifi_ibytes", &self.ifi_ibytes)
2153 .field("ifi_obytes", &self.ifi_obytes)
2154 .field("ifi_imcasts", &self.ifi_imcasts)
2155 .field("ifi_omcasts", &self.ifi_omcasts)
2156 .field("ifi_iqdrops", &self.ifi_iqdrops)
2157 .field("ifi_oqdrops", &self.ifi_oqdrops)
2158 .field("ifi_noproto", &self.ifi_noproto)
2159 .field("ifi_hwassist", &self.ifi_hwassist)
2160 .field("__ifi_epoch", &self.__ifi_epoch)
2161 .field("__ifi_lastchange", &self.__ifi_lastchange)
2162 .finish()
2163 }
2164 }
2165 impl hash::Hash for if_data {
2166 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2167 self.ifi_type.hash(state);
2168 self.ifi_physical.hash(state);
2169 self.ifi_addrlen.hash(state);
2170 self.ifi_hdrlen.hash(state);
2171 self.ifi_link_state.hash(state);
2172 self.ifi_vhid.hash(state);
2173 self.ifi_datalen.hash(state);
2174 self.ifi_mtu.hash(state);
2175 self.ifi_metric.hash(state);
2176 self.ifi_baudrate.hash(state);
2177 self.ifi_ipackets.hash(state);
2178 self.ifi_ierrors.hash(state);
2179 self.ifi_opackets.hash(state);
2180 self.ifi_oerrors.hash(state);
2181 self.ifi_collisions.hash(state);
2182 self.ifi_ibytes.hash(state);
2183 self.ifi_obytes.hash(state);
2184 self.ifi_imcasts.hash(state);
2185 self.ifi_omcasts.hash(state);
2186 self.ifi_iqdrops.hash(state);
2187 self.ifi_oqdrops.hash(state);
2188 self.ifi_noproto.hash(state);
2189 self.ifi_hwassist.hash(state);
2190 self.__ifi_epoch.hash(state);
2191 self.__ifi_lastchange.hash(state);
2192 }
2193 }
2194
2195 impl PartialEq for sctphdr {
2196 fn eq(&self, other: &sctphdr) -> bool {
2197 return { self.src_port } == { other.src_port }
2198 && { self.dest_port } == { other.dest_port }
2199 && { self.v_tag } == { other.v_tag }
2200 && { self.checksum } == { other.checksum };
2201 }
2202 }
2203 impl Eq for sctphdr {}
2204 impl fmt::Debug for sctphdr {
2205 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2206 f.debug_struct("sctphdr")
2207 .field("src_port", &{ self.src_port })
2208 .field("dest_port", &{ self.dest_port })
2209 .field("v_tag", &{ self.v_tag })
2210 .field("checksum", &{ self.checksum })
2211 .finish()
2212 }
2213 }
2214 impl hash::Hash for sctphdr {
2215 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2216 { self.src_port }.hash(state);
2217 { self.dest_port }.hash(state);
2218 { self.v_tag }.hash(state);
2219 { self.checksum }.hash(state);
2220 }
2221 }
2222
2223 impl PartialEq for sctp_chunkhdr {
2224 fn eq(&self, other: &sctp_chunkhdr) -> bool {
2225 return { self.chunk_type } == { other.chunk_type }
2226 && { self.chunk_flags } == { other.chunk_flags }
2227 && { self.chunk_length } == { other.chunk_length };
2228 }
2229 }
2230 impl Eq for sctp_chunkhdr {}
2231 impl fmt::Debug for sctp_chunkhdr {
2232 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2233 f.debug_struct("sctp_chunkhdr")
2234 .field("chunk_type", &{ self.chunk_type })
2235 .field("chunk_flags", &{ self.chunk_flags })
2236 .field("chunk_length", &{ self.chunk_length })
2237 .finish()
2238 }
2239 }
2240 impl hash::Hash for sctp_chunkhdr {
2241 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2242 { self.chunk_type }.hash(state);
2243 { self.chunk_flags }.hash(state);
2244 { self.chunk_length }.hash(state);
2245 }
2246 }
2247
2248 impl PartialEq for sctp_paramhdr {
2249 fn eq(&self, other: &sctp_paramhdr) -> bool {
2250 return { self.param_type } == { other.param_type } && { self.param_length } == {
2251 other.param_length
2252 };
2253 }
2254 }
2255 impl Eq for sctp_paramhdr {}
2256 impl fmt::Debug for sctp_paramhdr {
2257 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2258 f.debug_struct("sctp_paramhdr")
2259 .field("param_type", &{ self.param_type })
2260 .field("param_length", &{ self.param_length })
2261 .finish()
2262 }
2263 }
2264 impl hash::Hash for sctp_paramhdr {
2265 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2266 { self.param_type }.hash(state);
2267 { self.param_length }.hash(state);
2268 }
2269 }
2270
2271 impl PartialEq for sctp_gen_error_cause {
2272 fn eq(&self, other: &sctp_gen_error_cause) -> bool {
2273 return { self.code } == { other.code } && { self.length } == { other.length } && {
2274 self.info
2275 }
2276 .iter()
2277 .zip({ other.info }.iter())
2278 .all(|(a, b)| a == b);
2279 }
2280 }
2281 impl Eq for sctp_gen_error_cause {}
2282 impl fmt::Debug for sctp_gen_error_cause {
2283 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2284 f.debug_struct("sctp_gen_error_cause")
2285 .field("code", &{ self.code })
2286 .field("length", &{ self.length })
2287 // FIXME(debug): .field("info", &{self.info})
2288 .finish()
2289 }
2290 }
2291 impl hash::Hash for sctp_gen_error_cause {
2292 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2293 { self.code }.hash(state);
2294 { self.length }.hash(state);
2295 { self.info }.hash(state);
2296 }
2297 }
2298
2299 impl PartialEq for sctp_error_cause {
2300 fn eq(&self, other: &sctp_error_cause) -> bool {
2301 return { self.code } == { other.code } && { self.length } == { other.length };
2302 }
2303 }
2304 impl Eq for sctp_error_cause {}
2305 impl fmt::Debug for sctp_error_cause {
2306 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2307 f.debug_struct("sctp_error_cause")
2308 .field("code", &{ self.code })
2309 .field("length", &{ self.length })
2310 .finish()
2311 }
2312 }
2313 impl hash::Hash for sctp_error_cause {
2314 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2315 { self.code }.hash(state);
2316 { self.length }.hash(state);
2317 }
2318 }
2319
2320 impl PartialEq for sctp_error_invalid_stream {
2321 fn eq(&self, other: &sctp_error_invalid_stream) -> bool {
2322 return { self.cause } == { other.cause } && { self.stream_id } == {
2323 other.stream_id
2324 };
2325 }
2326 }
2327 impl Eq for sctp_error_invalid_stream {}
2328 impl fmt::Debug for sctp_error_invalid_stream {
2329 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2330 f.debug_struct("sctp_error_invalid_stream")
2331 .field("cause", &{ self.cause })
2332 .field("stream_id", &{ self.stream_id })
2333 .finish()
2334 }
2335 }
2336 impl hash::Hash for sctp_error_invalid_stream {
2337 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2338 { self.cause }.hash(state);
2339 { self.stream_id }.hash(state);
2340 }
2341 }
2342
2343 impl PartialEq for sctp_error_missing_param {
2344 fn eq(&self, other: &sctp_error_missing_param) -> bool {
2345 return { self.cause } == { other.cause }
2346 && { self.num_missing_params } == { other.num_missing_params }
2347 && { self.tpe }
2348 .iter()
2349 .zip({ other.tpe }.iter())
2350 .all(|(a, b)| a == b);
2351 }
2352 }
2353 impl Eq for sctp_error_missing_param {}
2354 impl fmt::Debug for sctp_error_missing_param {
2355 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2356 f.debug_struct("sctp_error_missing_param")
2357 .field("cause", &{ self.cause })
2358 .field("num_missing_params", &{ self.num_missing_params })
2359 // FIXME(debug): .field("tpe", &{self.tpe})
2360 .finish()
2361 }
2362 }
2363 impl hash::Hash for sctp_error_missing_param {
2364 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2365 { self.cause }.hash(state);
2366 { self.num_missing_params }.hash(state);
2367 { self.tpe }.hash(state);
2368 }
2369 }
2370
2371 impl PartialEq for sctp_error_stale_cookie {
2372 fn eq(&self, other: &sctp_error_stale_cookie) -> bool {
2373 return { self.cause } == { other.cause } && { self.stale_time } == {
2374 other.stale_time
2375 };
2376 }
2377 }
2378 impl Eq for sctp_error_stale_cookie {}
2379 impl fmt::Debug for sctp_error_stale_cookie {
2380 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2381 f.debug_struct("sctp_error_stale_cookie")
2382 .field("cause", &{ self.cause })
2383 .field("stale_time", &{ self.stale_time })
2384 .finish()
2385 }
2386 }
2387 impl hash::Hash for sctp_error_stale_cookie {
2388 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2389 { self.cause }.hash(state);
2390 { self.stale_time }.hash(state);
2391 }
2392 }
2393
2394 impl PartialEq for sctp_error_out_of_resource {
2395 fn eq(&self, other: &sctp_error_out_of_resource) -> bool {
2396 return { self.cause } == { other.cause };
2397 }
2398 }
2399 impl Eq for sctp_error_out_of_resource {}
2400 impl fmt::Debug for sctp_error_out_of_resource {
2401 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2402 f.debug_struct("sctp_error_out_of_resource")
2403 .field("cause", &{ self.cause })
2404 .finish()
2405 }
2406 }
2407 impl hash::Hash for sctp_error_out_of_resource {
2408 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2409 { self.cause }.hash(state);
2410 }
2411 }
2412
2413 impl PartialEq for sctp_error_unresolv_addr {
2414 fn eq(&self, other: &sctp_error_unresolv_addr) -> bool {
2415 return { self.cause } == { other.cause };
2416 }
2417 }
2418 impl Eq for sctp_error_unresolv_addr {}
2419 impl fmt::Debug for sctp_error_unresolv_addr {
2420 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2421 f.debug_struct("sctp_error_unresolv_addr")
2422 .field("cause", &{ self.cause })
2423 .finish()
2424 }
2425 }
2426 impl hash::Hash for sctp_error_unresolv_addr {
2427 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2428 { self.cause }.hash(state);
2429 }
2430 }
2431
2432 impl PartialEq for sctp_error_unrecognized_chunk {
2433 fn eq(&self, other: &sctp_error_unrecognized_chunk) -> bool {
2434 return { self.cause } == { other.cause } && { self.ch } == { other.ch };
2435 }
2436 }
2437 impl Eq for sctp_error_unrecognized_chunk {}
2438 impl fmt::Debug for sctp_error_unrecognized_chunk {
2439 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2440 f.debug_struct("sctp_error_unrecognized_chunk")
2441 .field("cause", &{ self.cause })
2442 .field("ch", &{ self.ch })
2443 .finish()
2444 }
2445 }
2446 impl hash::Hash for sctp_error_unrecognized_chunk {
2447 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2448 { self.cause }.hash(state);
2449 { self.ch }.hash(state);
2450 }
2451 }
2452
2453 impl PartialEq for sctp_error_no_user_data {
2454 fn eq(&self, other: &sctp_error_no_user_data) -> bool {
2455 return { self.cause } == { other.cause } && { self.tsn } == { other.tsn };
2456 }
2457 }
2458 impl Eq for sctp_error_no_user_data {}
2459 impl fmt::Debug for sctp_error_no_user_data {
2460 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2461 f.debug_struct("sctp_error_no_user_data")
2462 .field("cause", &{ self.cause })
2463 .field("tsn", &{ self.tsn })
2464 .finish()
2465 }
2466 }
2467 impl hash::Hash for sctp_error_no_user_data {
2468 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2469 { self.cause }.hash(state);
2470 { self.tsn }.hash(state);
2471 }
2472 }
2473
2474 impl PartialEq for sctp_error_auth_invalid_hmac {
2475 fn eq(&self, other: &sctp_error_auth_invalid_hmac) -> bool {
2476 return { self.cause } == { other.cause } && { self.hmac_id } == { other.hmac_id };
2477 }
2478 }
2479 impl Eq for sctp_error_auth_invalid_hmac {}
2480 impl fmt::Debug for sctp_error_auth_invalid_hmac {
2481 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2482 f.debug_struct("sctp_error_invalid_hmac")
2483 .field("cause", &{ self.cause })
2484 .field("hmac_id", &{ self.hmac_id })
2485 .finish()
2486 }
2487 }
2488 impl hash::Hash for sctp_error_auth_invalid_hmac {
2489 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2490 { self.cause }.hash(state);
2491 { self.hmac_id }.hash(state);
2492 }
2493 }
2494
2495 impl PartialEq for kinfo_file {
2496 fn eq(&self, other: &kinfo_file) -> bool {
2497 self.kf_structsize == other.kf_structsize
2498 && self.kf_type == other.kf_type
2499 && self.kf_fd == other.kf_fd
2500 && self.kf_ref_count == other.kf_ref_count
2501 && self.kf_flags == other.kf_flags
2502 && self.kf_offset == other.kf_offset
2503 && self.kf_status == other.kf_status
2504 && self.kf_cap_rights == other.kf_cap_rights
2505 && self
2506 .kf_path
2507 .iter()
2508 .zip(other.kf_path.iter())
2509 .all(|(a, b)| a == b)
2510 }
2511 }
2512 impl Eq for kinfo_file {}
2513 impl fmt::Debug for kinfo_file {
2514 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2515 f.debug_struct("kinfo_file")
2516 .field("kf_structsize", &self.kf_structsize)
2517 .field("kf_type", &self.kf_type)
2518 .field("kf_fd", &self.kf_fd)
2519 .field("kf_ref_count", &self.kf_ref_count)
2520 .field("kf_flags", &self.kf_flags)
2521 .field("kf_offset", &self.kf_offset)
2522 .field("kf_status", &self.kf_status)
2523 .field("kf_cap_rights", &self.kf_cap_rights)
2524 .field("kf_path", &&self.kf_path[..])
2525 .finish()
2526 }
2527 }
2528 impl hash::Hash for kinfo_file {
2529 fn hash<H: hash::Hasher>(&self, state: &mut H) {
2530 self.kf_structsize.hash(state);
2531 self.kf_type.hash(state);
2532 self.kf_fd.hash(state);
2533 self.kf_ref_count.hash(state);
2534 self.kf_flags.hash(state);
2535 self.kf_offset.hash(state);
2536 self.kf_status.hash(state);
2537 self.kf_cap_rights.hash(state);
2538 self.kf_path.hash(state);
2539 }
2540 }
2541
2542 impl fmt::Debug for ucontext_t {
2543 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2544 f.debug_struct("ucontext_t")
2545 .field("uc_sigmask", &self.uc_sigmask)
2546 .field("uc_mcontext", &self.uc_mcontext)
2547 .field("uc_link", &self.uc_link)
2548 .field("uc_stack", &self.uc_stack)
2549 .field("uc_flags", &self.uc_flags)
2550 .finish()
2551 }
2552 }
2553 }
2554 }
2555
2556 #[cfg_attr(feature = "extra_traits", derive(Debug))]
2557 #[repr(u32)]
2558 pub enum dot3Vendors {
2559 dot3VendorAMD = 1,
2560 dot3VendorIntel = 2,
2561 dot3VendorNational = 4,
2562 dot3VendorFujitsu = 5,
2563 dot3VendorDigital = 6,
2564 dot3VendorWesternDigital = 7,
2565 }
2566 impl Copy for dot3Vendors {}
2567 impl Clone for dot3Vendors {
2568 fn clone(&self) -> dot3Vendors {
2569 *self
2570 }
2571 }
2572
2573 // aio.h
2574 pub const LIO_VECTORED: c_int = 4;
2575 pub const LIO_WRITEV: c_int = 5;
2576 pub const LIO_READV: c_int = 6;
2577
2578 // sys/caprights.h
2579 pub const CAP_RIGHTS_VERSION_00: i32 = 0;
2580 pub const CAP_RIGHTS_VERSION: i32 = CAP_RIGHTS_VERSION_00;
2581
2582 // sys/capsicum.h
2583 macro_rules! cap_right {
2584 ($idx:expr, $bit:expr) => {
2585 ((1u64 << (57 + ($idx))) | ($bit))
2586 };
2587 }
2588 pub const CAP_READ: u64 = cap_right!(0, 0x0000000000000001u64);
2589 pub const CAP_WRITE: u64 = cap_right!(0, 0x0000000000000002u64);
2590 pub const CAP_SEEK_TELL: u64 = cap_right!(0, 0x0000000000000004u64);
2591 pub const CAP_SEEK: u64 = CAP_SEEK_TELL | 0x0000000000000008u64;
2592 pub const CAP_PREAD: u64 = CAP_SEEK | CAP_READ;
2593 pub const CAP_PWRITE: u64 = CAP_SEEK | CAP_WRITE;
2594 pub const CAP_MMAP: u64 = cap_right!(0, 0x0000000000000010u64);
2595 pub const CAP_MMAP_R: u64 = CAP_MMAP | CAP_SEEK | CAP_READ;
2596 pub const CAP_MMAP_W: u64 = CAP_MMAP | CAP_SEEK | CAP_WRITE;
2597 pub const CAP_MMAP_X: u64 = CAP_MMAP | CAP_SEEK | 0x0000000000000020u64;
2598 pub const CAP_MMAP_RW: u64 = CAP_MMAP_R | CAP_MMAP_W;
2599 pub const CAP_MMAP_RX: u64 = CAP_MMAP_R | CAP_MMAP_X;
2600 pub const CAP_MMAP_WX: u64 = CAP_MMAP_W | CAP_MMAP_X;
2601 pub const CAP_MMAP_RWX: u64 = CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X;
2602 pub const CAP_CREATE: u64 = cap_right!(0, 0x0000000000000040u64);
2603 pub const CAP_FEXECVE: u64 = cap_right!(0, 0x0000000000000080u64);
2604 pub const CAP_FSYNC: u64 = cap_right!(0, 0x0000000000000100u64);
2605 pub const CAP_FTRUNCATE: u64 = cap_right!(0, 0x0000000000000200u64);
2606 pub const CAP_LOOKUP: u64 = cap_right!(0, 0x0000000000000400u64);
2607 pub const CAP_FCHDIR: u64 = cap_right!(0, 0x0000000000000800u64);
2608 pub const CAP_FCHFLAGS: u64 = cap_right!(0, 0x0000000000001000u64);
2609 pub const CAP_CHFLAGSAT: u64 = CAP_FCHFLAGS | CAP_LOOKUP;
2610 pub const CAP_FCHMOD: u64 = cap_right!(0, 0x0000000000002000u64);
2611 pub const CAP_FCHMODAT: u64 = CAP_FCHMOD | CAP_LOOKUP;
2612 pub const CAP_FCHOWN: u64 = cap_right!(0, 0x0000000000004000u64);
2613 pub const CAP_FCHOWNAT: u64 = CAP_FCHOWN | CAP_LOOKUP;
2614 pub const CAP_FCNTL: u64 = cap_right!(0, 0x0000000000008000u64);
2615 pub const CAP_FLOCK: u64 = cap_right!(0, 0x0000000000010000u64);
2616 pub const CAP_FPATHCONF: u64 = cap_right!(0, 0x0000000000020000u64);
2617 pub const CAP_FSCK: u64 = cap_right!(0, 0x0000000000040000u64);
2618 pub const CAP_FSTAT: u64 = cap_right!(0, 0x0000000000080000u64);
2619 pub const CAP_FSTATAT: u64 = CAP_FSTAT | CAP_LOOKUP;
2620 pub const CAP_FSTATFS: u64 = cap_right!(0, 0x0000000000100000u64);
2621 pub const CAP_FUTIMES: u64 = cap_right!(0, 0x0000000000200000u64);
2622 pub const CAP_FUTIMESAT: u64 = CAP_FUTIMES | CAP_LOOKUP;
2623 // Note: this was named CAP_LINKAT prior to FreeBSD 11.0.
2624 pub const CAP_LINKAT_TARGET: u64 = CAP_LOOKUP | 0x0000000000400000u64;
2625 pub const CAP_MKDIRAT: u64 = CAP_LOOKUP | 0x0000000000800000u64;
2626 pub const CAP_MKFIFOAT: u64 = CAP_LOOKUP | 0x0000000001000000u64;
2627 pub const CAP_MKNODAT: u64 = CAP_LOOKUP | 0x0000000002000000u64;
2628 // Note: this was named CAP_RENAMEAT prior to FreeBSD 11.0.
2629 pub const CAP_RENAMEAT_SOURCE: u64 = CAP_LOOKUP | 0x0000000004000000u64;
2630 pub const CAP_SYMLINKAT: u64 = CAP_LOOKUP | 0x0000000008000000u64;
2631 pub const CAP_UNLINKAT: u64 = CAP_LOOKUP | 0x0000000010000000u64;
2632 pub const CAP_ACCEPT: u64 = cap_right!(0, 0x0000000020000000u64);
2633 pub const CAP_BIND: u64 = cap_right!(0, 0x0000000040000000u64);
2634 pub const CAP_CONNECT: u64 = cap_right!(0, 0x0000000080000000u64);
2635 pub const CAP_GETPEERNAME: u64 = cap_right!(0, 0x0000000100000000u64);
2636 pub const CAP_GETSOCKNAME: u64 = cap_right!(0, 0x0000000200000000u64);
2637 pub const CAP_GETSOCKOPT: u64 = cap_right!(0, 0x0000000400000000u64);
2638 pub const CAP_LISTEN: u64 = cap_right!(0, 0x0000000800000000u64);
2639 pub const CAP_PEELOFF: u64 = cap_right!(0, 0x0000001000000000u64);
2640 pub const CAP_RECV: u64 = CAP_READ;
2641 pub const CAP_SEND: u64 = CAP_WRITE;
2642 pub const CAP_SETSOCKOPT: u64 = cap_right!(0, 0x0000002000000000u64);
2643 pub const CAP_SHUTDOWN: u64 = cap_right!(0, 0x0000004000000000u64);
2644 pub const CAP_BINDAT: u64 = CAP_LOOKUP | 0x0000008000000000u64;
2645 pub const CAP_CONNECTAT: u64 = CAP_LOOKUP | 0x0000010000000000u64;
2646 pub const CAP_LINKAT_SOURCE: u64 = CAP_LOOKUP | 0x0000020000000000u64;
2647 pub const CAP_RENAMEAT_TARGET: u64 = CAP_LOOKUP | 0x0000040000000000u64;
2648 pub const CAP_SOCK_CLIENT: u64 = CAP_CONNECT
2649 | CAP_GETPEERNAME
2650 | CAP_GETSOCKNAME
2651 | CAP_GETSOCKOPT
2652 | CAP_PEELOFF
2653 | CAP_RECV
2654 | CAP_SEND
2655 | CAP_SETSOCKOPT
2656 | CAP_SHUTDOWN;
2657 pub const CAP_SOCK_SERVER: u64 = CAP_ACCEPT
2658 | CAP_BIND
2659 | CAP_GETPEERNAME
2660 | CAP_GETSOCKNAME
2661 | CAP_GETSOCKOPT
2662 | CAP_LISTEN
2663 | CAP_PEELOFF
2664 | CAP_RECV
2665 | CAP_SEND
2666 | CAP_SETSOCKOPT
2667 | CAP_SHUTDOWN;
2668 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2669 pub const CAP_ALL0: u64 = cap_right!(0, 0x000007FFFFFFFFFFu64);
2670 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2671 pub const CAP_UNUSED0_44: u64 = cap_right!(0, 0x0000080000000000u64);
2672 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2673 pub const CAP_UNUSED0_57: u64 = cap_right!(0, 0x0100000000000000u64);
2674 pub const CAP_MAC_GET: u64 = cap_right!(1, 0x0000000000000001u64);
2675 pub const CAP_MAC_SET: u64 = cap_right!(1, 0x0000000000000002u64);
2676 pub const CAP_SEM_GETVALUE: u64 = cap_right!(1, 0x0000000000000004u64);
2677 pub const CAP_SEM_POST: u64 = cap_right!(1, 0x0000000000000008u64);
2678 pub const CAP_SEM_WAIT: u64 = cap_right!(1, 0x0000000000000010u64);
2679 pub const CAP_EVENT: u64 = cap_right!(1, 0x0000000000000020u64);
2680 pub const CAP_KQUEUE_EVENT: u64 = cap_right!(1, 0x0000000000000040u64);
2681 pub const CAP_IOCTL: u64 = cap_right!(1, 0x0000000000000080u64);
2682 pub const CAP_TTYHOOK: u64 = cap_right!(1, 0x0000000000000100u64);
2683 pub const CAP_PDGETPID: u64 = cap_right!(1, 0x0000000000000200u64);
2684 pub const CAP_PDWAIT: u64 = cap_right!(1, 0x0000000000000400u64);
2685 pub const CAP_PDKILL: u64 = cap_right!(1, 0x0000000000000800u64);
2686 pub const CAP_EXTATTR_DELETE: u64 = cap_right!(1, 0x0000000000001000u64);
2687 pub const CAP_EXTATTR_GET: u64 = cap_right!(1, 0x0000000000002000u64);
2688 pub const CAP_EXTATTR_LIST: u64 = cap_right!(1, 0x0000000000004000u64);
2689 pub const CAP_EXTATTR_SET: u64 = cap_right!(1, 0x0000000000008000u64);
2690 pub const CAP_ACL_CHECK: u64 = cap_right!(1, 0x0000000000010000u64);
2691 pub const CAP_ACL_DELETE: u64 = cap_right!(1, 0x0000000000020000u64);
2692 pub const CAP_ACL_GET: u64 = cap_right!(1, 0x0000000000040000u64);
2693 pub const CAP_ACL_SET: u64 = cap_right!(1, 0x0000000000080000u64);
2694 pub const CAP_KQUEUE_CHANGE: u64 = cap_right!(1, 0x0000000000100000u64);
2695 pub const CAP_KQUEUE: u64 = CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE;
2696 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2697 pub const CAP_ALL1: u64 = cap_right!(1, 0x00000000001FFFFFu64);
2698 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2699 pub const CAP_UNUSED1_22: u64 = cap_right!(1, 0x0000000000200000u64);
2700 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2701 pub const CAP_UNUSED1_57: u64 = cap_right!(1, 0x0100000000000000u64);
2702 pub const CAP_FCNTL_GETFL: u32 = 1 << 3;
2703 pub const CAP_FCNTL_SETFL: u32 = 1 << 4;
2704 pub const CAP_FCNTL_GETOWN: u32 = 1 << 5;
2705 pub const CAP_FCNTL_SETOWN: u32 = 1 << 6;
2706
2707 // sys/devicestat.h
2708 pub const DEVSTAT_N_TRANS_FLAGS: c_int = 4;
2709 pub const DEVSTAT_NAME_LEN: c_int = 16;
2710
2711 // sys/cpuset.h
2712 cfg_if! {
2713 if #[cfg(any(freebsd15, freebsd14))] {
2714 pub const CPU_SETSIZE: c_int = 1024;
2715 } else {
2716 pub const CPU_SETSIZE: c_int = 256;
2717 }
2718 }
2719
2720 pub const SIGEV_THREAD_ID: c_int = 4;
2721
2722 pub const EXTATTR_NAMESPACE_EMPTY: c_int = 0;
2723 pub const EXTATTR_NAMESPACE_USER: c_int = 1;
2724 pub const EXTATTR_NAMESPACE_SYSTEM: c_int = 2;
2725
2726 pub const PTHREAD_STACK_MIN: size_t = MINSIGSTKSZ;
2727 pub const PTHREAD_MUTEX_ADAPTIVE_NP: c_int = 4;
2728 pub const PTHREAD_MUTEX_STALLED: c_int = 0;
2729 pub const PTHREAD_MUTEX_ROBUST: c_int = 1;
2730 pub const SIGSTKSZ: size_t = MINSIGSTKSZ + 32768;
2731 pub const SF_NODISKIO: c_int = 0x00000001;
2732 pub const SF_MNOWAIT: c_int = 0x00000002;
2733 pub const SF_SYNC: c_int = 0x00000004;
2734 pub const SF_USER_READAHEAD: c_int = 0x00000008;
2735 pub const SF_NOCACHE: c_int = 0x00000010;
2736 pub const O_CLOEXEC: c_int = 0x00100000;
2737 pub const O_DIRECTORY: c_int = 0x00020000;
2738 pub const O_DSYNC: c_int = 0x01000000;
2739 pub const O_EMPTY_PATH: c_int = 0x02000000;
2740 pub const O_EXEC: c_int = 0x00040000;
2741 pub const O_PATH: c_int = 0x00400000;
2742 pub const O_RESOLVE_BENEATH: c_int = 0x00800000;
2743 pub const O_SEARCH: c_int = O_EXEC;
2744 pub const O_TTY_INIT: c_int = 0x00080000;
2745 pub const O_VERIFY: c_int = 0x00200000;
2746 pub const F_GETLK: c_int = 11;
2747 pub const F_SETLK: c_int = 12;
2748 pub const F_SETLKW: c_int = 13;
2749 pub const ENOTCAPABLE: c_int = 93;
2750 pub const ECAPMODE: c_int = 94;
2751 pub const ENOTRECOVERABLE: c_int = 95;
2752 pub const EOWNERDEAD: c_int = 96;
2753 pub const EINTEGRITY: c_int = 97;
2754 pub const RLIMIT_NPTS: c_int = 11;
2755 pub const RLIMIT_SWAP: c_int = 12;
2756 pub const RLIMIT_KQUEUES: c_int = 13;
2757 pub const RLIMIT_UMTXP: c_int = 14;
2758 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
2759 pub const RLIM_NLIMITS: crate::rlim_t = 15;
2760 pub const RLIM_SAVED_MAX: crate::rlim_t = crate::RLIM_INFINITY;
2761 pub const RLIM_SAVED_CUR: crate::rlim_t = crate::RLIM_INFINITY;
2762
2763 pub const CP_USER: c_int = 0;
2764 pub const CP_NICE: c_int = 1;
2765 pub const CP_SYS: c_int = 2;
2766 pub const CP_INTR: c_int = 3;
2767 pub const CP_IDLE: c_int = 4;
2768 pub const CPUSTATES: c_int = 5;
2769
2770 pub const NI_NOFQDN: c_int = 0x00000001;
2771 pub const NI_NUMERICHOST: c_int = 0x00000002;
2772 pub const NI_NAMEREQD: c_int = 0x00000004;
2773 pub const NI_NUMERICSERV: c_int = 0x00000008;
2774 pub const NI_DGRAM: c_int = 0x00000010;
2775 pub const NI_NUMERICSCOPE: c_int = 0x00000020;
2776
2777 pub const XU_NGROUPS: c_int = 16;
2778
2779 pub const Q_GETQUOTA: c_int = 0x700;
2780 pub const Q_SETQUOTA: c_int = 0x800;
2781
2782 pub const MAP_GUARD: c_int = 0x00002000;
2783 pub const MAP_EXCL: c_int = 0x00004000;
2784 pub const MAP_PREFAULT_READ: c_int = 0x00040000;
2785 pub const MAP_ALIGNMENT_SHIFT: c_int = 24;
2786 pub const MAP_ALIGNMENT_MASK: c_int = 0xff << MAP_ALIGNMENT_SHIFT;
2787 pub const MAP_ALIGNED_SUPER: c_int = 1 << MAP_ALIGNMENT_SHIFT;
2788
2789 pub const POSIX_FADV_NORMAL: c_int = 0;
2790 pub const POSIX_FADV_RANDOM: c_int = 1;
2791 pub const POSIX_FADV_SEQUENTIAL: c_int = 2;
2792 pub const POSIX_FADV_WILLNEED: c_int = 3;
2793 pub const POSIX_FADV_DONTNEED: c_int = 4;
2794 pub const POSIX_FADV_NOREUSE: c_int = 5;
2795
2796 pub const POLLINIGNEOF: c_short = 0x2000;
2797 pub const POLLRDHUP: c_short = 0x4000;
2798
2799 pub const EVFILT_READ: i16 = -1;
2800 pub const EVFILT_WRITE: i16 = -2;
2801 pub const EVFILT_AIO: i16 = -3;
2802 pub const EVFILT_VNODE: i16 = -4;
2803 pub const EVFILT_PROC: i16 = -5;
2804 pub const EVFILT_SIGNAL: i16 = -6;
2805 pub const EVFILT_TIMER: i16 = -7;
2806 pub const EVFILT_PROCDESC: i16 = -8;
2807 pub const EVFILT_FS: i16 = -9;
2808 pub const EVFILT_LIO: i16 = -10;
2809 pub const EVFILT_USER: i16 = -11;
2810 pub const EVFILT_SENDFILE: i16 = -12;
2811 pub const EVFILT_EMPTY: i16 = -13;
2812
2813 pub const EV_ADD: u16 = 0x1;
2814 pub const EV_DELETE: u16 = 0x2;
2815 pub const EV_ENABLE: u16 = 0x4;
2816 pub const EV_DISABLE: u16 = 0x8;
2817 pub const EV_FORCEONESHOT: u16 = 0x100;
2818 pub const EV_KEEPUDATA: u16 = 0x200;
2819
2820 pub const EV_ONESHOT: u16 = 0x10;
2821 pub const EV_CLEAR: u16 = 0x20;
2822 pub const EV_RECEIPT: u16 = 0x40;
2823 pub const EV_DISPATCH: u16 = 0x80;
2824 pub const EV_SYSFLAGS: u16 = 0xf000;
2825 pub const EV_DROP: u16 = 0x1000;
2826 pub const EV_FLAG1: u16 = 0x2000;
2827 pub const EV_FLAG2: u16 = 0x4000;
2828
2829 pub const EV_EOF: u16 = 0x8000;
2830 pub const EV_ERROR: u16 = 0x4000;
2831
2832 pub const NOTE_TRIGGER: u32 = 0x01000000;
2833 pub const NOTE_FFNOP: u32 = 0x00000000;
2834 pub const NOTE_FFAND: u32 = 0x40000000;
2835 pub const NOTE_FFOR: u32 = 0x80000000;
2836 pub const NOTE_FFCOPY: u32 = 0xc0000000;
2837 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
2838 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
2839 pub const NOTE_LOWAT: u32 = 0x00000001;
2840 pub const NOTE_FILE_POLL: u32 = 0x00000002;
2841 pub const NOTE_DELETE: u32 = 0x00000001;
2842 pub const NOTE_WRITE: u32 = 0x00000002;
2843 pub const NOTE_EXTEND: u32 = 0x00000004;
2844 pub const NOTE_ATTRIB: u32 = 0x00000008;
2845 pub const NOTE_LINK: u32 = 0x00000010;
2846 pub const NOTE_RENAME: u32 = 0x00000020;
2847 pub const NOTE_REVOKE: u32 = 0x00000040;
2848 pub const NOTE_OPEN: u32 = 0x00000080;
2849 pub const NOTE_CLOSE: u32 = 0x00000100;
2850 pub const NOTE_CLOSE_WRITE: u32 = 0x00000200;
2851 pub const NOTE_READ: u32 = 0x00000400;
2852 pub const NOTE_EXIT: u32 = 0x80000000;
2853 pub const NOTE_FORK: u32 = 0x40000000;
2854 pub const NOTE_EXEC: u32 = 0x20000000;
2855 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
2856 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
2857 pub const NOTE_TRACK: u32 = 0x00000001;
2858 pub const NOTE_TRACKERR: u32 = 0x00000002;
2859 pub const NOTE_CHILD: u32 = 0x00000004;
2860 pub const NOTE_SECONDS: u32 = 0x00000001;
2861 pub const NOTE_MSECONDS: u32 = 0x00000002;
2862 pub const NOTE_USECONDS: u32 = 0x00000004;
2863 pub const NOTE_NSECONDS: u32 = 0x00000008;
2864 pub const NOTE_ABSTIME: u32 = 0x00000010;
2865
2866 pub const MADV_PROTECT: c_int = 10;
2867
2868 #[doc(hidden)]
2869 #[deprecated(
2870 since = "0.2.72",
2871 note = "CTL_UNSPEC is deprecated. Use CTL_SYSCTL instead"
2872 )]
2873 pub const CTL_UNSPEC: c_int = 0;
2874 pub const CTL_SYSCTL: c_int = 0;
2875 pub const CTL_KERN: c_int = 1;
2876 pub const CTL_VM: c_int = 2;
2877 pub const CTL_VFS: c_int = 3;
2878 pub const CTL_NET: c_int = 4;
2879 pub const CTL_DEBUG: c_int = 5;
2880 pub const CTL_HW: c_int = 6;
2881 pub const CTL_MACHDEP: c_int = 7;
2882 pub const CTL_USER: c_int = 8;
2883 pub const CTL_P1003_1B: c_int = 9;
2884
2885 // sys/sysctl.h
2886 pub const CTL_MAXNAME: c_int = 24;
2887
2888 pub const CTLTYPE: c_int = 0xf;
2889 pub const CTLTYPE_NODE: c_int = 1;
2890 pub const CTLTYPE_INT: c_int = 2;
2891 pub const CTLTYPE_STRING: c_int = 3;
2892 pub const CTLTYPE_S64: c_int = 4;
2893 pub const CTLTYPE_OPAQUE: c_int = 5;
2894 pub const CTLTYPE_STRUCT: c_int = CTLTYPE_OPAQUE;
2895 pub const CTLTYPE_UINT: c_int = 6;
2896 pub const CTLTYPE_LONG: c_int = 7;
2897 pub const CTLTYPE_ULONG: c_int = 8;
2898 pub const CTLTYPE_U64: c_int = 9;
2899 pub const CTLTYPE_U8: c_int = 0xa;
2900 pub const CTLTYPE_U16: c_int = 0xb;
2901 pub const CTLTYPE_S8: c_int = 0xc;
2902 pub const CTLTYPE_S16: c_int = 0xd;
2903 pub const CTLTYPE_S32: c_int = 0xe;
2904 pub const CTLTYPE_U32: c_int = 0xf;
2905
2906 pub const CTLFLAG_RD: c_int = 0x80000000;
2907 pub const CTLFLAG_WR: c_int = 0x40000000;
2908 pub const CTLFLAG_RW: c_int = CTLFLAG_RD | CTLFLAG_WR;
2909 pub const CTLFLAG_DORMANT: c_int = 0x20000000;
2910 pub const CTLFLAG_ANYBODY: c_int = 0x10000000;
2911 pub const CTLFLAG_SECURE: c_int = 0x08000000;
2912 pub const CTLFLAG_PRISON: c_int = 0x04000000;
2913 pub const CTLFLAG_DYN: c_int = 0x02000000;
2914 pub const CTLFLAG_SKIP: c_int = 0x01000000;
2915 pub const CTLMASK_SECURE: c_int = 0x00F00000;
2916 pub const CTLFLAG_TUN: c_int = 0x00080000;
2917 pub const CTLFLAG_RDTUN: c_int = CTLFLAG_RD | CTLFLAG_TUN;
2918 pub const CTLFLAG_RWTUN: c_int = CTLFLAG_RW | CTLFLAG_TUN;
2919 pub const CTLFLAG_MPSAFE: c_int = 0x00040000;
2920 pub const CTLFLAG_VNET: c_int = 0x00020000;
2921 pub const CTLFLAG_DYING: c_int = 0x00010000;
2922 pub const CTLFLAG_CAPRD: c_int = 0x00008000;
2923 pub const CTLFLAG_CAPWR: c_int = 0x00004000;
2924 pub const CTLFLAG_STATS: c_int = 0x00002000;
2925 pub const CTLFLAG_NOFETCH: c_int = 0x00001000;
2926 pub const CTLFLAG_CAPRW: c_int = CTLFLAG_CAPRD | CTLFLAG_CAPWR;
2927 pub const CTLFLAG_NEEDGIANT: c_int = 0x00000800;
2928
2929 pub const CTLSHIFT_SECURE: c_int = 20;
2930 pub const CTLFLAG_SECURE1: c_int = CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE);
2931 pub const CTLFLAG_SECURE2: c_int = CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE);
2932 pub const CTLFLAG_SECURE3: c_int = CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE);
2933
2934 pub const OID_AUTO: c_int = -1;
2935
2936 pub const CTL_SYSCTL_DEBUG: c_int = 0;
2937 pub const CTL_SYSCTL_NAME: c_int = 1;
2938 pub const CTL_SYSCTL_NEXT: c_int = 2;
2939 pub const CTL_SYSCTL_NAME2OID: c_int = 3;
2940 pub const CTL_SYSCTL_OIDFMT: c_int = 4;
2941 pub const CTL_SYSCTL_OIDDESCR: c_int = 5;
2942 pub const CTL_SYSCTL_OIDLABEL: c_int = 6;
2943 pub const CTL_SYSCTL_NEXTNOSKIP: c_int = 7;
2944
2945 pub const KERN_OSTYPE: c_int = 1;
2946 pub const KERN_OSRELEASE: c_int = 2;
2947 pub const KERN_OSREV: c_int = 3;
2948 pub const KERN_VERSION: c_int = 4;
2949 pub const KERN_MAXVNODES: c_int = 5;
2950 pub const KERN_MAXPROC: c_int = 6;
2951 pub const KERN_MAXFILES: c_int = 7;
2952 pub const KERN_ARGMAX: c_int = 8;
2953 pub const KERN_SECURELVL: c_int = 9;
2954 pub const KERN_HOSTNAME: c_int = 10;
2955 pub const KERN_HOSTID: c_int = 11;
2956 pub const KERN_CLOCKRATE: c_int = 12;
2957 pub const KERN_VNODE: c_int = 13;
2958 pub const KERN_PROC: c_int = 14;
2959 pub const KERN_FILE: c_int = 15;
2960 pub const KERN_PROF: c_int = 16;
2961 pub const KERN_POSIX1: c_int = 17;
2962 pub const KERN_NGROUPS: c_int = 18;
2963 pub const KERN_JOB_CONTROL: c_int = 19;
2964 pub const KERN_SAVED_IDS: c_int = 20;
2965 pub const KERN_BOOTTIME: c_int = 21;
2966 pub const KERN_NISDOMAINNAME: c_int = 22;
2967 pub const KERN_UPDATEINTERVAL: c_int = 23;
2968 pub const KERN_OSRELDATE: c_int = 24;
2969 pub const KERN_NTP_PLL: c_int = 25;
2970 pub const KERN_BOOTFILE: c_int = 26;
2971 pub const KERN_MAXFILESPERPROC: c_int = 27;
2972 pub const KERN_MAXPROCPERUID: c_int = 28;
2973 pub const KERN_DUMPDEV: c_int = 29;
2974 pub const KERN_IPC: c_int = 30;
2975 pub const KERN_DUMMY: c_int = 31;
2976 pub const KERN_PS_STRINGS: c_int = 32;
2977 pub const KERN_USRSTACK: c_int = 33;
2978 pub const KERN_LOGSIGEXIT: c_int = 34;
2979 pub const KERN_IOV_MAX: c_int = 35;
2980 pub const KERN_HOSTUUID: c_int = 36;
2981 pub const KERN_ARND: c_int = 37;
2982 pub const KERN_MAXPHYS: c_int = 38;
2983
2984 pub const KERN_PROC_ALL: c_int = 0;
2985 pub const KERN_PROC_PID: c_int = 1;
2986 pub const KERN_PROC_PGRP: c_int = 2;
2987 pub const KERN_PROC_SESSION: c_int = 3;
2988 pub const KERN_PROC_TTY: c_int = 4;
2989 pub const KERN_PROC_UID: c_int = 5;
2990 pub const KERN_PROC_RUID: c_int = 6;
2991 pub const KERN_PROC_ARGS: c_int = 7;
2992 pub const KERN_PROC_PROC: c_int = 8;
2993 pub const KERN_PROC_SV_NAME: c_int = 9;
2994 pub const KERN_PROC_RGID: c_int = 10;
2995 pub const KERN_PROC_GID: c_int = 11;
2996 pub const KERN_PROC_PATHNAME: c_int = 12;
2997 pub const KERN_PROC_OVMMAP: c_int = 13;
2998 pub const KERN_PROC_OFILEDESC: c_int = 14;
2999 pub const KERN_PROC_KSTACK: c_int = 15;
3000 pub const KERN_PROC_INC_THREAD: c_int = 0x10;
3001 pub const KERN_PROC_VMMAP: c_int = 32;
3002 pub const KERN_PROC_FILEDESC: c_int = 33;
3003 pub const KERN_PROC_GROUPS: c_int = 34;
3004 pub const KERN_PROC_ENV: c_int = 35;
3005 pub const KERN_PROC_AUXV: c_int = 36;
3006 pub const KERN_PROC_RLIMIT: c_int = 37;
3007 pub const KERN_PROC_PS_STRINGS: c_int = 38;
3008 pub const KERN_PROC_UMASK: c_int = 39;
3009 pub const KERN_PROC_OSREL: c_int = 40;
3010 pub const KERN_PROC_SIGTRAMP: c_int = 41;
3011 pub const KERN_PROC_CWD: c_int = 42;
3012 pub const KERN_PROC_NFDS: c_int = 43;
3013 pub const KERN_PROC_SIGFASTBLK: c_int = 44;
3014
3015 pub const KIPC_MAXSOCKBUF: c_int = 1;
3016 pub const KIPC_SOCKBUF_WASTE: c_int = 2;
3017 pub const KIPC_SOMAXCONN: c_int = 3;
3018 pub const KIPC_MAX_LINKHDR: c_int = 4;
3019 pub const KIPC_MAX_PROTOHDR: c_int = 5;
3020 pub const KIPC_MAX_HDR: c_int = 6;
3021 pub const KIPC_MAX_DATALEN: c_int = 7;
3022
3023 pub const HW_MACHINE: c_int = 1;
3024 pub const HW_MODEL: c_int = 2;
3025 pub const HW_NCPU: c_int = 3;
3026 pub const HW_BYTEORDER: c_int = 4;
3027 pub const HW_PHYSMEM: c_int = 5;
3028 pub const HW_USERMEM: c_int = 6;
3029 pub const HW_PAGESIZE: c_int = 7;
3030 pub const HW_DISKNAMES: c_int = 8;
3031 pub const HW_DISKSTATS: c_int = 9;
3032 pub const HW_FLOATINGPT: c_int = 10;
3033 pub const HW_MACHINE_ARCH: c_int = 11;
3034 pub const HW_REALMEM: c_int = 12;
3035
3036 pub const USER_CS_PATH: c_int = 1;
3037 pub const USER_BC_BASE_MAX: c_int = 2;
3038 pub const USER_BC_DIM_MAX: c_int = 3;
3039 pub const USER_BC_SCALE_MAX: c_int = 4;
3040 pub const USER_BC_STRING_MAX: c_int = 5;
3041 pub const USER_COLL_WEIGHTS_MAX: c_int = 6;
3042 pub const USER_EXPR_NEST_MAX: c_int = 7;
3043 pub const USER_LINE_MAX: c_int = 8;
3044 pub const USER_RE_DUP_MAX: c_int = 9;
3045 pub const USER_POSIX2_VERSION: c_int = 10;
3046 pub const USER_POSIX2_C_BIND: c_int = 11;
3047 pub const USER_POSIX2_C_DEV: c_int = 12;
3048 pub const USER_POSIX2_CHAR_TERM: c_int = 13;
3049 pub const USER_POSIX2_FORT_DEV: c_int = 14;
3050 pub const USER_POSIX2_FORT_RUN: c_int = 15;
3051 pub const USER_POSIX2_LOCALEDEF: c_int = 16;
3052 pub const USER_POSIX2_SW_DEV: c_int = 17;
3053 pub const USER_POSIX2_UPE: c_int = 18;
3054 pub const USER_STREAM_MAX: c_int = 19;
3055 pub const USER_TZNAME_MAX: c_int = 20;
3056 pub const USER_LOCALBASE: c_int = 21;
3057
3058 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: c_int = 1;
3059 pub const CTL_P1003_1B_MAPPED_FILES: c_int = 2;
3060 pub const CTL_P1003_1B_MEMLOCK: c_int = 3;
3061 pub const CTL_P1003_1B_MEMLOCK_RANGE: c_int = 4;
3062 pub const CTL_P1003_1B_MEMORY_PROTECTION: c_int = 5;
3063 pub const CTL_P1003_1B_MESSAGE_PASSING: c_int = 6;
3064 pub const CTL_P1003_1B_PRIORITIZED_IO: c_int = 7;
3065 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: c_int = 8;
3066 pub const CTL_P1003_1B_REALTIME_SIGNALS: c_int = 9;
3067 pub const CTL_P1003_1B_SEMAPHORES: c_int = 10;
3068 pub const CTL_P1003_1B_FSYNC: c_int = 11;
3069 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: c_int = 12;
3070 pub const CTL_P1003_1B_SYNCHRONIZED_IO: c_int = 13;
3071 pub const CTL_P1003_1B_TIMERS: c_int = 14;
3072 pub const CTL_P1003_1B_AIO_LISTIO_MAX: c_int = 15;
3073 pub const CTL_P1003_1B_AIO_MAX: c_int = 16;
3074 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: c_int = 17;
3075 pub const CTL_P1003_1B_DELAYTIMER_MAX: c_int = 18;
3076 pub const CTL_P1003_1B_MQ_OPEN_MAX: c_int = 19;
3077 pub const CTL_P1003_1B_PAGESIZE: c_int = 20;
3078 pub const CTL_P1003_1B_RTSIG_MAX: c_int = 21;
3079 pub const CTL_P1003_1B_SEM_NSEMS_MAX: c_int = 22;
3080 pub const CTL_P1003_1B_SEM_VALUE_MAX: c_int = 23;
3081 pub const CTL_P1003_1B_SIGQUEUE_MAX: c_int = 24;
3082 pub const CTL_P1003_1B_TIMER_MAX: c_int = 25;
3083
3084 pub const TIOCGPTN: c_ulong = 0x4004740f;
3085 pub const TIOCPTMASTER: c_ulong = 0x2000741c;
3086 pub const TIOCSIG: c_ulong = 0x2004745f;
3087 pub const TIOCM_DCD: c_int = 0x40;
3088 pub const H4DISC: c_int = 0x7;
3089
3090 pub const VM_TOTAL: c_int = 1;
3091
3092 cfg_if! {
3093 if #[cfg(target_pointer_width = "64")] {
3094 pub const BIOCSETFNR: c_ulong = 0x80104282;
3095 } else {
3096 pub const BIOCSETFNR: c_ulong = 0x80084282;
3097 }
3098 }
3099
3100 cfg_if! {
3101 if #[cfg(target_pointer_width = "64")] {
3102 pub const FIODGNAME: c_ulong = 0x80106678;
3103 } else {
3104 pub const FIODGNAME: c_ulong = 0x80086678;
3105 }
3106 }
3107
3108 pub const FIONWRITE: c_ulong = 0x40046677;
3109 pub const FIONSPACE: c_ulong = 0x40046676;
3110 pub const FIOSEEKDATA: c_ulong = 0xc0086661;
3111 pub const FIOSEEKHOLE: c_ulong = 0xc0086662;
3112 pub const FIOSSHMLPGCNF: c_ulong = 0x80306664;
3113
3114 pub const JAIL_API_VERSION: u32 = 2;
3115 pub const JAIL_CREATE: c_int = 0x01;
3116 pub const JAIL_UPDATE: c_int = 0x02;
3117 pub const JAIL_ATTACH: c_int = 0x04;
3118 pub const JAIL_DYING: c_int = 0x08;
3119 pub const JAIL_SET_MASK: c_int = 0x0f;
3120 pub const JAIL_GET_MASK: c_int = 0x08;
3121 pub const JAIL_SYS_DISABLE: c_int = 0;
3122 pub const JAIL_SYS_NEW: c_int = 1;
3123 pub const JAIL_SYS_INHERIT: c_int = 2;
3124
3125 pub const MNT_ACLS: c_int = 0x08000000;
3126 pub const MNT_BYFSID: c_int = 0x08000000;
3127 pub const MNT_GJOURNAL: c_int = 0x02000000;
3128 pub const MNT_MULTILABEL: c_int = 0x04000000;
3129 pub const MNT_NFS4ACLS: c_int = 0x00000010;
3130 pub const MNT_SNAPSHOT: c_int = 0x01000000;
3131 pub const MNT_UNION: c_int = 0x00000020;
3132 pub const MNT_NONBUSY: c_int = 0x04000000;
3133
3134 pub const SCM_BINTIME: c_int = 0x04;
3135 pub const SCM_REALTIME: c_int = 0x05;
3136 pub const SCM_MONOTONIC: c_int = 0x06;
3137 pub const SCM_TIME_INFO: c_int = 0x07;
3138 pub const SCM_CREDS2: c_int = 0x08;
3139
3140 pub const SO_BINTIME: c_int = 0x2000;
3141 pub const SO_NO_OFFLOAD: c_int = 0x4000;
3142 pub const SO_NO_DDP: c_int = 0x8000;
3143 pub const SO_REUSEPORT_LB: c_int = 0x10000;
3144 pub const SO_LABEL: c_int = 0x1009;
3145 pub const SO_PEERLABEL: c_int = 0x1010;
3146 pub const SO_LISTENQLIMIT: c_int = 0x1011;
3147 pub const SO_LISTENQLEN: c_int = 0x1012;
3148 pub const SO_LISTENINCQLEN: c_int = 0x1013;
3149 pub const SO_SETFIB: c_int = 0x1014;
3150 pub const SO_USER_COOKIE: c_int = 0x1015;
3151 pub const SO_PROTOCOL: c_int = 0x1016;
3152 pub const SO_PROTOTYPE: c_int = SO_PROTOCOL;
3153 pub const SO_TS_CLOCK: c_int = 0x1017;
3154 pub const SO_DOMAIN: c_int = 0x1019;
3155 pub const SO_VENDOR: c_int = 0x80000000;
3156
3157 pub const SO_TS_REALTIME_MICRO: c_int = 0;
3158 pub const SO_TS_BINTIME: c_int = 1;
3159 pub const SO_TS_REALTIME: c_int = 2;
3160 pub const SO_TS_MONOTONIC: c_int = 3;
3161 pub const SO_TS_DEFAULT: c_int = SO_TS_REALTIME_MICRO;
3162 pub const SO_TS_CLOCK_MAX: c_int = SO_TS_MONOTONIC;
3163
3164 pub const LOCAL_CREDS: c_int = 2;
3165 pub const LOCAL_CREDS_PERSISTENT: c_int = 3;
3166 pub const LOCAL_CONNWAIT: c_int = 4;
3167 pub const LOCAL_VENDOR: c_int = SO_VENDOR;
3168
3169 pub const PL_EVENT_NONE: c_int = 0;
3170 pub const PL_EVENT_SIGNAL: c_int = 1;
3171 pub const PL_FLAG_SA: c_int = 0x01;
3172 pub const PL_FLAG_BOUND: c_int = 0x02;
3173 pub const PL_FLAG_SCE: c_int = 0x04;
3174 pub const PL_FLAG_SCX: c_int = 0x08;
3175 pub const PL_FLAG_EXEC: c_int = 0x10;
3176 pub const PL_FLAG_SI: c_int = 0x20;
3177 pub const PL_FLAG_FORKED: c_int = 0x40;
3178 pub const PL_FLAG_CHILD: c_int = 0x80;
3179 pub const PL_FLAG_BORN: c_int = 0x100;
3180 pub const PL_FLAG_EXITED: c_int = 0x200;
3181 pub const PL_FLAG_VFORKED: c_int = 0x400;
3182 pub const PL_FLAG_VFORK_DONE: c_int = 0x800;
3183
3184 pub const PT_LWPINFO: c_int = 13;
3185 pub const PT_GETNUMLWPS: c_int = 14;
3186 pub const PT_GETLWPLIST: c_int = 15;
3187 pub const PT_CLEARSTEP: c_int = 16;
3188 pub const PT_SETSTEP: c_int = 17;
3189 pub const PT_SUSPEND: c_int = 18;
3190 pub const PT_RESUME: c_int = 19;
3191 pub const PT_TO_SCE: c_int = 20;
3192 pub const PT_TO_SCX: c_int = 21;
3193 pub const PT_SYSCALL: c_int = 22;
3194 pub const PT_FOLLOW_FORK: c_int = 23;
3195 pub const PT_LWP_EVENTS: c_int = 24;
3196 pub const PT_GET_EVENT_MASK: c_int = 25;
3197 pub const PT_SET_EVENT_MASK: c_int = 26;
3198 pub const PT_GET_SC_ARGS: c_int = 27;
3199 pub const PT_GET_SC_RET: c_int = 28;
3200 pub const PT_COREDUMP: c_int = 29;
3201 pub const PT_GETREGS: c_int = 33;
3202 pub const PT_SETREGS: c_int = 34;
3203 pub const PT_GETFPREGS: c_int = 35;
3204 pub const PT_SETFPREGS: c_int = 36;
3205 pub const PT_GETDBREGS: c_int = 37;
3206 pub const PT_SETDBREGS: c_int = 38;
3207 pub const PT_VM_TIMESTAMP: c_int = 40;
3208 pub const PT_VM_ENTRY: c_int = 41;
3209 pub const PT_GETREGSET: c_int = 42;
3210 pub const PT_SETREGSET: c_int = 43;
3211 pub const PT_SC_REMOTE: c_int = 44;
3212 pub const PT_FIRSTMACH: c_int = 64;
3213
3214 pub const PTRACE_EXEC: c_int = 0x0001;
3215 pub const PTRACE_SCE: c_int = 0x0002;
3216 pub const PTRACE_SCX: c_int = 0x0004;
3217 pub const PTRACE_SYSCALL: c_int = PTRACE_SCE | PTRACE_SCX;
3218 pub const PTRACE_FORK: c_int = 0x0008;
3219 pub const PTRACE_LWP: c_int = 0x0010;
3220 pub const PTRACE_VFORK: c_int = 0x0020;
3221 pub const PTRACE_DEFAULT: c_int = PTRACE_EXEC;
3222
3223 pub const PC_COMPRESS: u32 = 0x00000001;
3224 pub const PC_ALL: u32 = 0x00000002;
3225
3226 pub const PROC_SPROTECT: c_int = 1;
3227 pub const PROC_REAP_ACQUIRE: c_int = 2;
3228 pub const PROC_REAP_RELEASE: c_int = 3;
3229 pub const PROC_REAP_STATUS: c_int = 4;
3230 pub const PROC_REAP_GETPIDS: c_int = 5;
3231 pub const PROC_REAP_KILL: c_int = 6;
3232 pub const PROC_TRACE_CTL: c_int = 7;
3233 pub const PROC_TRACE_STATUS: c_int = 8;
3234 pub const PROC_TRAPCAP_CTL: c_int = 9;
3235 pub const PROC_TRAPCAP_STATUS: c_int = 10;
3236 pub const PROC_PDEATHSIG_CTL: c_int = 11;
3237 pub const PROC_PDEATHSIG_STATUS: c_int = 12;
3238 pub const PROC_ASLR_CTL: c_int = 13;
3239 pub const PROC_ASLR_STATUS: c_int = 14;
3240 pub const PROC_PROTMAX_CTL: c_int = 15;
3241 pub const PROC_PROTMAX_STATUS: c_int = 16;
3242 pub const PROC_STACKGAP_CTL: c_int = 17;
3243 pub const PROC_STACKGAP_STATUS: c_int = 18;
3244 pub const PROC_NO_NEW_PRIVS_CTL: c_int = 19;
3245 pub const PROC_NO_NEW_PRIVS_STATUS: c_int = 20;
3246 pub const PROC_WXMAP_CTL: c_int = 21;
3247 pub const PROC_WXMAP_STATUS: c_int = 22;
3248 pub const PROC_PROCCTL_MD_MIN: c_int = 0x10000000;
3249
3250 pub const PPROT_SET: c_int = 1;
3251 pub const PPROT_CLEAR: c_int = 2;
3252 pub const PPROT_DESCEND: c_int = 0x10;
3253 pub const PPROT_INHERIT: c_int = 0x20;
3254
3255 pub const PROC_TRACE_CTL_ENABLE: c_int = 1;
3256 pub const PROC_TRACE_CTL_DISABLE: c_int = 2;
3257 pub const PROC_TRACE_CTL_DISABLE_EXEC: c_int = 3;
3258
3259 pub const PROC_TRAPCAP_CTL_ENABLE: c_int = 1;
3260 pub const PROC_TRAPCAP_CTL_DISABLE: c_int = 2;
3261
3262 pub const PROC_ASLR_FORCE_ENABLE: c_int = 1;
3263 pub const PROC_ASLR_FORCE_DISABLE: c_int = 2;
3264 pub const PROC_ASLR_NOFORCE: c_int = 3;
3265 pub const PROC_ASLR_ACTIVE: c_int = 0x80000000;
3266
3267 pub const PROC_PROTMAX_FORCE_ENABLE: c_int = 1;
3268 pub const PROC_PROTMAX_FORCE_DISABLE: c_int = 2;
3269 pub const PROC_PROTMAX_NOFORCE: c_int = 3;
3270 pub const PROC_PROTMAX_ACTIVE: c_int = 0x80000000;
3271
3272 pub const PROC_STACKGAP_ENABLE: c_int = 0x0001;
3273 pub const PROC_STACKGAP_DISABLE: c_int = 0x0002;
3274 pub const PROC_STACKGAP_ENABLE_EXEC: c_int = 0x0004;
3275 pub const PROC_STACKGAP_DISABLE_EXEC: c_int = 0x0008;
3276
3277 pub const PROC_NO_NEW_PRIVS_ENABLE: c_int = 1;
3278 pub const PROC_NO_NEW_PRIVS_DISABLE: c_int = 2;
3279
3280 pub const PROC_WX_MAPPINGS_PERMIT: c_int = 0x0001;
3281 pub const PROC_WX_MAPPINGS_DISALLOW_EXEC: c_int = 0x0002;
3282 pub const PROC_WXORX_ENFORCE: c_int = 0x80000000;
3283
3284 pub const AF_SLOW: c_int = 33;
3285 pub const AF_SCLUSTER: c_int = 34;
3286 pub const AF_ARP: c_int = 35;
3287 pub const AF_BLUETOOTH: c_int = 36;
3288 pub const AF_IEEE80211: c_int = 37;
3289 pub const AF_INET_SDP: c_int = 40;
3290 pub const AF_INET6_SDP: c_int = 42;
3291
3292 // sys/net/if.h
3293 pub const IF_MAXUNIT: c_int = 0x7fff;
3294 /// (n) interface is up
3295 pub const IFF_UP: c_int = 0x1;
3296 /// (i) broadcast address valid
3297 pub const IFF_BROADCAST: c_int = 0x2;
3298 /// (n) turn on debugging
3299 pub const IFF_DEBUG: c_int = 0x4;
3300 /// (i) is a loopback net
3301 pub const IFF_LOOPBACK: c_int = 0x8;
3302 /// (i) is a point-to-point link
3303 pub const IFF_POINTOPOINT: c_int = 0x10;
3304 /// (i) calls if_input in net epoch
3305 #[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")]
3306 pub const IFF_KNOWSEPOCH: c_int = 0x20;
3307 /// (d) resources allocated
3308 pub const IFF_RUNNING: c_int = 0x40;
3309 #[doc(hidden)]
3310 #[deprecated(
3311 since = "0.2.54",
3312 note = "IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead"
3313 )]
3314 /// (d) resources allocate
3315 pub const IFF_DRV_RUNNING: c_int = 0x40;
3316 /// (n) no address resolution protocol
3317 pub const IFF_NOARP: c_int = 0x80;
3318 /// (n) receive all packets
3319 pub const IFF_PROMISC: c_int = 0x100;
3320 /// (n) receive all multicast packets
3321 pub const IFF_ALLMULTI: c_int = 0x200;
3322 /// (d) tx hardware queue is full
3323 pub const IFF_OACTIVE: c_int = 0x400;
3324 #[doc(hidden)]
3325 #[deprecated(since = "0.2.54", note = "Use the portable `IFF_OACTIVE` instead")]
3326 /// (d) tx hardware queue is full
3327 pub const IFF_DRV_OACTIVE: c_int = 0x400;
3328 /// (i) can't hear own transmissions
3329 pub const IFF_SIMPLEX: c_int = 0x800;
3330 /// per link layer defined bit
3331 pub const IFF_LINK0: c_int = 0x1000;
3332 /// per link layer defined bit
3333 pub const IFF_LINK1: c_int = 0x2000;
3334 /// per link layer defined bit
3335 pub const IFF_LINK2: c_int = 0x4000;
3336 /// use alternate physical connection
3337 pub const IFF_ALTPHYS: c_int = IFF_LINK2;
3338 /// (i) supports multicast
3339 pub const IFF_MULTICAST: c_int = 0x8000;
3340 /// (i) unconfigurable using ioctl(2)
3341 pub const IFF_CANTCONFIG: c_int = 0x10000;
3342 /// (n) user-requested promisc mode
3343 pub const IFF_PPROMISC: c_int = 0x20000;
3344 /// (n) user-requested monitor mode
3345 pub const IFF_MONITOR: c_int = 0x40000;
3346 /// (n) static ARP
3347 pub const IFF_STATICARP: c_int = 0x80000;
3348 /// (n) interface is winding down
3349 pub const IFF_DYING: c_int = 0x200000;
3350 /// (n) interface is being renamed
3351 pub const IFF_RENAMING: c_int = 0x400000;
3352 /// interface is not part of any groups
3353 #[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")]
3354 pub const IFF_NOGROUP: c_int = 0x800000;
3355
3356 /// link invalid/unknown
3357 pub const LINK_STATE_UNKNOWN: c_int = 0;
3358 /// link is down
3359 pub const LINK_STATE_DOWN: c_int = 1;
3360 /// link is up
3361 pub const LINK_STATE_UP: c_int = 2;
3362
3363 /// can offload checksum on RX
3364 pub const IFCAP_RXCSUM: c_int = 0x00001;
3365 /// can offload checksum on TX
3366 pub const IFCAP_TXCSUM: c_int = 0x00002;
3367 /// can be a network console
3368 pub const IFCAP_NETCONS: c_int = 0x00004;
3369 /// VLAN-compatible MTU
3370 pub const IFCAP_VLAN_MTU: c_int = 0x00008;
3371 /// hardware VLAN tag support
3372 pub const IFCAP_VLAN_HWTAGGING: c_int = 0x00010;
3373 /// 9000 byte MTU supported
3374 pub const IFCAP_JUMBO_MTU: c_int = 0x00020;
3375 /// driver supports polling
3376 pub const IFCAP_POLLING: c_int = 0x00040;
3377 /// can do IFCAP_HWCSUM on VLANs
3378 pub const IFCAP_VLAN_HWCSUM: c_int = 0x00080;
3379 /// can do TCP Segmentation Offload
3380 pub const IFCAP_TSO4: c_int = 0x00100;
3381 /// can do TCP6 Segmentation Offload
3382 pub const IFCAP_TSO6: c_int = 0x00200;
3383 /// can do Large Receive Offload
3384 pub const IFCAP_LRO: c_int = 0x00400;
3385 /// wake on any unicast frame
3386 pub const IFCAP_WOL_UCAST: c_int = 0x00800;
3387 /// wake on any multicast frame
3388 pub const IFCAP_WOL_MCAST: c_int = 0x01000;
3389 /// wake on any Magic Packet
3390 pub const IFCAP_WOL_MAGIC: c_int = 0x02000;
3391 /// interface can offload TCP
3392 pub const IFCAP_TOE4: c_int = 0x04000;
3393 /// interface can offload TCP6
3394 pub const IFCAP_TOE6: c_int = 0x08000;
3395 /// interface hw can filter vlan tag
3396 pub const IFCAP_VLAN_HWFILTER: c_int = 0x10000;
3397 /// can do SIOCGIFCAPNV/SIOCSIFCAPNV
3398 pub const IFCAP_NV: c_int = 0x20000;
3399 /// can do IFCAP_TSO on VLANs
3400 pub const IFCAP_VLAN_HWTSO: c_int = 0x40000;
3401 /// the runtime link state is dynamic
3402 pub const IFCAP_LINKSTATE: c_int = 0x80000;
3403 /// netmap mode supported/enabled
3404 pub const IFCAP_NETMAP: c_int = 0x100000;
3405 /// can offload checksum on IPv6 RX
3406 pub const IFCAP_RXCSUM_IPV6: c_int = 0x200000;
3407 /// can offload checksum on IPv6 TX
3408 pub const IFCAP_TXCSUM_IPV6: c_int = 0x400000;
3409 /// manages counters internally
3410 pub const IFCAP_HWSTATS: c_int = 0x800000;
3411 /// hardware supports TX rate limiting
3412 pub const IFCAP_TXRTLMT: c_int = 0x1000000;
3413 /// hardware rx timestamping
3414 pub const IFCAP_HWRXTSTMP: c_int = 0x2000000;
3415 /// understands M_EXTPG mbufs
3416 pub const IFCAP_MEXTPG: c_int = 0x4000000;
3417 /// can do TLS encryption and segmentation for TCP
3418 pub const IFCAP_TXTLS4: c_int = 0x8000000;
3419 /// can do TLS encryption and segmentation for TCP6
3420 pub const IFCAP_TXTLS6: c_int = 0x10000000;
3421 /// can do IFCAN_HWCSUM on VXLANs
3422 pub const IFCAP_VXLAN_HWCSUM: c_int = 0x20000000;
3423 /// can do IFCAP_TSO on VXLANs
3424 pub const IFCAP_VXLAN_HWTSO: c_int = 0x40000000;
3425 /// can do TLS with rate limiting
3426 pub const IFCAP_TXTLS_RTLMT: c_int = 0x80000000;
3427
3428 pub const IFCAP_HWCSUM_IPV6: c_int = IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6;
3429 pub const IFCAP_HWCSUM: c_int = IFCAP_RXCSUM | IFCAP_TXCSUM;
3430 pub const IFCAP_TSO: c_int = IFCAP_TSO4 | IFCAP_TSO6;
3431 pub const IFCAP_WOL: c_int = IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC;
3432 pub const IFCAP_TOE: c_int = IFCAP_TOE4 | IFCAP_TOE6;
3433 pub const IFCAP_TXTLS: c_int = IFCAP_TXTLS4 | IFCAP_TXTLS6;
3434 pub const IFCAP_CANTCHANGE: c_int = IFCAP_NETMAP | IFCAP_NV;
3435
3436 pub const IFQ_MAXLEN: c_int = 50;
3437 pub const IFNET_SLOWHZ: c_int = 1;
3438
3439 pub const IFAN_ARRIVAL: c_int = 0;
3440 pub const IFAN_DEPARTURE: c_int = 1;
3441
3442 pub const IFSTATMAX: c_int = 800;
3443
3444 pub const RSS_FUNC_NONE: c_int = 0;
3445 pub const RSS_FUNC_PRIVATE: c_int = 1;
3446 pub const RSS_FUNC_TOEPLITZ: c_int = 2;
3447
3448 pub const RSS_TYPE_IPV4: c_int = 0x00000001;
3449 pub const RSS_TYPE_TCP_IPV4: c_int = 0x00000002;
3450 pub const RSS_TYPE_IPV6: c_int = 0x00000004;
3451 pub const RSS_TYPE_IPV6_EX: c_int = 0x00000008;
3452 pub const RSS_TYPE_TCP_IPV6: c_int = 0x00000010;
3453 pub const RSS_TYPE_TCP_IPV6_EX: c_int = 0x00000020;
3454 pub const RSS_TYPE_UDP_IPV4: c_int = 0x00000040;
3455 pub const RSS_TYPE_UDP_IPV6: c_int = 0x00000080;
3456 pub const RSS_TYPE_UDP_IPV6_EX: c_int = 0x00000100;
3457 pub const RSS_KEYLEN: c_int = 128;
3458
3459 pub const IFNET_PCP_NONE: c_int = 0xff;
3460 pub const IFDR_MSG_SIZE: c_int = 64;
3461 pub const IFDR_REASON_MSG: c_int = 1;
3462 pub const IFDR_REASON_VENDOR: c_int = 2;
3463
3464 // sys/net/if_mib.h
3465
3466 /// non-interface-specific
3467 pub const IFMIB_SYSTEM: c_int = 1;
3468 /// per-interface data table
3469 pub const IFMIB_IFDATA: c_int = 2;
3470
3471 /// generic stats for all kinds of ifaces
3472 pub const IFDATA_GENERAL: c_int = 1;
3473 /// specific to the type of interface
3474 pub const IFDATA_LINKSPECIFIC: c_int = 2;
3475 /// driver name and unit
3476 pub const IFDATA_DRIVERNAME: c_int = 3;
3477
3478 /// number of interfaces configured
3479 pub const IFMIB_IFCOUNT: c_int = 1;
3480
3481 /// functions not specific to a type of iface
3482 pub const NETLINK_GENERIC: c_int = 0;
3483
3484 pub const DOT3COMPLIANCE_STATS: c_int = 1;
3485 pub const DOT3COMPLIANCE_COLLS: c_int = 2;
3486
3487 pub const dot3ChipSetAMD7990: c_int = 1;
3488 pub const dot3ChipSetAMD79900: c_int = 2;
3489 pub const dot3ChipSetAMD79C940: c_int = 3;
3490
3491 pub const dot3ChipSetIntel82586: c_int = 1;
3492 pub const dot3ChipSetIntel82596: c_int = 2;
3493 pub const dot3ChipSetIntel82557: c_int = 3;
3494
3495 pub const dot3ChipSetNational8390: c_int = 1;
3496 pub const dot3ChipSetNationalSonic: c_int = 2;
3497
3498 pub const dot3ChipSetFujitsu86950: c_int = 1;
3499
3500 pub const dot3ChipSetDigitalDC21040: c_int = 1;
3501 pub const dot3ChipSetDigitalDC21140: c_int = 2;
3502 pub const dot3ChipSetDigitalDC21041: c_int = 3;
3503 pub const dot3ChipSetDigitalDC21140A: c_int = 4;
3504 pub const dot3ChipSetDigitalDC21142: c_int = 5;
3505
3506 pub const dot3ChipSetWesternDigital83C690: c_int = 1;
3507 pub const dot3ChipSetWesternDigital83C790: c_int = 2;
3508
3509 // sys/netinet/in.h
3510 // Protocols (RFC 1700)
3511 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
3512
3513 // IPPROTO_IP defined in src/unix/mod.rs
3514 /// IP6 hop-by-hop options
3515 pub const IPPROTO_HOPOPTS: c_int = 0;
3516 // IPPROTO_ICMP defined in src/unix/mod.rs
3517 /// group mgmt protocol
3518 pub const IPPROTO_IGMP: c_int = 2;
3519 /// gateway^2 (deprecated)
3520 pub const IPPROTO_GGP: c_int = 3;
3521 /// for compatibility
3522 pub const IPPROTO_IPIP: c_int = 4;
3523 // IPPROTO_TCP defined in src/unix/mod.rs
3524 /// Stream protocol II.
3525 pub const IPPROTO_ST: c_int = 7;
3526 /// exterior gateway protocol
3527 pub const IPPROTO_EGP: c_int = 8;
3528 /// private interior gateway
3529 pub const IPPROTO_PIGP: c_int = 9;
3530 /// BBN RCC Monitoring
3531 pub const IPPROTO_RCCMON: c_int = 10;
3532 /// network voice protocol
3533 pub const IPPROTO_NVPII: c_int = 11;
3534 /// pup
3535 pub const IPPROTO_PUP: c_int = 12;
3536 /// Argus
3537 pub const IPPROTO_ARGUS: c_int = 13;
3538 /// EMCON
3539 pub const IPPROTO_EMCON: c_int = 14;
3540 /// Cross Net Debugger
3541 pub const IPPROTO_XNET: c_int = 15;
3542 /// Chaos
3543 pub const IPPROTO_CHAOS: c_int = 16;
3544 // IPPROTO_UDP defined in src/unix/mod.rs
3545 /// Multiplexing
3546 pub const IPPROTO_MUX: c_int = 18;
3547 /// DCN Measurement Subsystems
3548 pub const IPPROTO_MEAS: c_int = 19;
3549 /// Host Monitoring
3550 pub const IPPROTO_HMP: c_int = 20;
3551 /// Packet Radio Measurement
3552 pub const IPPROTO_PRM: c_int = 21;
3553 /// xns idp
3554 pub const IPPROTO_IDP: c_int = 22;
3555 /// Trunk-1
3556 pub const IPPROTO_TRUNK1: c_int = 23;
3557 /// Trunk-2
3558 pub const IPPROTO_TRUNK2: c_int = 24;
3559 /// Leaf-1
3560 pub const IPPROTO_LEAF1: c_int = 25;
3561 /// Leaf-2
3562 pub const IPPROTO_LEAF2: c_int = 26;
3563 /// Reliable Data
3564 pub const IPPROTO_RDP: c_int = 27;
3565 /// Reliable Transaction
3566 pub const IPPROTO_IRTP: c_int = 28;
3567 /// tp-4 w/ class negotiation
3568 pub const IPPROTO_TP: c_int = 29;
3569 /// Bulk Data Transfer
3570 pub const IPPROTO_BLT: c_int = 30;
3571 /// Network Services
3572 pub const IPPROTO_NSP: c_int = 31;
3573 /// Merit Internodal
3574 pub const IPPROTO_INP: c_int = 32;
3575 #[doc(hidden)]
3576 #[deprecated(
3577 since = "0.2.72",
3578 note = "IPPROTO_SEP is deprecated. Use IPPROTO_DCCP instead"
3579 )]
3580 pub const IPPROTO_SEP: c_int = 33;
3581 /// Datagram Congestion Control Protocol
3582 pub const IPPROTO_DCCP: c_int = 33;
3583 /// Third Party Connect
3584 pub const IPPROTO_3PC: c_int = 34;
3585 /// InterDomain Policy Routing
3586 pub const IPPROTO_IDPR: c_int = 35;
3587 /// XTP
3588 pub const IPPROTO_XTP: c_int = 36;
3589 /// Datagram Delivery
3590 pub const IPPROTO_DDP: c_int = 37;
3591 /// Control Message Transport
3592 pub const IPPROTO_CMTP: c_int = 38;
3593 /// TP++ Transport
3594 pub const IPPROTO_TPXX: c_int = 39;
3595 /// IL transport protocol
3596 pub const IPPROTO_IL: c_int = 40;
3597 // IPPROTO_IPV6 defined in src/unix/mod.rs
3598 /// Source Demand Routing
3599 pub const IPPROTO_SDRP: c_int = 42;
3600 /// IP6 routing header
3601 pub const IPPROTO_ROUTING: c_int = 43;
3602 /// IP6 fragmentation header
3603 pub const IPPROTO_FRAGMENT: c_int = 44;
3604 /// InterDomain Routing
3605 pub const IPPROTO_IDRP: c_int = 45;
3606 /// resource reservation
3607 pub const IPPROTO_RSVP: c_int = 46;
3608 /// General Routing Encap.
3609 pub const IPPROTO_GRE: c_int = 47;
3610 /// Mobile Host Routing
3611 pub const IPPROTO_MHRP: c_int = 48;
3612 /// BHA
3613 pub const IPPROTO_BHA: c_int = 49;
3614 /// IP6 Encap Sec. Payload
3615 pub const IPPROTO_ESP: c_int = 50;
3616 /// IP6 Auth Header
3617 pub const IPPROTO_AH: c_int = 51;
3618 /// Integ. Net Layer Security
3619 pub const IPPROTO_INLSP: c_int = 52;
3620 /// IP with encryption
3621 pub const IPPROTO_SWIPE: c_int = 53;
3622 /// Next Hop Resolution
3623 pub const IPPROTO_NHRP: c_int = 54;
3624 /// IP Mobility
3625 pub const IPPROTO_MOBILE: c_int = 55;
3626 /// Transport Layer Security
3627 pub const IPPROTO_TLSP: c_int = 56;
3628 /// SKIP
3629 pub const IPPROTO_SKIP: c_int = 57;
3630 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
3631 /// IP6 no next header
3632 pub const IPPROTO_NONE: c_int = 59;
3633 /// IP6 destination option
3634 pub const IPPROTO_DSTOPTS: c_int = 60;
3635 /// any host internal protocol
3636 pub const IPPROTO_AHIP: c_int = 61;
3637 /// CFTP
3638 pub const IPPROTO_CFTP: c_int = 62;
3639 /// "hello" routing protocol
3640 pub const IPPROTO_HELLO: c_int = 63;
3641 /// SATNET/Backroom EXPAK
3642 pub const IPPROTO_SATEXPAK: c_int = 64;
3643 /// Kryptolan
3644 pub const IPPROTO_KRYPTOLAN: c_int = 65;
3645 /// Remote Virtual Disk
3646 pub const IPPROTO_RVD: c_int = 66;
3647 /// Pluribus Packet Core
3648 pub const IPPROTO_IPPC: c_int = 67;
3649 /// Any distributed FS
3650 pub const IPPROTO_ADFS: c_int = 68;
3651 /// Satnet Monitoring
3652 pub const IPPROTO_SATMON: c_int = 69;
3653 /// VISA Protocol
3654 pub const IPPROTO_VISA: c_int = 70;
3655 /// Packet Core Utility
3656 pub const IPPROTO_IPCV: c_int = 71;
3657 /// Comp. Prot. Net. Executive
3658 pub const IPPROTO_CPNX: c_int = 72;
3659 /// Comp. Prot. HeartBeat
3660 pub const IPPROTO_CPHB: c_int = 73;
3661 /// Wang Span Network
3662 pub const IPPROTO_WSN: c_int = 74;
3663 /// Packet Video Protocol
3664 pub const IPPROTO_PVP: c_int = 75;
3665 /// BackRoom SATNET Monitoring
3666 pub const IPPROTO_BRSATMON: c_int = 76;
3667 /// Sun net disk proto (temp.)
3668 pub const IPPROTO_ND: c_int = 77;
3669 /// WIDEBAND Monitoring
3670 pub const IPPROTO_WBMON: c_int = 78;
3671 /// WIDEBAND EXPAK
3672 pub const IPPROTO_WBEXPAK: c_int = 79;
3673 /// ISO cnlp
3674 pub const IPPROTO_EON: c_int = 80;
3675 /// VMTP
3676 pub const IPPROTO_VMTP: c_int = 81;
3677 /// Secure VMTP
3678 pub const IPPROTO_SVMTP: c_int = 82;
3679 /// Banyon VINES
3680 pub const IPPROTO_VINES: c_int = 83;
3681 /// TTP
3682 pub const IPPROTO_TTP: c_int = 84;
3683 /// NSFNET-IGP
3684 pub const IPPROTO_IGP: c_int = 85;
3685 /// dissimilar gateway prot.
3686 pub const IPPROTO_DGP: c_int = 86;
3687 /// TCF
3688 pub const IPPROTO_TCF: c_int = 87;
3689 /// Cisco/GXS IGRP
3690 pub const IPPROTO_IGRP: c_int = 88;
3691 /// OSPFIGP
3692 pub const IPPROTO_OSPFIGP: c_int = 89;
3693 /// Strite RPC protocol
3694 pub const IPPROTO_SRPC: c_int = 90;
3695 /// Locus Address Resoloution
3696 pub const IPPROTO_LARP: c_int = 91;
3697 /// Multicast Transport
3698 pub const IPPROTO_MTP: c_int = 92;
3699 /// AX.25 Frames
3700 pub const IPPROTO_AX25: c_int = 93;
3701 /// IP encapsulated in IP
3702 pub const IPPROTO_IPEIP: c_int = 94;
3703 /// Mobile Int.ing control
3704 pub const IPPROTO_MICP: c_int = 95;
3705 /// Semaphore Comm. security
3706 pub const IPPROTO_SCCSP: c_int = 96;
3707 /// Ethernet IP encapsulation
3708 pub const IPPROTO_ETHERIP: c_int = 97;
3709 /// encapsulation header
3710 pub const IPPROTO_ENCAP: c_int = 98;
3711 /// any private encr. scheme
3712 pub const IPPROTO_APES: c_int = 99;
3713 /// GMTP
3714 pub const IPPROTO_GMTP: c_int = 100;
3715 /// payload compression (IPComp)
3716 pub const IPPROTO_IPCOMP: c_int = 108;
3717 /// SCTP
3718 pub const IPPROTO_SCTP: c_int = 132;
3719 /// IPv6 Mobility Header
3720 pub const IPPROTO_MH: c_int = 135;
3721 /// UDP-Lite
3722 pub const IPPROTO_UDPLITE: c_int = 136;
3723 /// IP6 Host Identity Protocol
3724 pub const IPPROTO_HIP: c_int = 139;
3725 /// IP6 Shim6 Protocol
3726 pub const IPPROTO_SHIM6: c_int = 140;
3727
3728 /* 101-254: Partly Unassigned */
3729 /// Protocol Independent Mcast
3730 pub const IPPROTO_PIM: c_int = 103;
3731 /// CARP
3732 pub const IPPROTO_CARP: c_int = 112;
3733 /// PGM
3734 pub const IPPROTO_PGM: c_int = 113;
3735 /// MPLS-in-IP
3736 pub const IPPROTO_MPLS: c_int = 137;
3737 /// PFSYNC
3738 pub const IPPROTO_PFSYNC: c_int = 240;
3739
3740 /* 255: Reserved */
3741 /* BSD Private, local use, namespace incursion, no longer used */
3742 /// OLD divert pseudo-proto
3743 pub const IPPROTO_OLD_DIVERT: c_int = 254;
3744 pub const IPPROTO_MAX: c_int = 256;
3745 /// last return value of *_input(), meaning "all job for this pkt is done".
3746 pub const IPPROTO_DONE: c_int = 257;
3747
3748 /* Only used internally, so can be outside the range of valid IP protocols. */
3749 /// divert pseudo-protocol
3750 pub const IPPROTO_DIVERT: c_int = 258;
3751 /// SeND pseudo-protocol
3752 pub const IPPROTO_SEND: c_int = 259;
3753
3754 // sys/netinet/TCP.h
3755 pub const TCP_MD5SIG: c_int = 16;
3756 pub const TCP_INFO: c_int = 32;
3757 pub const TCP_CONGESTION: c_int = 64;
3758 pub const TCP_CCALGOOPT: c_int = 65;
3759 pub const TCP_MAXUNACKTIME: c_int = 68;
3760 #[deprecated(since = "0.2.160", note = "Removed in FreeBSD 15")]
3761 pub const TCP_MAXPEAKRATE: c_int = 69;
3762 pub const TCP_IDLE_REDUCE: c_int = 70;
3763 pub const TCP_REMOTE_UDP_ENCAPS_PORT: c_int = 71;
3764 pub const TCP_DELACK: c_int = 72;
3765 pub const TCP_FIN_IS_RST: c_int = 73;
3766 pub const TCP_LOG_LIMIT: c_int = 74;
3767 pub const TCP_SHARED_CWND_ALLOWED: c_int = 75;
3768 pub const TCP_PROC_ACCOUNTING: c_int = 76;
3769 pub const TCP_USE_CMP_ACKS: c_int = 77;
3770 pub const TCP_PERF_INFO: c_int = 78;
3771 pub const TCP_LRD: c_int = 79;
3772 pub const TCP_KEEPINIT: c_int = 128;
3773 pub const TCP_FASTOPEN: c_int = 1025;
3774 pub const TCP_PCAP_OUT: c_int = 2048;
3775 pub const TCP_PCAP_IN: c_int = 4096;
3776 pub const TCP_FUNCTION_BLK: c_int = 8192;
3777 pub const TCP_FUNCTION_ALIAS: c_int = 8193;
3778 pub const TCP_FASTOPEN_PSK_LEN: c_int = 16;
3779 pub const TCP_FUNCTION_NAME_LEN_MAX: c_int = 32;
3780
3781 pub const TCP_REUSPORT_LB_NUMA: c_int = 1026;
3782 pub const TCP_RACK_MBUF_QUEUE: c_int = 1050;
3783 pub const TCP_RACK_TLP_REDUCE: c_int = 1052;
3784 pub const TCP_RACK_PACE_MAX_SEG: c_int = 1054;
3785 pub const TCP_RACK_PACE_ALWAYS: c_int = 1055;
3786 pub const TCP_RACK_PRR_SENDALOT: c_int = 1057;
3787 pub const TCP_RACK_MIN_TO: c_int = 1058;
3788 pub const TCP_RACK_EARLY_SEG: c_int = 1060;
3789 pub const TCP_RACK_REORD_THRESH: c_int = 1061;
3790 pub const TCP_RACK_REORD_FADE: c_int = 1062;
3791 pub const TCP_RACK_TLP_THRESH: c_int = 1063;
3792 pub const TCP_RACK_PKT_DELAY: c_int = 1064;
3793 pub const TCP_BBR_IWINTSO: c_int = 1067;
3794 pub const TCP_BBR_STARTUP_PG: c_int = 1069;
3795 pub const TCP_BBR_DRAIN_PG: c_int = 1070;
3796 pub const TCP_BBR_PROBE_RTT_INT: c_int = 1072;
3797 pub const TCP_BBR_STARTUP_LOSS_EXIT: c_int = 1074;
3798 pub const TCP_BBR_TSLIMITS: c_int = 1076;
3799 pub const TCP_BBR_PACE_OH: c_int = 1077;
3800 pub const TCP_BBR_USEDEL_RATE: c_int = 1079;
3801 pub const TCP_BBR_MIN_RTO: c_int = 1080;
3802 pub const TCP_BBR_MAX_RTO: c_int = 1081;
3803 pub const TCP_BBR_ALGORITHM: c_int = 1083;
3804
3805 pub const IP_BINDANY: c_int = 24;
3806 pub const IP_BINDMULTI: c_int = 25;
3807 pub const IP_RSS_LISTEN_BUCKET: c_int = 26;
3808 pub const IP_ORIGDSTADDR: c_int = 27;
3809 pub const IP_RECVORIGDSTADDR: c_int = IP_ORIGDSTADDR;
3810
3811 pub const IP_DONTFRAG: c_int = 67;
3812 pub const IP_RECVTOS: c_int = 68;
3813
3814 pub const IPV6_BINDANY: c_int = 64;
3815 pub const IPV6_ORIGDSTADDR: c_int = 72;
3816 pub const IPV6_RECVORIGDSTADDR: c_int = IPV6_ORIGDSTADDR;
3817
3818 pub const PF_SLOW: c_int = AF_SLOW;
3819 pub const PF_SCLUSTER: c_int = AF_SCLUSTER;
3820 pub const PF_ARP: c_int = AF_ARP;
3821 pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
3822 pub const PF_IEEE80211: c_int = AF_IEEE80211;
3823 pub const PF_INET_SDP: c_int = AF_INET_SDP;
3824 pub const PF_INET6_SDP: c_int = AF_INET6_SDP;
3825
3826 pub const NET_RT_DUMP: c_int = 1;
3827 pub const NET_RT_FLAGS: c_int = 2;
3828 pub const NET_RT_IFLIST: c_int = 3;
3829 pub const NET_RT_IFMALIST: c_int = 4;
3830 pub const NET_RT_IFLISTL: c_int = 5;
3831
3832 // System V IPC
3833 pub const IPC_INFO: c_int = 3;
3834 pub const MSG_NOERROR: c_int = 0o10000;
3835 pub const SHM_LOCK: c_int = 11;
3836 pub const SHM_UNLOCK: c_int = 12;
3837 pub const SHM_STAT: c_int = 13;
3838 pub const SHM_INFO: c_int = 14;
3839 pub const SHM_ANON: *mut c_char = 1 as *mut c_char;
3840
3841 // The *_MAXID constants never should've been used outside of the
3842 // FreeBSD base system. And with the exception of CTL_P1003_1B_MAXID,
3843 // they were all removed in svn r262489. They remain here for backwards
3844 // compatibility only, and are scheduled to be removed in libc 1.0.0.
3845 #[doc(hidden)]
3846 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
3847 pub const CTL_MAXID: c_int = 10;
3848 #[doc(hidden)]
3849 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
3850 pub const KERN_MAXID: c_int = 38;
3851 #[doc(hidden)]
3852 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
3853 pub const HW_MAXID: c_int = 13;
3854 #[doc(hidden)]
3855 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
3856 pub const USER_MAXID: c_int = 21;
3857 #[doc(hidden)]
3858 #[deprecated(since = "0.2.74", note = "Removed in FreeBSD 13")]
3859 pub const CTL_P1003_1B_MAXID: c_int = 26;
3860
3861 pub const MSG_NOTIFICATION: c_int = 0x00002000;
3862 pub const MSG_NBIO: c_int = 0x00004000;
3863 pub const MSG_COMPAT: c_int = 0x00008000;
3864 pub const MSG_CMSG_CLOEXEC: c_int = 0x00040000;
3865 pub const MSG_NOSIGNAL: c_int = 0x20000;
3866 pub const MSG_WAITFORONE: c_int = 0x00080000;
3867
3868 // utmpx entry types
3869 pub const EMPTY: c_short = 0;
3870 pub const BOOT_TIME: c_short = 1;
3871 pub const OLD_TIME: c_short = 2;
3872 pub const NEW_TIME: c_short = 3;
3873 pub const USER_PROCESS: c_short = 4;
3874 pub const INIT_PROCESS: c_short = 5;
3875 pub const LOGIN_PROCESS: c_short = 6;
3876 pub const DEAD_PROCESS: c_short = 7;
3877 pub const SHUTDOWN_TIME: c_short = 8;
3878 // utmp database types
3879 pub const UTXDB_ACTIVE: c_int = 0;
3880 pub const UTXDB_LASTLOGIN: c_int = 1;
3881 pub const UTXDB_LOG: c_int = 2;
3882
3883 pub const LC_COLLATE_MASK: c_int = 1 << 0;
3884 pub const LC_CTYPE_MASK: c_int = 1 << 1;
3885 pub const LC_MONETARY_MASK: c_int = 1 << 2;
3886 pub const LC_NUMERIC_MASK: c_int = 1 << 3;
3887 pub const LC_TIME_MASK: c_int = 1 << 4;
3888 pub const LC_MESSAGES_MASK: c_int = 1 << 5;
3889 pub const LC_ALL_MASK: c_int = LC_COLLATE_MASK
3890 | LC_CTYPE_MASK
3891 | LC_MESSAGES_MASK
3892 | LC_MONETARY_MASK
3893 | LC_NUMERIC_MASK
3894 | LC_TIME_MASK;
3895
3896 pub const WSTOPPED: c_int = 2; // same as WUNTRACED
3897 pub const WCONTINUED: c_int = 4;
3898 pub const WNOWAIT: c_int = 8;
3899 pub const WEXITED: c_int = 16;
3900 pub const WTRAPPED: c_int = 32;
3901
3902 // FreeBSD defines a great many more of these, we only expose the
3903 // standardized ones.
3904 pub const P_PID: idtype_t = 0;
3905 pub const P_PGID: idtype_t = 2;
3906 pub const P_ALL: idtype_t = 7;
3907
3908 pub const UTIME_OMIT: c_long = -2;
3909 pub const UTIME_NOW: c_long = -1;
3910
3911 pub const B460800: crate::speed_t = 460800;
3912 pub const B921600: crate::speed_t = 921600;
3913
3914 pub const AT_FDCWD: c_int = -100;
3915 pub const AT_EACCESS: c_int = 0x100;
3916 pub const AT_SYMLINK_NOFOLLOW: c_int = 0x200;
3917 pub const AT_SYMLINK_FOLLOW: c_int = 0x400;
3918 pub const AT_REMOVEDIR: c_int = 0x800;
3919 pub const AT_RESOLVE_BENEATH: c_int = 0x2000;
3920 pub const AT_EMPTY_PATH: c_int = 0x4000;
3921
3922 pub const AT_NULL: c_int = 0;
3923 pub const AT_IGNORE: c_int = 1;
3924 pub const AT_EXECFD: c_int = 2;
3925 pub const AT_PHDR: c_int = 3;
3926 pub const AT_PHENT: c_int = 4;
3927 pub const AT_PHNUM: c_int = 5;
3928 pub const AT_PAGESZ: c_int = 6;
3929 pub const AT_BASE: c_int = 7;
3930 pub const AT_FLAGS: c_int = 8;
3931 pub const AT_ENTRY: c_int = 9;
3932 pub const AT_NOTELF: c_int = 10;
3933 pub const AT_UID: c_int = 11;
3934 pub const AT_EUID: c_int = 12;
3935 pub const AT_GID: c_int = 13;
3936 pub const AT_EGID: c_int = 14;
3937 pub const AT_EXECPATH: c_int = 15;
3938 pub const AT_CANARY: c_int = 16;
3939 pub const AT_OSRELDATE: c_int = 18;
3940 pub const AT_NCPUS: c_int = 19;
3941 pub const AT_PAGESIZES: c_int = 20;
3942 pub const AT_TIMEKEEP: c_int = 22;
3943 pub const AT_HWCAP: c_int = 25;
3944 pub const AT_HWCAP2: c_int = 26;
3945 pub const AT_USRSTACKBASE: c_int = 35;
3946 pub const AT_USRSTACKLIM: c_int = 36;
3947
3948 pub const TABDLY: crate::tcflag_t = 0x00000004;
3949 pub const TAB0: crate::tcflag_t = 0x00000000;
3950 pub const TAB3: crate::tcflag_t = 0x00000004;
3951
3952 pub const _PC_ACL_NFS4: c_int = 64;
3953
3954 pub const _SC_CPUSET_SIZE: c_int = 122;
3955
3956 pub const _UUID_NODE_LEN: usize = 6;
3957
3958 // Flags which can be passed to pdfork(2)
3959 pub const PD_DAEMON: c_int = 0x00000001;
3960 pub const PD_CLOEXEC: c_int = 0x00000002;
3961 pub const PD_ALLOWED_AT_FORK: c_int = PD_DAEMON | PD_CLOEXEC;
3962
3963 // Values for struct rtprio (type_ field)
3964 pub const RTP_PRIO_REALTIME: c_ushort = 2;
3965 pub const RTP_PRIO_NORMAL: c_ushort = 3;
3966 pub const RTP_PRIO_IDLE: c_ushort = 4;
3967
3968 // Flags for chflags(2)
3969 pub const UF_SYSTEM: c_ulong = 0x00000080;
3970 pub const UF_SPARSE: c_ulong = 0x00000100;
3971 pub const UF_OFFLINE: c_ulong = 0x00000200;
3972 pub const UF_REPARSE: c_ulong = 0x00000400;
3973 pub const UF_ARCHIVE: c_ulong = 0x00000800;
3974 pub const UF_READONLY: c_ulong = 0x00001000;
3975 pub const UF_HIDDEN: c_ulong = 0x00008000;
3976 pub const SF_SNAPSHOT: c_ulong = 0x00200000;
3977
3978 // fcntl commands
3979 pub const F_ADD_SEALS: c_int = 19;
3980 pub const F_GET_SEALS: c_int = 20;
3981 pub const F_OGETLK: c_int = 7;
3982 pub const F_OSETLK: c_int = 8;
3983 pub const F_OSETLKW: c_int = 9;
3984 pub const F_RDAHEAD: c_int = 16;
3985 pub const F_READAHEAD: c_int = 15;
3986 pub const F_SETLK_REMOTE: c_int = 14;
3987 pub const F_KINFO: c_int = 22;
3988
3989 // for use with F_ADD_SEALS
3990 pub const F_SEAL_GROW: c_int = 4;
3991 pub const F_SEAL_SEAL: c_int = 1;
3992 pub const F_SEAL_SHRINK: c_int = 2;
3993 pub const F_SEAL_WRITE: c_int = 8;
3994
3995 // for use with fspacectl
3996 pub const SPACECTL_DEALLOC: c_int = 1;
3997
3998 // For realhostname* api
3999 pub const HOSTNAME_FOUND: c_int = 0;
4000 pub const HOSTNAME_INCORRECTNAME: c_int = 1;
4001 pub const HOSTNAME_INVALIDADDR: c_int = 2;
4002 pub const HOSTNAME_INVALIDNAME: c_int = 3;
4003
4004 // For rfork
4005 pub const RFFDG: c_int = 4;
4006 pub const RFPROC: c_int = 16;
4007 pub const RFMEM: c_int = 32;
4008 pub const RFNOWAIT: c_int = 64;
4009 pub const RFCFDG: c_int = 4096;
4010 pub const RFTHREAD: c_int = 8192;
4011 pub const RFSIGSHARE: c_int = 16384;
4012 pub const RFLINUXTHPN: c_int = 65536;
4013 pub const RFTSIGZMB: c_int = 524288;
4014 pub const RFSPAWN: c_int = 2147483648;
4015
4016 // For eventfd
4017 pub const EFD_SEMAPHORE: c_int = 0x1;
4018 pub const EFD_NONBLOCK: c_int = 0x4;
4019 pub const EFD_CLOEXEC: c_int = 0x100000;
4020
4021 pub const MALLOCX_ZERO: c_int = 0x40;
4022
4023 /// size of returned wchan message
4024 pub const WMESGLEN: usize = 8;
4025 /// size of returned lock name
4026 pub const LOCKNAMELEN: usize = 8;
4027 /// size of returned thread name
4028 pub const TDNAMLEN: usize = 16;
4029 /// size of returned ki_comm name
4030 pub const COMMLEN: usize = 19;
4031 /// size of returned ki_emul
4032 pub const KI_EMULNAMELEN: usize = 16;
4033 /// number of groups in ki_groups
4034 pub const KI_NGROUPS: usize = 16;
4035 cfg_if! {
4036 if #[cfg(freebsd11)] {
4037 pub const KI_NSPARE_INT: usize = 4;
4038 } else {
4039 pub const KI_NSPARE_INT: usize = 2;
4040 }
4041 }
4042 pub const KI_NSPARE_LONG: usize = 12;
4043 /// Flags for the process credential.
4044 pub const KI_CRF_CAPABILITY_MODE: usize = 0x00000001;
4045 /// Steal a bit from ki_cr_flags to indicate that the cred had more than
4046 /// KI_NGROUPS groups.
4047 pub const KI_CRF_GRP_OVERFLOW: usize = 0x80000000;
4048 /// controlling tty vnode active
4049 pub const KI_CTTY: usize = 0x00000001;
4050 /// session leader
4051 pub const KI_SLEADER: usize = 0x00000002;
4052 /// proc blocked on lock ki_lockname
4053 pub const KI_LOCKBLOCK: usize = 0x00000004;
4054 /// size of returned ki_login
4055 pub const LOGNAMELEN: usize = 17;
4056 /// size of returned ki_loginclass
4057 pub const LOGINCLASSLEN: usize = 17;
4058
4059 pub const KF_ATTR_VALID: c_int = 0x0001;
4060 pub const KF_TYPE_NONE: c_int = 0;
4061 pub const KF_TYPE_VNODE: c_int = 1;
4062 pub const KF_TYPE_SOCKET: c_int = 2;
4063 pub const KF_TYPE_PIPE: c_int = 3;
4064 pub const KF_TYPE_FIFO: c_int = 4;
4065 pub const KF_TYPE_KQUEUE: c_int = 5;
4066 pub const KF_TYPE_MQUEUE: c_int = 7;
4067 pub const KF_TYPE_SHM: c_int = 8;
4068 pub const KF_TYPE_SEM: c_int = 9;
4069 pub const KF_TYPE_PTS: c_int = 10;
4070 pub const KF_TYPE_PROCDESC: c_int = 11;
4071 pub const KF_TYPE_DEV: c_int = 12;
4072 pub const KF_TYPE_UNKNOWN: c_int = 255;
4073
4074 pub const KF_VTYPE_VNON: c_int = 0;
4075 pub const KF_VTYPE_VREG: c_int = 1;
4076 pub const KF_VTYPE_VDIR: c_int = 2;
4077 pub const KF_VTYPE_VBLK: c_int = 3;
4078 pub const KF_VTYPE_VCHR: c_int = 4;
4079 pub const KF_VTYPE_VLNK: c_int = 5;
4080 pub const KF_VTYPE_VSOCK: c_int = 6;
4081 pub const KF_VTYPE_VFIFO: c_int = 7;
4082 pub const KF_VTYPE_VBAD: c_int = 8;
4083 pub const KF_VTYPE_UNKNOWN: c_int = 255;
4084
4085 /// Current working directory
4086 pub const KF_FD_TYPE_CWD: c_int = -1;
4087 /// Root directory
4088 pub const KF_FD_TYPE_ROOT: c_int = -2;
4089 /// Jail directory
4090 pub const KF_FD_TYPE_JAIL: c_int = -3;
4091 /// Ktrace vnode
4092 pub const KF_FD_TYPE_TRACE: c_int = -4;
4093 pub const KF_FD_TYPE_TEXT: c_int = -5;
4094 /// Controlling terminal
4095 pub const KF_FD_TYPE_CTTY: c_int = -6;
4096 pub const KF_FLAG_READ: c_int = 0x00000001;
4097 pub const KF_FLAG_WRITE: c_int = 0x00000002;
4098 pub const KF_FLAG_APPEND: c_int = 0x00000004;
4099 pub const KF_FLAG_ASYNC: c_int = 0x00000008;
4100 pub const KF_FLAG_FSYNC: c_int = 0x00000010;
4101 pub const KF_FLAG_NONBLOCK: c_int = 0x00000020;
4102 pub const KF_FLAG_DIRECT: c_int = 0x00000040;
4103 pub const KF_FLAG_HASLOCK: c_int = 0x00000080;
4104 pub const KF_FLAG_SHLOCK: c_int = 0x00000100;
4105 pub const KF_FLAG_EXLOCK: c_int = 0x00000200;
4106 pub const KF_FLAG_NOFOLLOW: c_int = 0x00000400;
4107 pub const KF_FLAG_CREAT: c_int = 0x00000800;
4108 pub const KF_FLAG_TRUNC: c_int = 0x00001000;
4109 pub const KF_FLAG_EXCL: c_int = 0x00002000;
4110 pub const KF_FLAG_EXEC: c_int = 0x00004000;
4111
4112 pub const KVME_TYPE_NONE: c_int = 0;
4113 pub const KVME_TYPE_DEFAULT: c_int = 1;
4114 pub const KVME_TYPE_VNODE: c_int = 2;
4115 pub const KVME_TYPE_SWAP: c_int = 3;
4116 pub const KVME_TYPE_DEVICE: c_int = 4;
4117 pub const KVME_TYPE_PHYS: c_int = 5;
4118 pub const KVME_TYPE_DEAD: c_int = 6;
4119 pub const KVME_TYPE_SG: c_int = 7;
4120 pub const KVME_TYPE_MGTDEVICE: c_int = 8;
4121 // Present in `sys/user.h` but is undefined for whatever reason...
4122 // pub const KVME_TYPE_GUARD: c_int = 9;
4123 pub const KVME_TYPE_UNKNOWN: c_int = 255;
4124 pub const KVME_PROT_READ: c_int = 0x00000001;
4125 pub const KVME_PROT_WRITE: c_int = 0x00000002;
4126 pub const KVME_PROT_EXEC: c_int = 0x00000004;
4127 pub const KVME_FLAG_COW: c_int = 0x00000001;
4128 pub const KVME_FLAG_NEEDS_COPY: c_int = 0x00000002;
4129 pub const KVME_FLAG_NOCOREDUMP: c_int = 0x00000004;
4130 pub const KVME_FLAG_SUPER: c_int = 0x00000008;
4131 pub const KVME_FLAG_GROWS_UP: c_int = 0x00000010;
4132 pub const KVME_FLAG_GROWS_DOWN: c_int = 0x00000020;
4133 pub const KVME_FLAG_USER_WIRED: c_int = 0x00000040;
4134
4135 pub const KKST_MAXLEN: c_int = 1024;
4136 /// Stack is valid.
4137 pub const KKST_STATE_STACKOK: c_int = 0;
4138 /// Stack swapped out.
4139 pub const KKST_STATE_SWAPPED: c_int = 1;
4140 pub const KKST_STATE_RUNNING: c_int = 2;
4141
4142 // Constants about priority.
4143 pub const PRI_MIN: c_int = 0;
4144 pub const PRI_MAX: c_int = 255;
4145 pub const PRI_MIN_ITHD: c_int = PRI_MIN;
4146 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4147 #[allow(deprecated)]
4148 pub const PRI_MAX_ITHD: c_int = PRI_MIN_REALTIME - 1;
4149 pub const PI_REALTIME: c_int = PRI_MIN_ITHD + 0;
4150 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4151 pub const PI_AV: c_int = PRI_MIN_ITHD + 4;
4152 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4153 pub const PI_NET: c_int = PRI_MIN_ITHD + 8;
4154 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4155 pub const PI_DISK: c_int = PRI_MIN_ITHD + 12;
4156 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4157 pub const PI_TTY: c_int = PRI_MIN_ITHD + 16;
4158 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4159 pub const PI_DULL: c_int = PRI_MIN_ITHD + 20;
4160 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4161 pub const PI_SOFT: c_int = PRI_MIN_ITHD + 24;
4162 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4163 pub const PRI_MIN_REALTIME: c_int = 48;
4164 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4165 #[allow(deprecated)]
4166 pub const PRI_MAX_REALTIME: c_int = PRI_MIN_KERN - 1;
4167 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4168 pub const PRI_MIN_KERN: c_int = 80;
4169 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4170 #[allow(deprecated)]
4171 pub const PRI_MAX_KERN: c_int = PRI_MIN_TIMESHARE - 1;
4172 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4173 #[allow(deprecated)]
4174 pub const PSWP: c_int = PRI_MIN_KERN + 0;
4175 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4176 #[allow(deprecated)]
4177 pub const PVM: c_int = PRI_MIN_KERN + 4;
4178 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4179 #[allow(deprecated)]
4180 pub const PINOD: c_int = PRI_MIN_KERN + 8;
4181 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4182 #[allow(deprecated)]
4183 pub const PRIBIO: c_int = PRI_MIN_KERN + 12;
4184 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4185 #[allow(deprecated)]
4186 pub const PVFS: c_int = PRI_MIN_KERN + 16;
4187 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4188 #[allow(deprecated)]
4189 pub const PZERO: c_int = PRI_MIN_KERN + 20;
4190 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4191 #[allow(deprecated)]
4192 pub const PSOCK: c_int = PRI_MIN_KERN + 24;
4193 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4194 #[allow(deprecated)]
4195 pub const PWAIT: c_int = PRI_MIN_KERN + 28;
4196 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4197 #[allow(deprecated)]
4198 pub const PLOCK: c_int = PRI_MIN_KERN + 32;
4199 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4200 #[allow(deprecated)]
4201 pub const PPAUSE: c_int = PRI_MIN_KERN + 36;
4202 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4203 pub const PRI_MIN_TIMESHARE: c_int = 120;
4204 pub const PRI_MAX_TIMESHARE: c_int = PRI_MIN_IDLE - 1;
4205 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4206 #[allow(deprecated)]
4207 pub const PUSER: c_int = PRI_MIN_TIMESHARE;
4208 pub const PRI_MIN_IDLE: c_int = 224;
4209 pub const PRI_MAX_IDLE: c_int = PRI_MAX;
4210
4211 pub const NZERO: c_int = 0;
4212
4213 // Resource utilization information.
4214 pub const RUSAGE_THREAD: c_int = 1;
4215
4216 cfg_if! {
4217 if #[cfg(any(freebsd11, target_pointer_width = "32"))] {
4218 pub const ARG_MAX: c_int = 256 * 1024;
4219 } else {
4220 pub const ARG_MAX: c_int = 2 * 256 * 1024;
4221 }
4222 }
4223 pub const CHILD_MAX: c_int = 40;
4224 /// max command name remembered
4225 pub const MAXCOMLEN: usize = 19;
4226 /// max interpreter file name length
4227 pub const MAXINTERP: c_int = crate::PATH_MAX;
4228 /// max login name length (incl. NUL)
4229 pub const MAXLOGNAME: c_int = 33;
4230 /// max simultaneous processes
4231 pub const MAXUPRC: c_int = CHILD_MAX;
4232 /// max bytes for an exec function
4233 pub const NCARGS: c_int = ARG_MAX;
4234 /// /* max number groups
4235 pub const NGROUPS: c_int = NGROUPS_MAX + 1;
4236 /// max open files per process
4237 pub const NOFILE: c_int = OPEN_MAX;
4238 /// marker for empty group set member
4239 pub const NOGROUP: c_int = 65535;
4240 /// max hostname size
4241 pub const MAXHOSTNAMELEN: c_int = 256;
4242 /// max bytes in term canon input line
4243 pub const MAX_CANON: c_int = 255;
4244 /// max bytes in terminal input
4245 pub const MAX_INPUT: c_int = 255;
4246 /// max bytes in a file name
4247 pub const NAME_MAX: c_int = 255;
4248 pub const MAXSYMLINKS: c_int = 32;
4249 /// max supplemental group id's
4250 pub const NGROUPS_MAX: c_int = 1023;
4251 /// max open files per process
4252 pub const OPEN_MAX: c_int = 64;
4253
4254 pub const _POSIX_ARG_MAX: c_int = 4096;
4255 pub const _POSIX_LINK_MAX: c_int = 8;
4256 pub const _POSIX_MAX_CANON: c_int = 255;
4257 pub const _POSIX_MAX_INPUT: c_int = 255;
4258 pub const _POSIX_NAME_MAX: c_int = 14;
4259 pub const _POSIX_PIPE_BUF: c_int = 512;
4260 pub const _POSIX_SSIZE_MAX: c_int = 32767;
4261 pub const _POSIX_STREAM_MAX: c_int = 8;
4262
4263 /// max ibase/obase values in bc(1)
4264 pub const BC_BASE_MAX: c_int = 99;
4265 /// max array elements in bc(1)
4266 pub const BC_DIM_MAX: c_int = 2048;
4267 /// max scale value in bc(1)
4268 pub const BC_SCALE_MAX: c_int = 99;
4269 /// max const string length in bc(1)
4270 pub const BC_STRING_MAX: c_int = 1000;
4271 /// max character class name size
4272 pub const CHARCLASS_NAME_MAX: c_int = 14;
4273 /// max weights for order keyword
4274 pub const COLL_WEIGHTS_MAX: c_int = 10;
4275 /// max expressions nested in expr(1)
4276 pub const EXPR_NEST_MAX: c_int = 32;
4277 /// max bytes in an input line
4278 pub const LINE_MAX: c_int = 2048;
4279 /// max RE's in interval notation
4280 pub const RE_DUP_MAX: c_int = 255;
4281
4282 pub const _POSIX2_BC_BASE_MAX: c_int = 99;
4283 pub const _POSIX2_BC_DIM_MAX: c_int = 2048;
4284 pub const _POSIX2_BC_SCALE_MAX: c_int = 99;
4285 pub const _POSIX2_BC_STRING_MAX: c_int = 1000;
4286 pub const _POSIX2_CHARCLASS_NAME_MAX: c_int = 14;
4287 pub const _POSIX2_COLL_WEIGHTS_MAX: c_int = 2;
4288 pub const _POSIX2_EQUIV_CLASS_MAX: c_int = 2;
4289 pub const _POSIX2_EXPR_NEST_MAX: c_int = 32;
4290 pub const _POSIX2_LINE_MAX: c_int = 2048;
4291 pub const _POSIX2_RE_DUP_MAX: c_int = 255;
4292
4293 // sys/proc.h
4294 pub const TDF_BORROWING: c_int = 0x00000001;
4295 pub const TDF_INPANIC: c_int = 0x00000002;
4296 pub const TDF_INMEM: c_int = 0x00000004;
4297 pub const TDF_SINTR: c_int = 0x00000008;
4298 pub const TDF_TIMEOUT: c_int = 0x00000010;
4299 pub const TDF_IDLETD: c_int = 0x00000020;
4300 pub const TDF_CANSWAP: c_int = 0x00000040;
4301 pub const TDF_KTH_SUSP: c_int = 0x00000100;
4302 pub const TDF_ALLPROCSUSP: c_int = 0x00000200;
4303 pub const TDF_BOUNDARY: c_int = 0x00000400;
4304 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4305 pub const TDF_ASTPENDING: c_int = 0x00000800;
4306 pub const TDF_SBDRY: c_int = 0x00002000;
4307 pub const TDF_UPIBLOCKED: c_int = 0x00004000;
4308 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4309 pub const TDF_NEEDSUSPCHK: c_int = 0x00008000;
4310 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4311 pub const TDF_NEEDRESCHED: c_int = 0x00010000;
4312 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4313 pub const TDF_NEEDSIGCHK: c_int = 0x00020000;
4314 pub const TDF_NOLOAD: c_int = 0x00040000;
4315 pub const TDF_SERESTART: c_int = 0x00080000;
4316 pub const TDF_THRWAKEUP: c_int = 0x00100000;
4317 pub const TDF_SEINTR: c_int = 0x00200000;
4318 pub const TDF_SWAPINREQ: c_int = 0x00400000;
4319 #[deprecated(since = "0.2.133", note = "Removed in FreeBSD 14")]
4320 pub const TDF_UNUSED23: c_int = 0x00800000;
4321 pub const TDF_SCHED0: c_int = 0x01000000;
4322 pub const TDF_SCHED1: c_int = 0x02000000;
4323 pub const TDF_SCHED2: c_int = 0x04000000;
4324 pub const TDF_SCHED3: c_int = 0x08000000;
4325 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4326 pub const TDF_ALRMPEND: c_int = 0x10000000;
4327 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4328 pub const TDF_PROFPEND: c_int = 0x20000000;
4329 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
4330 pub const TDF_MACPEND: c_int = 0x40000000;
4331
4332 pub const TDB_SUSPEND: c_int = 0x00000001;
4333 pub const TDB_XSIG: c_int = 0x00000002;
4334 pub const TDB_USERWR: c_int = 0x00000004;
4335 pub const TDB_SCE: c_int = 0x00000008;
4336 pub const TDB_SCX: c_int = 0x00000010;
4337 pub const TDB_EXEC: c_int = 0x00000020;
4338 pub const TDB_FORK: c_int = 0x00000040;
4339 pub const TDB_STOPATFORK: c_int = 0x00000080;
4340 pub const TDB_CHILD: c_int = 0x00000100;
4341 pub const TDB_BORN: c_int = 0x00000200;
4342 pub const TDB_EXIT: c_int = 0x00000400;
4343 pub const TDB_VFORK: c_int = 0x00000800;
4344 pub const TDB_FSTP: c_int = 0x00001000;
4345 pub const TDB_STEP: c_int = 0x00002000;
4346
4347 pub const TDP_OLDMASK: c_int = 0x00000001;
4348 pub const TDP_INKTR: c_int = 0x00000002;
4349 pub const TDP_INKTRACE: c_int = 0x00000004;
4350 pub const TDP_BUFNEED: c_int = 0x00000008;
4351 pub const TDP_COWINPROGRESS: c_int = 0x00000010;
4352 pub const TDP_ALTSTACK: c_int = 0x00000020;
4353 pub const TDP_DEADLKTREAT: c_int = 0x00000040;
4354 pub const TDP_NOFAULTING: c_int = 0x00000080;
4355 pub const TDP_OWEUPC: c_int = 0x00000200;
4356 pub const TDP_ITHREAD: c_int = 0x00000400;
4357 pub const TDP_SYNCIO: c_int = 0x00000800;
4358 pub const TDP_SCHED1: c_int = 0x00001000;
4359 pub const TDP_SCHED2: c_int = 0x00002000;
4360 pub const TDP_SCHED3: c_int = 0x00004000;
4361 pub const TDP_SCHED4: c_int = 0x00008000;
4362 pub const TDP_GEOM: c_int = 0x00010000;
4363 pub const TDP_SOFTDEP: c_int = 0x00020000;
4364 pub const TDP_NORUNNINGBUF: c_int = 0x00040000;
4365 pub const TDP_WAKEUP: c_int = 0x00080000;
4366 pub const TDP_INBDFLUSH: c_int = 0x00100000;
4367 pub const TDP_KTHREAD: c_int = 0x00200000;
4368 pub const TDP_CALLCHAIN: c_int = 0x00400000;
4369 pub const TDP_IGNSUSP: c_int = 0x00800000;
4370 pub const TDP_AUDITREC: c_int = 0x01000000;
4371 pub const TDP_RFPPWAIT: c_int = 0x02000000;
4372 pub const TDP_RESETSPUR: c_int = 0x04000000;
4373 pub const TDP_NERRNO: c_int = 0x08000000;
4374 pub const TDP_EXECVMSPC: c_int = 0x40000000;
4375
4376 pub const TDI_SUSPENDED: c_int = 0x0001;
4377 pub const TDI_SLEEPING: c_int = 0x0002;
4378 pub const TDI_SWAPPED: c_int = 0x0004;
4379 pub const TDI_LOCK: c_int = 0x0008;
4380 pub const TDI_IWAIT: c_int = 0x0010;
4381
4382 pub const P_ADVLOCK: c_int = 0x00000001;
4383 pub const P_CONTROLT: c_int = 0x00000002;
4384 pub const P_KPROC: c_int = 0x00000004;
4385 pub const P_UNUSED3: c_int = 0x00000008;
4386 pub const P_PPWAIT: c_int = 0x00000010;
4387 pub const P_PROFIL: c_int = 0x00000020;
4388 pub const P_STOPPROF: c_int = 0x00000040;
4389 pub const P_HADTHREADS: c_int = 0x00000080;
4390 pub const P_SUGID: c_int = 0x00000100;
4391 pub const P_SYSTEM: c_int = 0x00000200;
4392 pub const P_SINGLE_EXIT: c_int = 0x00000400;
4393 pub const P_TRACED: c_int = 0x00000800;
4394 pub const P_WAITED: c_int = 0x00001000;
4395 pub const P_WEXIT: c_int = 0x00002000;
4396 pub const P_EXEC: c_int = 0x00004000;
4397 pub const P_WKILLED: c_int = 0x00008000;
4398 pub const P_CONTINUED: c_int = 0x00010000;
4399 pub const P_STOPPED_SIG: c_int = 0x00020000;
4400 pub const P_STOPPED_TRACE: c_int = 0x00040000;
4401 pub const P_STOPPED_SINGLE: c_int = 0x00080000;
4402 pub const P_PROTECTED: c_int = 0x00100000;
4403 pub const P_SIGEVENT: c_int = 0x00200000;
4404 pub const P_SINGLE_BOUNDARY: c_int = 0x00400000;
4405 pub const P_HWPMC: c_int = 0x00800000;
4406 pub const P_JAILED: c_int = 0x01000000;
4407 pub const P_TOTAL_STOP: c_int = 0x02000000;
4408 pub const P_INEXEC: c_int = 0x04000000;
4409 pub const P_STATCHILD: c_int = 0x08000000;
4410 pub const P_INMEM: c_int = 0x10000000;
4411 pub const P_SWAPPINGOUT: c_int = 0x20000000;
4412 pub const P_SWAPPINGIN: c_int = 0x40000000;
4413 pub const P_PPTRACE: c_int = 0x80000000;
4414 pub const P_STOPPED: c_int = P_STOPPED_SIG | P_STOPPED_SINGLE | P_STOPPED_TRACE;
4415
4416 pub const P2_INHERIT_PROTECTED: c_int = 0x00000001;
4417 pub const P2_NOTRACE: c_int = 0x00000002;
4418 pub const P2_NOTRACE_EXEC: c_int = 0x00000004;
4419 pub const P2_AST_SU: c_int = 0x00000008;
4420 pub const P2_PTRACE_FSTP: c_int = 0x00000010;
4421 pub const P2_TRAPCAP: c_int = 0x00000020;
4422 pub const P2_STKGAP_DISABLE: c_int = 0x00000800;
4423 pub const P2_STKGAP_DISABLE_EXEC: c_int = 0x00001000;
4424
4425 pub const P_TREE_ORPHANED: c_int = 0x00000001;
4426 pub const P_TREE_FIRST_ORPHAN: c_int = 0x00000002;
4427 pub const P_TREE_REAPER: c_int = 0x00000004;
4428
4429 pub const SIDL: c_char = 1;
4430 pub const SRUN: c_char = 2;
4431 pub const SSLEEP: c_char = 3;
4432 pub const SSTOP: c_char = 4;
4433 pub const SZOMB: c_char = 5;
4434 pub const SWAIT: c_char = 6;
4435 pub const SLOCK: c_char = 7;
4436
4437 pub const P_MAGIC: c_int = 0xbeefface;
4438
4439 pub const TDP_SIGFASTBLOCK: c_int = 0x00000100;
4440 pub const TDP_UIOHELD: c_int = 0x10000000;
4441 pub const TDP_SIGFASTPENDING: c_int = 0x80000000;
4442 pub const TDP2_COMPAT32RB: c_int = 0x00000002;
4443 pub const P2_PROTMAX_ENABLE: c_int = 0x00000200;
4444 pub const P2_PROTMAX_DISABLE: c_int = 0x00000400;
4445 pub const TDP2_SBPAGES: c_int = 0x00000001;
4446 pub const P2_ASLR_ENABLE: c_int = 0x00000040;
4447 pub const P2_ASLR_DISABLE: c_int = 0x00000080;
4448 pub const P2_ASLR_IGNSTART: c_int = 0x00000100;
4449 pub const P_TREE_GRPEXITED: c_int = 0x00000008;
4450
4451 // libprocstat.h
4452 pub const PS_FST_VTYPE_VNON: c_int = 1;
4453 pub const PS_FST_VTYPE_VREG: c_int = 2;
4454 pub const PS_FST_VTYPE_VDIR: c_int = 3;
4455 pub const PS_FST_VTYPE_VBLK: c_int = 4;
4456 pub const PS_FST_VTYPE_VCHR: c_int = 5;
4457 pub const PS_FST_VTYPE_VLNK: c_int = 6;
4458 pub const PS_FST_VTYPE_VSOCK: c_int = 7;
4459 pub const PS_FST_VTYPE_VFIFO: c_int = 8;
4460 pub const PS_FST_VTYPE_VBAD: c_int = 9;
4461 pub const PS_FST_VTYPE_UNKNOWN: c_int = 255;
4462
4463 pub const PS_FST_TYPE_VNODE: c_int = 1;
4464 pub const PS_FST_TYPE_FIFO: c_int = 2;
4465 pub const PS_FST_TYPE_SOCKET: c_int = 3;
4466 pub const PS_FST_TYPE_PIPE: c_int = 4;
4467 pub const PS_FST_TYPE_PTS: c_int = 5;
4468 pub const PS_FST_TYPE_KQUEUE: c_int = 6;
4469 pub const PS_FST_TYPE_MQUEUE: c_int = 8;
4470 pub const PS_FST_TYPE_SHM: c_int = 9;
4471 pub const PS_FST_TYPE_SEM: c_int = 10;
4472 pub const PS_FST_TYPE_UNKNOWN: c_int = 11;
4473 pub const PS_FST_TYPE_NONE: c_int = 12;
4474 pub const PS_FST_TYPE_PROCDESC: c_int = 13;
4475 pub const PS_FST_TYPE_DEV: c_int = 14;
4476 pub const PS_FST_TYPE_EVENTFD: c_int = 15;
4477
4478 pub const PS_FST_UFLAG_RDIR: c_int = 0x0001;
4479 pub const PS_FST_UFLAG_CDIR: c_int = 0x0002;
4480 pub const PS_FST_UFLAG_JAIL: c_int = 0x0004;
4481 pub const PS_FST_UFLAG_TRACE: c_int = 0x0008;
4482 pub const PS_FST_UFLAG_TEXT: c_int = 0x0010;
4483 pub const PS_FST_UFLAG_MMAP: c_int = 0x0020;
4484 pub const PS_FST_UFLAG_CTTY: c_int = 0x0040;
4485
4486 pub const PS_FST_FFLAG_READ: c_int = 0x0001;
4487 pub const PS_FST_FFLAG_WRITE: c_int = 0x0002;
4488 pub const PS_FST_FFLAG_NONBLOCK: c_int = 0x0004;
4489 pub const PS_FST_FFLAG_APPEND: c_int = 0x0008;
4490 pub const PS_FST_FFLAG_SHLOCK: c_int = 0x0010;
4491 pub const PS_FST_FFLAG_EXLOCK: c_int = 0x0020;
4492 pub const PS_FST_FFLAG_ASYNC: c_int = 0x0040;
4493 pub const PS_FST_FFLAG_SYNC: c_int = 0x0080;
4494 pub const PS_FST_FFLAG_NOFOLLOW: c_int = 0x0100;
4495 pub const PS_FST_FFLAG_CREAT: c_int = 0x0200;
4496 pub const PS_FST_FFLAG_TRUNC: c_int = 0x0400;
4497 pub const PS_FST_FFLAG_EXCL: c_int = 0x0800;
4498 pub const PS_FST_FFLAG_DIRECT: c_int = 0x1000;
4499 pub const PS_FST_FFLAG_EXEC: c_int = 0x2000;
4500 pub const PS_FST_FFLAG_HASLOCK: c_int = 0x4000;
4501
4502 // sys/mount.h
4503
4504 /// File identifier.
4505 /// These are unique per filesystem on a single machine.
4506 ///
4507 /// Note that the offset of fid_data is 4 bytes, so care must be taken to avoid
4508 /// undefined behavior accessing unaligned fields within an embedded struct.
4509 pub const MAXFIDSZ: c_int = 16;
4510 /// Length of type name including null.
4511 pub const MFSNAMELEN: c_int = 16;
4512 cfg_if! {
4513 if #[cfg(any(freebsd10, freebsd11))] {
4514 /// Size of on/from name bufs.
4515 pub const MNAMELEN: c_int = 88;
4516 } else {
4517 /// Size of on/from name bufs.
4518 pub const MNAMELEN: c_int = 1024;
4519 }
4520 }
4521
4522 /// Using journaled soft updates.
4523 pub const MNT_SUJ: u64 = 0x100000000;
4524 /// Mounted by automountd(8).
4525 pub const MNT_AUTOMOUNTED: u64 = 0x200000000;
4526 /// Filesys metadata untrusted.
4527 pub const MNT_UNTRUSTED: u64 = 0x800000000;
4528
4529 /// Require TLS.
4530 pub const MNT_EXTLS: u64 = 0x4000000000;
4531 /// Require TLS with client cert.
4532 pub const MNT_EXTLSCERT: u64 = 0x8000000000;
4533 /// Require TLS with user cert.
4534 pub const MNT_EXTLSCERTUSER: u64 = 0x10000000000;
4535
4536 /// Filesystem is stored locally.
4537 pub const MNT_LOCAL: u64 = 0x000001000;
4538 /// Quotas are enabled on fs.
4539 pub const MNT_QUOTA: u64 = 0x000002000;
4540 /// Identifies the root fs.
4541 pub const MNT_ROOTFS: u64 = 0x000004000;
4542 /// Mounted by a user.
4543 pub const MNT_USER: u64 = 0x000008000;
4544 /// Do not show entry in df.
4545 pub const MNT_IGNORE: u64 = 0x000800000;
4546 /// Filesystem is verified.
4547 pub const MNT_VERIFIED: u64 = 0x400000000;
4548
4549 /// Do not cover a mount point.
4550 pub const MNT_NOCOVER: u64 = 0x001000000000;
4551 /// Only mount on empty dir.
4552 pub const MNT_EMPTYDIR: u64 = 0x002000000000;
4553 /// Recursively unmount uppers.
4554 pub const MNT_RECURSE: u64 = 0x100000000000;
4555 /// Unmount in async context.
4556 pub const MNT_DEFERRED: u64 = 0x200000000000;
4557
4558 /// Get configured filesystems.
4559 pub const VFS_VFSCONF: c_int = 0;
4560 /// Generic filesystem information.
4561 pub const VFS_GENERIC: c_int = 0;
4562
4563 /// int: highest defined filesystem type.
4564 pub const VFS_MAXTYPENUM: c_int = 1;
4565 /// struct: vfsconf for filesystem given as next argument.
4566 pub const VFS_CONF: c_int = 2;
4567
4568 /// Synchronously wait for I/O to complete.
4569 pub const MNT_WAIT: c_int = 1;
4570 /// Start all I/O, but do not wait for it.
4571 pub const MNT_NOWAIT: c_int = 2;
4572 /// Push data not written by filesystem syncer.
4573 pub const MNT_LAZY: c_int = 3;
4574 /// Suspend file system after sync.
4575 pub const MNT_SUSPEND: c_int = 4;
4576
4577 pub const MAXSECFLAVORS: c_int = 5;
4578
4579 /// Statically compiled into kernel.
4580 pub const VFCF_STATIC: c_int = 0x00010000;
4581 /// May get data over the network.
4582 pub const VFCF_NETWORK: c_int = 0x00020000;
4583 /// Writes are not implemented.
4584 pub const VFCF_READONLY: c_int = 0x00040000;
4585 /// Data does not represent real files.
4586 pub const VFCF_SYNTHETIC: c_int = 0x00080000;
4587 /// Aliases some other mounted FS.
4588 pub const VFCF_LOOPBACK: c_int = 0x00100000;
4589 /// Stores file names as Unicode.
4590 pub const VFCF_UNICODE: c_int = 0x00200000;
4591 /// Can be mounted from within a jail.
4592 pub const VFCF_JAIL: c_int = 0x00400000;
4593 /// Supports delegated administration.
4594 pub const VFCF_DELEGADMIN: c_int = 0x00800000;
4595 /// Stop at Boundary: defer stop requests to kernel->user (AST) transition.
4596 pub const VFCF_SBDRY: c_int = 0x01000000;
4597
4598 // time.h
4599
4600 /// not on dst
4601 pub const DST_NONE: c_int = 0;
4602 /// USA style dst
4603 pub const DST_USA: c_int = 1;
4604 /// Australian style dst
4605 pub const DST_AUST: c_int = 2;
4606 /// Western European dst
4607 pub const DST_WET: c_int = 3;
4608 /// Middle European dst
4609 pub const DST_MET: c_int = 4;
4610 /// Eastern European dst
4611 pub const DST_EET: c_int = 5;
4612 /// Canada
4613 pub const DST_CAN: c_int = 6;
4614
4615 pub const CPUCLOCK_WHICH_PID: c_int = 0;
4616 pub const CPUCLOCK_WHICH_TID: c_int = 1;
4617
4618 pub const MFD_CLOEXEC: c_uint = 0x00000001;
4619 pub const MFD_ALLOW_SEALING: c_uint = 0x00000002;
4620 pub const MFD_HUGETLB: c_uint = 0x00000004;
4621 pub const MFD_HUGE_MASK: c_uint = 0xFC000000;
4622 pub const MFD_HUGE_64KB: c_uint = 16 << 26;
4623 pub const MFD_HUGE_512KB: c_uint = 19 << 26;
4624 pub const MFD_HUGE_1MB: c_uint = 20 << 26;
4625 pub const MFD_HUGE_2MB: c_uint = 21 << 26;
4626 pub const MFD_HUGE_8MB: c_uint = 23 << 26;
4627 pub const MFD_HUGE_16MB: c_uint = 24 << 26;
4628 pub const MFD_HUGE_32MB: c_uint = 25 << 26;
4629 pub const MFD_HUGE_256MB: c_uint = 28 << 26;
4630 pub const MFD_HUGE_512MB: c_uint = 29 << 26;
4631 pub const MFD_HUGE_1GB: c_uint = 30 << 26;
4632 pub const MFD_HUGE_2GB: c_uint = 31 << 26;
4633 pub const MFD_HUGE_16GB: c_uint = 34 << 26;
4634
4635 pub const SHM_LARGEPAGE_ALLOC_DEFAULT: c_int = 0;
4636 pub const SHM_LARGEPAGE_ALLOC_NOWAIT: c_int = 1;
4637 pub const SHM_LARGEPAGE_ALLOC_HARD: c_int = 2;
4638 pub const SHM_RENAME_NOREPLACE: c_int = 1 << 0;
4639 pub const SHM_RENAME_EXCHANGE: c_int = 1 << 1;
4640
4641 // sys/umtx.h
4642
4643 pub const UMTX_OP_WAIT: c_int = 2;
4644 pub const UMTX_OP_WAKE: c_int = 3;
4645 pub const UMTX_OP_MUTEX_TRYLOCK: c_int = 4;
4646 pub const UMTX_OP_MUTEX_LOCK: c_int = 5;
4647 pub const UMTX_OP_MUTEX_UNLOCK: c_int = 6;
4648 pub const UMTX_OP_SET_CEILING: c_int = 7;
4649 pub const UMTX_OP_CV_WAIT: c_int = 8;
4650 pub const UMTX_OP_CV_SIGNAL: c_int = 9;
4651 pub const UMTX_OP_CV_BROADCAST: c_int = 10;
4652 pub const UMTX_OP_WAIT_UINT: c_int = 11;
4653 pub const UMTX_OP_RW_RDLOCK: c_int = 12;
4654 pub const UMTX_OP_RW_WRLOCK: c_int = 13;
4655 pub const UMTX_OP_RW_UNLOCK: c_int = 14;
4656 pub const UMTX_OP_WAIT_UINT_PRIVATE: c_int = 15;
4657 pub const UMTX_OP_WAKE_PRIVATE: c_int = 16;
4658 pub const UMTX_OP_MUTEX_WAIT: c_int = 17;
4659 pub const UMTX_OP_NWAKE_PRIVATE: c_int = 21;
4660 pub const UMTX_OP_MUTEX_WAKE2: c_int = 22;
4661 pub const UMTX_OP_SEM2_WAIT: c_int = 23;
4662 pub const UMTX_OP_SEM2_WAKE: c_int = 24;
4663 pub const UMTX_OP_SHM: c_int = 25;
4664 pub const UMTX_OP_ROBUST_LISTS: c_int = 26;
4665
4666 pub const UMTX_ABSTIME: u32 = 1;
4667
4668 pub const CPU_LEVEL_ROOT: c_int = 1;
4669 pub const CPU_LEVEL_CPUSET: c_int = 2;
4670 pub const CPU_LEVEL_WHICH: c_int = 3;
4671
4672 pub const CPU_WHICH_TID: c_int = 1;
4673 pub const CPU_WHICH_PID: c_int = 2;
4674 pub const CPU_WHICH_CPUSET: c_int = 3;
4675 pub const CPU_WHICH_IRQ: c_int = 4;
4676 pub const CPU_WHICH_JAIL: c_int = 5;
4677
4678 // net/route.h
4679 pub const RTF_LLDATA: c_int = 0x400;
4680 pub const RTF_FIXEDMTU: c_int = 0x80000;
4681
4682 pub const RTM_VERSION: c_int = 5;
4683
4684 pub const RTAX_MAX: c_int = 8;
4685
4686 // sys/signal.h
4687 pub const SIGTHR: c_int = 32;
4688 pub const SIGLWP: c_int = SIGTHR;
4689 pub const SIGLIBRT: c_int = 33;
4690
4691 // netinet/sctp.h
4692 pub const SCTP_FUTURE_ASSOC: c_int = 0;
4693 pub const SCTP_CURRENT_ASSOC: c_int = 1;
4694 pub const SCTP_ALL_ASSOC: c_int = 2;
4695
4696 pub const SCTP_NO_NEXT_MSG: c_int = 0x0000;
4697 pub const SCTP_NEXT_MSG_AVAIL: c_int = 0x0001;
4698 pub const SCTP_NEXT_MSG_ISCOMPLETE: c_int = 0x0002;
4699 pub const SCTP_NEXT_MSG_IS_UNORDERED: c_int = 0x0004;
4700 pub const SCTP_NEXT_MSG_IS_NOTIFICATION: c_int = 0x0008;
4701
4702 pub const SCTP_RECVV_NOINFO: c_int = 0;
4703 pub const SCTP_RECVV_RCVINFO: c_int = 1;
4704 pub const SCTP_RECVV_NXTINFO: c_int = 2;
4705 pub const SCTP_RECVV_RN: c_int = 3;
4706
4707 pub const SCTP_SENDV_NOINFO: c_int = 0;
4708 pub const SCTP_SENDV_SNDINFO: c_int = 1;
4709 pub const SCTP_SENDV_PRINFO: c_int = 2;
4710 pub const SCTP_SENDV_AUTHINFO: c_int = 3;
4711 pub const SCTP_SENDV_SPA: c_int = 4;
4712
4713 pub const SCTP_SEND_SNDINFO_VALID: c_int = 0x00000001;
4714 pub const SCTP_SEND_PRINFO_VALID: c_int = 0x00000002;
4715 pub const SCTP_SEND_AUTHINFO_VALID: c_int = 0x00000004;
4716
4717 pub const SCTP_NOTIFICATION: c_int = 0x0010;
4718 pub const SCTP_COMPLETE: c_int = 0x0020;
4719 pub const SCTP_EOF: c_int = 0x0100;
4720 pub const SCTP_ABORT: c_int = 0x0200;
4721 pub const SCTP_UNORDERED: c_int = 0x0400;
4722 pub const SCTP_ADDR_OVER: c_int = 0x0800;
4723 pub const SCTP_SENDALL: c_int = 0x1000;
4724 pub const SCTP_EOR: c_int = 0x2000;
4725 pub const SCTP_SACK_IMMEDIATELY: c_int = 0x4000;
4726 pub const SCTP_PR_SCTP_NONE: c_int = 0x0000;
4727 pub const SCTP_PR_SCTP_TTL: c_int = 0x0001;
4728 pub const SCTP_PR_SCTP_PRIO: c_int = 0x0002;
4729 pub const SCTP_PR_SCTP_BUF: c_int = SCTP_PR_SCTP_PRIO;
4730 pub const SCTP_PR_SCTP_RTX: c_int = 0x0003;
4731 pub const SCTP_PR_SCTP_MAX: c_int = SCTP_PR_SCTP_RTX;
4732 pub const SCTP_PR_SCTP_ALL: c_int = 0x000f;
4733
4734 pub const SCTP_INIT: c_int = 0x0001;
4735 pub const SCTP_SNDRCV: c_int = 0x0002;
4736 pub const SCTP_EXTRCV: c_int = 0x0003;
4737 pub const SCTP_SNDINFO: c_int = 0x0004;
4738 pub const SCTP_RCVINFO: c_int = 0x0005;
4739 pub const SCTP_NXTINFO: c_int = 0x0006;
4740 pub const SCTP_PRINFO: c_int = 0x0007;
4741 pub const SCTP_AUTHINFO: c_int = 0x0008;
4742 pub const SCTP_DSTADDRV4: c_int = 0x0009;
4743 pub const SCTP_DSTADDRV6: c_int = 0x000a;
4744
4745 pub const SCTP_RTOINFO: c_int = 0x00000001;
4746 pub const SCTP_ASSOCINFO: c_int = 0x00000002;
4747 pub const SCTP_INITMSG: c_int = 0x00000003;
4748 pub const SCTP_NODELAY: c_int = 0x00000004;
4749 pub const SCTP_AUTOCLOSE: c_int = 0x00000005;
4750 pub const SCTP_SET_PEER_PRIMARY_ADDR: c_int = 0x00000006;
4751 pub const SCTP_PRIMARY_ADDR: c_int = 0x00000007;
4752 pub const SCTP_ADAPTATION_LAYER: c_int = 0x00000008;
4753 pub const SCTP_ADAPTION_LAYER: c_int = 0x00000008;
4754 pub const SCTP_DISABLE_FRAGMENTS: c_int = 0x00000009;
4755 pub const SCTP_PEER_ADDR_PARAMS: c_int = 0x0000000a;
4756 pub const SCTP_DEFAULT_SEND_PARAM: c_int = 0x0000000b;
4757 pub const SCTP_EVENTS: c_int = 0x0000000c;
4758 pub const SCTP_I_WANT_MAPPED_V4_ADDR: c_int = 0x0000000d;
4759 pub const SCTP_MAXSEG: c_int = 0x0000000e;
4760 pub const SCTP_DELAYED_SACK: c_int = 0x0000000f;
4761 pub const SCTP_FRAGMENT_INTERLEAVE: c_int = 0x00000010;
4762 pub const SCTP_PARTIAL_DELIVERY_POINT: c_int = 0x00000011;
4763 pub const SCTP_AUTH_CHUNK: c_int = 0x00000012;
4764 pub const SCTP_AUTH_KEY: c_int = 0x00000013;
4765 pub const SCTP_HMAC_IDENT: c_int = 0x00000014;
4766 pub const SCTP_AUTH_ACTIVE_KEY: c_int = 0x00000015;
4767 pub const SCTP_AUTH_DELETE_KEY: c_int = 0x00000016;
4768 pub const SCTP_USE_EXT_RCVINFO: c_int = 0x00000017;
4769 pub const SCTP_AUTO_ASCONF: c_int = 0x00000018;
4770 pub const SCTP_MAXBURST: c_int = 0x00000019;
4771 pub const SCTP_MAX_BURST: c_int = 0x00000019;
4772 pub const SCTP_CONTEXT: c_int = 0x0000001a;
4773 pub const SCTP_EXPLICIT_EOR: c_int = 0x00000001b;
4774 pub const SCTP_REUSE_PORT: c_int = 0x00000001c;
4775 pub const SCTP_AUTH_DEACTIVATE_KEY: c_int = 0x00000001d;
4776 pub const SCTP_EVENT: c_int = 0x0000001e;
4777 pub const SCTP_RECVRCVINFO: c_int = 0x0000001f;
4778 pub const SCTP_RECVNXTINFO: c_int = 0x00000020;
4779 pub const SCTP_DEFAULT_SNDINFO: c_int = 0x00000021;
4780 pub const SCTP_DEFAULT_PRINFO: c_int = 0x00000022;
4781 pub const SCTP_PEER_ADDR_THLDS: c_int = 0x00000023;
4782 pub const SCTP_REMOTE_UDP_ENCAPS_PORT: c_int = 0x00000024;
4783 pub const SCTP_ECN_SUPPORTED: c_int = 0x00000025;
4784 pub const SCTP_AUTH_SUPPORTED: c_int = 0x00000027;
4785 pub const SCTP_ASCONF_SUPPORTED: c_int = 0x00000028;
4786 pub const SCTP_RECONFIG_SUPPORTED: c_int = 0x00000029;
4787 pub const SCTP_NRSACK_SUPPORTED: c_int = 0x00000030;
4788 pub const SCTP_PKTDROP_SUPPORTED: c_int = 0x00000031;
4789 pub const SCTP_MAX_CWND: c_int = 0x00000032;
4790
4791 pub const SCTP_STATUS: c_int = 0x00000100;
4792 pub const SCTP_GET_PEER_ADDR_INFO: c_int = 0x00000101;
4793 pub const SCTP_PEER_AUTH_CHUNKS: c_int = 0x00000102;
4794 pub const SCTP_LOCAL_AUTH_CHUNKS: c_int = 0x00000103;
4795 pub const SCTP_GET_ASSOC_NUMBER: c_int = 0x00000104;
4796 pub const SCTP_GET_ASSOC_ID_LIST: c_int = 0x00000105;
4797 pub const SCTP_TIMEOUTS: c_int = 0x00000106;
4798 pub const SCTP_PR_STREAM_STATUS: c_int = 0x00000107;
4799 pub const SCTP_PR_ASSOC_STATUS: c_int = 0x00000108;
4800
4801 pub const SCTP_COMM_UP: c_int = 0x0001;
4802 pub const SCTP_COMM_LOST: c_int = 0x0002;
4803 pub const SCTP_RESTART: c_int = 0x0003;
4804 pub const SCTP_SHUTDOWN_COMP: c_int = 0x0004;
4805 pub const SCTP_CANT_STR_ASSOC: c_int = 0x0005;
4806
4807 pub const SCTP_ASSOC_SUPPORTS_PR: c_int = 0x01;
4808 pub const SCTP_ASSOC_SUPPORTS_AUTH: c_int = 0x02;
4809 pub const SCTP_ASSOC_SUPPORTS_ASCONF: c_int = 0x03;
4810 pub const SCTP_ASSOC_SUPPORTS_MULTIBUF: c_int = 0x04;
4811 pub const SCTP_ASSOC_SUPPORTS_RE_CONFIG: c_int = 0x05;
4812 pub const SCTP_ASSOC_SUPPORTS_INTERLEAVING: c_int = 0x06;
4813 pub const SCTP_ASSOC_SUPPORTS_MAX: c_int = 0x06;
4814
4815 pub const SCTP_ADDR_AVAILABLE: c_int = 0x0001;
4816 pub const SCTP_ADDR_UNREACHABLE: c_int = 0x0002;
4817 pub const SCTP_ADDR_REMOVED: c_int = 0x0003;
4818 pub const SCTP_ADDR_ADDED: c_int = 0x0004;
4819 pub const SCTP_ADDR_MADE_PRIM: c_int = 0x0005;
4820 pub const SCTP_ADDR_CONFIRMED: c_int = 0x0006;
4821
4822 pub const SCTP_ACTIVE: c_int = 0x0001;
4823 pub const SCTP_INACTIVE: c_int = 0x0002;
4824 pub const SCTP_UNCONFIRMED: c_int = 0x0200;
4825
4826 pub const SCTP_DATA_UNSENT: c_int = 0x0001;
4827 pub const SCTP_DATA_SENT: c_int = 0x0002;
4828
4829 pub const SCTP_PARTIAL_DELIVERY_ABORTED: c_int = 0x0001;
4830
4831 pub const SCTP_AUTH_NEW_KEY: c_int = 0x0001;
4832 pub const SCTP_AUTH_NEWKEY: c_int = SCTP_AUTH_NEW_KEY;
4833 pub const SCTP_AUTH_NO_AUTH: c_int = 0x0002;
4834 pub const SCTP_AUTH_FREE_KEY: c_int = 0x0003;
4835
4836 pub const SCTP_STREAM_RESET_INCOMING_SSN: c_int = 0x0001;
4837 pub const SCTP_STREAM_RESET_OUTGOING_SSN: c_int = 0x0002;
4838 pub const SCTP_STREAM_RESET_DENIED: c_int = 0x0004;
4839 pub const SCTP_STREAM_RESET_FAILED: c_int = 0x0008;
4840
4841 pub const SCTP_ASSOC_RESET_DENIED: c_int = 0x0004;
4842 pub const SCTP_ASSOC_RESET_FAILED: c_int = 0x0008;
4843
4844 pub const SCTP_STREAM_CHANGE_DENIED: c_int = 0x0004;
4845 pub const SCTP_STREAM_CHANGE_FAILED: c_int = 0x0008;
4846
4847 pub const KENV_DUMP_LOADER: c_int = 4;
4848 pub const KENV_DUMP_STATIC: c_int = 5;
4849
4850 pub const RB_PAUSE: c_int = 0x100000;
4851 pub const RB_REROOT: c_int = 0x200000;
4852 pub const RB_POWERCYCLE: c_int = 0x400000;
4853 pub const RB_PROBE: c_int = 0x10000000;
4854 pub const RB_MULTIPLE: c_int = 0x20000000;
4855
4856 // sys/time.h
4857 pub const CLOCK_BOOTTIME: crate::clockid_t = crate::CLOCK_UPTIME;
4858 pub const CLOCK_REALTIME_COARSE: crate::clockid_t = crate::CLOCK_REALTIME_FAST;
4859 pub const CLOCK_MONOTONIC_COARSE: crate::clockid_t = crate::CLOCK_MONOTONIC_FAST;
4860
4861 // sys/timerfd.h
4862
4863 pub const TFD_NONBLOCK: c_int = crate::O_NONBLOCK;
4864 pub const TFD_CLOEXEC: c_int = O_CLOEXEC;
4865 pub const TFD_TIMER_ABSTIME: c_int = 0x01;
4866 pub const TFD_TIMER_CANCEL_ON_SET: c_int = 0x02;
4867
4868 // sys/unistd.h
4869
4870 pub const CLOSE_RANGE_CLOEXEC: c_uint = 1 << 2;
4871
4872 pub const KCMP_FILE: c_int = 100;
4873 pub const KCMP_FILEOBJ: c_int = 101;
4874 pub const KCMP_FILES: c_int = 102;
4875 pub const KCMP_SIGHAND: c_int = 103;
4876 pub const KCMP_VM: c_int = 104;
4877
4878 pub const fn MAP_ALIGNED(a: c_int) -> c_int {
4879 a << 24
4880 }
4881
4882 const_fn! {
4883 {const} fn _ALIGN(p: usize) -> usize {
4884 (p + _ALIGNBYTES) & !_ALIGNBYTES
4885 }
4886 }
4887
4888 f! {
4889 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
4890 (cmsg as *mut c_uchar).offset(_ALIGN(mem::size_of::<cmsghdr>()) as isize)
4891 }
4892
4893 pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
4894 _ALIGN(mem::size_of::<cmsghdr>()) as c_uint + length
4895 }
4896
4897 pub fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
4898 if cmsg.is_null() {
4899 return crate::CMSG_FIRSTHDR(mhdr);
4900 };
4901 let next =
4902 cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(mem::size_of::<cmsghdr>());
4903 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
4904 if next > max {
4905 0 as *mut cmsghdr
4906 } else {
4907 (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
4908 }
4909 }
4910
4911 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
4912 (_ALIGN(mem::size_of::<cmsghdr>()) + _ALIGN(length as usize)) as c_uint
4913 }
4914
4915 pub fn MALLOCX_ALIGN(lg: c_uint) -> c_int {
4916 ffsl(lg as c_long - 1)
4917 }
4918
4919 pub {const} fn MALLOCX_TCACHE(tc: c_int) -> c_int {
4920 (tc + 2) << 8 as c_int
4921 }
4922
4923 pub {const} fn MALLOCX_ARENA(a: c_int) -> c_int {
4924 (a + 1) << 20 as c_int
4925 }
4926
4927 pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
4928 let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 };
4929 mem::size_of::<sockcred>() + mem::size_of::<crate::gid_t>() * ngrps
4930 }
4931
4932 pub fn uname(buf: *mut crate::utsname) -> c_int {
4933 __xuname(256, buf as *mut c_void)
4934 }
4935
4936 pub fn CPU_ZERO(cpuset: &mut cpuset_t) -> () {
4937 for slot in cpuset.__bits.iter_mut() {
4938 *slot = 0;
4939 }
4940 }
4941
4942 pub fn CPU_FILL(cpuset: &mut cpuset_t) -> () {
4943 for slot in cpuset.__bits.iter_mut() {
4944 *slot = !0;
4945 }
4946 }
4947
4948 pub fn CPU_SET(cpu: usize, cpuset: &mut cpuset_t) -> () {
4949 let bitset_bits = 8 * mem::size_of::<c_long>();
4950 let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
4951 cpuset.__bits[idx] |= 1 << offset;
4952 ()
4953 }
4954
4955 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpuset_t) -> () {
4956 let bitset_bits = 8 * mem::size_of::<c_long>();
4957 let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
4958 cpuset.__bits[idx] &= !(1 << offset);
4959 ()
4960 }
4961
4962 pub fn CPU_ISSET(cpu: usize, cpuset: &cpuset_t) -> bool {
4963 let bitset_bits = 8 * mem::size_of::<c_long>();
4964 let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits);
4965 0 != cpuset.__bits[idx] & (1 << offset)
4966 }
4967
4968 pub fn CPU_COUNT(cpuset: &cpuset_t) -> c_int {
4969 let mut s: u32 = 0;
4970 let cpuset_size = mem::size_of::<cpuset_t>();
4971 let bitset_size = mem::size_of::<c_long>();
4972
4973 for i in cpuset.__bits[..(cpuset_size / bitset_size)].iter() {
4974 s += i.count_ones();
4975 }
4976 s as c_int
4977 }
4978
4979 pub fn SOCKCRED2SIZE(ngrps: usize) -> usize {
4980 let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 };
4981 mem::size_of::<sockcred2>() + mem::size_of::<crate::gid_t>() * ngrps
4982 }
4983
4984 pub fn PROT_MAX(x: c_int) -> c_int {
4985 x << 16
4986 }
4987
4988 pub fn PROT_MAX_EXTRACT(x: c_int) -> c_int {
4989 (x >> 16) & (crate::PROT_READ | crate::PROT_WRITE | crate::PROT_EXEC)
4990 }
4991 }
4992
4993 safe_f! {
4994 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
4995 (status & 0o177) != 0o177 && (status & 0o177) != 0 && status != 0x13
4996 }
4997
4998 pub {const} fn INVALID_SINFO_FLAG(x: c_int) -> bool {
4999 (x) & 0xfffffff0
5000 & !(SCTP_EOF
5001 | SCTP_ABORT
5002 | SCTP_UNORDERED
5003 | SCTP_ADDR_OVER
5004 | SCTP_SENDALL
5005 | SCTP_EOR
5006 | SCTP_SACK_IMMEDIATELY)
5007 != 0
5008 }
5009
5010 pub {const} fn PR_SCTP_POLICY(x: c_int) -> c_int {
5011 x & 0x0f
5012 }
5013
5014 pub {const} fn PR_SCTP_ENABLED(x: c_int) -> bool {
5015 PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE && PR_SCTP_POLICY(x) != SCTP_PR_SCTP_ALL
5016 }
5017
5018 pub {const} fn PR_SCTP_TTL_ENABLED(x: c_int) -> bool {
5019 PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL
5020 }
5021
5022 pub {const} fn PR_SCTP_BUF_ENABLED(x: c_int) -> bool {
5023 PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF
5024 }
5025
5026 pub {const} fn PR_SCTP_RTX_ENABLED(x: c_int) -> bool {
5027 PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX
5028 }
5029
5030 pub {const} fn PR_SCTP_INVALID_POLICY(x: c_int) -> bool {
5031 PR_SCTP_POLICY(x) > SCTP_PR_SCTP_MAX
5032 }
5033
5034 pub {const} fn PR_SCTP_VALID_POLICY(x: c_int) -> bool {
5035 PR_SCTP_POLICY(x) <= SCTP_PR_SCTP_MAX
5036 }
5037 }
5038
5039 cfg_if! {
5040 if #[cfg(not(any(freebsd10, freebsd11)))] {
5041 extern "C" {
5042 pub fn fhlink(fhp: *mut fhandle_t, to: *const c_char) -> c_int;
5043 pub fn fhlinkat(fhp: *mut fhandle_t, tofd: c_int, to: *const c_char) -> c_int;
5044 pub fn fhreadlink(fhp: *mut fhandle_t, buf: *mut c_char, bufsize: size_t) -> c_int;
5045 pub fn getfhat(fd: c_int, path: *mut c_char, fhp: *mut fhandle, flag: c_int) -> c_int;
5046 }
5047 }
5048 }
5049
5050 extern "C" {
5051 #[cfg_attr(doc, doc(alias = "__errno_location"))]
5052 #[cfg_attr(doc, doc(alias = "errno"))]
5053 pub fn __error() -> *mut c_int;
5054
5055 pub fn aio_cancel(fd: c_int, aiocbp: *mut aiocb) -> c_int;
5056 pub fn aio_error(aiocbp: *const aiocb) -> c_int;
5057 pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int;
5058 pub fn aio_read(aiocbp: *mut aiocb) -> c_int;
5059 pub fn aio_readv(aiocbp: *mut crate::aiocb) -> c_int;
5060 pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t;
5061 pub fn aio_suspend(
5062 aiocb_list: *const *const aiocb,
5063 nitems: c_int,
5064 timeout: *const crate::timespec,
5065 ) -> c_int;
5066 pub fn aio_write(aiocbp: *mut aiocb) -> c_int;
5067 pub fn aio_writev(aiocbp: *mut crate::aiocb) -> c_int;
5068
5069 pub fn copy_file_range(
5070 infd: c_int,
5071 inoffp: *mut off_t,
5072 outfd: c_int,
5073 outoffp: *mut off_t,
5074 len: size_t,
5075 flags: c_uint,
5076 ) -> ssize_t;
5077
5078 pub fn devname_r(
5079 dev: crate::dev_t,
5080 mode: crate::mode_t,
5081 buf: *mut c_char,
5082 len: c_int,
5083 ) -> *mut c_char;
5084
5085 pub fn extattr_delete_fd(fd: c_int, attrnamespace: c_int, attrname: *const c_char) -> c_int;
5086 pub fn extattr_delete_file(
5087 path: *const c_char,
5088 attrnamespace: c_int,
5089 attrname: *const c_char,
5090 ) -> c_int;
5091 pub fn extattr_delete_link(
5092 path: *const c_char,
5093 attrnamespace: c_int,
5094 attrname: *const c_char,
5095 ) -> c_int;
5096 pub fn extattr_get_fd(
5097 fd: c_int,
5098 attrnamespace: c_int,
5099 attrname: *const c_char,
5100 data: *mut c_void,
5101 nbytes: size_t,
5102 ) -> ssize_t;
5103 pub fn extattr_get_file(
5104 path: *const c_char,
5105 attrnamespace: c_int,
5106 attrname: *const c_char,
5107 data: *mut c_void,
5108 nbytes: size_t,
5109 ) -> ssize_t;
5110 pub fn extattr_get_link(
5111 path: *const c_char,
5112 attrnamespace: c_int,
5113 attrname: *const c_char,
5114 data: *mut c_void,
5115 nbytes: size_t,
5116 ) -> ssize_t;
5117 pub fn extattr_list_fd(
5118 fd: c_int,
5119 attrnamespace: c_int,
5120 data: *mut c_void,
5121 nbytes: size_t,
5122 ) -> ssize_t;
5123 pub fn extattr_list_file(
5124 path: *const c_char,
5125 attrnamespace: c_int,
5126 data: *mut c_void,
5127 nbytes: size_t,
5128 ) -> ssize_t;
5129 pub fn extattr_list_link(
5130 path: *const c_char,
5131 attrnamespace: c_int,
5132 data: *mut c_void,
5133 nbytes: size_t,
5134 ) -> ssize_t;
5135 pub fn extattr_set_fd(
5136 fd: c_int,
5137 attrnamespace: c_int,
5138 attrname: *const c_char,
5139 data: *const c_void,
5140 nbytes: size_t,
5141 ) -> ssize_t;
5142 pub fn extattr_set_file(
5143 path: *const c_char,
5144 attrnamespace: c_int,
5145 attrname: *const c_char,
5146 data: *const c_void,
5147 nbytes: size_t,
5148 ) -> ssize_t;
5149 pub fn extattr_set_link(
5150 path: *const c_char,
5151 attrnamespace: c_int,
5152 attrname: *const c_char,
5153 data: *const c_void,
5154 nbytes: size_t,
5155 ) -> ssize_t;
5156
5157 pub fn fspacectl(
5158 fd: c_int,
5159 cmd: c_int,
5160 rqsr: *const spacectl_range,
5161 flags: c_int,
5162 rmsr: *mut spacectl_range,
5163 ) -> c_int;
5164
5165 pub fn jail(jail: *mut crate::jail) -> c_int;
5166 pub fn jail_attach(jid: c_int) -> c_int;
5167 pub fn jail_remove(jid: c_int) -> c_int;
5168 pub fn jail_get(iov: *mut crate::iovec, niov: c_uint, flags: c_int) -> c_int;
5169 pub fn jail_set(iov: *mut crate::iovec, niov: c_uint, flags: c_int) -> c_int;
5170
5171 pub fn lio_listio(
5172 mode: c_int,
5173 aiocb_list: *const *mut aiocb,
5174 nitems: c_int,
5175 sevp: *mut sigevent,
5176 ) -> c_int;
5177
5178 pub fn getutxuser(user: *const c_char) -> *mut utmpx;
5179 pub fn setutxdb(_type: c_int, file: *const c_char) -> c_int;
5180
5181 pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut crate::timespec) -> ssize_t;
5182 pub fn mq_getfd_np(mqd: crate::mqd_t) -> c_int;
5183
5184 pub fn waitid(
5185 idtype: idtype_t,
5186 id: crate::id_t,
5187 infop: *mut crate::siginfo_t,
5188 options: c_int,
5189 ) -> c_int;
5190 pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
5191
5192 pub fn ftok(pathname: *const c_char, proj_id: c_int) -> crate::key_t;
5193 pub fn shmget(key: crate::key_t, size: size_t, shmflg: c_int) -> c_int;
5194 pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void;
5195 pub fn shmdt(shmaddr: *const c_void) -> c_int;
5196 pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int;
5197 pub fn semget(key: crate::key_t, nsems: c_int, semflg: c_int) -> c_int;
5198 pub fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) -> c_int;
5199 pub fn semop(semid: c_int, sops: *mut sembuf, nsops: size_t) -> c_int;
5200 pub fn msgctl(msqid: c_int, cmd: c_int, buf: *mut crate::msqid_ds) -> c_int;
5201 pub fn msgget(key: crate::key_t, msgflg: c_int) -> c_int;
5202 pub fn msgsnd(msqid: c_int, msgp: *const c_void, msgsz: size_t, msgflg: c_int) -> c_int;
5203 pub fn cfmakesane(termios: *mut crate::termios);
5204
5205 pub fn pdfork(fdp: *mut c_int, flags: c_int) -> crate::pid_t;
5206 pub fn pdgetpid(fd: c_int, pidp: *mut crate::pid_t) -> c_int;
5207 pub fn pdkill(fd: c_int, signum: c_int) -> c_int;
5208
5209 pub fn rtprio_thread(function: c_int, lwpid: crate::lwpid_t, rtp: *mut super::rtprio) -> c_int;
5210
5211 pub fn uuidgen(store: *mut uuid, count: c_int) -> c_int;
5212
5213 pub fn thr_kill(id: c_long, sig: c_int) -> c_int;
5214 pub fn thr_kill2(pid: crate::pid_t, id: c_long, sig: c_int) -> c_int;
5215 pub fn thr_self(tid: *mut c_long) -> c_int;
5216 pub fn pthread_getthreadid_np() -> c_int;
5217 pub fn pthread_getaffinity_np(
5218 td: crate::pthread_t,
5219 cpusetsize: size_t,
5220 cpusetp: *mut cpuset_t,
5221 ) -> c_int;
5222 pub fn pthread_setaffinity_np(
5223 td: crate::pthread_t,
5224 cpusetsize: size_t,
5225 cpusetp: *const cpuset_t,
5226 ) -> c_int;
5227
5228 // sched.h linux compatibility api
5229 pub fn sched_getaffinity(
5230 pid: crate::pid_t,
5231 cpusetsz: size_t,
5232 cpuset: *mut crate::cpuset_t,
5233 ) -> c_int;
5234 pub fn sched_setaffinity(
5235 pid: crate::pid_t,
5236 cpusetsz: size_t,
5237 cpuset: *const crate::cpuset_t,
5238 ) -> c_int;
5239 pub fn sched_getcpu() -> c_int;
5240
5241 pub fn pthread_mutex_consistent(mutex: *mut crate::pthread_mutex_t) -> c_int;
5242
5243 pub fn pthread_mutexattr_getrobust(
5244 attr: *mut crate::pthread_mutexattr_t,
5245 robust: *mut c_int,
5246 ) -> c_int;
5247 pub fn pthread_mutexattr_setrobust(
5248 attr: *mut crate::pthread_mutexattr_t,
5249 robust: c_int,
5250 ) -> c_int;
5251
5252 pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int;
5253 pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int;
5254 pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int;
5255 pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int;
5256 pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int;
5257
5258 #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "statfs@FBSD_1.0")]
5259 pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
5260 #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "fstatfs@FBSD_1.0")]
5261 pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
5262
5263 pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int;
5264 pub fn __xuname(nmln: c_int, buf: *mut c_void) -> c_int;
5265
5266 pub fn sendmmsg(
5267 sockfd: c_int,
5268 msgvec: *mut crate::mmsghdr,
5269 vlen: size_t,
5270 flags: c_int,
5271 ) -> ssize_t;
5272 pub fn recvmmsg(
5273 sockfd: c_int,
5274 msgvec: *mut crate::mmsghdr,
5275 vlen: size_t,
5276 flags: c_int,
5277 timeout: *const crate::timespec,
5278 ) -> ssize_t;
5279 pub fn memmem(
5280 haystack: *const c_void,
5281 haystacklen: size_t,
5282 needle: *const c_void,
5283 needlelen: size_t,
5284 ) -> *mut c_void;
5285
5286 pub fn fhopen(fhp: *const fhandle_t, flags: c_int) -> c_int;
5287 pub fn fhstat(fhp: *const fhandle, buf: *mut crate::stat) -> c_int;
5288 pub fn fhstatfs(fhp: *const fhandle_t, buf: *mut crate::statfs) -> c_int;
5289 pub fn getfh(path: *const c_char, fhp: *mut fhandle_t) -> c_int;
5290 pub fn lgetfh(path: *const c_char, fhp: *mut fhandle_t) -> c_int;
5291 pub fn getfsstat(buf: *mut crate::statfs, bufsize: c_long, mode: c_int) -> c_int;
5292 #[cfg_attr(
5293 all(target_os = "freebsd", freebsd11),
5294 link_name = "getmntinfo@FBSD_1.0"
5295 )]
5296 pub fn getmntinfo(mntbufp: *mut *mut crate::statfs, mode: c_int) -> c_int;
5297 pub fn mount(
5298 type_: *const c_char,
5299 dir: *const c_char,
5300 flags: c_int,
5301 data: *mut c_void,
5302 ) -> c_int;
5303 pub fn nmount(iov: *mut crate::iovec, niov: c_uint, flags: c_int) -> c_int;
5304
5305 pub fn setproctitle(fmt: *const c_char, ...);
5306 pub fn rfork(flags: c_int) -> c_int;
5307 pub fn cpuset_getaffinity(
5308 level: cpulevel_t,
5309 which: cpuwhich_t,
5310 id: crate::id_t,
5311 setsize: size_t,
5312 mask: *mut cpuset_t,
5313 ) -> c_int;
5314 pub fn cpuset_setaffinity(
5315 level: cpulevel_t,
5316 which: cpuwhich_t,
5317 id: crate::id_t,
5318 setsize: size_t,
5319 mask: *const cpuset_t,
5320 ) -> c_int;
5321 pub fn cpuset(setid: *mut crate::cpusetid_t) -> c_int;
5322 pub fn cpuset_getid(
5323 level: cpulevel_t,
5324 which: cpuwhich_t,
5325 id: crate::id_t,
5326 setid: *mut crate::cpusetid_t,
5327 ) -> c_int;
5328 pub fn cpuset_setid(which: cpuwhich_t, id: crate::id_t, setid: crate::cpusetid_t) -> c_int;
5329 pub fn cap_enter() -> c_int;
5330 pub fn cap_getmode(modep: *mut c_uint) -> c_int;
5331 pub fn cap_fcntls_get(fd: c_int, fcntlrightsp: *mut u32) -> c_int;
5332 pub fn cap_fcntls_limit(fd: c_int, fcntlrights: u32) -> c_int;
5333 pub fn cap_ioctls_get(fd: c_int, cmds: *mut u_long, maxcmds: usize) -> isize;
5334 pub fn cap_ioctls_limit(fd: c_int, cmds: *const u_long, ncmds: usize) -> c_int;
5335 pub fn __cap_rights_init(version: c_int, rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
5336 pub fn __cap_rights_get(version: c_int, fd: c_int, rightsp: *mut cap_rights_t) -> c_int;
5337 pub fn __cap_rights_set(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
5338 pub fn __cap_rights_clear(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
5339 pub fn __cap_rights_is_set(rights: *const cap_rights_t, ...) -> bool;
5340 pub fn cap_rights_is_valid(rights: *const cap_rights_t) -> bool;
5341 pub fn cap_rights_limit(fd: c_int, rights: *const cap_rights_t) -> c_int;
5342 pub fn cap_rights_merge(dst: *mut cap_rights_t, src: *const cap_rights_t) -> *mut cap_rights_t;
5343 pub fn cap_rights_remove(dst: *mut cap_rights_t, src: *const cap_rights_t)
5344 -> *mut cap_rights_t;
5345 pub fn cap_rights_contains(big: *const cap_rights_t, little: *const cap_rights_t) -> bool;
5346 pub fn cap_sandboxed() -> bool;
5347
5348 pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void;
5349
5350 pub fn ffs(value: c_int) -> c_int;
5351 pub fn ffsl(value: c_long) -> c_int;
5352 pub fn ffsll(value: c_longlong) -> c_int;
5353 pub fn fls(value: c_int) -> c_int;
5354 pub fn flsl(value: c_long) -> c_int;
5355 pub fn flsll(value: c_longlong) -> c_int;
5356 pub fn malloc_stats_print(
5357 write_cb: unsafe extern "C" fn(*mut c_void, *const c_char),
5358 cbopaque: *mut c_void,
5359 opt: *const c_char,
5360 );
5361 pub fn mallctl(
5362 name: *const c_char,
5363 oldp: *mut c_void,
5364 oldlenp: *mut size_t,
5365 newp: *mut c_void,
5366 newlen: size_t,
5367 ) -> c_int;
5368 pub fn mallctlnametomib(name: *const c_char, mibp: *mut size_t, miplen: *mut size_t) -> c_int;
5369 pub fn mallctlbymib(
5370 mib: *const size_t,
5371 mible: size_t,
5372 oldp: *mut c_void,
5373 oldlenp: *mut size_t,
5374 newp: *mut c_void,
5375 newlen: size_t,
5376 ) -> c_int;
5377 pub fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
5378 pub fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
5379 pub fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
5380 pub fn sallocx(ptr: *const c_void, flags: c_int) -> size_t;
5381 pub fn dallocx(ptr: *mut c_void, flags: c_int);
5382 pub fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
5383 pub fn nallocx(size: size_t, flags: c_int) -> size_t;
5384
5385 pub fn procctl(
5386 idtype: crate::idtype_t,
5387 id: crate::id_t,
5388 cmd: c_int,
5389 data: *mut c_void,
5390 ) -> c_int;
5391
5392 pub fn getpagesize() -> c_int;
5393 pub fn getpagesizes(pagesize: *mut size_t, nelem: c_int) -> c_int;
5394
5395 pub fn clock_getcpuclockid2(arg1: crate::id_t, arg2: c_int, arg3: *mut clockid_t) -> c_int;
5396 pub fn strchrnul(s: *const c_char, c: c_int) -> *mut c_char;
5397
5398 pub fn shm_create_largepage(
5399 path: *const c_char,
5400 flags: c_int,
5401 psind: c_int,
5402 alloc_policy: c_int,
5403 mode: crate::mode_t,
5404 ) -> c_int;
5405 pub fn shm_rename(path_from: *const c_char, path_to: *const c_char, flags: c_int) -> c_int;
5406 pub fn memfd_create(name: *const c_char, flags: c_uint) -> c_int;
5407 pub fn setaudit(auditinfo: *const auditinfo_t) -> c_int;
5408
5409 pub fn eventfd(init: c_uint, flags: c_int) -> c_int;
5410 pub fn eventfd_read(fd: c_int, value: *mut eventfd_t) -> c_int;
5411 pub fn eventfd_write(fd: c_int, value: eventfd_t) -> c_int;
5412
5413 pub fn fdatasync(fd: c_int) -> c_int;
5414
5415 pub fn elf_aux_info(aux: c_int, buf: *mut c_void, buflen: c_int) -> c_int;
5416 pub fn setproctitle_fast(fmt: *const c_char, ...);
5417 pub fn timingsafe_bcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
5418 pub fn timingsafe_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
5419
5420 pub fn _umtx_op(
5421 obj: *mut c_void,
5422 op: c_int,
5423 val: c_ulong,
5424 uaddr: *mut c_void,
5425 uaddr2: *mut c_void,
5426 ) -> c_int;
5427
5428 pub fn sctp_peeloff(s: c_int, id: crate::sctp_assoc_t) -> c_int;
5429 pub fn sctp_bindx(s: c_int, addrs: *mut crate::sockaddr, num: c_int, tpe: c_int) -> c_int;
5430 pub fn sctp_connectx(
5431 s: c_int,
5432 addrs: *const crate::sockaddr,
5433 addrcnt: c_int,
5434 id: *mut crate::sctp_assoc_t,
5435 ) -> c_int;
5436 pub fn sctp_getaddrlen(family: crate::sa_family_t) -> c_int;
5437 pub fn sctp_getpaddrs(
5438 s: c_int,
5439 asocid: crate::sctp_assoc_t,
5440 addrs: *mut *mut crate::sockaddr,
5441 ) -> c_int;
5442 pub fn sctp_freepaddrs(addrs: *mut crate::sockaddr);
5443 pub fn sctp_getladdrs(
5444 s: c_int,
5445 asocid: crate::sctp_assoc_t,
5446 addrs: *mut *mut crate::sockaddr,
5447 ) -> c_int;
5448 pub fn sctp_freeladdrs(addrs: *mut crate::sockaddr);
5449 pub fn sctp_opt_info(
5450 s: c_int,
5451 id: crate::sctp_assoc_t,
5452 opt: c_int,
5453 arg: *mut c_void,
5454 size: *mut crate::socklen_t,
5455 ) -> c_int;
5456 pub fn sctp_sendv(
5457 sd: c_int,
5458 iov: *const crate::iovec,
5459 iovcnt: c_int,
5460 addrs: *mut crate::sockaddr,
5461 addrcnt: c_int,
5462 info: *mut c_void,
5463 infolen: crate::socklen_t,
5464 infotype: c_uint,
5465 flags: c_int,
5466 ) -> ssize_t;
5467 pub fn sctp_recvv(
5468 sd: c_int,
5469 iov: *const crate::iovec,
5470 iovcnt: c_int,
5471 from: *mut crate::sockaddr,
5472 fromlen: *mut crate::socklen_t,
5473 info: *mut c_void,
5474 infolen: *mut crate::socklen_t,
5475 infotype: *mut c_uint,
5476 flags: *mut c_int,
5477 ) -> ssize_t;
5478
5479 pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int;
5480 pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int;
5481 pub fn timerfd_settime(
5482 fd: c_int,
5483 flags: c_int,
5484 new_value: *const itimerspec,
5485 old_value: *mut itimerspec,
5486 ) -> c_int;
5487 pub fn closefrom(lowfd: c_int);
5488 pub fn close_range(lowfd: c_uint, highfd: c_uint, flags: c_int) -> c_int;
5489
5490 pub fn execvpe(
5491 file: *const c_char,
5492 argv: *const *const c_char,
5493 envp: *const *const c_char,
5494 ) -> c_int;
5495
5496 pub fn kcmp(
5497 pid1: crate::pid_t,
5498 pid2: crate::pid_t,
5499 type_: c_int,
5500 idx1: c_ulong,
5501 idx2: c_ulong,
5502 ) -> c_int;
5503 }
5504
5505 #[link(name = "memstat")]
5506 extern "C" {
5507 pub fn memstat_strerror(error: c_int) -> *const c_char;
5508 pub fn memstat_mtl_alloc() -> *mut memory_type_list;
5509 pub fn memstat_mtl_first(list: *mut memory_type_list) -> *mut memory_type;
5510 pub fn memstat_mtl_next(mtp: *mut memory_type) -> *mut memory_type;
5511 pub fn memstat_mtl_find(
5512 list: *mut memory_type_list,
5513 allocator: c_int,
5514 name: *const c_char,
5515 ) -> *mut memory_type;
5516 pub fn memstat_mtl_free(list: *mut memory_type_list);
5517 pub fn memstat_mtl_geterror(list: *mut memory_type_list) -> c_int;
5518 pub fn memstat_get_name(mtp: *const memory_type) -> *const c_char;
5519 }
5520
5521 #[link(name = "kvm")]
5522 extern "C" {
5523 pub fn kvm_dpcpu_setcpu(kd: *mut crate::kvm_t, cpu: c_uint) -> c_int;
5524 pub fn kvm_getargv(
5525 kd: *mut crate::kvm_t,
5526 p: *const kinfo_proc,
5527 nchr: c_int,
5528 ) -> *mut *mut c_char;
5529 pub fn kvm_getcptime(kd: *mut crate::kvm_t, cp_time: *mut c_long) -> c_int;
5530 pub fn kvm_getenvv(
5531 kd: *mut crate::kvm_t,
5532 p: *const kinfo_proc,
5533 nchr: c_int,
5534 ) -> *mut *mut c_char;
5535 pub fn kvm_geterr(kd: *mut crate::kvm_t) -> *mut c_char;
5536 pub fn kvm_getmaxcpu(kd: *mut crate::kvm_t) -> c_int;
5537 pub fn kvm_getncpus(kd: *mut crate::kvm_t) -> c_int;
5538 pub fn kvm_getpcpu(kd: *mut crate::kvm_t, cpu: c_int) -> *mut c_void;
5539 pub fn kvm_counter_u64_fetch(kd: *mut crate::kvm_t, base: c_ulong) -> u64;
5540 pub fn kvm_getswapinfo(
5541 kd: *mut crate::kvm_t,
5542 info: *mut kvm_swap,
5543 maxswap: c_int,
5544 flags: c_int,
5545 ) -> c_int;
5546 pub fn kvm_native(kd: *mut crate::kvm_t) -> c_int;
5547 pub fn kvm_nlist(kd: *mut crate::kvm_t, nl: *mut nlist) -> c_int;
5548 pub fn kvm_nlist2(kd: *mut crate::kvm_t, nl: *mut kvm_nlist) -> c_int;
5549 pub fn kvm_read_zpcpu(
5550 kd: *mut crate::kvm_t,
5551 base: c_ulong,
5552 buf: *mut c_void,
5553 size: size_t,
5554 cpu: c_int,
5555 ) -> ssize_t;
5556 pub fn kvm_read2(
5557 kd: *mut crate::kvm_t,
5558 addr: kvaddr_t,
5559 buf: *mut c_void,
5560 nbytes: size_t,
5561 ) -> ssize_t;
5562 }
5563
5564 #[link(name = "util")]
5565 extern "C" {
5566 pub fn extattr_namespace_to_string(attrnamespace: c_int, string: *mut *mut c_char) -> c_int;
5567 pub fn extattr_string_to_namespace(string: *const c_char, attrnamespace: *mut c_int) -> c_int;
5568 pub fn realhostname(host: *mut c_char, hsize: size_t, ip: *const crate::in_addr) -> c_int;
5569 pub fn realhostname_sa(
5570 host: *mut c_char,
5571 hsize: size_t,
5572 addr: *mut crate::sockaddr,
5573 addrlen: c_int,
5574 ) -> c_int;
5575
5576 pub fn kld_isloaded(name: *const c_char) -> c_int;
5577 pub fn kld_load(name: *const c_char) -> c_int;
5578
5579 pub fn kinfo_getvmmap(pid: crate::pid_t, cntp: *mut c_int) -> *mut kinfo_vmentry;
5580
5581 pub fn hexdump(ptr: *const c_void, length: c_int, hdr: *const c_char, flags: c_int);
5582 pub fn humanize_number(
5583 buf: *mut c_char,
5584 len: size_t,
5585 number: i64,
5586 suffix: *const c_char,
5587 scale: c_int,
5588 flags: c_int,
5589 ) -> c_int;
5590
5591 pub fn flopen(path: *const c_char, flags: c_int, ...) -> c_int;
5592 pub fn flopenat(fd: c_int, path: *const c_char, flags: c_int, ...) -> c_int;
5593
5594 pub fn getlocalbase() -> *const c_char;
5595
5596 pub fn pidfile_open(
5597 path: *const c_char,
5598 mode: crate::mode_t,
5599 pidptr: *mut crate::pid_t,
5600 ) -> *mut crate::pidfh;
5601 pub fn pidfile_write(path: *mut crate::pidfh) -> c_int;
5602 pub fn pidfile_close(path: *mut crate::pidfh) -> c_int;
5603 pub fn pidfile_remove(path: *mut crate::pidfh) -> c_int;
5604 pub fn pidfile_fileno(path: *const crate::pidfh) -> c_int;
5605 // FIXME(freebsd): pidfile_signal in due time (both manpage present and updated image snapshot)
5606 }
5607
5608 #[link(name = "procstat")]
5609 extern "C" {
5610 pub fn procstat_open_sysctl() -> *mut procstat;
5611 pub fn procstat_getfiles(
5612 procstat: *mut procstat,
5613 kp: *mut kinfo_proc,
5614 mmapped: c_int,
5615 ) -> *mut filestat_list;
5616 pub fn procstat_freefiles(procstat: *mut procstat, head: *mut filestat_list);
5617 pub fn procstat_getprocs(
5618 procstat: *mut procstat,
5619 what: c_int,
5620 arg: c_int,
5621 count: *mut c_uint,
5622 ) -> *mut kinfo_proc;
5623 pub fn procstat_freeprocs(procstat: *mut procstat, p: *mut kinfo_proc);
5624 pub fn procstat_getvmmap(
5625 procstat: *mut procstat,
5626 kp: *mut kinfo_proc,
5627 count: *mut c_uint,
5628 ) -> *mut kinfo_vmentry;
5629 pub fn procstat_freevmmap(procstat: *mut procstat, vmmap: *mut kinfo_vmentry);
5630 pub fn procstat_close(procstat: *mut procstat);
5631 pub fn procstat_freeargv(procstat: *mut procstat);
5632 pub fn procstat_freeenvv(procstat: *mut procstat);
5633 pub fn procstat_freegroups(procstat: *mut procstat, groups: *mut crate::gid_t);
5634 pub fn procstat_freeptlwpinfo(procstat: *mut procstat, pl: *mut ptrace_lwpinfo);
5635 pub fn procstat_getargv(
5636 procstat: *mut procstat,
5637 kp: *mut kinfo_proc,
5638 nchr: size_t,
5639 ) -> *mut *mut c_char;
5640 pub fn procstat_getenvv(
5641 procstat: *mut procstat,
5642 kp: *mut kinfo_proc,
5643 nchr: size_t,
5644 ) -> *mut *mut c_char;
5645 pub fn procstat_getgroups(
5646 procstat: *mut procstat,
5647 kp: *mut kinfo_proc,
5648 count: *mut c_uint,
5649 ) -> *mut crate::gid_t;
5650 pub fn procstat_getosrel(
5651 procstat: *mut procstat,
5652 kp: *mut kinfo_proc,
5653 osrelp: *mut c_int,
5654 ) -> c_int;
5655 pub fn procstat_getpathname(
5656 procstat: *mut procstat,
5657 kp: *mut kinfo_proc,
5658 pathname: *mut c_char,
5659 maxlen: size_t,
5660 ) -> c_int;
5661 pub fn procstat_getrlimit(
5662 procstat: *mut procstat,
5663 kp: *mut kinfo_proc,
5664 which: c_int,
5665 rlimit: *mut crate::rlimit,
5666 ) -> c_int;
5667 pub fn procstat_getumask(
5668 procstat: *mut procstat,
5669 kp: *mut kinfo_proc,
5670 maskp: *mut c_ushort,
5671 ) -> c_int;
5672 pub fn procstat_open_core(filename: *const c_char) -> *mut procstat;
5673 pub fn procstat_open_kvm(nlistf: *const c_char, memf: *const c_char) -> *mut procstat;
5674 pub fn procstat_get_socket_info(
5675 proc_: *mut procstat,
5676 fst: *mut filestat,
5677 sock: *mut sockstat,
5678 errbuf: *mut c_char,
5679 ) -> c_int;
5680 pub fn procstat_get_vnode_info(
5681 proc_: *mut procstat,
5682 fst: *mut filestat,
5683 vn: *mut vnstat,
5684 errbuf: *mut c_char,
5685 ) -> c_int;
5686 pub fn procstat_get_pts_info(
5687 proc_: *mut procstat,
5688 fst: *mut filestat,
5689 pts: *mut ptsstat,
5690 errbuf: *mut c_char,
5691 ) -> c_int;
5692 pub fn procstat_get_shm_info(
5693 proc_: *mut procstat,
5694 fst: *mut filestat,
5695 shm: *mut shmstat,
5696 errbuf: *mut c_char,
5697 ) -> c_int;
5698 }
5699
5700 #[link(name = "rt")]
5701 extern "C" {
5702 pub fn timer_create(clock_id: clockid_t, evp: *mut sigevent, timerid: *mut timer_t) -> c_int;
5703 pub fn timer_delete(timerid: timer_t) -> c_int;
5704 pub fn timer_getoverrun(timerid: timer_t) -> c_int;
5705 pub fn timer_gettime(timerid: timer_t, value: *mut itimerspec) -> c_int;
5706 pub fn timer_settime(
5707 timerid: timer_t,
5708 flags: c_int,
5709 value: *const itimerspec,
5710 ovalue: *mut itimerspec,
5711 ) -> c_int;
5712 }
5713
5714 #[link(name = "devstat")]
5715 extern "C" {
5716 pub fn devstat_getnumdevs(kd: *mut crate::kvm_t) -> c_int;
5717 pub fn devstat_getgeneration(kd: *mut crate::kvm_t) -> c_long;
5718 pub fn devstat_getversion(kd: *mut crate::kvm_t) -> c_int;
5719 pub fn devstat_checkversion(kd: *mut crate::kvm_t) -> c_int;
5720 pub fn devstat_selectdevs(
5721 dev_select: *mut *mut device_selection,
5722 num_selected: *mut c_int,
5723 num_selections: *mut c_int,
5724 select_generation: *mut c_long,
5725 current_generation: c_long,
5726 devices: *mut devstat,
5727 numdevs: c_int,
5728 matches: *mut devstat_match,
5729 num_matches: c_int,
5730 dev_selections: *mut *mut c_char,
5731 num_dev_selections: c_int,
5732 select_mode: devstat_select_mode,
5733 maxshowdevs: c_int,
5734 perf_select: c_int,
5735 ) -> c_int;
5736 pub fn devstat_buildmatch(
5737 match_str: *mut c_char,
5738 matches: *mut *mut devstat_match,
5739 num_matches: *mut c_int,
5740 ) -> c_int;
5741 }
5742
5743 cfg_if! {
5744 if #[cfg(freebsd15)] {
5745 mod freebsd15;
5746 pub use self::freebsd15::*;
5747 } else if #[cfg(freebsd14)] {
5748 mod freebsd14;
5749 pub use self::freebsd14::*;
5750 } else if #[cfg(freebsd13)] {
5751 mod freebsd13;
5752 pub use self::freebsd13::*;
5753 } else if #[cfg(freebsd12)] {
5754 mod freebsd12;
5755 pub use self::freebsd12::*;
5756 } else if #[cfg(any(freebsd10, freebsd11))] {
5757 mod freebsd11;
5758 pub use self::freebsd11::*;
5759 } else {
5760 // Unknown freebsd version
5761 }
5762 }
5763
5764 cfg_if! {
5765 if #[cfg(target_arch = "x86")] {
5766 mod x86;
5767 pub use self::x86::*;
5768 } else if #[cfg(target_arch = "x86_64")] {
5769 mod x86_64;
5770 pub use self::x86_64::*;
5771 } else if #[cfg(target_arch = "aarch64")] {
5772 mod aarch64;
5773 pub use self::aarch64::*;
5774 } else if #[cfg(target_arch = "arm")] {
5775 mod arm;
5776 pub use self::arm::*;
5777 } else if #[cfg(target_arch = "powerpc64")] {
5778 mod powerpc64;
5779 pub use self::powerpc64::*;
5780 } else if #[cfg(target_arch = "powerpc")] {
5781 mod powerpc;
5782 pub use self::powerpc::*;
5783 } else if #[cfg(target_arch = "riscv64")] {
5784 mod riscv64;
5785 pub use self::riscv64::*;
5786 } else {
5787 // Unknown target_arch
5788 }
5789 }