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