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