From 8dc0a3247ff562e3d706e9b42a3ce34c95de7fea Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 16 Sep 2023 19:08:13 -0600 Subject: [PATCH 1/7] Revert "Disable FreeBSD 14 CI temporarily" This reverts commit c9643c8768541b18017bbff90b0d6c582e402ed9. New FreeBSD images have been available in gcloud since July. Update the testing image to the latest, 14.0-BETA2 --- .cirrus.yml | 4 +--- ci/build.sh | 14 ++++++-------- ci/install-rust.sh | 3 --- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index dcfff67206296..4e5c9e74a0ada 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -29,9 +29,7 @@ task: task: name: nightly x86_64-unknown-freebsd-14 freebsd_instance: - # FIXME: FreeBSD 14 CI fails due to pkg installation. - # Use 14 again once a new image is available on Cirrus CI. - image_family: freebsd-13-2 + image: freebsd-14-0-beta2-amd64 setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh diff --git a/ci/build.sh b/ci/build.sh index 2a9d68f53859b..4f339a603ad3d 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -102,6 +102,12 @@ i686-linux-android \ i686-unknown-freebsd \ i686-unknown-linux-gnu \ i686-unknown-linux-musl \ +mips-unknown-linux-gnu \ +mips-unknown-linux-musl \ +mips64-unknown-linux-gnuabi64 \ +mips64el-unknown-linux-gnuabi64 \ +mipsel-unknown-linux-gnu \ +mipsel-unknown-linux-musl \ powerpc-unknown-linux-gnu \ powerpc64-unknown-linux-gnu \ powerpc64le-unknown-linux-gnu \ @@ -112,14 +118,6 @@ x86_64-unknown-linux-musl \ x86_64-unknown-netbsd \ " -# FIXME: builds of MIPS targets are currently broken on nightly. -# mips-unknown-linux-gnu \ -# mips-unknown-linux-musl \ -# mips64-unknown-linux-gnuabi64 \ -# mips64el-unknown-linux-gnuabi64 \ -# mipsel-unknown-linux-gnu \ -# mipsel-unknown-linux-musl \ - RUST_GT_1_13_LINUX_TARGETS="\ arm-unknown-linux-musleabi \ arm-unknown-linux-musleabihf \ diff --git a/ci/install-rust.sh b/ci/install-rust.sh index 3ce81e6299932..5b50c624cbd66 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -12,9 +12,6 @@ else # https://github.com/rust-lang/rust/issues/103673 contains related information. case "$TARGET" in *android*) toolchain=nightly-2022-10-09;; - # FIXME: Unpin once mips' components are available on nightly. - # https://rust-lang.github.io/rustup-components-history/mips-unknown-linux-gnu.html - *mips*) toolchain=nightly-2023-07-04;; *) toolchain=nightly;; esac fi From 2f43f142b764ae5a38a658c74984d7948f33b72f Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 3 Oct 2023 19:58:42 -0600 Subject: [PATCH 2/7] WIP making changes for FreeBSD 14.0-beta2 --- libc-test/build.rs | 8 +++++++- src/unix/bsd/freebsdlike/freebsd/mod.rs | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index ffb972cb4145e..f213cfe386ec9 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2196,6 +2196,12 @@ fn test_freebsd(target: &str) { // should've been used anywhere anyway. "TDF_UNUSED23" => true, + // Removed in FreeBSD 14 (git a6b55ee6be1) + "IFF_KNOWSEPOCH" => true, + + // Removed in FreeBSD 14 (git 7ff9ae90f0b) + "IFF_NOGROUP" => true, + // FIXME: These are deprecated - remove in a couple of releases. // These symbols are not stable across OS-versions. They were // changed for FreeBSD 14 in git revisions b62848b0c3f and @@ -2277,7 +2283,7 @@ fn test_freebsd(target: &str) { // Added in freebsd 14. "IFCAP_MEXTPG" if Some(14) > freebsd_ver => true, // Added in freebsd 13. - "IFF_KNOWSEPOCH" | "IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM" + "IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM" | "IFCAP_VXLAN_HWTSO" | "IFCAP_TXTLS_RTLMT" | "IFCAP_TXTLS" if Some(13) > freebsd_ver => { diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 5fba1447d7baf..d5b7def5f09f6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3172,6 +3172,7 @@ pub const IFF_LOOPBACK: ::c_int = 0x8; /// (i) is a point-to-point link pub const IFF_POINTOPOINT: ::c_int = 0x10; /// (i) calls if_input in net epoch +#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")] pub const IFF_KNOWSEPOCH: ::c_int = 0x20; /// (d) resources allocated pub const IFF_RUNNING: ::c_int = 0x40; @@ -3219,6 +3220,7 @@ pub const IFF_DYING: ::c_int = 0x200000; /// (n) interface is being renamed pub const IFF_RENAMING: ::c_int = 0x400000; /// interface is not part of any groups +#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")] pub const IFF_NOGROUP: ::c_int = 0x800000; /// link invalid/unknown From eb3ff113fc6eb00cc549ca95fbae73ca0d1b0487 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 18 Oct 2023 12:20:20 -0600 Subject: [PATCH 3/7] Update FreeBSD 14 CI image to 14.0-RC1 And update the definition of struct tcp_info for FreeBSD 14. --- .cirrus.yml | 2 +- src/unix/bsd/freebsdlike/freebsd/mod.rs | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 4e5c9e74a0ada..3a42cc356c255 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -29,7 +29,7 @@ task: task: name: nightly x86_64-unknown-freebsd-14 freebsd_instance: - image: freebsd-14-0-beta2-amd64 + image: freebsd-14-0-rc1-amd64 setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index d5b7def5f09f6..797eee798a945 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -998,6 +998,8 @@ s! { pub pcbcnt: u32, } + // Note: this structure will change in a backwards-incompatible way in + // FreeBSD 15. pub struct tcp_info { pub tcpi_state: u8, pub __tcpi_ca_state: u8, @@ -1055,7 +1057,21 @@ s! { #[cfg(freebsd14)] pub __tcpi_received_ce_bytes: u32, #[cfg(freebsd14)] - pub __tcpi_pad: [u32; 19], + pub tcpi_total_tlp: u32, + #[cfg(freebsd14)] + pub tcpi_total_tlp_bytes: u64, + #[cfg(freebsd14)] + pub tcpi_snd_una: u32, + #[cfg(freebsd14)] + pub tcpi_snd_max: u32, + #[cfg(freebsd14)] + pub tcpi_rcv_numsacks: u32, + #[cfg(freebsd14)] + pub tcpi_rcv_adv: u32, + #[cfg(freebsd14)] + pub tcpi_dupacks: u32, + #[cfg(freebsd14)] + pub __tcpi_pad: [u32; 10], #[cfg(not(freebsd14))] pub __tcpi_pad: [u32; 26], } From 01bfa0cdc55dab6a99fd90ea11f65fe10fe58c93 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 18 Oct 2023 13:26:02 -0600 Subject: [PATCH 4/7] cargo fmt --- libc-test/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index f213cfe386ec9..64101f48cfaa8 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2283,8 +2283,8 @@ fn test_freebsd(target: &str) { // Added in freebsd 14. "IFCAP_MEXTPG" if Some(14) > freebsd_ver => true, // Added in freebsd 13. - "IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM" - | "IFCAP_VXLAN_HWTSO" | "IFCAP_TXTLS_RTLMT" | "IFCAP_TXTLS" + "IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM" | "IFCAP_VXLAN_HWTSO" + | "IFCAP_TXTLS_RTLMT" | "IFCAP_TXTLS" if Some(13) > freebsd_ver => { true From 84b65654fb87d10fcdb0ed964ccef3520207bf2c Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 18 Oct 2023 13:42:31 -0600 Subject: [PATCH 5/7] Increase size of cpuset_t on FreeBSD 14 See https://github.com/freebsd/freebsd-src/commit/d1639e43c589644510198dc53aef87e8908a1507 --- src/unix/bsd/freebsdlike/freebsd/mod.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 797eee798a945..52203906cc361 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -365,9 +365,13 @@ s! { } pub struct cpuset_t { - #[cfg(target_pointer_width = "64")] + #[cfg(all(freebsd14, target_pointer_width = "64"))] + __bits: [::c_long; 16], + #[cfg(all(freebsd14, target_pointer_width = "32"))] + __bits: [::c_long; 32], + #[cfg(all(not(freebsd14), target_pointer_width = "64"))] __bits: [::c_long; 4], - #[cfg(target_pointer_width = "32")] + #[cfg(all(not(freebsd14), target_pointer_width = "32"))] __bits: [::c_long; 8], } @@ -2615,7 +2619,13 @@ pub const DEVSTAT_N_TRANS_FLAGS: ::c_int = 4; pub const DEVSTAT_NAME_LEN: ::c_int = 16; // sys/cpuset.h -pub const CPU_SETSIZE: ::c_int = 256; +cfg_if! { + if #[cfg(freebsd14)] { + pub const CPU_SETSIZE: ::c_int = 1024; + } else { + pub const CPU_SETSIZE: ::c_int = 256; + } +} pub const SIGEV_THREAD_ID: ::c_int = 4; From 2c3bf6fb5f716a165d5fdc906c13852316cc644e Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Thu, 19 Oct 2023 20:00:47 -0600 Subject: [PATCH 6/7] include sys/timerfd.h in libc-test for FreeBSD. --- libc-test/build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 64101f48cfaa8..511317c401660 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1987,6 +1987,10 @@ fn test_freebsd(target: &str) { Some(n) if n >= 13 => true, _ => false, }; + let freebsd14 = match freebsd_ver { + Some(n) if n >= 14 => true, + _ => false, + }; headers! { cfg: "aio.h", @@ -2074,6 +2078,7 @@ fn test_freebsd(target: &str) { "sys/sysctl.h", "sys/thr.h", "sys/time.h", + [freebsd14]:"sys/timerfd.h", "sys/times.h", "sys/timex.h", "sys/types.h", From 58121b2cc0592f6f55aa1ca4d2518be450730b63 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 25 Oct 2023 10:42:36 -0600 Subject: [PATCH 7/7] Re-disable linux-mips targets Though not mentioned in the commit message, change c9643c8768541b18017bbff90b0d6c582e402ed9 disabled these along with FreeBSD 14. --- ci/build.sh | 14 ++++++++------ ci/install-rust.sh | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ci/build.sh b/ci/build.sh index 4f339a603ad3d..2a9d68f53859b 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -102,12 +102,6 @@ i686-linux-android \ i686-unknown-freebsd \ i686-unknown-linux-gnu \ i686-unknown-linux-musl \ -mips-unknown-linux-gnu \ -mips-unknown-linux-musl \ -mips64-unknown-linux-gnuabi64 \ -mips64el-unknown-linux-gnuabi64 \ -mipsel-unknown-linux-gnu \ -mipsel-unknown-linux-musl \ powerpc-unknown-linux-gnu \ powerpc64-unknown-linux-gnu \ powerpc64le-unknown-linux-gnu \ @@ -118,6 +112,14 @@ x86_64-unknown-linux-musl \ x86_64-unknown-netbsd \ " +# FIXME: builds of MIPS targets are currently broken on nightly. +# mips-unknown-linux-gnu \ +# mips-unknown-linux-musl \ +# mips64-unknown-linux-gnuabi64 \ +# mips64el-unknown-linux-gnuabi64 \ +# mipsel-unknown-linux-gnu \ +# mipsel-unknown-linux-musl \ + RUST_GT_1_13_LINUX_TARGETS="\ arm-unknown-linux-musleabi \ arm-unknown-linux-musleabihf \ diff --git a/ci/install-rust.sh b/ci/install-rust.sh index 5b50c624cbd66..3ce81e6299932 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -12,6 +12,9 @@ else # https://github.com/rust-lang/rust/issues/103673 contains related information. case "$TARGET" in *android*) toolchain=nightly-2022-10-09;; + # FIXME: Unpin once mips' components are available on nightly. + # https://rust-lang.github.io/rustup-components-history/mips-unknown-linux-gnu.html + *mips*) toolchain=nightly-2023-07-04;; *) toolchain=nightly;; esac fi