libc/unix/bsd/freebsdlike/freebsd/
mod.rs

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