From f16089a2a20dd977097b8d214121376540580e34 Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 18 Jul 2024 20:06:35 +0200 Subject: [PATCH 1/3] Apple: `rmx_state` has been removed --- libc-test/build.rs | 3 +++ src/unix/bsd/apple/mod.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index d033ce843c79f..2074d71d10f64 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -408,6 +408,9 @@ fn test_apple(target: &str) { ("ifreq", "ifr_ifru") => true, ("ifkpi", "ifk_data") => true, ("ifconf", "ifc_ifcu") => true, + // FIXME: this field has been incorporated into a resized `rmx_filler` array. + ("rt_metrics", "rmx_state") => true, + ("rt_metrics", "rmx_filler") => true, _ => false, } }); diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 70019ea0b313e..f21c0ae6e54aa 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -509,6 +509,8 @@ s! { pub rmx_rtt: u32, pub rmx_rttvar: u32, pub rmx_pksent: u32, + /// This field does not exist anymore, the u32 is now part of a resized + /// `rmx_filler` array. pub rmx_state: u32, pub rmx_filler: [u32; 3], } From 1b092dc30d2b736b028cad6e1f84f38dfceeedef Mon Sep 17 00:00:00 2001 From: joboet Date: Mon, 29 Jul 2024 12:17:11 +0200 Subject: [PATCH 2/3] `addr_of!(EXTERN_STATIC)` is now considered safe See rust-lang/rust#125834 --- src/wasi.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wasi.rs b/src/wasi.rs index ae490bf94d7a2..16b81b50b2f1a 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -366,10 +366,14 @@ pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; pub const _SC_IOV_MAX: c_int = 60; pub const _SC_SYMLOOP_MAX: c_int = 173; +#[allow(unused_unsafe)] // `addr_of!(EXTERN_STATIC)` is now considered safe pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) }; +#[allow(unused_unsafe)] pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) }; +#[allow(unused_unsafe)] pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) }; +#[allow(unused_unsafe)] pub static CLOCK_THREAD_CPUTIME_ID: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) }; From 8367de9eaaefc74f5adf1d30925d8bbae82c6c69 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Wed, 31 Jul 2024 09:54:59 -0700 Subject: [PATCH 3/3] Reference specific MSRV in comment This will make it easier to remove the now-unneeded `unsafe` when we update MSRV. --- src/wasi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wasi.rs b/src/wasi.rs index 16b81b50b2f1a..8b32405b9fbfe 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -366,7 +366,7 @@ pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; pub const _SC_IOV_MAX: c_int = 60; pub const _SC_SYMLOOP_MAX: c_int = 173; -#[allow(unused_unsafe)] // `addr_of!(EXTERN_STATIC)` is now considered safe +#[allow(unused_unsafe)] // `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82 pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) }; #[allow(unused_unsafe)] pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =