interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / unix / bsd / freebsdlike / freebsd / mod.rs

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