Debian Codegraph @

debian/missing-sources/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs

raw
1 use crate::prelude::*;
2 use crate::{
3 cmsghdr,
4 off_t,
5 };
6
7 pub type fflags_t = u32;
8
9 pub type vm_prot_t = u_char;
10 pub type kvaddr_t = u64;
11 pub type segsz_t = isize;
12 pub type __fixpt_t = u32;
13 pub type fixpt_t = __fixpt_t;
14 pub type __lwpid_t = i32;
15 pub type lwpid_t = __lwpid_t;
16 pub type blksize_t = i32;
17 pub type ksize_t = u64;
18 pub type inp_gen_t = u64;
19 pub type so_gen_t = u64;
20 pub type clockid_t = c_int;
21 pub type sem_t = _sem;
22 pub type timer_t = *mut __c_anonymous__timer;
23
24 pub type fsblkcnt_t = u64;
25 pub type fsfilcnt_t = u64;
26 pub type idtype_t = c_uint;
27
28 pub type msglen_t = c_ulong;
29 pub type msgqnum_t = c_ulong;
30
31 pub type cpulevel_t = c_int;
32 pub type cpuwhich_t = c_int;
33
34 pub type mqd_t = *mut c_void;
35
36 pub type pthread_spinlock_t = *mut __c_anonymous_pthread_spinlock;
37 pub type pthread_barrierattr_t = *mut __c_anonymous_pthread_barrierattr;
38 pub type pthread_barrier_t = *mut __c_anonymous_pthread_barrier;
39
40 pub type uuid_t = crate::uuid;
41 pub type u_int = c_uint;
42 pub type u_char = c_uchar;
43 pub type u_long = c_ulong;
44 pub type u_short = c_ushort;
45
46 pub type caddr_t = *mut c_char;
47
48 pub type fhandle_t = fhandle;
49
50 pub type au_id_t = crate::uid_t;
51 pub type au_asid_t = crate::pid_t;
52
53 pub type cpusetid_t = c_int;
54
55 pub type sctp_assoc_t = u32;
56
57 pub type eventfd_t = u64;
58
59 #[derive(Debug)]
60 #[cfg_attr(feature = "extra_traits", derive(Hash, PartialEq, Eq))]
61 #[repr(u32)]
62 pub 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 }
68 impl Copy for devstat_support_flags {}
69 impl 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)]
78 pub enum devstat_trans_flags {
79 DEVSTAT_NO_DATA = 0x00,
80 DEVSTAT_READ = 0x01,
81 DEVSTAT_WRITE = 0x02,
82 DEVSTAT_FREE = 0x03,
83 }
84
85 impl Copy for devstat_trans_flags {}
86 impl 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)]
95 pub 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 }
101 impl Copy for devstat_tag_type {}
102 impl 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)]
111 pub 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 }
117 impl Copy for devstat_match_flags {}
118 impl 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)]
127 pub 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 }
139 impl Copy for devstat_priority {}
140 impl 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)]
149 pub 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 }
172 impl Copy for devstat_type_flags {}
173 impl 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)]
182 pub 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 }
230 impl Copy for devstat_metric {}
231 impl 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)]
240 pub enum devstat_select_mode {
241 DS_SELECT_ADD,
242 DS_SELECT_ONLY,
243 DS_SELECT_REMOVE,
244 DS_SELECT_ADDONLY,
245 }
246 impl Copy for devstat_select_mode {}
247 impl Clone for devstat_select_mode {
248 fn clone(&self) -> devstat_select_mode {
249 *self
250 }
251 }
252
253 s! {
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: Padding<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
1655 s_no_extra_traits! {
1656 pub union __c_anonymous_cr_pid {
1657 __cr_unused: Padding<*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: Padding<[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
1789 cfg_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)]
1922 pub enum dot3Vendors {
1923 dot3VendorAMD = 1,
1924 dot3VendorIntel = 2,
1925 dot3VendorNational = 4,
1926 dot3VendorFujitsu = 5,
1927 dot3VendorDigital = 6,
1928 dot3VendorWesternDigital = 7,
1929 }
1930 impl Copy for dot3Vendors {}
1931 impl Clone for dot3Vendors {
1932 fn clone(&self) -> dot3Vendors {
1933 *self
1934 }
1935 }
1936
1937 // aio.h
1938 pub const LIO_VECTORED: c_int = 4;
1939 pub const LIO_WRITEV: c_int = 5;
1940 pub const LIO_READV: c_int = 6;
1941
1942 // sys/caprights.h
1943 pub const CAP_RIGHTS_VERSION_00: i32 = 0;
1944 pub const CAP_RIGHTS_VERSION: i32 = CAP_RIGHTS_VERSION_00;
1945
1946 // sys/capsicum.h
1947 macro_rules! cap_right {
1948 ($idx:expr, $bit:expr) => {
1949 ((1u64 << (57 + ($idx))) | ($bit))
1950 };
1951 }
1952 pub const CAP_READ: u64 = cap_right!(0, 0x0000000000000001u64);
1953 pub const CAP_WRITE: u64 = cap_right!(0, 0x0000000000000002u64);
1954 pub const CAP_SEEK_TELL: u64 = cap_right!(0, 0x0000000000000004u64);
1955 pub const CAP_SEEK: u64 = CAP_SEEK_TELL | 0x0000000000000008u64;
1956 pub const CAP_PREAD: u64 = CAP_SEEK | CAP_READ;
1957 pub const CAP_PWRITE: u64 = CAP_SEEK | CAP_WRITE;
1958 pub const CAP_MMAP: u64 = cap_right!(0, 0x0000000000000010u64);
1959 pub const CAP_MMAP_R: u64 = CAP_MMAP | CAP_SEEK | CAP_READ;
1960 pub const CAP_MMAP_W: u64 = CAP_MMAP | CAP_SEEK | CAP_WRITE;
1961 pub const CAP_MMAP_X: u64 = CAP_MMAP | CAP_SEEK | 0x0000000000000020u64;
1962 pub const CAP_MMAP_RW: u64 = CAP_MMAP_R | CAP_MMAP_W;
1963 pub const CAP_MMAP_RX: u64 = CAP_MMAP_R | CAP_MMAP_X;
1964 pub const CAP_MMAP_WX: u64 = CAP_MMAP_W | CAP_MMAP_X;
1965 pub const CAP_MMAP_RWX: u64 = CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X;
1966 pub const CAP_CREATE: u64 = cap_right!(0, 0x0000000000000040u64);
1967 pub const CAP_FEXECVE: u64 = cap_right!(0, 0x0000000000000080u64);
1968 pub const CAP_FSYNC: u64 = cap_right!(0, 0x0000000000000100u64);
1969 pub const CAP_FTRUNCATE: u64 = cap_right!(0, 0x0000000000000200u64);
1970 pub const CAP_LOOKUP: u64 = cap_right!(0, 0x0000000000000400u64);
1971 pub const CAP_FCHDIR: u64 = cap_right!(0, 0x0000000000000800u64);
1972 pub const CAP_FCHFLAGS: u64 = cap_right!(0, 0x0000000000001000u64);
1973 pub const CAP_CHFLAGSAT: u64 = CAP_FCHFLAGS | CAP_LOOKUP;
1974 pub const CAP_FCHMOD: u64 = cap_right!(0, 0x0000000000002000u64);
1975 pub const CAP_FCHMODAT: u64 = CAP_FCHMOD | CAP_LOOKUP;
1976 pub const CAP_FCHOWN: u64 = cap_right!(0, 0x0000000000004000u64);
1977 pub const CAP_FCHOWNAT: u64 = CAP_FCHOWN | CAP_LOOKUP;
1978 pub const CAP_FCNTL: u64 = cap_right!(0, 0x0000000000008000u64);
1979 pub const CAP_FLOCK: u64 = cap_right!(0, 0x0000000000010000u64);
1980 pub const CAP_FPATHCONF: u64 = cap_right!(0, 0x0000000000020000u64);
1981 pub const CAP_FSCK: u64 = cap_right!(0, 0x0000000000040000u64);
1982 pub const CAP_FSTAT: u64 = cap_right!(0, 0x0000000000080000u64);
1983 pub const CAP_FSTATAT: u64 = CAP_FSTAT | CAP_LOOKUP;
1984 pub const CAP_FSTATFS: u64 = cap_right!(0, 0x0000000000100000u64);
1985 pub const CAP_FUTIMES: u64 = cap_right!(0, 0x0000000000200000u64);
1986 pub const CAP_FUTIMESAT: u64 = CAP_FUTIMES | CAP_LOOKUP;
1987 // Note: this was named CAP_LINKAT prior to FreeBSD 11.0.
1988 pub const CAP_LINKAT_TARGET: u64 = CAP_LOOKUP | 0x0000000000400000u64;
1989 pub const CAP_MKDIRAT: u64 = CAP_LOOKUP | 0x0000000000800000u64;
1990 pub const CAP_MKFIFOAT: u64 = CAP_LOOKUP | 0x0000000001000000u64;
1991 pub const CAP_MKNODAT: u64 = CAP_LOOKUP | 0x0000000002000000u64;
1992 // Note: this was named CAP_RENAMEAT prior to FreeBSD 11.0.
1993 pub const CAP_RENAMEAT_SOURCE: u64 = CAP_LOOKUP | 0x0000000004000000u64;
1994 pub const CAP_SYMLINKAT: u64 = CAP_LOOKUP | 0x0000000008000000u64;
1995 pub const CAP_UNLINKAT: u64 = CAP_LOOKUP | 0x0000000010000000u64;
1996 pub const CAP_ACCEPT: u64 = cap_right!(0, 0x0000000020000000u64);
1997 pub const CAP_BIND: u64 = cap_right!(0, 0x0000000040000000u64);
1998 pub const CAP_CONNECT: u64 = cap_right!(0, 0x0000000080000000u64);
1999 pub const CAP_GETPEERNAME: u64 = cap_right!(0, 0x0000000100000000u64);
2000 pub const CAP_GETSOCKNAME: u64 = cap_right!(0, 0x0000000200000000u64);
2001 pub const CAP_GETSOCKOPT: u64 = cap_right!(0, 0x0000000400000000u64);
2002 pub const CAP_LISTEN: u64 = cap_right!(0, 0x0000000800000000u64);
2003 pub const CAP_PEELOFF: u64 = cap_right!(0, 0x0000001000000000u64);
2004 pub const CAP_RECV: u64 = CAP_READ;
2005 pub const CAP_SEND: u64 = CAP_WRITE;
2006 pub const CAP_SETSOCKOPT: u64 = cap_right!(0, 0x0000002000000000u64);
2007 pub const CAP_SHUTDOWN: u64 = cap_right!(0, 0x0000004000000000u64);
2008 pub const CAP_BINDAT: u64 = CAP_LOOKUP | 0x0000008000000000u64;
2009 pub const CAP_CONNECTAT: u64 = CAP_LOOKUP | 0x0000010000000000u64;
2010 pub const CAP_LINKAT_SOURCE: u64 = CAP_LOOKUP | 0x0000020000000000u64;
2011 pub const CAP_RENAMEAT_TARGET: u64 = CAP_LOOKUP | 0x0000040000000000u64;
2012 pub 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;
2021 pub 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")]
2033 pub const CAP_ALL0: u64 = cap_right!(0, 0x000007FFFFFFFFFFu64);
2034 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2035 pub const CAP_UNUSED0_44: u64 = cap_right!(0, 0x0000080000000000u64);
2036 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2037 pub const CAP_UNUSED0_57: u64 = cap_right!(0, 0x0100000000000000u64);
2038 pub const CAP_MAC_GET: u64 = cap_right!(1, 0x0000000000000001u64);
2039 pub const CAP_MAC_SET: u64 = cap_right!(1, 0x0000000000000002u64);
2040 pub const CAP_SEM_GETVALUE: u64 = cap_right!(1, 0x0000000000000004u64);
2041 pub const CAP_SEM_POST: u64 = cap_right!(1, 0x0000000000000008u64);
2042 pub const CAP_SEM_WAIT: u64 = cap_right!(1, 0x0000000000000010u64);
2043 pub const CAP_EVENT: u64 = cap_right!(1, 0x0000000000000020u64);
2044 pub const CAP_KQUEUE_EVENT: u64 = cap_right!(1, 0x0000000000000040u64);
2045 pub const CAP_IOCTL: u64 = cap_right!(1, 0x0000000000000080u64);
2046 pub const CAP_TTYHOOK: u64 = cap_right!(1, 0x0000000000000100u64);
2047 pub const CAP_PDGETPID: u64 = cap_right!(1, 0x0000000000000200u64);
2048 pub const CAP_PDWAIT: u64 = cap_right!(1, 0x0000000000000400u64);
2049 pub const CAP_PDKILL: u64 = cap_right!(1, 0x0000000000000800u64);
2050 pub const CAP_EXTATTR_DELETE: u64 = cap_right!(1, 0x0000000000001000u64);
2051 pub const CAP_EXTATTR_GET: u64 = cap_right!(1, 0x0000000000002000u64);
2052 pub const CAP_EXTATTR_LIST: u64 = cap_right!(1, 0x0000000000004000u64);
2053 pub const CAP_EXTATTR_SET: u64 = cap_right!(1, 0x0000000000008000u64);
2054 pub const CAP_ACL_CHECK: u64 = cap_right!(1, 0x0000000000010000u64);
2055 pub const CAP_ACL_DELETE: u64 = cap_right!(1, 0x0000000000020000u64);
2056 pub const CAP_ACL_GET: u64 = cap_right!(1, 0x0000000000040000u64);
2057 pub const CAP_ACL_SET: u64 = cap_right!(1, 0x0000000000080000u64);
2058 pub const CAP_KQUEUE_CHANGE: u64 = cap_right!(1, 0x0000000000100000u64);
2059 pub const CAP_KQUEUE: u64 = CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE;
2060 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2061 pub const CAP_ALL1: u64 = cap_right!(1, 0x00000000001FFFFFu64);
2062 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2063 pub const CAP_UNUSED1_22: u64 = cap_right!(1, 0x0000000000200000u64);
2064 #[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
2065 pub const CAP_UNUSED1_57: u64 = cap_right!(1, 0x0100000000000000u64);
2066 pub const CAP_FCNTL_GETFL: u32 = 1 << 3;
2067 pub const CAP_FCNTL_SETFL: u32 = 1 << 4;
2068 pub const CAP_FCNTL_GETOWN: u32 = 1 << 5;
2069 pub const CAP_FCNTL_SETOWN: u32 = 1 << 6;
2070
2071 // sys/devicestat.h
2072 pub const DEVSTAT_N_TRANS_FLAGS: c_int = 4;
2073 pub const DEVSTAT_NAME_LEN: c_int = 16;
2074
2075 // sys/cpuset.h
2076 cfg_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
2084 pub const SIGEV_THREAD_ID: c_int = 4;
2085
2086 pub const EXTATTR_NAMESPACE_EMPTY: c_int = 0;
2087 pub const EXTATTR_NAMESPACE_USER: c_int = 1;
2088 pub const EXTATTR_NAMESPACE_SYSTEM: c_int = 2;
2089
2090 pub const PTHREAD_STACK_MIN: size_t = MINSIGSTKSZ;
2091 pub const PTHREAD_MUTEX_ADAPTIVE_NP: c_int = 4;
2092 pub const PTHREAD_MUTEX_STALLED: c_int = 0;
2093 pub const PTHREAD_MUTEX_ROBUST: c_int = 1;
2094 pub const SIGSTKSZ: size_t = MINSIGSTKSZ + 32768;
2095 pub const SF_NODISKIO: c_int = 0x00000001;
2096 pub const SF_MNOWAIT: c_int = 0x00000002;
2097 pub const SF_SYNC: c_int = 0x00000004;
2098 pub const SF_USER_READAHEAD: c_int = 0x00000008;
2099 pub const SF_NOCACHE: c_int = 0x00000010;
2100 pub const O_CLOEXEC: c_int = 0x00100000;
2101 pub const O_DIRECTORY: c_int = 0x00020000;
2102 pub const O_DSYNC: c_int = 0x01000000;
2103 pub const O_EMPTY_PATH: c_int = 0x02000000;
2104 pub const O_EXEC: c_int = 0x00040000;
2105 pub const O_PATH: c_int = 0x00400000;
2106 pub const O_RESOLVE_BENEATH: c_int = 0x00800000;
2107 pub const O_SEARCH: c_int = O_EXEC;
2108 pub const O_TTY_INIT: c_int = 0x00080000;
2109 pub const O_VERIFY: c_int = 0x00200000;
2110 pub const F_GETLK: c_int = 11;
2111 pub const F_SETLK: c_int = 12;
2112 pub const F_SETLKW: c_int = 13;
2113 pub const ENOTCAPABLE: c_int = 93;
2114 pub const ECAPMODE: c_int = 94;
2115 pub const ENOTRECOVERABLE: c_int = 95;
2116 pub const EOWNERDEAD: c_int = 96;
2117 pub const EINTEGRITY: c_int = 97;
2118 pub const RLIMIT_NPTS: c_int = 11;
2119 pub const RLIMIT_SWAP: c_int = 12;
2120 pub const RLIMIT_KQUEUES: c_int = 13;
2121 pub const RLIMIT_UMTXP: c_int = 14;
2122 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
2123 pub const RLIM_NLIMITS: crate::rlim_t = 15;
2124 pub const RLIM_SAVED_MAX: crate::rlim_t = crate::RLIM_INFINITY;
2125 pub const RLIM_SAVED_CUR: crate::rlim_t = crate::RLIM_INFINITY;
2126
2127 pub const CP_USER: c_int = 0;
2128 pub const CP_NICE: c_int = 1;
2129 pub const CP_SYS: c_int = 2;
2130 pub const CP_INTR: c_int = 3;
2131 pub const CP_IDLE: c_int = 4;
2132 pub const CPUSTATES: c_int = 5;
2133
2134 pub const NI_NOFQDN: c_int = 0x00000001;
2135 pub const NI_NUMERICHOST: c_int = 0x00000002;
2136 pub const NI_NAMEREQD: c_int = 0x00000004;
2137 pub const NI_NUMERICSERV: c_int = 0x00000008;
2138 pub const NI_DGRAM: c_int = 0x00000010;
2139 pub const NI_NUMERICSCOPE: c_int = 0x00000020;
2140
2141 pub const XU_NGROUPS: c_int = 16;
2142
2143 pub const Q_GETQUOTA: c_int = 0x700;
2144 pub const Q_SETQUOTA: c_int = 0x800;
2145
2146 pub const MAP_GUARD: c_int = 0x00002000;
2147 pub const MAP_EXCL: c_int = 0x00004000;
2148 pub const MAP_PREFAULT_READ: c_int = 0x00040000;
2149 pub const MAP_ALIGNMENT_SHIFT: c_int = 24;
2150 pub const MAP_ALIGNMENT_MASK: c_int = 0xff << MAP_ALIGNMENT_SHIFT;
2151 pub const MAP_ALIGNED_SUPER: c_int = 1 << MAP_ALIGNMENT_SHIFT;
2152
2153 pub const POSIX_FADV_NORMAL: c_int = 0;
2154 pub const POSIX_FADV_RANDOM: c_int = 1;
2155 pub const POSIX_FADV_SEQUENTIAL: c_int = 2;
2156 pub const POSIX_FADV_WILLNEED: c_int = 3;
2157 pub const POSIX_FADV_DONTNEED: c_int = 4;
2158 pub const POSIX_FADV_NOREUSE: c_int = 5;
2159
2160 pub const POLLINIGNEOF: c_short = 0x2000;
2161 pub const POLLRDHUP: c_short = 0x4000;
2162
2163 pub const EVFILT_READ: i16 = -1;
2164 pub const EVFILT_WRITE: i16 = -2;
2165 pub const EVFILT_AIO: i16 = -3;
2166 pub const EVFILT_VNODE: i16 = -4;
2167 pub const EVFILT_PROC: i16 = -5;
2168 pub const EVFILT_SIGNAL: i16 = -6;
2169 pub const EVFILT_TIMER: i16 = -7;
2170 pub const EVFILT_PROCDESC: i16 = -8;
2171 pub const EVFILT_FS: i16 = -9;
2172 pub const EVFILT_LIO: i16 = -10;
2173 pub const EVFILT_USER: i16 = -11;
2174 pub const EVFILT_SENDFILE: i16 = -12;
2175 pub const EVFILT_EMPTY: i16 = -13;
2176
2177 pub const EV_ADD: u16 = 0x1;
2178 pub const EV_DELETE: u16 = 0x2;
2179 pub const EV_ENABLE: u16 = 0x4;
2180 pub const EV_DISABLE: u16 = 0x8;
2181 pub const EV_FORCEONESHOT: u16 = 0x100;
2182 pub const EV_KEEPUDATA: u16 = 0x200;
2183
2184 pub const EV_ONESHOT: u16 = 0x10;
2185 pub const EV_CLEAR: u16 = 0x20;
2186 pub const EV_RECEIPT: u16 = 0x40;
2187 pub const EV_DISPATCH: u16 = 0x80;
2188 pub const EV_SYSFLAGS: u16 = 0xf000;
2189 pub const EV_DROP: u16 = 0x1000;
2190 pub const EV_FLAG1: u16 = 0x2000;
2191 pub const EV_FLAG2: u16 = 0x4000;
2192
2193 pub const EV_EOF: u16 = 0x8000;
2194 pub const EV_ERROR: u16 = 0x4000;
2195
2196 pub const NOTE_TRIGGER: u32 = 0x01000000;
2197 pub const NOTE_FFNOP: u32 = 0x00000000;
2198 pub const NOTE_FFAND: u32 = 0x40000000;
2199 pub const NOTE_FFOR: u32 = 0x80000000;
2200 pub const NOTE_FFCOPY: u32 = 0xc0000000;
2201 pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
2202 pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
2203 pub const NOTE_LOWAT: u32 = 0x00000001;
2204 pub const NOTE_FILE_POLL: u32 = 0x00000002;
2205 pub const NOTE_DELETE: u32 = 0x00000001;
2206 pub const NOTE_WRITE: u32 = 0x00000002;
2207 pub const NOTE_EXTEND: u32 = 0x00000004;
2208 pub const NOTE_ATTRIB: u32 = 0x00000008;
2209 pub const NOTE_LINK: u32 = 0x00000010;
2210 pub const NOTE_RENAME: u32 = 0x00000020;
2211 pub const NOTE_REVOKE: u32 = 0x00000040;
2212 pub const NOTE_OPEN: u32 = 0x00000080;
2213 pub const NOTE_CLOSE: u32 = 0x00000100;
2214 pub const NOTE_CLOSE_WRITE: u32 = 0x00000200;
2215 pub const NOTE_READ: u32 = 0x00000400;
2216 pub const NOTE_EXIT: u32 = 0x80000000;
2217 pub const NOTE_FORK: u32 = 0x40000000;
2218 pub const NOTE_EXEC: u32 = 0x20000000;
2219 pub const NOTE_PDATAMASK: u32 = 0x000fffff;
2220 pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
2221 pub const NOTE_TRACK: u32 = 0x00000001;
2222 pub const NOTE_TRACKERR: u32 = 0x00000002;
2223 pub const NOTE_CHILD: u32 = 0x00000004;
2224 pub const NOTE_SECONDS: u32 = 0x00000001;
2225 pub const NOTE_MSECONDS: u32 = 0x00000002;
2226 pub const NOTE_USECONDS: u32 = 0x00000004;
2227 pub const NOTE_NSECONDS: u32 = 0x00000008;
2228 pub const NOTE_ABSTIME: u32 = 0x00000010;
2229
2230 pub 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 )]
2237 pub const CTL_UNSPEC: c_int = 0;
2238 pub const CTL_SYSCTL: c_int = 0;
2239 pub const CTL_KERN: c_int = 1;
2240 pub const CTL_VM: c_int = 2;
2241 pub const CTL_VFS: c_int = 3;
2242 pub const CTL_NET: c_int = 4;
2243 pub const CTL_DEBUG: c_int = 5;
2244 pub const CTL_HW: c_int = 6;
2245 pub const CTL_MACHDEP: c_int = 7;
2246 pub const CTL_USER: c_int = 8;
2247 pub const CTL_P1003_1B: c_int = 9;
2248
2249 // sys/sysctl.h
2250 pub const CTL_MAXNAME: c_int = 24;
2251
2252 pub const CTLTYPE: c_int = 0xf;
2253 pub const CTLTYPE_NODE: c_int = 1;
2254 pub const CTLTYPE_INT: c_int = 2;
2255 pub const CTLTYPE_STRING: c_int = 3;
2256 pub const CTLTYPE_S64: c_int = 4;
2257 pub const CTLTYPE_OPAQUE: c_int = 5;
2258 pub const CTLTYPE_STRUCT: c_int = CTLTYPE_OPAQUE;
2259 pub const CTLTYPE_UINT: c_int = 6;
2260 pub const CTLTYPE_LONG: c_int = 7;
2261 pub const CTLTYPE_ULONG: c_int = 8;
2262 pub const CTLTYPE_U64: c_int = 9;
2263 pub const CTLTYPE_U8: c_int = 0xa;
2264 pub const CTLTYPE_U16: c_int = 0xb;
2265 pub const CTLTYPE_S8: c_int = 0xc;
2266 pub const CTLTYPE_S16: c_int = 0xd;
2267 pub const CTLTYPE_S32: c_int = 0xe;
2268 pub const CTLTYPE_U32: c_int = 0xf;
2269
2270 pub const CTLFLAG_RD: c_int = 0x80000000;
2271 pub const CTLFLAG_WR: c_int = 0x40000000;
2272 pub const CTLFLAG_RW: c_int = CTLFLAG_RD | CTLFLAG_WR;
2273 pub const CTLFLAG_DORMANT: c_int = 0x20000000;
2274 pub const CTLFLAG_ANYBODY: c_int = 0x10000000;
2275 pub const CTLFLAG_SECURE: c_int = 0x08000000;
2276 pub const CTLFLAG_PRISON: c_int = 0x04000000;
2277 pub const CTLFLAG_DYN: c_int = 0x02000000;
2278 pub const CTLFLAG_SKIP: c_int = 0x01000000;
2279 pub const CTLMASK_SECURE: c_int = 0x00F00000;
2280 pub const CTLFLAG_TUN: c_int = 0x00080000;
2281 pub const CTLFLAG_RDTUN: c_int = CTLFLAG_RD | CTLFLAG_TUN;
2282 pub const CTLFLAG_RWTUN: c_int = CTLFLAG_RW | CTLFLAG_TUN;
2283 pub const CTLFLAG_MPSAFE: c_int = 0x00040000;
2284 pub const CTLFLAG_VNET: c_int = 0x00020000;
2285 pub const CTLFLAG_DYING: c_int = 0x00010000;
2286 pub const CTLFLAG_CAPRD: c_int = 0x00008000;
2287 pub const CTLFLAG_CAPWR: c_int = 0x00004000;
2288 pub const CTLFLAG_STATS: c_int = 0x00002000;
2289 pub const CTLFLAG_NOFETCH: c_int = 0x00001000;
2290 pub const CTLFLAG_CAPRW: c_int = CTLFLAG_CAPRD | CTLFLAG_CAPWR;
2291 pub const CTLFLAG_NEEDGIANT: c_int = 0x00000800;
2292
2293 pub const CTLSHIFT_SECURE: c_int = 20;
2294 pub const CTLFLAG_SECURE1: c_int = CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE);
2295 pub const CTLFLAG_SECURE2: c_int = CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE);
2296 pub const CTLFLAG_SECURE3: c_int = CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE);
2297
2298 pub const OID_AUTO: c_int = -1;
2299
2300 pub const CTL_SYSCTL_DEBUG: c_int = 0;
2301 pub const CTL_SYSCTL_NAME: c_int = 1;
2302 pub const CTL_SYSCTL_NEXT: c_int = 2;
2303 pub const CTL_SYSCTL_NAME2OID: c_int = 3;
2304 pub const CTL_SYSCTL_OIDFMT: c_int = 4;
2305 pub const CTL_SYSCTL_OIDDESCR: c_int = 5;
2306 pub const CTL_SYSCTL_OIDLABEL: c_int = 6;
2307 pub const CTL_SYSCTL_NEXTNOSKIP: c_int = 7;
2308
2309 pub const KERN_OSTYPE: c_int = 1;
2310 pub const KERN_OSRELEASE: c_int = 2;
2311 pub const KERN_OSREV: c_int = 3;
2312 pub const KERN_VERSION: c_int = 4;
2313 pub const KERN_MAXVNODES: c_int = 5;
2314 pub const KERN_MAXPROC: c_int = 6;
2315 pub const KERN_MAXFILES: c_int = 7;
2316 pub const KERN_ARGMAX: c_int = 8;
2317 pub const KERN_SECURELVL: c_int = 9;
2318 pub const KERN_HOSTNAME: c_int = 10;
2319 pub const KERN_HOSTID: c_int = 11;
2320 pub const KERN_CLOCKRATE: c_int = 12;
2321 pub const KERN_VNODE: c_int = 13;
2322 pub const KERN_PROC: c_int = 14;
2323 pub const KERN_FILE: c_int = 15;
2324 pub const KERN_PROF: c_int = 16;
2325 pub const KERN_POSIX1: c_int = 17;
2326 pub const KERN_NGROUPS: c_int = 18;
2327 pub const KERN_JOB_CONTROL: c_int = 19;
2328 pub const KERN_SAVED_IDS: c_int = 20;
2329 pub const KERN_BOOTTIME: c_int = 21;
2330 pub const KERN_NISDOMAINNAME: c_int = 22;
2331 pub const KERN_UPDATEINTERVAL: c_int = 23;
2332 pub const KERN_OSRELDATE: c_int = 24;
2333 pub const KERN_NTP_PLL: c_int = 25;
2334 pub const KERN_BOOTFILE: c_int = 26;
2335 pub const KERN_MAXFILESPERPROC: c_int = 27;
2336 pub const KERN_MAXPROCPERUID: c_int = 28;
2337 pub const KERN_DUMPDEV: c_int = 29;
2338 pub const KERN_IPC: c_int = 30;
2339 pub const KERN_DUMMY: c_int = 31;
2340 pub const KERN_PS_STRINGS: c_int = 32;
2341 pub const KERN_USRSTACK: c_int = 33;
2342 pub const KERN_LOGSIGEXIT: c_int = 34;
2343 pub const KERN_IOV_MAX: c_int = 35;
2344 pub const KERN_HOSTUUID: c_int = 36;
2345 pub const KERN_ARND: c_int = 37;
2346 pub const KERN_MAXPHYS: c_int = 38;
2347
2348 pub const KERN_PROC_ALL: c_int = 0;
2349 pub const KERN_PROC_PID: c_int = 1;
2350 pub const KERN_PROC_PGRP: c_int = 2;
2351 pub const KERN_PROC_SESSION: c_int = 3;
2352 pub const KERN_PROC_TTY: c_int = 4;
2353 pub const KERN_PROC_UID: c_int = 5;
2354 pub const KERN_PROC_RUID: c_int = 6;
2355 pub const KERN_PROC_ARGS: c_int = 7;
2356 pub const KERN_PROC_PROC: c_int = 8;
2357 pub const KERN_PROC_SV_NAME: c_int = 9;
2358 pub const KERN_PROC_RGID: c_int = 10;
2359 pub const KERN_PROC_GID: c_int = 11;
2360 pub const KERN_PROC_PATHNAME: c_int = 12;
2361 pub const KERN_PROC_OVMMAP: c_int = 13;
2362 pub const KERN_PROC_OFILEDESC: c_int = 14;
2363 pub const KERN_PROC_KSTACK: c_int = 15;
2364 pub const KERN_PROC_INC_THREAD: c_int = 0x10;
2365 pub const KERN_PROC_VMMAP: c_int = 32;
2366 pub const KERN_PROC_FILEDESC: c_int = 33;
2367 pub const KERN_PROC_GROUPS: c_int = 34;
2368 pub const KERN_PROC_ENV: c_int = 35;
2369 pub const KERN_PROC_AUXV: c_int = 36;
2370 pub const KERN_PROC_RLIMIT: c_int = 37;
2371 pub const KERN_PROC_PS_STRINGS: c_int = 38;
2372 pub const KERN_PROC_UMASK: c_int = 39;
2373 pub const KERN_PROC_OSREL: c_int = 40;
2374 pub const KERN_PROC_SIGTRAMP: c_int = 41;
2375 pub const KERN_PROC_CWD: c_int = 42;
2376 pub const KERN_PROC_NFDS: c_int = 43;
2377 pub const KERN_PROC_SIGFASTBLK: c_int = 44;
2378
2379 pub const KIPC_MAXSOCKBUF: c_int = 1;
2380 pub const KIPC_SOCKBUF_WASTE: c_int = 2;
2381 pub const KIPC_SOMAXCONN: c_int = 3;
2382 pub const KIPC_MAX_LINKHDR: c_int = 4;
2383 pub const KIPC_MAX_PROTOHDR: c_int = 5;
2384 pub const KIPC_MAX_HDR: c_int = 6;
2385 pub const KIPC_MAX_DATALEN: c_int = 7;
2386
2387 pub const HW_MACHINE: c_int = 1;
2388 pub const HW_MODEL: c_int = 2;
2389 pub const HW_NCPU: c_int = 3;
2390 pub const HW_BYTEORDER: c_int = 4;
2391 pub const HW_PHYSMEM: c_int = 5;
2392 pub const HW_USERMEM: c_int = 6;
2393 pub const HW_PAGESIZE: c_int = 7;
2394 pub const HW_DISKNAMES: c_int = 8;
2395 pub const HW_DISKSTATS: c_int = 9;
2396 pub const HW_FLOATINGPT: c_int = 10;
2397 pub const HW_MACHINE_ARCH: c_int = 11;
2398 pub const HW_REALMEM: c_int = 12;
2399
2400 pub const USER_CS_PATH: c_int = 1;
2401 pub const USER_BC_BASE_MAX: c_int = 2;
2402 pub const USER_BC_DIM_MAX: c_int = 3;
2403 pub const USER_BC_SCALE_MAX: c_int = 4;
2404 pub const USER_BC_STRING_MAX: c_int = 5;
2405 pub const USER_COLL_WEIGHTS_MAX: c_int = 6;
2406 pub const USER_EXPR_NEST_MAX: c_int = 7;
2407 pub const USER_LINE_MAX: c_int = 8;
2408 pub const USER_RE_DUP_MAX: c_int = 9;
2409 pub const USER_POSIX2_VERSION: c_int = 10;
2410 pub const USER_POSIX2_C_BIND: c_int = 11;
2411 pub const USER_POSIX2_C_DEV: c_int = 12;
2412 pub const USER_POSIX2_CHAR_TERM: c_int = 13;
2413 pub const USER_POSIX2_FORT_DEV: c_int = 14;
2414 pub const USER_POSIX2_FORT_RUN: c_int = 15;
2415 pub const USER_POSIX2_LOCALEDEF: c_int = 16;
2416 pub const USER_POSIX2_SW_DEV: c_int = 17;
2417 pub const USER_POSIX2_UPE: c_int = 18;
2418 pub const USER_STREAM_MAX: c_int = 19;
2419 pub const USER_TZNAME_MAX: c_int = 20;
2420 pub const USER_LOCALBASE: c_int = 21;
2421
2422 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: c_int = 1;
2423 pub const CTL_P1003_1B_MAPPED_FILES: c_int = 2;
2424 pub const CTL_P1003_1B_MEMLOCK: c_int = 3;
2425 pub const CTL_P1003_1B_MEMLOCK_RANGE: c_int = 4;
2426 pub const CTL_P1003_1B_MEMORY_PROTECTION: c_int = 5;
2427 pub const CTL_P1003_1B_MESSAGE_PASSING: c_int = 6;
2428 pub const CTL_P1003_1B_PRIORITIZED_IO: c_int = 7;
2429 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: c_int = 8;
2430 pub const CTL_P1003_1B_REALTIME_SIGNALS: c_int = 9;
2431 pub const CTL_P1003_1B_SEMAPHORES: c_int = 10;
2432 pub const CTL_P1003_1B_FSYNC: c_int = 11;
2433 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: c_int = 12;
2434 pub const CTL_P1003_1B_SYNCHRONIZED_IO: c_int = 13;
2435 pub const CTL_P1003_1B_TIMERS: c_int = 14;
2436 pub const CTL_P1003_1B_AIO_LISTIO_MAX: c_int = 15;
2437 pub const CTL_P1003_1B_AIO_MAX: c_int = 16;
2438 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: c_int = 17;
2439 pub const CTL_P1003_1B_DELAYTIMER_MAX: c_int = 18;
2440 pub const CTL_P1003_1B_MQ_OPEN_MAX: c_int = 19;
2441 pub const CTL_P1003_1B_PAGESIZE: c_int = 20;
2442 pub const CTL_P1003_1B_RTSIG_MAX: c_int = 21;
2443 pub const CTL_P1003_1B_SEM_NSEMS_MAX: c_int = 22;
2444 pub const CTL_P1003_1B_SEM_VALUE_MAX: c_int = 23;
2445 pub const CTL_P1003_1B_SIGQUEUE_MAX: c_int = 24;
2446 pub const CTL_P1003_1B_TIMER_MAX: c_int = 25;
2447
2448 pub const TIOCGPTN: c_ulong = 0x4004740f;
2449 pub const TIOCPTMASTER: c_ulong = 0x2000741c;
2450 pub const TIOCSIG: c_ulong = 0x2004745f;
2451 pub const TIOCM_DCD: c_int = 0x40;
2452 pub const H4DISC: c_int = 0x7;
2453
2454 pub const VM_TOTAL: c_int = 1;
2455
2456 cfg_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
2464 cfg_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
2472 pub const FIONWRITE: c_ulong = 0x40046677;
2473 pub const FIONSPACE: c_ulong = 0x40046676;
2474 pub const FIOSEEKDATA: c_ulong = 0xc0086661;
2475 pub const FIOSEEKHOLE: c_ulong = 0xc0086662;
2476 pub const FIOSSHMLPGCNF: c_ulong = 0x80306664;
2477
2478 pub const JAIL_API_VERSION: u32 = 2;
2479 pub const JAIL_CREATE: c_int = 0x01;
2480 pub const JAIL_UPDATE: c_int = 0x02;
2481 pub const JAIL_ATTACH: c_int = 0x04;
2482 pub const JAIL_DYING: c_int = 0x08;
2483 pub const JAIL_SYS_DISABLE: c_int = 0;
2484 pub const JAIL_SYS_NEW: c_int = 1;
2485 pub const JAIL_SYS_INHERIT: c_int = 2;
2486
2487 pub const MNT_ACLS: c_int = 0x08000000;
2488 pub const MNT_BYFSID: c_int = 0x08000000;
2489 pub const MNT_GJOURNAL: c_int = 0x02000000;
2490 pub const MNT_MULTILABEL: c_int = 0x04000000;
2491 pub const MNT_NFS4ACLS: c_int = 0x00000010;
2492 pub const MNT_SNAPSHOT: c_int = 0x01000000;
2493 pub const MNT_UNION: c_int = 0x00000020;
2494 pub const MNT_NONBUSY: c_int = 0x04000000;
2495
2496 pub const SCM_BINTIME: c_int = 0x04;
2497 pub const SCM_REALTIME: c_int = 0x05;
2498 pub const SCM_MONOTONIC: c_int = 0x06;
2499 pub const SCM_TIME_INFO: c_int = 0x07;
2500 pub const SCM_CREDS2: c_int = 0x08;
2501
2502 pub const SO_BINTIME: c_int = 0x2000;
2503 pub const SO_NO_OFFLOAD: c_int = 0x4000;
2504 pub const SO_NO_DDP: c_int = 0x8000;
2505 pub const SO_REUSEPORT_LB: c_int = 0x10000;
2506 pub const SO_LABEL: c_int = 0x1009;
2507 pub const SO_PEERLABEL: c_int = 0x1010;
2508 pub const SO_LISTENQLIMIT: c_int = 0x1011;
2509 pub const SO_LISTENQLEN: c_int = 0x1012;
2510 pub const SO_LISTENINCQLEN: c_int = 0x1013;
2511 pub const SO_SETFIB: c_int = 0x1014;
2512 pub const SO_USER_COOKIE: c_int = 0x1015;
2513 pub const SO_PROTOCOL: c_int = 0x1016;
2514 pub const SO_PROTOTYPE: c_int = SO_PROTOCOL;
2515 pub const SO_TS_CLOCK: c_int = 0x1017;
2516 pub const SO_DOMAIN: c_int = 0x1019;
2517 pub const SO_SPLICE: c_int = 0x1023;
2518 pub const SO_VENDOR: c_int = 0x80000000;
2519
2520 pub const SO_TS_REALTIME_MICRO: c_int = 0;
2521 pub const SO_TS_BINTIME: c_int = 1;
2522 pub const SO_TS_REALTIME: c_int = 2;
2523 pub const SO_TS_MONOTONIC: c_int = 3;
2524 pub const SO_TS_DEFAULT: c_int = SO_TS_REALTIME_MICRO;
2525 pub const SO_TS_CLOCK_MAX: c_int = SO_TS_MONOTONIC;
2526
2527 pub const LOCAL_CREDS: c_int = 2;
2528 pub const LOCAL_CREDS_PERSISTENT: c_int = 3;
2529 pub const LOCAL_CONNWAIT: c_int = 4;
2530 pub const LOCAL_VENDOR: c_int = SO_VENDOR;
2531
2532 pub const PL_EVENT_NONE: c_int = 0;
2533 pub const PL_EVENT_SIGNAL: c_int = 1;
2534 pub const PL_FLAG_SA: c_int = 0x01;
2535 pub const PL_FLAG_BOUND: c_int = 0x02;
2536 pub const PL_FLAG_SCE: c_int = 0x04;
2537 pub const PL_FLAG_SCX: c_int = 0x08;
2538 pub const PL_FLAG_EXEC: c_int = 0x10;
2539 pub const PL_FLAG_SI: c_int = 0x20;
2540 pub const PL_FLAG_FORKED: c_int = 0x40;
2541 pub const PL_FLAG_CHILD: c_int = 0x80;
2542 pub const PL_FLAG_BORN: c_int = 0x100;
2543 pub const PL_FLAG_EXITED: c_int = 0x200;
2544 pub const PL_FLAG_VFORKED: c_int = 0x400;
2545 pub const PL_FLAG_VFORK_DONE: c_int = 0x800;
2546
2547 pub const PT_LWPINFO: c_int = 13;
2548 pub const PT_GETNUMLWPS: c_int = 14;
2549 pub const PT_GETLWPLIST: c_int = 15;
2550 pub const PT_CLEARSTEP: c_int = 16;
2551 pub const PT_SETSTEP: c_int = 17;
2552 pub const PT_SUSPEND: c_int = 18;
2553 pub const PT_RESUME: c_int = 19;
2554 pub const PT_TO_SCE: c_int = 20;
2555 pub const PT_TO_SCX: c_int = 21;
2556 pub const PT_SYSCALL: c_int = 22;
2557 pub const PT_FOLLOW_FORK: c_int = 23;
2558 pub const PT_LWP_EVENTS: c_int = 24;
2559 pub const PT_GET_EVENT_MASK: c_int = 25;
2560 pub const PT_SET_EVENT_MASK: c_int = 26;
2561 pub const PT_GET_SC_ARGS: c_int = 27;
2562 pub const PT_GET_SC_RET: c_int = 28;
2563 pub const PT_COREDUMP: c_int = 29;
2564 pub const PT_GETREGS: c_int = 33;
2565 pub const PT_SETREGS: c_int = 34;
2566 pub const PT_GETFPREGS: c_int = 35;
2567 pub const PT_SETFPREGS: c_int = 36;
2568 pub const PT_GETDBREGS: c_int = 37;
2569 pub const PT_SETDBREGS: c_int = 38;
2570 pub const PT_VM_TIMESTAMP: c_int = 40;
2571 pub const PT_VM_ENTRY: c_int = 41;
2572 pub const PT_GETREGSET: c_int = 42;
2573 pub const PT_SETREGSET: c_int = 43;
2574 pub const PT_SC_REMOTE: c_int = 44;
2575 pub const PT_FIRSTMACH: c_int = 64;
2576
2577 pub const PTRACE_EXEC: c_int = 0x0001;
2578 pub const PTRACE_SCE: c_int = 0x0002;
2579 pub const PTRACE_SCX: c_int = 0x0004;
2580 pub const PTRACE_SYSCALL: c_int = PTRACE_SCE | PTRACE_SCX;
2581 pub const PTRACE_FORK: c_int = 0x0008;
2582 pub const PTRACE_LWP: c_int = 0x0010;
2583 pub const PTRACE_VFORK: c_int = 0x0020;
2584 pub const PTRACE_DEFAULT: c_int = PTRACE_EXEC;
2585
2586 pub const PC_COMPRESS: u32 = 0x00000001;
2587 pub const PC_ALL: u32 = 0x00000002;
2588
2589 pub const PROC_SPROTECT: c_int = 1;
2590 pub const PROC_REAP_ACQUIRE: c_int = 2;
2591 pub const PROC_REAP_RELEASE: c_int = 3;
2592 pub const PROC_REAP_STATUS: c_int = 4;
2593 pub const PROC_REAP_GETPIDS: c_int = 5;
2594 pub const PROC_REAP_KILL: c_int = 6;
2595 pub const PROC_TRACE_CTL: c_int = 7;
2596 pub const PROC_TRACE_STATUS: c_int = 8;
2597 pub const PROC_TRAPCAP_CTL: c_int = 9;
2598 pub const PROC_TRAPCAP_STATUS: c_int = 10;
2599 pub const PROC_PDEATHSIG_CTL: c_int = 11;
2600 pub const PROC_PDEATHSIG_STATUS: c_int = 12;
2601 pub const PROC_ASLR_CTL: c_int = 13;
2602 pub const PROC_ASLR_STATUS: c_int = 14;
2603 pub const PROC_PROTMAX_CTL: c_int = 15;
2604 pub const PROC_PROTMAX_STATUS: c_int = 16;
2605 pub const PROC_STACKGAP_CTL: c_int = 17;
2606 pub const PROC_STACKGAP_STATUS: c_int = 18;
2607 pub const PROC_NO_NEW_PRIVS_CTL: c_int = 19;
2608 pub const PROC_NO_NEW_PRIVS_STATUS: c_int = 20;
2609 pub const PROC_WXMAP_CTL: c_int = 21;
2610 pub const PROC_WXMAP_STATUS: c_int = 22;
2611 pub const PROC_PROCCTL_MD_MIN: c_int = 0x10000000;
2612
2613 pub const PPROT_SET: c_int = 1;
2614 pub const PPROT_CLEAR: c_int = 2;
2615 pub const PPROT_DESCEND: c_int = 0x10;
2616 pub const PPROT_INHERIT: c_int = 0x20;
2617
2618 pub const PROC_TRACE_CTL_ENABLE: c_int = 1;
2619 pub const PROC_TRACE_CTL_DISABLE: c_int = 2;
2620 pub const PROC_TRACE_CTL_DISABLE_EXEC: c_int = 3;
2621
2622 pub const PROC_TRAPCAP_CTL_ENABLE: c_int = 1;
2623 pub const PROC_TRAPCAP_CTL_DISABLE: c_int = 2;
2624
2625 pub const PROC_ASLR_FORCE_ENABLE: c_int = 1;
2626 pub const PROC_ASLR_FORCE_DISABLE: c_int = 2;
2627 pub const PROC_ASLR_NOFORCE: c_int = 3;
2628 pub const PROC_ASLR_ACTIVE: c_int = 0x80000000;
2629
2630 pub const PROC_PROTMAX_FORCE_ENABLE: c_int = 1;
2631 pub const PROC_PROTMAX_FORCE_DISABLE: c_int = 2;
2632 pub const PROC_PROTMAX_NOFORCE: c_int = 3;
2633 pub const PROC_PROTMAX_ACTIVE: c_int = 0x80000000;
2634
2635 pub const PROC_STACKGAP_ENABLE: c_int = 0x0001;
2636 pub const PROC_STACKGAP_DISABLE: c_int = 0x0002;
2637 pub const PROC_STACKGAP_ENABLE_EXEC: c_int = 0x0004;
2638 pub const PROC_STACKGAP_DISABLE_EXEC: c_int = 0x0008;
2639
2640 pub const PROC_NO_NEW_PRIVS_ENABLE: c_int = 1;
2641 pub const PROC_NO_NEW_PRIVS_DISABLE: c_int = 2;
2642
2643 pub const PROC_WX_MAPPINGS_PERMIT: c_int = 0x0001;
2644 pub const PROC_WX_MAPPINGS_DISALLOW_EXEC: c_int = 0x0002;
2645 pub const PROC_WXORX_ENFORCE: c_int = 0x80000000;
2646
2647 pub const AF_SLOW: c_int = 33;
2648 pub const AF_SCLUSTER: c_int = 34;
2649 pub const AF_ARP: c_int = 35;
2650 pub const AF_BLUETOOTH: c_int = 36;
2651 pub const AF_IEEE80211: c_int = 37;
2652 pub const AF_INET_SDP: c_int = 40;
2653 pub const AF_INET6_SDP: c_int = 42;
2654
2655 // sys/net/if.h
2656 pub const IF_MAXUNIT: c_int = 0x7fff;
2657 /// (n) interface is up
2658 pub const IFF_UP: c_int = 0x1;
2659 /// (i) broadcast address valid
2660 pub const IFF_BROADCAST: c_int = 0x2;
2661 /// (n) turn on debugging
2662 pub const IFF_DEBUG: c_int = 0x4;
2663 /// (i) is a loopback net
2664 pub const IFF_LOOPBACK: c_int = 0x8;
2665 /// (i) is a point-to-point link
2666 pub 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")]
2669 pub const IFF_KNOWSEPOCH: c_int = 0x20;
2670 /// (d) resources allocated
2671 pub 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
2678 pub const IFF_DRV_RUNNING: c_int = 0x40;
2679 /// (n) no address resolution protocol
2680 pub const IFF_NOARP: c_int = 0x80;
2681 /// (n) receive all packets
2682 pub const IFF_PROMISC: c_int = 0x100;
2683 /// (n) receive all multicast packets
2684 pub const IFF_ALLMULTI: c_int = 0x200;
2685 /// (d) tx hardware queue is full
2686 pub 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
2690 pub const IFF_DRV_OACTIVE: c_int = 0x400;
2691 /// (i) can't hear own transmissions
2692 pub const IFF_SIMPLEX: c_int = 0x800;
2693 /// per link layer defined bit
2694 pub const IFF_LINK0: c_int = 0x1000;
2695 /// per link layer defined bit
2696 pub const IFF_LINK1: c_int = 0x2000;
2697 /// per link layer defined bit
2698 pub const IFF_LINK2: c_int = 0x4000;
2699 /// use alternate physical connection
2700 pub const IFF_ALTPHYS: c_int = IFF_LINK2;
2701 /// (i) supports multicast
2702 pub const IFF_MULTICAST: c_int = 0x8000;
2703 /// (i) unconfigurable using ioctl(2)
2704 pub const IFF_CANTCONFIG: c_int = 0x10000;
2705 /// (n) user-requested promisc mode
2706 pub const IFF_PPROMISC: c_int = 0x20000;
2707 /// (n) user-requested monitor mode
2708 pub const IFF_MONITOR: c_int = 0x40000;
2709 /// (n) static ARP
2710 pub const IFF_STATICARP: c_int = 0x80000;
2711 /// (n) interface is winding down
2712 pub const IFF_DYING: c_int = 0x200000;
2713 /// (n) interface is being renamed
2714 pub 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")]
2717 pub const IFF_NOGROUP: c_int = 0x800000;
2718
2719 /// link invalid/unknown
2720 pub const LINK_STATE_UNKNOWN: c_int = 0;
2721 /// link is down
2722 pub const LINK_STATE_DOWN: c_int = 1;
2723 /// link is up
2724 pub const LINK_STATE_UP: c_int = 2;
2725
2726 /// can offload checksum on RX
2727 pub const IFCAP_RXCSUM: c_int = 0x00001;
2728 /// can offload checksum on TX
2729 pub const IFCAP_TXCSUM: c_int = 0x00002;
2730 /// can be a network console
2731 pub const IFCAP_NETCONS: c_int = 0x00004;
2732 /// VLAN-compatible MTU
2733 pub const IFCAP_VLAN_MTU: c_int = 0x00008;
2734 /// hardware VLAN tag support
2735 pub const IFCAP_VLAN_HWTAGGING: c_int = 0x00010;
2736 /// 9000 byte MTU supported
2737 pub const IFCAP_JUMBO_MTU: c_int = 0x00020;
2738 /// driver supports polling
2739 pub const IFCAP_POLLING: c_int = 0x00040;
2740 /// can do IFCAP_HWCSUM on VLANs
2741 pub const IFCAP_VLAN_HWCSUM: c_int = 0x00080;
2742 /// can do TCP Segmentation Offload
2743 pub const IFCAP_TSO4: c_int = 0x00100;
2744 /// can do TCP6 Segmentation Offload
2745 pub const IFCAP_TSO6: c_int = 0x00200;
2746 /// can do Large Receive Offload
2747 pub const IFCAP_LRO: c_int = 0x00400;
2748 /// wake on any unicast frame
2749 pub const IFCAP_WOL_UCAST: c_int = 0x00800;
2750 /// wake on any multicast frame
2751 pub const IFCAP_WOL_MCAST: c_int = 0x01000;
2752 /// wake on any Magic Packet
2753 pub const IFCAP_WOL_MAGIC: c_int = 0x02000;
2754 /// interface can offload TCP
2755 pub const IFCAP_TOE4: c_int = 0x04000;
2756 /// interface can offload TCP6
2757 pub const IFCAP_TOE6: c_int = 0x08000;
2758 /// interface hw can filter vlan tag
2759 pub const IFCAP_VLAN_HWFILTER: c_int = 0x10000;
2760 /// can do SIOCGIFCAPNV/SIOCSIFCAPNV
2761 pub const IFCAP_NV: c_int = 0x20000;
2762 /// can do IFCAP_TSO on VLANs
2763 pub const IFCAP_VLAN_HWTSO: c_int = 0x40000;
2764 /// the runtime link state is dynamic
2765 pub const IFCAP_LINKSTATE: c_int = 0x80000;
2766 /// netmap mode supported/enabled
2767 pub const IFCAP_NETMAP: c_int = 0x100000;
2768 /// can offload checksum on IPv6 RX
2769 pub const IFCAP_RXCSUM_IPV6: c_int = 0x200000;
2770 /// can offload checksum on IPv6 TX
2771 pub const IFCAP_TXCSUM_IPV6: c_int = 0x400000;
2772 /// manages counters internally
2773 pub const IFCAP_HWSTATS: c_int = 0x800000;
2774 /// hardware supports TX rate limiting
2775 pub const IFCAP_TXRTLMT: c_int = 0x1000000;
2776 /// hardware rx timestamping
2777 pub const IFCAP_HWRXTSTMP: c_int = 0x2000000;
2778 /// understands M_EXTPG mbufs
2779 pub const IFCAP_MEXTPG: c_int = 0x4000000;
2780 /// can do TLS encryption and segmentation for TCP
2781 pub const IFCAP_TXTLS4: c_int = 0x8000000;
2782 /// can do TLS encryption and segmentation for TCP6
2783 pub const IFCAP_TXTLS6: c_int = 0x10000000;
2784 /// can do IFCAN_HWCSUM on VXLANs
2785 pub const IFCAP_VXLAN_HWCSUM: c_int = 0x20000000;
2786 /// can do IFCAP_TSO on VXLANs
2787 pub const IFCAP_VXLAN_HWTSO: c_int = 0x40000000;
2788 /// can do TLS with rate limiting
2789 pub const IFCAP_TXTLS_RTLMT: c_int = 0x80000000;
2790
2791 pub const IFCAP_HWCSUM_IPV6: c_int = IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6;
2792 pub const IFCAP_HWCSUM: c_int = IFCAP_RXCSUM | IFCAP_TXCSUM;
2793 pub const IFCAP_TSO: c_int = IFCAP_TSO4 | IFCAP_TSO6;
2794 pub const IFCAP_WOL: c_int = IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC;
2795 pub const IFCAP_TOE: c_int = IFCAP_TOE4 | IFCAP_TOE6;
2796 pub const IFCAP_TXTLS: c_int = IFCAP_TXTLS4 | IFCAP_TXTLS6;
2797 pub const IFCAP_CANTCHANGE: c_int = IFCAP_NETMAP | IFCAP_NV;
2798
2799 pub const IFQ_MAXLEN: c_int = 50;
2800 pub const IFNET_SLOWHZ: c_int = 1;
2801
2802 pub const IFAN_ARRIVAL: c_int = 0;
2803 pub const IFAN_DEPARTURE: c_int = 1;
2804
2805 pub const IFSTATMAX: c_int = 800;
2806
2807 pub const RSS_FUNC_NONE: c_int = 0;
2808 pub const RSS_FUNC_PRIVATE: c_int = 1;
2809 pub const RSS_FUNC_TOEPLITZ: c_int = 2;
2810
2811 pub const RSS_TYPE_IPV4: c_int = 0x00000001;
2812 pub const RSS_TYPE_TCP_IPV4: c_int = 0x00000002;
2813 pub const RSS_TYPE_IPV6: c_int = 0x00000004;
2814 pub const RSS_TYPE_IPV6_EX: c_int = 0x00000008;
2815 pub const RSS_TYPE_TCP_IPV6: c_int = 0x00000010;
2816 pub const RSS_TYPE_TCP_IPV6_EX: c_int = 0x00000020;
2817 pub const RSS_TYPE_UDP_IPV4: c_int = 0x00000040;
2818 pub const RSS_TYPE_UDP_IPV6: c_int = 0x00000080;
2819 pub const RSS_TYPE_UDP_IPV6_EX: c_int = 0x00000100;
2820 pub const RSS_KEYLEN: c_int = 128;
2821
2822 pub const IFNET_PCP_NONE: c_int = 0xff;
2823 pub const IFDR_MSG_SIZE: c_int = 64;
2824 pub const IFDR_REASON_MSG: c_int = 1;
2825 pub const IFDR_REASON_VENDOR: c_int = 2;
2826
2827 // sys/net/if_mib.h
2828
2829 /// non-interface-specific
2830 pub const IFMIB_SYSTEM: c_int = 1;
2831 /// per-interface data table
2832 pub const IFMIB_IFDATA: c_int = 2;
2833
2834 /// generic stats for all kinds of ifaces
2835 pub const IFDATA_GENERAL: c_int = 1;
2836 /// specific to the type of interface
2837 pub const IFDATA_LINKSPECIFIC: c_int = 2;
2838 /// driver name and unit
2839 pub const IFDATA_DRIVERNAME: c_int = 3;
2840
2841 /// number of interfaces configured
2842 pub const IFMIB_IFCOUNT: c_int = 1;
2843
2844 /// functions not specific to a type of iface
2845 pub const NETLINK_GENERIC: c_int = 0;
2846
2847 pub const DOT3COMPLIANCE_STATS: c_int = 1;
2848 pub const DOT3COMPLIANCE_COLLS: c_int = 2;
2849
2850 pub const dot3ChipSetAMD7990: c_int = 1;
2851 pub const dot3ChipSetAMD79900: c_int = 2;
2852 pub const dot3ChipSetAMD79C940: c_int = 3;
2853
2854 pub const dot3ChipSetIntel82586: c_int = 1;
2855 pub const dot3ChipSetIntel82596: c_int = 2;
2856 pub const dot3ChipSetIntel82557: c_int = 3;
2857
2858 pub const dot3ChipSetNational8390: c_int = 1;
2859 pub const dot3ChipSetNationalSonic: c_int = 2;
2860
2861 pub const dot3ChipSetFujitsu86950: c_int = 1;
2862
2863 pub const dot3ChipSetDigitalDC21040: c_int = 1;
2864 pub const dot3ChipSetDigitalDC21140: c_int = 2;
2865 pub const dot3ChipSetDigitalDC21041: c_int = 3;
2866 pub const dot3ChipSetDigitalDC21140A: c_int = 4;
2867 pub const dot3ChipSetDigitalDC21142: c_int = 5;
2868
2869 pub const dot3ChipSetWesternDigital83C690: c_int = 1;
2870 pub 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
2878 pub const IPPROTO_HOPOPTS: c_int = 0;
2879 // IPPROTO_ICMP defined in src/unix/mod.rs
2880 /// group mgmt protocol
2881 pub const IPPROTO_IGMP: c_int = 2;
2882 /// gateway^2 (deprecated)
2883 pub const IPPROTO_GGP: c_int = 3;
2884 /// for compatibility
2885 pub const IPPROTO_IPIP: c_int = 4;
2886 // IPPROTO_TCP defined in src/unix/mod.rs
2887 /// Stream protocol II.
2888 pub const IPPROTO_ST: c_int = 7;
2889 /// exterior gateway protocol
2890 pub const IPPROTO_EGP: c_int = 8;
2891 /// private interior gateway
2892 pub const IPPROTO_PIGP: c_int = 9;
2893 /// BBN RCC Monitoring
2894 pub const IPPROTO_RCCMON: c_int = 10;
2895 /// network voice protocol
2896 pub const IPPROTO_NVPII: c_int = 11;
2897 /// pup
2898 pub const IPPROTO_PUP: c_int = 12;
2899 /// Argus
2900 pub const IPPROTO_ARGUS: c_int = 13;
2901 /// EMCON
2902 pub const IPPROTO_EMCON: c_int = 14;
2903 /// Cross Net Debugger
2904 pub const IPPROTO_XNET: c_int = 15;
2905 /// Chaos
2906 pub const IPPROTO_CHAOS: c_int = 16;
2907 // IPPROTO_UDP defined in src/unix/mod.rs
2908 /// Multiplexing
2909 pub const IPPROTO_MUX: c_int = 18;
2910 /// DCN Measurement Subsystems
2911 pub const IPPROTO_MEAS: c_int = 19;
2912 /// Host Monitoring
2913 pub const IPPROTO_HMP: c_int = 20;
2914 /// Packet Radio Measurement
2915 pub const IPPROTO_PRM: c_int = 21;
2916 /// xns idp
2917 pub const IPPROTO_IDP: c_int = 22;
2918 /// Trunk-1
2919 pub const IPPROTO_TRUNK1: c_int = 23;
2920 /// Trunk-2
2921 pub const IPPROTO_TRUNK2: c_int = 24;
2922 /// Leaf-1
2923 pub const IPPROTO_LEAF1: c_int = 25;
2924 /// Leaf-2
2925 pub const IPPROTO_LEAF2: c_int = 26;
2926 /// Reliable Data
2927 pub const IPPROTO_RDP: c_int = 27;
2928 /// Reliable Transaction
2929 pub const IPPROTO_IRTP: c_int = 28;
2930 /// tp-4 w/ class negotiation
2931 pub const IPPROTO_TP: c_int = 29;
2932 /// Bulk Data Transfer
2933 pub const IPPROTO_BLT: c_int = 30;
2934 /// Network Services
2935 pub const IPPROTO_NSP: c_int = 31;
2936 /// Merit Internodal
2937 pub 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 )]
2943 pub const IPPROTO_SEP: c_int = 33;
2944 /// Datagram Congestion Control Protocol
2945 pub const IPPROTO_DCCP: c_int = 33;
2946 /// Third Party Connect
2947 pub const IPPROTO_3PC: c_int = 34;
2948 /// InterDomain Policy Routing
2949 pub const IPPROTO_IDPR: c_int = 35;
2950 /// XTP
2951 pub const IPPROTO_XTP: c_int = 36;
2952 /// Datagram Delivery
2953 pub const IPPROTO_DDP: c_int = 37;
2954 /// Control Message Transport
2955 pub const IPPROTO_CMTP: c_int = 38;
2956 /// TP++ Transport
2957 pub const IPPROTO_TPXX: c_int = 39;
2958 /// IL transport protocol
2959 pub const IPPROTO_IL: c_int = 40;
2960 // IPPROTO_IPV6 defined in src/unix/mod.rs
2961 /// Source Demand Routing
2962 pub const IPPROTO_SDRP: c_int = 42;
2963 /// IP6 routing header
2964 pub const IPPROTO_ROUTING: c_int = 43;
2965 /// IP6 fragmentation header
2966 pub const IPPROTO_FRAGMENT: c_int = 44;
2967 /// InterDomain Routing
2968 pub const IPPROTO_IDRP: c_int = 45;
2969 /// resource reservation
2970 pub const IPPROTO_RSVP: c_int = 46;
2971 /// General Routing Encap.
2972 pub const IPPROTO_GRE: c_int = 47;
2973 /// Mobile Host Routing
2974 pub const IPPROTO_MHRP: c_int = 48;
2975 /// BHA
2976 pub const IPPROTO_BHA: c_int = 49;
2977 /// IP6 Encap Sec. Payload
2978 pub const IPPROTO_ESP: c_int = 50;
2979 /// IP6 Auth Header
2980 pub const IPPROTO_AH: c_int = 51;
2981 /// Integ. Net Layer Security
2982 pub const IPPROTO_INLSP: c_int = 52;
2983 /// IP with encryption
2984 pub const IPPROTO_SWIPE: c_int = 53;
2985 /// Next Hop Resolution
2986 pub const IPPROTO_NHRP: c_int = 54;
2987 /// IP Mobility
2988 pub const IPPROTO_MOBILE: c_int = 55;
2989 /// Transport Layer Security
2990 pub const IPPROTO_TLSP: c_int = 56;
2991 /// SKIP
2992 pub const IPPROTO_SKIP: c_int = 57;
2993 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
2994 /// IP6 no next header
2995 pub const IPPROTO_NONE: c_int = 59;
2996 /// IP6 destination option
2997 pub const IPPROTO_DSTOPTS: c_int = 60;
2998 /// any host internal protocol
2999 pub const IPPROTO_AHIP: c_int = 61;
3000 /// CFTP
3001 pub const IPPROTO_CFTP: c_int = 62;
3002 /// "hello" routing protocol
3003 pub const IPPROTO_HELLO: c_int = 63;
3004 /// SATNET/Backroom EXPAK
3005 pub const IPPROTO_SATEXPAK: c_int = 64;
3006 /// Kryptolan
3007 pub const IPPROTO_KRYPTOLAN: c_int = 65;
3008 /// Remote Virtual Disk
3009 pub const IPPROTO_RVD: c_int = 66;
3010 /// Pluribus Packet Core
3011 pub const IPPROTO_IPPC: c_int = 67;
3012 /// Any distributed FS
3013 pub const IPPROTO_ADFS: c_int = 68;
3014 /// Satnet Monitoring
3015 pub const IPPROTO_SATMON: c_int = 69;
3016 /// VISA Protocol
3017 pub const IPPROTO_VISA: c_int = 70;
3018 /// Packet Core Utility
3019 pub const IPPROTO_IPCV: c_int = 71;
3020 /// Comp. Prot. Net. Executive
3021 pub const IPPROTO_CPNX: c_int = 72;
3022 /// Comp. Prot. HeartBeat
3023 pub const IPPROTO_CPHB: c_int = 73;
3024 /// Wang Span Network
3025 pub const IPPROTO_WSN: c_int = 74;
3026 /// Packet Video Protocol
3027 pub const IPPROTO_PVP: c_int = 75;
3028 /// BackRoom SATNET Monitoring
3029 pub const IPPROTO_BRSATMON: c_int = 76;
3030 /// Sun net disk proto (temp.)
3031 pub const IPPROTO_ND: c_int = 77;
3032 /// WIDEBAND Monitoring
3033 pub const IPPROTO_WBMON: c_int = 78;
3034 /// WIDEBAND EXPAK
3035 pub const IPPROTO_WBEXPAK: c_int = 79;
3036 /// ISO cnlp
3037 pub const IPPROTO_EON: c_int = 80;
3038 /// VMTP
3039 pub const IPPROTO_VMTP: c_int = 81;
3040 /// Secure VMTP
3041 pub const IPPROTO_SVMTP: c_int = 82;
3042 /// Banyon VINES
3043 pub const IPPROTO_VINES: c_int = 83;
3044 /// TTP
3045 pub const IPPROTO_TTP: c_int = 84;
3046 /// NSFNET-IGP
3047 pub const IPPROTO_IGP: c_int = 85;
3048 /// dissimilar gateway prot.
3049 pub const IPPROTO_DGP: c_int = 86;
3050 /// TCF
3051 pub const IPPROTO_TCF: c_int = 87;
3052 /// Cisco/GXS IGRP
3053 pub const IPPROTO_IGRP: c_int = 88;
3054 /// OSPFIGP
3055 pub const IPPROTO_OSPFIGP: c_int = 89;
3056 /// Strite RPC protocol
3057 pub const IPPROTO_SRPC: c_int = 90;
3058 /// Locus Address Resoloution
3059 pub const IPPROTO_LARP: c_int = 91;
3060 /// Multicast Transport
3061 pub const IPPROTO_MTP: c_int = 92;
3062 /// AX.25 Frames
3063 pub const IPPROTO_AX25: c_int = 93;
3064 /// IP encapsulated in IP
3065 pub const IPPROTO_IPEIP: c_int = 94;
3066 /// Mobile Int.ing control
3067 pub const IPPROTO_MICP: c_int = 95;
3068 /// Semaphore Comm. security
3069 pub const IPPROTO_SCCSP: c_int = 96;
3070 /// Ethernet IP encapsulation
3071 pub const IPPROTO_ETHERIP: c_int = 97;
3072 /// encapsulation header
3073 pub const IPPROTO_ENCAP: c_int = 98;
3074 /// any private encr. scheme
3075 pub const IPPROTO_APES: c_int = 99;
3076 /// GMTP
3077 pub const IPPROTO_GMTP: c_int = 100;
3078 /// payload compression (IPComp)
3079 pub const IPPROTO_IPCOMP: c_int = 108;
3080 /// SCTP
3081 pub const IPPROTO_SCTP: c_int = 132;
3082 /// IPv6 Mobility Header
3083 pub const IPPROTO_MH: c_int = 135;
3084 /// UDP-Lite
3085 pub const IPPROTO_UDPLITE: c_int = 136;
3086 /// IP6 Host Identity Protocol
3087 pub const IPPROTO_HIP: c_int = 139;
3088 /// IP6 Shim6 Protocol
3089 pub const IPPROTO_SHIM6: c_int = 140;
3090
3091 /* 101-254: Partly Unassigned */
3092 /// Protocol Independent Mcast
3093 pub const IPPROTO_PIM: c_int = 103;
3094 /// CARP
3095 pub const IPPROTO_CARP: c_int = 112;
3096 /// PGM
3097 pub const IPPROTO_PGM: c_int = 113;
3098 /// MPLS-in-IP
3099 pub const IPPROTO_MPLS: c_int = 137;
3100 /// PFSYNC
3101 pub 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
3106 pub const IPPROTO_OLD_DIVERT: c_int = 254;
3107 pub const IPPROTO_MAX: c_int = 256;
3108 /// last return value of *_input(), meaning "all job for this pkt is done".
3109 pub 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
3113 pub const IPPROTO_DIVERT: c_int = 258;
3114 /// SeND pseudo-protocol
3115 pub const IPPROTO_SEND: c_int = 259;
3116
3117 // sys/netinet/TCP.h
3118 pub const TCP_MD5SIG: c_int = 16;
3119 pub const TCP_INFO: c_int = 32;
3120 pub const TCP_CONGESTION: c_int = 64;
3121 pub const TCP_CCALGOOPT: c_int = 65;
3122 pub const TCP_MAXUNACKTIME: c_int = 68;
3123 #[deprecated(since = "0.2.160", note = "Removed in FreeBSD 15")]
3124 pub const TCP_MAXPEAKRATE: c_int = 69;
3125 pub const TCP_IDLE_REDUCE: c_int = 70;
3126 pub const TCP_REMOTE_UDP_ENCAPS_PORT: c_int = 71;
3127 pub const TCP_DELACK: c_int = 72;
3128 pub const TCP_FIN_IS_RST: c_int = 73;
3129 pub const TCP_LOG_LIMIT: c_int = 74;
3130 pub const TCP_SHARED_CWND_ALLOWED: c_int = 75;
3131 pub const TCP_PROC_ACCOUNTING: c_int = 76;
3132 pub const TCP_USE_CMP_ACKS: c_int = 77;
3133 pub const TCP_PERF_INFO: c_int = 78;
3134 pub const TCP_LRD: c_int = 79;
3135 pub const TCP_KEEPINIT: c_int = 128;
3136 pub const TCP_FASTOPEN: c_int = 1025;
3137 #[deprecated(since = "0.2.171", note = "removed in FreeBSD 15")]
3138 pub const TCP_PCAP_OUT: c_int = 2048;
3139 #[deprecated(since = "0.2.171", note = "removed in FreeBSD 15")]
3140 pub const TCP_PCAP_IN: c_int = 4096;
3141 pub const TCP_FUNCTION_BLK: c_int = 8192;
3142 pub const TCP_FUNCTION_ALIAS: c_int = 8193;
3143 pub const TCP_FASTOPEN_PSK_LEN: c_int = 16;
3144 pub const TCP_FUNCTION_NAME_LEN_MAX: c_int = 32;
3145
3146 pub const TCP_REUSPORT_LB_NUMA: c_int = 1026;
3147 pub const TCP_RACK_MBUF_QUEUE: c_int = 1050;
3148 pub const TCP_RACK_TLP_REDUCE: c_int = 1052;
3149 pub const TCP_RACK_PACE_MAX_SEG: c_int = 1054;
3150 pub const TCP_RACK_PACE_ALWAYS: c_int = 1055;
3151 pub const TCP_RACK_PRR_SENDALOT: c_int = 1057;
3152 pub const TCP_RACK_MIN_TO: c_int = 1058;
3153 pub const TCP_RACK_EARLY_SEG: c_int = 1060;
3154 pub const TCP_RACK_REORD_THRESH: c_int = 1061;
3155 pub const TCP_RACK_REORD_FADE: c_int = 1062;
3156 pub const TCP_RACK_TLP_THRESH: c_int = 1063;
3157 pub const TCP_RACK_PKT_DELAY: c_int = 1064;
3158 pub const TCP_BBR_IWINTSO: c_int = 1067;
3159 pub const TCP_BBR_STARTUP_PG: c_int = 1069;
3160 pub const TCP_BBR_DRAIN_PG: c_int = 1070;
3161 pub const TCP_BBR_PROBE_RTT_INT: c_int = 1072;
3162 pub const TCP_BBR_STARTUP_LOSS_EXIT: c_int = 1074;
3163 pub const TCP_BBR_TSLIMITS: c_int = 1076;
3164 pub const TCP_BBR_PACE_OH: c_int = 1077;
3165 pub const TCP_BBR_USEDEL_RATE: c_int = 1079;
3166 pub const TCP_BBR_MIN_RTO: c_int = 1080;
3167 pub const TCP_BBR_MAX_RTO: c_int = 1081;
3168 pub const TCP_BBR_ALGORITHM: c_int = 1083;
3169 pub const TCP_BBR_PACE_PER_SEC: c_int = 1086;
3170 pub const TCP_BBR_PACE_DEL_TAR: c_int = 1087;
3171 pub const TCP_BBR_PACE_SEG_MAX: c_int = 1088;
3172 pub const TCP_BBR_PACE_SEG_MIN: c_int = 1089;
3173 pub const TCP_BBR_PACE_CROSS: c_int = 1090;
3174 pub const TCP_BBR_TMR_PACE_OH: c_int = 1096;
3175 pub const TCP_BBR_RACK_RTT_USE: c_int = 1098;
3176 pub const TCP_BBR_RETRAN_WTSO: c_int = 1099;
3177 pub const TCP_BBR_PROBE_RTT_GAIN: c_int = 1101;
3178 pub const TCP_BBR_PROBE_RTT_LEN: c_int = 1102;
3179 pub const TCP_BBR_SEND_IWND_IN_TSO: c_int = 1103;
3180 pub const TCP_BBR_USE_RACK_RR: c_int = 1104;
3181 pub const TCP_BBR_HDWR_PACE: c_int = 1105;
3182 pub const TCP_BBR_UTTER_MAX_TSO: c_int = 1106;
3183 pub const TCP_BBR_EXTRA_STATE: c_int = 1107;
3184 pub const TCP_BBR_FLOOR_MIN_TSO: c_int = 1108;
3185 pub const TCP_BBR_MIN_TOPACEOUT: c_int = 1109;
3186 pub const TCP_BBR_TSTMP_RAISES: c_int = 1110;
3187 pub const TCP_BBR_POLICER_DETECT: c_int = 1111;
3188 pub const TCP_BBR_RACK_INIT_RATE: c_int = 1112;
3189
3190 pub const IP_BINDANY: c_int = 24;
3191 pub const IP_BINDMULTI: c_int = 25;
3192 pub const IP_RSS_LISTEN_BUCKET: c_int = 26;
3193 pub const IP_ORIGDSTADDR: c_int = 27;
3194 pub const IP_RECVORIGDSTADDR: c_int = IP_ORIGDSTADDR;
3195
3196 pub const IP_DONTFRAG: c_int = 67;
3197 pub const IP_RECVTOS: c_int = 68;
3198
3199 pub const IPV6_BINDANY: c_int = 64;
3200 pub const IPV6_ORIGDSTADDR: c_int = 72;
3201 pub const IPV6_RECVORIGDSTADDR: c_int = IPV6_ORIGDSTADDR;
3202
3203 pub const PF_SLOW: c_int = AF_SLOW;
3204 pub const PF_SCLUSTER: c_int = AF_SCLUSTER;
3205 pub const PF_ARP: c_int = AF_ARP;
3206 pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
3207 pub const PF_IEEE80211: c_int = AF_IEEE80211;
3208 pub const PF_INET_SDP: c_int = AF_INET_SDP;
3209 pub const PF_INET6_SDP: c_int = AF_INET6_SDP;
3210
3211 pub const NET_RT_DUMP: c_int = 1;
3212 pub const NET_RT_FLAGS: c_int = 2;
3213 pub const NET_RT_IFLIST: c_int = 3;
3214 pub const NET_RT_IFMALIST: c_int = 4;
3215 pub const NET_RT_IFLISTL: c_int = 5;
3216
3217 // System V IPC
3218 pub const IPC_INFO: c_int = 3;
3219 pub const MSG_NOERROR: c_int = 0o10000;
3220 pub const SHM_LOCK: c_int = 11;
3221 pub const SHM_UNLOCK: c_int = 12;
3222 pub const SHM_STAT: c_int = 13;
3223 pub const SHM_INFO: c_int = 14;
3224 pub 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")]
3232 pub const CTL_MAXID: c_int = 10;
3233 #[doc(hidden)]
3234 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
3235 pub const KERN_MAXID: c_int = 38;
3236 #[doc(hidden)]
3237 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
3238 pub const HW_MAXID: c_int = 13;
3239 #[doc(hidden)]
3240 #[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
3241 pub const USER_MAXID: c_int = 21;
3242 #[doc(hidden)]
3243 #[deprecated(since = "0.2.74", note = "Removed in FreeBSD 13")]
3244 pub const CTL_P1003_1B_MAXID: c_int = 26;
3245
3246 pub const MSG_NOTIFICATION: c_int = 0x00002000;
3247 pub const MSG_NBIO: c_int = 0x00004000;
3248 pub const MSG_COMPAT: c_int = 0x00008000;
3249 pub const MSG_CMSG_CLOEXEC: c_int = 0x00040000;
3250 pub const MSG_NOSIGNAL: c_int = 0x20000;
3251 pub const MSG_WAITFORONE: c_int = 0x00080000;
3252
3253 // utmpx entry types
3254 pub const EMPTY: c_short = 0;
3255 pub const BOOT_TIME: c_short = 1;
3256 pub const OLD_TIME: c_short = 2;
3257 pub const NEW_TIME: c_short = 3;
3258 pub const USER_PROCESS: c_short = 4;
3259 pub const INIT_PROCESS: c_short = 5;
3260 pub const LOGIN_PROCESS: c_short = 6;
3261 pub const DEAD_PROCESS: c_short = 7;
3262 pub const SHUTDOWN_TIME: c_short = 8;
3263 // utmp database types
3264 pub const UTXDB_ACTIVE: c_int = 0;
3265 pub const UTXDB_LASTLOGIN: c_int = 1;
3266 pub const UTXDB_LOG: c_int = 2;
3267
3268 pub const LC_COLLATE_MASK: c_int = 1 << 0;
3269 pub const LC_CTYPE_MASK: c_int = 1 << 1;
3270 pub const LC_MONETARY_MASK: c_int = 1 << 2;
3271 pub const LC_NUMERIC_MASK: c_int = 1 << 3;
3272 pub const LC_TIME_MASK: c_int = 1 << 4;
3273 pub const LC_MESSAGES_MASK: c_int = 1 << 5;
3274 pub 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
3281 pub const WSTOPPED: c_int = 2; // same as WUNTRACED
3282 pub const WCONTINUED: c_int = 4;
3283 pub const WNOWAIT: c_int = 8;
3284 pub const WEXITED: c_int = 16;
3285 pub const WTRAPPED: c_int = 32;
3286
3287 // FreeBSD defines a great many more of these, we only expose the
3288 // standardized ones.
3289 pub const P_PID: idtype_t = 0;
3290 pub const P_PGID: idtype_t = 2;
3291 pub const P_ALL: idtype_t = 7;
3292
3293 pub const UTIME_OMIT: c_long = -2;
3294 pub const UTIME_NOW: c_long = -1;
3295
3296 pub const B460800: crate::speed_t = 460800;
3297 pub const B921600: crate::speed_t = 921600;
3298
3299 pub const AT_FDCWD: c_int = -100;
3300 pub const AT_EACCESS: c_int = 0x100;
3301 pub const AT_SYMLINK_NOFOLLOW: c_int = 0x200;
3302 pub const AT_SYMLINK_FOLLOW: c_int = 0x400;
3303 pub const AT_REMOVEDIR: c_int = 0x800;
3304 pub const AT_RESOLVE_BENEATH: c_int = 0x2000;
3305 pub const AT_EMPTY_PATH: c_int = 0x4000;
3306
3307 pub const AT_NULL: c_int = 0;
3308 pub const AT_IGNORE: c_int = 1;
3309 pub const AT_EXECFD: c_int = 2;
3310 pub const AT_PHDR: c_int = 3;
3311 pub const AT_PHENT: c_int = 4;
3312 pub const AT_PHNUM: c_int = 5;
3313 pub const AT_PAGESZ: c_int = 6;
3314 pub const AT_BASE: c_int = 7;
3315 pub const AT_FLAGS: c_int = 8;
3316 pub const AT_ENTRY: c_int = 9;
3317 pub const AT_NOTELF: c_int = 10;
3318 pub const AT_UID: c_int = 11;
3319 pub const AT_EUID: c_int = 12;
3320 pub const AT_GID: c_int = 13;
3321 pub const AT_EGID: c_int = 14;
3322 pub const AT_EXECPATH: c_int = 15;
3323 pub const AT_CANARY: c_int = 16;
3324 pub const AT_OSRELDATE: c_int = 18;
3325 pub const AT_NCPUS: c_int = 19;
3326 pub const AT_PAGESIZES: c_int = 20;
3327 pub const AT_TIMEKEEP: c_int = 22;
3328 pub const AT_HWCAP: c_int = 25;
3329 pub const AT_HWCAP2: c_int = 26;
3330 pub const AT_USRSTACKBASE: c_int = 35;
3331 pub const AT_USRSTACKLIM: c_int = 36;
3332 pub const AT_HWCAP3: c_int = 38;
3333 pub const AT_HWCAP4: c_int = 39;
3334
3335 pub const TABDLY: crate::tcflag_t = 0x00000004;
3336 pub const TAB0: crate::tcflag_t = 0x00000000;
3337 pub const TAB3: crate::tcflag_t = 0x00000004;
3338
3339 pub const _PC_ACL_NFS4: c_int = 64;
3340
3341 pub const _SC_CPUSET_SIZE: c_int = 122;
3342
3343 pub const _UUID_NODE_LEN: usize = 6;
3344
3345 // Flags which can be passed to pdfork(2)
3346 pub const PD_DAEMON: c_int = 0x00000001;
3347 pub const PD_CLOEXEC: c_int = 0x00000002;
3348 pub const PD_ALLOWED_AT_FORK: c_int = PD_DAEMON | PD_CLOEXEC;
3349
3350 // Values for struct rtprio (type_ field)
3351 pub const RTP_PRIO_REALTIME: c_ushort = 2;
3352 pub const RTP_PRIO_NORMAL: c_ushort = 3;
3353 pub const RTP_PRIO_IDLE: c_ushort = 4;
3354
3355 // Flags for chflags(2)
3356 pub const UF_SYSTEM: c_ulong = 0x00000080;
3357 pub const UF_SPARSE: c_ulong = 0x00000100;
3358 pub const UF_OFFLINE: c_ulong = 0x00000200;
3359 pub const UF_REPARSE: c_ulong = 0x00000400;
3360 pub const UF_ARCHIVE: c_ulong = 0x00000800;
3361 pub const UF_READONLY: c_ulong = 0x00001000;
3362 pub const UF_HIDDEN: c_ulong = 0x00008000;
3363 pub const SF_SNAPSHOT: c_ulong = 0x00200000;
3364
3365 // fcntl commands
3366 pub const F_ADD_SEALS: c_int = 19;
3367 pub const F_GET_SEALS: c_int = 20;
3368 pub const F_OGETLK: c_int = 7;
3369 pub const F_OSETLK: c_int = 8;
3370 pub const F_OSETLKW: c_int = 9;
3371 pub const F_RDAHEAD: c_int = 16;
3372 pub const F_READAHEAD: c_int = 15;
3373 pub const F_SETLK_REMOTE: c_int = 14;
3374 pub const F_KINFO: c_int = 22;
3375
3376 // for use with F_ADD_SEALS
3377 pub const F_SEAL_GROW: c_int = 4;
3378 pub const F_SEAL_SEAL: c_int = 1;
3379 pub const F_SEAL_SHRINK: c_int = 2;
3380 pub const F_SEAL_WRITE: c_int = 8;
3381
3382 // for use with fspacectl
3383 pub const SPACECTL_DEALLOC: c_int = 1;
3384
3385 // For realhostname* api
3386 pub const HOSTNAME_FOUND: c_int = 0;
3387 pub const HOSTNAME_INCORRECTNAME: c_int = 1;
3388 pub const HOSTNAME_INVALIDADDR: c_int = 2;
3389 pub const HOSTNAME_INVALIDNAME: c_int = 3;
3390
3391 // For rfork
3392 pub const RFFDG: c_int = 4;
3393 pub const RFPROC: c_int = 16;
3394 pub const RFMEM: c_int = 32;
3395 pub const RFNOWAIT: c_int = 64;
3396 pub const RFCFDG: c_int = 4096;
3397 pub const RFTHREAD: c_int = 8192;
3398 pub const RFSIGSHARE: c_int = 16384;
3399 pub const RFLINUXTHPN: c_int = 65536;
3400 pub const RFTSIGZMB: c_int = 524288;
3401 pub const RFSPAWN: c_int = 2147483648;
3402
3403 // For eventfd
3404 pub const EFD_SEMAPHORE: c_int = 0x1;
3405 pub const EFD_NONBLOCK: c_int = 0x4;
3406 pub const EFD_CLOEXEC: c_int = 0x100000;
3407
3408 pub const MALLOCX_ZERO: c_int = 0x40;
3409
3410 /// size of returned wchan message
3411 pub const WMESGLEN: usize = 8;
3412 /// size of returned lock name
3413 pub const LOCKNAMELEN: usize = 8;
3414 /// size of returned thread name
3415 pub const TDNAMLEN: usize = 16;
3416 /// size of returned ki_comm name
3417 pub const COMMLEN: usize = 19;
3418 /// size of returned ki_emul
3419 pub const KI_EMULNAMELEN: usize = 16;
3420 /// number of groups in ki_groups
3421 pub const KI_NGROUPS: usize = 16;
3422 cfg_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 }
3429 pub const KI_NSPARE_LONG: usize = 12;
3430 /// Flags for the process credential.
3431 pub 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.
3434 pub const KI_CRF_GRP_OVERFLOW: usize = 0x80000000;
3435 /// controlling tty vnode active
3436 pub const KI_CTTY: usize = 0x00000001;
3437 /// session leader
3438 pub const KI_SLEADER: usize = 0x00000002;
3439 /// proc blocked on lock ki_lockname
3440 pub const KI_LOCKBLOCK: usize = 0x00000004;
3441 /// size of returned ki_login
3442 pub const LOGNAMELEN: usize = 17;
3443 /// size of returned ki_loginclass
3444 pub const LOGINCLASSLEN: usize = 17;
3445
3446 pub const KF_ATTR_VALID: c_int = 0x0001;
3447 pub const KF_TYPE_NONE: c_int = 0;
3448 pub const KF_TYPE_VNODE: c_int = 1;
3449 pub const KF_TYPE_SOCKET: c_int = 2;
3450 pub const KF_TYPE_PIPE: c_int = 3;
3451 pub const KF_TYPE_FIFO: c_int = 4;
3452 pub const KF_TYPE_KQUEUE: c_int = 5;
3453 pub const KF_TYPE_MQUEUE: c_int = 7;
3454 pub const KF_TYPE_SHM: c_int = 8;
3455 pub const KF_TYPE_SEM: c_int = 9;
3456 pub const KF_TYPE_PTS: c_int = 10;
3457 pub const KF_TYPE_PROCDESC: c_int = 11;
3458 pub const KF_TYPE_DEV: c_int = 12;
3459 pub const KF_TYPE_UNKNOWN: c_int = 255;
3460
3461 pub const KF_VTYPE_VNON: c_int = 0;
3462 pub const KF_VTYPE_VREG: c_int = 1;
3463 pub const KF_VTYPE_VDIR: c_int = 2;
3464 pub const KF_VTYPE_VBLK: c_int = 3;
3465 pub const KF_VTYPE_VCHR: c_int = 4;
3466 pub const KF_VTYPE_VLNK: c_int = 5;
3467 pub const KF_VTYPE_VSOCK: c_int = 6;
3468 pub const KF_VTYPE_VFIFO: c_int = 7;
3469 pub const KF_VTYPE_VBAD: c_int = 8;
3470 pub const KF_VTYPE_UNKNOWN: c_int = 255;
3471
3472 /// Current working directory
3473 pub const KF_FD_TYPE_CWD: c_int = -1;
3474 /// Root directory
3475 pub const KF_FD_TYPE_ROOT: c_int = -2;
3476 /// Jail directory
3477 pub const KF_FD_TYPE_JAIL: c_int = -3;
3478 /// Ktrace vnode
3479 pub const KF_FD_TYPE_TRACE: c_int = -4;
3480 pub const KF_FD_TYPE_TEXT: c_int = -5;
3481 /// Controlling terminal
3482 pub const KF_FD_TYPE_CTTY: c_int = -6;
3483 pub const KF_FLAG_READ: c_int = 0x00000001;
3484 pub const KF_FLAG_WRITE: c_int = 0x00000002;
3485 pub const KF_FLAG_APPEND: c_int = 0x00000004;
3486 pub const KF_FLAG_ASYNC: c_int = 0x00000008;
3487 pub const KF_FLAG_FSYNC: c_int = 0x00000010;
3488 pub const KF_FLAG_NONBLOCK: c_int = 0x00000020;
3489 pub const KF_FLAG_DIRECT: c_int = 0x00000040;
3490 pub const KF_FLAG_HASLOCK: c_int = 0x00000080;
3491 pub const KF_FLAG_SHLOCK: c_int = 0x00000100;
3492 pub const KF_FLAG_EXLOCK: c_int = 0x00000200;
3493 pub const KF_FLAG_NOFOLLOW: c_int = 0x00000400;
3494 pub const KF_FLAG_CREAT: c_int = 0x00000800;
3495 pub const KF_FLAG_TRUNC: c_int = 0x00001000;
3496 pub const KF_FLAG_EXCL: c_int = 0x00002000;
3497 pub const KF_FLAG_EXEC: c_int = 0x00004000;
3498
3499 pub const KVME_TYPE_NONE: c_int = 0;
3500 pub const KVME_TYPE_DEFAULT: c_int = 1;
3501 pub const KVME_TYPE_VNODE: c_int = 2;
3502 pub const KVME_TYPE_SWAP: c_int = 3;
3503 pub const KVME_TYPE_DEVICE: c_int = 4;
3504 pub const KVME_TYPE_PHYS: c_int = 5;
3505 pub const KVME_TYPE_DEAD: c_int = 6;
3506 pub const KVME_TYPE_SG: c_int = 7;
3507 pub 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;
3510 pub const KVME_TYPE_UNKNOWN: c_int = 255;
3511 pub const KVME_PROT_READ: c_int = 0x00000001;
3512 pub const KVME_PROT_WRITE: c_int = 0x00000002;
3513 pub const KVME_PROT_EXEC: c_int = 0x00000004;
3514 pub const KVME_FLAG_COW: c_int = 0x00000001;
3515 pub const KVME_FLAG_NEEDS_COPY: c_int = 0x00000002;
3516 pub const KVME_FLAG_NOCOREDUMP: c_int = 0x00000004;
3517 pub const KVME_FLAG_SUPER: c_int = 0x00000008;
3518 pub const KVME_FLAG_GROWS_UP: c_int = 0x00000010;
3519 pub const KVME_FLAG_GROWS_DOWN: c_int = 0x00000020;
3520 pub const KVME_FLAG_USER_WIRED: c_int = 0x00000040;
3521
3522 pub const KKST_MAXLEN: c_int = 1024;
3523 /// Stack is valid.
3524 pub const KKST_STATE_STACKOK: c_int = 0;
3525 /// Stack swapped out.
3526 pub const KKST_STATE_SWAPPED: c_int = 1;
3527 pub const KKST_STATE_RUNNING: c_int = 2;
3528
3529 // Constants about priority.
3530 pub const PRI_MIN: c_int = 0;
3531 pub const PRI_MAX: c_int = 255;
3532 pub const PRI_MIN_ITHD: c_int = PRI_MIN;
3533 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3534 #[allow(deprecated)]
3535 pub const PRI_MAX_ITHD: c_int = PRI_MIN_REALTIME - 1;
3536 pub const PI_REALTIME: c_int = PRI_MIN_ITHD + 0;
3537 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3538 pub const PI_AV: c_int = PRI_MIN_ITHD + 4;
3539 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3540 pub const PI_NET: c_int = PRI_MIN_ITHD + 8;
3541 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3542 pub const PI_DISK: c_int = PRI_MIN_ITHD + 12;
3543 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3544 pub const PI_TTY: c_int = PRI_MIN_ITHD + 16;
3545 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3546 pub const PI_DULL: c_int = PRI_MIN_ITHD + 20;
3547 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3548 pub const PI_SOFT: c_int = PRI_MIN_ITHD + 24;
3549 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3550 pub const PRI_MIN_REALTIME: c_int = 48;
3551 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3552 #[allow(deprecated)]
3553 pub const PRI_MAX_REALTIME: c_int = PRI_MIN_KERN - 1;
3554 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3555 pub const PRI_MIN_KERN: c_int = 80;
3556 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3557 #[allow(deprecated)]
3558 pub 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)]
3561 pub const PSWP: c_int = PRI_MIN_KERN + 0;
3562 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3563 #[allow(deprecated)]
3564 pub const PVM: c_int = PRI_MIN_KERN + 4;
3565 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3566 #[allow(deprecated)]
3567 pub const PINOD: c_int = PRI_MIN_KERN + 8;
3568 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3569 #[allow(deprecated)]
3570 pub const PRIBIO: c_int = PRI_MIN_KERN + 12;
3571 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3572 #[allow(deprecated)]
3573 pub const PVFS: c_int = PRI_MIN_KERN + 16;
3574 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3575 #[allow(deprecated)]
3576 pub const PZERO: c_int = PRI_MIN_KERN + 20;
3577 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3578 #[allow(deprecated)]
3579 pub const PSOCK: c_int = PRI_MIN_KERN + 24;
3580 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3581 #[allow(deprecated)]
3582 pub const PWAIT: c_int = PRI_MIN_KERN + 28;
3583 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3584 #[allow(deprecated)]
3585 pub const PLOCK: c_int = PRI_MIN_KERN + 32;
3586 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3587 #[allow(deprecated)]
3588 pub const PPAUSE: c_int = PRI_MIN_KERN + 36;
3589 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3590 pub const PRI_MIN_TIMESHARE: c_int = 120;
3591 pub 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)]
3594 pub const PUSER: c_int = PRI_MIN_TIMESHARE;
3595 pub const PRI_MIN_IDLE: c_int = 224;
3596 pub const PRI_MAX_IDLE: c_int = PRI_MAX;
3597
3598 pub const NZERO: c_int = 0;
3599
3600 // Resource utilization information.
3601 pub const RUSAGE_THREAD: c_int = 1;
3602
3603 cfg_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 }
3610 pub const CHILD_MAX: c_int = 40;
3611 /// max command name remembered
3612 pub const MAXCOMLEN: usize = 19;
3613 /// max interpreter file name length
3614 pub const MAXINTERP: c_int = crate::PATH_MAX;
3615 /// max login name length (incl. NUL)
3616 pub const MAXLOGNAME: c_int = 33;
3617 /// max simultaneous processes
3618 pub const MAXUPRC: c_int = CHILD_MAX;
3619 /// max bytes for an exec function
3620 pub const NCARGS: c_int = ARG_MAX;
3621 /// /* max number groups
3622 pub const NGROUPS: c_int = NGROUPS_MAX + 1;
3623 /// max open files per process
3624 pub const NOFILE: c_int = OPEN_MAX;
3625 /// marker for empty group set member
3626 pub const NOGROUP: c_int = 65535;
3627 /// max hostname size
3628 pub const MAXHOSTNAMELEN: c_int = 256;
3629 /// max bytes in term canon input line
3630 pub const MAX_CANON: c_int = 255;
3631 /// max bytes in terminal input
3632 pub const MAX_INPUT: c_int = 255;
3633 /// max bytes in a file name
3634 pub const NAME_MAX: c_int = 255;
3635 pub const MAXSYMLINKS: c_int = 32;
3636 /// max supplemental group id's
3637 pub const NGROUPS_MAX: c_int = 1023;
3638 /// max open files per process
3639 pub const OPEN_MAX: c_int = 64;
3640
3641 pub const _POSIX_ARG_MAX: c_int = 4096;
3642 pub const _POSIX_LINK_MAX: c_int = 8;
3643 pub const _POSIX_MAX_CANON: c_int = 255;
3644 pub const _POSIX_MAX_INPUT: c_int = 255;
3645 pub const _POSIX_NAME_MAX: c_int = 14;
3646 pub const _POSIX_PIPE_BUF: c_int = 512;
3647 pub const _POSIX_SSIZE_MAX: c_int = 32767;
3648 pub const _POSIX_STREAM_MAX: c_int = 8;
3649
3650 /// max ibase/obase values in bc(1)
3651 pub const BC_BASE_MAX: c_int = 99;
3652 /// max array elements in bc(1)
3653 pub const BC_DIM_MAX: c_int = 2048;
3654 /// max scale value in bc(1)
3655 pub const BC_SCALE_MAX: c_int = 99;
3656 /// max const string length in bc(1)
3657 pub const BC_STRING_MAX: c_int = 1000;
3658 /// max character class name size
3659 pub const CHARCLASS_NAME_MAX: c_int = 14;
3660 /// max weights for order keyword
3661 pub const COLL_WEIGHTS_MAX: c_int = 10;
3662 /// max expressions nested in expr(1)
3663 pub const EXPR_NEST_MAX: c_int = 32;
3664 /// max bytes in an input line
3665 pub const LINE_MAX: c_int = 2048;
3666 /// max RE's in interval notation
3667 pub const RE_DUP_MAX: c_int = 255;
3668
3669 pub const _POSIX2_BC_BASE_MAX: c_int = 99;
3670 pub const _POSIX2_BC_DIM_MAX: c_int = 2048;
3671 pub const _POSIX2_BC_SCALE_MAX: c_int = 99;
3672 pub const _POSIX2_BC_STRING_MAX: c_int = 1000;
3673 pub const _POSIX2_CHARCLASS_NAME_MAX: c_int = 14;
3674 pub const _POSIX2_COLL_WEIGHTS_MAX: c_int = 2;
3675 pub const _POSIX2_EQUIV_CLASS_MAX: c_int = 2;
3676 pub const _POSIX2_EXPR_NEST_MAX: c_int = 32;
3677 pub const _POSIX2_LINE_MAX: c_int = 2048;
3678 pub const _POSIX2_RE_DUP_MAX: c_int = 255;
3679
3680 // sys/proc.h
3681 pub const TDF_BORROWING: c_int = 0x00000001;
3682 pub const TDF_INPANIC: c_int = 0x00000002;
3683 pub const TDF_INMEM: c_int = 0x00000004;
3684 pub const TDF_SINTR: c_int = 0x00000008;
3685 pub const TDF_TIMEOUT: c_int = 0x00000010;
3686 pub const TDF_IDLETD: c_int = 0x00000020;
3687 pub const TDF_CANSWAP: c_int = 0x00000040;
3688 pub const TDF_KTH_SUSP: c_int = 0x00000100;
3689 pub const TDF_ALLPROCSUSP: c_int = 0x00000200;
3690 pub const TDF_BOUNDARY: c_int = 0x00000400;
3691 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3692 pub const TDF_ASTPENDING: c_int = 0x00000800;
3693 pub const TDF_SBDRY: c_int = 0x00002000;
3694 pub const TDF_UPIBLOCKED: c_int = 0x00004000;
3695 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3696 pub const TDF_NEEDSUSPCHK: c_int = 0x00008000;
3697 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3698 pub const TDF_NEEDRESCHED: c_int = 0x00010000;
3699 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3700 pub const TDF_NEEDSIGCHK: c_int = 0x00020000;
3701 pub const TDF_NOLOAD: c_int = 0x00040000;
3702 pub const TDF_SERESTART: c_int = 0x00080000;
3703 pub const TDF_THRWAKEUP: c_int = 0x00100000;
3704 pub const TDF_SEINTR: c_int = 0x00200000;
3705 pub const TDF_SWAPINREQ: c_int = 0x00400000;
3706 #[deprecated(since = "0.2.133", note = "Removed in FreeBSD 14")]
3707 pub const TDF_UNUSED23: c_int = 0x00800000;
3708 pub const TDF_SCHED0: c_int = 0x01000000;
3709 pub const TDF_SCHED1: c_int = 0x02000000;
3710 pub const TDF_SCHED2: c_int = 0x04000000;
3711 pub const TDF_SCHED3: c_int = 0x08000000;
3712 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3713 pub const TDF_ALRMPEND: c_int = 0x10000000;
3714 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3715 pub const TDF_PROFPEND: c_int = 0x20000000;
3716 #[deprecated(since = "0.2.133", note = "Not stable across OS versions")]
3717 pub const TDF_MACPEND: c_int = 0x40000000;
3718
3719 pub const TDB_SUSPEND: c_int = 0x00000001;
3720 pub const TDB_XSIG: c_int = 0x00000002;
3721 pub const TDB_USERWR: c_int = 0x00000004;
3722 pub const TDB_SCE: c_int = 0x00000008;
3723 pub const TDB_SCX: c_int = 0x00000010;
3724 pub const TDB_EXEC: c_int = 0x00000020;
3725 pub const TDB_FORK: c_int = 0x00000040;
3726 pub const TDB_STOPATFORK: c_int = 0x00000080;
3727 pub const TDB_CHILD: c_int = 0x00000100;
3728 pub const TDB_BORN: c_int = 0x00000200;
3729 pub const TDB_EXIT: c_int = 0x00000400;
3730 pub const TDB_VFORK: c_int = 0x00000800;
3731 pub const TDB_FSTP: c_int = 0x00001000;
3732 pub const TDB_STEP: c_int = 0x00002000;
3733
3734 pub const TDP_OLDMASK: c_int = 0x00000001;
3735 pub const TDP_INKTR: c_int = 0x00000002;
3736 pub const TDP_INKTRACE: c_int = 0x00000004;
3737 pub const TDP_BUFNEED: c_int = 0x00000008;
3738 pub const TDP_COWINPROGRESS: c_int = 0x00000010;
3739 pub const TDP_ALTSTACK: c_int = 0x00000020;
3740 pub const TDP_DEADLKTREAT: c_int = 0x00000040;
3741 pub const TDP_NOFAULTING: c_int = 0x00000080;
3742 pub const TDP_OWEUPC: c_int = 0x00000200;
3743 pub const TDP_ITHREAD: c_int = 0x00000400;
3744 pub const TDP_SYNCIO: c_int = 0x00000800;
3745 pub const TDP_SCHED1: c_int = 0x00001000;
3746 pub const TDP_SCHED2: c_int = 0x00002000;
3747 pub const TDP_SCHED3: c_int = 0x00004000;
3748 pub const TDP_SCHED4: c_int = 0x00008000;
3749 pub const TDP_GEOM: c_int = 0x00010000;
3750 pub const TDP_SOFTDEP: c_int = 0x00020000;
3751 pub const TDP_NORUNNINGBUF: c_int = 0x00040000;
3752 pub const TDP_WAKEUP: c_int = 0x00080000;
3753 pub const TDP_INBDFLUSH: c_int = 0x00100000;
3754 pub const TDP_KTHREAD: c_int = 0x00200000;
3755 pub const TDP_CALLCHAIN: c_int = 0x00400000;
3756 pub const TDP_IGNSUSP: c_int = 0x00800000;
3757 pub const TDP_AUDITREC: c_int = 0x01000000;
3758 pub const TDP_RFPPWAIT: c_int = 0x02000000;
3759 pub const TDP_RESETSPUR: c_int = 0x04000000;
3760 pub const TDP_NERRNO: c_int = 0x08000000;
3761 pub const TDP_EXECVMSPC: c_int = 0x40000000;
3762
3763 pub const TDI_SUSPENDED: c_int = 0x0001;
3764 pub const TDI_SLEEPING: c_int = 0x0002;
3765 pub const TDI_SWAPPED: c_int = 0x0004;
3766 pub const TDI_LOCK: c_int = 0x0008;
3767 pub const TDI_IWAIT: c_int = 0x0010;
3768
3769 pub const P_ADVLOCK: c_int = 0x00000001;
3770 pub const P_CONTROLT: c_int = 0x00000002;
3771 pub const P_KPROC: c_int = 0x00000004;
3772 #[deprecated(since = "1.0", note = "Replaced in FreeBSD 15 by P_IDLEPROC")]
3773 pub const P_UNUSED3: c_int = 0x00000008;
3774 #[cfg(freebsd15)]
3775 pub const P_IDLEPROC: c_int = 0x00000008;
3776 pub const P_PPWAIT: c_int = 0x00000010;
3777 pub const P_PROFIL: c_int = 0x00000020;
3778 pub const P_STOPPROF: c_int = 0x00000040;
3779 pub const P_HADTHREADS: c_int = 0x00000080;
3780 pub const P_SUGID: c_int = 0x00000100;
3781 pub const P_SYSTEM: c_int = 0x00000200;
3782 pub const P_SINGLE_EXIT: c_int = 0x00000400;
3783 pub const P_TRACED: c_int = 0x00000800;
3784 pub const P_WAITED: c_int = 0x00001000;
3785 pub const P_WEXIT: c_int = 0x00002000;
3786 pub const P_EXEC: c_int = 0x00004000;
3787 pub const P_WKILLED: c_int = 0x00008000;
3788 pub const P_CONTINUED: c_int = 0x00010000;
3789 pub const P_STOPPED_SIG: c_int = 0x00020000;
3790 pub const P_STOPPED_TRACE: c_int = 0x00040000;
3791 pub const P_STOPPED_SINGLE: c_int = 0x00080000;
3792 pub const P_PROTECTED: c_int = 0x00100000;
3793 pub const P_SIGEVENT: c_int = 0x00200000;
3794 pub const P_SINGLE_BOUNDARY: c_int = 0x00400000;
3795 pub const P_HWPMC: c_int = 0x00800000;
3796 pub const P_JAILED: c_int = 0x01000000;
3797 pub const P_TOTAL_STOP: c_int = 0x02000000;
3798 pub const P_INEXEC: c_int = 0x04000000;
3799 pub const P_STATCHILD: c_int = 0x08000000;
3800 pub const P_INMEM: c_int = 0x10000000;
3801 pub const P_SWAPPINGOUT: c_int = 0x20000000;
3802 pub const P_SWAPPINGIN: c_int = 0x40000000;
3803 pub const P_PPTRACE: c_int = 0x80000000;
3804 pub const P_STOPPED: c_int = P_STOPPED_SIG | P_STOPPED_SINGLE | P_STOPPED_TRACE;
3805
3806 pub const P2_INHERIT_PROTECTED: c_int = 0x00000001;
3807 pub const P2_NOTRACE: c_int = 0x00000002;
3808 pub const P2_NOTRACE_EXEC: c_int = 0x00000004;
3809 pub const P2_AST_SU: c_int = 0x00000008;
3810 pub const P2_PTRACE_FSTP: c_int = 0x00000010;
3811 pub const P2_TRAPCAP: c_int = 0x00000020;
3812 pub const P2_STKGAP_DISABLE: c_int = 0x00000800;
3813 pub const P2_STKGAP_DISABLE_EXEC: c_int = 0x00001000;
3814
3815 pub const P_TREE_ORPHANED: c_int = 0x00000001;
3816 pub const P_TREE_FIRST_ORPHAN: c_int = 0x00000002;
3817 pub const P_TREE_REAPER: c_int = 0x00000004;
3818
3819 pub const SIDL: c_char = 1;
3820 pub const SRUN: c_char = 2;
3821 pub const SSLEEP: c_char = 3;
3822 pub const SSTOP: c_char = 4;
3823 pub const SZOMB: c_char = 5;
3824 pub const SWAIT: c_char = 6;
3825 pub const SLOCK: c_char = 7;
3826
3827 pub const P_MAGIC: c_int = 0xbeefface;
3828
3829 pub const TDP_SIGFASTBLOCK: c_int = 0x00000100;
3830 pub const TDP_UIOHELD: c_int = 0x10000000;
3831 pub const TDP_SIGFASTPENDING: c_int = 0x80000000;
3832 pub const TDP2_COMPAT32RB: c_int = 0x00000002;
3833 pub const P2_PROTMAX_ENABLE: c_int = 0x00000200;
3834 pub const P2_PROTMAX_DISABLE: c_int = 0x00000400;
3835 pub const TDP2_SBPAGES: c_int = 0x00000001;
3836 pub const P2_ASLR_ENABLE: c_int = 0x00000040;
3837 pub const P2_ASLR_DISABLE: c_int = 0x00000080;
3838 pub const P2_ASLR_IGNSTART: c_int = 0x00000100;
3839 pub const P_TREE_GRPEXITED: c_int = 0x00000008;
3840
3841 // libprocstat.h
3842 pub const PS_FST_VTYPE_VNON: c_int = 1;
3843 pub const PS_FST_VTYPE_VREG: c_int = 2;
3844 pub const PS_FST_VTYPE_VDIR: c_int = 3;
3845 pub const PS_FST_VTYPE_VBLK: c_int = 4;
3846 pub const PS_FST_VTYPE_VCHR: c_int = 5;
3847 pub const PS_FST_VTYPE_VLNK: c_int = 6;
3848 pub const PS_FST_VTYPE_VSOCK: c_int = 7;
3849 pub const PS_FST_VTYPE_VFIFO: c_int = 8;
3850 pub const PS_FST_VTYPE_VBAD: c_int = 9;
3851 pub const PS_FST_VTYPE_UNKNOWN: c_int = 255;
3852
3853 pub const PS_FST_TYPE_VNODE: c_int = 1;
3854 pub const PS_FST_TYPE_FIFO: c_int = 2;
3855 pub const PS_FST_TYPE_SOCKET: c_int = 3;
3856 pub const PS_FST_TYPE_PIPE: c_int = 4;
3857 pub const PS_FST_TYPE_PTS: c_int = 5;
3858 pub const PS_FST_TYPE_KQUEUE: c_int = 6;
3859 pub const PS_FST_TYPE_MQUEUE: c_int = 8;
3860 pub const PS_FST_TYPE_SHM: c_int = 9;
3861 pub const PS_FST_TYPE_SEM: c_int = 10;
3862 pub const PS_FST_TYPE_UNKNOWN: c_int = 11;
3863 pub const PS_FST_TYPE_NONE: c_int = 12;
3864 pub const PS_FST_TYPE_PROCDESC: c_int = 13;
3865 pub const PS_FST_TYPE_DEV: c_int = 14;
3866 pub const PS_FST_TYPE_EVENTFD: c_int = 15;
3867
3868 pub const PS_FST_UFLAG_RDIR: c_int = 0x0001;
3869 pub const PS_FST_UFLAG_CDIR: c_int = 0x0002;
3870 pub const PS_FST_UFLAG_JAIL: c_int = 0x0004;
3871 pub const PS_FST_UFLAG_TRACE: c_int = 0x0008;
3872 pub const PS_FST_UFLAG_TEXT: c_int = 0x0010;
3873 pub const PS_FST_UFLAG_MMAP: c_int = 0x0020;
3874 pub const PS_FST_UFLAG_CTTY: c_int = 0x0040;
3875
3876 pub const PS_FST_FFLAG_READ: c_int = 0x0001;
3877 pub const PS_FST_FFLAG_WRITE: c_int = 0x0002;
3878 pub const PS_FST_FFLAG_NONBLOCK: c_int = 0x0004;
3879 pub const PS_FST_FFLAG_APPEND: c_int = 0x0008;
3880 pub const PS_FST_FFLAG_SHLOCK: c_int = 0x0010;
3881 pub const PS_FST_FFLAG_EXLOCK: c_int = 0x0020;
3882 pub const PS_FST_FFLAG_ASYNC: c_int = 0x0040;
3883 pub const PS_FST_FFLAG_SYNC: c_int = 0x0080;
3884 pub const PS_FST_FFLAG_NOFOLLOW: c_int = 0x0100;
3885 pub const PS_FST_FFLAG_CREAT: c_int = 0x0200;
3886 pub const PS_FST_FFLAG_TRUNC: c_int = 0x0400;
3887 pub const PS_FST_FFLAG_EXCL: c_int = 0x0800;
3888 pub const PS_FST_FFLAG_DIRECT: c_int = 0x1000;
3889 pub const PS_FST_FFLAG_EXEC: c_int = 0x2000;
3890 pub 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.
3899 pub const MAXFIDSZ: c_int = 16;
3900 /// Length of type name including null.
3901 pub const MFSNAMELEN: c_int = 16;
3902 cfg_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.
3913 pub const MNT_SUJ: u64 = 0x100000000;
3914 /// Mounted by automountd(8).
3915 pub const MNT_AUTOMOUNTED: u64 = 0x200000000;
3916 /// Filesys metadata untrusted.
3917 pub const MNT_UNTRUSTED: u64 = 0x800000000;
3918
3919 /// Require TLS.
3920 pub const MNT_EXTLS: u64 = 0x4000000000;
3921 /// Require TLS with client cert.
3922 pub const MNT_EXTLSCERT: u64 = 0x8000000000;
3923 /// Require TLS with user cert.
3924 pub const MNT_EXTLSCERTUSER: u64 = 0x10000000000;
3925
3926 /// Filesystem is stored locally.
3927 pub const MNT_LOCAL: u64 = 0x000001000;
3928 /// Quotas are enabled on fs.
3929 pub const MNT_QUOTA: u64 = 0x000002000;
3930 /// Identifies the root fs.
3931 pub const MNT_ROOTFS: u64 = 0x000004000;
3932 /// Mounted by a user.
3933 pub const MNT_USER: u64 = 0x000008000;
3934 /// Do not show entry in df.
3935 pub const MNT_IGNORE: u64 = 0x000800000;
3936 /// Filesystem is verified.
3937 pub const MNT_VERIFIED: u64 = 0x400000000;
3938
3939 /// Do not cover a mount point.
3940 pub const MNT_NOCOVER: u64 = 0x001000000000;
3941 /// Only mount on empty dir.
3942 pub const MNT_EMPTYDIR: u64 = 0x002000000000;
3943 /// Recursively unmount uppers.
3944 pub const MNT_RECURSE: u64 = 0x100000000000;
3945 /// Unmount in async context.
3946 pub const MNT_DEFERRED: u64 = 0x200000000000;
3947
3948 /// Get configured filesystems.
3949 pub const VFS_VFSCONF: c_int = 0;
3950 /// Generic filesystem information.
3951 pub const VFS_GENERIC: c_int = 0;
3952
3953 /// int: highest defined filesystem type.
3954 pub const VFS_MAXTYPENUM: c_int = 1;
3955 /// struct: vfsconf for filesystem given as next argument.
3956 pub const VFS_CONF: c_int = 2;
3957
3958 /// Synchronously wait for I/O to complete.
3959 pub const MNT_WAIT: c_int = 1;
3960 /// Start all I/O, but do not wait for it.
3961 pub const MNT_NOWAIT: c_int = 2;
3962 /// Push data not written by filesystem syncer.
3963 pub const MNT_LAZY: c_int = 3;
3964 /// Suspend file system after sync.
3965 pub const MNT_SUSPEND: c_int = 4;
3966
3967 pub const MAXSECFLAVORS: c_int = 5;
3968
3969 /// Statically compiled into kernel.
3970 pub const VFCF_STATIC: c_int = 0x00010000;
3971 /// May get data over the network.
3972 pub const VFCF_NETWORK: c_int = 0x00020000;
3973 /// Writes are not implemented.
3974 pub const VFCF_READONLY: c_int = 0x00040000;
3975 /// Data does not represent real files.
3976 pub const VFCF_SYNTHETIC: c_int = 0x00080000;
3977 /// Aliases some other mounted FS.
3978 pub const VFCF_LOOPBACK: c_int = 0x00100000;
3979 /// Stores file names as Unicode.
3980 pub const VFCF_UNICODE: c_int = 0x00200000;
3981 /// Can be mounted from within a jail.
3982 pub const VFCF_JAIL: c_int = 0x00400000;
3983 /// Supports delegated administration.
3984 pub const VFCF_DELEGADMIN: c_int = 0x00800000;
3985 /// Stop at Boundary: defer stop requests to kernel->user (AST) transition.
3986 pub const VFCF_SBDRY: c_int = 0x01000000;
3987
3988 // time.h
3989
3990 /// not on dst
3991 pub const DST_NONE: c_int = 0;
3992 /// USA style dst
3993 pub const DST_USA: c_int = 1;
3994 /// Australian style dst
3995 pub const DST_AUST: c_int = 2;
3996 /// Western European dst
3997 pub const DST_WET: c_int = 3;
3998 /// Middle European dst
3999 pub const DST_MET: c_int = 4;
4000 /// Eastern European dst
4001 pub const DST_EET: c_int = 5;
4002 /// Canada
4003 pub const DST_CAN: c_int = 6;
4004
4005 pub const CPUCLOCK_WHICH_PID: c_int = 0;
4006 pub const CPUCLOCK_WHICH_TID: c_int = 1;
4007
4008 pub const MFD_CLOEXEC: c_uint = 0x00000001;
4009 pub const MFD_ALLOW_SEALING: c_uint = 0x00000002;
4010 pub const MFD_HUGETLB: c_uint = 0x00000004;
4011 pub const MFD_HUGE_MASK: c_uint = 0xFC000000;
4012 pub const MFD_HUGE_64KB: c_uint = 16 << 26;
4013 pub const MFD_HUGE_512KB: c_uint = 19 << 26;
4014 pub const MFD_HUGE_1MB: c_uint = 20 << 26;
4015 pub const MFD_HUGE_2MB: c_uint = 21 << 26;
4016 pub const MFD_HUGE_8MB: c_uint = 23 << 26;
4017 pub const MFD_HUGE_16MB: c_uint = 24 << 26;
4018 pub const MFD_HUGE_32MB: c_uint = 25 << 26;
4019 pub const MFD_HUGE_256MB: c_uint = 28 << 26;
4020 pub const MFD_HUGE_512MB: c_uint = 29 << 26;
4021 pub const MFD_HUGE_1GB: c_uint = 30 << 26;
4022 pub const MFD_HUGE_2GB: c_uint = 31 << 26;
4023 pub const MFD_HUGE_16GB: c_uint = 34 << 26;
4024
4025 pub const SHM_LARGEPAGE_ALLOC_DEFAULT: c_int = 0;
4026 pub const SHM_LARGEPAGE_ALLOC_NOWAIT: c_int = 1;
4027 pub const SHM_LARGEPAGE_ALLOC_HARD: c_int = 2;
4028 pub const SHM_RENAME_NOREPLACE: c_int = 1 << 0;
4029 pub const SHM_RENAME_EXCHANGE: c_int = 1 << 1;
4030
4031 // sys/umtx.h
4032
4033 pub const UMTX_OP_WAIT: c_int = 2;
4034 pub const UMTX_OP_WAKE: c_int = 3;
4035 pub const UMTX_OP_MUTEX_TRYLOCK: c_int = 4;
4036 pub const UMTX_OP_MUTEX_LOCK: c_int = 5;
4037 pub const UMTX_OP_MUTEX_UNLOCK: c_int = 6;
4038 pub const UMTX_OP_SET_CEILING: c_int = 7;
4039 pub const UMTX_OP_CV_WAIT: c_int = 8;
4040 pub const UMTX_OP_CV_SIGNAL: c_int = 9;
4041 pub const UMTX_OP_CV_BROADCAST: c_int = 10;
4042 pub const UMTX_OP_WAIT_UINT: c_int = 11;
4043 pub const UMTX_OP_RW_RDLOCK: c_int = 12;
4044 pub const UMTX_OP_RW_WRLOCK: c_int = 13;
4045 pub const UMTX_OP_RW_UNLOCK: c_int = 14;
4046 pub const UMTX_OP_WAIT_UINT_PRIVATE: c_int = 15;
4047 pub const UMTX_OP_WAKE_PRIVATE: c_int = 16;
4048 pub const UMTX_OP_MUTEX_WAIT: c_int = 17;
4049 pub const UMTX_OP_NWAKE_PRIVATE: c_int = 21;
4050 pub const UMTX_OP_MUTEX_WAKE2: c_int = 22;
4051 pub const UMTX_OP_SEM2_WAIT: c_int = 23;
4052 pub const UMTX_OP_SEM2_WAKE: c_int = 24;
4053 pub const UMTX_OP_SHM: c_int = 25;
4054 pub const UMTX_OP_ROBUST_LISTS: c_int = 26;
4055
4056 pub const UMTX_ABSTIME: u32 = 1;
4057
4058 pub const CPU_LEVEL_ROOT: c_int = 1;
4059 pub const CPU_LEVEL_CPUSET: c_int = 2;
4060 pub const CPU_LEVEL_WHICH: c_int = 3;
4061
4062 pub const CPU_WHICH_TID: c_int = 1;
4063 pub const CPU_WHICH_PID: c_int = 2;
4064 pub const CPU_WHICH_CPUSET: c_int = 3;
4065 pub const CPU_WHICH_IRQ: c_int = 4;
4066 pub const CPU_WHICH_JAIL: c_int = 5;
4067
4068 // net/route.h
4069 pub const RTF_LLDATA: c_int = 0x400;
4070 pub const RTF_FIXEDMTU: c_int = 0x80000;
4071
4072 pub const RTM_VERSION: c_int = 5;
4073
4074 pub const RTAX_MAX: c_int = 8;
4075
4076 // sys/signal.h
4077 pub const SIGTHR: c_int = 32;
4078 pub const SIGLWP: c_int = SIGTHR;
4079 pub const SIGLIBRT: c_int = 33;
4080
4081 // netinet/sctp.h
4082 pub const SCTP_FUTURE_ASSOC: c_int = 0;
4083 pub const SCTP_CURRENT_ASSOC: c_int = 1;
4084 pub const SCTP_ALL_ASSOC: c_int = 2;
4085
4086 pub const SCTP_NO_NEXT_MSG: c_int = 0x0000;
4087 pub const SCTP_NEXT_MSG_AVAIL: c_int = 0x0001;
4088 pub const SCTP_NEXT_MSG_ISCOMPLETE: c_int = 0x0002;
4089 pub const SCTP_NEXT_MSG_IS_UNORDERED: c_int = 0x0004;
4090 pub const SCTP_NEXT_MSG_IS_NOTIFICATION: c_int = 0x0008;
4091
4092 pub const SCTP_RECVV_NOINFO: c_int = 0;
4093 pub const SCTP_RECVV_RCVINFO: c_int = 1;
4094 pub const SCTP_RECVV_NXTINFO: c_int = 2;
4095 pub const SCTP_RECVV_RN: c_int = 3;
4096
4097 pub const SCTP_SENDV_NOINFO: c_int = 0;
4098 pub const SCTP_SENDV_SNDINFO: c_int = 1;
4099 pub const SCTP_SENDV_PRINFO: c_int = 2;
4100 pub const SCTP_SENDV_AUTHINFO: c_int = 3;
4101 pub const SCTP_SENDV_SPA: c_int = 4;
4102
4103 pub const SCTP_SEND_SNDINFO_VALID: c_int = 0x00000001;
4104 pub const SCTP_SEND_PRINFO_VALID: c_int = 0x00000002;
4105 pub const SCTP_SEND_AUTHINFO_VALID: c_int = 0x00000004;
4106
4107 pub const SCTP_NOTIFICATION: c_int = 0x0010;
4108 pub const SCTP_COMPLETE: c_int = 0x0020;
4109 pub const SCTP_EOF: c_int = 0x0100;
4110 pub const SCTP_ABORT: c_int = 0x0200;
4111 pub const SCTP_UNORDERED: c_int = 0x0400;
4112 pub const SCTP_ADDR_OVER: c_int = 0x0800;
4113 pub const SCTP_SENDALL: c_int = 0x1000;
4114 pub const SCTP_EOR: c_int = 0x2000;
4115 pub const SCTP_SACK_IMMEDIATELY: c_int = 0x4000;
4116 pub const SCTP_PR_SCTP_NONE: c_int = 0x0000;
4117 pub const SCTP_PR_SCTP_TTL: c_int = 0x0001;
4118 pub const SCTP_PR_SCTP_PRIO: c_int = 0x0002;
4119 pub const SCTP_PR_SCTP_BUF: c_int = SCTP_PR_SCTP_PRIO;
4120 pub const SCTP_PR_SCTP_RTX: c_int = 0x0003;
4121 pub const SCTP_PR_SCTP_MAX: c_int = SCTP_PR_SCTP_RTX;
4122 pub const SCTP_PR_SCTP_ALL: c_int = 0x000f;
4123
4124 pub const SCTP_INIT: c_int = 0x0001;
4125 pub const SCTP_SNDRCV: c_int = 0x0002;
4126 pub const SCTP_EXTRCV: c_int = 0x0003;
4127 pub const SCTP_SNDINFO: c_int = 0x0004;
4128 pub const SCTP_RCVINFO: c_int = 0x0005;
4129 pub const SCTP_NXTINFO: c_int = 0x0006;
4130 pub const SCTP_PRINFO: c_int = 0x0007;
4131 pub const SCTP_AUTHINFO: c_int = 0x0008;
4132 pub const SCTP_DSTADDRV4: c_int = 0x0009;
4133 pub const SCTP_DSTADDRV6: c_int = 0x000a;
4134
4135 pub const SCTP_RTOINFO: c_int = 0x00000001;
4136 pub const SCTP_ASSOCINFO: c_int = 0x00000002;
4137 pub const SCTP_INITMSG: c_int = 0x00000003;
4138 pub const SCTP_NODELAY: c_int = 0x00000004;
4139 pub const SCTP_AUTOCLOSE: c_int = 0x00000005;
4140 pub const SCTP_SET_PEER_PRIMARY_ADDR: c_int = 0x00000006;
4141 pub const SCTP_PRIMARY_ADDR: c_int = 0x00000007;
4142 pub const SCTP_ADAPTATION_LAYER: c_int = 0x00000008;
4143 pub const SCTP_ADAPTION_LAYER: c_int = 0x00000008;
4144 pub const SCTP_DISABLE_FRAGMENTS: c_int = 0x00000009;
4145 pub const SCTP_PEER_ADDR_PARAMS: c_int = 0x0000000a;
4146 pub const SCTP_DEFAULT_SEND_PARAM: c_int = 0x0000000b;
4147 pub const SCTP_EVENTS: c_int = 0x0000000c;
4148 pub const SCTP_I_WANT_MAPPED_V4_ADDR: c_int = 0x0000000d;
4149 pub const SCTP_MAXSEG: c_int = 0x0000000e;
4150 pub const SCTP_DELAYED_SACK: c_int = 0x0000000f;
4151 pub const SCTP_FRAGMENT_INTERLEAVE: c_int = 0x00000010;
4152 pub const SCTP_PARTIAL_DELIVERY_POINT: c_int = 0x00000011;
4153 pub const SCTP_AUTH_CHUNK: c_int = 0x00000012;
4154 pub const SCTP_AUTH_KEY: c_int = 0x00000013;
4155 pub const SCTP_HMAC_IDENT: c_int = 0x00000014;
4156 pub const SCTP_AUTH_ACTIVE_KEY: c_int = 0x00000015;
4157 pub const SCTP_AUTH_DELETE_KEY: c_int = 0x00000016;
4158 pub const SCTP_USE_EXT_RCVINFO: c_int = 0x00000017;
4159 pub const SCTP_AUTO_ASCONF: c_int = 0x00000018;
4160 pub const SCTP_MAXBURST: c_int = 0x00000019;
4161 pub const SCTP_MAX_BURST: c_int = 0x00000019;
4162 pub const SCTP_CONTEXT: c_int = 0x0000001a;
4163 pub const SCTP_EXPLICIT_EOR: c_int = 0x00000001b;
4164 pub const SCTP_REUSE_PORT: c_int = 0x00000001c;
4165 pub const SCTP_AUTH_DEACTIVATE_KEY: c_int = 0x00000001d;
4166 pub const SCTP_EVENT: c_int = 0x0000001e;
4167 pub const SCTP_RECVRCVINFO: c_int = 0x0000001f;
4168 pub const SCTP_RECVNXTINFO: c_int = 0x00000020;
4169 pub const SCTP_DEFAULT_SNDINFO: c_int = 0x00000021;
4170 pub const SCTP_DEFAULT_PRINFO: c_int = 0x00000022;
4171 pub const SCTP_PEER_ADDR_THLDS: c_int = 0x00000023;
4172 pub const SCTP_REMOTE_UDP_ENCAPS_PORT: c_int = 0x00000024;
4173 pub const SCTP_ECN_SUPPORTED: c_int = 0x00000025;
4174 pub const SCTP_AUTH_SUPPORTED: c_int = 0x00000027;
4175 pub const SCTP_ASCONF_SUPPORTED: c_int = 0x00000028;
4176 pub const SCTP_RECONFIG_SUPPORTED: c_int = 0x00000029;
4177 pub const SCTP_NRSACK_SUPPORTED: c_int = 0x00000030;
4178 pub const SCTP_PKTDROP_SUPPORTED: c_int = 0x00000031;
4179 pub const SCTP_MAX_CWND: c_int = 0x00000032;
4180
4181 pub const SCTP_STATUS: c_int = 0x00000100;
4182 pub const SCTP_GET_PEER_ADDR_INFO: c_int = 0x00000101;
4183 pub const SCTP_PEER_AUTH_CHUNKS: c_int = 0x00000102;
4184 pub const SCTP_LOCAL_AUTH_CHUNKS: c_int = 0x00000103;
4185 pub const SCTP_GET_ASSOC_NUMBER: c_int = 0x00000104;
4186 pub const SCTP_GET_ASSOC_ID_LIST: c_int = 0x00000105;
4187 pub const SCTP_TIMEOUTS: c_int = 0x00000106;
4188 pub const SCTP_PR_STREAM_STATUS: c_int = 0x00000107;
4189 pub const SCTP_PR_ASSOC_STATUS: c_int = 0x00000108;
4190
4191 pub const SCTP_COMM_UP: c_int = 0x0001;
4192 pub const SCTP_COMM_LOST: c_int = 0x0002;
4193 pub const SCTP_RESTART: c_int = 0x0003;
4194 pub const SCTP_SHUTDOWN_COMP: c_int = 0x0004;
4195 pub const SCTP_CANT_STR_ASSOC: c_int = 0x0005;
4196
4197 pub const SCTP_ASSOC_SUPPORTS_PR: c_int = 0x01;
4198 pub const SCTP_ASSOC_SUPPORTS_AUTH: c_int = 0x02;
4199 pub const SCTP_ASSOC_SUPPORTS_ASCONF: c_int = 0x03;
4200 pub const SCTP_ASSOC_SUPPORTS_MULTIBUF: c_int = 0x04;
4201 pub const SCTP_ASSOC_SUPPORTS_RE_CONFIG: c_int = 0x05;
4202 pub const SCTP_ASSOC_SUPPORTS_INTERLEAVING: c_int = 0x06;
4203 pub const SCTP_ASSOC_SUPPORTS_MAX: c_int = 0x06;
4204
4205 pub const SCTP_ADDR_AVAILABLE: c_int = 0x0001;
4206 pub const SCTP_ADDR_UNREACHABLE: c_int = 0x0002;
4207 pub const SCTP_ADDR_REMOVED: c_int = 0x0003;
4208 pub const SCTP_ADDR_ADDED: c_int = 0x0004;
4209 pub const SCTP_ADDR_MADE_PRIM: c_int = 0x0005;
4210 pub const SCTP_ADDR_CONFIRMED: c_int = 0x0006;
4211
4212 pub const SCTP_ACTIVE: c_int = 0x0001;
4213 pub const SCTP_INACTIVE: c_int = 0x0002;
4214 pub const SCTP_UNCONFIRMED: c_int = 0x0200;
4215
4216 pub const SCTP_DATA_UNSENT: c_int = 0x0001;
4217 pub const SCTP_DATA_SENT: c_int = 0x0002;
4218
4219 pub const SCTP_PARTIAL_DELIVERY_ABORTED: c_int = 0x0001;
4220
4221 pub const SCTP_AUTH_NEW_KEY: c_int = 0x0001;
4222 pub const SCTP_AUTH_NEWKEY: c_int = SCTP_AUTH_NEW_KEY;
4223 pub const SCTP_AUTH_NO_AUTH: c_int = 0x0002;
4224 pub const SCTP_AUTH_FREE_KEY: c_int = 0x0003;
4225
4226 pub const SCTP_STREAM_RESET_INCOMING_SSN: c_int = 0x0001;
4227 pub const SCTP_STREAM_RESET_OUTGOING_SSN: c_int = 0x0002;
4228 pub const SCTP_STREAM_RESET_DENIED: c_int = 0x0004;
4229 pub const SCTP_STREAM_RESET_FAILED: c_int = 0x0008;
4230
4231 pub const SCTP_ASSOC_RESET_DENIED: c_int = 0x0004;
4232 pub const SCTP_ASSOC_RESET_FAILED: c_int = 0x0008;
4233
4234 pub const SCTP_STREAM_CHANGE_DENIED: c_int = 0x0004;
4235 pub const SCTP_STREAM_CHANGE_FAILED: c_int = 0x0008;
4236
4237 pub const KENV_DUMP_LOADER: c_int = 4;
4238 pub const KENV_DUMP_STATIC: c_int = 5;
4239
4240 pub const RB_PAUSE: c_int = 0x100000;
4241 pub const RB_REROOT: c_int = 0x200000;
4242 pub const RB_POWERCYCLE: c_int = 0x400000;
4243 pub const RB_PROBE: c_int = 0x10000000;
4244 pub const RB_MULTIPLE: c_int = 0x20000000;
4245
4246 // netinet/in_pcb.h
4247 pub const INC_ISIPV6: c_uchar = 0x01;
4248 pub const INC_IPV6MINMTU: c_uchar = 0x02;
4249
4250 // sys/time.h
4251 pub const CLOCK_BOOTTIME: crate::clockid_t = crate::CLOCK_UPTIME;
4252 pub const CLOCK_REALTIME_COARSE: crate::clockid_t = crate::CLOCK_REALTIME_FAST;
4253 pub const CLOCK_MONOTONIC_COARSE: crate::clockid_t = crate::CLOCK_MONOTONIC_FAST;
4254
4255 // sys/timerfd.h
4256
4257 pub const TFD_NONBLOCK: c_int = crate::O_NONBLOCK;
4258 pub const TFD_CLOEXEC: c_int = O_CLOEXEC;
4259 pub const TFD_TIMER_ABSTIME: c_int = 0x01;
4260 pub const TFD_TIMER_CANCEL_ON_SET: c_int = 0x02;
4261
4262 // sys/unistd.h
4263
4264 pub const CLOSE_RANGE_CLOEXEC: c_uint = 1 << 2;
4265
4266 pub const KCMP_FILE: c_int = 100;
4267 pub const KCMP_FILEOBJ: c_int = 101;
4268 pub const KCMP_FILES: c_int = 102;
4269 pub const KCMP_SIGHAND: c_int = 103;
4270 pub const KCMP_VM: c_int = 104;
4271
4272 pub const fn MAP_ALIGNED(a: c_int) -> c_int {
4273 a << 24
4274 }
4275
4276 const fn _ALIGN(p: usize) -> usize {
4277 (p + _ALIGNBYTES) & !_ALIGNBYTES
4278 }
4279
4280 f! {
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
4382 safe_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
4428 cfg_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
4439 extern "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 pub fn pthread_timedjoin_np(
4648 thread: crate::pthread_t,
4649 retval: *mut *mut c_void,
4650 abstime: *const crate::timespec,
4651 ) -> c_int;
4652
4653 #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "statfs@FBSD_1.0")]
4654 pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
4655 #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "fstatfs@FBSD_1.0")]
4656 pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
4657
4658 pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int;
4659 pub fn __xuname(nmln: c_int, buf: *mut c_void) -> c_int;
4660
4661 pub fn sendmmsg(
4662 sockfd: c_int,
4663 msgvec: *mut crate::mmsghdr,
4664 vlen: size_t,
4665 flags: c_int,
4666 ) -> ssize_t;
4667 pub fn recvmmsg(
4668 sockfd: c_int,
4669 msgvec: *mut crate::mmsghdr,
4670 vlen: size_t,
4671 flags: c_int,
4672 timeout: *const crate::timespec,
4673 ) -> ssize_t;
4674 pub fn memmem(
4675 haystack: *const c_void,
4676 haystacklen: size_t,
4677 needle: *const c_void,
4678 needlelen: size_t,
4679 ) -> *mut c_void;
4680
4681 pub fn fhopen(fhp: *const fhandle_t, flags: c_int) -> c_int;
4682 pub fn fhstat(fhp: *const fhandle, buf: *mut crate::stat) -> c_int;
4683 pub fn fhstatfs(fhp: *const fhandle_t, buf: *mut crate::statfs) -> c_int;
4684 pub fn getfh(path: *const c_char, fhp: *mut fhandle_t) -> c_int;
4685 pub fn lgetfh(path: *const c_char, fhp: *mut fhandle_t) -> c_int;
4686 pub fn getfsstat(buf: *mut crate::statfs, bufsize: c_long, mode: c_int) -> c_int;
4687 #[cfg_attr(
4688 all(target_os = "freebsd", freebsd11),
4689 link_name = "getmntinfo@FBSD_1.0"
4690 )]
4691 pub fn getmntinfo(mntbufp: *mut *mut crate::statfs, mode: c_int) -> c_int;
4692 pub fn mount(
4693 type_: *const c_char,
4694 dir: *const c_char,
4695 flags: c_int,
4696 data: *mut c_void,
4697 ) -> c_int;
4698 pub fn nmount(iov: *mut crate::iovec, niov: c_uint, flags: c_int) -> c_int;
4699
4700 pub fn setproctitle(fmt: *const c_char, ...);
4701 pub fn rfork(flags: c_int) -> c_int;
4702 pub fn cpuset_getaffinity(
4703 level: cpulevel_t,
4704 which: cpuwhich_t,
4705 id: crate::id_t,
4706 setsize: size_t,
4707 mask: *mut cpuset_t,
4708 ) -> c_int;
4709 pub fn cpuset_setaffinity(
4710 level: cpulevel_t,
4711 which: cpuwhich_t,
4712 id: crate::id_t,
4713 setsize: size_t,
4714 mask: *const cpuset_t,
4715 ) -> c_int;
4716 pub fn cpuset(setid: *mut crate::cpusetid_t) -> c_int;
4717 pub fn cpuset_getid(
4718 level: cpulevel_t,
4719 which: cpuwhich_t,
4720 id: crate::id_t,
4721 setid: *mut crate::cpusetid_t,
4722 ) -> c_int;
4723 pub fn cpuset_setid(which: cpuwhich_t, id: crate::id_t, setid: crate::cpusetid_t) -> c_int;
4724 pub fn cap_enter() -> c_int;
4725 pub fn cap_getmode(modep: *mut c_uint) -> c_int;
4726 pub fn cap_fcntls_get(fd: c_int, fcntlrightsp: *mut u32) -> c_int;
4727 pub fn cap_fcntls_limit(fd: c_int, fcntlrights: u32) -> c_int;
4728 pub fn cap_ioctls_get(fd: c_int, cmds: *mut u_long, maxcmds: usize) -> isize;
4729 pub fn cap_ioctls_limit(fd: c_int, cmds: *const u_long, ncmds: usize) -> c_int;
4730 pub fn __cap_rights_init(version: c_int, rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
4731 pub fn __cap_rights_get(version: c_int, fd: c_int, rightsp: *mut cap_rights_t) -> c_int;
4732 pub fn __cap_rights_set(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
4733 pub fn __cap_rights_clear(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t;
4734 pub fn __cap_rights_is_set(rights: *const cap_rights_t, ...) -> bool;
4735 pub fn cap_rights_is_valid(rights: *const cap_rights_t) -> bool;
4736 pub fn cap_rights_limit(fd: c_int, rights: *const cap_rights_t) -> c_int;
4737 pub fn cap_rights_merge(dst: *mut cap_rights_t, src: *const cap_rights_t) -> *mut cap_rights_t;
4738 pub fn cap_rights_remove(dst: *mut cap_rights_t, src: *const cap_rights_t)
4739 -> *mut cap_rights_t;
4740 pub fn cap_rights_contains(big: *const cap_rights_t, little: *const cap_rights_t) -> bool;
4741 pub fn cap_sandboxed() -> bool;
4742
4743 pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void;
4744
4745 pub fn ffs(value: c_int) -> c_int;
4746 pub fn ffsl(value: c_long) -> c_int;
4747 pub fn ffsll(value: c_longlong) -> c_int;
4748 pub fn fls(value: c_int) -> c_int;
4749 pub fn flsl(value: c_long) -> c_int;
4750 pub fn flsll(value: c_longlong) -> c_int;
4751 pub fn malloc_stats_print(
4752 write_cb: unsafe extern "C" fn(*mut c_void, *const c_char),
4753 cbopaque: *mut c_void,
4754 opt: *const c_char,
4755 );
4756 pub fn mallctl(
4757 name: *const c_char,
4758 oldp: *mut c_void,
4759 oldlenp: *mut size_t,
4760 newp: *mut c_void,
4761 newlen: size_t,
4762 ) -> c_int;
4763 pub fn mallctlnametomib(name: *const c_char, mibp: *mut size_t, miplen: *mut size_t) -> c_int;
4764 pub fn mallctlbymib(
4765 mib: *const size_t,
4766 mible: size_t,
4767 oldp: *mut c_void,
4768 oldlenp: *mut size_t,
4769 newp: *mut c_void,
4770 newlen: size_t,
4771 ) -> c_int;
4772 pub fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
4773 pub fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
4774 pub fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
4775 pub fn sallocx(ptr: *const c_void, flags: c_int) -> size_t;
4776 pub fn dallocx(ptr: *mut c_void, flags: c_int);
4777 pub fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
4778 pub fn nallocx(size: size_t, flags: c_int) -> size_t;
4779
4780 pub fn procctl(
4781 idtype: crate::idtype_t,
4782 id: crate::id_t,
4783 cmd: c_int,
4784 data: *mut c_void,
4785 ) -> c_int;
4786
4787 pub fn getpagesize() -> c_int;
4788 pub fn getpagesizes(pagesize: *mut size_t, nelem: c_int) -> c_int;
4789
4790 pub fn clock_getcpuclockid2(arg1: crate::id_t, arg2: c_int, arg3: *mut clockid_t) -> c_int;
4791 pub fn strchrnul(s: *const c_char, c: c_int) -> *mut c_char;
4792
4793 pub fn shm_create_largepage(
4794 path: *const c_char,
4795 flags: c_int,
4796 psind: c_int,
4797 alloc_policy: c_int,
4798 mode: crate::mode_t,
4799 ) -> c_int;
4800 pub fn shm_rename(path_from: *const c_char, path_to: *const c_char, flags: c_int) -> c_int;
4801 pub fn memfd_create(name: *const c_char, flags: c_uint) -> c_int;
4802 pub fn setaudit(auditinfo: *const auditinfo_t) -> c_int;
4803
4804 pub fn eventfd(initval: c_uint, flags: c_int) -> c_int;
4805 pub fn eventfd_read(fd: c_int, value: *mut eventfd_t) -> c_int;
4806 pub fn eventfd_write(fd: c_int, value: eventfd_t) -> c_int;
4807
4808 pub fn fdatasync(fd: c_int) -> c_int;
4809
4810 pub fn elf_aux_info(aux: c_int, buf: *mut c_void, buflen: c_int) -> c_int;
4811 pub fn setproctitle_fast(fmt: *const c_char, ...);
4812 pub fn timingsafe_bcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
4813 pub fn timingsafe_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
4814
4815 pub fn _umtx_op(
4816 obj: *mut c_void,
4817 op: c_int,
4818 val: c_ulong,
4819 uaddr: *mut c_void,
4820 uaddr2: *mut c_void,
4821 ) -> c_int;
4822
4823 pub fn sctp_peeloff(s: c_int, id: crate::sctp_assoc_t) -> c_int;
4824 pub fn sctp_bindx(s: c_int, addrs: *mut crate::sockaddr, num: c_int, tpe: c_int) -> c_int;
4825 pub fn sctp_connectx(
4826 s: c_int,
4827 addrs: *const crate::sockaddr,
4828 addrcnt: c_int,
4829 id: *mut crate::sctp_assoc_t,
4830 ) -> c_int;
4831 pub fn sctp_getaddrlen(family: crate::sa_family_t) -> c_int;
4832 pub fn sctp_getpaddrs(
4833 s: c_int,
4834 asocid: crate::sctp_assoc_t,
4835 addrs: *mut *mut crate::sockaddr,
4836 ) -> c_int;
4837 pub fn sctp_freepaddrs(addrs: *mut crate::sockaddr);
4838 pub fn sctp_getladdrs(
4839 s: c_int,
4840 asocid: crate::sctp_assoc_t,
4841 addrs: *mut *mut crate::sockaddr,
4842 ) -> c_int;
4843 pub fn sctp_freeladdrs(addrs: *mut crate::sockaddr);
4844 pub fn sctp_opt_info(
4845 s: c_int,
4846 id: crate::sctp_assoc_t,
4847 opt: c_int,
4848 arg: *mut c_void,
4849 size: *mut crate::socklen_t,
4850 ) -> c_int;
4851 pub fn sctp_sendv(
4852 sd: c_int,
4853 iov: *const crate::iovec,
4854 iovcnt: c_int,
4855 addrs: *mut crate::sockaddr,
4856 addrcnt: c_int,
4857 info: *mut c_void,
4858 infolen: crate::socklen_t,
4859 infotype: c_uint,
4860 flags: c_int,
4861 ) -> ssize_t;
4862 pub fn sctp_recvv(
4863 sd: c_int,
4864 iov: *const crate::iovec,
4865 iovcnt: c_int,
4866 from: *mut crate::sockaddr,
4867 fromlen: *mut crate::socklen_t,
4868 info: *mut c_void,
4869 infolen: *mut crate::socklen_t,
4870 infotype: *mut c_uint,
4871 flags: *mut c_int,
4872 ) -> ssize_t;
4873
4874 pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int;
4875 pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int;
4876 pub fn timerfd_settime(
4877 fd: c_int,
4878 flags: c_int,
4879 new_value: *const itimerspec,
4880 old_value: *mut itimerspec,
4881 ) -> c_int;
4882 pub fn closefrom(lowfd: c_int);
4883 pub fn close_range(lowfd: c_uint, highfd: c_uint, flags: c_int) -> c_int;
4884
4885 pub fn execvpe(
4886 file: *const c_char,
4887 argv: *const *const c_char,
4888 envp: *const *const c_char,
4889 ) -> c_int;
4890
4891 pub fn kcmp(
4892 pid1: crate::pid_t,
4893 pid2: crate::pid_t,
4894 type_: c_int,
4895 idx1: c_ulong,
4896 idx2: c_ulong,
4897 ) -> c_int;
4898 pub fn dlvsym(
4899 handle: *mut c_void,
4900 symbol: *const c_char,
4901 version: *const c_char,
4902 ) -> *mut c_void;
4903 }
4904
4905 #[link(name = "memstat")]
4906 extern "C" {
4907 pub fn memstat_strerror(error: c_int) -> *const c_char;
4908 pub fn memstat_mtl_alloc() -> *mut memory_type_list;
4909 pub fn memstat_mtl_first(list: *mut memory_type_list) -> *mut memory_type;
4910 pub fn memstat_mtl_next(mtp: *mut memory_type) -> *mut memory_type;
4911 pub fn memstat_mtl_find(
4912 list: *mut memory_type_list,
4913 allocator: c_int,
4914 name: *const c_char,
4915 ) -> *mut memory_type;
4916 pub fn memstat_mtl_free(list: *mut memory_type_list);
4917 pub fn memstat_mtl_geterror(list: *mut memory_type_list) -> c_int;
4918 pub fn memstat_get_name(mtp: *const memory_type) -> *const c_char;
4919 }
4920
4921 #[link(name = "kvm")]
4922 extern "C" {
4923 pub fn kvm_dpcpu_setcpu(kd: *mut crate::kvm_t, cpu: c_uint) -> c_int;
4924 pub fn kvm_getargv(
4925 kd: *mut crate::kvm_t,
4926 p: *const kinfo_proc,
4927 nchr: c_int,
4928 ) -> *mut *mut c_char;
4929 pub fn kvm_getcptime(kd: *mut crate::kvm_t, cp_time: *mut c_long) -> c_int;
4930 pub fn kvm_getenvv(
4931 kd: *mut crate::kvm_t,
4932 p: *const kinfo_proc,
4933 nchr: c_int,
4934 ) -> *mut *mut c_char;
4935 pub fn kvm_geterr(kd: *mut crate::kvm_t) -> *mut c_char;
4936 pub fn kvm_getmaxcpu(kd: *mut crate::kvm_t) -> c_int;
4937 pub fn kvm_getncpus(kd: *mut crate::kvm_t) -> c_int;
4938 pub fn kvm_getpcpu(kd: *mut crate::kvm_t, cpu: c_int) -> *mut c_void;
4939 pub fn kvm_counter_u64_fetch(kd: *mut crate::kvm_t, base: c_ulong) -> u64;
4940 pub fn kvm_getswapinfo(
4941 kd: *mut crate::kvm_t,
4942 info: *mut kvm_swap,
4943 maxswap: c_int,
4944 flags: c_int,
4945 ) -> c_int;
4946 pub fn kvm_native(kd: *mut crate::kvm_t) -> c_int;
4947 pub fn kvm_nlist(kd: *mut crate::kvm_t, nl: *mut nlist) -> c_int;
4948 pub fn kvm_nlist2(kd: *mut crate::kvm_t, nl: *mut kvm_nlist) -> c_int;
4949 pub fn kvm_read_zpcpu(
4950 kd: *mut crate::kvm_t,
4951 base: c_ulong,
4952 buf: *mut c_void,
4953 size: size_t,
4954 cpu: c_int,
4955 ) -> ssize_t;
4956 pub fn kvm_read2(
4957 kd: *mut crate::kvm_t,
4958 addr: kvaddr_t,
4959 buf: *mut c_void,
4960 nbytes: size_t,
4961 ) -> ssize_t;
4962 }
4963
4964 #[link(name = "util")]
4965 extern "C" {
4966 pub fn extattr_namespace_to_string(attrnamespace: c_int, string: *mut *mut c_char) -> c_int;
4967 pub fn extattr_string_to_namespace(string: *const c_char, attrnamespace: *mut c_int) -> c_int;
4968 pub fn realhostname(host: *mut c_char, hsize: size_t, ip: *const crate::in_addr) -> c_int;
4969 pub fn realhostname_sa(
4970 host: *mut c_char,
4971 hsize: size_t,
4972 addr: *mut crate::sockaddr,
4973 addrlen: c_int,
4974 ) -> c_int;
4975
4976 pub fn kld_isloaded(name: *const c_char) -> c_int;
4977 pub fn kld_load(name: *const c_char) -> c_int;
4978
4979 pub fn kinfo_getvmmap(pid: crate::pid_t, cntp: *mut c_int) -> *mut kinfo_vmentry;
4980
4981 pub fn hexdump(ptr: *const c_void, length: c_int, hdr: *const c_char, flags: c_int);
4982 pub fn humanize_number(
4983 buf: *mut c_char,
4984 len: size_t,
4985 number: i64,
4986 suffix: *const c_char,
4987 scale: c_int,
4988 flags: c_int,
4989 ) -> c_int;
4990
4991 pub fn flopen(path: *const c_char, flags: c_int, ...) -> c_int;
4992 pub fn flopenat(fd: c_int, path: *const c_char, flags: c_int, ...) -> c_int;
4993
4994 pub fn getlocalbase() -> *const c_char;
4995
4996 pub fn pidfile_open(
4997 path: *const c_char,
4998 mode: crate::mode_t,
4999 pidptr: *mut crate::pid_t,
5000 ) -> *mut crate::pidfh;
5001 pub fn pidfile_write(path: *mut crate::pidfh) -> c_int;
5002 pub fn pidfile_close(path: *mut crate::pidfh) -> c_int;
5003 pub fn pidfile_remove(path: *mut crate::pidfh) -> c_int;
5004 pub fn pidfile_fileno(path: *const crate::pidfh) -> c_int;
5005 // FIXME(freebsd): pidfile_signal in due time (both manpage present and updated image snapshot)
5006 }
5007
5008 #[link(name = "procstat")]
5009 extern "C" {
5010 pub fn procstat_open_sysctl() -> *mut procstat;
5011 pub fn procstat_getfiles(
5012 procstat: *mut procstat,
5013 kp: *mut kinfo_proc,
5014 mmapped: c_int,
5015 ) -> *mut filestat_list;
5016 pub fn procstat_freefiles(procstat: *mut procstat, head: *mut filestat_list);
5017 pub fn procstat_getprocs(
5018 procstat: *mut procstat,
5019 what: c_int,
5020 arg: c_int,
5021 count: *mut c_uint,
5022 ) -> *mut kinfo_proc;
5023 pub fn procstat_freeprocs(procstat: *mut procstat, p: *mut kinfo_proc);
5024 pub fn procstat_getvmmap(
5025 procstat: *mut procstat,
5026 kp: *mut kinfo_proc,
5027 count: *mut c_uint,
5028 ) -> *mut kinfo_vmentry;
5029 pub fn procstat_freevmmap(procstat: *mut procstat, vmmap: *mut kinfo_vmentry);
5030 pub fn procstat_close(procstat: *mut procstat);
5031 pub fn procstat_freeargv(procstat: *mut procstat);
5032 pub fn procstat_freeenvv(procstat: *mut procstat);
5033 pub fn procstat_freegroups(procstat: *mut procstat, groups: *mut crate::gid_t);
5034 pub fn procstat_freeptlwpinfo(procstat: *mut procstat, pl: *mut ptrace_lwpinfo);
5035 pub fn procstat_getargv(
5036 procstat: *mut procstat,
5037 kp: *mut kinfo_proc,
5038 nchr: size_t,
5039 ) -> *mut *mut c_char;
5040 pub fn procstat_getenvv(
5041 procstat: *mut procstat,
5042 kp: *mut kinfo_proc,
5043 nchr: size_t,
5044 ) -> *mut *mut c_char;
5045 pub fn procstat_getgroups(
5046 procstat: *mut procstat,
5047 kp: *mut kinfo_proc,
5048 count: *mut c_uint,
5049 ) -> *mut crate::gid_t;
5050 pub fn procstat_getosrel(
5051 procstat: *mut procstat,
5052 kp: *mut kinfo_proc,
5053 osrelp: *mut c_int,
5054 ) -> c_int;
5055 pub fn procstat_getpathname(
5056 procstat: *mut procstat,
5057 kp: *mut kinfo_proc,
5058 pathname: *mut c_char,
5059 maxlen: size_t,
5060 ) -> c_int;
5061 pub fn procstat_getrlimit(
5062 procstat: *mut procstat,
5063 kp: *mut kinfo_proc,
5064 which: c_int,
5065 rlimit: *mut crate::rlimit,
5066 ) -> c_int;
5067 pub fn procstat_getumask(
5068 procstat: *mut procstat,
5069 kp: *mut kinfo_proc,
5070 maskp: *mut c_ushort,
5071 ) -> c_int;
5072 pub fn procstat_open_core(filename: *const c_char) -> *mut procstat;
5073 pub fn procstat_open_kvm(nlistf: *const c_char, memf: *const c_char) -> *mut procstat;
5074 pub fn procstat_get_socket_info(
5075 proc_: *mut procstat,
5076 fst: *mut filestat,
5077 sock: *mut sockstat,
5078 errbuf: *mut c_char,
5079 ) -> c_int;
5080 pub fn procstat_get_vnode_info(
5081 proc_: *mut procstat,
5082 fst: *mut filestat,
5083 vn: *mut vnstat,
5084 errbuf: *mut c_char,
5085 ) -> c_int;
5086 pub fn procstat_get_pts_info(
5087 proc_: *mut procstat,
5088 fst: *mut filestat,
5089 pts: *mut ptsstat,
5090 errbuf: *mut c_char,
5091 ) -> c_int;
5092 pub fn procstat_get_shm_info(
5093 proc_: *mut procstat,
5094 fst: *mut filestat,
5095 shm: *mut shmstat,
5096 errbuf: *mut c_char,
5097 ) -> c_int;
5098 }
5099
5100 #[link(name = "rt")]
5101 extern "C" {
5102 pub fn timer_create(clock_id: clockid_t, evp: *mut sigevent, timerid: *mut timer_t) -> c_int;
5103 pub fn timer_delete(timerid: timer_t) -> c_int;
5104 pub fn timer_getoverrun(timerid: timer_t) -> c_int;
5105 pub fn timer_gettime(timerid: timer_t, value: *mut itimerspec) -> c_int;
5106 pub fn timer_settime(
5107 timerid: timer_t,
5108 flags: c_int,
5109 value: *const itimerspec,
5110 ovalue: *mut itimerspec,
5111 ) -> c_int;
5112 }
5113
5114 #[link(name = "devstat")]
5115 extern "C" {
5116 pub fn devstat_getnumdevs(kd: *mut crate::kvm_t) -> c_int;
5117 pub fn devstat_getgeneration(kd: *mut crate::kvm_t) -> c_long;
5118 pub fn devstat_getversion(kd: *mut crate::kvm_t) -> c_int;
5119 pub fn devstat_checkversion(kd: *mut crate::kvm_t) -> c_int;
5120 pub fn devstat_selectdevs(
5121 dev_select: *mut *mut device_selection,
5122 num_selected: *mut c_int,
5123 num_selections: *mut c_int,
5124 select_generation: *mut c_long,
5125 current_generation: c_long,
5126 devices: *mut devstat,
5127 numdevs: c_int,
5128 matches: *mut devstat_match,
5129 num_matches: c_int,
5130 dev_selections: *mut *mut c_char,
5131 num_dev_selections: c_int,
5132 select_mode: devstat_select_mode,
5133 maxshowdevs: c_int,
5134 perf_select: c_int,
5135 ) -> c_int;
5136 pub fn devstat_buildmatch(
5137 match_str: *mut c_char,
5138 matches: *mut *mut devstat_match,
5139 num_matches: *mut c_int,
5140 ) -> c_int;
5141 }
5142
5143 cfg_if! {
5144 if #[cfg(freebsd15)] {
5145 mod freebsd15;
5146 pub use self::freebsd15::*;
5147 } else if #[cfg(freebsd14)] {
5148 mod freebsd14;
5149 pub use self::freebsd14::*;
5150 } else if #[cfg(freebsd13)] {
5151 mod freebsd13;
5152 pub use self::freebsd13::*;
5153 } else if #[cfg(freebsd12)] {
5154 mod freebsd12;
5155 pub use self::freebsd12::*;
5156 } else if #[cfg(any(freebsd10, freebsd11))] {
5157 mod freebsd11;
5158 pub use self::freebsd11::*;
5159 } else {
5160 // Unknown freebsd version
5161 }
5162 }
5163
5164 cfg_if! {
5165 if #[cfg(target_arch = "x86")] {
5166 mod x86;
5167 pub use self::x86::*;
5168 } else if #[cfg(target_arch = "x86_64")] {
5169 mod x86_64;
5170 pub use self::x86_64::*;
5171 } else if #[cfg(target_arch = "aarch64")] {
5172 mod aarch64;
5173 pub use self::aarch64::*;
5174 } else if #[cfg(target_arch = "arm")] {
5175 mod arm;
5176 pub use self::arm::*;
5177 } else if #[cfg(target_arch = "powerpc64")] {
5178 mod powerpc64;
5179 pub use self::powerpc64::*;
5180 } else if #[cfg(target_arch = "powerpc")] {
5181 mod powerpc;
5182 pub use self::powerpc::*;
5183 } else if #[cfg(target_arch = "riscv64")] {
5184 mod riscv64;
5185 pub use self::riscv64::*;
5186 } else {
5187 // Unknown target_arch
5188 }
5189 }