|
330 | 330 | pub ki_fd: *mut ::c_void, |
331 | 331 | // This is normally "struct vmspace". |
332 | 332 | pub ki_vmspace: *mut ::c_void, |
333 | | - #[cfg(freebsd13)] |
| 333 | + #[cfg(any(freebsd13, freebsd14))] |
334 | 334 | pub ki_wchan: *const ::c_void, |
335 | | - #[cfg(not(freebsd13))] |
| 335 | + #[cfg(not(any(freebsd13, freebsd14)))] |
336 | 336 | pub ki_wchan: *mut ::c_void, |
337 | 337 | pub ki_pid: ::pid_t, |
338 | 338 | pub ki_ppid: ::pid_t, |
|
342 | 342 | pub ki_tsid: ::pid_t, |
343 | 343 | pub ki_jobc: ::c_short, |
344 | 344 | pub ki_spare_short1: ::c_short, |
345 | | - #[cfg(any(freebsd12, freebsd13))] |
| 345 | + #[cfg(any(freebsd12, freebsd13, freebsd14))] |
346 | 346 | pub ki_tdev_freebsd11: u32, |
347 | 347 | #[cfg(freebsd11)] |
348 | 348 | pub ki_tdev: ::dev_t, |
|
393 | 393 | pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1], |
394 | 394 | pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq |
395 | 395 | pub ki_spareints: [::c_int; ::KI_NSPARE_INT], |
396 | | - #[cfg(freebsd13)] |
| 396 | + #[cfg(any(freebsd13, freebsd14))] |
397 | 397 | pub ki_tdev: u64, |
398 | 398 | #[cfg(freebsd12)] |
399 | 399 | pub ki_tdev: ::dev_t, |
|
416 | 416 | // This is normally "struct thread". |
417 | 417 | pub ki_tdaddr: *mut ::c_void, |
418 | 418 | // This is normally "struct pwddesc". |
419 | | - #[cfg(freebsd13)] |
| 419 | + #[cfg(any(freebsd13, freebsd14))] |
420 | 420 | pub ki_pd: *mut ::c_void, |
421 | 421 | pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR], |
422 | 422 | pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG], |
@@ -542,6 +542,11 @@ s_no_extra_traits! { |
542 | 542 | __unused2: [::c_long; 7] |
543 | 543 | } |
544 | 544 |
|
| 545 | + pub struct spacectl_range { |
| 546 | + r_offset: ::off_t, |
| 547 | + r_len: ::off_t |
| 548 | + } |
| 549 | + |
545 | 550 | #[cfg(libc_union)] |
546 | 551 | pub union __c_anonymous_elf32_auxv_union { |
547 | 552 | pub a_val: ::c_int, |
@@ -772,6 +777,29 @@ cfg_if! { |
772 | 777 | self.sigev_notify_thread_id.hash(state); |
773 | 778 | } |
774 | 779 | } |
| 780 | + |
| 781 | + impl ::fmt::Debug for spacectl_range { |
| 782 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 783 | + f.debug_struct("spacectl_range") |
| 784 | + .field("r_offset", &self.r_offset) |
| 785 | + .field("r_len", &self.r_len) |
| 786 | + .finish() |
| 787 | + } |
| 788 | + } |
| 789 | + impl ::Hash::Hash for spacectl_range { |
| 790 | + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 791 | + self.r_offset.hash(state); |
| 792 | + self.r_len.hash(state); |
| 793 | + } |
| 794 | + } |
| 795 | + impl Eq for spacectl_range {} |
| 796 | + impl PartialEq for spacectl_range { |
| 797 | + fn eq(&self, other: &Self) -> bool { |
| 798 | + self.r_offset == other.r_offset |
| 799 | + && self.r_len == other.r_len |
| 800 | + } |
| 801 | + } |
| 802 | + |
775 | 803 | #[cfg(libc_union)] |
776 | 804 | impl PartialEq for __c_anonymous_elf32_auxv_union { |
777 | 805 | fn eq(&self, other: &__c_anonymous_elf32_auxv_union) -> bool { |
@@ -1741,6 +1769,9 @@ pub const F_SEAL_SEAL: ::c_int = 1; |
1741 | 1769 | pub const F_SEAL_SHRINK: ::c_int = 2; |
1742 | 1770 | pub const F_SEAL_WRITE: ::c_int = 8; |
1743 | 1771 |
|
| 1772 | +// for use with fspacectl |
| 1773 | +pub const SPACECTL_DEALLOC: ::c_int = 1; |
| 1774 | + |
1744 | 1775 | // For getrandom() |
1745 | 1776 | pub const GRND_NONBLOCK: ::c_uint = 0x1; |
1746 | 1777 | pub const GRND_RANDOM: ::c_uint = 0x2; |
@@ -1881,7 +1912,7 @@ pub const KVME_FLAG_SUPER: ::c_int = 0x00000008; |
1881 | 1912 | pub const KVME_FLAG_GROWS_UP: ::c_int = 0x00000010; |
1882 | 1913 | pub const KVME_FLAG_GROWS_DOWN: ::c_int = 0x00000020; |
1883 | 1914 | cfg_if! { |
1884 | | - if #[cfg(any(freebsd12, freebsd13))] { |
| 1915 | + if #[cfg(any(freebsd12, freebsd13, freebsd14))] { |
1885 | 1916 | pub const KVME_FLAG_USER_WIRED: ::c_int = 0x00000040; |
1886 | 1917 | } |
1887 | 1918 | } |
@@ -2208,6 +2239,8 @@ extern "C" { |
2208 | 2239 | nbytes: ::size_t, |
2209 | 2240 | ) -> ::ssize_t; |
2210 | 2241 |
|
| 2242 | + pub fn fspacectl(fd: ::c_int, cmd: ::c_int, rqsr: *const spacectl_range, flags: ::c_int, rmsr: *mut spacectl_range) -> ::c_int; |
| 2243 | + |
2211 | 2244 | pub fn jail(jail: *mut ::jail) -> ::c_int; |
2212 | 2245 | pub fn jail_attach(jid: ::c_int) -> ::c_int; |
2213 | 2246 | pub fn jail_remove(jid: ::c_int) -> ::c_int; |
@@ -2624,7 +2657,9 @@ extern "C" { |
2624 | 2657 | } |
2625 | 2658 |
|
2626 | 2659 | cfg_if! { |
2627 | | - if #[cfg(freebsd13)] { |
| 2660 | + if #[cfg(any(freebsd13, freebsd14))] { |
| 2661 | + // For now, there are no differences between FreeBSD 13 and 14 that Rust |
| 2662 | + // needs to care about. |
2628 | 2663 | mod freebsd13; |
2629 | 2664 | pub use self::freebsd13::*; |
2630 | 2665 | } else if #[cfg(freebsd12)] { |
|
0 commit comments