From d6efc56cd3375ad94e099c14b9de8085e1cf41de Mon Sep 17 00:00:00 2001 From: Zac Harrold Date: Wed, 22 Jul 2026 14:39:37 +1000 Subject: [PATCH 01/93] meta: Explicitly include rather than exclude package members Added in 27a38e3bda16c72f1bff3af9432e2282427843df causes `cargo-deny` warnings due to the inclusion of an executable Python script. (backport ) (cherry picked from commit 53bc12c46ddadf081c5ba4e891199d47d47fe084) --- Cargo.toml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 380dd89fb693..134a072e32c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,15 @@ name = "libc" version = "0.2.189" keywords = ["libc", "ffi", "bindings", "operating", "system"] categories = ["external-ffi-bindings", "no-std", "os"] -exclude = ["/ci/*", "/.github/*", "/triagebot.toml", "cherry-pick-stable.sh"] +include = [ + "/src", + "/tests", + "/examples", + "/build.rs", + "/CHANGELOG*", + "/LICENSE*", + "/README*", +] description = "Raw FFI bindings to platform libraries like libc." edition = "2021" license = "MIT OR Apache-2.0" From fe69d9d48d287e8bd775e85de2efd4710c65a8e7 Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Wed, 22 Jul 2026 18:28:36 +0300 Subject: [PATCH 02/93] ci: Select Cuttlefish by target instead of a matrix env The x86_64-linux-android job set TEST_CUTTLEFISH=1 in the workflow matrix just so run-docker.sh could tell it apart. Match on the target name instead, like the existing musl and aarch64-linux-android checks, so the CI matrix carries no magic env and running the job locally needs no special variable. Suggested-by: Trevor Gross Assisted-By: Claude Opus 4.8 Signed-off-by: Adrian Ratiu (backport ) (cherry picked from commit aa2e58911fb25868a05154cdfdf551811cb19917) --- .github/workflows/ci.yaml | 1 - ci/run-docker.sh | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fdc77ccc27fd..de2741a12c38 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -231,7 +231,6 @@ jobs: - target: x86_64-apple-darwin os: macos-26-intel - target: x86_64-linux-android - env: { TEST_CUTTLEFISH: 1 } # Keep in sync with the Android build pinned in ci/cuttlefish-setup.sh artifact-tag: android17 # FIXME: Exec format error (os error 8) diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 218fa4e1ca0f..67ca55fadd0a 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -59,13 +59,11 @@ run() { mkdir -p target extra_args=() - if [ -n "${TEST_CUTTLEFISH:-}" ]; then - # Cuttlefish-based Android targets boot their virtual device inside - # the container (see cuttlefish-entrypoint.sh in the target's docker - # dir): pass the virtualization device nodes and let the entrypoint - # create its tap networking. It starts as root and drops to an - # unprivileged user matching HOST_UID for the device and the tests. - # Same flags as upstream's containerized Cuttlefish CI. + # x86_64-linux-android boots a Cuttlefish virtual device inside the + # container. Give it the virtualization device nodes and NET_ADMIN it needs. + # These are the same flags Google's android-cuttlefish project uses for its + # own containerized CI. + if [ "$run_target" = "x86_64-linux-android" ]; then extra_args+=( --device /dev/kvm --device /dev/net/tun From 1967e146884d8187a7827590a1fe3920a8d0948b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 21 Jul 2026 17:55:51 -0700 Subject: [PATCH 03/93] Fill out some more WASI pthread APIs Also update wasmtime/wasi-sdk used in testing to keep them up-to-date. All headers are located at https://github.com/WebAssembly/wasi-libc/blob/af323bda7f3ea816ebefd8e307619920432af89c/libc-top-half/musl/include/pthread.h (backport ) (cherry picked from commit af22329b288d15ff4fa68fd5ca184d8d4be8f109) --- ci/wasi.sh | 4 +-- libc-test/build.rs | 4 +++ src/wasi/mod.rs | 87 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) diff --git a/ci/wasi.sh b/ci/wasi.sh index 2648aa38207d..d4ba4bb64af0 100755 --- a/ci/wasi.sh +++ b/ci/wasi.sh @@ -11,8 +11,8 @@ apt-get install -y --no-install-recommends \ # Wasmtime is used to execute tests and wasi-sdk is used to compile tests. # Download appropriate versions here and configure various flags below. -wasmtime=38.0.2 -wasi_sdk=29 +wasmtime=47.0.2 +wasi_sdk=33 curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v$wasmtime/wasmtime-v$wasmtime-x86_64-linux.tar.xz | tar xJf - diff --git a/libc-test/build.rs b/libc-test/build.rs index ef5e4a939a4f..7a559bb2c696 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2099,6 +2099,10 @@ fn test_wasi(target: &str) { // used here to generate a pointer to them in bindings so skip these tests. cfg.skip_static(|s| s.ident().starts_with("_CLOCK_")); + // This was removed in wasip2 target for wasi-sdk-30+, but it's just a + // typedef, so ignore it. + cfg.skip_alias(|s| s.ident() == "__wasi_rights_t"); + cfg.skip_const(|c| match c.ident() { // These constants aren't yet defined in wasi-libc. // Exposing them is being tracked by https://github.com/WebAssembly/wasi-libc/issues/531. diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 9bce096559e4..73b2cc3e21aa 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -615,6 +615,40 @@ pub const NOEXPR: crate::nl_item = 0x50001; pub const YESSTR: crate::nl_item = 0x50002; pub const NOSTR: crate::nl_item = 0x50003; +pub const PTHREAD_CREATE_JOINABLE: c_int = 0; +pub const PTHREAD_CREATE_DETACHED: c_int = 1; +pub const PTHREAD_MUTEX_NORMAL: c_int = 0; +pub const PTHREAD_MUTEX_DEFAULT: c_int = 0; +pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2; +pub const PTHREAD_MUTEX_STALLED: c_int = 0; +pub const PTHREAD_MUTEX_ROBUST: c_int = 1; +pub const PTHREAD_PRIO_NONE: c_int = 0; +pub const PTHREAD_PRIO_INHERIT: c_int = 1; +pub const PTHREAD_PRIO_PROTECT: c_int = 2; +pub const PTHREAD_INHERIT_SCHED: c_int = 0; +pub const PTHREAD_EXPLICIT_SCHED: c_int = 1; +pub const PTHREAD_SCOPE_SYSTEM: c_int = 0; +pub const PTHREAD_SCOPE_PROCESS: c_int = 1; +pub const PTHREAD_PROCESS_PRIVATE: c_int = 0; +pub const PTHREAD_PROCESS_SHARED: c_int = 1; +pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + size: [0 as *mut c_void; 6], +}; +pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + size: [0 as *mut c_void; 8], +}; +pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + size: [0 as *mut c_void; 12], +}; +pub const PTHREAD_ONCE_INIT: pthread_once_t = 0; +pub const PTHREAD_CANCEL_ENABLE: c_int = 0; +pub const PTHREAD_CANCEL_DISABLE: c_int = 1; +pub const PTHREAD_CANCEL_MASKED: c_int = 2; +pub const PTHREAD_CANCEL_DEFERRED: c_int = 0; +pub const PTHREAD_CANCEL_ASYNCHRONOUS: c_int = 1; +pub const PTHREAD_CANCELED: *mut c_void = usize::MAX as *mut c_void; +pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1; pub const PTHREAD_STACK_MIN: usize = 2048; pub const TIMER_ABSTIME: c_int = 1; @@ -1040,8 +1074,21 @@ extern "C" { pub fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> c_int; pub fn pthread_attr_getstacksize(attr: *const pthread_attr_t, stacksize: *mut size_t) -> c_int; pub fn pthread_attr_setstacksize(attr: *mut pthread_attr_t, stack_size: size_t) -> c_int; + pub fn pthread_attr_getdetachstate(attr: *const pthread_attr_t, state: *mut c_int) -> c_int; pub fn pthread_attr_setdetachstate(attr: *mut pthread_attr_t, state: c_int) -> c_int; + pub fn pthread_attr_getguardsize(attr: *const pthread_attr_t, b: *mut size_t) -> c_int; + pub fn pthread_attr_setguardsize(attr: *mut pthread_attr_t, b: size_t) -> c_int; + pub fn pthread_attr_getstack( + attr: *const pthread_attr_t, + b: *mut *mut c_void, + c: *mut size_t, + ) -> c_int; + pub fn pthread_attr_setstack(attr: *mut pthread_attr_t, b: *mut c_void, c: size_t) -> c_int; pub fn pthread_detach(thread: pthread_t) -> c_int; + pub fn pthread_setcancelstate(a: c_int, b: *mut c_int) -> c_int; + pub fn pthread_setcanceltype(a: c_int, b: *mut c_int) -> c_int; + pub fn pthread_testcancel(); + pub fn pthread_once(a: *mut pthread_once_t, b: extern "C" fn()) -> c_int; pub fn pthread_key_create( key: *mut pthread_key_t, @@ -1058,10 +1105,20 @@ extern "C" { pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int; pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> c_int; pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int; + pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, ts: *const timespec) -> c_int; + pub fn pthread_mutex_consistent(lock: *mut pthread_mutex_t) -> c_int; + pub fn pthread_mutex_getprioceiling(lock: *mut pthread_mutex_t, b: *mut c_int) -> c_int; pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int; pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int; pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: c_int) -> c_int; + pub fn pthread_mutexattr_getprotocol(attr: *const pthread_mutexattr_t, b: *mut c_int) -> c_int; + pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, b: *mut c_int) -> c_int; + pub fn pthread_mutexattr_getrobust(attr: *const pthread_mutexattr_t, b: *mut c_int) -> c_int; + pub fn pthread_mutexattr_gettype(attr: *const pthread_mutexattr_t, b: *mut c_int) -> c_int; + pub fn pthread_mutexattr_setprotocol(attr: *const pthread_mutexattr_t, b: c_int) -> c_int; + pub fn pthread_mutexattr_setpshared(attr: *const pthread_mutexattr_t, b: c_int) -> c_int; + pub fn pthread_mutexattr_setrobust(attr: *const pthread_mutexattr_t, b: c_int) -> c_int; pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> c_int; pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int; @@ -1075,6 +1132,8 @@ extern "C" { pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int; pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> c_int; pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> c_int; + pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, b: c_int) -> c_int; + pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, b: *mut c_int) -> c_int; pub fn pthread_rwlock_init( lock: *mut pthread_rwlock_t, @@ -1086,8 +1145,36 @@ extern "C" { pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> c_int; pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> c_int; pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> c_int; + pub fn pthread_rwlock_timedrdlock(lock: *mut pthread_rwlock_t, at: *const timespec) -> c_int; + pub fn pthread_rwlock_timedwrlock(lock: *mut pthread_rwlock_t, at: *const timespec) -> c_int; pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> c_int; pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> c_int; + pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, b: c_int) -> c_int; + pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, b: *mut c_int) + -> c_int; + + pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, b: c_int) -> c_int; + pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int; + pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int; + pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int; + pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int; + + pub fn pthread_barrier_init( + barrier: *mut pthread_barrier_t, + attr: *const pthread_barrierattr_t, + count: c_uint, + ) -> c_int; + pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int; + pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int; + pub fn pthread_barrierattr_init(attr: *mut pthread_barrierattr_t) -> c_int; + pub fn pthread_barrierattr_destroy(attr: *mut pthread_barrierattr_t) -> c_int; + pub fn pthread_barrierattr_setpshared(attr: *mut pthread_barrierattr_t, b: c_int) -> c_int; + pub fn pthread_barrierattr_getpshared( + attr: *const pthread_barrierattr_t, + b: *mut c_int, + ) -> c_int; + + pub fn pthread_getattr_np(thread: pthread_t, attr: *mut pthread_attr_t) -> c_int; } cfg_if! { From 1b279a94f065c20a6ffd74d3a60d27a0f374e59c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 22 Jul 2026 07:26:07 -0700 Subject: [PATCH 04/93] Review comments * Extract wasi-sdk version information from `wasi/version.h` * Conditionally verify `__wasi_rights_t` for the wasip1 target, deprecate it on other targets. * Use `ptr::null_mut()`. (backport ) (cherry picked from commit 0f50a2e49ffb7d660127228e63292f8d67715777) --- libc-test/build.rs | 32 +++++++++++++++++++++++++++++--- src/wasi/mod.rs | 10 +++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 7a559bb2c696..8f28aa3750cb 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2036,6 +2036,7 @@ fn which_dragonfly() -> Option { fn test_wasi(target: &str) { assert!(target.contains("wasi")); let p2 = target.contains("wasip2"); + let wasi_sdk = VERSIONS.wasi_sdk.unwrap(); let mut cfg = ctest_cfg(); cfg.define("_GNU_SOURCE", None); @@ -2099,9 +2100,14 @@ fn test_wasi(target: &str) { // used here to generate a pointer to them in bindings so skip these tests. cfg.skip_static(|s| s.ident().starts_with("_CLOCK_")); - // This was removed in wasip2 target for wasi-sdk-30+, but it's just a - // typedef, so ignore it. - cfg.skip_alias(|s| s.ident() == "__wasi_rights_t"); + match wasi_sdk.1 { + WasiVersion::P1 => {} + // This was removed in wasip2 target for wasi-sdk-30+, but it's just a + // typedef, so ignore it. + _ => { + cfg.skip_alias(|s| s.ident() == "__wasi_rights_t"); + } + } cfg.skip_const(|c| match c.ident() { // These constants aren't yet defined in wasi-libc. @@ -6569,6 +6575,15 @@ struct Versions { netbsd: Option<(u32, u32)>, macos: Option<(u32, u32)>, emscripten: Option<(u32, u32)>, + wasi_sdk: Option<(u32, WasiVersion)>, +} + +#[derive(Clone, Copy, Debug, Default)] +enum WasiVersion { + #[default] + P1, + P2, + P3, } impl Versions { @@ -6605,6 +6620,11 @@ impl Versions { /* Provides __EMSCRIPTEN_MAJOR__, __EMSCRIPTEN_MINOR__ */ #include "emscripten/version.h" #endif + + #if __has_include() + /* provides __wasi_sdk_major__, __wasi_sdk_version__ */ + #include + #endif "#; let mut ret = Versions::default(); @@ -6685,6 +6705,12 @@ impl Versions { "__EMSCRIPTEN_minor__" => { ret.emscripten.get_or_insert_default().1 = value.parse().unwrap() } + "__wasi_sdk_major__" => { + ret.wasi_sdk.get_or_insert_default().0 = value.parse().unwrap() + } + "__wasip1__" => ret.wasi_sdk.get_or_insert_default().1 = WasiVersion::P1, + "__wasip2__" => ret.wasi_sdk.get_or_insert_default().1 = WasiVersion::P2, + "__wasip3__" => ret.wasi_sdk.get_or_insert_default().1 = WasiVersion::P3, _ => (), } } diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 73b2cc3e21aa..8ba518bdcfff 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -31,6 +31,10 @@ pub type blkcnt_t = i64; pub type nfds_t = c_ulong; pub type wchar_t = i32; pub type nl_item = c_int; +#[cfg_attr( + not(target_env = "p1"), + deprecated(since = "0.2.190", note = "not present on wasip2/3 targets") +)] pub type __wasi_rights_t = u64; pub type locale_t = *mut __locale_struct; pub type pthread_t = *mut c_void; @@ -633,13 +637,13 @@ pub const PTHREAD_SCOPE_PROCESS: c_int = 1; pub const PTHREAD_PROCESS_PRIVATE: c_int = 0; pub const PTHREAD_PROCESS_SHARED: c_int = 1; pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - size: [0 as *mut c_void; 6], + size: [ptr::null_mut(); 6], }; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - size: [0 as *mut c_void; 8], + size: [ptr::null_mut(); 8], }; pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - size: [0 as *mut c_void; 12], + size: [ptr::null_mut(); 12], }; pub const PTHREAD_ONCE_INIT: pthread_once_t = 0; pub const PTHREAD_CANCEL_ENABLE: c_int = 0; From 557eda1cd7ac68d5f740a700fdb4a074201b101f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:03:18 +0000 Subject: [PATCH 05/93] build(deps): bump vmactions/netbsd-vm from 1.4.2 to 1.4.4 Bumps [vmactions/netbsd-vm](https://github.com/vmactions/netbsd-vm) from 1.4.2 to 1.4.4. - [Release notes](https://github.com/vmactions/netbsd-vm/releases) - [Commits](https://github.com/vmactions/netbsd-vm/compare/0c26a4c4a5e234038862a4a53a00c905b8a107c9...bf34bcd909bb50856f934a67d09a8fbe2b966a1b) --- updated-dependencies: - dependency-name: vmactions/netbsd-vm dependency-version: 1.4.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] (backport ) (cherry picked from commit 10d5038102f69e339ccffa98299e9ebaff7ecca4) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index de2741a12c38..f6930182ea79 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -333,7 +333,7 @@ jobs: run: ./ci/bsd-run.sh ${{ matrix.target }} - name: Test on NetBSD - uses: vmactions/netbsd-vm@0c26a4c4a5e234038862a4a53a00c905b8a107c9 # v1.4.2 + uses: vmactions/netbsd-vm@bf34bcd909bb50856f934a67d09a8fbe2b966a1b # v1.4.4 if: contains(matrix.target, 'netbsd') with: release: "10.1" From ebf9b03637671ddcd7b75560dd5fd3fd216b543b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:03:37 +0000 Subject: [PATCH 06/93] build(deps): bump taiki-e/install-action from 2.84.0 to 2.85.2 Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.84.0 to 2.85.2. - [Release notes](https://github.com/taiki-e/install-action/releases) - [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/taiki-e/install-action/compare/a6b2e2dcd845ddd7f509ce4f3ed3d922b80cc5d9...41049aa56687c35e0afa74eed4f09cec4f9afabf) --- updated-dependencies: - dependency-name: taiki-e/install-action dependency-version: 2.85.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] (backport ) (cherry picked from commit 541424268987b6a91ed2239d220282bd9733ade3) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f6930182ea79..329ea7853d3d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -82,7 +82,7 @@ jobs: run: ./ci/install-rust.sh - name: Install semver-checks - uses: taiki-e/install-action@a6b2e2dcd845ddd7f509ce4f3ed3d922b80cc5d9 # v2.84.0 + uses: taiki-e/install-action@41049aa56687c35e0afa74eed4f09cec4f9afabf # v2.85.2 if: matrix.toolchain == 'stable' with: tool: cargo-semver-checks From 6c076eedd67c680d9d80b636c77ff70670b3e4da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:03:44 +0000 Subject: [PATCH 07/93] build(deps): bump actions/checkout from 7.0.0 to 7.0.1 Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0...3d3c42e5aac5ba805825da76410c181273ba90b1) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] (backport ) (cherry picked from commit 2eee169ba39e8a19473e3dce43e2a89415eeebd1) --- .github/workflows/ci.yaml | 16 ++++++++-------- .github/workflows/publish_0.2.yml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 329ea7853d3d..1bb1f88d53e7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-26.04 timeout-minutes: 10 steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Rust toolchain @@ -44,7 +44,7 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 10 steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - run: rustup update stable --no-self-update @@ -75,7 +75,7 @@ jobs: env: TOOLCHAIN: ${{ matrix.toolchain }} steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Rust toolchain @@ -148,7 +148,7 @@ jobs: env: TARGET: ${{ matrix.target }} steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Rust toolchain @@ -250,7 +250,7 @@ jobs: env: TARGET: ${{ matrix.target }} steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Rust toolchain @@ -302,7 +302,7 @@ jobs: - target: x86_64-unknown-illumos timeout-minutes: 25 steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Test on FreeBSD @@ -362,7 +362,7 @@ jobs: runs-on: ubuntu-26.04 timeout-minutes: 10 steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install Rust @@ -378,7 +378,7 @@ jobs: timeout-minutes: 10 steps: - name: Checkout repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false diff --git a/.github/workflows/publish_0.2.yml b/.github/workflows/publish_0.2.yml index a3d921b2ac07..009ec37a49fa 100644 --- a/.github/workflows/publish_0.2.yml +++ b/.github/workflows/publish_0.2.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false From 7d616f1fdfc8971782a0ff20e3c8532921d48084 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 27 Jul 2026 21:13:54 +0200 Subject: [PATCH 08/93] Add binding of getrandom for Redox OS Relibc definition for getrandom: https://gitlab.redox-os.org/redox-os/relibc/-/blob/5f6afb52692e62dae79154f4dbec2d0e79a07602/src/header/sys_random/mod.rs (backport ) (cherry picked from commit d0d18dca4dbde1c6466bc54859dd1309f698b32c) --- src/unix/redox/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 774d7b0d3164..1a4a2878b584 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -778,6 +778,10 @@ pub const MS_ASYNC: c_int = 0x0001; pub const MS_INVALIDATE: c_int = 0x0002; pub const MS_SYNC: c_int = 0x0004; +// sys/random.h +pub const GRND_NONBLOCK: c_uint = 1; +pub const GRND_RANDOM: c_uint = 2; + // sys/resource.h pub const RLIM_INFINITY: rlim_t = !0; pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; @@ -1389,6 +1393,9 @@ extern "C" { pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int; pub fn shm_unlink(name: *const c_char) -> c_int; + // sys/random.h + pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; + // sys/resource.h pub fn getpriority(which: c_int, who: crate::id_t) -> c_int; pub fn setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int; From 7da9d7f0859caea36305382f576426bacd7644cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:03:47 +0000 Subject: [PATCH 09/93] build(deps): bump zizmorcore/zizmor-action from 0.5.7 to 0.6.1 Bumps [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) from 0.5.7 to 0.6.1. - [Release notes](https://github.com/zizmorcore/zizmor-action/releases) - [Commits](https://github.com/zizmorcore/zizmor-action/compare/192e21d79ab29983730a13d1382995c2307fbcaa...6fc4b006235f201fdab3722e17240ab420d580e5) --- updated-dependencies: - dependency-name: zizmorcore/zizmor-action dependency-version: 0.6.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] (backport ) (cherry picked from commit 1f72f2c6ef9d9eb77e38566672a809c7e63fe557) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1bb1f88d53e7..1e6de4fbf65e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -383,7 +383,7 @@ jobs: persist-credentials: false - name: Run zizmor - uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7 + uses: zizmorcore/zizmor-action@6fc4b006235f201fdab3722e17240ab420d580e5 # v0.6.1 # One job that "summarizes" the success state of this pipeline. This can then be added to branch # protection, rather than having to add each job separately. From 544efc58fdd8b0e35da95625c3574b11cba5639d Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Fri, 24 Jul 2026 18:31:02 +0100 Subject: [PATCH 10/93] clippy: fix unused_unit lint https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unused_unit (backport ) (cherry picked from commit 63b34a986c570232352e2aee1ea35afe31229998) --- src/fuchsia/mod.rs | 2 -- src/unix/bsd/freebsdlike/dragonfly/mod.rs | 2 -- src/unix/linux_like/android/mod.rs | 2 -- src/unix/linux_like/emscripten/mod.rs | 2 -- 4 files changed, 8 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 4c2dcec5957e..58f638f5ec16 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3002,14 +3002,12 @@ f! { let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; - () } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); - () } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 773acc66f437..af5369ada85c 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1266,13 +1266,11 @@ f! { pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); cpuset.ary[idx] |= 1 << offset; - () } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); cpuset.ary[idx] &= !(1 << offset); - () } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index a29476859ba7..c0c10a0819f9 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -3489,14 +3489,12 @@ f! { let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.__bits[idx] |= 1 << offset; - () } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.__bits[idx] &= !(1 << offset); - () } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 7a28d89269f9..11c8ef131c81 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1284,14 +1284,12 @@ f! { let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; - () } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); - () } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { From 0a4261ac1385abf39dd65041923683345dcfdeba Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 27 Sep 2023 14:30:38 +0200 Subject: [PATCH 11/93] freebsd: move `net/if_mib.h` to `src/new` module There is a conflict of `NETLINK_GENERIC` definitions between `net/if_mib.h` and `netlink/netlink.h`. `netlink.h` is already exported in the crate root for Linux (and those definitions are already used by at least crates neli and netlink-packet-route.) `if_mib` does not seem to be too widely used just yet, so this moves the `if_mib` module contents into a namespace of their own to make space for `netlink` support on FreeBSD (rust-lang/libc#3194.) Signed-off-by: Yann Dirson Co-authored-by: dybucc <149513579+dybucc@users.noreply.github.com> (backport ) (cherry picked from commit f51fe550b737a2a6303c55955f2c3e95da127fae) --- src/new/freebsd/net/if_mib.rs | 48 +++++++++++++++++++++++++ src/new/freebsd/net/mod.rs | 1 + src/new/mod.rs | 2 ++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 45 ----------------------- 4 files changed, 51 insertions(+), 45 deletions(-) create mode 100644 src/new/freebsd/net/if_mib.rs diff --git a/src/new/freebsd/net/if_mib.rs b/src/new/freebsd/net/if_mib.rs new file mode 100644 index 000000000000..67e989085b2c --- /dev/null +++ b/src/new/freebsd/net/if_mib.rs @@ -0,0 +1,48 @@ +//! Header: `net/if_mib.h` +//! +//! https://github.com/freebsd/freebsd-src/blob/86691d52a6d3796ad36ba474cf0a9493f6d99202/sys/net/if_mib.h + +use crate::prelude::*; + +/// non-interface-specific +pub const IFMIB_SYSTEM: c_int = 1; +/// per-interface data table +pub const IFMIB_IFDATA: c_int = 2; + +/// generic stats for all kinds of ifaces +pub const IFDATA_GENERAL: c_int = 1; +/// specific to the type of interface +pub const IFDATA_LINKSPECIFIC: c_int = 2; +/// driver name and unit +pub const IFDATA_DRIVERNAME: c_int = 3; + +/// number of interfaces configured +pub const IFMIB_IFCOUNT: c_int = 1; + +/// functions not specific to a type of iface +pub const NETLINK_GENERIC: c_int = 0; + +pub const DOT3COMPLIANCE_STATS: c_int = 1; +pub const DOT3COMPLIANCE_COLLS: c_int = 2; + +pub const dot3ChipSetAMD7990: c_int = 1; +pub const dot3ChipSetAMD79900: c_int = 2; +pub const dot3ChipSetAMD79C940: c_int = 3; + +pub const dot3ChipSetIntel82586: c_int = 1; +pub const dot3ChipSetIntel82596: c_int = 2; +pub const dot3ChipSetIntel82557: c_int = 3; + +pub const dot3ChipSetNational8390: c_int = 1; +pub const dot3ChipSetNationalSonic: c_int = 2; + +pub const dot3ChipSetFujitsu86950: c_int = 1; + +pub const dot3ChipSetDigitalDC21040: c_int = 1; +pub const dot3ChipSetDigitalDC21140: c_int = 2; +pub const dot3ChipSetDigitalDC21041: c_int = 3; +pub const dot3ChipSetDigitalDC21140A: c_int = 4; +pub const dot3ChipSetDigitalDC21142: c_int = 5; + +pub const dot3ChipSetWesternDigital83C690: c_int = 1; +pub const dot3ChipSetWesternDigital83C790: c_int = 2; diff --git a/src/new/freebsd/net/mod.rs b/src/new/freebsd/net/mod.rs index e270c54938cb..c8d8c3690111 100644 --- a/src/new/freebsd/net/mod.rs +++ b/src/new/freebsd/net/mod.rs @@ -3,3 +3,4 @@ //! https://github.com/freebsd/freebsd-src/tree/main/sys/net pub(crate) mod dlt; +pub(crate) mod if_mib; diff --git a/src/new/mod.rs b/src/new/mod.rs index f4387e7aa9da..52212334e661 100644 --- a/src/new/mod.rs +++ b/src/new/mod.rs @@ -227,6 +227,8 @@ cfg_if! { pub use net::if_::*; } else if #[cfg(target_os = "freebsd")] { pub use net::dlt::*; + // FIXME(1.0,remove): these bindings should be left in a public submodule. + pub use net::if_mib::*; pub use netinet6::in6_var::*; pub use sys::file::*; pub use sys::ioccom::*; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 0d1491bcf9a6..9b0fc45f07d9 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -2908,51 +2908,6 @@ pub const IFDR_MSG_SIZE: c_int = 64; pub const IFDR_REASON_MSG: c_int = 1; pub const IFDR_REASON_VENDOR: c_int = 2; -// sys/net/if_mib.h - -/// non-interface-specific -pub const IFMIB_SYSTEM: c_int = 1; -/// per-interface data table -pub const IFMIB_IFDATA: c_int = 2; - -/// generic stats for all kinds of ifaces -pub const IFDATA_GENERAL: c_int = 1; -/// specific to the type of interface -pub const IFDATA_LINKSPECIFIC: c_int = 2; -/// driver name and unit -pub const IFDATA_DRIVERNAME: c_int = 3; - -/// number of interfaces configured -pub const IFMIB_IFCOUNT: c_int = 1; - -/// functions not specific to a type of iface -pub const NETLINK_GENERIC: c_int = 0; - -pub const DOT3COMPLIANCE_STATS: c_int = 1; -pub const DOT3COMPLIANCE_COLLS: c_int = 2; - -pub const dot3ChipSetAMD7990: c_int = 1; -pub const dot3ChipSetAMD79900: c_int = 2; -pub const dot3ChipSetAMD79C940: c_int = 3; - -pub const dot3ChipSetIntel82586: c_int = 1; -pub const dot3ChipSetIntel82596: c_int = 2; -pub const dot3ChipSetIntel82557: c_int = 3; - -pub const dot3ChipSetNational8390: c_int = 1; -pub const dot3ChipSetNationalSonic: c_int = 2; - -pub const dot3ChipSetFujitsu86950: c_int = 1; - -pub const dot3ChipSetDigitalDC21040: c_int = 1; -pub const dot3ChipSetDigitalDC21140: c_int = 2; -pub const dot3ChipSetDigitalDC21041: c_int = 3; -pub const dot3ChipSetDigitalDC21140A: c_int = 4; -pub const dot3ChipSetDigitalDC21142: c_int = 5; - -pub const dot3ChipSetWesternDigital83C690: c_int = 1; -pub const dot3ChipSetWesternDigital83C790: c_int = 2; - // sys/netinet/in.h // Protocols (RFC 1700) // NOTE: These are in addition to the constants defined in src/unix/mod.rs From 6442763cd34d0fae40233fd1ad97c933e1b32f63 Mon Sep 17 00:00:00 2001 From: Asger Hautop Drewsen Date: Fri, 24 Jul 2026 11:17:41 +0200 Subject: [PATCH 12/93] Add `RTLD_NEXT` for Android targets See https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/dlfcn.h;drc=5cbc4aac25367c5d774a8af9e015950517887e06 (backport ) (cherry picked from commit 56b4d3a1c8a9d9a5da7514d8c35cff9fd55f326c) --- libc-test/semver/android.txt | 1 + src/unix/linux_like/android/b32/mod.rs | 1 + src/unix/linux_like/android/b64/mod.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 6e99aea99f90..0f6d82b2e7bf 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -2300,6 +2300,7 @@ RTLD_DEFAULT RTLD_GLOBAL RTLD_LAZY RTLD_LOCAL +RTLD_NEXT RTLD_NODELETE RTLD_NOLOAD RTLD_NOW diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs index e744c324e159..056200313a33 100644 --- a/src/unix/linux_like/android/b32/mod.rs +++ b/src/unix/linux_like/android/b32/mod.rs @@ -193,6 +193,7 @@ pub const SA_SIGINFO: c_int = 0x00000004; pub const RTLD_GLOBAL: c_int = 2; pub const RTLD_NOW: c_int = 0; pub const RTLD_DEFAULT: *mut c_void = -1isize as *mut c_void; +pub const RTLD_NEXT: *mut c_void = -2isize as *mut c_void; pub const PTRACE_GETFPREGS: c_int = 14; pub const PTRACE_SETFPREGS: c_int = 15; diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs index f5a204d8fe61..a1f7c393998d 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/linux_like/android/b64/mod.rs @@ -152,6 +152,7 @@ pub const SA_SIGINFO: c_int = 0x00000004; pub const RTLD_GLOBAL: c_int = 0x00100; pub const RTLD_NOW: c_int = 2; pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut(); +pub const RTLD_NEXT: *mut c_void = -1isize as *mut c_void; pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { value: 0, From d27d756f2350cfb7b73caad9f71bc10a2c110816 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Wed, 8 Jul 2026 13:27:20 +0200 Subject: [PATCH 13/93] hurd(b32): simplify item paths (backport ) (cherry picked from commit 15a45360df53f264a017ffd5268f4ddc952cb166) --- src/unix/hurd/b32.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/hurd/b32.rs b/src/unix/hurd/b32.rs index e706789006db..e56df6d6bf06 100644 --- a/src/unix/hurd/b32.rs +++ b/src/unix/hurd/b32.rs @@ -15,14 +15,14 @@ pub type __u_quad_t = c_ulonglong; pub type __intmax_t = c_longlong; pub type __uintmax_t = c_ulonglong; -pub type __squad_type = crate::__int64_t; -pub type __uquad_type = crate::__uint64_t; +pub type __squad_type = __int64_t; +pub type __uquad_type = __uint64_t; pub type __sword_type = c_int; pub type __uword_type = c_uint; pub type __slong32_type = c_long; pub type __ulong32_type = c_ulong; -pub type __s64_type = crate::__int64_t; -pub type __u64_type = crate::__uint64_t; +pub type __s64_type = __int64_t; +pub type __u64_type = __uint64_t; pub type __ipc_pid_t = c_ushort; From 421d49081ed5ac4bd567407c3480977564de37e5 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Wed, 8 Jul 2026 13:28:18 +0200 Subject: [PATCH 14/93] hurd: fill in definition for `fpos_t` Add GNU/Hurd definition and skip the opaque type definition in the top-level `unix` module. The definition fits that of [^1]. [^1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/bits/types/__fpos_t.h;h=bb04576651b9097b3027e4299cc30c88f334535f;hb=b5eecf35d91a3b29cff80b731bbc6bcce6863827 (backport ) (cherry picked from commit 442adc8e448b0a9ca8247c5a894309488775f22b) --- src/unix/hurd/mod.rs | 17 +++++++++++++++++ src/unix/mod.rs | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 1cc87eb268fa..f7776fddd1d5 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -1068,6 +1068,23 @@ impl siginfo_t { } } +s_no_extra_traits! { + pub struct fpos_t { + __pos: off_t, + __state: __mbstate_t, + } + + struct __mbstate_t { + __count: c_int, + __value: __c_anonymous___mbstate_t___value, + } + + union __c_anonymous___mbstate_t___value { + __wch: c_int, + __wchb: [c_char; 4], + } +} + // const // aio.h diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 6c64020d49e8..38d6a46556c6 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -611,7 +611,10 @@ cfg_if! { } cfg_if! { - if #[cfg(not(all(target_os = "linux", target_env = "gnu")))] { + if #[cfg(not(any( + target_os = "hurd", + all(target_os = "linux", target_env = "gnu") + )))] { extern_ty! { pub type fpos_t; // FIXME(unix): fill this out with a struct } From 73a46f311cec5083bf7b8ce1ce48b68d70d17773 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Wed, 8 Jul 2026 13:45:14 +0200 Subject: [PATCH 15/93] hurd: add proper handling of lfs Add uses of the `gnu_file_offset_bits64` `cfg` to the `hurd` module. GNU/Hurd systems use glibc and that includes both the file offset and `time_t` feature test macros. This patch ensures the right definition is exposed on 64-unsuffixed types. Affected records don't directly use the `cfg` to define their fields conditionally. They instead use the types not prefixed with two underscores to define their fields. These types are themselves conditionally defined. This avoids cluttering both the type alias definition and the record definition. (backport ) (cherry picked from commit fed788dc113ff8f87e49f08a2ea9ef59520b0d39) --- build.rs | 2 +- src/unix/hurd/mod.rs | 200 +++++++++++++++++++++++++++++++------------ 2 files changed, 147 insertions(+), 55 deletions(-) diff --git a/build.rs b/build.rs index 67da9c63b02f..fecbd484867c 100644 --- a/build.rs +++ b/build.rs @@ -177,7 +177,7 @@ fn main() { } if target_env == "gnu" - && matches!(target_os.as_str(), "linux" | "windows") + && matches!(target_os.as_str(), "linux" | "windows" | "hurd") && target_ptr_width == "32" && target_arch != "riscv32" && target_arch != "x86_64" diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index f7776fddd1d5..dad540931d39 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -77,7 +77,15 @@ pub type wchar_t = c_int; pub type wint_t = c_uint; pub type gid_t = __gid_t; pub type uid_t = __uid_t; -pub type off_t = __off_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type off_t = __off64_t; + } else { + pub type off_t = __off_t; + } +} + pub type off64_t = __off64_t; pub type useconds_t = __useconds_t; pub type pid_t = __pid_t; @@ -101,7 +109,15 @@ pub type quad_t = __quad_t; pub type u_quad_t = __u_quad_t; pub type fsid_t = __fsid_t; pub type loff_t = __loff_t; -pub type ino_t = __ino_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type ino_t = __ino64_t; + } else { + pub type ino_t = __ino_t; + } +} + pub type ino64_t = __ino64_t; pub type dev_t = __dev_t; pub type mode_t = __mode_t; @@ -129,9 +145,19 @@ pub type sigset_t = __sigset_t; pub type __fd_mask = c_long; pub type fd_mask = __fd_mask; pub type blksize_t = __blksize_t; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type blkcnt_t = __blkcnt64_t; + pub type fsblkcnt_t = __fsblkcnt64_t; + pub type fsfilcnt_t = __fsfilcnt64_t; + } else { + pub type blkcnt_t = __blkcnt_t; + pub type fsblkcnt_t = __fsblkcnt_t; + pub type fsfilcnt_t = __fsfilcnt_t; + } +} + pub type blkcnt64_t = __blkcnt64_t; pub type fsblkcnt64_t = __fsblkcnt64_t; pub type fsfilcnt64_t = __fsfilcnt64_t; @@ -164,7 +190,15 @@ pub type pthread_once_t = __pthread_once; pub type __rlimit_resource = c_uint; pub type __rlimit_resource_t = __rlimit_resource; -pub type rlim_t = __rlim_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type rlim_t = __rlim64_t; + } else { + pub type rlim_t = __rlim_t; + } +} + pub type rlim64_t = __rlim64_t; pub type __rusage_who = c_int; @@ -350,7 +384,7 @@ s! { } pub struct dirent { - pub d_ino: __ino_t, + pub d_ino: ino_t, pub d_reclen: c_ushort, pub d_type: c_uchar, pub d_namlen: c_uchar, @@ -449,22 +483,36 @@ s! { pub struct stat { pub st_fstype: c_int, pub st_dev: __fsid_t, /* Actually st_fsid */ - pub st_ino: __ino_t, + pub st_ino: ino_t, pub st_gen: c_uint, pub st_rdev: __dev_t, pub st_mode: __mode_t, pub st_nlink: __nlink_t, pub st_uid: __uid_t, pub st_gid: __gid_t, - pub st_size: __off_t, - pub st_atim: crate::timespec, - pub st_mtim: crate::timespec, - pub st_ctim: crate::timespec, + pub st_size: off_t, + pub st_atim: timespec, + pub st_mtim: timespec, + pub st_ctim: timespec, pub st_blksize: __blksize_t, - pub st_blocks: __blkcnt_t, + pub st_blocks: blkcnt_t, pub st_author: __uid_t, pub st_flags: c_uint, - pub st_spare: [c_int; 11usize], + st_spare: Padding< + [c_int; if cfg!(not(gnu_file_offset_bits64)) { + if size_of::<__fsid_t>() == size_of::() { + 12 + } else { + 11 + } + } else { + if size_of::<__fsid_t>() == size_of::() { + 9 + } else { + 8 + } + }], + >, } pub struct stat64 { @@ -478,14 +526,20 @@ s! { pub st_uid: __uid_t, pub st_gid: __gid_t, pub st_size: __off64_t, - pub st_atim: crate::timespec, - pub st_mtim: crate::timespec, - pub st_ctim: crate::timespec, + pub st_atim: timespec, + pub st_mtim: timespec, + pub st_ctim: timespec, pub st_blksize: __blksize_t, pub st_blocks: __blkcnt64_t, pub st_author: __uid_t, pub st_flags: c_uint, - pub st_spare: [c_int; 8usize], + st_spare: Padding< + [c_int; if size_of::<__fsid_t>() == size_of::() { + 9 + } else { + 8 + }], + >, } pub struct statx { @@ -521,17 +575,17 @@ s! { pub struct statfs { pub f_type: c_uint, pub f_bsize: c_ulong, - pub f_blocks: __fsblkcnt_t, - pub f_bfree: __fsblkcnt_t, - pub f_bavail: __fsblkcnt_t, - pub f_files: __fsblkcnt_t, - pub f_ffree: __fsblkcnt_t, + pub f_blocks: fsblkcnt_t, + pub f_bfree: fsblkcnt_t, + pub f_bavail: fsblkcnt_t, + pub f_files: fsblkcnt_t, + pub f_ffree: fsblkcnt_t, pub f_fsid: __fsid_t, pub f_namelen: c_ulong, - pub f_favail: __fsfilcnt_t, + pub f_favail: fsfilcnt_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } pub struct statfs64 { @@ -547,23 +601,23 @@ s! { pub f_favail: __fsfilcnt64_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } pub struct statvfs { pub __f_type: c_uint, pub f_bsize: c_ulong, - pub f_blocks: __fsblkcnt_t, - pub f_bfree: __fsblkcnt_t, - pub f_bavail: __fsblkcnt_t, - pub f_files: __fsfilcnt_t, - pub f_ffree: __fsfilcnt_t, + pub f_blocks: fsblkcnt_t, + pub f_bfree: fsblkcnt_t, + pub f_bavail: fsblkcnt_t, + pub f_files: fsfilcnt_t, + pub f_ffree: fsfilcnt_t, pub f_fsid: __fsid_t, pub f_namemax: c_ulong, - pub f_favail: __fsfilcnt_t, + pub f_favail: fsfilcnt_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } pub struct statvfs64 { @@ -579,7 +633,7 @@ s! { pub f_favail: __fsfilcnt64_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } pub struct aiocb { @@ -628,6 +682,7 @@ s! { pub __pshared: __pthread_process_shared, pub __mutex_type: __pthread_mutex_type, } + pub struct __pthread_mutex { pub __lock: c_uint, pub __owner_id: c_uint, @@ -893,12 +948,14 @@ s! { pub l_type: c_int, #[cfg(target_pointer_width = "32")] pub l_whence: c_int, + #[cfg(target_pointer_width = "64")] pub l_type: c_short, #[cfg(target_pointer_width = "64")] pub l_whence: c_short, - pub l_start: __off_t, - pub l_len: __off_t, + + pub l_start: off_t, + pub l_len: off_t, pub l_pid: __pid_t, } @@ -907,11 +964,13 @@ s! { pub l_type: c_int, #[cfg(target_pointer_width = "32")] pub l_whence: c_int, + #[cfg(target_pointer_width = "64")] pub l_type: c_short, #[cfg(target_pointer_width = "64")] pub l_whence: c_short, - pub l_start: __off_t, + + pub l_start: __off64_t, pub l_len: __off64_t, pub l_pid: __pid_t, } @@ -1206,10 +1265,17 @@ pub const __PTHREAD_SPIN_LOCK_INITIALIZER: c_int = 0; pub const PTHREAD_MUTEX_NORMAL: c_int = 0; // sys/resource.h -pub const RLIM_INFINITY: crate::rlim_t = 2147483647; -pub const RLIM64_INFINITY: crate::rlim64_t = 9223372036854775807; -pub const RLIM_SAVED_MAX: crate::rlim_t = RLIM_INFINITY; -pub const RLIM_SAVED_CUR: crate::rlim_t = RLIM_INFINITY; +cfg_if! { + if #[cfg(gnu_file_offset_bits64)] { + pub const RLIM_INFINITY: rlim64_t = 0x7fffffffffffffff; + } else { + pub const RLIM_INFINITY: rlim_t = -1_isize as rlim_t; + } +} + +pub const RLIM64_INFINITY: rlim64_t = 0x7fffffffffffffff; +pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY; +pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; pub const PRIO_MIN: c_int = -20; pub const PRIO_MAX: c_int = 20; @@ -3568,17 +3634,19 @@ extern "C" { pub fn readv(__fd: c_int, __iovec: *const crate::iovec, __count: c_int) -> ssize_t; pub fn writev(__fd: c_int, __iovec: *const crate::iovec, __count: c_int) -> ssize_t; + #[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64")] pub fn preadv( __fd: c_int, __iovec: *const crate::iovec, __count: c_int, - __offset: __off_t, + __offset: off_t, ) -> ssize_t; + #[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64")] pub fn pwritev( __fd: c_int, __iovec: *const crate::iovec, __count: c_int, - __offset: __off_t, + __offset: off_t, ) -> ssize_t; pub fn preadv64(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off64_t) @@ -3689,6 +3757,7 @@ extern "C" { addrlen: *mut crate::socklen_t, ) -> ssize_t; + #[cfg_attr(gnu_file_offset_bits64, link_name = "sendfile64")] pub fn sendfile(out_fd: c_int, in_fd: c_int, offset: *mut off_t, count: size_t) -> ssize_t; pub fn sendfile64(out_fd: c_int, in_fd: c_int, offset: *mut off64_t, count: size_t) -> ssize_t; @@ -4056,8 +4125,10 @@ extern "C" { pub fn lstat(__file: *const c_char, __buf: *mut stat) -> c_int; pub fn lstat64(__file: *const c_char, __buf: *mut stat64) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "statfs64")] pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; pub fn statfs64(__file: *const c_char, __buf: *mut statfs64) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "fstatfs64")] pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; pub fn fstatfs64(__fildes: c_int, __buf: *mut statfs64) -> c_int; @@ -4250,8 +4321,8 @@ extern "C" { ) -> c_int; pub fn readdir64_r( dirp: *mut crate::DIR, - entry: *mut crate::dirent64, - result: *mut *mut crate::dirent64, + entry: *mut dirent64, + result: *mut *mut dirent64, ) -> c_int; pub fn seekdir(dirp: *mut crate::DIR, loc: c_long); pub fn telldir(dirp: *mut crate::DIR) -> c_long; @@ -4269,7 +4340,7 @@ extern "C" { __prot: c_int, __flags: c_int, __fd: c_int, - __offset: __off64_t, + __offset: off64_t, ) -> *mut c_void; pub fn mremap( @@ -4288,9 +4359,11 @@ extern "C" { pub fn fdatasync(fd: c_int) -> c_int; pub fn fallocate64(fd: c_int, mode: c_int, offset: off64_t, len: off64_t) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")] pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; pub fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fadvise64")] pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int; pub fn posix_fadvise64(fd: c_int, offset: off64_t, len: off64_t, advise: c_int) -> c_int; @@ -4299,11 +4372,12 @@ extern "C" { pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; - pub fn getrlimit(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; - pub fn getrlimit64(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit64) -> c_int; - pub fn setrlimit(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit) -> c_int; - pub fn setrlimit64(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit64) - -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "getrlimit64")] + pub fn getrlimit(resource: __rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; + pub fn getrlimit64(resource: __rlimit_resource_t, rlim: *mut rlimit64) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "setrlimit64")] + pub fn setrlimit(resource: __rlimit_resource_t, rlim: *const crate::rlimit) -> c_int; + pub fn setrlimit64(resource: __rlimit_resource_t, rlim: *const rlimit64) -> c_int; pub fn getpriority(which: crate::__priority_which, who: crate::id_t) -> c_int; pub fn setpriority(which: crate::__priority_which, who: crate::id_t, prio: c_int) -> c_int; @@ -4396,20 +4470,38 @@ extern "C" { pub fn regfree(preg: *mut crate::regex_t); + #[cfg_attr( + all(gnu_file_offset_bits64, gnu_time_bits64), + link_name = "__glob64_time64" + )] + #[cfg_attr( + all(gnu_file_offset_bits64, not(gnu_time_bits64)), + link_name = "glob64" + )] pub fn glob( pattern: *const c_char, flags: c_int, errfunc: Option c_int>, - pglob: *mut crate::glob_t, + pglob: *mut glob_t, ) -> c_int; - pub fn globfree(pglob: *mut crate::glob_t); - + #[cfg_attr( + all(gnu_file_offset_bits64, gnu_time_bits64), + link_name = "__globfree64_time64" + )] + #[cfg_attr( + all(gnu_file_offset_bits64, not(gnu_time_bits64)), + link_name = "globfree64" + )] + pub fn globfree(pglob: *mut glob_t); + + #[cfg_attr(gnu_time_bits64, link_name = "__glob64_time64")] pub fn glob64( pattern: *const c_char, flags: c_int, errfunc: Option c_int>, pglob: *mut glob64_t, ) -> c_int; + #[cfg_attr(gnu_time_bits64, link_name = "__globfree64_time64")] pub fn globfree64(pglob: *mut glob64_t); pub fn getxattr( From 7fbfa0145d6159d7846ce2ab59d3dc05bb29ad33 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Wed, 8 Jul 2026 16:55:30 +0200 Subject: [PATCH 16/93] hurd: adjust `cpu_set_t` definition Modify definition of `cpu_set_t` to use the same constant expression as used upstream [^1]. This resolves to the same values as before but relies on the conditional definition of the type `__cpu_mask` is defined in terms of. [^1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=posix/bits/cpu-set.h;h=ddb79cefc2e5d93003f8da84eca6302f99153a22;hb=b5eecf35d91a3b29cff80b731bbc6bcce6863827 (backport ) (cherry picked from commit b518ad5dca806bfc3536068d15a47bbe50dd99e4) --- src/unix/hurd/mod.rs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index dad540931d39..7fbe8cbdb56c 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -1013,10 +1013,7 @@ s! { } pub struct cpu_set_t { - #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] - bits: [u32; 32], - #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))] - bits: [u64; 16], + __bits: [__cpu_mask; __CPU_SETSIZE / __NCPUBITS], } pub struct if_nameindex { @@ -2564,6 +2561,7 @@ pub const SCHED_FIFO: c_int = 1; pub const SCHED_RR: c_int = 2; pub const _BITS_TYPES_STRUCT_SCHED_PARAM: usize = 1; pub const __CPU_SETSIZE: usize = 1024; +pub const __NCPUBITS: usize = 8 * size_of::<__cpu_mask>(); pub const CPU_SETSIZE: usize = 1024; // pthread.h @@ -3499,36 +3497,36 @@ f! { pub unsafe fn CPU_ALLOC_SIZE(count: c_int) -> size_t { let _dummy: cpu_set_t = mem::zeroed(); - let size_in_bits = 8 * size_of_val(&_dummy.bits[0]); + let size_in_bits = 8 * size_of_val(&_dummy.__bits[0]); ((count as size_t + size_in_bits - 1) / 8) as size_t } pub unsafe fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { - cpuset.bits.fill(0); + cpuset.__bits.fill(0); } pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] |= 1 << offset; + cpuset.__bits[idx] |= 1 << offset; } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] &= !(1 << offset); + cpuset.__bits[idx] &= !(1 << offset); } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - 0 != (cpuset.bits[idx] & (1 << offset)) + 0 != (cpuset.__bits[idx] & (1 << offset)) } pub unsafe fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; - let size_of_mask = size_of_val(&cpuset.bits[0]); - for i in cpuset.bits[..(size / size_of_mask)].iter() { + let size_of_mask = size_of_val(&cpuset.__bits[0]); + for i in cpuset.__bits[..(size / size_of_mask)].iter() { s += i.count_ones(); } s as c_int @@ -3539,7 +3537,7 @@ f! { } pub unsafe fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { - set1.bits == set2.bits + set1.__bits == set2.__bits } pub unsafe fn IPTOS_TOS(tos: u8) -> u8 { From f6a8f64ddae6b4370745460e47f287182c4cd39d Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Wed, 8 Jul 2026 16:59:04 +0200 Subject: [PATCH 17/93] hurd: remove duplicate definitions Remove routine bindings that were already present in the `unix` module. Those in the top-level `unix` module were already outfit with the corresponding link name redirection under one of `gnu_file_offset_bits64` or `gnu_time_bits64`. They have been preferred over those in the `hurd` submodule. (backport ) (cherry picked from commit 25a4d1fe545be51a7372c400e5989b4e31159721) --- src/unix/hurd/mod.rs | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 7fbe8cbdb56c..d8a9601bdaab 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -3717,9 +3717,7 @@ extern "C" { oldattr: *mut crate::mq_attr, ) -> c_int; - pub fn lseek64(__fd: c_int, __offset: __off64_t, __whence: c_int) -> __off64_t; - - pub fn lseek(__fd: c_int, __offset: __off_t, __whence: c_int) -> __off_t; + pub fn lseek64(__fd: c_int, __offset: off64_t, __whence: c_int) -> off64_t; pub fn fgetpos64(stream: *mut crate::FILE, ptr: *mut fpos64_t) -> c_int; pub fn fseeko64(stream: *mut crate::FILE, offset: off64_t, whence: c_int) -> c_int; @@ -4097,10 +4095,8 @@ extern "C" { old_value: *mut crate::itimerspec, ) -> c_int; - pub fn fstat(__fd: c_int, __buf: *mut stat) -> c_int; pub fn fstat64(__fd: c_int, __buf: *mut stat64) -> c_int; - pub fn fstatat(__fd: c_int, __file: *const c_char, __buf: *mut stat, __flag: c_int) -> c_int; pub fn fstatat64( __fd: c_int, __file: *const c_char, @@ -4116,11 +4112,9 @@ extern "C" { statxbuf: *mut statx, ) -> c_int; - pub fn ftruncate(__fd: c_int, __length: __off_t) -> c_int; - pub fn ftruncate64(__fd: c_int, __length: __off64_t) -> c_int; - pub fn truncate64(__file: *const c_char, __length: __off64_t) -> c_int; + pub fn ftruncate64(__fd: c_int, __length: off64_t) -> c_int; + pub fn truncate64(__file: *const c_char, __length: off64_t) -> c_int; - pub fn lstat(__file: *const c_char, __buf: *mut stat) -> c_int; pub fn lstat64(__file: *const c_char, __buf: *mut stat64) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "statfs64")] @@ -4130,15 +4124,11 @@ extern "C" { pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; pub fn fstatfs64(__fildes: c_int, __buf: *mut statfs64) -> c_int; - pub fn statvfs(__file: *const c_char, __buf: *mut statvfs) -> c_int; pub fn statvfs64(__file: *const c_char, __buf: *mut statvfs64) -> c_int; - pub fn fstatvfs(__fildes: c_int, __buf: *mut statvfs) -> c_int; pub fn fstatvfs64(__fildes: c_int, __buf: *mut statvfs64) -> c_int; - pub fn open(__file: *const c_char, __oflag: c_int, ...) -> c_int; pub fn open64(__file: *const c_char, __oflag: c_int, ...) -> c_int; - pub fn openat(__fd: c_int, __file: *const c_char, __oflag: c_int, ...) -> c_int; pub fn openat64(__fd: c_int, __file: *const c_char, __oflag: c_int, ...) -> c_int; pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut crate::FILE; @@ -4307,16 +4297,9 @@ extern "C" { pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; - pub fn stat(__file: *const c_char, __buf: *mut stat) -> c_int; pub fn stat64(__file: *const c_char, __buf: *mut stat64) -> c_int; - pub fn readdir(dirp: *mut crate::DIR) -> *mut crate::dirent; - pub fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64; - pub fn readdir_r( - dirp: *mut crate::DIR, - entry: *mut crate::dirent, - result: *mut *mut crate::dirent, - ) -> c_int; + pub fn readdir64(dirp: *mut crate::DIR) -> *mut dirent64; pub fn readdir64_r( dirp: *mut crate::DIR, entry: *mut dirent64, From 15cad6c9c5cbf6a0149402b27498bf94c9c03461 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:52:26 +0200 Subject: [PATCH 18/93] hurd: deprecate glob64 types and routines Add deprecation notices to `glob64_t` and 64-suffixed routines. The bindings we expose have no difference whatsoever between `glob_t` and `glob64_t`. Differing fields are exposed here as `void *`s. (backport ) (cherry picked from commit 50ee7e30120930b301fd6d4a5b9a2c4dd587d966) --- src/unix/hurd/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index d8a9601bdaab..0e02f5c6a841 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -988,6 +988,10 @@ s! { __unused5: Padding<*mut c_void>, } + #[deprecated( + since = "0.2.187", + note = "Use `glob_t` instead. The definitions are equivalent." + )] pub struct glob64_t { pub gl_pathc: size_t, pub gl_pathv: *mut *mut c_char, @@ -4476,6 +4480,11 @@ extern "C" { pub fn globfree(pglob: *mut glob_t); #[cfg_attr(gnu_time_bits64, link_name = "__glob64_time64")] + #[deprecated( + since = "0.2.187", + note = "Use `glob` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn glob64( pattern: *const c_char, flags: c_int, @@ -4483,6 +4492,11 @@ extern "C" { pglob: *mut glob64_t, ) -> c_int; #[cfg_attr(gnu_time_bits64, link_name = "__globfree64_time64")] + #[deprecated( + since = "0.2.187", + note = "Use `globfree` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn globfree64(pglob: *mut glob64_t); pub fn getxattr( From f1c04f9e4997a4dae9503f5f5461f0072846cd2c Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:53:40 +0200 Subject: [PATCH 19/93] hurd: deprecate non-existing `fallocate64` Add deprecation notice to `fallocate64` because this routine is only exposed under Linux in glibc [^1]. [^1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/fcntl-linux.h;h=587b815124318864320973b864899b19466e46b8;hb=HEAD#l450 (backport ) (cherry picked from commit 611a311c9c0ffba473e3d567a03c97d716a39b9b) --- src/unix/hurd/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 0e02f5c6a841..88f29380e7de 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -4343,6 +4343,7 @@ extern "C" { pub fn syncfs(fd: c_int) -> c_int; pub fn fdatasync(fd: c_int) -> c_int; + #[deprecated(since = "0.2.187", note = "This routine doesn't exist upstream.")] pub fn fallocate64(fd: c_int, mode: c_int, offset: off64_t, len: off64_t) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")] pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; From d4e5fc58844a09c5769ed3c0318733eca39edd8a Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Thu, 2 Jul 2026 11:48:44 +0200 Subject: [PATCH 20/93] hurd: annotate file off tys/fns for deprecation Add comments annotating file offset types and routines whose identifier is 64-suffixed as slated for deprecation and eventual removal. this holds only for 64-bit targets, so the comment adds a "parameter" to the FIXME that will be found+replaced with a deprecation attribute later on. These types otherwise provide redundant definitions. (backport ) (cherry picked from commit d96acec424e0310959883f94487647b5c55ec8f5) --- src/unix/hurd/mod.rs | 49 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 88f29380e7de..ad8d5a3c1b6d 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -86,6 +86,7 @@ cfg_if! { } } +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type off64_t = __off64_t; pub type useconds_t = __useconds_t; pub type pid_t = __pid_t; @@ -118,6 +119,7 @@ cfg_if! { } } +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type ino64_t = __ino64_t; pub type dev_t = __dev_t; pub type mode_t = __mode_t; @@ -158,8 +160,11 @@ cfg_if! { } } +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type blkcnt64_t = __blkcnt64_t; +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type fsblkcnt64_t = __fsblkcnt64_t; +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type fsfilcnt64_t = __fsfilcnt64_t; pub type __pthread_spinlock_t = c_int; @@ -199,6 +204,7 @@ cfg_if! { } } +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type rlim64_t = __rlim64_t; pub type __rusage_who = c_int; @@ -260,6 +266,7 @@ pub type nl_item = c_int; pub type iconv_t = *mut c_void; extern_ty! { + // FIXME(1.0,deprecate,64): lfs binding to be removed pub type fpos64_t; // FIXME(hurd): fill this out with a struct pub type timezone; } @@ -391,6 +398,7 @@ s! { pub d_name: [c_char; 1usize], } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct dirent64 { pub d_ino: __ino64_t, pub d_reclen: c_ushort, @@ -515,6 +523,7 @@ s! { >, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct stat64 { pub st_fstype: c_int, pub st_dev: __fsid_t, /* Actually st_fsid */ @@ -588,6 +597,7 @@ s! { f_spare: Padding<[c_uint; 3usize]>, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct statfs64 { pub f_type: c_uint, pub f_bsize: c_ulong, @@ -620,6 +630,7 @@ s! { f_spare: Padding<[c_uint; 3usize]>, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct statvfs64 { pub __f_type: c_uint, pub f_bsize: c_ulong, @@ -921,6 +932,7 @@ s! { pub domainname: [c_char; _UTSNAME_LENGTH], } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -959,6 +971,7 @@ s! { pub l_pid: __pid_t, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct flock64 { #[cfg(target_pointer_width = "32")] pub l_type: c_int, @@ -1274,6 +1287,7 @@ cfg_if! { } } +// FIXME(1.0,deprecate,64): lfs binding to be removed pub const RLIM64_INFINITY: rlim64_t = 0x7fffffffffffffff; pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY; pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; @@ -3630,7 +3644,9 @@ extern "C" { pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: off64_t) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset: off64_t) -> ssize_t; pub fn readv(__fd: c_int, __iovec: *const crate::iovec, __count: c_int) -> ssize_t; @@ -3651,8 +3667,10 @@ extern "C" { __offset: off_t, ) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn preadv64(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off64_t) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn pwritev64( fd: c_int, iov: *const crate::iovec, @@ -3721,11 +3739,18 @@ extern "C" { oldattr: *mut crate::mq_attr, ) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn lseek64(__fd: c_int, __offset: off64_t, __whence: c_int) -> off64_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed + #[allow(clashing_extern_declarations)] pub fn fgetpos64(stream: *mut crate::FILE, ptr: *mut fpos64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fseeko64(stream: *mut crate::FILE, offset: off64_t, whence: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed + #[allow(clashing_extern_declarations)] pub fn fsetpos64(stream: *mut crate::FILE, ptr: *const fpos64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn ftello64(stream: *mut crate::FILE) -> off64_t; pub fn bind(__fd: c_int, __addr: *const sockaddr, __len: crate::socklen_t) -> c_int; @@ -3759,6 +3784,7 @@ extern "C" { #[cfg_attr(gnu_file_offset_bits64, link_name = "sendfile64")] pub fn sendfile(out_fd: c_int, in_fd: c_int, offset: *mut off_t, count: size_t) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn sendfile64(out_fd: c_int, in_fd: c_int, offset: *mut off64_t, count: size_t) -> ssize_t; pub fn shutdown(__fd: c_int, __how: c_int) -> c_int; @@ -4099,8 +4125,10 @@ extern "C" { old_value: *mut crate::itimerspec, ) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstat64(__fd: c_int, __buf: *mut stat64) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstatat64( __fd: c_int, __file: *const c_char, @@ -4116,37 +4144,50 @@ extern "C" { statxbuf: *mut statx, ) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn ftruncate64(__fd: c_int, __length: off64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn truncate64(__file: *const c_char, __length: off64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn lstat64(__file: *const c_char, __buf: *mut stat64) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "statfs64")] pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn statfs64(__file: *const c_char, __buf: *mut statfs64) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "fstatfs64")] pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstatfs64(__fildes: c_int, __buf: *mut statfs64) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn statvfs64(__file: *const c_char, __buf: *mut statvfs64) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstatvfs64(__fildes: c_int, __buf: *mut statvfs64) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn open64(__file: *const c_char, __oflag: c_int, ...) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn openat64(__fd: c_int, __file: *const c_char, __oflag: c_int, ...) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut crate::FILE; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn freopen64( filename: *const c_char, mode: *const c_char, file: *mut crate::FILE, ) -> *mut crate::FILE; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn creat64(path: *const c_char, mode: mode_t) -> c_int; pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int; pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int; pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn tmpfile64() -> *mut crate::FILE; pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE; @@ -4301,9 +4342,12 @@ extern "C" { pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn stat64(__file: *const c_char, __buf: *mut stat64) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn readdir64(dirp: *mut crate::DIR) -> *mut dirent64; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn readdir64_r( dirp: *mut crate::DIR, entry: *mut dirent64, @@ -4319,6 +4363,7 @@ extern "C" { pub fn __errno_location() -> *mut c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn mmap64( __addr: *mut c_void, __len: size_t, @@ -4347,11 +4392,13 @@ extern "C" { pub fn fallocate64(fd: c_int, mode: c_int, offset: off64_t, len: off64_t) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")] pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fadvise64")] pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn posix_fadvise64(fd: c_int, offset: off64_t, len: off64_t, advise: c_int) -> c_int; pub fn madvise(__addr: *mut c_void, __len: size_t, __advice: c_int) -> c_int; @@ -4360,9 +4407,11 @@ extern "C" { #[cfg_attr(gnu_file_offset_bits64, link_name = "getrlimit64")] pub fn getrlimit(resource: __rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn getrlimit64(resource: __rlimit_resource_t, rlim: *mut rlimit64) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "setrlimit64")] pub fn setrlimit(resource: __rlimit_resource_t, rlim: *const crate::rlimit) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn setrlimit64(resource: __rlimit_resource_t, rlim: *const rlimit64) -> c_int; pub fn getpriority(which: crate::__priority_which, who: crate::id_t) -> c_int; From b35e034113fd9da4df1f77d2b0e4ab52a928b99e Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:39:43 +0200 Subject: [PATCH 21/93] linux(uclibc): remove explicit linking to libutil Removes linking directory to libutil in MIPS32. This did not seem necessary. Testing is pending. (backport ) (cherry picked from commit 8b7c4068fb4297f38cb59a700f16563785ae07f0) --- src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs index b6c8559e78b7..2ecf9c7c5c98 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs @@ -661,7 +661,6 @@ pub const SYS_process_mrelease: c_long = 4000 + 448; pub const SYS_futex_waitv: c_long = 4000 + 449; pub const SYS_set_mempolicy_home_node: c_long = 4000 + 450; -#[link(name = "util")] extern "C" { pub fn sysctl( name: *mut c_int, From 798237b8a76cfdc28fd35b23f64e7674bb3edf9a Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:35:15 +0200 Subject: [PATCH 22/93] linux(uclibc): remove conflicting records Remove records that are already declared in top-level modules. This affects x86_64 only. There is no such supported Rust target. This change should virtually affect nobody. (backport ) (cherry picked from commit 1d33a6e674fa591f28dce52db6a6901b48b67ceb) --- .../linux_like/linux/uclibc/x86_64/mod.rs | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index 46f3439ccb6e..cd9f45699d59 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -246,19 +246,6 @@ s! { pub _f: [c_char; 0], } - pub struct glob_t { - // FIXME(ulibc) - pub gl_pathc: size_t, - pub gl_pathv: *mut *mut c_char, - pub gl_offs: size_t, - pub gl_flags: c_int, - __unused1: Padding<*mut c_void>, - __unused2: Padding<*mut c_void>, - __unused3: Padding<*mut c_void>, - __unused4: Padding<*mut c_void>, - __unused5: Padding<*mut c_void>, - } - pub struct cpu_set_t { // FIXME(ulibc) #[cfg(target_pointer_width = "32")] @@ -288,16 +275,6 @@ s! { } } -s_no_extra_traits! { - pub struct dirent { - pub d_ino: crate::ino64_t, - pub d_off: off64_t, - pub d_reclen: u16, - pub d_type: u8, - pub d_name: [c_char; 256], - } -} - // constants pub const ENAMETOOLONG: c_int = 36; // File name too long pub const ENOTEMPTY: c_int = 39; // Directory not empty From c9efedee67f44aba05ac12813e35d3326b975994 Mon Sep 17 00:00:00 2001 From: LusterSourav <282348889+LusterSourav@users.noreply.github.com> Date: Sat, 1 Aug 2026 00:56:24 +0530 Subject: [PATCH 23/93] add __errno for newlib targets newlib errno is (*__errno()) so rust needs this to read errno. std already links it on newlib source https://www.sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/sys/errno.h;hb=b6624e23e17bdc505f639d9f181225dbf3a50fc6 (backport ) (cherry picked from commit 8428e69998032604fb47ef80077ff67e3cb3df79) --- src/unix/newlib/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index d5f8bc53d648..473bb543029f 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -842,6 +842,7 @@ f! { } extern "C" { + pub fn __errno() -> *mut c_int; pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int; pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int; From 0830bbb2bd031d9a0fc0600a65a14f02acdad32d Mon Sep 17 00:00:00 2001 From: LusterSourav <282348889+LusterSourav@users.noreply.github.com> Date: Sat, 1 Aug 2026 00:56:33 +0530 Subject: [PATCH 24/93] add __errno to espidf semver list (backport ) (cherry picked from commit 5c472fbc1b85ef9d8d8e16de03269a56e138b58e) --- libc-test/semver/espidf.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/libc-test/semver/espidf.txt b/libc-test/semver/espidf.txt index cdef4f09bc0e..f9f9089b9e37 100644 --- a/libc-test/semver/espidf.txt +++ b/libc-test/semver/espidf.txt @@ -32,6 +32,7 @@ SIGSEGV SIGTERM SOL_SOCKET SOMAXCONN +__errno cmsghdr dirent eventfd From 88dac1f86e84852c30bd6974607707679132e652 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 28 Jul 2026 06:41:27 +0900 Subject: [PATCH 25/93] fix(vxworks): sync semver test with some symbol removal (backport ) (cherry picked from commit 315d29088606b35477fa119121e0f8ed47bb3fc6) --- libc-test/semver/vxworks.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/libc-test/semver/vxworks.txt b/libc-test/semver/vxworks.txt index 35d795a706e8..ea796fef7b80 100644 --- a/libc-test/semver/vxworks.txt +++ b/libc-test/semver/vxworks.txt @@ -623,7 +623,6 @@ pipe poll pollfd posix_memalign -pread printf protoent pthread_attr_destroy @@ -680,7 +679,6 @@ putchar putchar_unlocked putenv puts -pwrite raise read readdir From 3fa3c27a4b751fb8b2525a54f382d52e2e85e08a Mon Sep 17 00:00:00 2001 From: samuraiXwandering <301416091+samuraixwandering@users.noreply.github.com> Date: Sun, 2 Aug 2026 10:04:27 +0600 Subject: [PATCH 26/93] docs: wrap bare URLs in doc comments so `cargo doc` builds off Linux `RUSTDOCFLAGS: -Dwarnings` is set for the whole CI workflow, but the `docs` job runs on `ubuntu-26.04`, so it only ever documents the Linux modules. Fifteen doc comments under `src/new` carry bare URLs, which rustdoc reports as `this URL is not a hyperlink`, and all of them are in Apple or BSD trees that the Linux job never compiles. The result is that `cargo doc --workspace --no-deps` fails on those hosts while CI stays green. Wrapping each URL in angle brackets is the form already used elsewhere in the same directories, for example `src/new/apple/xnu/net/mod.rs`. Also drops a stray trailing apostrophe from the URL in `src/new/freebsd/sys/mod.rs`. Verified with `RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --target ...`, which fails on `main` and passes here: aarch64-apple-darwin 3 errors -> ok x86_64-apple-darwin 3 errors -> ok x86_64-unknown-freebsd 9 errors -> ok x86_64-unknown-netbsd 1 error -> ok The remaining two lines are an OpenBSD module and an `i386` one; neither target has a std available locally, so they are unverified, but the edit is identical in form. No API change, so there is nothing to add to `libc-test/semver`. (backport ) (cherry picked from commit 9658498e6757664f9bb70c2f3ab41deaac5f9247) --- src/new/apple/xnu/mod.rs | 6 +++--- src/new/apple/xnu/sys/mod.rs | 2 +- src/new/freebsd/net/dlt.rs | 2 +- src/new/freebsd/net/if_mib.rs | 2 +- src/new/freebsd/net/mod.rs | 2 +- src/new/freebsd/netinet6/in6_var.rs | 2 +- src/new/freebsd/netinet6/mod.rs | 2 +- src/new/freebsd/sys/file.rs | 2 +- src/new/freebsd/sys/ioccom.rs | 2 +- src/new/freebsd/sys/mod.rs | 2 +- src/new/freebsd/sys/socket.rs | 2 +- src/new/netbsd/sys/mod.rs | 2 +- src/new/openbsd/sys/mod.rs | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/new/apple/xnu/mod.rs b/src/new/apple/xnu/mod.rs index a81d38db55d5..a0217e2ffa97 100644 --- a/src/new/apple/xnu/mod.rs +++ b/src/new/apple/xnu/mod.rs @@ -4,7 +4,7 @@ /// Directory: `arm/` /// -/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/arm +/// #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] pub(crate) mod arm { pub(crate) mod _mcontext; @@ -12,7 +12,7 @@ pub(crate) mod arm { /// Directory: `i386/` /// -/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/i386 +/// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub(crate) mod i386 { pub(crate) mod _mcontext; @@ -22,7 +22,7 @@ pub(crate) mod mach; /// Directory: `machine/` /// -/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/machine +/// pub(crate) mod machine { pub(crate) mod _mcontext; } diff --git a/src/new/apple/xnu/sys/mod.rs b/src/new/apple/xnu/sys/mod.rs index 8c7108c63aa7..b670ae5bc0b0 100644 --- a/src/new/apple/xnu/sys/mod.rs +++ b/src/new/apple/xnu/sys/mod.rs @@ -9,7 +9,7 @@ pub(crate) mod ttycom; /// Directory: `sys/_types` /// -/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/sys/_types +/// pub(crate) mod _types { pub(crate) mod _ucontext; } diff --git a/src/new/freebsd/net/dlt.rs b/src/new/freebsd/net/dlt.rs index e3dddce93040..25dee59d517c 100644 --- a/src/new/freebsd/net/dlt.rs +++ b/src/new/freebsd/net/dlt.rs @@ -1,6 +1,6 @@ //! Header: `net/dlt.h` //! -//! https://github.com/freebsd/freebsd-src/blob/main/sys/net/dlt.h +//! use crate::prelude::*; diff --git a/src/new/freebsd/net/if_mib.rs b/src/new/freebsd/net/if_mib.rs index 67e989085b2c..319510d6211c 100644 --- a/src/new/freebsd/net/if_mib.rs +++ b/src/new/freebsd/net/if_mib.rs @@ -1,6 +1,6 @@ //! Header: `net/if_mib.h` //! -//! https://github.com/freebsd/freebsd-src/blob/86691d52a6d3796ad36ba474cf0a9493f6d99202/sys/net/if_mib.h +//! use crate::prelude::*; diff --git a/src/new/freebsd/net/mod.rs b/src/new/freebsd/net/mod.rs index c8d8c3690111..44be99742696 100644 --- a/src/new/freebsd/net/mod.rs +++ b/src/new/freebsd/net/mod.rs @@ -1,6 +1,6 @@ //! Directory: `net/` //! -//! https://github.com/freebsd/freebsd-src/tree/main/sys/net +//! pub(crate) mod dlt; pub(crate) mod if_mib; diff --git a/src/new/freebsd/netinet6/in6_var.rs b/src/new/freebsd/netinet6/in6_var.rs index f9e45306bffb..710c85102848 100644 --- a/src/new/freebsd/netinet6/in6_var.rs +++ b/src/new/freebsd/netinet6/in6_var.rs @@ -1,6 +1,6 @@ //! Header: `netinet6/in6_var.h` //! -//! https://github.com/freebsd/freebsd-src/blob/main/sys/netinet6/in6_var.h +//! use crate::prelude::*; use crate::sys::ioccom::*; diff --git a/src/new/freebsd/netinet6/mod.rs b/src/new/freebsd/netinet6/mod.rs index 848e809aaa8c..8aa8f09b5c39 100644 --- a/src/new/freebsd/netinet6/mod.rs +++ b/src/new/freebsd/netinet6/mod.rs @@ -1,5 +1,5 @@ //! Directory: `netinet6/` //! -//! https://github.com/freebsd/freebsd-src/tree/main/sys/netinet6 +//! pub(crate) mod in6_var; diff --git a/src/new/freebsd/sys/file.rs b/src/new/freebsd/sys/file.rs index 3072c1de7d76..b2d752e6ef2a 100644 --- a/src/new/freebsd/sys/file.rs +++ b/src/new/freebsd/sys/file.rs @@ -1,6 +1,6 @@ //! Header: `sys/file.h` //! -//! https://github.com/freebsd/freebsd-src/blob/main/sys/sys/file.h +//! use crate::prelude::*; diff --git a/src/new/freebsd/sys/ioccom.rs b/src/new/freebsd/sys/ioccom.rs index 64261b90671b..758d9de1245a 100644 --- a/src/new/freebsd/sys/ioccom.rs +++ b/src/new/freebsd/sys/ioccom.rs @@ -1,6 +1,6 @@ //! Header: `sys/ioccom.h` //! -//! https://github.com/freebsd/freebsd-src/blob/main/sys/sys/ioccom.h +//! use crate::prelude::*; diff --git a/src/new/freebsd/sys/mod.rs b/src/new/freebsd/sys/mod.rs index 4afb1d48b864..0aea439f24f8 100644 --- a/src/new/freebsd/sys/mod.rs +++ b/src/new/freebsd/sys/mod.rs @@ -1,6 +1,6 @@ //! Directory: `sys/` //! -//! https://github.com/freebsd/freebsd-src/tree/main/sys/sys' +//! pub(crate) mod file; pub(crate) mod ioccom; diff --git a/src/new/freebsd/sys/socket.rs b/src/new/freebsd/sys/socket.rs index ba528729d958..8b3394f37c5d 100644 --- a/src/new/freebsd/sys/socket.rs +++ b/src/new/freebsd/sys/socket.rs @@ -1,6 +1,6 @@ //! Header: `sys/socket.h` //! -//! https://github.com/freebsd/freebsd-src/blob/main/sys/sys/socket.h +//! use crate::prelude::*; diff --git a/src/new/netbsd/sys/mod.rs b/src/new/netbsd/sys/mod.rs index b7255d87b309..11be69d6ad2e 100644 --- a/src/new/netbsd/sys/mod.rs +++ b/src/new/netbsd/sys/mod.rs @@ -1,6 +1,6 @@ //! Directory: `sys/` //! -//! https://github.com/NetBSD/src/tree/trunk/sys/sys +//! pub(crate) mod file; pub(crate) mod ipc; diff --git a/src/new/openbsd/sys/mod.rs b/src/new/openbsd/sys/mod.rs index 7ba77c537356..d72038e43878 100644 --- a/src/new/openbsd/sys/mod.rs +++ b/src/new/openbsd/sys/mod.rs @@ -1,5 +1,5 @@ //! Directory: `sys/` //! -//! https://github.com/openbsd/src/tree/trunk/sys/sys +//! pub(crate) mod ipc; From 5b97602734ab33d33bb7ae70fa7eabfa094d8e87 Mon Sep 17 00:00:00 2001 From: Senthilnathan Date: Thu, 30 Jul 2026 16:40:47 +0530 Subject: [PATCH 27/93] style: run rustfmt with nightly toolchain in ci/style.py (backport ) (cherry picked from commit 866b6429dc4c0039769bdda6b500d10ac4547d11) --- ci/style.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/style.py b/ci/style.py index e6c45ddfe80b..ca3afa2bdf2f 100755 --- a/ci/style.py +++ b/ci/style.py @@ -19,7 +19,7 @@ def main(): # if `CI` is set, do a check rather than overwriting check_only = os.getenv("CI") is not None - run(["rustfmt", "-V"]) + run(["rustfmt", "+nightly", "-V"]) fmt_files = [] for dir in FMT_DIRS: @@ -33,9 +33,9 @@ def main(): # Run once from workspace root to get everything that wasn't handled as an # individual file. if check_only: - run(["cargo", "fmt", "--check"]) + run(["cargo", "+nightly", "fmt", "--check"]) else: - run(["cargo", "fmt"]) + run(["cargo", "+nightly", "fmt"]) for file in iglob("libc-test/semver/*.txt"): check_semver_file(Path(file)) @@ -112,7 +112,7 @@ def enum_sub(m: re.Match) -> str: # Invoke rustfmt passing via stdin/stdout so we don't need to write the file. Exits # on failure. - cmd = ["rustfmt", "--config-path=.rustfmt.toml"] + cmd = ["rustfmt", "+nightly", "--config-path=.rustfmt.toml"] if check_only: res = check_output(cmd + ["--check"], input=text) From fd5ff8a30caa5814405b17585eee24d893eb416f Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 27 Jul 2026 23:35:00 +0100 Subject: [PATCH 28/93] clippy: fix explicit_iter_loop lint https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop (backport ) (cherry picked from commit 79d54f3515d8f4a39e39f4d26e6919c310001c1a) --- src/teeos/mod.rs | 3 +-- src/unix/bsd/freebsdlike/freebsd/mod.rs | 3 +-- src/unix/cygwin/mod.rs | 2 +- src/unix/hurd/mod.rs | 2 +- src/unix/linux_like/android/mod.rs | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index daf4cf31fd1e..7605764ab08e 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -1337,8 +1337,7 @@ pub fn errno() -> c_int { pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; let size_of_mask = size_of_val(&cpuset.bits[0]); - - for i in cpuset.bits[..(size / size_of_mask)].iter() { + for i in &cpuset.bits[..(size / size_of_mask)] { s += i.count_ones(); } s as c_int diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 9b0fc45f07d9..5120338b33b4 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -4493,8 +4493,7 @@ f! { let mut s: u32 = 0; let cpuset_size = size_of::(); let bitset_size = size_of::(); - - for i in cpuset.__bits[..(cpuset_size / bitset_size)].iter() { + for i in &cpuset.__bits[..(cpuset_size / bitset_size)] { s += i.count_ones(); } s as c_int diff --git a/src/unix/cygwin/mod.rs b/src/unix/cygwin/mod.rs index bfe1d8ff4052..a95d2d1c0c17 100644 --- a/src/unix/cygwin/mod.rs +++ b/src/unix/cygwin/mod.rs @@ -1710,7 +1710,7 @@ f! { pub unsafe fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; let size_of_mask = size_of_val(&cpuset.bits[0]); - for i in cpuset.bits[..(size / size_of_mask)].iter() { + for i in &cpuset.bits[..(size / size_of_mask)] { s += i.count_ones(); } s as c_int diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index ad8d5a3c1b6d..11a41898ffd4 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -3544,7 +3544,7 @@ f! { pub unsafe fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; let size_of_mask = size_of_val(&cpuset.__bits[0]); - for i in cpuset.__bits[..(size / size_of_mask)].iter() { + for i in &cpuset.__bits[..(size / size_of_mask)] { s += i.count_ones(); } s as c_int diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index c0c10a0819f9..eda5e3d59e68 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -3506,7 +3506,7 @@ f! { pub unsafe fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; let size_of_mask = size_of_val(&cpuset.__bits[0]); - for i in cpuset.__bits[..(size / size_of_mask)].iter() { + for i in &cpuset.__bits[..(size / size_of_mask)] { s += i.count_ones(); } s as c_int From e56e4b90787e4838fd6e93723bb8544400fc02d4 Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Sat, 11 Jul 2026 12:13:49 +0300 Subject: [PATCH 29/93] libc-test: Detect the targeted Android API level from the toolchain Add "android" to the Versions platform-version detection. Knowing it allows version-gating the Android test skips instead of hardcoding them. The level can appear in two macros: 1. Old clang defines __ANDROID_API__ directly as an integer. 2. Modern clang defines it as an alias of __ANDROID_MIN_SDK_VERSION__. A toolchain whose target triple carries no API level defines neither number, so nothing is parsed and the level stays undetected. An undetected level (android == None) causes its consumers to treat it conservatively: every API-gated skip stays active, as if the toolchain targeted the oldest level possible. Nothing consumes the value yet, so it has no effect on what is tested. Next commits will add users for it. Suggested-by: Trevor Gross Assisted-By: Claude Fable 5 Signed-off-by: Adrian Ratiu (backport ) (cherry picked from commit 61a5c688f302a82012d95e24c606ab0821e67899) --- libc-test/build.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) mode change 100644 => 100755 libc-test/build.rs diff --git a/libc-test/build.rs b/libc-test/build.rs old mode 100644 new mode 100755 index 8f28aa3750cb..5fb99044d170 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -6576,6 +6576,8 @@ struct Versions { macos: Option<(u32, u32)>, emscripten: Option<(u32, u32)>, wasi_sdk: Option<(u32, WasiVersion)>, + /// Android API level (no minor version). + android: Option, } #[derive(Clone, Copy, Debug, Default)] @@ -6604,6 +6606,13 @@ impl Versions { #include "gnu/libc-version.h" #endif + #ifdef __ANDROID__ + /* The clang driver predefines __ANDROID_MIN_SDK_VERSION__ from the API level + * in the target triple; including api-level.h ensures it is defined even on + * toolchains that leave it to the header. */ + #include "android/api-level.h" + #endif + #if defined(__FreeBSD__) \ || defined(__NetBSD__) \ || defined(__OpenBSD__) \ @@ -6673,6 +6682,11 @@ impl Versions { } "__GLIBC__" => ret.glibc.get_or_insert_default().0 = value.parse().unwrap(), "__GLIBC_MINOR__" => ret.glibc.get_or_insert_default().1 = value.parse().unwrap(), + // Clang 12+ predefines the target API level here as a plain integer. + // Every NDK wrapper we build with carries an API level, so parse it like + // the other version macros above and let a missing value fail loudly at + // the unwrap in `test_android` rather than silently skipping tests. + "__ANDROID_MIN_SDK_VERSION__" => ret.android = Some(value.parse().unwrap()), "__MAC_OS_X_VERSION_MAX_ALLOWED" => { let caps = mac_re.captures(value).unwrap(); let major: u32 = caps[1].parse().unwrap(); From 54af614779732427e50ae340f0b728c495062116 Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Sat, 11 Jul 2026 11:07:27 +0300 Subject: [PATCH 30/93] libc-test: Version-gate the Android API level skips Convert the existing hardcoded "added in API level N" test skips into gates on the detected API level added in the previous commit. Items stay skipped when the toolchain builds below their introduction level (or when no level was detected) and get tested once the toolchain provably targets a high enough level. There are no test coverage changes. Assisted-By: Claude Fable 5 Signed-off-by: Adrian Ratiu (backport ) (cherry picked from commit 1e77ff6a3975472e329eebef74fdf5ad1514079a) --- libc-test/build.rs | 51 +++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 5fb99044d170..32bfe1cd80d0 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2154,6 +2154,10 @@ fn test_android(target: &str) { }; let x86 = target.contains("i686") || target.contains("x86_64"); let aarch64 = target.contains("aarch64"); + // The API level the NDK toolchain targets, which caps the available libc + // API surface (see `Versions`). Detection is required, so unwrap and let a + // toolchain we can't read fail loudly rather than silently skip every test. + let android = VERSIONS.android.unwrap(); let mut cfg = ctest_cfg(); cfg.define("_GNU_SOURCE", None); @@ -2349,8 +2353,7 @@ fn test_android(target: &str) { "posix_spawn_file_actions_t" => true, "posix_spawnattr_t" => true, - // Added in API level 24 - "if_nameindex" => true, + "if_nameindex" if android < 24 => true, _ => false, } @@ -2551,8 +2554,11 @@ fn test_android(target: &str) { "reallocarray" => true, "__system_property_wait" => true, - // Added in API level 30, but tests use level 28. - "memfd_create" | "mlock2" | "renameat2" | "statx" | "statx_timestamp" => true, + "memfd_create" | "mlock2" | "renameat2" | "statx" | "statx_timestamp" + if android < 30 => + { + true + } // Added in API level 33, but tests use level 28. "preadv2" | "pwritev2" => true, @@ -2560,34 +2566,23 @@ fn test_android(target: &str) { // Added in glibc 2.25. "getentropy" => true, - // Added in API level 28, but some tests use level 24. - "getrandom" => true, - - // Added in API level 28, but some tests use level 24. - "syncfs" => true, - - // Added in API level 28, but some tests use level 24. - "pthread_attr_getinheritsched" | "pthread_attr_setinheritsched" => true, - // Added in API level 28, but some tests use level 24. - "fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" => true, - - // Added in API level 28, but some tests use level 24. - "aligned_alloc" => true, + "getrandom" | "syncfs" | "aligned_alloc" if android < 28 => true, - // Added in API level 26, but some tests use level 24. - "getgrent" => true, + "pthread_attr_getinheritsched" | "pthread_attr_setinheritsched" if android < 28 => true, - // Added in API level 26, but some tests use level 24. - "setgrent" => true, - - // Added in API level 26, but some tests use level 24. - "endgrent" => true, + "fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" + if android < 28 => + { + true + } - // Added in API level 26, but some tests use level 24. - "getpwent" | "setpwent" | "endpwent" => true, + "getgrent" | "setgrent" | "endgrent" | "getpwent" | "setpwent" | "endpwent" + if android < 26 => + { + true + } - // Added in API level 26, but some tests use level 24. - "getdomainname" | "setdomainname" => true, + "getdomainname" | "setdomainname" if android < 26 => true, // FIXME(android): bad function pointers: "isalnum" | "isalpha" | "iscntrl" | "isdigit" | "isgraph" | "islower" | "isprint" From 2c127a43eac3ca90b5ed2e8ca755f3edbe60be66 Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Sat, 11 Jul 2026 11:07:56 +0300 Subject: [PATCH 31/93] libc-test: Skip termios function pointer checks below Android API 28 Bionic implements the termios API as static inline functions in until API 28 turns them into real libc.so symbols, so below that level the C-side function address is the header's inline, never matching the symbol Rust links against. Skip the function pointer identity check (the only check ctest generates for a foreign function) for the termios family below API 28. This surfaced when pinning the C test compilation to a real API level (see next commit). At level 24, e.g. on arm, all thirteen termios pointer comparisons fail. It is ordered before the pin commit to keep commits bisectable. Assisted-By: Claude Fable 5 Signed-off-by: Adrian Ratiu (backport ) (cherry picked from commit 59d5a18c5006b05935b869c2cdb6cd29d47cac6a) --- libc-test/build.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 32bfe1cd80d0..8f28c1a5b99e 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2600,6 +2600,21 @@ fn test_android(target: &str) { } }); + cfg.skip_fn_ptrcheck(move |func| { + match func { + // termios functions are inlines below API 28, so + // their C-side address never matches the symbol Rust links. + "tcdrain" | "tcflow" | "tcflush" | "tcgetattr" | "tcgetsid" | "tcsendbreak" + | "tcsetattr" | "cfgetispeed" | "cfgetospeed" | "cfmakeraw" | "cfsetispeed" + | "cfsetospeed" | "cfsetspeed" + if android < 28 => + { + true + } + _ => false, + } + }); + cfg.skip_struct_field_type(move |struct_, field| { match (struct_.ident(), field.ident()) { // This is a weird union, don't check the type. From fdb0561fb8a01bddb69a1a215dba0cc69b1da51d Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Mon, 13 Jul 2026 16:45:47 +0300 Subject: [PATCH 32/93] ci: Point each Android toolchain at the API level we target Each CC wrapper's name (e.g. x86_64-linux-android28-clang) tells clang which API to target: clang infers "-target" from the invoked binary name whenever none is given explicitly. Ours said 28 everywhere, which only reflects the NDK's link-time stub level, not the level of the bionic that actually runs the tests. Every job now targets API 24 (the level the arm and aarch64 emulators run and the level the retired x86_64 sysimage ran), so the dynamic skips resolve exactly as the old hardcoded ones did and coverage is unchanged. Each Dockerfile declares that level once, in an ANDROID_API build arg. For the arm and aarch64 emulator jobs the arg also selects the system image android-install-sdk.sh installs, so the wrapper cannot drift from the image the tests run on. This mismatch was invisible before because the tests were hardcoded to skip higher API levels regardless of the toolchain: it surfaced after extracting the real API level from the toolchain and wiring in the dynamic skip mechanism (previous commits) instead of hardcoding. Assisted-By: Claude Fable 5 Signed-off-by: Adrian Ratiu (backport ) (cherry picked from commit 63472c900b27d8399aa21d99eb041a9fc5d910d6) --- ci/android-install-sdk.sh | 20 +++++++++++++------- ci/docker/aarch64-linux-android/Dockerfile | 10 +++++++--- ci/docker/arm-linux-androideabi/Dockerfile | 10 +++++++--- ci/docker/x86_64-linux-android/Dockerfile | 10 +++++++--- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/ci/android-install-sdk.sh b/ci/android-install-sdk.sh index 43e1153dcd33..fa1e021ede5b 100755 --- a/ci/android-install-sdk.sh +++ b/ci/android-install-sdk.sh @@ -14,25 +14,31 @@ mkdir -p sdk/cmdline-tools wget -q --tries=20 "https://dl.google.com/android/repository/commandlinetools-linux-${sdk}_latest.zip" unzip -q -d sdk/cmdline-tools "commandlinetools-linux-${sdk}_latest.zip" -case "$1" in +# The API level is passed in (arg 2) so it stays a single source of truth +# shared with the CC wrapper name in the Dockerfile; only the image variant +# is arch-specific here. +arch="$1" +api="$2" +if [ -z "${api}" ]; then + echo "usage: $0 " + exit 1 +fi + +case "${arch}" in arm | armv7) - api=24 image="system-images;android-${api};default;armeabi-v7a" ;; aarch64) - api=24 image="system-images;android-${api};google_apis;arm64-v8a" ;; i686) - api=28 image="system-images;android-${api};default;x86" ;; x86_64) - api=28 image="system-images;android-${api};default;x86_64" ;; *) - echo "invalid arch: $1" + echo "invalid arch: ${arch}" exit 1 ;; esac @@ -66,7 +72,7 @@ cp /android/android-emulator-package.xml /android/sdk/emulator/package.xml echo "no" | ./sdk/cmdline-tools/tools/bin/avdmanager create avd \ - --name "${1}" \ + --name "${arch}" \ --package "${image}" | grep -v = || true rm -rf "commandlinetools-linux-${sdk}_latest.zip" emulator-linux_x64-9058569.zip diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile index 91c074150f94..5d0ee0f9c1e4 100644 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -18,18 +18,22 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=aarch64 +# Single source of truth for the API level: it selects the emulator system +# image (passed to android-install-sdk.sh) and names the CC wrapper below, so +# the toolchain can never drift from the image the tests run on. +ARG ANDROID_API=24 ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools RUN /android/android-install-ndk.sh -RUN /android/android-install-sdk.sh $ANDROID_ARCH +RUN /android/android-install-sdk.sh $ANDROID_ARCH $ANDROID_API RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android28-clang \ + CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android${ANDROID_API}-clang \ CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ - CC_aarch64_linux_android=aarch64-linux-android28-clang \ + CC_aarch64_linux_android=aarch64-linux-android${ANDROID_API}-clang \ AR_aarch64_linux_android=llvm-ar \ HOME=/tmp diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile index 657ff81097c7..3317d53cbfca 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -18,18 +18,22 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=arm +# Single source of truth for the API level: it selects the emulator system +# image (passed to android-install-sdk.sh) and names the CC wrapper below, so +# the toolchain can never drift from the image the tests run on. +ARG ANDROID_API=24 ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools RUN /android/android-install-ndk.sh -RUN /android/android-install-sdk.sh $ANDROID_ARCH +RUN /android/android-install-sdk.sh $ANDROID_ARCH $ANDROID_API RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi28-clang \ + CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi${ANDROID_API}-clang \ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \ - CC_arm_linux_androideabi=armv7a-linux-androideabi28-clang \ + CC_arm_linux_androideabi=armv7a-linux-androideabi${ANDROID_API}-clang \ AR_arm_linux_androideabi=llvm-ar \ HOME=/tmp diff --git a/ci/docker/x86_64-linux-android/Dockerfile b/ci/docker/x86_64-linux-android/Dockerfile index 62eee968057b..4b72b8c382fe 100644 --- a/ci/docker/x86_64-linux-android/Dockerfile +++ b/ci/docker/x86_64-linux-android/Dockerfile @@ -21,15 +21,19 @@ RUN curl -fsSL https://us-apt.pkg.dev/doc/repo-signing-key.gpg \ WORKDIR /android/ ENV ANDROID_ARCH=x86_64 +# The API level we compile against: this only names the CC wrapper and the toolchain we use. +# The Android Cuttlefish device is pinned separately and is newer, i.e. capable of testing +# newer APIs. The toolchain wrapper is held at the same baseline as arm/aarch64 for now. +ARG ANDROID_API=24 COPY android-install-ndk.sh /android/ RUN /android/android-install-ndk.sh ENV PATH=$PATH:/rust/bin:/android/linux-x86_64/bin \ ANDROID_SERIAL=127.0.0.1:6520 \ - CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android28-clang \ + CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android${ANDROID_API}-clang \ CARGO_TARGET_X86_64_LINUX_ANDROID_RUNNER=/tmp/runtest \ - CC_x86_64_linux_android=x86_64-linux-android28-clang \ - CXX_x86_64_linux_android=x86_64-linux-android28-clang++ \ + CC_x86_64_linux_android=x86_64-linux-android${ANDROID_API}-clang \ + CXX_x86_64_linux_android=x86_64-linux-android${ANDROID_API}-clang++ \ AR_x86_64_linux_android=llvm-ar \ HOME=/tmp From fce5c6ac0267253328e3290558ae1149bfbfe7be Mon Sep 17 00:00:00 2001 From: Sergii Bogomolov Date: Thu, 23 Jul 2026 20:57:51 +0200 Subject: [PATCH 33/93] bsd: add `BPF_WORDALIGN` (backport ) (cherry picked from commit 257f77c6f0df0bb8dbc55f7ceff87b8cd79d22ae) --- libc-test/semver/apple.txt | 1 + libc-test/semver/dragonfly.txt | 1 + libc-test/semver/freebsd.txt | 1 + src/new/apple/xnu/net/bpf.rs | 4 ++++ src/unix/bsd/freebsdlike/mod.rs | 4 ++++ 5 files changed, 11 insertions(+) diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 1a714992cdad..b0aaabcfbf3e 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -186,6 +186,7 @@ BIOCSSEESENT BIOCVERSION BOOT_TIME BPF_ALIGNMENT +BPF_WORDALIGN BS0 BS1 BSDLY diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index 4636e3761465..8cabbf2b6349 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -115,6 +115,7 @@ BIOCSSEESENT BIOCVERSION BOOT_TIME BPF_ALIGNMENT +BPF_WORDALIGN BTUARTDISC BUFSIZ BUS_ADRALN diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index a7218afae819..582e89bb636b 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -142,6 +142,7 @@ BIOCSSEESENT BIOCVERSION BOOT_TIME BPF_ALIGNMENT +BPF_WORDALIGN BUFSIZ BUS_ADRALN BUS_ADRERR diff --git a/src/new/apple/xnu/net/bpf.rs b/src/new/apple/xnu/net/bpf.rs index dc0aae84de28..93667d578ac6 100644 --- a/src/new/apple/xnu/net/bpf.rs +++ b/src/new/apple/xnu/net/bpf.rs @@ -49,6 +49,10 @@ pub const DLT_LOOP: c_uint = 108; pub const BPF_ALIGNMENT: c_int = size_of::() as c_int; +pub const fn BPF_WORDALIGN(x: usize) -> usize { + (x + (BPF_ALIGNMENT as usize - 1)) & !(BPF_ALIGNMENT as usize - 1) +} + pub const BIOCGRSIG: c_ulong = _IOR::('B' as c_ulong, 114); pub const BIOCSRSIG: c_ulong = _IOW::('B' as c_ulong, 115); pub const BIOCGSEESENT: c_ulong = _IOR::('B' as c_ulong, 118); diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 5c9bccf38c60..7a7d193f92eb 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1323,6 +1323,10 @@ pub const EUI64_LEN: usize = 8; // https://github.com/freebsd/freebsd/blob/HEAD/sys/net/bpf.h pub const BPF_ALIGNMENT: usize = SIZEOF_LONG; +pub const fn BPF_WORDALIGN(x: usize) -> usize { + (x + (BPF_ALIGNMENT - 1)) & !(BPF_ALIGNMENT - 1) +} + // Values for rtprio struct (prio field) and syscall (function argument) pub const RTP_PRIO_MIN: c_ushort = 0; pub const RTP_PRIO_MAX: c_ushort = 31; From 01f2e8c57773f0d8cc59d26279d5c3c1237834b7 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 2 Aug 2026 18:04:59 -0500 Subject: [PATCH 34/93] macros: Test for safety/unsafety of `f` and `safe_f` (backport ) (cherry picked from commit c5fdb11353f8ce0bf3a403cc641786793625cd89) --- src/macros.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/macros.rs b/src/macros.rs index 0271d326aa1b..b5af6b17c155 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -631,6 +631,31 @@ mod tests { assert_eq!(PRIV_ON_1, 42u16); } + #[test] + #[deny(unused_unsafe)] + fn f_safety() { + // Enusure the created functions are safe / unsafe / const as expected + f! { + pub unsafe fn unsafe_foo() -> u32 { 100 } + pub const unsafe fn const_unsafe_foo() -> u32 { 101 } + } + safe_f! { + pub safe fn safe_foo() -> u32 { 200 } + pub const safe fn const_safe_foo() -> u32 { 201 } + } + + assert_eq!(unsafe { unsafe_foo() }, 100u32); + assert_eq!(const { unsafe { const_unsafe_foo() } }, 101u32); + assert_eq!(safe_foo(), 200u32); + assert_eq!(const { const_safe_foo() }, 201u32); + + // Check the ABI + let _: unsafe extern "C" fn() -> u32 = unsafe_foo; + let _: unsafe extern "C" fn() -> u32 = const_unsafe_foo; + let _: extern "C" fn() -> u32 = safe_foo; + let _: extern "C" fn() -> u32 = const_safe_foo; + } + fn type_id_of_val(_: &T) -> TypeId { TypeId::of::() } From 3b76b7d7d02ff8f59fc0caa5be8b4b3c27c1baa6 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 2 Aug 2026 18:04:59 -0500 Subject: [PATCH 35/93] macros: Merge `f!` and `safe_f!` Now that we have separate `safe` and `unsafe` syntax, there isn't much reason to keep the macros split. Moving some functions around was necessary for the style checker. (backport ) (cherry picked from commit 4ef1831337bab5d3663fdb328b03c6b247e897ec) --- src/fuchsia/mod.rs | 2 - src/macros.rs | 43 +++-- src/new/linux_uapi/linux/sctp.rs | 2 - src/unix/aix/mod.rs | 2 - src/unix/bsd/apple/mod.rs | 2 - src/unix/bsd/freebsdlike/dragonfly/mod.rs | 2 - .../bsd/freebsdlike/freebsd/freebsd11/mod.rs | 2 +- .../bsd/freebsdlike/freebsd/freebsd12/mod.rs | 2 +- .../bsd/freebsdlike/freebsd/freebsd13/mod.rs | 2 +- .../bsd/freebsdlike/freebsd/freebsd14/mod.rs | 2 +- .../bsd/freebsdlike/freebsd/freebsd15/mod.rs | 2 +- src/unix/bsd/freebsdlike/freebsd/mod.rs | 2 - src/unix/bsd/freebsdlike/mod.rs | 2 +- src/unix/bsd/mod.rs | 2 - src/unix/bsd/netbsdlike/netbsd/mod.rs | 2 - src/unix/bsd/netbsdlike/openbsd/mod.rs | 2 - src/unix/cygwin/mod.rs | 2 - src/unix/haiku/mod.rs | 2 - src/unix/hurd/mod.rs | 172 +++++++++--------- src/unix/linux_like/android/mod.rs | 2 - src/unix/linux_like/emscripten/mod.rs | 2 - src/unix/linux_like/linux_l4re_shared.rs | 2 - src/unix/linux_like/mod.rs | 2 - src/unix/mod.rs | 34 ++-- src/unix/newlib/horizon/mod.rs | 2 +- src/unix/newlib/rtems/mod.rs | 2 +- src/unix/nto/mod.rs | 2 - src/unix/redox/mod.rs | 2 - src/unix/solarish/mod.rs | 2 - src/vxworks/mod.rs | 51 +++--- 30 files changed, 166 insertions(+), 186 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 58f638f5ec16..8dfb1e7e1c9c 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3053,9 +3053,7 @@ f! { pub const unsafe fn CMSG_LEN(len: c_uint) -> c_uint { (CMSG_ALIGN(size_of::()) + len as size_t) as c_uint } -} -safe_f! { pub const safe fn WIFSTOPPED(status: c_int) -> bool { (status & 0xff) == 0x7f } diff --git a/src/macros.rs b/src/macros.rs index b5af6b17c155..cc595969218f 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -402,36 +402,59 @@ macro_rules! c_enum { (@ty) => { $crate::prelude::CEnumRepr }; } -/// Define a `unsafe` function. +/// Define a function that can be either `safe` or `unsafe` and optionally `const`. This always +/// marks the function inline and adds `extern "C"`. macro_rules! f { ($( $(#[$attr:meta])* - pub $(const $($const_dummy:literal)?)? unsafe + pub $(const $($const_dummy:literal)?)? + $(unsafe $($unsafe_dummy:literal)?)? $(safe $($safe_dummy:literal)?)? fn $i:ident ($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty $body:block )+) => {$( + f! { + @single + $(#[$attr])* + pub $(const $($const_dummy)?)? + $(unsafe $($unsafe_dummy)?)? $(safe $($safe_dummy)?)? + fn $i ($($arg: $argty),*) -> $ret + $body + } + )+}; + + (@single + $(#[$attr:meta])* + pub $(const $($const_dummy:literal)?)? unsafe + fn $i:ident ($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty + $body:block + ) => { #[inline] $(#[$attr])* pub $(const $($const_dummy)?)? unsafe extern "C" fn $i ($($arg: $argty),*) -> $ret $body - )+}; -} + }; -/// Define a safe function. -macro_rules! safe_f { - ($( + (@single $(#[$attr:meta])* pub $(const $($const_dummy:literal)?)? safe fn $i:ident ($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty $body:block - )+) => {$( + ) => { #[inline] $(#[$attr])* pub $(const $($const_dummy)?)? extern "C" fn $i ($($arg: $argty),*) -> $ret $body - )+}; + }; + + (@single + pub $(const $($const_dummy:literal)?)? + fn $i:ident ($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty + $body:block + ) => { + compile_error!("either `safe` or `unsafe` must be specified"); + }; } // This macro is used to deprecate items that should be accessed via the mach2 crate @@ -638,8 +661,6 @@ mod tests { f! { pub unsafe fn unsafe_foo() -> u32 { 100 } pub const unsafe fn const_unsafe_foo() -> u32 { 101 } - } - safe_f! { pub safe fn safe_foo() -> u32 { 200 } pub const safe fn const_safe_foo() -> u32 { 201 } } diff --git a/src/new/linux_uapi/linux/sctp.rs b/src/new/linux_uapi/linux/sctp.rs index 3a9ad6d19b5b..5fe843c25d7b 100644 --- a/src/new/linux_uapi/linux/sctp.rs +++ b/src/new/linux_uapi/linux/sctp.rs @@ -74,9 +74,7 @@ f! { *flags &= !SCTP_PR_SCTP_MASK; *flags |= policy; } -} -safe_f! { pub const safe fn SCTP_PR_TTL_ENABLED(policy: c_int) -> bool { policy == SCTP_PR_SCTP_TTL } diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 6f5a02a284e8..a7c2d6e27550 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -2516,9 +2516,7 @@ f! { let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0; } -} -safe_f! { pub const safe fn WIFSTOPPED(status: c_int) -> bool { (status & _W_STOPPED) != 0 } diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index ab6736a5c0a5..d03832c2489b 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -4361,9 +4361,7 @@ f! { pub const unsafe fn VM_MAKE_TAG(id: u8) -> u32 { (id as u32) << 24u32 } -} -safe_f! { pub const safe fn WSTOPSIG(status: c_int) -> c_int { status >> 8 } diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index af5369ada85c..cbe02efd58ae 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1277,9 +1277,7 @@ f! { let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); 0 != cpuset.ary[idx] & (1 << offset) } -} -safe_f! { pub const safe fn WIFSIGNALED(status: c_int) -> bool { (status & 0o177) != 0o177 && (status & 0o177) != 0 } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 1bf913bc533d..91fb88d1b060 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -271,7 +271,7 @@ pub const MINCORE_SUPER: c_int = 0x20; /// max length of devicename pub const SPECNAMELEN: c_int = 63; -safe_f! { +f! { pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { let major = major as crate::dev_t; let minor = minor as crate::dev_t; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index 8fd49615df38..eebf3cba8bde 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -317,7 +317,7 @@ pub const KI_NSPARE_PTR: usize = 6; pub const MINCORE_SUPER: c_int = 0x20; -safe_f! { +f! { pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { let major = major as crate::dev_t; let minor = minor as crate::dev_t; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index 2858cbfe755d..39c01538701b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -339,7 +339,7 @@ pub const DOMAINSET_POLICY_INTERLEAVE: c_int = 4; pub const MINCORE_SUPER: c_int = 0x20; -safe_f! { +f! { pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { let major = major as crate::dev_t; let minor = minor as crate::dev_t; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index 12beb34e4e6c..a84c185488ca 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -341,7 +341,7 @@ pub const DOMAINSET_POLICY_INTERLEAVE: c_int = 4; pub const MINCORE_SUPER: c_int = 0x60; -safe_f! { +f! { pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { let major = major as crate::dev_t; let minor = minor as crate::dev_t; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs index 92c263f48783..08f9e5e43e6b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs @@ -343,7 +343,7 @@ pub const DOMAINSET_POLICY_INTERLEAVE: c_int = 4; pub const MINCORE_SUPER: c_int = 0x60; -safe_f! { +f! { pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { let major = major as crate::dev_t; let minor = minor as crate::dev_t; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 5120338b33b4..ea378374280b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -4511,9 +4511,7 @@ f! { pub unsafe fn PROT_MAX_EXTRACT(x: c_int) -> c_int { (x >> 16) & (crate::PROT_READ | crate::PROT_WRITE | crate::PROT_EXEC) } -} -safe_f! { pub const safe fn WIFSIGNALED(status: c_int) -> bool { (status & 0o177) != 0o177 && (status & 0o177) != 0 && status != 0x13 } diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 7a7d193f92eb..2740096d5e98 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1451,7 +1451,7 @@ pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08; pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10; pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20; -safe_f! { +f! { pub const safe fn WIFCONTINUED(status: c_int) -> bool { status == 0x13 } diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index e0a39f273655..a734ec4776a5 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -500,9 +500,7 @@ f! { pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { (*set).fds_bits.fill(0); } -} -safe_f! { pub const safe fn WTERMSIG(status: c_int) -> c_int { status & 0o177 } diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 43572ce590fd..75e4008fc332 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1859,9 +1859,7 @@ f! { pub unsafe fn PROT_MPROTECT_EXTRACT(x: c_int) -> c_int { (x >> 3) & 0x7 } -} -safe_f! { pub const safe fn WSTOPSIG(status: c_int) -> c_int { status >> 8 } diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 5a69b0ef35d2..8b35121af917 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1872,9 +1872,7 @@ f! { pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint { (_ALIGN(size_of::()) + _ALIGN(length as usize)) as c_uint } -} -safe_f! { pub const safe fn WSTOPSIG(status: c_int) -> c_int { status >> 8 } diff --git a/src/unix/cygwin/mod.rs b/src/unix/cygwin/mod.rs index a95d2d1c0c17..5645bdd2b2dc 100644 --- a/src/unix/cygwin/mod.rs +++ b/src/unix/cygwin/mod.rs @@ -1783,9 +1783,7 @@ f! { pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { cmsg.offset(1).cast_mut().cast() } -} -safe_f! { pub const safe fn makedev(ma: c_uint, mi: c_uint) -> dev_t { let ma = ma as dev_t; let mi = mi as dev_t; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 011fa9f9ad07..0e7b0203308f 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1444,9 +1444,7 @@ f! { pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { (*set).fds_bits.fill(0); } -} -safe_f! { pub const safe fn WIFEXITED(status: c_int) -> bool { (status & !0xff) == 0 } diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 11a41898ffd4..e90797cd105f 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -3589,6 +3589,91 @@ f! { pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { (*set).fds_bits.fill(0); } + + pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { + let major = major as crate::dev_t; + let minor = minor as crate::dev_t; + let mut dev = 0; + dev |= major << 8; + dev |= minor; + dev + } + + pub const safe fn major(dev: crate::dev_t) -> c_uint { + ((dev >> 8) & 0xff) as c_uint + } + + pub const safe fn minor(dev: crate::dev_t) -> c_uint { + (dev & 0xffff00ff) as c_uint + } + + pub safe fn SIGRTMAX() -> c_int { + unsafe { __libc_current_sigrtmax() } + } + + pub safe fn SIGRTMIN() -> c_int { + unsafe { __libc_current_sigrtmin() } + } + + pub const safe fn WIFSTOPPED(status: c_int) -> bool { + (status & 0xff) == 0x7f + } + + pub const safe fn WSTOPSIG(status: c_int) -> c_int { + (status >> 8) & 0xff + } + + pub const safe fn WIFCONTINUED(status: c_int) -> bool { + status == 0xffff + } + + pub const safe fn WIFSIGNALED(status: c_int) -> bool { + ((status & 0x7f) + 1) as i8 >= 2 + } + + pub const safe fn WTERMSIG(status: c_int) -> c_int { + status & 0x7f + } + + pub const safe fn WIFEXITED(status: c_int) -> bool { + (status & 0x7f) == 0 + } + + pub const safe fn WEXITSTATUS(status: c_int) -> c_int { + (status >> 8) & 0xff + } + + pub const safe fn WCOREDUMP(status: c_int) -> bool { + (status & 0x80) != 0 + } + + pub const safe fn W_EXITCODE(ret: c_int, sig: c_int) -> c_int { + (ret << 8) | sig + } + + pub const safe fn W_STOPCODE(sig: c_int) -> c_int { + (sig << 8) | 0x7f + } + + pub const safe fn QCMD(cmd: c_int, type_: c_int) -> c_int { + (cmd << 8) | (type_ & 0x00ff) + } + + pub const safe fn IPOPT_COPIED(o: u8) -> u8 { + o & IPOPT_COPY + } + + pub const safe fn IPOPT_CLASS(o: u8) -> u8 { + o & IPOPT_CLASS_MASK + } + + pub const safe fn IPOPT_NUMBER(o: u8) -> u8 { + o & IPOPT_NUMBER_MASK + } + + pub const safe fn IPTOS_ECN(x: u8) -> u8 { + x & crate::IPTOS_ECN_MASK + } } extern "C" { @@ -4634,93 +4719,6 @@ extern "C" { pub fn gnu_get_libc_version() -> *const c_char; } -safe_f! { - pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { - let major = major as crate::dev_t; - let minor = minor as crate::dev_t; - let mut dev = 0; - dev |= major << 8; - dev |= minor; - dev - } - - pub const safe fn major(dev: crate::dev_t) -> c_uint { - ((dev >> 8) & 0xff) as c_uint - } - - pub const safe fn minor(dev: crate::dev_t) -> c_uint { - (dev & 0xffff00ff) as c_uint - } - - pub safe fn SIGRTMAX() -> c_int { - unsafe { __libc_current_sigrtmax() } - } - - pub safe fn SIGRTMIN() -> c_int { - unsafe { __libc_current_sigrtmin() } - } - - pub const safe fn WIFSTOPPED(status: c_int) -> bool { - (status & 0xff) == 0x7f - } - - pub const safe fn WSTOPSIG(status: c_int) -> c_int { - (status >> 8) & 0xff - } - - pub const safe fn WIFCONTINUED(status: c_int) -> bool { - status == 0xffff - } - - pub const safe fn WIFSIGNALED(status: c_int) -> bool { - ((status & 0x7f) + 1) as i8 >= 2 - } - - pub const safe fn WTERMSIG(status: c_int) -> c_int { - status & 0x7f - } - - pub const safe fn WIFEXITED(status: c_int) -> bool { - (status & 0x7f) == 0 - } - - pub const safe fn WEXITSTATUS(status: c_int) -> c_int { - (status >> 8) & 0xff - } - - pub const safe fn WCOREDUMP(status: c_int) -> bool { - (status & 0x80) != 0 - } - - pub const safe fn W_EXITCODE(ret: c_int, sig: c_int) -> c_int { - (ret << 8) | sig - } - - pub const safe fn W_STOPCODE(sig: c_int) -> c_int { - (sig << 8) | 0x7f - } - - pub const safe fn QCMD(cmd: c_int, type_: c_int) -> c_int { - (cmd << 8) | (type_ & 0x00ff) - } - - pub const safe fn IPOPT_COPIED(o: u8) -> u8 { - o & IPOPT_COPY - } - - pub const safe fn IPOPT_CLASS(o: u8) -> u8 { - o & IPOPT_CLASS_MASK - } - - pub const safe fn IPOPT_NUMBER(o: u8) -> u8 { - o & IPOPT_NUMBER_MASK - } - - pub const safe fn IPTOS_ECN(x: u8) -> u8 { - x & crate::IPTOS_ECN_MASK - } -} - cfg_if! { if #[cfg(target_pointer_width = "64")] { mod b64; diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index eda5e3d59e68..bdd1725f70e5 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -3527,9 +3527,7 @@ f! { pub unsafe fn SO_EE_OFFENDER(ee: *const crate::sock_extended_err) -> *mut crate::sockaddr { ee.offset(1) as *mut crate::sockaddr } -} -safe_f! { pub const safe fn makedev(ma: c_uint, mi: c_uint) -> crate::dev_t { let ma = ma as crate::dev_t; let mi = mi as crate::dev_t; diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 11c8ef131c81..2004d99318ca 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1301,9 +1301,7 @@ f! { pub unsafe fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { set1.bits == set2.bits } -} -safe_f! { pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { let major = major as crate::dev_t; let minor = minor as crate::dev_t; diff --git a/src/unix/linux_like/linux_l4re_shared.rs b/src/unix/linux_like/linux_l4re_shared.rs index 0674269182e7..ed9e429c03a1 100644 --- a/src/unix/linux_like/linux_l4re_shared.rs +++ b/src/unix/linux_like/linux_l4re_shared.rs @@ -1562,9 +1562,7 @@ f! { pub unsafe fn ELF64_R_INFO(sym: Elf64_Xword, t: Elf64_Xword) -> Elf64_Xword { sym << (32 + t) } -} -safe_f! { pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { let major = major as crate::dev_t; let minor = minor as crate::dev_t; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 9081f8472aa7..04aa98a52ed5 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1806,9 +1806,7 @@ f! { pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { (*set).fds_bits.fill(0); } -} -safe_f! { pub safe fn SIGRTMAX() -> c_int { unsafe { __libc_current_sigrtmax() } } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 38d6a46556c6..ec915d32ebc4 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -418,6 +418,23 @@ cfg_if! { } } +f! { + // It seems htonl, etc are macros on macOS. So we have to reimplement them. So let's + // reimplement them for all UNIX platforms + pub const safe fn htonl(hostlong: u32) -> u32 { + u32::to_be(hostlong) + } + pub const safe fn htons(hostshort: u16) -> u16 { + u16::to_be(hostshort) + } + pub const safe fn ntohl(netlong: u32) -> u32 { + u32::from_be(netlong) + } + pub const safe fn ntohs(netshort: u16) -> u16 { + u16::from_be(netshort) + } +} + extern "C" { pub static in6addr_loopback: in6_addr; pub static in6addr_any: in6_addr; @@ -2129,23 +2146,6 @@ extern "C" { } -safe_f! { - // It seems htonl, etc are macros on macOS. So we have to reimplement them. So let's - // reimplement them for all UNIX platforms - pub const safe fn htonl(hostlong: u32) -> u32 { - u32::to_be(hostlong) - } - pub const safe fn htons(hostshort: u16) -> u16 { - u16::to_be(hostshort) - } - pub const safe fn ntohl(netlong: u32) -> u32 { - u32::from_be(netlong) - } - pub const safe fn ntohs(netshort: u16) -> u16 { - u16::from_be(netshort) - } -} - cfg_if! { if #[cfg(not(any( target_os = "emscripten", diff --git a/src/unix/newlib/horizon/mod.rs b/src/unix/newlib/horizon/mod.rs index 0e92ccd9f907..a357f8e3a7be 100644 --- a/src/unix/newlib/horizon/mod.rs +++ b/src/unix/newlib/horizon/mod.rs @@ -192,7 +192,7 @@ pub const GRND_NONBLOCK: c_uint = 0x1; pub const GRND_RANDOM: c_uint = 0x2; // Horizon OS works doesn't or can't hold any of this information -safe_f! { +f! { pub const safe fn WIFSTOPPED(_status: c_int) -> bool { false } diff --git a/src/unix/newlib/rtems/mod.rs b/src/unix/newlib/rtems/mod.rs index c889f6d908d9..9ed423096e8d 100644 --- a/src/unix/newlib/rtems/mod.rs +++ b/src/unix/newlib/rtems/mod.rs @@ -86,7 +86,7 @@ pub const WUNTRACED: c_int = 2; // sys/socket.h pub const SOMAXCONN: c_int = 128; -safe_f! { +f! { pub const safe fn WIFSTOPPED(status: c_int) -> bool { (status & 0xff) == 0x7f } diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index 6aa400ad62fc..eac685243b91 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -2343,9 +2343,7 @@ f! { let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 }; size_of::() + size_of::() * ngrps } -} -safe_f! { pub const safe fn WIFSTOPPED(status: c_int) -> bool { (status & 0xff) == 0x7f } diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 1a4a2878b584..2ef0dfe4b035 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -1149,9 +1149,7 @@ f! { pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { (*set).fds_bits.fill(0); } -} -safe_f! { pub const safe fn WIFSTOPPED(status: c_int) -> bool { (status & 0xff) == 0x7f } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index b08e8a4086c6..98c61c763653 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -2275,9 +2275,7 @@ f! { pub unsafe fn FD_ZERO(set: *mut fd_set) -> () { (*set).fds_bits.fill(0); } -} -safe_f! { pub safe fn SIGRTMAX() -> c_int { unsafe { crate::sysconf(_SC_SIGRT_MAX) as c_int } } diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 27e0c122bb99..91e0a9dab4be 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -1496,6 +1496,30 @@ f! { pub const unsafe fn CMSG_LEN(length: c_uint) -> c_uint { CMSG_ALIGN(size_of::()) as c_uint + length } + + // Dummy functions, these don't really exist in VxWorks. + // wait.h macros + pub const safe fn WIFEXITED(status: c_int) -> bool { + (status & 0xFF00) == 0 + } + pub const safe fn WIFSIGNALED(status: c_int) -> bool { + (status & 0xFF00) != 0 + } + pub const safe fn WIFSTOPPED(status: c_int) -> bool { + (status & 0xFF0000) != 0 + } + pub const safe fn WEXITSTATUS(status: c_int) -> c_int { + status & 0xFF + } + pub const safe fn WIFCONTINUED(status: c_int) -> c_int { + (status >> 24) & 0xFF + } + pub const safe fn WTERMSIG(status: c_int) -> c_int { + (status >> 8) & 0xFF + } + pub const safe fn WSTOPSIG(status: c_int) -> c_int { + (status >> 16) & 0xFF + } } extern "C" { @@ -2410,33 +2434,6 @@ extern "C" { pub fn vxCpuConfiguredGet() -> crate::cpuset_t; // Get set of Configured CPU's in the system } -//Dummy functions, these don't really exist in VxWorks. - -// wait.h macros -safe_f! { - pub const safe fn WIFEXITED(status: c_int) -> bool { - (status & 0xFF00) == 0 - } - pub const safe fn WIFSIGNALED(status: c_int) -> bool { - (status & 0xFF00) != 0 - } - pub const safe fn WIFSTOPPED(status: c_int) -> bool { - (status & 0xFF0000) != 0 - } - pub const safe fn WEXITSTATUS(status: c_int) -> c_int { - status & 0xFF - } - pub const safe fn WIFCONTINUED(status: c_int) -> c_int { - (status >> 24) & 0xFF - } - pub const safe fn WTERMSIG(status: c_int) -> c_int { - (status >> 8) & 0xFF - } - pub const safe fn WSTOPSIG(status: c_int) -> c_int { - (status >> 16) & 0xFF - } -} - pub unsafe fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int { // check to see if align is a power of 2 and if align is a multiple // of sizeof(void *) From ef605de8a008b2e83527c9772074ee9996819ebe Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 3 Aug 2026 12:53:30 -0500 Subject: [PATCH 36/93] ci: Pin docs toolchain to nightly-2026-08-02 The job has been failing due to [1]. [1]: https://github.com/rust-lang/rust/issues/160439 (backport ) (cherry picked from commit 297152ad0564a528315a19bc528e44545af0d57e) --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1e6de4fbf65e..76307f2c0f57 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -366,7 +366,8 @@ jobs: with: persist-credentials: false - name: Install Rust - run: rustup update nightly --no-self-update && rustup default nightly + # FIXME(rust-lang/rust#160439): unpin once the issue is fixed + run: rustup update nightly-2026-08-02 --no-self-update && rustup default nightly-2026-08-02 - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 - run: cargo doc --workspace --no-deps From 56ff5ee3a9b5aa72e69df43013eb83dc8aa7a4f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 14:04:07 +0000 Subject: [PATCH 37/93] build(deps): bump taiki-e/install-action from 2.85.2 to 2.85.5 Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.85.2 to 2.85.5. - [Release notes](https://github.com/taiki-e/install-action/releases) - [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/taiki-e/install-action/compare/41049aa56687c35e0afa74eed4f09cec4f9afabf...6a1bd70eaac3c8bdf093356838d7ee09fda951cf) --- updated-dependencies: - dependency-name: taiki-e/install-action dependency-version: 2.85.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] (backport ) (cherry picked from commit c65b96f2f3ec0cc28b10116d93cb8e6ffe32eb49) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 76307f2c0f57..49c543cf9220 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -82,7 +82,7 @@ jobs: run: ./ci/install-rust.sh - name: Install semver-checks - uses: taiki-e/install-action@41049aa56687c35e0afa74eed4f09cec4f9afabf # v2.85.2 + uses: taiki-e/install-action@6a1bd70eaac3c8bdf093356838d7ee09fda951cf # v2.85.5 if: matrix.toolchain == 'stable' with: tool: cargo-semver-checks From b8ccc2b636277c2ba2a04afae95b2ca68286df8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 14:04:15 +0000 Subject: [PATCH 38/93] build(deps): bump vmactions/netbsd-vm from 1.4.4 to 1.4.5 Bumps [vmactions/netbsd-vm](https://github.com/vmactions/netbsd-vm) from 1.4.4 to 1.4.5. - [Release notes](https://github.com/vmactions/netbsd-vm/releases) - [Commits](https://github.com/vmactions/netbsd-vm/compare/bf34bcd909bb50856f934a67d09a8fbe2b966a1b...e7ac71b97abbe8437cec8859a5acf72dfa6a8be0) --- updated-dependencies: - dependency-name: vmactions/netbsd-vm dependency-version: 1.4.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] (backport ) (cherry picked from commit 9d452ead63d696cb31ee3b470cb137e8ecf158d0) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 49c543cf9220..882f37febf80 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -333,7 +333,7 @@ jobs: run: ./ci/bsd-run.sh ${{ matrix.target }} - name: Test on NetBSD - uses: vmactions/netbsd-vm@bf34bcd909bb50856f934a67d09a8fbe2b966a1b # v1.4.4 + uses: vmactions/netbsd-vm@e7ac71b97abbe8437cec8859a5acf72dfa6a8be0 # v1.4.5 if: contains(matrix.target, 'netbsd') with: release: "10.1" From 4f30c57e1e5707fbf89bd30af3ff376cd1eb32d2 Mon Sep 17 00:00:00 2001 From: Zhiwei Liang Date: Tue, 28 Jul 2026 00:06:01 -0400 Subject: [PATCH 39/93] wasi: move version-independent socket constants to the shared module, add SOCK_CLOEXEC https://github.com/WebAssembly/wasi-libc/blob/0d5332aceea8e72698b6abc270550e666ba97aea/libc-bottom-half/headers/public/__header_sys_socket.h Signed-off-by: Zhiwei Liang (backport ) (cherry picked from commit 7518e54017e3a34c8b4dcca3070520a1bb1e6c1a) --- libc-test/semver/wasi-p2.txt | 3 --- libc-test/semver/wasi.txt | 4 ++++ src/wasi/mod.rs | 7 +++++++ src/wasi/p2.rs | 4 ---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libc-test/semver/wasi-p2.txt b/libc-test/semver/wasi-p2.txt index 2d1bc774ab30..31ab3679baff 100644 --- a/libc-test/semver/wasi-p2.txt +++ b/libc-test/semver/wasi-p2.txt @@ -24,9 +24,7 @@ SHUT_RD SHUT_RDWR SHUT_WR SOCK_DGRAM -SOCK_NONBLOCK SOCK_STREAM -SOL_SOCKET SO_ACCEPTCONN SO_BROADCAST SO_DOMAIN @@ -39,7 +37,6 @@ SO_RCVTIMEO SO_REUSEADDR SO_SNDBUF SO_SNDTIMEO -SO_TYPE TCP_KEEPCNT TCP_KEEPIDLE TCP_KEEPINTVL diff --git a/libc-test/semver/wasi.txt b/libc-test/semver/wasi.txt index 5e7ab4b5192c..510c73fd16e7 100644 --- a/libc-test/semver/wasi.txt +++ b/libc-test/semver/wasi.txt @@ -1,6 +1,10 @@ FD_ISSET FD_SET FD_ZERO +SOCK_CLOEXEC +SOCK_NONBLOCK +SOL_SOCKET +SO_TYPE _SC_2_CHAR_TERM _SC_2_C_BIND _SC_2_C_DEV diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 8ba518bdcfff..a21aa4f32635 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -656,6 +656,13 @@ pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1; pub const PTHREAD_STACK_MIN: usize = 2048; pub const TIMER_ABSTIME: c_int = 1; +pub const SOCK_CLOEXEC: c_int = 0x00002000; +pub const SOCK_NONBLOCK: c_int = 0x00004000; + +pub const SOL_SOCKET: c_int = 0x7fffffff; + +pub const SO_TYPE: c_int = 3; + f! { pub unsafe fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool { let set = &*set; diff --git a/src/wasi/p2.rs b/src/wasi/p2.rs index 7332a779396d..2a724ac061c1 100644 --- a/src/wasi/p2.rs +++ b/src/wasi/p2.rs @@ -79,7 +79,6 @@ pub const MSG_NOSIGNAL: c_int = 0x4000; pub const MSG_PEEK: c_int = 0x0002; pub const SO_REUSEADDR: c_int = 2; -pub const SO_TYPE: c_int = 3; pub const SO_ERROR: c_int = 4; pub const SO_BROADCAST: c_int = 6; pub const SO_SNDBUF: c_int = 7; @@ -94,9 +93,6 @@ pub const SO_SNDTIMEO: c_int = 67; pub const SOCK_DGRAM: c_int = 5; pub const SOCK_STREAM: c_int = 6; -pub const SOCK_NONBLOCK: c_int = 0x00004000; - -pub const SOL_SOCKET: c_int = 0x7fffffff; pub const AF_UNSPEC: c_int = 0; pub const AF_INET: c_int = 1; From db81760d07cc98d0fcae8883074a3a657827a0df Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:10:00 +0200 Subject: [PATCH 40/93] use trusted publishing (backport ) (cherry picked from commit 3ba7473a6e0ce17ae529dd54ddf85b6cef0d4295) --- .github/workflows/publish_0.2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_0.2.yml b/.github/workflows/publish_0.2.yml index 009ec37a49fa..6a86d8bbb84b 100644 --- a/.github/workflows/publish_0.2.yml +++ b/.github/workflows/publish_0.2.yml @@ -15,6 +15,7 @@ jobs: release-plz: name: Release-plz v0.2 runs-on: ubuntu-latest + environment: release steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -27,7 +28,6 @@ jobs: uses: release-plz/action@2eb1d8bcb770b4c48ccfaad919734b38b51958c9 # v0.5.131 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} with: # FIXME(release): release-pr is broken since we have two release tracks for # `libc` :( From b0fa222451303de18aea71b0958d51b4803d6a70 Mon Sep 17 00:00:00 2001 From: Valentyn Kit Date: Mon, 3 Aug 2026 12:09:02 +0300 Subject: [PATCH 41/93] Add pthread_gettid_np for Android and glibc Returns the Linux TID for a given thread, unlike gettid, which only returns the id of the calling thread. This is useful for std in the thread spawn path: the parent can set the TID of the child it just created, whereas today the TID can only be read once the child itself starts running. The declaration is limited to Android and linux-gnu. musl and ohos do not re-export it. ctest is gated on the glibc version. The function was added in 2.42, so older glibc has no declaration to check against. Link: https://github.com/bminor/glibc/blob/d2097651cc57834dbfcaa102ddfacae0d86cfb66/sysdeps/nptl/pthread.h#L1320-L1322 Link: https://android.googlesource.com/platform/bionic/+/731631f300090436d7f5df80d50b6275c8c60a93/libc/include/pthread.h#173 (backport ) (cherry picked from commit 87e552e35ff732b62c732082588076f609e589be) --- libc-test/build.rs | 2 ++ libc-test/semver/android.txt | 1 + libc-test/semver/linux-gnu.txt | 1 + src/new/bionic_libc/pthread.rs | 1 + src/new/common/linux_like/pthread.rs | 3 +++ src/new/glibc/sysdeps/nptl/pthread.rs | 1 + 6 files changed, 9 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 8f28c1a5b99e..e6a8ddca2fd1 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -5238,6 +5238,8 @@ fn test_linux(target: &str) { "posix_spawn_file_actions_addclosefrom_np" if gnu && sparc64 => true, // Needs glibc 2.35 or later. "posix_spawn_file_actions_addtcsetpgrp_np" if gnu && sparc64 => true, + // Needs glibc 2.42 or later. + "pthread_gettid_np" if gnu && versions.glibc.unwrap() < (2, 42) => true, // FIXME(linux): Deprecated since glibc 2.30. Remove fn once upstream does. "sysctl" if gnu => true, diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 0f6d82b2e7bf..9b057ed0e9b5 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -3853,6 +3853,7 @@ pthread_getattr_np pthread_getcpuclockid pthread_getschedparam pthread_getspecific +pthread_gettid_np pthread_join pthread_key_create pthread_key_delete diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index c5e2ae624706..78ce9936ff4b 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -662,6 +662,7 @@ process_vm_readv process_vm_writev pthread_attr_getaffinity_np pthread_attr_setaffinity_np +pthread_gettid_np pthread_rwlockattr_getkind_np pthread_rwlockattr_getpshared pthread_rwlockattr_setkind_np diff --git a/src/new/bionic_libc/pthread.rs b/src/new/bionic_libc/pthread.rs index 4997547ff090..db62dc4ce784 100644 --- a/src/new/bionic_libc/pthread.rs +++ b/src/new/bionic_libc/pthread.rs @@ -2,6 +2,7 @@ pub use crate::new::common::linux_like::pthread::{ pthread_getattr_np, + pthread_gettid_np, pthread_setname_np, }; pub use crate::new::common::posix::pthread::{ diff --git a/src/new/common/linux_like/pthread.rs b/src/new/common/linux_like/pthread.rs index b54d385f9c05..e76b704142a7 100644 --- a/src/new/common/linux_like/pthread.rs +++ b/src/new/common/linux_like/pthread.rs @@ -13,6 +13,9 @@ extern "C" { #[cfg(target_os = "linux")] pub fn pthread_getname_np(thread: crate::pthread_t, name: *mut c_char, len: size_t) -> c_int; + #[cfg(any(target_os = "android", all(target_os = "linux", target_env = "gnu")))] + pub fn pthread_gettid_np(thread: crate::pthread_t) -> crate::pid_t; + #[cfg(any(target_os = "linux", target_os = "l4re"))] pub fn pthread_setaffinity_np( thread: crate::pthread_t, diff --git a/src/new/glibc/sysdeps/nptl/pthread.rs b/src/new/glibc/sysdeps/nptl/pthread.rs index cefc9e3002a4..bb45d2851fc5 100644 --- a/src/new/glibc/sysdeps/nptl/pthread.rs +++ b/src/new/glibc/sysdeps/nptl/pthread.rs @@ -28,6 +28,7 @@ pub use crate::new::common::linux_like::pthread::{ pthread_getaffinity_np, pthread_getattr_np, pthread_getname_np, + pthread_gettid_np, pthread_setaffinity_np, pthread_setname_np, }; From fca5bd6d0ced24076f467b5f15c815b1e5e70276 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:51 +0200 Subject: [PATCH 42/93] fuchsia: mirror `fd_set` definition Fixes `fd_set`'s array field. The size was wrong [^1]. Now unused constants have been removed. The PR has been separated from the commit fixing miscellaneous records. [^1]: https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/sys/select.h;l=23-25;drc=7c5e521391fddb98fd8f6970da7c410899ddf5cf (backport ) (cherry picked from commit e3a6cd6684e3a028744c3f75ee2da4de021dc20a) --- src/fuchsia/mod.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 8dfb1e7e1c9c..25bc32276b8a 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -363,7 +363,7 @@ s! { } pub struct fd_set { - fds_bits: [c_ulong; FD_SETSIZE as usize / ULONG_SIZE], + fds_bits: [c_ulong; FD_SETSIZE as usize / 8 / size_of::()], } pub struct tm { @@ -2956,17 +2956,6 @@ pub const O_NOFOLLOW: c_int = 0x00000080; pub const HUGETLB_FLAG_ENCODE_SHIFT: u32 = 26; pub const MAP_HUGE_SHIFT: u32 = 26; -// intentionally not public, only used for fd_set -cfg_if! { - if #[cfg(target_pointer_width = "32")] { - const ULONG_SIZE: usize = 32; - } else if #[cfg(target_pointer_width = "64")] { - const ULONG_SIZE: usize = 64; - } else { - // Unknown target_pointer_width - } -} - // END_PUB_CONST f! { From 2e3346d40c3ce25af2cfa4620697f14defdada76 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:51 +0200 Subject: [PATCH 43/93] fuchsia: mirror type aliases Mirror type aliases. They were previously only equivalent. This changes them to using C types. Remove architecture-specific definitions. They were the same. (backport ) (cherry picked from commit aa771fb9e1b5ca793cae5619f01e93c45677d1bf) --- src/fuchsia/aarch64.rs | 2 -- src/fuchsia/mod.rs | 20 +++++++++++--------- src/fuchsia/riscv64.rs | 3 --- src/fuchsia/x86_64.rs | 2 -- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs index 93090f7238d7..cf91bc4d4504 100644 --- a/src/fuchsia/aarch64.rs +++ b/src/fuchsia/aarch64.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type __u64 = c_ulonglong; pub type wchar_t = u32; -pub type nlink_t = c_ulong; -pub type blksize_t = c_long; s! { pub struct stat { diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 25bc32276b8a..0e09589b963b 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -18,34 +18,36 @@ pub type intptr_t = isize; pub type uintptr_t = usize; pub type ssize_t = isize; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; +pub type pid_t = c_int; +pub type uid_t = c_uint; +pub type gid_t = c_uint; pub type in_addr_t = u32; pub type in_port_t = u16; pub type sighandler_t = size_t; pub type cc_t = c_uchar; -pub type sa_family_t = u16; +pub type sa_family_t = c_ushort; pub type pthread_key_t = c_uint; pub type speed_t = c_uint; pub type tcflag_t = c_uint; pub type clockid_t = c_int; pub type key_t = c_int; pub type id_t = c_uint; -pub type useconds_t = u32; -pub type dev_t = u64; -pub type socklen_t = u32; +pub type useconds_t = c_uint; +pub type dev_t = c_ulonglong; +pub type socklen_t = c_uint; pub type pthread_t = c_ulong; -pub type mode_t = u32; pub type ino64_t = u64; pub type off64_t = i64; pub type blkcnt64_t = i64; pub type rlim64_t = u64; pub type mqd_t = c_int; +pub type mode_t = c_uint; pub type nfds_t = c_ulong; pub type nl_item = c_int; pub type idtype_t = c_uint; -pub type loff_t = c_longlong; +pub type loff_t = crate::off_t; +pub type nlink_t = c_ulong; +pub type blksize_t = c_long; pub type __u8 = c_uchar; pub type __u16 = c_ushort; diff --git a/src/fuchsia/riscv64.rs b/src/fuchsia/riscv64.rs index bc93cc3bff0a..6bc038e48652 100644 --- a/src/fuchsia/riscv64.rs +++ b/src/fuchsia/riscv64.rs @@ -5,9 +5,6 @@ use crate::prelude::*; pub type __u64 = c_ulonglong; pub type wchar_t = i32; -pub type nlink_t = c_ulong; -pub type blksize_t = c_long; - pub type stat64 = stat; s! { pub struct stat { diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index fc42cd981098..26343235398e 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -2,8 +2,6 @@ use crate::off_t; use crate::prelude::*; pub type wchar_t = i32; -pub type nlink_t = u64; -pub type blksize_t = c_long; pub type __u64 = c_ulonglong; s! { From 358884079c00b2185d4d8c678fa9f96a65933007 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:51 +0200 Subject: [PATCH 44/93] fuchsia: tweak constant definitions Mirror constants. They were previously equivalent. (backport ) (cherry picked from commit 30684d8198d14dcfe749a68e26c6a3a393415b70) --- src/fuchsia/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 0e09589b963b..84b766545134 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -1054,7 +1054,7 @@ pub const FD_CLOEXEC: c_int = 0x1; pub const USRQUOTA: c_int = 0; pub const GRPQUOTA: c_int = 1; -pub const SIGIOT: c_int = 6; +pub const SIGIOT: c_int = SIGABRT; pub const S_ISUID: mode_t = 0o4000; pub const S_ISGID: mode_t = 0o2000; From d5d4bbc0aef4630a130f1367744e96a331ccdd17 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:51 +0200 Subject: [PATCH 45/93] fuchsia: fill in definition of `fpos_t` Fills in the pending definition. It's opaque in other platforms. It's public in the Fuchsia headers [^1]. Solves a `FIXME`. [^1]: https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/stdio.h;l=47-50;drc=7c5e521391fddb98fd8f6970da7c410899ddf5cf (backport ) (cherry picked from commit 02cd49edf3e272b740528bac4bb0307d125e3ecb) --- src/fuchsia/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 84b766545134..c14bc01b1a3a 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -1031,6 +1031,13 @@ s! { } } +s_no_extra_traits! { + pub union fpos_t { + __opaque: [c_char; 16], + __align: c_double, + } +} + // PUB_CONST pub const INT_MIN: c_int = -2147483648; @@ -3128,7 +3135,6 @@ extern "C" {} extern_ty! { pub type FILE; - pub type fpos_t; // FIXME(fuchsia): fill this out with a struct } extern "C" { From 198735f5d15d0259a6c918fec1706140c3afbd9a Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:51 +0200 Subject: [PATCH 46/93] fuchsia: deprecate nonexistent types Remove nonexistent types. They are not part of the Fuchsia IDK. Replace `off64_t` in two routines. It's now `off_t`. `off64_t` doesn't exist in Fuchsia. (backport ) (cherry picked from commit e6b15f71ce69e05f670569b043359618a6d3ce80) --- src/fuchsia/aarch64.rs | 14 ++++ src/fuchsia/mod.rs | 169 ++++++++++++++++++++++++++++++++++------- src/fuchsia/riscv64.rs | 14 ++++ src/fuchsia/x86_64.rs | 15 ++++ 4 files changed, 183 insertions(+), 29 deletions(-) diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs index cf91bc4d4504..28485f4cdb2b 100644 --- a/src/fuchsia/aarch64.rs +++ b/src/fuchsia/aarch64.rs @@ -1,6 +1,10 @@ use crate::off_t; use crate::prelude::*; +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub type __u64 = c_ulonglong; pub type wchar_t = u32; @@ -27,6 +31,11 @@ s! { __unused: Padding<[c_uint; 2]>, } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct stat64 { pub st_dev: crate::dev_t, pub st_ino: crate::ino_t, @@ -49,6 +58,11 @@ s! { __unused: Padding<[c_uint; 2]>, } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct ipc_perm { pub __ipc_perm_key: crate::key_t, pub uid: crate::uid_t, diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index c14bc01b1a3a..35b718d62266 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -36,11 +36,6 @@ pub type useconds_t = c_uint; pub type dev_t = c_ulonglong; pub type socklen_t = c_uint; pub type pthread_t = c_ulong; -pub type ino64_t = u64; -pub type off64_t = i64; -pub type blkcnt64_t = i64; -pub type rlim64_t = u64; -pub type mqd_t = c_int; pub type mode_t = c_uint; pub type nfds_t = c_ulong; pub type nl_item = c_int; @@ -49,6 +44,36 @@ pub type loff_t = crate::off_t; pub type nlink_t = c_ulong; pub type blksize_t = c_long; +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] +pub type mqd_t = c_int; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] +pub type off64_t = i64; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] +pub type ino64_t = u64; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] +pub type blkcnt64_t = i64; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] +pub type rlim64_t = u64; + pub type __u8 = c_uchar; pub type __u16 = c_ushort; pub type __s16 = c_short; @@ -78,12 +103,30 @@ pub type msgqnum_t = c_ulong; pub type msglen_t = c_ulong; pub type fsblkcnt_t = c_ulonglong; pub type fsfilcnt_t = c_ulonglong; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub type rlim_t = c_ulonglong; +#[deprecated( + since = "0.2.189", + note = "Use `statfs` instead. This type does not exist upstream and will \ + eventually be removed." +)] +pub type statfs64 = statfs; + extern_ty! { pub type timezone; pub type DIR; - pub type fpos64_t; // FIXME(fuchsia): fill this out with a struct + + #[deprecated( + since = "0.2.189", + note = "Use `fpos_t` instead. This type does not exist upstream and \ + will eventually be removed." + )] + pub type fpos64_t; } // Deprecated impls: see #5296 @@ -117,8 +160,11 @@ s! { pub tv_nsec: c_long, } - // FIXME(fuchsia): the rlimit and rusage related functions and types don't exist - // within zircon. Are there reasons for keeping them around? + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct rlimit { pub rlim_cur: rlim_t, pub rlim_max: rlim_t, @@ -397,6 +443,12 @@ s! { pub dli_saddr: *mut c_void, } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] + #[allow(deprecated)] pub struct epoll_event { pub events: u32, pub u64: u64, @@ -429,6 +481,11 @@ s! { pub int_n_sign_posn: c_char, } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -674,6 +731,11 @@ s! { pub weak_magnitude: crate::__u16, } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct ff_effect { pub type_: crate::__u16, pub id: crate::__s16, @@ -733,21 +795,11 @@ s! { pub p_align: Elf64_Xword, } - pub struct statfs64 { - pub f_type: c_ulong, - pub f_bsize: c_ulong, - pub f_blocks: crate::fsblkcnt_t, - pub f_bfree: crate::fsblkcnt_t, - pub f_bavail: crate::fsblkcnt_t, - pub f_files: crate::fsfilcnt_t, - pub f_ffree: crate::fsfilcnt_t, - pub f_fsid: crate::fsid_t, - pub f_namelen: c_ulong, - pub f_frsize: c_ulong, - pub f_flags: c_ulong, - pub f_spare: [c_ulong; 4], - } - + #[deprecated( + since = "0.2.189", + note = "Use `statvfs` instead. This type does not exist upstream and \ + will eventually be removed." + )] pub struct statvfs64 { pub f_bsize: c_ulong, pub f_frsize: c_ulong, @@ -850,6 +902,11 @@ s! { _align: [usize; 0], } + #[deprecated( + since = "0.2.189", + note = "Use `termios`. This type does not exist upstream and will \ + eventually be removed." + )] pub struct termios2 { pub c_iflag: crate::tcflag_t, pub c_oflag: crate::tcflag_t, @@ -889,6 +946,11 @@ s! { size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T], } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct sysinfo { pub uptime: c_ulong, pub loads: [c_ulong; 3], @@ -934,6 +996,12 @@ s! { pub d_name: [c_char; 256], } + #[deprecated( + since = "0.2.189", + note = "Use `dirent` instead. This type does not exist upstream and \ + will eventually be removed." + )] + #[allow(deprecated)] pub struct dirent64 { pub d_ino: crate::ino64_t, pub d_off: off64_t, @@ -942,8 +1010,11 @@ s! { pub d_name: [c_char; 256], } - // x32 compatibility - // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct mq_attr { #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] pub mq_flags: i64, @@ -968,6 +1039,11 @@ s! { pad: Padding<[c_long; 4]>, } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct sockaddr_nl { pub nl_family: crate::sa_family_t, nl_pad: Padding, @@ -1991,7 +2067,20 @@ pub const _SC_XOPEN_STREAMS: c_int = 246; pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 247; pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 248; +#[deprecated( + since = "0.2.189", + note = "This constant does not exist upstream and will eventually be \ + removed." +)] +#[allow(deprecated)] pub const RLIM_SAVED_MAX: crate::rlim_t = RLIM_INFINITY; + +#[deprecated( + since = "0.2.189", + note = "This constant does not exist upstream and will eventually be \ + removed." +)] +#[allow(deprecated)] pub const RLIM_SAVED_CUR: crate::rlim_t = RLIM_INFINITY; pub const GLOB_ERR: c_int = 1 << 0; @@ -2535,12 +2624,34 @@ pub const POSIX_FADV_NOREUSE: c_int = 5; pub const POSIX_MADV_DONTNEED: c_int = 4; +#[deprecated( + since = "0.2.189", + note = "This constant does not exist upstream and will eventually be \ + removed." +)] +#[allow(deprecated)] pub const RLIM_INFINITY: crate::rlim_t = !0; + +#[deprecated( + since = "0.2.189", + note = "This constant does not exist upstream and will eventually be \ + removed." +)] +#[allow(deprecated)] pub const RLIMIT_RTTIME: c_int = 15; -#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] + +#[deprecated( + since = "0.2.189", + note = "This constant does not exist upstream and will eventually be \ + removed." +)] pub const RLIMIT_NLIMITS: c_int = 16; +#[deprecated( + since = "0.2.189", + note = "This constant does not exist upstream and will eventually be \ + removed." +)] #[allow(deprecated)] -#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: c_int = RLIMIT_NLIMITS; pub const MAP_ANONYMOUS: c_int = MAP_ANON; @@ -3751,7 +3862,7 @@ extern "C" { pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int; pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; - pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t; + pub fn readahead(fd: c_int, offset: off_t, count: size_t) -> ssize_t; pub fn signalfd(fd: c_int, mask: *const crate::sigset_t, flags: c_int) -> c_int; pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int; pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int; @@ -3791,7 +3902,7 @@ extern "C" { pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; pub fn if_nameindex() -> *mut if_nameindex; pub fn if_freenameindex(ptr: *mut if_nameindex); - pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int; + pub fn sync_file_range(fd: c_int, offset: off_t, nbytes: off_t, flags: c_uint) -> c_int; pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int; pub fn freeifaddrs(ifa: *mut crate::ifaddrs); diff --git a/src/fuchsia/riscv64.rs b/src/fuchsia/riscv64.rs index 6bc038e48652..891a9bde662c 100644 --- a/src/fuchsia/riscv64.rs +++ b/src/fuchsia/riscv64.rs @@ -2,10 +2,19 @@ use crate::off_t; use crate::prelude::*; // From psABI Calling Convention for RV64 +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub type __u64 = c_ulonglong; pub type wchar_t = i32; +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub type stat64 = stat; + s! { pub struct stat { pub st_dev: crate::dev_t, @@ -29,6 +38,11 @@ s! { } // Not actually used, IPC calls just return ENOSYS + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct ipc_perm { pub __ipc_perm_key: crate::key_t, pub uid: crate::uid_t, diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index 26343235398e..d1eadc1df407 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -2,6 +2,11 @@ use crate::off_t; use crate::prelude::*; pub type wchar_t = i32; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub type __u64 = c_ulonglong; s! { @@ -26,6 +31,11 @@ s! { __unused: Padding<[c_long; 3]>, } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct stat64 { pub st_dev: crate::dev_t, pub st_ino: crate::ino64_t, @@ -51,6 +61,11 @@ s! { __private: [u64; 32], } + #[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be \ + removed." + )] pub struct ipc_perm { pub __ipc_perm_key: crate::key_t, pub uid: crate::uid_t, From 69e41fd6aa24b448f90d37c66be50d90914b58a9 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:18:41 +0200 Subject: [PATCH 47/93] macros: allow deprecated in `s_no_extra_traits` Add an `allow(deprecated)` to `s_no_extra_traits`'s `impl Debug` expansion on `union`s to avoid warnings on deprecated items. This fixes the prior patch's deprecation warnings on `epoll_data`. (backport ) (cherry picked from commit f3a6420962dea7bff55528e4c3a4ed1144f22764) --- src/macros.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/macros.rs b/src/macros.rs index cc595969218f..8be1f0e66603 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -230,6 +230,7 @@ macro_rules! s_no_extra_traits { $(#[$attr])* $pub union $i { $($field)* } + #[allow(deprecated)] impl ::core::fmt::Debug for $i { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct(::core::stringify!($i)).finish_non_exhaustive() From 6917de8d1022fde3237e96576ff797b5b7c56e0f Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:51 +0200 Subject: [PATCH 48/93] fuchsia: fix record definitions Remove uses of 32-bit target conditional compilation. Fuchsia does not support 32-bit targets [^1]. This is unnecessary. Fix missing fields in records. No particular header file is targetted. All wrong records have been fixed. c.f. all headers under `arch/{arch}/sysroot/include` in the IDK. Fix `cpu_set_t` macros [^2]. They were wrongly defined. They neither returned the right values. [^1]: https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0111_fuchsia_hardware_specifications#required_64-bit_cpu_and_platform [^2]: https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/sched.h;drc=e99708804b3800218154f1cd153f4300c9ef66e6 (backport ) (cherry picked from commit 5c5339175db670c17aef6e937f85bef5e2a9e754) --- src/fuchsia/aarch64.rs | 4 +- src/fuchsia/mod.rs | 146 +++++++++++++++++++++++++++-------------- src/fuchsia/riscv64.rs | 5 +- src/fuchsia/x86_64.rs | 2 +- 4 files changed, 100 insertions(+), 57 deletions(-) diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs index 28485f4cdb2b..01fd37f381b6 100644 --- a/src/fuchsia/aarch64.rs +++ b/src/fuchsia/aarch64.rs @@ -17,10 +17,10 @@ s! { pub st_uid: crate::uid_t, pub st_gid: crate::gid_t, pub st_rdev: crate::dev_t, - __pad0: Padding, + __pad: Padding, pub st_size: off_t, pub st_blksize: crate::blksize_t, - __pad1: Padding, + __pad2: Padding, pub st_blocks: crate::blkcnt_t, pub st_atime: crate::time_t, pub st_atime_nsec: c_long, diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 35b718d62266..fe706d3525cb 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -495,13 +495,8 @@ s! { pub gl_pathc: size_t, pub gl_pathv: *mut *mut c_char, pub gl_offs: size_t, - pub gl_flags: c_int, - - __unused1: Padding<*mut c_void>, - __unused2: Padding<*mut c_void>, - __unused3: Padding<*mut c_void>, - __unused4: Padding<*mut c_void>, - __unused5: Padding<*mut c_void>, + __dummy1: Padding, + __dummy2: Padding<[*mut c_void; 5]>, } pub struct ifaddrs { @@ -545,15 +540,10 @@ s! { pub f_files: crate::fsfilcnt_t, pub f_ffree: crate::fsfilcnt_t, pub f_favail: crate::fsfilcnt_t, - #[cfg(target_endian = "little")] - pub f_fsid: c_ulong, - #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] - __f_unused: Padding, - #[cfg(target_endian = "big")] pub f_fsid: c_ulong, pub f_flag: c_ulong, pub f_namemax: c_ulong, - __f_spare: [c_int; 6], + __f_spare: Padding<[c_int; 6]>, } pub struct dqblk { @@ -603,10 +593,7 @@ s! { } pub struct cpu_set_t { - #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] - bits: [u32; 32], - #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))] - bits: [u64; 16], + __bits: [c_ulonglong; 128 / size_of::()], } pub struct if_nameindex { @@ -750,23 +737,10 @@ s! { } pub struct dl_phdr_info { - #[cfg(target_pointer_width = "64")] pub dlpi_addr: Elf64_Addr, - #[cfg(target_pointer_width = "32")] - pub dlpi_addr: Elf32_Addr, - pub dlpi_name: *const c_char, - - #[cfg(target_pointer_width = "64")] pub dlpi_phdr: *const Elf64_Phdr, - #[cfg(target_pointer_width = "32")] - pub dlpi_phdr: *const Elf32_Phdr, - - #[cfg(target_pointer_width = "64")] pub dlpi_phnum: Elf64_Half, - #[cfg(target_pointer_width = "32")] - pub dlpi_phnum: Elf32_Half, - pub dlpi_adds: c_ulonglong, pub dlpi_subs: c_ulonglong, pub dlpi_tls_modid: size_t, @@ -826,7 +800,7 @@ s! { } pub struct sigset_t { - __val: [c_ulong; 16], + __bits: [c_ulong; 128 / size_of::()], } pub struct shmid_ds { @@ -891,15 +865,16 @@ s! { } pub struct sem_t { - __val: [c_int; 8], + _s_value: c_int, + _s_waiters: c_int, } + #[repr(align(8))] pub struct siginfo_t { pub si_signo: c_int, pub si_errno: c_int, pub si_code: c_int, - pub _pad: [c_int; 29], - _align: [usize; 0], + __si_fields: Padding<__c_anonymous_siginfo_t___si_fields>, } #[deprecated( @@ -975,13 +950,14 @@ s! { pub struct sockaddr_storage { pub ss_family: sa_family_t, - __ss_pad2: Padding<[u8; 128 - 2 - 8]>, - __ss_align: size_t, + __ss_padding: + Padding<[c_char; 128 - size_of::() - size_of::()]>, + __ss_align: c_ulong, } pub struct utsname { pub sysname: [c_char; 65], - pub nodename: [c_char; 65], + pub nodename: [c_char; HOST_NAME_MAX as usize + 1], pub release: [c_char; 65], pub version: [c_char; 65], pub machine: [c_char; 65], @@ -989,7 +965,7 @@ s! { } pub struct dirent { - pub d_ino: crate::ino_t, + pub d_ino: ino_t, pub d_off: off_t, pub d_reclen: c_ushort, pub d_type: c_uchar, @@ -1112,12 +1088,75 @@ s_no_extra_traits! { __opaque: [c_char; 16], __align: c_double, } + + pub union __c_anonymous_siginfo_t___si_fields { + __pad: Padding<[c_char; 128 - 2 * size_of::() - size_of::()]>, + __si_common: __c_anonymous___si_fields___si_common, + __sigfault: __c_anonymous___si_fields___sigfault, + __sigpoll: __c_anonymous___si_fields___sigpoll, + __sigsys: __c_anonymous___si_fields___sigsys, + } + + pub struct __c_anonymous___si_fields___si_common { + __first: Padding<__c_anonymous___si_common___first>, + __second: Padding<__c_anonymous___si_common___second>, + } + + pub union __c_anonymous___si_common___first { + __piduid: __c_anonymous___first___piduid, + __timer: __c_anonymous___first___timer, + } + + pub struct __c_anonymous___first___piduid { + si_pid: pid_t, + si_uid: uid_t, + } + + pub struct __c_anonymous___first___timer { + si_timerid: c_int, + si_overrun: c_int, + } + + pub union __c_anonymous___si_common___second { + si_value: sigval, + __sigchld: __c_anonymous___second___sigchld, + } + + pub struct __c_anonymous___second___sigchld { + si_status: c_int, + si_utime: clock_t, + si_stime: clock_t, + } + + pub struct __c_anonymous___si_fields___sigfault { + si_addr: *mut c_void, + si_dadr_lsb: c_short, + __addr_bnd: __c_anonymous___sigfault___addr_bnd, + } + + pub struct __c_anonymous___sigfault___addr_bnd { + si_lower: *mut c_void, + si_upper: *mut c_void, + } + + pub struct __c_anonymous___si_fields___sigpoll { + si_band: c_long, + si_fd: c_int, + } + + pub struct __c_anonymous___si_fields___sigsys { + si_call_addr: *mut c_void, + si_syscall: c_int, + si_arch: c_uint, + } } // PUB_CONST -pub const INT_MIN: c_int = -2147483648; -pub const INT_MAX: c_int = 2147483647; +pub const HOST_NAME_MAX: c_int = 255; + +pub const INT_MIN: c_int = -1 - 0x7fffffff; +pub const INT_MAX: c_int = 0x7fffffff; pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub const SIG_IGN: sighandler_t = 1 as sighandler_t; @@ -3104,29 +3143,34 @@ f! { } pub unsafe fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { - cpuset.bits.fill(0); + cpuset.__bits.fill(0); } pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] |= 1 << offset; + if !(cpu / 8 >= size_of::()) { + cpuset.__bits[cpu / 8 / size_of::()] |= 1 << (cpu % (8 * size_of::())); + } } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] &= !(1 << offset); + if !(cpu / 8 >= size_of::()) { + cpuset.__bits[cpu / 8 / size_of::()] &= + !(1 << (cpu % (8 * size_of::()))); + } } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - 0 != (cpuset.bits[idx] & (1 << offset)) + if !(cpu / 8 >= size_of::()) { + (cpuset.__bits[cpu / 8 / size_of::()] + & (1 << (cpu % (8 * size_of::())))) + != 0 + } else { + false + } } pub unsafe fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { - set1.bits == set2.bits + set1.__bits == set2.__bits } pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { diff --git a/src/fuchsia/riscv64.rs b/src/fuchsia/riscv64.rs index 891a9bde662c..c7b8f08037b7 100644 --- a/src/fuchsia/riscv64.rs +++ b/src/fuchsia/riscv64.rs @@ -1,4 +1,3 @@ -use crate::off_t; use crate::prelude::*; // From psABI Calling Convention for RV64 @@ -23,9 +22,9 @@ s! { pub st_mode: crate::mode_t, pub st_uid: crate::uid_t, pub st_gid: crate::gid_t, - __pad0: Padding, + __pad0: Padding, pub st_rdev: crate::dev_t, - pub st_size: off_t, + pub st_size: crate::off_t, pub st_blksize: crate::blksize_t, pub st_blocks: crate::blkcnt_t, pub st_atime: crate::time_t, diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index d1eadc1df407..2cc06272e281 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -17,7 +17,7 @@ s! { pub st_mode: crate::mode_t, pub st_uid: crate::uid_t, pub st_gid: crate::gid_t, - __pad0: Padding, + __pad0: Padding, pub st_rdev: crate::dev_t, pub st_size: off_t, pub st_blksize: crate::blksize_t, From b1fe31b388e7031c7a37caaef5bded8335ee16cd Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:51 +0200 Subject: [PATCH 49/93] fuchsia: fix `bits/signal.h` types Fix definition of types in x86_64. `mcontext_t` provided opaque field. `ucontext_t` had a slightly wrong definition. New records have been introduced. They are particular to `mcontext_t`. Add definitions in AArch64 and RISC-V64. They were missing. They are different for all three target architectures. These are declared in [^1]. [^1]: https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/bits/signal.h;drc=bbff36aa507d5be390c5f09c8939bc3b7a2ebaf9 (backport ) (cherry picked from commit 92330f5a730975043b0309b4d2c6f0b32d5c17fa) --- src/fuchsia/aarch64.rs | 19 ++++++++++++++++ src/fuchsia/riscv64.rs | 12 +++++++++++ src/fuchsia/x86_64.rs | 49 +++++++++++++++++++++++++++++++++--------- 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs index 01fd37f381b6..690c62f277c2 100644 --- a/src/fuchsia/aarch64.rs +++ b/src/fuchsia/aarch64.rs @@ -74,6 +74,25 @@ s! { __unused1: Padding, __unused2: Padding, } + + // FIXME(f128): __reserved is meant to be an array of `long double`s. That + // requires native support for `f128`. This is currently missing. + pub struct mcontext_t { + pub fault_address: c_ulong, + pub regs: [c_ulong; 31], + pub sp: c_ulong, + pub pc: c_ulong, + pub pstate: c_ulong, + __reserved: Padding<[i128; 256]>, + } + + pub struct ucontext_t { + pub uc_flags: c_ulong, + pub uc_link: *mut crate::ucontext_t, + pub uc_stack: crate::stack_t, + pub uc_sigmask: crate::sigset_t, + pub uc_mcontext: crate::mcontext_t, + } } // From https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/bits/signal.h;l=20-21;drc=0827b18ab9540c46f8037f407d17ea15a79e9ba7 diff --git a/src/fuchsia/riscv64.rs b/src/fuchsia/riscv64.rs index c7b8f08037b7..75ecea9adffa 100644 --- a/src/fuchsia/riscv64.rs +++ b/src/fuchsia/riscv64.rs @@ -53,4 +53,16 @@ s! { __unused1: Padding, __unused2: Padding, } + + pub struct mcontext_t { + pub regs: [c_ulong; 32], + } + + pub struct ucontext_t { + pub uc_flags: c_ulong, + pub uc_link: *mut crate::ucontext_t, + pub uc_stack: crate::stack_t, + pub uc_sigmask: crate::sigset_t, + pub uc_mcontext: crate::mcontext_t, + } } diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index 2cc06272e281..ab9927eb0997 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -9,7 +9,34 @@ pub type wchar_t = i32; )] pub type __u64 = c_ulonglong; +pub type gregset_t = [c_ulonglong; 23]; +pub type fpregset_t = *mut _fpstate; + s! { + pub struct _fpstate { + pub cwd: c_ushort, + pub swd: c_ushort, + pub ftw: c_ushort, + pub fop: c_ushort, + pub rip: c_ulonglong, + pub rdp: c_ulonglong, + pub mxcsr: c_uint, + pub mxcr_mask: c_uint, + pub _st: [__c_anonymous__fpstate__st; 8], + pub _xmm: [__c_anonymous__fpstate__xmm; 16], + padding: Padding<[c_uint; 24]>, + } + + pub struct __c_anonymous__fpstate__st { + pub significand: [c_ushort; 4], + pub exponent: c_ushort, + padding: Padding<[c_ushort; 3]>, + } + + pub struct __c_anonymous__fpstate__xmm { + pub element: [c_uint; 4], + } + pub struct stat { pub st_dev: crate::dev_t, pub st_ino: crate::ino_t, @@ -58,7 +85,18 @@ s! { } pub struct mcontext_t { - __private: [u64; 32], + pub gregs: crate::gregset_t, + pub fpregs: crate::fpregset_t, + __reserved1: Padding<[c_ulonglong; 8]>, + } + + pub struct ucontext_t { + pub uc_flags: c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: crate::stack_t, + pub uc_mcontext: crate::mcontext_t, + pub uc_sigmask: crate::sigset_t, + __fpregs_mem: [c_ulong; 64], } #[deprecated( @@ -77,15 +115,6 @@ s! { __unused1: Padding, __unused2: Padding, } - - pub struct ucontext_t { - pub uc_flags: c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: crate::stack_t, - pub uc_mcontext: mcontext_t, - pub uc_sigmask: crate::sigset_t, - __private: [u8; 512], - } } // offsets in user_regs_structs, from sys/reg.h From 2141723e5a6d898d5e704f69621128abcb23411e Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 3 Aug 2026 09:02:52 +0200 Subject: [PATCH 50/93] fuchsia: fix `pthread.h` definitions Remove opaque types. Replace with proper fields. Remove conditional defintion for 32-bit targets. Fuchsia has no 32-bit targets. Static initializers needed modification. They are specified as `{ 0 }` in POSIX for C. The new definition replicates that. It zeroes/nullifies the new fields. Constants were used to initialize the previous opaque array. These have been deprecated. These are declared in [^1]. [^1]: https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/pthread.h;drc=e577fd0e9d34337a36d410aa89866c77ee95493c (backport ) (cherry picked from commit 41125cb02f9661f3e816ca42de331b47590e711f) --- src/fuchsia/mod.rs | 117 ++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 55 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index fe706d3525cb..bb139ba1d43b 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -796,7 +796,15 @@ s! { } pub struct pthread_attr_t { - __size: [u64; 7], + __name: *const c_char, + __c11: c_int, + _a_stacksize: crate::size_t, + _a_guardsize: crate::size_t, + _a_stackaddr: *mut c_void, + _a_detach: c_int, + _a_sched: c_int, + _a_policy: c_int, + _a_prio: c_int, } pub struct sigset_t { @@ -898,27 +906,16 @@ s! { pub ipi6_ifindex: c_uint, } - #[cfg_attr( - any(target_pointer_width = "32", target_arch = "x86_64"), - repr(align(4)) - )] - #[cfg_attr( - not(any(target_pointer_width = "32", target_arch = "x86_64")), - repr(align(8)) - )] pub struct pthread_mutexattr_t { - size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T], + __attr: c_uint, } - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] pub struct pthread_rwlockattr_t { - size: [u8; crate::__SIZEOF_PTHREAD_RWLOCKATTR_T], + __attr: [c_uint; 2], } - #[repr(align(4))] pub struct pthread_condattr_t { - size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T], + __attr: c_uint, } #[deprecated( @@ -1033,53 +1030,28 @@ s! { pub sigev_value: crate::sigval, pub sigev_signo: c_int, pub sigev_notify: c_int, - pub sigev_notify_function: fn(crate::sigval), + pub sigev_notify_function: Option, pub sigev_notify_attributes: *mut pthread_attr_t, - pub __pad: [c_char; 56 - 3 * 8], + __pad: Padding<[c_char; 56 - 3 * size_of::()]>, } - #[cfg_attr( - all( - target_pointer_width = "32", - any(target_arch = "arm", target_arch = "x86_64") - ), - repr(align(4)) - )] - #[cfg_attr( - any( - target_pointer_width = "64", - not(any(target_arch = "arm", target_arch = "x86_64")) - ), - repr(align(8)) - )] pub struct pthread_mutex_t { - size: [u8; crate::__SIZEOF_PTHREAD_MUTEX_T], + _m_attr: c_uint, + _m_lock: c_int, + _m_waiters: c_int, + _m_count: c_int, } - #[cfg_attr( - all( - target_pointer_width = "32", - any(target_arch = "arm", target_arch = "x86_64") - ), - repr(align(4)) - )] - #[cfg_attr( - any( - target_pointer_width = "64", - not(any(target_arch = "arm", target_arch = "x86_64")) - ), - repr(align(8)) - )] pub struct pthread_rwlock_t { - size: [u8; crate::__SIZEOF_PTHREAD_RWLOCK_T], + _rw_lock: c_int, + _rw_waiters: c_int, } - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_arch = "x86", repr(align(4)))] - #[cfg_attr(not(target_arch = "x86"), repr(align(8)))] pub struct pthread_cond_t { - size: [u8; crate::__SIZEOF_PTHREAD_COND_T], + _c_head: *mut c_void, + _c_clock: c_int, + _c_tail: *mut c_void, + _c_lock: c_int, } } @@ -2172,13 +2144,20 @@ pub const RTLD_NOW: c_int = 0x2; pub const TCP_MD5SIG: c_int = 14; pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - size: [0; __SIZEOF_PTHREAD_MUTEX_T], + _m_attr: 0, + _m_lock: 0, + _m_waiters: 0, + _m_count: 0, }; pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - size: [0; __SIZEOF_PTHREAD_COND_T], + _c_head: ptr::null_mut(), + _c_clock: 0, + _c_tail: ptr::null_mut(), + _c_lock: 0, }; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - size: [0; __SIZEOF_PTHREAD_RWLOCK_T], + _rw_lock: 0, + _rw_waiters: 0, }; pub const PTHREAD_MUTEX_NORMAL: c_int = 0; pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1; @@ -2186,6 +2165,11 @@ pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2; pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL; pub const PTHREAD_PROCESS_PRIVATE: c_int = 0; pub const PTHREAD_PROCESS_SHARED: c_int = 1; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub const __SIZEOF_PTHREAD_COND_T: usize = 48; pub const RENAME_NOREPLACE: c_int = 1; @@ -2711,8 +2695,22 @@ pub const TCP_TIMESTAMP: c_int = 24; pub const SIGUNUSED: c_int = crate::SIGSYS; +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; pub const CPU_SETSIZE: c_int = 128; @@ -2851,7 +2849,16 @@ pub const B3000000: crate::speed_t = 0o010015; pub const B3500000: crate::speed_t = 0o010016; pub const B4000000: crate::speed_t = 0o010017; +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; + +#[deprecated( + since = "0.2.189", + note = "This type does not exist upstream and will eventually be removed." +)] pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const O_ASYNC: c_int = 0x00000400; From d4d79d2f4eb131f058e6db58ef8804e6bf668d39 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 25 Jul 2026 08:41:59 +0200 Subject: [PATCH 51/93] newlib: change definition of `time_t` Replace `time_t` definition in `newlib` for certain targets. This option is configurable in upstream newlib [^1] and some targets seem to have it enabled in their build scripts. Effective changes include the following. OS | old | new | effective change -----------------------------------|-------------|--------|--------------------------- risc32/xtensa32-espidf time32 | `i32` | `long` | alias only, no size change risc32/xtensa32-espidf not(time32) | `long long` | `i64` | alias only, no size change arm32-horizon | `long long` | `i64` | alias only, no size change arm32-rtems | `i32` | `i64` | ABI change, 32->64 bits arm32-vita | `i32` | `long` | alias only, no size change [^1]: https://github.com/cygwin/cygwin/blob/41e6325ad64fa00f5e61e25c2020a8bc716c29a0/newlib/README#L351 (backport ) (cherry picked from commit 8805480027e156d8c0fe19d7219acf41f9f69b17) --- src/unix/newlib/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 473bb543029f..563f4bf5f62a 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -55,12 +55,12 @@ pub type useconds_t = u32; cfg_if! { if #[cfg(any( - target_os = "horizon", - all(target_os = "espidf", not(espidf_time32)) + all(target_os = "espidf", espidf_time32), + target_os = "vita" ))] { - pub type time_t = c_longlong; + pub type time_t = c_long; } else { - pub type time_t = i32; + pub type time_t = i64; } } From 279c58afdf185fd10a9c8120c6e25f909875d1ab Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 25 Jul 2026 08:41:57 +0200 Subject: [PATCH 52/93] newlib: change definition of file offset types Use mirrored definition of file offset types in `vita` target. Effective changes include the following. OS | ty | old | new | effective change -----------------------|---------|------------------|------------------|--------------------------- risc32/xtensa32-espidf | `dev_t` | `short` | `short` | none arm32-horizon | `dev_t` | `u32` | `u32` | none arm32-rtems | `dev_t` | `u32` | `u32` | none arm32-vita | `dev_t` | `short` | `short` | none -----------------------|---------|------------------|------------------|--------------------------- risc32/xtensa32-espidf | `ino_t` | `unsigned short` | `unsigned short` | none arm32-horizon | `ino_t` | `u32` | `u32` | none arm32-rtems | `ino_t` | `u32` | `u32` | none arm32-vita | `ino_t` | `unsigned short` | `unsigned short` | none -----------------------|---------|------------------|------------------|--------------------------- risc32/xtensa32-espidf | `off_t` | `long` | `long` | none arm32-horizon | `off_t` | `i64` | `i64` | none arm32-rtems | `off_t` | `i64` | `i64` | none arm32-vita | `off_t` | `int` | `long` | alias only, no size change (backport ) (cherry picked from commit e2811e47db1e29170c4e19c3a9b980d10639550b) --- src/unix/newlib/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 563f4bf5f62a..6d5d0edac795 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -6,14 +6,14 @@ pub type blksize_t = i32; pub type clockid_t = c_ulong; cfg_if! { - if #[cfg(any(target_os = "espidf"))] { + if #[cfg(any( + target_os = "espidf", + target_os = "vita", + target_arch = "aarch64" + ))] { pub type dev_t = c_short; pub type ino_t = c_ushort; pub type off_t = c_long; - } else if #[cfg(any(target_os = "vita"))] { - pub type dev_t = c_short; - pub type ino_t = c_ushort; - pub type off_t = c_int; } else { pub type dev_t = u32; pub type ino_t = u32; From e406d3af940af58c9179df736d770fb03d271506 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 25 Jul 2026 08:41:56 +0200 Subject: [PATCH 53/93] newlib: remove `aarch64` bindings Remove AArch64 bindigns in newlib. Rust has no officially supported target using newlib in AArch64. (backport ) (cherry picked from commit 44f796d156df0ca8581d059a12fe8e60a21c96d7) --- src/unix/newlib/aarch64/mod.rs | 56 ---------------------------------- src/unix/newlib/mod.rs | 9 +----- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 src/unix/newlib/aarch64/mod.rs diff --git a/src/unix/newlib/aarch64/mod.rs b/src/unix/newlib/aarch64/mod.rs deleted file mode 100644 index 56c268fc5f2b..000000000000 --- a/src/unix/newlib/aarch64/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -use crate::prelude::*; - -pub type clock_t = c_long; -pub type wchar_t = u32; - -s! { - pub struct sockaddr { - pub sa_len: u8, - pub sa_family: crate::sa_family_t, - pub sa_data: [c_char; 14], - } - - pub struct sockaddr_in6 { - pub sin6_len: u8, - pub sin6_family: crate::sa_family_t, - pub sin6_port: crate::in_port_t, - pub sin6_flowinfo: u32, - pub sin6_addr: crate::in6_addr, - pub sin6_scope_id: u32, - } - - pub struct sockaddr_in { - pub sin_len: u8, - pub sin_family: crate::sa_family_t, - pub sin_port: crate::in_port_t, - pub sin_addr: crate::in_addr, - pub sin_zero: [c_char; 8], - } -} - -pub const AF_INET6: c_int = 23; - -pub const FIONBIO: c_ulong = 1; - -pub const POLLIN: c_short = 0x1; -pub const POLLPRI: c_short = 0x2; -pub const POLLOUT: c_short = 0x4; -pub const POLLERR: c_short = 0x8; -pub const POLLHUP: c_short = 0x10; -pub const POLLNVAL: c_short = 0x20; - -pub const SOL_SOCKET: c_int = 65535; - -pub const MSG_OOB: c_int = 1; -pub const MSG_PEEK: c_int = 2; -pub const MSG_DONTWAIT: c_int = 4; -pub const MSG_DONTROUTE: c_int = 0; -pub const MSG_WAITALL: c_int = 0; -pub const MSG_MORE: c_int = 0; -pub const MSG_NOSIGNAL: c_int = 0; - -pub use crate::unix::newlib::generic::{ - dirent, - sigset_t, - stat, -}; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 6d5d0edac795..2374b0dd2070 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -6,11 +6,7 @@ pub type blksize_t = i32; pub type clockid_t = c_ulong; cfg_if! { - if #[cfg(any( - target_os = "espidf", - target_os = "vita", - target_arch = "aarch64" - ))] { + if #[cfg(any(target_os = "espidf", target_os = "vita"))] { pub type dev_t = c_short; pub type ino_t = c_ushort; pub type off_t = c_long; @@ -955,9 +951,6 @@ cfg_if! { } else if #[cfg(target_arch = "arm")] { mod arm; pub use self::arm::*; - } else if #[cfg(target_arch = "aarch64")] { - mod aarch64; - pub use self::aarch64::*; } else if #[cfg(target_arch = "powerpc")] { mod powerpc; pub use self::powerpc::*; From 769cd96ff430ab4f3d080a0fe25a19a88e1f3769 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 25 Jul 2026 08:41:55 +0200 Subject: [PATCH 54/93] newlib: enforce file off tys in supported targets Force a compile error on targets with no file offset type definitions. This ensures any new target needs providing defintions for these types. (backport ) (cherry picked from commit f939290b070783b92fd2b7f58ccaa6415b7611cf) --- src/unix/newlib/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 2374b0dd2070..9939f30689d3 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -10,10 +10,12 @@ cfg_if! { pub type dev_t = c_short; pub type ino_t = c_ushort; pub type off_t = c_long; - } else { + } else if #[cfg(any(target_arch = "arm", target_arch = "powerpc"))] { pub type dev_t = u32; pub type ino_t = u32; pub type off_t = i64; + } else { + core::compile_error!("unsupported target"); } } From 6aa311b7298c082c74a54f7674f7450450d1178d Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 25 Jul 2026 08:41:54 +0200 Subject: [PATCH 55/93] newlib: move `generic` module definitions Move the `generic` module into the top-level `newlib` module. They were already reexported by all supported targets in their respective modules. These types were also conditionally defined anyway. (backport ) (cherry picked from commit c1fbd962a48553889268ad0f082d211af3ebeab3) --- src/unix/newlib/arm/mod.rs | 6 ------ src/unix/newlib/espidf/mod.rs | 6 ------ src/unix/newlib/horizon/mod.rs | 2 -- src/unix/newlib/mod.rs | 32 ++++++++++++++++++++++++++++++-- src/unix/newlib/powerpc/mod.rs | 6 ------ 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/unix/newlib/arm/mod.rs b/src/unix/newlib/arm/mod.rs index 9b5978fc538c..a559cf4da59f 100644 --- a/src/unix/newlib/arm/mod.rs +++ b/src/unix/newlib/arm/mod.rs @@ -50,9 +50,3 @@ pub const MSG_DONTROUTE: c_int = 0; pub const MSG_WAITALL: c_int = 0; pub const MSG_MORE: c_int = 0; pub const MSG_NOSIGNAL: c_int = 0; - -pub use crate::unix::newlib::generic::{ - dirent, - sigset_t, - stat, -}; diff --git a/src/unix/newlib/espidf/mod.rs b/src/unix/newlib/espidf/mod.rs index b791bbe26536..f108ab82bf93 100644 --- a/src/unix/newlib/espidf/mod.rs +++ b/src/unix/newlib/espidf/mod.rs @@ -129,9 +129,3 @@ extern "C" { pub fn eventfd(initval: c_uint, flags: c_int) -> c_int; } - -pub use crate::unix::newlib::generic::{ - dirent, - sigset_t, - stat, -}; diff --git a/src/unix/newlib/horizon/mod.rs b/src/unix/newlib/horizon/mod.rs index a357f8e3a7be..ab0956ef7042 100644 --- a/src/unix/newlib/horizon/mod.rs +++ b/src/unix/newlib/horizon/mod.rs @@ -282,5 +282,3 @@ extern "C" { pub fn gethostid() -> c_long; } - -pub use crate::unix::newlib::generic::dirent; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 9939f30689d3..25d421ad2b5a 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -323,6 +323,36 @@ s! { // Unverified size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T], } + + #[cfg(all(not(target_os = "vita"), not(target_os = "horizon")))] + pub struct sigset_t { + __val: u32, + } + + #[cfg(not(target_os = "vita"))] + pub struct stat { + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, + pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, + pub st_rdev: crate::dev_t, + pub st_size: crate::off_t, + pub st_atim: crate::timespec, + pub st_mtim: crate::timespec, + pub st_ctim: crate::timespec, + pub st_blksize: crate::blksize_t, + pub st_blocks: crate::blkcnt_t, + pub st_spare4: [c_long; 2usize], + } + + #[cfg(not(target_os = "vita"))] + pub struct dirent { + pub d_ino: crate::ino_t, + pub d_type: c_uchar, + pub d_name: [c_char; 256usize], + } } // unverified constants @@ -938,8 +968,6 @@ extern "C" { pub fn uname(buf: *mut crate::utsname) -> c_int; } -mod generic; - cfg_if! { if #[cfg(target_os = "espidf")] { mod espidf; diff --git a/src/unix/newlib/powerpc/mod.rs b/src/unix/newlib/powerpc/mod.rs index f51a1b2cbe60..002130d1a619 100644 --- a/src/unix/newlib/powerpc/mod.rs +++ b/src/unix/newlib/powerpc/mod.rs @@ -3,12 +3,6 @@ use crate::prelude::*; pub type clock_t = c_ulong; pub type wchar_t = c_int; -pub use crate::unix::newlib::generic::{ - dirent, - sigset_t, - stat, -}; - // the newlib shipped with devkitPPC does not support the following components: // - sockaddr // - AF_INET6 From 5d1701a3d373278b9f6cc4d4b4f38ae687142003 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 25 Jul 2026 08:41:46 +0200 Subject: [PATCH 56/93] newlib: remove `powerpc` bindings Remove PowerPC definitions. There's no Rust target using newlib on PowerPC. (backport ) (cherry picked from commit 141b44bde43d5fdf875c58a265c9efc2bdecd5b1) --- src/unix/newlib/mod.rs | 7 +------ src/unix/newlib/powerpc/mod.rs | 12 ------------ 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 src/unix/newlib/powerpc/mod.rs diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 25d421ad2b5a..ab12da1d6fe0 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -981,13 +981,8 @@ cfg_if! { } else if #[cfg(target_arch = "arm")] { mod arm; pub use self::arm::*; - } else if #[cfg(target_arch = "powerpc")] { - mod powerpc; - pub use self::powerpc::*; } else { - // Only tested on ARM so far. Other platforms might have different - // definitions for types and constants. - pub use target_arch_not_implemented; + core::compile_error!("unsupported target"); } } diff --git a/src/unix/newlib/powerpc/mod.rs b/src/unix/newlib/powerpc/mod.rs deleted file mode 100644 index 002130d1a619..000000000000 --- a/src/unix/newlib/powerpc/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -use crate::prelude::*; - -pub type clock_t = c_ulong; -pub type wchar_t = c_int; - -// the newlib shipped with devkitPPC does not support the following components: -// - sockaddr -// - AF_INET6 -// - FIONBIO -// - POLL* -// - SOL_SOCKET -// - MSG_* From 114bbc473a1de857ca10794f8cd778078366cbeb Mon Sep 17 00:00:00 2001 From: Sergii Bogomolov Date: Thu, 23 Jul 2026 22:04:58 +0200 Subject: [PATCH 57/93] linux: add `NLMSG_*` helpers (backport ) (cherry picked from commit 11f779b007a9e2c330729f63870603910f04a2c6) --- libc-test/build.rs | 3 + libc-test/semver/linux.txt | 7 ++ libc-test/src/nlmsg.c | 35 +++++++++ libc-test/tests/nlmsg.rs | 108 ++++++++++++++++++++++++++++ src/new/linux_uapi/linux/netlink.rs | 41 +++++++++++ 5 files changed, 194 insertions(+) create mode 100644 libc-test/src/nlmsg.c create mode 100644 libc-test/tests/nlmsg.rs diff --git a/libc-test/build.rs b/libc-test/build.rs index e6a8ddca2fd1..84229bded8c4 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -56,6 +56,9 @@ fn do_cc() { if target.contains("android") || (target.contains("linux") && !target.contains("wasm32")) { cc::Build::new().file("src/errqueue.c").compile("errqueue"); } + if target.contains("linux") && !target.contains("android") && !target.contains("wasm32") { + cc::Build::new().file("src/nlmsg.c").compile("nlmsg"); + } if (target.contains("linux") && !target.contains("wasm32")) || target.contains("l4re") || target.contains("android") diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 3fd80eac8297..e15b6c0d9d68 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -2145,11 +2145,18 @@ NLA_F_NESTED NLA_F_NET_BYTEORDER NLA_TYPE_MASK NLDLY +NLMSG_ALIGN +NLMSG_DATA NLMSG_DONE NLMSG_ERROR +NLMSG_LENGTH NLMSG_MIN_TYPE +NLMSG_NEXT NLMSG_NOOP +NLMSG_OK NLMSG_OVERRUN +NLMSG_PAYLOAD +NLMSG_SPACE NLM_F_ACK NLM_F_ACK_TLVS NLM_F_APPEND diff --git a/libc-test/src/nlmsg.c b/libc-test/src/nlmsg.c new file mode 100644 index 000000000000..a10c61b9b6c2 --- /dev/null +++ b/libc-test/src/nlmsg.c @@ -0,0 +1,35 @@ +#include +#include + +// Since the NLMSG_* helpers are macros instead of functions, they aren't +// available to FFI. libc must reimplement them, which is error-prone. This +// file provides FFI access to the actual macros so they can be tested against +// the Rust reimplementation. + +int nlmsg_align_ffi(size_t size) { + return NLMSG_ALIGN(size); +} + +int nlmsg_length_ffi(size_t size) { + return NLMSG_LENGTH(size); +} + +int nlmsg_space_ffi(size_t size) { + return NLMSG_SPACE(size); +} + +void *nlmsg_data_ffi(struct nlmsghdr *nlh) { + return NLMSG_DATA(nlh); +} + +struct nlmsghdr *nlmsg_next_ffi(struct nlmsghdr *nlh, int *size) { + return NLMSG_NEXT(nlh, *size); +} + +int nlmsg_ok_ffi(struct nlmsghdr *nlh, int size) { + return NLMSG_OK(nlh, size); +} + +int nlmsg_payload_ffi(struct nlmsghdr *nlh, int size) { + return NLMSG_PAYLOAD(nlh, size); +} diff --git a/libc-test/tests/nlmsg.rs b/libc-test/tests/nlmsg.rs new file mode 100644 index 000000000000..5d33e2165355 --- /dev/null +++ b/libc-test/tests/nlmsg.rs @@ -0,0 +1,108 @@ +//! Compare libc's NLMSG_* functions against the actual C macros, for various inputs. + +#![cfg(target_os = "linux")] + +use libc::{ + self, + c_int, + c_void, + nlmsghdr, + size_t, +}; + +extern "C" { + fn nlmsg_align_ffi(size: size_t) -> c_int; + fn nlmsg_length_ffi(size: size_t) -> c_int; + fn nlmsg_space_ffi(size: size_t) -> c_int; + fn nlmsg_data_ffi(nlh: *mut nlmsghdr) -> *mut c_void; + fn nlmsg_next_ffi(nlh: *mut nlmsghdr, size: *mut c_int) -> *mut nlmsghdr; + fn nlmsg_ok_ffi(nlh: *mut nlmsghdr, size: c_int) -> c_int; + fn nlmsg_payload_ffi(nlh: *mut nlmsghdr, size: c_int) -> c_int; +} + +#[test] +fn test_sizes() { + for size in [0, 1, 2, 3, 4, 5, 15, 16, 17, 100, 4095, 4096] { + assert_eq!(libc::NLMSG_ALIGN(size), unsafe { nlmsg_align_ffi(size) }); + assert_eq!(libc::NLMSG_LENGTH(size), unsafe { nlmsg_length_ffi(size) }); + assert_eq!(libc::NLMSG_SPACE(size), unsafe { nlmsg_space_ffi(size) }); + } +} + +/// Write message headers with lengths `lens` into `buf`, at NLMSG_ALIGN spacing. +/// +/// `[u32]` keeps the buffer 4-byte aligned for `nlmsghdr`; NLMSG_ALIGN keeps every +/// message offset a multiple of 4, so each header dereference stays aligned. +fn fill(buf: &mut [u32], lens: &[u32]) -> c_int { + let mut total = 0; + for len in lens { + assert!(total + size_of::() <= size_of_val(buf)); + let hdr = nlmsghdr { + nlmsg_len: *len, + nlmsg_type: 0, + nlmsg_flags: 0, + nlmsg_seq: 0, + nlmsg_pid: 0, + }; + unsafe { + buf.as_mut_ptr() + .cast::() + .add(total) + .cast::() + .write(hdr); + } + total += libc::NLMSG_ALIGN(*len as size_t) as usize; + } + assert!(total <= size_of_val(buf)); + total as c_int +} + +// Walk a multipart message with the Rust and C implementations in lockstep, +// comparing every step. +#[test] +fn test_walk() { + let mut buf = [0u32; 32]; + let total = fill(&mut buf, &[21, 16, 30]); + + let mut nlh = buf.as_mut_ptr().cast::(); + let mut len = total; + let mut len_c = total; + let mut seen = 0; + loop { + let ok = unsafe { libc::NLMSG_OK(nlh, len) }; + assert_eq!(ok, unsafe { nlmsg_ok_ffi(nlh, len_c) } != 0); + if !ok { + break; + } + unsafe { + assert_eq!(libc::NLMSG_DATA(nlh), nlmsg_data_ffi(nlh)); + for size in [0, 4, 8] { + assert_eq!(libc::NLMSG_PAYLOAD(nlh, size), nlmsg_payload_ffi(nlh, size)); + } + } + let next = unsafe { libc::NLMSG_NEXT(nlh, &mut len) }; + let next_c = unsafe { nlmsg_next_ffi(nlh, &mut len_c) }; + assert_eq!(next, next_c); + assert_eq!(len, len_c); + nlh = next; + seen += 1; + } + assert_eq!(seen, 3); + assert_eq!(len, 0); +} + +// Boundary cases for the validity check: exact fit, short buffer, truncated +// header, message longer than the remaining buffer. +#[test] +fn test_ok_boundaries() { + let mut buf = [0u32; 32]; + for (nlmsg_len, len) in [(16, 16), (16, 15), (8, 16), (100, 16)] { + fill(&mut buf, &[nlmsg_len]); + let nlh = buf.as_mut_ptr().cast::(); + assert_eq!( + unsafe { libc::NLMSG_OK(nlh, len) }, + unsafe { nlmsg_ok_ffi(nlh, len) } != 0, + "nlmsg_len={nlmsg_len} len={len}" + ); + } +} diff --git a/src/new/linux_uapi/linux/netlink.rs b/src/new/linux_uapi/linux/netlink.rs index eb78ecac964d..2e517dae1476 100644 --- a/src/new/linux_uapi/linux/netlink.rs +++ b/src/new/linux_uapi/linux/netlink.rs @@ -67,6 +67,47 @@ pub const NLM_F_NONREC: c_int = 0x100; pub const NLM_F_CAPPED: c_int = 0x100; pub const NLM_F_ACK_TLVS: c_int = 0x200; +const NLMSG_ALIGNTO: c_uint = 4; + +const NLMSG_HDRLEN: c_int = NLMSG_ALIGN(size_of::()); + +f! { + pub const safe fn NLMSG_ALIGN(size: size_t) -> c_int { + ((size + NLMSG_ALIGNTO as size_t - 1) & !(NLMSG_ALIGNTO as size_t - 1)) as c_int + } + + pub const safe fn NLMSG_LENGTH(size: size_t) -> c_int { + size as c_int + NLMSG_HDRLEN + } + + pub const safe fn NLMSG_SPACE(size: size_t) -> c_int { + NLMSG_ALIGN(NLMSG_LENGTH(size) as size_t) + } + + pub unsafe fn NLMSG_DATA(nlh: *mut nlmsghdr) -> *mut c_void { + nlh.cast::() + .wrapping_add(NLMSG_HDRLEN as usize) + .cast::() + } + + pub unsafe fn NLMSG_NEXT(nlh: *mut nlmsghdr, size: &mut c_int) -> *mut nlmsghdr { + *size -= NLMSG_ALIGN((*nlh).nlmsg_len as size_t); + nlh.cast::() + .wrapping_add(NLMSG_ALIGN((*nlh).nlmsg_len as size_t) as usize) + .cast::() + } + + pub unsafe fn NLMSG_OK(nlh: *const nlmsghdr, size: c_int) -> bool { + size >= size_of::() as c_int + && (*nlh).nlmsg_len >= size_of::() as c_uint + && (*nlh).nlmsg_len <= size as c_uint + } + + pub unsafe fn NLMSG_PAYLOAD(nlh: *const nlmsghdr, size: c_int) -> c_int { + (*nlh).nlmsg_len as c_int - NLMSG_SPACE(size as size_t) + } +} + pub const NLMSG_NOOP: c_int = 0x1; pub const NLMSG_ERROR: c_int = 0x2; pub const NLMSG_DONE: c_int = 0x3; From 3dc9c53e41115093779af1f366786332019f7c6c Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 1 Aug 2026 13:58:41 +0200 Subject: [PATCH 58/93] haiku: remove redundant `union` skips Remove check for `cpuid_info` as a `union` as that dates back to the times where Rust didn't itself have `union`s so this type had to be implemented as a `struct`. Skipping it in libc-test's build script is redundant. The same applies to `cpu_topology_node_info`. (backport ) (cherry picked from commit 12fe28de091baa3f4fdaa9b4232a20334215cf3a) --- libc-test/build.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 84229bded8c4..2fd94cf300db 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -5869,9 +5869,6 @@ fn test_haiku(target: &str) { "Elf64_Phdr" => true, - // is an union - "cpuid_info" => true, - _ => false, } }); @@ -5962,7 +5959,6 @@ fn test_haiku(target: &str) { ("sigaction", "sa_sigaction") => true, ("sigevent", "sigev_value") => true, ("fpu_state", "_fpreg") => true, - ("cpu_topology_node_info", "data") => true, // these fields have a simplified data definition in libc ("fpu_state", "_xmm") => true, ("savefpu", "_fp_ymm") => true, From b6b6697f9a73db30e8a0f50513737f2471cbbf63 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 1 Aug 2026 18:30:14 +0200 Subject: [PATCH 59/93] haiku: fill in full definition for `sem_t` Replace dummy field for `union` with an actual definition fitting that of the upstream type. The current (pre-patch) field corresponded with the times back when Rust didn't have `union`s. Now it's not necessary anymore to expose only a single field of the `union`. The corresponding skip in libc-test's build script has also been removed. (backport ) (cherry picked from commit 97ad3772174208e4b93f8eadaaef5f78f4c0e66b) --- libc-test/build.rs | 1 - src/unix/haiku/mod.rs | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 2fd94cf300db..eb1ad8105bfc 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -5955,7 +5955,6 @@ fn test_haiku(target: &str) { // these are actually unions, but we cannot represent it well ("siginfo_t", "sigval") => true, - ("sem_t", "named_sem_id") => true, ("sigaction", "sa_sigaction") => true, ("sigevent", "sigev_value") => true, ("fpu_state", "_fpreg") => true, diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 0e7b0203308f..72be53de152f 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -368,12 +368,6 @@ s! { sa_userdata: *mut c_void, } - pub struct sem_t { - pub type_: i32, - pub named_sem_id: i32, // actually a union with unnamed_sem (i32) - padding: Padding<[i32; 2]>, - } - pub struct ucred { pub pid: crate::pid_t, pub uid: crate::uid_t, @@ -499,6 +493,19 @@ s! { } } +s_no_extra_traits! { + pub struct sem_t { + pub type_: i32, + pub named_sem_id: __c_anonymous_sem_t_u, + padding: Padding<[i32; 2]>, + } + + pub union __c_anonymous_sem_t_u { + pub named_sem_id: i32, + pub unnamed_sem: i32, + } +} + pub const EXIT_FAILURE: c_int = 1; pub const EXIT_SUCCESS: c_int = 0; pub const RAND_MAX: c_int = 2147483647; From c7b14076b12ec31c58693399a670687f8923cb32 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 1 Aug 2026 18:52:56 +0200 Subject: [PATCH 60/93] hexagon: remove redundant `union` skip Remove a skip over `sigaction` in Hexagon QuRT as it seems the separate fields in Rust mentioned in libc-test's build script's skip aligns well with the (also) split fields upstream. See header file `posix/signal.h` under `rtos/qurt/computev81` in the Hexagon SDK. (backport ) (cherry picked from commit 96baf11494cd98d45c414a3d860ed35f501b97ec) --- libc-test/build.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index eb1ad8105bfc..89a4af49131d 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -6363,8 +6363,6 @@ fn test_qurt(target: &str) { // These are compatibility stubs in libc, not from QuRT headers "stat" | "tm" | "timespec" | "timeval" | "itimerspec" | "dirent" | "DIR" | "termios" | "rlimit" | "rusage" | "flock" | "div_t" | "ldiv_t" | "lldiv_t" => true, - // sigaction: sa_handler/sa_sigaction are a union in C but separate fields in Rust - "sigaction" => true, // sem_t is typedef of anonymous struct in C (no struct tag) "sem_t" => true, _ => false, From 554945e3b47b065f1f28892d4287c76f71bf42dc Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Sat, 1 Aug 2026 18:55:32 +0200 Subject: [PATCH 61/93] hexagon: remove possibly redundant skip on `sem_t` Remove skip over `sem_t` in Hexagon QuRT as it alleged to this being a `typedef` of an anonymous `struct`, but that also happens in other targets we test against without there being skips for their records. See header file `posix/semaphore.h` under `rtos/qurt/computev81` in the Hexagon SDK for details. (backport ) (cherry picked from commit 471be3d9247ddfa17e5c2139397db10b181f73a7) --- libc-test/build.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 89a4af49131d..f83334398936 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -6363,8 +6363,6 @@ fn test_qurt(target: &str) { // These are compatibility stubs in libc, not from QuRT headers "stat" | "tm" | "timespec" | "timeval" | "itimerspec" | "dirent" | "DIR" | "termios" | "rlimit" | "rusage" | "flock" | "div_t" | "ldiv_t" | "lldiv_t" => true, - // sem_t is typedef of anonymous struct in C (no struct tag) - "sem_t" => true, _ => false, } }); From a582a7f2b53ae369aac5592977eadcb39a0fe5be Mon Sep 17 00:00:00 2001 From: telcharr Date: Mon, 3 Aug 2026 20:22:22 -0400 Subject: [PATCH 62/93] add macros for generating Default impls (backport ) (cherry picked from commit f3fbc8a08244c272ea71354b08b081aaf0d09702) --- src/macros.rs | 296 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 296 insertions(+) diff --git a/src/macros.rs b/src/macros.rs index 8be1f0e66603..d82febea3241 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -250,6 +250,194 @@ macro_rules! s_no_extra_traits { ); } +/// Like [`s`], but also generates a `Default` impl for every struct in the block. +macro_rules! s_with_default { + ($( + $(#[$attr:meta])* + $pub:vis $t:ident $i:ident { $($field:tt)* } + )*) => ($( + s_with_default!(it: $(#[$attr])* $pub $t $i { $($field)* }); + )*); + + (it: $(#[$attr:meta])* $pub:vis union $i:ident { $($field:tt)* }) => ( + compile_error!( + "unions cannot derive extra traits, use s_no_extra_traits_with_default instead" + ); + ); + + (it: $(#[$attr:meta])* $pub:vis struct $i:ident { $($field:tt)* }) => ( + struct_with_default! { + attrs: { + #[repr(C)] + #[::core::prelude::v1::derive( + ::core::clone::Clone, + ::core::marker::Copy, + ::core::fmt::Debug, + )] + #[cfg_attr( + feature = "extra_traits", + ::core::prelude::v1::derive(PartialEq, Eq, Hash) + )] + #[allow(deprecated)] + } + $(#[$attr])* $pub struct $i { $($field)* } + } + ); +} + +/// Like [`s_no_extra_traits`], but also generates a `Default` impl for every struct in the block. +/// +/// Unions are emitted just like `s_no_extra_traits!` does, with no `Default`. A struct field of +/// union type supplies its own default via `#[custom_default(...)]`. +macro_rules! s_no_extra_traits_with_default { + ($( + $(#[$attr:meta])* + $pub:vis $t:ident $i:ident { $($field:tt)* } + )*) => ($( + s_no_extra_traits_with_default!(it: $(#[$attr])* $pub $t $i { $($field)* }); + )*); + + (it: $(#[$attr:meta])* $pub:vis union $i:ident { $($field:tt)* }) => ( + #[repr(C)] + #[::core::prelude::v1::derive( + ::core::clone::Clone, + ::core::marker::Copy, + )] + $(#[$attr])* + $pub union $i { $($field)* } + + impl ::core::fmt::Debug for $i { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct(::core::stringify!($i)).finish_non_exhaustive() + } + } + ); + + (it: $(#[$attr:meta])* $pub:vis struct $i:ident { $($field:tt)* }) => ( + struct_with_default! { + attrs: { + #[repr(C)] + #[::core::prelude::v1::derive( + ::core::clone::Clone, + ::core::marker::Copy, + ::core::fmt::Debug, + )] + } + $(#[$attr])* $pub struct $i { $($field)* } + } + ); +} + +/// Emit a struct with the given derive attributes plus a generated `Default` impl. +/// +/// Fields default to `Default::default()`. A field whose default can't be derived must carry +/// `#[custom_default(EXPR)]` as its *first* attribute, and `EXPR` is used instead. +/// +/// This works by scanning each field for `#[custom_default]` attributes. If one exists, the +/// attribute's contents are added to `processed_field_defaults` and will be used in the expansion +/// for `Default`. If it does not exist, `Default::default()` is used instead. In either case, the +/// field is added to `processed_fields` with `#[custom_default]` stripped if necessary, and +/// `struct_with_default` is invoked again with the remaining fields. +macro_rules! struct_with_default { + // entry; `attrs` is the attribute block the caller wants on the struct (repr, derives, etc.), + // which is merged with the struct's own attributes. + ( + attrs: { $($attrs:tt)* } + $(#[$attr:meta])* + $vis:vis struct $name:ident { $($body:tt)* } + ) => { + struct_with_default! { + @struct + attrs: { $($attrs)* $(#[$attr])* } + vis: { $vis } + name: { $name } + processed_fields: { } + processed_field_defaults: { } + remaining_fields: { $($body)* } + } + }; + + // field led by #[custom_default(...)] + ( + @struct + attrs: { $($attrs:tt)* } + vis: { $vis:vis } + name: { $name:ident } + processed_fields: { $($processed_fields:tt)* } + processed_field_defaults: { $($processed_field_defaults:tt)* } + remaining_fields: { + #[custom_default($default:expr)] + $(#[$fattr:meta])* + $fvis:vis $fname:ident: $fty:ty, + $($tail:tt)* + } + ) => { + struct_with_default! { + @struct + attrs: { $($attrs)* } + vis: { $vis } + name: { $name } + processed_fields: { $($processed_fields)* $(#[$fattr])* $fvis $fname: $fty, } + processed_field_defaults: { + $($processed_field_defaults)* + $(#[$fattr])* $fname: $default, + } + remaining_fields: { $($tail)* } + } + }; + + // plain field + ( + @struct + attrs: { $($attrs:tt)* } + vis: { $vis:vis } + name: { $name:ident } + processed_fields: { $($processed_fields:tt)* } + processed_field_defaults: { $($processed_field_defaults:tt)* } + remaining_fields: { + $(#[$fattr:meta])* + $fvis:vis $fname:ident: $fty:ty, + $($tail:tt)* + } + ) => { + struct_with_default! { + @struct + attrs: { $($attrs)* } + vis: { $vis } + name: { $name } + processed_fields: { $($processed_fields)* $(#[$fattr])* $fvis $fname: $fty, } + processed_field_defaults: { + $($processed_field_defaults)* + $(#[$fattr])* $fname: ::core::default::Default::default(), + } + remaining_fields: { $($tail)* } + } + }; + + // done + ( + @struct + attrs: { $($attrs:tt)* } + vis: { $vis:vis } + name: { $name:ident } + processed_fields: { $($processed_fields:tt)* } + processed_field_defaults: { $($processed_field_defaults:tt)* } + remaining_fields: { } + ) => { + $($attrs)* + $vis struct $name { $($processed_fields)* } + + impl ::core::default::Default for $name { + // Field attributes (`#[cfg]`, doc comments) get forwarded to the initializer too. + // Docs are harmless there but trip the lint, so silence it. + #[allow(unused_doc_comments)] + fn default() -> Self { + Self { $($processed_field_defaults)* } + } + } + }; +} + /// Create an uninhabited type that can't be constructed. It implements `Debug`, `Clone`, /// and `Copy`, but these aren't meaningful for extern types so they should eventually /// be removed. @@ -701,6 +889,81 @@ mod tests { assert_eq!(core::mem::offset_of!(Off1, c), offset_of!(Off1, c)); assert_eq!(core::mem::offset_of!(Off1, d), offset_of!(Off1, d)); } + + #[test] + fn s_with_default_uses_custom_default() { + // A non-default value proves `custom_default` is used rather than a derived default. + s_with_default! { + struct CustomDefault { + a: u32, + #[custom_default([1; 64])] + buf: [u8; 64], + } + } + + let s = CustomDefault::default(); + assert_eq!(s.a, 0); + assert_eq!(s.buf, [1u8; 64]); + } + + #[test] + fn s_with_default_keeps_field_attrs() { + // If `custom_default` stripping ate the other field attributes, the two `a` fields + // would collide. + s_with_default! { + struct FieldAttrs { + #[cfg(target_arch = "x86_64")] + a: u8, + #[cfg(not(target_arch = "x86_64"))] + a: u64, + } + } + + let s = FieldAttrs::default(); + #[cfg(target_arch = "x86_64")] + assert_eq!(s.a, 0u8); + #[cfg(not(target_arch = "x86_64"))] + assert_eq!(s.a, 0u64); + } + + #[test] + fn s_with_default_single_cfg_field() { + // this field only exists on x86_64, so its default init needs the same cfg or + // Default won't build on other arches + s_with_default! { + struct SingleCfg { + common: u32, + #[cfg(target_arch = "x86_64")] + x86_only: u64, + } + } + + let s = SingleCfg::default(); + assert_eq!(s.common, 0); + #[cfg(target_arch = "x86_64")] + assert_eq!(s.x86_only, 0); + } + + #[test] + fn s_no_extra_traits_with_default_zeroes_union() { + // A union field's default is supplied by `custom_default(unsafe { mem::zeroed })`. + s_no_extra_traits_with_default! { + union U { + a: u32, + b: f32, + } + + struct HasUnion { + x: u16, + #[custom_default(unsafe { ::core::mem::zeroed::() })] + u: U, + } + } + + let s = HasUnion::default(); + assert_eq!(s.x, 0); + assert_eq!(unsafe { s.u.a }, 0); + } } #[cfg(test)] @@ -744,4 +1007,37 @@ mod macro_checks { type Foo; pub type Bar; } + + s_with_default! { + pub struct S3 { + pub a: u32, + #[custom_default([1; 64])] + pub buf: [u8; 64], + } + + struct S3Priv { + pub a: u32, + b: u32, + } + } + + s_no_extra_traits_with_default! { + pub union U3 { + pub a: u32, + b: f32, + } + + pub struct S4 { + pub a: u32, + #[custom_default(unsafe { ::core::mem::zeroed::() })] + pub u: U3, + } + } + + fn assert_impls_default() {} + + fn check_default() { + assert_impls_default::(); + assert_impls_default::(); + } } From ed836245960ab783aace24ee7c3275e0af8c68dd Mon Sep 17 00:00:00 2001 From: telcharr Date: Mon, 3 Aug 2026 20:22:22 -0400 Subject: [PATCH 63/93] use default macros in linux/can.rs (backport ) (cherry picked from commit 2eb8a5e7805cc3fceb1df879fa39d001660bd740) --- src/new/linux_uapi/linux/can.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/new/linux_uapi/linux/can.rs b/src/new/linux_uapi/linux/can.rs index c4ae2da58434..d50523c12e82 100644 --- a/src/new/linux_uapi/linux/can.rs +++ b/src/new/linux_uapi/linux/can.rs @@ -37,7 +37,7 @@ pub const CANXL_MAX_DLC_MASK: c_int = 0x07FF; pub const CANXL_MIN_DLEN: usize = 1; pub const CANXL_MAX_DLEN: usize = 2048; -s! { +s_with_default! { #[repr(align(8))] pub struct can_frame { pub can_id: canid_t, @@ -54,7 +54,7 @@ pub const CANFD_BRS: c_int = 0x01; pub const CANFD_ESI: c_int = 0x02; pub const CANFD_FDF: c_int = 0x04; -s! { +s_with_default! { #[repr(align(8))] pub struct canfd_frame { pub can_id: canid_t, @@ -62,6 +62,7 @@ s! { pub flags: u8, __res0: u8, __res1: u8, + #[custom_default([0; CANFD_MAX_DLEN])] pub data: [u8; CANFD_MAX_DLEN], } } @@ -69,13 +70,14 @@ s! { pub const CANXL_XLF: c_int = 0x80; pub const CANXL_SEC: c_int = 0x01; -s! { +s_with_default! { pub struct canxl_frame { pub prio: canid_t, pub flags: u8, pub sdt: u8, pub len: u16, pub af: u32, + #[custom_default([0; CANXL_MAX_DLEN])] pub data: [u8; CANXL_MAX_DLEN], } } @@ -101,10 +103,11 @@ pub const CAN_NPROTO: c_int = 8; pub const SOL_CAN_BASE: c_int = 100; -s_no_extra_traits! { +s_no_extra_traits_with_default! { pub struct sockaddr_can { pub can_family: crate::sa_family_t, pub can_ifindex: c_int, + #[custom_default(unsafe { mem::zeroed::<__c_anonymous_sockaddr_can_can_addr>() })] pub can_addr: __c_anonymous_sockaddr_can_can_addr, } From 0604fe4a4563fbdb7d9466e405c7a54730c7076a Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Thu, 30 Jul 2026 14:32:18 -0400 Subject: [PATCH 64/93] linux: select powerpc64 speed symbols by ELF ABI Starting with Rust 1.98, `powerpc64-unknown-linux-gnuelfv2` will be a supported triple. During my attempts to try to build a bunch of projects for this new target, though, libc failed to compile. This is because the `cf*speed` link names assumed all big-endian powerpc64 targets use ELFv1, which was reasonable in the past, but not anymore. Now, this uses the target ABI to select the correct symbol versions instead. (backport ) (cherry picked from commit 18788dbb49f1ef59e592be9db8dea0c7f28bea13) --- Cargo.toml | 1 + build.rs | 10 +++++++--- ci/verify-build.py | 1 + src/unix/mod.rs | 25 +++++++++++++++---------- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 134a072e32c8..a6098cc0f17e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -136,6 +136,7 @@ targets = [ "powerpc64-ibm-aix", "powerpc64-unknown-freebsd", "powerpc64-unknown-linux-gnu", + "powerpc64-unknown-linux-gnuelfv2", "powerpc64-wrs-vxworks", "riscv32-wrs-vxworks", "riscv32gc-unknown-linux-musl", diff --git a/build.rs b/build.rs index fecbd484867c..e3d2a89feeb0 100644 --- a/build.rs +++ b/build.rs @@ -30,6 +30,7 @@ const ALLOWED_CFGS: &[&str] = &[ // GNU to expose a 64-bit `time_t`. "gnu_time_bits64", "libc_deny_warnings", + "libc_elfv2", // Corresponds to `__USE_TIME_BITS64` in UAPI "linux_time_bits64", "musl_v1_2_3", @@ -92,9 +93,12 @@ fn main() { let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); let target_abi = env::var("CARGO_CFG_TARGET_ABI").unwrap_or_default(); - // FIXME(msrv): Once the MSRV is 1.78, use `cfg(target_abi = "pauthtest")` - // directly instead of translating it to `libc_pauthtest`. `target_abi` - // cannot be used directly in cfg expressions on the current MSRV. + // FIXME(msrv): Once the MSRV is 1.78, use `cfg(target_abi)` directly instead + // of translating its values. `target_abi` cannot be used directly in cfg + // expressions on the current MSRV. + if target_abi == "elfv2" { + set_cfg("libc_elfv2"); + } if target_abi == "pauthtest" { set_cfg("libc_pauthtest"); } diff --git a/ci/verify-build.py b/ci/verify-build.py index b41ad8a9e07c..fe4ae8182f92 100755 --- a/ci/verify-build.py +++ b/ci/verify-build.py @@ -189,6 +189,7 @@ class TargetResult: Target("powerpc-wrs-vxworks-spe", dist=False), Target("powerpc64-ibm-aix", dist=False), Target("powerpc64-unknown-freebsd", dist=False), + Target("powerpc64-unknown-linux-gnuelfv2", dist=False), Target("powerpc64-wrs-vxworks", dist=False), Target("riscv32-wrs-vxworks", dist=False), Target("riscv32gc-unknown-linux-gnu", dist=False), diff --git a/src/unix/mod.rs b/src/unix/mod.rs index ec915d32ebc4..e331089b3831 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1722,7 +1722,8 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "big" + target_endian = "big", + not(libc_elfv2) ), link_name = "cfgetispeed@GLIBC_2.3" )] @@ -1731,7 +1732,7 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "little" + any(target_endian = "little", libc_elfv2) ), link_name = "cfgetispeed@GLIBC_2.17" )] @@ -1823,7 +1824,8 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "big" + target_endian = "big", + not(libc_elfv2) ), link_name = "cfgetospeed@GLIBC_2.3" )] @@ -1832,7 +1834,7 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "little" + any(target_endian = "little", libc_elfv2) ), link_name = "cfgetospeed@GLIBC_2.17" )] @@ -1924,7 +1926,8 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "big" + target_endian = "big", + not(libc_elfv2) ), link_name = "cfsetispeed@GLIBC_2.3" )] @@ -1933,7 +1936,7 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "little" + any(target_endian = "little", libc_elfv2) ), link_name = "cfsetispeed@GLIBC_2.17" )] @@ -2025,7 +2028,8 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "big" + target_endian = "big", + not(libc_elfv2) ), link_name = "cfsetospeed@GLIBC_2.3" )] @@ -2034,7 +2038,7 @@ extern "C" { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "little" + any(target_endian = "little", libc_elfv2) ), link_name = "cfsetospeed@GLIBC_2.17" )] @@ -2416,7 +2420,8 @@ cfg_if! { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "big" + target_endian = "big", + not(libc_elfv2) ), link_name = "cfsetspeed@GLIBC_2.3" )] @@ -2425,7 +2430,7 @@ cfg_if! { target_os = "linux", target_env = "gnu", target_arch = "powerpc64", - target_endian = "little" + any(target_endian = "little", libc_elfv2) ), link_name = "cfsetspeed@GLIBC_2.17" )] From cfd3b5e785057228c950bde0111fc9b922cd5eb2 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 4 Aug 2026 02:46:20 +0100 Subject: [PATCH 65/93] docs: update mirror repo for glibc (backport ) (cherry picked from commit 50ba956e16021b2083ced0406bda3d5b54037ba2) --- libc-test/build.rs | 2 +- src/new/glibc/mod.rs | 6 +++--- src/new/glibc/posix/unistd.rs | 2 +- src/new/glibc/sysdeps/nptl/mod.rs | 2 +- src/new/glibc/sysdeps/nptl/pthread.rs | 2 +- src/new/glibc/sysdeps/unix/linux/mod.rs | 2 +- src/new/glibc/sysdeps/unix/linux/net/route.rs | 2 +- src/new/glibc/sysdeps/unix/mod.rs | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index f83334398936..8bc5cfc38f56 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -5068,7 +5068,7 @@ fn test_linux(target: &str) { "PR_SME_VL_LEN_MAX" | "PR_SME_SET_VL_INHERIT" | "PR_SME_SET_VL_ONE_EXEC" if gnu => true, // FIXME(linux): The below is no longer const in glibc 2.34: - // https://github.com/bminor/glibc/commit/5d98a7dae955bafa6740c26eaba9c86060ae0344 + // https://github.com/sailfishos-mirror/glibc/commit/5d98a7dae955bafa6740c26eaba9c86060ae0344 "PTHREAD_STACK_MIN" | "SIGSTKSZ" | "MINSIGSTKSZ" if gnu => true, // value changed diff --git a/src/new/glibc/mod.rs b/src/new/glibc/mod.rs index e11c026f3c58..86dec42d6a78 100644 --- a/src/new/glibc/mod.rs +++ b/src/new/glibc/mod.rs @@ -1,21 +1,21 @@ //! GNU libc. //! //! * Headers: (official) -//! * Headers: (mirror) +//! * Headers: (mirror) //! //! This module structure is modeled after glibc's source tree. Its build system selects headers //! from different locations based on the platform, which we mimic here with reexports. /// Source directory: `posix/` /// -/// +/// mod posix { pub(crate) mod unistd; } /// Source directory: `sysdeps/` /// -/// +/// mod sysdeps { // FIXME(pthread): eventually all platforms should use this module #[cfg(target_os = "linux")] diff --git a/src/new/glibc/posix/unistd.rs b/src/new/glibc/posix/unistd.rs index 907066c458df..96ee83b17ecb 100644 --- a/src/new/glibc/posix/unistd.rs +++ b/src/new/glibc/posix/unistd.rs @@ -1,6 +1,6 @@ //! Header: `unistd.h` //! -//! +//! pub use crate::new::common::posix::unistd::{ STDERR_FILENO, diff --git a/src/new/glibc/sysdeps/nptl/mod.rs b/src/new/glibc/sysdeps/nptl/mod.rs index 92b8e9a22df4..6ea74cd9412e 100644 --- a/src/new/glibc/sysdeps/nptl/mod.rs +++ b/src/new/glibc/sysdeps/nptl/mod.rs @@ -2,7 +2,7 @@ //! //! Native POSIX threading library. //! -//! +//! pub(crate) mod bits { #[cfg_attr( diff --git a/src/new/glibc/sysdeps/nptl/pthread.rs b/src/new/glibc/sysdeps/nptl/pthread.rs index bb45d2851fc5..0d094945c98e 100644 --- a/src/new/glibc/sysdeps/nptl/pthread.rs +++ b/src/new/glibc/sysdeps/nptl/pthread.rs @@ -1,6 +1,6 @@ //! Source header: `sysdeps/nptl/pthread.h` //! -//! +//! use super::bits::struct_mutex::*; use crate::prelude::*; diff --git a/src/new/glibc/sysdeps/unix/linux/mod.rs b/src/new/glibc/sysdeps/unix/linux/mod.rs index 0ecee596c5b1..21dac17fc0b2 100644 --- a/src/new/glibc/sysdeps/unix/linux/mod.rs +++ b/src/new/glibc/sysdeps/unix/linux/mod.rs @@ -1,6 +1,6 @@ //! Source directory: `sysdeps/unix/sysv/linux` (the `sysv` is flattened). //! -//! +//! /// Directory: `net/` /// diff --git a/src/new/glibc/sysdeps/unix/linux/net/route.rs b/src/new/glibc/sysdeps/unix/linux/net/route.rs index 2851451652df..1da2b47ebbb4 100644 --- a/src/new/glibc/sysdeps/unix/linux/net/route.rs +++ b/src/new/glibc/sysdeps/unix/linux/net/route.rs @@ -1,7 +1,7 @@ //! Header: `net/route.h` //! //! Source header: `sysdeps/unix/sysv/linux/net/route.h` -//! +//! use crate::prelude::*; diff --git a/src/new/glibc/sysdeps/unix/mod.rs b/src/new/glibc/sysdeps/unix/mod.rs index 55a895d4d0de..a2159e0b7339 100644 --- a/src/new/glibc/sysdeps/unix/mod.rs +++ b/src/new/glibc/sysdeps/unix/mod.rs @@ -1,6 +1,6 @@ //! Source directory: `sysdeps/unix/` //! -//! +//! #[cfg(target_os = "linux")] pub(crate) mod linux; From 1cfed554e1fd770d7be239054a2747cd764bf39e Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 4 Aug 2026 03:06:52 +0100 Subject: [PATCH 66/93] docs: add mirror repo for relibc (backport ) (cherry picked from commit f31ee02cca4431b7e4269fd79d069ebe8bb171bf) --- src/new/redox/mod.rs | 3 ++- src/new/relibc/mod.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/new/redox/mod.rs b/src/new/redox/mod.rs index cf7806a2437a..32cd7e72ac32 100644 --- a/src/new/redox/mod.rs +++ b/src/new/redox/mod.rs @@ -1,3 +1,4 @@ //! Redox libc. //! -//! * Headers: +//! * Headers: (official) +//! * Headers: (mirror) diff --git a/src/new/relibc/mod.rs b/src/new/relibc/mod.rs index d2449123218a..ec1624102531 100644 --- a/src/new/relibc/mod.rs +++ b/src/new/relibc/mod.rs @@ -1,5 +1,6 @@ //! Redox OS libc. //! -//! * Headers: +//! * Headers: (official) +//! * Headers: (mirror) pub(crate) mod unistd; From 3d418eef0e738ac005501b5514450d6e722b2e1e Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 4 Aug 2026 04:01:32 +0100 Subject: [PATCH 67/93] docs: add official repo for musl (backport ) (cherry picked from commit 2a2e8ef233f4f8f0e9225ea2a6d571f575ee2245) --- src/new/musl/arch/generic/mod.rs | 3 ++- src/new/musl/arch/mips/mod.rs | 3 ++- src/new/musl/arch/mips64/mod.rs | 3 ++- src/new/musl/arch/mod.rs | 3 ++- src/new/musl/mod.rs | 3 ++- src/new/musl/pthread.rs | 3 ++- src/new/musl/sys/socket.rs | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/new/musl/arch/generic/mod.rs b/src/new/musl/arch/generic/mod.rs index ac02505c882b..a51a3dfa7493 100644 --- a/src/new/musl/arch/generic/mod.rs +++ b/src/new/musl/arch/generic/mod.rs @@ -1,6 +1,7 @@ //! Source directory: `arch/generic/` //! -//! +//! * Headers: (official) +//! * Headers: (mirror) pub(crate) mod bits { // Currently unused diff --git a/src/new/musl/arch/mips/mod.rs b/src/new/musl/arch/mips/mod.rs index 2f02036d254c..ce546c654a61 100644 --- a/src/new/musl/arch/mips/mod.rs +++ b/src/new/musl/arch/mips/mod.rs @@ -1,6 +1,7 @@ //! Source directory: `arch/mips/` //! -//! +//! * Headers: (official) +//! * Headers: (mirror) pub(crate) mod bits { pub(crate) mod socket; diff --git a/src/new/musl/arch/mips64/mod.rs b/src/new/musl/arch/mips64/mod.rs index 6a45b067b998..0e01c9742c41 100644 --- a/src/new/musl/arch/mips64/mod.rs +++ b/src/new/musl/arch/mips64/mod.rs @@ -1,6 +1,7 @@ //! Source directory: `arch/mips64/` //! -//! +//! * Headers: (official) +//! * Headers: (mirror) pub(crate) mod bits { pub(crate) mod socket; diff --git a/src/new/musl/arch/mod.rs b/src/new/musl/arch/mod.rs index 514d7b4bdfea..d4a717895a17 100644 --- a/src/new/musl/arch/mod.rs +++ b/src/new/musl/arch/mod.rs @@ -1,6 +1,7 @@ //! Source directory: `arch/` //! -//! +//! * Headers: (official) +//! * Headers: (mirror) pub(crate) mod generic; diff --git a/src/new/musl/mod.rs b/src/new/musl/mod.rs index a6551c342da6..9edb38255422 100644 --- a/src/new/musl/mod.rs +++ b/src/new/musl/mod.rs @@ -24,7 +24,8 @@ pub(crate) mod pthread; /// Directory: `sys/` /// -/// +/// * Headers: (official) +/// * Headers: (mirror) pub(crate) mod sys { pub(crate) mod socket; } diff --git a/src/new/musl/pthread.rs b/src/new/musl/pthread.rs index 0d578bc9665d..1190a92120cc 100644 --- a/src/new/musl/pthread.rs +++ b/src/new/musl/pthread.rs @@ -1,6 +1,7 @@ //! Header: `pthread.h` //! -//! +//! * Headers: (official) +//! * Headers: (mirror) pub use crate::new::common::linux_like::pthread::{ pthread_getaffinity_np, diff --git a/src/new/musl/sys/socket.rs b/src/new/musl/sys/socket.rs index 7d3f49595545..8083ddc2a7dc 100644 --- a/src/new/musl/sys/socket.rs +++ b/src/new/musl/sys/socket.rs @@ -1,6 +1,7 @@ //! Header: `sys/socket.h` //! -//! +//! * Headers: (official) +//! * Headers: (mirror) use crate::prelude::*; From b2ae55966ac1ce9db04ccfdf4f2573613d0d699f Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 4 Aug 2026 04:11:25 +0100 Subject: [PATCH 68/93] docs: update source links section in CONTRIBUTING (backport ) (cherry picked from commit 8aea5af9026ea50f4c3a12f15074e913fb61158a) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a5ac3ed43c2..35fcba6404ba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,7 +116,7 @@ Please include permalinks to headers in commit messages for all API changes. Common sources include: * Linux uapi: https://github.com/torvalds/linux/tree/master/include/uapi -* Glibc: https://sourceware.org/git/?p=glibc.git;a=tree +* Glibc: https://github.com/sailfishos-mirror/glibc (original is https://sourceware.org/git/?p=glibc.git;a=tree) * Musl: https://github.com/kraj/musl (original is https://git.musl-libc.org/cgit/musl/tree/) * Apple XNU: https://github.com/apple-oss-distributions/xnu, libc https://github.com/apple-oss-distributions/Libc/tree/main/include * Android: https://cs.android.com/android/platform/superproject/main From 9ebf4c23ae5831f0bbdd498883e375d5973f6491 Mon Sep 17 00:00:00 2001 From: Sergii Bogomolov Date: Wed, 1 Jul 2026 00:34:40 +0200 Subject: [PATCH 69/93] Add RFC 3678 multicast `group_req`/`group_source_req` and `MCAST_*` Add the protocol-independent multicast group membership request structs `group_req` and `group_source_req` (RFC 3678) on Linux, Apple, and FreeBSD, and the `MCAST_*` socket-option constants on Apple and FreeBSD (Linux already defines them). Apple wraps the structs in `#pragma pack(4)`, so they are `#[repr(packed(4))]` there; Linux and FreeBSD use natural alignment. DragonFly lacks the RFC 3678 multicast API, so it is excluded. (backport ) (cherry picked from commit 605ebff6efabfa185c409b836954acb39cef6f62) --- libc-test/semver/android.txt | 2 ++ libc-test/semver/apple.txt | 8 ++++++++ libc-test/semver/freebsd.txt | 8 ++++++++ libc-test/semver/l4re.txt | 2 ++ libc-test/semver/linux.txt | 2 ++ src/unix/bsd/apple/mod.rs | 22 ++++++++++++++++++++++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 20 ++++++++++++++++++++ src/unix/linux_like/mod.rs | 12 ++++++++++++ 8 files changed, 76 insertions(+) diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 9b057ed0e9b5..1a58e07de237 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -3633,6 +3633,8 @@ gmtime gmtime_r grantpt group +group_req +group_source_req hostent id_t idtype_t diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index b0aaabcfbf3e..a175fc36245f 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -910,6 +910,12 @@ MAXPHASE MAXSEC MAXTC MAXTHREADNAMESIZE +MCAST_BLOCK_SOURCE +MCAST_JOIN_GROUP +MCAST_JOIN_SOURCE_GROUP +MCAST_LEAVE_GROUP +MCAST_LEAVE_SOURCE_GROUP +MCAST_UNBLOCK_SOURCE MCL_CURRENT MCL_FUTURE MDMBUF @@ -2112,6 +2118,8 @@ getxattr glob glob_t globfree +group_req +group_source_req host_cpu_load_info host_cpu_load_info_data_t host_cpu_load_info_t diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 582e89bb636b..7c0b0c8a2565 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -862,6 +862,12 @@ MAXFREQ MAXPHASE MAXSEC MAXTC +MCAST_BLOCK_SOURCE +MCAST_JOIN_GROUP +MCAST_JOIN_SOURCE_GROUP +MCAST_LEAVE_GROUP +MCAST_LEAVE_SOURCE_GROUP +MCAST_UNBLOCK_SOURCE MCL_CURRENT MCL_FUTURE MDMBUF @@ -2075,6 +2081,8 @@ getutxuser glob glob_t globfree +group_req +group_source_req hexdump humanize_number icmp6_ifstat diff --git a/libc-test/semver/l4re.txt b/libc-test/semver/l4re.txt index 04fdedd37ae8..e4a8a79a28a1 100644 --- a/libc-test/semver/l4re.txt +++ b/libc-test/semver/l4re.txt @@ -2201,6 +2201,8 @@ gid_t gmtime gmtime_r group +group_req +group_source_req hostent hstrerror iconv diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index e15b6c0d9d68..6c651e52f86e 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -4184,6 +4184,8 @@ getspnam getspnam_r gettid getxattr +group_req +group_source_req hasmntopt hwtstamp_config iconv diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index d03832c2489b..4c95b07bc249 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1398,6 +1398,20 @@ s! { __ss_pad2: Padding<[u8; 112]>, } + // netinet/in.h: RFC 3678 multicast group membership requests. + #[repr(packed(4))] + pub struct group_req { + pub gr_interface: u32, + pub gr_group: crate::sockaddr_storage, + } + + #[repr(packed(4))] + pub struct group_source_req { + pub gsr_interface: u32, + pub gsr_group: crate::sockaddr_storage, + pub gsr_source: crate::sockaddr_storage, + } + pub struct utmpx { pub ut_user: [c_char; _UTX_USERSIZE], pub ut_id: [c_char; _UTX_IDSIZE], @@ -2800,6 +2814,14 @@ pub const IPPROTO_MAX: c_int = 256; /// last return value of *_input(), meaning "all job for this pkt is done". pub const IPPROTO_DONE: c_int = 257; +// RFC 3678 protocol-independent multicast +pub const MCAST_JOIN_GROUP: c_int = 80; +pub const MCAST_LEAVE_GROUP: c_int = 81; +pub const MCAST_JOIN_SOURCE_GROUP: c_int = 82; +pub const MCAST_LEAVE_SOURCE_GROUP: c_int = 83; +pub const MCAST_BLOCK_SOURCE: c_int = 84; +pub const MCAST_UNBLOCK_SOURCE: c_int = 85; + pub const AF_UNSPEC: c_int = 0; pub const AF_LOCAL: c_int = 1; pub const AF_UNIX: c_int = AF_LOCAL; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index ea378374280b..0df0e40faf3b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -280,12 +280,24 @@ s! { pub ip6: *mut crate::in6_addr, } + // netinet/in.h: RFC 3678 multicast group membership requests pub struct ip_mreq_source { pub imr_multiaddr: crate::in_addr, pub imr_sourceaddr: crate::in_addr, pub imr_interface: crate::in_addr, } + pub struct group_req { + pub gr_interface: u32, + pub gr_group: crate::sockaddr_storage, + } + + pub struct group_source_req { + pub gsr_interface: u32, + pub gsr_group: crate::sockaddr_storage, + pub gsr_source: crate::sockaddr_storage, + } + pub struct statvfs { pub f_bavail: crate::fsblkcnt_t, pub f_bfree: crate::fsblkcnt_t, @@ -3153,6 +3165,14 @@ pub const IPPROTO_DIVERT: c_int = 258; /// SeND pseudo-protocol pub const IPPROTO_SEND: c_int = 259; +// RFC 3678 protocol-independent multicast +pub const MCAST_JOIN_GROUP: c_int = 80; +pub const MCAST_LEAVE_GROUP: c_int = 81; +pub const MCAST_JOIN_SOURCE_GROUP: c_int = 82; +pub const MCAST_LEAVE_SOURCE_GROUP: c_int = 83; +pub const MCAST_BLOCK_SOURCE: c_int = 84; +pub const MCAST_UNBLOCK_SOURCE: c_int = 85; + // sys/netinet/TCP.h pub const TCP_MD5SIG: c_int = 16; pub const TCP_INFO: c_int = 32; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 04aa98a52ed5..7951abf33f4d 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -29,12 +29,24 @@ s! { pub imr_ifindex: c_int, } + // netinet/in.h: RFC 3678 multicast group membership requests pub struct ip_mreq_source { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, pub imr_sourceaddr: in_addr, } + pub struct group_req { + pub gr_interface: u32, + pub gr_group: crate::sockaddr_storage, + } + + pub struct group_source_req { + pub gsr_interface: u32, + pub gsr_group: crate::sockaddr_storage, + pub gsr_source: crate::sockaddr_storage, + } + pub struct sockaddr { pub sa_family: sa_family_t, pub sa_data: [c_char; 14], From 99411070f1e33a7eaa204a8095a7df2eb50d67bb Mon Sep 17 00:00:00 2001 From: Sergii Bogomolov Date: Fri, 31 Jul 2026 21:59:39 +0200 Subject: [PATCH 70/93] apple: change `BPF_ALIGNMENT` to `size_t` (backport ) (cherry picked from commit 19254881d5cb2564040741002bd481fa8d94a08c) --- src/new/apple/xnu/net/bpf.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/new/apple/xnu/net/bpf.rs b/src/new/apple/xnu/net/bpf.rs index 93667d578ac6..2f938c577088 100644 --- a/src/new/apple/xnu/net/bpf.rs +++ b/src/new/apple/xnu/net/bpf.rs @@ -47,7 +47,7 @@ pub const DLT_ATM_RFC1483: c_uint = 11; // LLC/SNAP encapsulated atm pub const DLT_RAW: c_uint = 12; // raw IP pub const DLT_LOOP: c_uint = 108; -pub const BPF_ALIGNMENT: c_int = size_of::() as c_int; +pub const BPF_ALIGNMENT: size_t = size_of::(); pub const fn BPF_WORDALIGN(x: usize) -> usize { (x + (BPF_ALIGNMENT as usize - 1)) & !(BPF_ALIGNMENT as usize - 1) From e607803e128355a45385e0a3091f397b23933ac6 Mon Sep 17 00:00:00 2001 From: apersomany Date: Tue, 4 Aug 2026 15:42:43 +0900 Subject: [PATCH 71/93] android: add reuseport BPF socket options Add SO_ATTACH_REUSEPORT_CBPF (51), SO_ATTACH_REUSEPORT_EBPF (52) and SO_DETACH_REUSEPORT_BPF (68) to the Android module, as declared by bionic in its kernel uapi asm-generic/socket.h: https://android.googlesource.com/platform/bionic/+/731631f3/libc/kernel/uapi/asm-generic/socket.h The generic architecture values apply to all Android ABIs. Needed to compile aya for aarch64-linux-android. (backport ) (cherry picked from commit 6b4c11aecf2eb45ce51b673e632d31b11c37bf81) --- libc-test/semver/android.txt | 3 +++ src/unix/linux_like/android/mod.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 1a58e07de237..33f2a804daa7 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -2640,12 +2640,15 @@ SOL_UDP SOL_X25 SOMAXCONN SO_ACCEPTCONN +SO_ATTACH_REUSEPORT_CBPF +SO_ATTACH_REUSEPORT_EBPF SO_BINDTODEVICE SO_BINDTOIFINDEX SO_BROADCAST SO_BSDCOMPAT SO_BUSY_POLL SO_DEBUG +SO_DETACH_REUSEPORT_BPF SO_DOMAIN SO_DONTROUTE SO_EE_OFFENDER diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index bdd1725f70e5..139f28aeb041 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -1220,12 +1220,15 @@ pub const SO_DOMAIN: c_int = 39; pub const SO_RXQ_OVFL: c_int = 40; pub const SO_PEEK_OFF: c_int = 42; pub const SO_BUSY_POLL: c_int = 46; +pub const SO_ATTACH_REUSEPORT_CBPF: c_int = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: c_int = 52; pub const SCM_TIMESTAMPING_OPT_STATS: c_int = 54; pub const SCM_TIMESTAMPING_PKTINFO: c_int = 58; pub const SO_BINDTOIFINDEX: c_int = 62; pub const SO_TIMESTAMP_NEW: c_int = 63; pub const SO_TIMESTAMPNS_NEW: c_int = 64; pub const SO_TIMESTAMPING_NEW: c_int = 65; +pub const SO_DETACH_REUSEPORT_BPF: c_int = 68; // Defined in unix/linux_like/mod.rs // pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP; From fc8f142ead5e131dfe359c44a000855d41e3030a Mon Sep 17 00:00:00 2001 From: samuraiXwandering <301416091+samuraixwandering@users.noreply.github.com> Date: Sun, 2 Aug 2026 09:40:49 +0600 Subject: [PATCH 72/93] apple: add TCP header flags, options and SACK limits Socket options already exist for Apple (TCP_NODELAY, TCP_MAXSEG from BSD, TCP_KEEPALIVE from Apple) but the header-and-options side doesn't. This adds TH_*, the TCPOPT_*/TCPOLEN_* pairs, and the SACK limits. TH_* is c_int because TH_AE is 0x100 and the composed masks exceed a byte. TCPOPT_MULTIPATH left out, it's behind #if MPTCP and invisible to userspace. MAX_SACK_BLKS got the usage-guidelines comment, the other two limits are protocol-fixed. https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/netinet/tcp.h#L107-L181 (backport ) (cherry picked from commit 530ed73894298616ddbaffad8f1153fa6c1eeb98) --- libc-test/semver/apple.txt | 48 ++++++++++++++++++ src/new/apple/xnu/mod.rs | 2 + src/new/apple/xnu/netinet/mod.rs | 5 ++ src/new/apple/xnu/netinet/tcp.rs | 84 ++++++++++++++++++++++++++++++++ src/new/mod.rs | 1 + 5 files changed, 140 insertions(+) create mode 100644 src/new/apple/xnu/netinet/mod.rs create mode 100644 src/new/apple/xnu/netinet/tcp.rs diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index a175fc36245f..2a7110250a0c 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -910,6 +910,8 @@ MAXPHASE MAXSEC MAXTC MAXTHREADNAMESIZE +MAX_SACK_BLKS +MAX_TCPOPTLEN MCAST_BLOCK_SOURCE MCAST_JOIN_GROUP MCAST_JOIN_SOURCE_GROUP @@ -1499,12 +1501,45 @@ TAB1 TAB2 TAB3 TABDLY +TCPOLEN_ACCECN_COUNTER +TCPOLEN_ACCECN_EMPTY +TCPOLEN_CC +TCPOLEN_CC_APPA +TCPOLEN_EOL +TCPOLEN_FASTOPEN_REQ +TCPOLEN_MAXSEG +TCPOLEN_NOP +TCPOLEN_SACK +TCPOLEN_SACKHDR +TCPOLEN_SACK_PERMITTED +TCPOLEN_SIGNATURE +TCPOLEN_TIMESTAMP +TCPOLEN_TSTAMP_APPA +TCPOLEN_WINDOW +TCPOPT_ACCECN0 +TCPOPT_ACCECN1 +TCPOPT_CC +TCPOPT_CCECHO +TCPOPT_CCNEW +TCPOPT_EOL +TCPOPT_FASTOPEN +TCPOPT_MAXSEG +TCPOPT_NOP +TCPOPT_SACK +TCPOPT_SACK_HDR +TCPOPT_SACK_PERMITTED +TCPOPT_SACK_PERMIT_HDR +TCPOPT_SIGNATURE +TCPOPT_TIMESTAMP +TCPOPT_TSTAMP_HDR +TCPOPT_WINDOW TCP_CONNECTION_INFO TCP_FASTOPEN TCP_KEEPALIVE TCP_KEEPCNT TCP_KEEPINTVL TCP_MAXSEG +TCP_MAX_SACK TCP_NOOPT TCP_NOPUSH THOUSEP @@ -1532,14 +1567,27 @@ THREAD_THROUGHPUT_QOS_POLICY THREAD_THROUGHPUT_QOS_POLICY_COUNT THREAD_TIME_CONSTRAINT_POLICY THREAD_TIME_CONSTRAINT_POLICY_COUNT +TH_ACCEPT +TH_ACE +TH_ACK +TH_AE +TH_CWR +TH_ECE +TH_FIN +TH_FLAGS +TH_FLAGS_ALL TH_FLAGS_GLOBAL_FORCED_IDLE TH_FLAGS_IDLE TH_FLAGS_SWAPPED +TH_PUSH +TH_RST TH_STATE_HALTED TH_STATE_RUNNING TH_STATE_STOPPED TH_STATE_UNINTERRUPTIBLE TH_STATE_WAITING +TH_SYN +TH_URG TIME_DEL TIME_ERROR TIME_INS diff --git a/src/new/apple/xnu/mod.rs b/src/new/apple/xnu/mod.rs index a0217e2ffa97..84fd8cbeb974 100644 --- a/src/new/apple/xnu/mod.rs +++ b/src/new/apple/xnu/mod.rs @@ -29,6 +29,8 @@ pub(crate) mod machine { pub(crate) mod net; +pub(crate) mod netinet; + pub(crate) mod netinet6; pub(crate) mod sys; diff --git a/src/new/apple/xnu/netinet/mod.rs b/src/new/apple/xnu/netinet/mod.rs new file mode 100644 index 000000000000..fef066187619 --- /dev/null +++ b/src/new/apple/xnu/netinet/mod.rs @@ -0,0 +1,5 @@ +//! Directory: `netinet/` +//! +//! + +pub(crate) mod tcp; diff --git a/src/new/apple/xnu/netinet/tcp.rs b/src/new/apple/xnu/netinet/tcp.rs new file mode 100644 index 000000000000..feb51c80e508 --- /dev/null +++ b/src/new/apple/xnu/netinet/tcp.rs @@ -0,0 +1,84 @@ +//! Header: `netinet/tcp.h` +//! +//! + +use crate::prelude::*; + +// TCP header flags. These are numbered as if `th_x2` and `th_flags` were one +// field, with `th_flags` as the low octet, so `TH_AE` (0x100) and `TH_ACE` +// (which spans both) do not fit in `th_flags` alone. +pub const TH_FIN: c_int = 0x01; +pub const TH_SYN: c_int = 0x02; +pub const TH_RST: c_int = 0x04; +pub const TH_PUSH: c_int = 0x08; +pub const TH_ACK: c_int = 0x10; +pub const TH_URG: c_int = 0x20; +pub const TH_ECE: c_int = 0x40; +pub const TH_CWR: c_int = 0x80; +pub const TH_AE: c_int = 0x100; + +pub const TH_FLAGS: c_int = TH_FIN | TH_SYN | TH_RST | TH_ACK | TH_URG | TH_ECE | TH_CWR; +pub const TH_FLAGS_ALL: c_int = TH_FLAGS | TH_PUSH; +pub const TH_ACCEPT: c_int = TH_FIN | TH_SYN | TH_RST | TH_ACK; +pub const TH_ACE: c_int = TH_AE | TH_CWR | TH_ECE; + +// TCP option kinds and their lengths. +pub const TCPOPT_EOL: c_int = 0; +pub const TCPOLEN_EOL: c_int = 1; +pub const TCPOPT_NOP: c_int = 1; +pub const TCPOLEN_NOP: c_int = 1; +pub const TCPOPT_MAXSEG: c_int = 2; +pub const TCPOLEN_MAXSEG: c_int = 4; +pub const TCPOPT_WINDOW: c_int = 3; +pub const TCPOLEN_WINDOW: c_int = 3; +/// SACK capability in SYN. +pub const TCPOPT_SACK_PERMITTED: c_int = 4; +pub const TCPOLEN_SACK_PERMITTED: c_int = 2; +pub const TCPOPT_SACK: c_int = 5; +pub const TCPOLEN_SACKHDR: c_int = 2; +/// Length of one SACK block. +pub const TCPOLEN_SACK: c_int = 8; +pub const TCPOPT_TIMESTAMP: c_int = 8; +pub const TCPOLEN_TIMESTAMP: c_int = 10; +/// RFC 1323 appendix A. +pub const TCPOLEN_TSTAMP_APPA: c_int = TCPOLEN_TIMESTAMP + 2; +pub const TCPOPT_TSTAMP_HDR: c_int = + (TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP; + +/// Absolute maximum TCP options length. +pub const MAX_TCPOPTLEN: c_int = 40; + +/// CC options: RFC 1644. +pub const TCPOPT_CC: c_int = 11; +pub const TCPOPT_CCNEW: c_int = 12; +pub const TCPOPT_CCECHO: c_int = 13; +pub const TCPOLEN_CC: c_int = 6; +pub const TCPOLEN_CC_APPA: c_int = TCPOLEN_CC + 2; + +/// Keyed MD5: RFC 2385. +pub const TCPOPT_SIGNATURE: c_int = 19; +pub const TCPOLEN_SIGNATURE: c_int = 18; + +pub const TCPOPT_FASTOPEN: c_int = 34; +pub const TCPOLEN_FASTOPEN_REQ: c_int = 2; + +/// AccECN order 0. +pub const TCPOPT_ACCECN0: c_int = 172; +/// AccECN order 1. +pub const TCPOPT_ACCECN1: c_int = 174; +/// Empty option contains kind and length. +pub const TCPOLEN_ACCECN_EMPTY: c_int = 2; +/// Length of each AccECN counter. +pub const TCPOLEN_ACCECN_COUNTER: c_int = 3; + +pub const TCPOPT_SACK_PERMIT_HDR: c_int = + (TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_SACK_PERMITTED << 8) | TCPOLEN_SACK_PERMITTED; +pub const TCPOPT_SACK_HDR: c_int = (TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_SACK << 8); + +/// Maximum number of SACK blocks stored at the sender. +/// +/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) +/// for details. +pub const MAX_SACK_BLKS: c_int = 6; +/// Maximum number of SACKs sent in any segment. +pub const TCP_MAX_SACK: c_int = 4; diff --git a/src/new/mod.rs b/src/new/mod.rs index 52212334e661..0472413474f3 100644 --- a/src/new/mod.rs +++ b/src/new/mod.rs @@ -198,6 +198,7 @@ cfg_if! { pub use net::route::*; } else if #[cfg(target_vendor = "apple")] { pub use net::bpf::*; + pub use netinet::tcp::*; pub use netinet6::in6_var::*; pub use pthread_::introspection::*; pub use pthread_::pthread_spis::*; From 8daa59e6ab3a001cb14751c829145250b7f851fa Mon Sep 17 00:00:00 2001 From: Sergii Bogomolov Date: Tue, 4 Aug 2026 11:56:38 +0200 Subject: [PATCH 73/93] freebsd: add `rt_msghdr` and `rt_metrics` (backport ) (cherry picked from commit 9e26f038c7484363744a9ac3f49b4eea3c4643c3) --- libc-test/semver/freebsd.txt | 2 ++ src/new/freebsd/net/mod.rs | 1 + src/new/freebsd/net/route.rs | 39 ++++++++++++++++++++++++++++++++++++ src/new/mod.rs | 1 + 4 files changed, 43 insertions(+) create mode 100644 src/new/freebsd/net/route.rs diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 7c0b0c8a2565..2cdacfe842cc 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -2323,6 +2323,8 @@ regfree register_t regmatch_t regoff_t +rt_metrics +rt_msghdr rtprio rtprio_thread sallocx diff --git a/src/new/freebsd/net/mod.rs b/src/new/freebsd/net/mod.rs index 44be99742696..d39cb6c32d72 100644 --- a/src/new/freebsd/net/mod.rs +++ b/src/new/freebsd/net/mod.rs @@ -4,3 +4,4 @@ pub(crate) mod dlt; pub(crate) mod if_mib; +pub(crate) mod route; diff --git a/src/new/freebsd/net/route.rs b/src/new/freebsd/net/route.rs new file mode 100644 index 000000000000..a67faeda2e0b --- /dev/null +++ b/src/new/freebsd/net/route.rs @@ -0,0 +1,39 @@ +//! Header: `net/route.h` +//! +//! + +use crate::prelude::*; + +s_with_default! { + pub struct rt_metrics { + pub rmx_locks: c_ulong, + pub rmx_mtu: c_ulong, + pub rmx_hopcount: c_ulong, + pub rmx_expire: c_ulong, + pub rmx_recvpipe: c_ulong, + pub rmx_sendpipe: c_ulong, + pub rmx_ssthresh: c_ulong, + pub rmx_rtt: c_ulong, + pub rmx_rttvar: c_ulong, + pub rmx_pksent: c_ulong, + pub rmx_weight: c_ulong, + pub rmx_nhidx: c_ulong, + rmx_filler: Padding<[c_ulong; 2]>, + } + + pub struct rt_msghdr { + pub rtm_msglen: c_ushort, + pub rtm_version: c_uchar, + pub rtm_type: c_uchar, + pub rtm_index: c_ushort, + _rtm_spare1: Padding, + pub rtm_flags: c_int, + pub rtm_addrs: c_int, + pub rtm_pid: crate::pid_t, + pub rtm_seq: c_int, + pub rtm_errno: c_int, + pub rtm_fmask: c_int, + pub rtm_inits: c_ulong, + pub rtm_rmx: rt_metrics, + } +} diff --git a/src/new/mod.rs b/src/new/mod.rs index 0472413474f3..13479209d23c 100644 --- a/src/new/mod.rs +++ b/src/new/mod.rs @@ -230,6 +230,7 @@ cfg_if! { pub use net::dlt::*; // FIXME(1.0,remove): these bindings should be left in a public submodule. pub use net::if_mib::*; + pub use net::route::*; pub use netinet6::in6_var::*; pub use sys::file::*; pub use sys::ioccom::*; From 10336e8318fa9b9f1d648546e9258a6323fc4a87 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 4 Aug 2026 11:47:50 +0100 Subject: [PATCH 74/93] docs: update source links for xnu (backport ) (cherry picked from commit 93a17ee8f6cb91cd73dbfd7c5bad88f67dc16164) --- src/unix/bsd/apple/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 4c95b07bc249..801c1ad0d8ad 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -2452,7 +2452,7 @@ pub const F_GLOBAL_NOCACHE: c_int = 55; pub const F_NODIRECT: c_int = 62; pub const F_LOG2PHYS_EXT: c_int = 65; pub const F_BARRIERFSYNC: c_int = 85; -// See https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h +// See https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/fcntl.h pub const F_OFD_SETLK: c_int = 90; /* Acquire or release open file description lock */ pub const F_OFD_SETLKW: c_int = 91; /* (as F_OFD_SETLK but blocking if conflicting lock) */ pub const F_OFD_GETLK: c_int = 92; /* Examine OFD lock */ From 09d0aeece9db9f6ef3c6643886a6e88b06be6881 Mon Sep 17 00:00:00 2001 From: LusterSourav <282348889+LusterSourav@users.noreply.github.com> Date: Tue, 4 Aug 2026 18:01:18 +0530 Subject: [PATCH 75/93] Add `environ` for linux-gnu `environ` is an array of pointers to the environment strings, declared in behind _GNU_SOURCE on glibc. Ref: https://man7.org/linux/man-pages/man7/environ.7.html (backport ) (cherry picked from commit cc7475004d5842014165e1ab27ae9e82ed6cc577) --- libc-test/semver/linux-gnu.txt | 1 + src/unix/linux_like/linux/gnu/mod.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 78ce9936ff4b..4fbcf053c022 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -600,6 +600,7 @@ dlmopen dlvsym eaccess endutxent +environ epoll_pwait2 ethhdr euidaccess diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index d162a2643c36..e8f0c08b95e8 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1319,6 +1319,9 @@ extern "C" { pub fn mempcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; pub fn tgkill(tgid: crate::pid_t, tid: crate::pid_t, sig: c_int) -> c_int; + + // glibc provides this in with _GNU_SOURCE + pub static mut environ: *mut *mut c_char; } cfg_if! { From 47a8f139bf482fd92233af419f0d033171a8f1e6 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 4 Aug 2026 09:07:59 -0500 Subject: [PATCH 76/93] test: Move the build script for `libc-test` to a subdirectory This file could use some organization, so prepare for that. (backport ) (cherry picked from commit 585c32ee48cfbb407a5dfba47c47ede55452a8f9) --- libc-test/Cargo.toml | 1 + libc-test/{build.rs => build/main.rs} | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename libc-test/{build.rs => build/main.rs} (99%) diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 2bc12a29fee5..74bf20b216c2 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -6,6 +6,7 @@ publish = false edition = "2021" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/libc" +build = "build/main.rs" [dependencies] cfg-if = "1.0.4" diff --git a/libc-test/build.rs b/libc-test/build/main.rs similarity index 99% rename from libc-test/build.rs rename to libc-test/build/main.rs index 8bc5cfc38f56..e4e26f510683 100755 --- a/libc-test/build.rs +++ b/libc-test/build/main.rs @@ -190,7 +190,7 @@ fn process_semver_file>(output: &mut W, path: &mut Path fn main() { // Avoid unnecessary re-building. - println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=."); // Ensure version checking works, even if we don't use it. LazyLock::force(&VERSIONS); From 7cad49f22dc4ec12d10bff45d4d4f98c9a9317c4 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 4 Aug 2026 09:16:19 -0500 Subject: [PATCH 77/93] test: Move semver check build portion to a separate file (backport ) (cherry picked from commit 989e84094d67e16de6f28c3de3c1b46f62f62ddf) --- libc-test/build/main.rs | 96 ++------------------------------------- libc-test/build/semver.rs | 90 ++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 91 deletions(-) create mode 100644 libc-test/build/semver.rs diff --git a/libc-test/build/main.rs b/libc-test/build/main.rs index e4e26f510683..521add048706 100755 --- a/libc-test/build/main.rs +++ b/libc-test/build/main.rs @@ -1,26 +1,15 @@ #![allow(clippy::match_like_matches_macro)] +mod semver; + +use std::env; use std::env::VarError; -use std::fs::File; -use std::io::{ - BufRead, - BufReader, - BufWriter, - Write, -}; -use std::path::{ - Path, - PathBuf, -}; +use std::io::Write; use std::process::{ Command, Stdio, }; use std::sync::LazyLock; -use std::{ - env, - io, -}; use regex::Regex; @@ -113,81 +102,6 @@ fn ctest_cfg() -> ctest::TestGenerator { cfg } -fn do_semver() { - let mut out = PathBuf::from(env::var("OUT_DIR").unwrap()); - out.push("semver.rs"); - let mut output = BufWriter::new(File::create(&out).unwrap()); - - let family = env::var("CARGO_CFG_TARGET_FAMILY").unwrap(); - let vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap(); - let os = env::var("CARGO_CFG_TARGET_OS").unwrap(); - let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); - let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); - - // `libc-test/semver` dir. - let mut semver_root = PathBuf::from("semver"); - - // NOTE: Windows has the same `family` as `os`, no point in including it - // twice. - // NOTE: Android doesn't include the unix file (or the Linux file) because - // there are some many definitions missing it's actually easier just to - // maintain a file for Android. - // NOTE: AIX and L4Re do not include the unix file because there are - // definitions missing on these systems. It is easier to maintain separate - // files for them. - if family != os && !matches!(os.as_str(), "android" | "aix" | "l4re") && os != "vxworks" { - process_semver_file(&mut output, &mut semver_root, &family); - } - // We don't do semver for unknown targets. - if vendor != "unknown" { - process_semver_file(&mut output, &mut semver_root, &vendor); - } - process_semver_file(&mut output, &mut semver_root, &os); - let os_arch = format!("{os}-{arch}"); - process_semver_file(&mut output, &mut semver_root, &os_arch); - if !target_env.is_empty() { - let os_env = format!("{os}-{target_env}"); - process_semver_file(&mut output, &mut semver_root, &os_env); - - let os_env_arch = format!("{os}-{target_env}-{arch}"); - process_semver_file(&mut output, &mut semver_root, &os_env_arch); - } -} - -fn process_semver_file>(output: &mut W, path: &mut PathBuf, file: P) { - // NOTE: `path` is reused between calls, so always remove the file again. - path.push(file); - path.set_extension("txt"); - - println!("cargo:rerun-if-changed={}", path.display()); - let input_file = match File::open(&*path) { - Ok(file) => file, - Err(ref err) if err.kind() == io::ErrorKind::NotFound => { - path.pop(); - return; - } - Err(err) => panic!("unexpected error opening file: {err}"), - }; - let input = BufReader::new(input_file); - - writeln!(output, "// Source: {}.", path.display()).unwrap(); - output.write_all(b"use libc::{\n").unwrap(); - for line in input.lines() { - let line = line.unwrap().into_bytes(); - match line.first() { - // Ignore comments and empty lines. - Some(b'#') | None => continue, - _ => { - output.write_all(b" ").unwrap(); - output.write_all(&line).unwrap(); - output.write_all(b",\n").unwrap(); - } - } - } - output.write_all(b"};\n\n").unwrap(); - path.pop(); -} - fn main() { // Avoid unnecessary re-building. println!("cargo:rerun-if-changed=."); @@ -196,7 +110,7 @@ fn main() { do_cc(); do_ctest(); - do_semver(); + semver::do_semver(); } macro_rules! headers { diff --git a/libc-test/build/semver.rs b/libc-test/build/semver.rs new file mode 100644 index 000000000000..e5339fe4faee --- /dev/null +++ b/libc-test/build/semver.rs @@ -0,0 +1,90 @@ +use std::fs::File; +use std::io::{ + BufRead, + BufReader, + BufWriter, + Write, +}; +use std::path::{ + Path, + PathBuf, +}; +use std::{ + env, + io, +}; + +pub(crate) fn do_semver() { + let mut out = PathBuf::from(env::var("OUT_DIR").unwrap()); + out.push("semver.rs"); + let mut output = BufWriter::new(File::create(&out).unwrap()); + + let family = env::var("CARGO_CFG_TARGET_FAMILY").unwrap(); + let vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap(); + let os = env::var("CARGO_CFG_TARGET_OS").unwrap(); + let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); + + // `libc-test/semver` dir. + let mut semver_root = PathBuf::from("semver"); + + // NOTE: Windows has the same `family` as `os`, no point in including it + // twice. + // NOTE: Android doesn't include the unix file (or the Linux file) because + // there are some many definitions missing it's actually easier just to + // maintain a file for Android. + // NOTE: AIX and L4Re do not include the unix file because there are + // definitions missing on these systems. It is easier to maintain separate + // files for them. + if family != os && !matches!(os.as_str(), "android" | "aix" | "l4re") && os != "vxworks" { + process_semver_file(&mut output, &mut semver_root, &family); + } + // We don't do semver for unknown targets. + if vendor != "unknown" { + process_semver_file(&mut output, &mut semver_root, &vendor); + } + process_semver_file(&mut output, &mut semver_root, &os); + let os_arch = format!("{os}-{arch}"); + process_semver_file(&mut output, &mut semver_root, &os_arch); + if !target_env.is_empty() { + let os_env = format!("{os}-{target_env}"); + process_semver_file(&mut output, &mut semver_root, &os_env); + + let os_env_arch = format!("{os}-{target_env}-{arch}"); + process_semver_file(&mut output, &mut semver_root, &os_env_arch); + } +} + +fn process_semver_file>(output: &mut W, path: &mut PathBuf, file: P) { + // NOTE: `path` is reused between calls, so always remove the file again. + path.push(file); + path.set_extension("txt"); + + println!("cargo:rerun-if-changed={}", path.display()); + let input_file = match File::open(&*path) { + Ok(file) => file, + Err(ref err) if err.kind() == io::ErrorKind::NotFound => { + path.pop(); + return; + } + Err(err) => panic!("unexpected error opening file: {err}"), + }; + let input = BufReader::new(input_file); + + writeln!(output, "// Source: {}.", path.display()).unwrap(); + output.write_all(b"use libc::{\n").unwrap(); + for line in input.lines() { + let line = line.unwrap().into_bytes(); + match line.first() { + // Ignore comments and empty lines. + Some(b'#') | None => continue, + _ => { + output.write_all(b" ").unwrap(); + output.write_all(&line).unwrap(); + output.write_all(b",\n").unwrap(); + } + } + } + output.write_all(b"};\n\n").unwrap(); + path.pop(); +} From e087fef1b960b7a544b57b499454434c4da3b069 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 6 Aug 2026 03:56:18 -0500 Subject: [PATCH 78/93] haiku: Use `i32::MIN` rather than `core::i32::MIN` Avoid a new deprecation warning. (backport ) (cherry picked from commit df2900ea149e1c882b82b84d91feef3d8fc795e3) --- src/unix/haiku/native.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index bc0cd5e15bd5..3700d9e71d6e 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -650,7 +650,7 @@ pub const B_DIRECTORY_NODE: u32 = 0x04; pub const B_ANY_NODE: u32 = 0x07; // support/Errors.h -pub const B_GENERAL_ERROR_BASE: status_t = core::i32::MIN; +pub const B_GENERAL_ERROR_BASE: status_t = i32::MIN; pub const B_OS_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x1000; pub const B_APP_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x2000; pub const B_INTERFACE_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x3000; From e982dd0e5f842d5ed16e07e8aeb139cae60ecd20 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 6 Aug 2026 01:42:18 -0500 Subject: [PATCH 79/93] build: Add a warning if using `RUST_LIBC_UNSTABLE_MUSL_V1_2_3` Closes: https://github.com/rust-lang/libc/issues/5343 (backport ) (cherry picked from commit 6a04ef15d1302ad66c1b282f5f868542718a8c15) --- build.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.rs b/build.rs index e3d2a89feeb0..4a5e154f85a2 100644 --- a/build.rs +++ b/build.rs @@ -151,6 +151,13 @@ fn main() { } let mut musl_v1_2_3 = env_flag("CARGO_CFG_LIBC_UNSTABLE_MUSL_V1_2_3"); + if let Ok(old_musl_v1_2_3) = env::var("RUST_LIBC_UNSTABLE_MUSL_V1_2_3") { + println!( + "cargo:warning=RUST_LIBC_UNSTABLE_MUSL_V1_2_3 will be removed; \ + set `--cfg=libc_unstable_musl_v1_2_3` via RUSTFLAGS instead" + ); + musl_v1_2_3 |= old_musl_v1_2_3 != "0"; + } // OpenHarmony uses a fork of the musl libc let musl = target_env == "musl" || target_env == "ohos"; From 66958409ee56274da5706ff993f838daa0de5278 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 6 Aug 2026 01:47:26 -0500 Subject: [PATCH 80/93] test: Simplify musl_v1_2_3 config (backport ) (cherry picked from commit 3a6ec284fcb676598ecf097243d56dafe0937393) --- libc-test/build/main.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libc-test/build/main.rs b/libc-test/build/main.rs index 521add048706..97ab56860870 100755 --- a/libc-test/build/main.rs +++ b/libc-test/build/main.rs @@ -4080,6 +4080,7 @@ fn test_linux(target: &str) { let mips64 = target.contains("mips64"); let mips32 = mips && !mips64; let pauthtest = target.contains("pauthtest"); + let b32 = arm || target.contains("hexagon") || mips32 || ppc32 || x86_32; let versions = &*VERSIONS; let kernel = match versions.linux { Some(v) => v, @@ -4087,17 +4088,21 @@ fn test_linux(target: &str) { None => panic!("failed to detect kernel version for Linux target {target}"), }; - // Force modern musl also for pauthtest. - let musl_v1_2_3 = env_flag("CARGO_CFG_LIBC_UNSTABLE_MUSL_V1_2_3") || pauthtest; + let mut musl_v1_2_3 = env_flag("CARGO_CFG_LIBC_UNSTABLE_MUSL_V1_2_3"); if musl_v1_2_3 { assert!(musl); } - let old_musl = musl && !musl_v1_2_3; - let b32 = arm || target.contains("hexagon") || mips32 || ppc32 || x86_32; + // Some platforms only exist with recent musl. Keep in sync with libc's build.rs. + if musl && (loongarch64 || hexagon || pauthtest/* || ohos */) { + musl_v1_2_3 = true; + } + + let old_musl = musl && !musl_v1_2_3; let mut cfg = ctest_cfg(); - if (musl_v1_2_3 || loongarch64 || hexagon) && musl { + + if musl_v1_2_3 { cfg.cfg("musl_v1_2_3", None); if b32 { cfg.cfg("musl32_time64", None); @@ -4107,6 +4112,7 @@ fn test_linux(target: &str) { cfg.cfg("musl_redir_time64", None); } } + let uclibc_use_time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64"); if uclibc && uclibc_use_time64 { cfg.cfg("linux_time_bits64", None); From ddd81ab4191dbb0e114e7ecde0005760bb6299d8 Mon Sep 17 00:00:00 2001 From: Aelin Reidel Date: Fri, 7 Aug 2026 19:18:01 +0200 Subject: [PATCH 81/93] libc-test: re-enable some skipped tests on powerpc64 These tests pass just fine for me on powerpc64le-unknown-linux-musl, powerpc64-unknown-linux-musl and powerpc64le-unknown-linux-gnu. (backport ) (cherry picked from commit 7dcbee3f57986bd100db5c057145fec4abcaafdd) --- libc-test/build/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libc-test/build/main.rs b/libc-test/build/main.rs index 97ab56860870..7367e4199529 100755 --- a/libc-test/build/main.rs +++ b/libc-test/build/main.rs @@ -4456,7 +4456,7 @@ fn test_linux(target: &str) { // FIXME(rust-lang/rust#43894): pass by value for structs that are not an even 32/64 bits // on big-endian systems corrupts the value for unknown reasons. - if (sparc64 || ppc || ppc64 || s390x) + if (sparc64 || ppc || s390x) && (ty == "sockaddr_pkt" || ty == "tpacket_auxdata" || ty == "tpacket_hdr_variant1" @@ -4500,7 +4500,7 @@ fn test_linux(target: &str) { // FIXME(ppc): tests fail due to a field type mismatch (`long long unsigned` vs // `long unsigned`). - "clone_args" if ppc64 => true, + "clone_args" if ppc64 && gnu => true, // Linux >= 6.13 (pidfd_info.exit_code: Linux >= 6.15) // Might differ between kernel versions @@ -5428,7 +5428,7 @@ fn test_linux(target: &str) { "bcm_msg_head" => true, // FIXME(linux): the call ABI of max_align_t is incorrect on these platforms: - "max_align_t" if i686 || ppc64 => true, + "max_align_t" if i686 => true, _ => false, }); From 3f671b84560e7abf36a162665f4aa25b218761b8 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sun, 2 Aug 2026 22:15:58 +0100 Subject: [PATCH 82/93] clippy: fix manual_bits lint https://rust-lang.github.io/rust-clippy/master/#manual_bits (backport ) (cherry picked from commit 374dc52053d09a168af37279382fb3bda08ba559) --- src/unix/bsd/freebsdlike/freebsd/mod.rs | 6 +++--- src/unix/hurd/mod.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 0df0e40faf3b..b2e5fffc1a33 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -4492,19 +4492,19 @@ f! { } pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpuset_t) -> () { - let bitset_bits = 8 * size_of::(); + let bitset_bits = c_long::BITS as usize; let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); cpuset.__bits[idx] |= 1 << offset; } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpuset_t) -> () { - let bitset_bits = 8 * size_of::(); + let bitset_bits = c_long::BITS as usize; let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); cpuset.__bits[idx] &= !(1 << offset); } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpuset_t) -> bool { - let bitset_bits = 8 * size_of::(); + let bitset_bits = c_long::BITS as usize; let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); 0 != cpuset.__bits[idx] & (1 << offset) } diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index e90797cd105f..d3d1792135ea 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -2579,7 +2579,7 @@ pub const SCHED_FIFO: c_int = 1; pub const SCHED_RR: c_int = 2; pub const _BITS_TYPES_STRUCT_SCHED_PARAM: usize = 1; pub const __CPU_SETSIZE: usize = 1024; -pub const __NCPUBITS: usize = 8 * size_of::<__cpu_mask>(); +pub const __NCPUBITS: usize = __cpu_mask::BITS as usize; pub const CPU_SETSIZE: usize = 1024; // pthread.h From 6e4a0b89bf2425176d82dd78c54216398f9278fe Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sun, 2 Aug 2026 22:28:18 +0100 Subject: [PATCH 83/93] freebsd: use size_of_val for bitset calculations (backport ) (cherry picked from commit 5061bd84e5e41e3987306fd072af46cc91873084) --- src/unix/bsd/freebsdlike/freebsd/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index b2e5fffc1a33..c83f32fa484d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -4492,19 +4492,19 @@ f! { } pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpuset_t) -> () { - let bitset_bits = c_long::BITS as usize; + let bitset_bits = 8 * size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); cpuset.__bits[idx] |= 1 << offset; } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpuset_t) -> () { - let bitset_bits = c_long::BITS as usize; + let bitset_bits = 8 * size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); cpuset.__bits[idx] &= !(1 << offset); } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpuset_t) -> bool { - let bitset_bits = c_long::BITS as usize; + let bitset_bits = 8 * size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); 0 != cpuset.__bits[idx] & (1 << offset) } @@ -4512,7 +4512,7 @@ f! { pub unsafe fn CPU_COUNT(cpuset: &cpuset_t) -> c_int { let mut s: u32 = 0; let cpuset_size = size_of::(); - let bitset_size = size_of::(); + let bitset_size = size_of_val(&cpuset.__bits[0]); for i in &cpuset.__bits[..(cpuset_size / bitset_size)] { s += i.count_ones(); } From 4a7bda629d3a91402012575b1a96653b14933ea9 Mon Sep 17 00:00:00 2001 From: LusterSourav <282348889+LusterSourav@users.noreply.github.com> Date: Fri, 7 Aug 2026 09:23:00 +0530 Subject: [PATCH 84/93] remove stale sparc64 roundtrip skips (backport ) (cherry picked from commit 7f28e6e067e90da5bb58efd16966fb227a8d3294) --- libc-test/build/main.rs | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/libc-test/build/main.rs b/libc-test/build/main.rs index 7367e4199529..29b221a5e5f6 100755 --- a/libc-test/build/main.rs +++ b/libc-test/build/main.rs @@ -5395,30 +5395,6 @@ fn test_linux(target: &str) { // FIXME(union): This is actually a union. "fpreg_t" if s390x => true, - // The test doesn't work on some env: - "ipv6_mreq" - | "ip_mreq_source" - | "sockaddr_in6" - | "sockaddr_ll" - | "in_pktinfo" - | "arpreq" - | "arpreq_old" - | "sockaddr_un" - | "ff_constant_effect" - | "ff_ramp_effect" - | "ff_condition_effect" - | "Elf32_Ehdr" - | "Elf32_Chdr" - | "ucred" - | "in6_pktinfo" - | "sockaddr_nl" - | "termios" - | "nlmsgerr" - if sparc64 && gnu => - { - true - } - // The following types contain Flexible Array Member fields which have unspecified calling // convention. The roundtripping tests deliberately pass the structs by value to check "by // value" layout consistency, but this would be UB for the these types. From 64bcac1595c650d2cebe1e4f69132c9572b8537f Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Fri, 7 Aug 2026 09:26:52 +0200 Subject: [PATCH 85/93] android: stop skipping `ioctl` in tests Remove skip for `ioctl` and add `#define` for the macro required to get this symbol's overload not to be exposed [^1]. This should allow there to be only a single function signature against which to match. [^1]: (backport ) (cherry picked from commit 60e768445ef2aed7355d729d893377c898afa5e1) --- libc-test/build/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libc-test/build/main.rs b/libc-test/build/main.rs index 29b221a5e5f6..468260f997a5 100755 --- a/libc-test/build/main.rs +++ b/libc-test/build/main.rs @@ -2079,6 +2079,10 @@ fn test_android(target: &str) { let mut cfg = ctest_cfg(); cfg.define("_GNU_SOURCE", None); + // This ensure we avoid the `ioctl` overload for request parameters that use + // an unsigned integer instead of a signed integer. + cfg.define("BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD", None); + headers!( cfg, "arpa/inet.h", @@ -2509,10 +2513,6 @@ fn test_android(target: &str) { // Added in API level 24 "if_nameindex" | "if_freenameindex" => true, - // FIXME(ctest): In our current method of testing, we cast the function to a `void *`, - // which is not possible for functions that have been overloaded. - "ioctl" => true, - _ => false, } }); From 0cbfc731c4e0b0c74204f4ee3bce71978013484a Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Sat, 8 Aug 2026 08:12:25 +0200 Subject: [PATCH 86/93] Define max_align_t for s390x-linux The proper value for max_align_t was determined with the help of a small C program which yielded a size of 24 for max_align_t with an alignment of 8 bytes when compiled and run on s390x-linux: glaubitz@zelenka:~$ cat max_align_t.c #include #include int main() { printf("sizeof(max_align_t): %d\n", sizeof(max_align_t)); printf("_Alignof(max_align_t): %d\n", _Alignof(max_align_t)); return 0; } glaubitz@zelenka:~$ gcc max_align_t.c -o max_align_t glaubitz@zelenka:~$ ./max_align_t sizeof(max_align_t): 24 _Alignof(max_align_t): 8 glaubitz@zelenka:~$ (backport ) (cherry picked from commit 81abd818f59046e3e09b0bcceec17af8f738004a) --- libc-test/semver/linux-s390x.txt | 1 + src/unix/linux_like/linux/gnu/b64/s390x.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/libc-test/semver/linux-s390x.txt b/libc-test/semver/linux-s390x.txt index f2a16a6d8fe6..e5a4c347b5e5 100644 --- a/libc-test/semver/linux-s390x.txt +++ b/libc-test/semver/linux-s390x.txt @@ -104,4 +104,5 @@ flock64 fpreg_t fpregset_t greg_t +max_align_t termios2 diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index c5a7cc414a32..c72a3f0d9609 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -239,6 +239,13 @@ cfg_if! { } } +s_no_extra_traits! { + #[repr(align(8))] + pub struct max_align_t { + priv_: [i64; 3], + } +} + pub const POSIX_FADV_DONTNEED: c_int = 6; pub const POSIX_FADV_NOREUSE: c_int = 7; From e2d326d0597c19371af8b96c4b82831665983d93 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Tue, 9 Jun 2026 12:27:35 +0200 Subject: [PATCH 87/93] linux(musl): annotate lfs bindings for deprecation Leave a comment to deprecate LFS types once we reach stage 3 of the 64-bit deprecation story [^1]. [^1]: rust-lang/libc#4805 (backport ) (cherry picked from commit 0773a6009d751b3f0e554926b7e74673b218351d) --- src/unix/linux_like/l4re/uclibc/mod.rs | 1 + src/unix/linux_like/linux/mod.rs | 8 ++++++++ src/unix/linux_like/linux/musl/b32/arm/mod.rs | 2 -- src/unix/linux_like/linux/musl/b32/hexagon.rs | 1 - src/unix/linux_like/linux/musl/b32/mips/mod.rs | 3 +-- src/unix/linux_like/linux/musl/b32/powerpc.rs | 2 -- src/unix/linux_like/linux/musl/b32/riscv32/mod.rs | 2 -- src/unix/linux_like/linux/musl/b32/x86/mod.rs | 2 -- src/unix/linux_like/linux/musl/b64/aarch64/mod.rs | 2 -- .../linux_like/linux/musl/b64/loongarch64/mod.rs | 2 -- src/unix/linux_like/linux/musl/b64/mips64.rs | 3 +-- src/unix/linux_like/linux/musl/b64/powerpc64.rs | 2 -- src/unix/linux_like/linux/musl/b64/riscv64/mod.rs | 2 -- src/unix/linux_like/linux/musl/b64/s390x.rs | 3 ++- src/unix/linux_like/linux/musl/b64/wasm32/mod.rs | 2 -- src/unix/linux_like/linux/musl/b64/x86_64/mod.rs | 2 -- src/unix/linux_like/linux/musl/mod.rs | 13 +++++++++++-- src/unix/linux_like/linux_l4re_shared.rs | 14 +++++++++++++- 18 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/unix/linux_like/l4re/uclibc/mod.rs b/src/unix/linux_like/l4re/uclibc/mod.rs index e89794648997..06add53ad9ea 100644 --- a/src/unix/linux_like/l4re/uclibc/mod.rs +++ b/src/unix/linux_like/l4re/uclibc/mod.rs @@ -284,6 +284,7 @@ s! { pub __wc: crate::wchar_t, } + // FIXME(1.0,deprecate): lfs binding to be removed pub struct fpos64_t { pub __pos: crate::off64_t, pub __mbstate: __mbstate_t, diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index a41d03d9f808..09e6a6c3aca2 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -18,6 +18,7 @@ pub type dev_t = u64; pub type socklen_t = u32; pub type mode_t = u32; pub type ino64_t = u64; +// FIXME(1.0,deprecate): lfs binding to be removed pub type off64_t = i64; pub type blkcnt64_t = i64; pub type rlim64_t = u64; @@ -1012,6 +1013,7 @@ s! { cfg_if! { if #[cfg(not(target_env = "gnu"))] { extern_ty! { + // FIXME(1.0,deprecate): lfs binding to be removed pub type fpos64_t; // FIXME(linux): fill this out with a struct } } @@ -3528,7 +3530,10 @@ extern "C" { pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int; #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")] pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; + #[cfg(not(any(target_env = "musl", target_env = "ohos")))] pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t; + #[cfg(any(target_env = "musl", target_env = "ohos"))] + pub fn readahead(fd: c_int, offset: off_t, count: size_t) -> ssize_t; pub fn getxattr( path: *const c_char, name: *const c_char, @@ -3616,7 +3621,10 @@ extern "C" { // Not available now on Android pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; + #[cfg(not(any(target_env = "musl", target_env = "ohos")))] pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int; + #[cfg(any(target_env = "musl", target_env = "ohos"))] + pub fn sync_file_range(fd: c_int, offset: off_t, nbytes: off_t, flags: c_uint) -> c_int; pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index 26d3380eb7ba..81ea674f6b04 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = u32; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs index c8c3377c53ab..c99411c15e7e 100644 --- a/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -1,7 +1,6 @@ use crate::prelude::*; pub type wchar_t = u32; -pub type stat64 = crate::stat; s! { pub struct stat { diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index 7edcf573d279..78768ad322ab 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, @@ -149,6 +147,7 @@ s! { pub f_spare: [c_ulong; 5], } + // FIXME(1.0,deprecate): lfs binding to be removed pub struct statfs64 { pub f_type: c_ulong, pub f_bsize: c_ulong, diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index f0d92c0e936e..92b00f4847cd 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = i32; -pub type stat64 = stat; - s! { pub struct termios { pub c_iflag: crate::tcflag_t, diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index 1dea8d224bf8..0356645fe872 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -5,8 +5,6 @@ use crate::prelude::*; pub type wchar_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index 1a348078764f..0b285911006e 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -3,8 +3,6 @@ use crate::prelude::*; pub type wchar_t = i32; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index 04bbb8d22386..1821cf5572f9 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -5,8 +5,6 @@ pub type wchar_t = u32; pub type nlink_t = u32; pub type blksize_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs index 27853cdbf599..fcbf8a8be7b2 100644 --- a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs @@ -8,8 +8,6 @@ pub type wchar_t = c_int; pub type nlink_t = c_uint; pub type blksize_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/mips64.rs b/src/unix/linux_like/linux/musl/b64/mips64.rs index dc59d58be8dd..6f926cbaf3b5 100644 --- a/src/unix/linux_like/linux/musl/b64/mips64.rs +++ b/src/unix/linux_like/linux/musl/b64/mips64.rs @@ -5,8 +5,6 @@ pub type wchar_t = i32; pub type nlink_t = c_uint; pub type blksize_t = i64; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, @@ -74,6 +72,7 @@ s! { pub f_spare: [c_ulong; 5], } + // FIXME(1.0,deprecate): lfs binding to be removed pub struct statfs64 { pub f_type: c_ulong, pub f_bsize: c_ulong, diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/linux_like/linux/musl/b64/powerpc64.rs index 32c380789c01..8c62d2e57a52 100644 --- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs +++ b/src/unix/linux_like/linux/musl/b64/powerpc64.rs @@ -5,8 +5,6 @@ pub type wchar_t = i32; pub type nlink_t = u64; pub type blksize_t = c_long; -pub type stat64 = stat; - s! { pub struct termios { pub c_iflag: crate::tcflag_t, diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index 4baced6f19b9..863003fe7ba5 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -8,8 +8,6 @@ pub type wchar_t = c_int; pub type nlink_t = c_uint; pub type blksize_t = c_int; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs index 3291acc7bbb2..cb32228c3dd7 100644 --- a/src/unix/linux_like/linux/musl/b64/s390x.rs +++ b/src/unix/linux_like/linux/musl/b64/s390x.rs @@ -5,8 +5,9 @@ pub type blksize_t = i64; pub type nlink_t = u64; pub type wchar_t = i32; pub type greg_t = u64; + +// FIXME(1.0,deprecate): lfs binding to be removed pub type statfs64 = statfs; -pub type stat64 = stat; s! { pub struct ipc_perm { diff --git a/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs b/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs index 7064a137acca..ce7ab543e490 100644 --- a/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs @@ -7,8 +7,6 @@ pub type wchar_t = i32; pub type nlink_t = u64; pub type blksize_t = c_long; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index 805457f16ce1..caf79eb3d618 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -6,8 +6,6 @@ pub type nlink_t = u64; pub type blksize_t = c_long; pub type greg_t = i64; -pub type stat64 = stat; - s! { pub struct stat { pub st_dev: crate::dev_t, diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 26a7248ac608..24e7c8c98872 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -37,11 +37,16 @@ pub type shmatt_t = c_ulong; pub type msgqnum_t = c_ulong; pub type msglen_t = c_ulong; pub type fsblkcnt_t = c_ulonglong; -pub type fsblkcnt64_t = c_ulonglong; pub type fsfilcnt_t = c_ulonglong; -pub type fsfilcnt64_t = c_ulonglong; pub type rlim_t = c_ulonglong; +// FIXME(1.0,deprecate): lfs binding to be removed +pub type fsblkcnt64_t = c_ulonglong; +// FIXME(1.0,deprecate): lfs binding to be removed +pub type fsfilcnt64_t = c_ulonglong; +// FIXME(1.0,deprecate): lfs binding to be removed +pub type stat64 = stat; + cfg_if! { if #[cfg(doc)] { // Used in `linux::arch` to define ioctl constants. @@ -208,6 +213,7 @@ s! { __f_reserved: Padding<[c_int; 6]>, } + // FIXME(1.0,deprecate): lfs binding to be removed pub struct statvfs64 { pub f_bsize: c_ulong, pub f_frsize: c_ulong, @@ -249,6 +255,7 @@ s! { pub l_pid: crate::pid_t, } + // FIXME(1.0,deprecate): lfs binding to be removed pub struct flock64 { pub l_type: c_short, pub l_whence: c_short, @@ -415,6 +422,7 @@ s! { } // MIPS/s390x implementation is special (see arch folders) + // FIXME(1.0,deprecate): lfs binding to be removed #[cfg(not(any(target_arch = "mips", target_arch = "mips64", target_arch = "s390x")))] pub struct statfs64 { pub f_type: c_ulong, @@ -887,6 +895,7 @@ extern "C" { } // Alias to 64 to mimic glibc's LFS64 support +// FIXME(1.0,deprecate): lfs binding to be removed mod lfs64; pub use self::lfs64::*; diff --git a/src/unix/linux_like/linux_l4re_shared.rs b/src/unix/linux_like/linux_l4re_shared.rs index ed9e429c03a1..310c0412403d 100644 --- a/src/unix/linux_like/linux_l4re_shared.rs +++ b/src/unix/linux_like/linux_l4re_shared.rs @@ -275,6 +275,7 @@ s! { pub val: c_int, } + // FIXME(1.0,deprecate): lfs binding to be removed pub struct rlimit64 { pub rlim_cur: crate::rlim64_t, pub rlim_max: crate::rlim64_t, @@ -297,6 +298,7 @@ s! { pub d_name: [c_char; 256], } + // FIXME(1.0,deprecate): lfs binding to be removed pub struct dirent64 { pub d_ino: crate::ino64_t, pub d_off: crate::off64_t, @@ -1911,7 +1913,7 @@ extern "C" { longindex: *mut c_int, ) -> c_int; - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_env = "musl", target_env = "ohos")))] pub fn copy_file_range( fd_in: c_int, off_in: *mut crate::off64_t, @@ -1920,6 +1922,16 @@ extern "C" { len: size_t, flags: c_uint, ) -> ssize_t; + + #[cfg(any(target_env = "musl", target_env = "ohos"))] + pub fn copy_file_range( + fd_in: c_int, + off_in: *mut crate::off_t, + fd_out: c_int, + off_out: *mut crate::off_t, + len: size_t, + flags: c_uint, + ) -> ssize_t; } cfg_if! { From 169e1d56e15abe20381bbb3fcce4313bbee7fe18 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 9 Aug 2026 17:20:54 -0400 Subject: [PATCH 88/93] deps: Bump `cc` to 1.4.2 https://github.com/rust-lang/cc-rs/pull/1845 was released which fixes builds, so we can remove the pin. Effectively reverts c10647790eed ("fix(ci): pin cc to 1.4.0"). (backport ) (cherry picked from commit 6f69e13e0be1aa071e9a399009828703ba24214d) --- Cargo.lock | 8 ++++---- libc-test/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12bcc4cf55b2..d977be0b7d5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,9 +80,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.3.0" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89588d05638b5b4594a3348a2d6c20277e43a7f5c5202b05cc56888475a47b8" +checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273" dependencies = [ "find-msvc-tools", "shlex", @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890" [[package]] name = "glob" diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 74bf20b216c2..12be9b3fafb7 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -19,7 +19,7 @@ glob = "0.3.3" annotate-snippets = { version = "0.11.5", features = ["testing-colors"] } [build-dependencies] -cc = "1.2.43" +cc = "1.4.2" # Use the in-tree `ctest` from the `main` branch via crates.io ctest = "0.5.0-beta.3" regex = "1.13.0" From 83073e1f2562c1666e15c5cfc25f72e84c3475e2 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 9 Aug 2026 17:24:13 -0400 Subject: [PATCH 89/93] deps: Run `cargo update` [ reapplied for 0.2 - Trevor ] (backport ) (cherry picked from commit 116b9ec3d8fed19fa25ceb90c75cfd27d6009be2) --- Cargo.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d977be0b7d5e..70bfea50a5c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" dependencies = [ "memchr", ] @@ -120,9 +120,9 @@ checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890" [[package]] name = "glob" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" [[package]] name = "itoa" @@ -196,9 +196,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.16" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" dependencies = [ "aho-corasick", "memchr", @@ -249,7 +249,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 3.0.2", + "syn 3.0.4", ] [[package]] @@ -284,9 +284,9 @@ dependencies = [ [[package]] name = "syn" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a207d6d6a2b7fc470b80443726053f18a2481b7e1eee970597051596567987a3" +checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f" dependencies = [ "proc-macro2", "quote", @@ -295,22 +295,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.19" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.19" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" dependencies = [ "proc-macro2", "quote", - "syn 3.0.2", + "syn 3.0.4", ] [[package]] From e1eec0ffdc8b1da41aaf3ac26ace002ada10f3e1 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 11 Aug 2026 06:16:59 -0400 Subject: [PATCH 90/93] Remove most items that have been deprecated since before 0.2.100 Most of these got removed upstream a long time ago and have been deprecated in `libc` for at least five years. Delete them, which allows for some test code cleanup. Closes: https://github.com/rust-lang/libc/issues/1356 Closes: https://github.com/rust-lang/libc/issues/1896 (backport ) (cherry picked from commit e2b191dea039d531d8e0060b4b3aedf85948f775) --- libc-test/build/main.rs | 43 +------------------ libc-test/semver/TODO-linux.txt | 3 -- libc-test/semver/android.txt | 2 - libc-test/semver/linux-aarch64.txt | 1 - libc-test/semver/linux-i686.txt | 4 -- libc-test/semver/linux-loongarch64.txt | 1 - libc-test/semver/linux-mips.txt | 3 -- libc-test/semver/linux-powerpc.txt | 4 -- libc-test/semver/linux-powerpc64.txt | 4 -- libc-test/semver/linux-s390x.txt | 4 -- libc-test/semver/linux-sparc64.txt | 3 -- libc-test/semver/linux-x86_64.txt | 1 - libc-test/semver/linux.txt | 2 - src/unix/bsd/apple/b32/mod.rs | 4 -- src/unix/bsd/apple/b64/mod.rs | 4 -- src/unix/bsd/apple/mod.rs | 22 ---------- src/unix/bsd/freebsdlike/freebsd/mod.rs | 23 ---------- src/unix/bsd/freebsdlike/mod.rs | 12 ------ src/unix/linux_like/android/b32/x86/mod.rs | 9 ++-- src/unix/linux_like/android/b64/x86_64/mod.rs | 9 ++-- src/unix/linux_like/android/mod.rs | 10 +---- src/unix/linux_like/emscripten/mod.rs | 4 -- src/unix/linux_like/linux/gnu/b32/arm/mod.rs | 2 - src/unix/linux_like/linux/gnu/b32/csky/mod.rs | 2 - src/unix/linux_like/linux/gnu/b32/m68k/mod.rs | 11 ++--- src/unix/linux_like/linux/gnu/b32/mips/mod.rs | 9 ++-- src/unix/linux_like/linux/gnu/b32/mod.rs | 6 +-- src/unix/linux_like/linux/gnu/b32/powerpc.rs | 11 ++--- .../linux_like/linux/gnu/b32/sparc/mod.rs | 9 ++-- src/unix/linux_like/linux/gnu/b32/x86/mod.rs | 11 ++--- .../linux_like/linux/gnu/b64/aarch64/mod.rs | 2 - .../linux/gnu/b64/loongarch64/mod.rs | 1 - .../linux_like/linux/gnu/b64/mips64/mod.rs | 9 ++-- .../linux_like/linux/gnu/b64/powerpc64/mod.rs | 11 ++--- src/unix/linux_like/linux/gnu/b64/s390x.rs | 11 ++--- .../linux_like/linux/gnu/b64/sparc64/mod.rs | 9 ++-- .../linux_like/linux/gnu/b64/x86_64/mod.rs | 2 - .../linux/gnu/b64/x86_64/not_x32.rs | 9 ++-- src/unix/linux_like/linux/mod.rs | 12 ------ .../linux_like/linux/musl/b32/mips/mod.rs | 9 ++-- src/unix/linux_like/linux/musl/b32/powerpc.rs | 9 ++-- src/unix/linux_like/linux/musl/b32/x86/mod.rs | 9 ++-- src/unix/linux_like/linux/musl/b64/mips64.rs | 9 ++-- .../linux_like/linux/musl/b64/powerpc64.rs | 9 ++-- src/unix/linux_like/linux/musl/b64/s390x.rs | 9 ++-- .../linux_like/linux/musl/b64/wasm32/mod.rs | 6 +-- .../linux_like/linux/musl/b64/x86_64/mod.rs | 9 ++-- src/unix/linux_like/linux/musl/mod.rs | 3 -- .../linux/uclibc/mips/mips32/mod.rs | 9 ++-- src/unix/linux_like/linux_l4re_shared.rs | 8 +--- 50 files changed, 68 insertions(+), 320 deletions(-) diff --git a/libc-test/build/main.rs b/libc-test/build/main.rs index 468260f997a5..597f75f1cfd7 100755 --- a/libc-test/build/main.rs +++ b/libc-test/build/main.rs @@ -289,10 +289,6 @@ fn test_apple(target: &str) { match constant.ident() { // They're declared via `deprecated_mach` and we don't support it anymore. x if x.starts_with("VM_FLAGS_") => true, - // FIXME(deprecated): These OSX constants are removed in Sierra. - // https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html - "KERN_KDENABLE_BG_TRACE" | "KERN_KDDISABLE_BG_TRACE" => true, - // FIXME(deprecated): Removed since 12.0.1 / xnu-8019.41.5. See `ttycom.h` at // https://github.com/apple-oss-distributions/xnu/commit/e6231be02a03711ca404e5121a151b24afbff733 "TIOCREMOTE" => true, @@ -1459,7 +1455,6 @@ fn test_netbsd(target: &str) { cfg.skip_const(move |constant| { match constant.ident() { "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness - "SIGUNUSED" => true, // removed in glibc 2.26 // deprecated, obsolete upstream "PT_LWPINFO" | "PL_EVENT_NONE" | "PL_EVENT_SIGNAL" | "PL_EVENT_SUSPENDED" => true, @@ -2328,14 +2323,8 @@ fn test_android(target: &str) { // The `ARPHRD_CAN` is tested in the `linux_if_arp.rs` tests: "ARPHRD_CAN" => true, - // FIXME(deprecated): deprecated: not available in any header - // See: https://github.com/rust-lang/libc/issues/1356 - "ENOATTR" => true, - // FIXME(android): still necessary? "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness - // FIXME(deprecated): deprecated - removed in glibc 2.26 - "SIGUNUSED" => true, // Needs a newer Android SDK for the definition "P_PIDFD" => true, @@ -2389,7 +2378,6 @@ fn test_android(target: &str) { | "ALG_SET_DRBG_ENTROPY" => true, // FIXME(android): Something has been changed on r26b: - | "IPPROTO_MAX" | "NFNL_SUBSYS_COUNT" | "NF_NETDEV_NUMHOOKS" | "NFT_MSG_MAX" @@ -2823,11 +2811,6 @@ fn test_freebsd(target: &str) { true } - // FIXME(deprecated): These are deprecated - remove in a couple of releases. - // These constants were removed in FreeBSD 11 (svn r273250) but will - // still be accepted and ignored at runtime. - "MAP_RENAME" | "MAP_NORESERVE" => true, - // FIXME(deprecated): These are deprecated - remove in a couple of releases. // These constants were removed in FreeBSD 11 (svn r262489), // and they've never had any legitimate use outside of the @@ -2879,12 +2862,6 @@ fn test_freebsd(target: &str) { // had any legitimate use outside of the base system anyway. "CTL_P1003_1B_MAXID" => true, - // This was renamed in FreeBSD 12.2 and 13 (r352486). - "CTL_UNSPEC" | "CTL_SYSCTL" => true, - - // This was renamed in FreeBSD 12.2 and 13 (r350749). - "IPPROTO_SEP" | "IPPROTO_DCCP" => true, - // This was changed to 96(0x60) in FreeBSD 13: // https://github.com/freebsd/freebsd/ // commit/06b00ceaa914a3907e4e27bad924f44612bae1d7 @@ -3481,10 +3458,6 @@ fn test_emscripten(target: &str) { cfg.skip_const(move |constant| { match constant.ident() { - // FIXME(deprecated): deprecated - SIGNUNUSED was removed in glibc 2.26 - // users should use SIGSYS instead - "SIGUNUSED" => true, - // FIXME(emscripten): emscripten uses different constants to constructs these n if n.contains("__SIZEOF_PTHREAD") => true, @@ -4914,14 +4887,6 @@ fn test_linux(target: &str) { // because including `linux/if_arp.h` causes some conflicts: "ARPHRD_CAN" => true, - // FIXME(deprecated): deprecated: not available in any header - // See: https://github.com/rust-lang/libc/issues/1356 - "ENOATTR" => true, - - // FIXME(deprecated): SIGUNUSED was removed in glibc 2.26 - // Users should use SIGSYS instead. - "SIGUNUSED" => true, - // FIXME(linux): conflicts with glibc headers and is tested in // `linux_termios.rs` below: "BOTHER" | "IBSHIFT" | "TCGETS2" | "TCSETS2" | "TCSETSW2" | "TCSETSF2" => true, @@ -4934,12 +4899,6 @@ fn test_linux(target: &str) { // We should do so after a while. "SOMAXCONN" if gnu => true, - // deprecated: not available from Linux kernel 5.6: - "VMADDR_CID_RESERVED" => true, - - // FIXME(value): IPPROTO_MAX was increased in 5.6 for IPPROTO_MPTCP: - "IPPROTO_MAX" => true, - // Requires >= 6.9 kernel headers. n if (arm || ppc32) && n.starts_with("FUTEX2_") => kernel < (6, 9), @@ -5059,6 +5018,8 @@ fn test_linux(target: &str) { | "PF_BLOCK_TS" | "PF_SUSPEND_TASK" => true, "EPIOCSPARAMS" | "EPIOCGPARAMS" if old_musl => true, + // Changed value + "IPPROTO_MAX" if old_musl => true, // FIXME(linux): Requires >= 6.6 kernel headers. "SECCOMP_IOCTL_NOTIF_SET_FLAGS" => kernel < (6, 6), diff --git a/libc-test/semver/TODO-linux.txt b/libc-test/semver/TODO-linux.txt index 4dee6991cd9f..4bb8b1b60286 100644 --- a/libc-test/semver/TODO-linux.txt +++ b/libc-test/semver/TODO-linux.txt @@ -61,10 +61,8 @@ SO_ZEROCOPY SYS__llseek SYS__newselect SYS__sysctl -SYS_create_module SYS_fadvise64 SYS_fstatat64 -SYS_get_kernel_syms SYS_get_thread_area SYS_getrlimit SYS_migrate_pages @@ -72,7 +70,6 @@ SYS_mmap SYS_nfsservctl SYS_pread64 SYS_pwrite64 -SYS_query_module SYS_set_thread_area SYS_uselib fsblkcnt64_t diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 33f2a804daa7..7ddd3dbb65a1 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -433,7 +433,6 @@ ENETRESET ENETUNREACH ENFILE ENOANO -ENOATTR ENOBUFS ENOCSI ENODATA @@ -2492,7 +2491,6 @@ SIGTRAP SIGTSTP SIGTTIN SIGTTOU -SIGUNUSED SIGURG SIGUSR1 SIGUSR2 diff --git a/libc-test/semver/linux-aarch64.txt b/libc-test/semver/linux-aarch64.txt index 03a312bcc13d..940f2662affd 100644 --- a/libc-test/semver/linux-aarch64.txt +++ b/libc-test/semver/linux-aarch64.txt @@ -53,7 +53,6 @@ FICLONERANGE MADV_SOFT_OFFLINE MAP_SYNC SIGSTKFLT -SIGUNUSED SKF_AD_ALU_XOR_X SKF_AD_CPU SKF_AD_HATYPE diff --git a/libc-test/semver/linux-i686.txt b/libc-test/semver/linux-i686.txt index 2649e3249a76..c7f6082f564f 100644 --- a/libc-test/semver/linux-i686.txt +++ b/libc-test/semver/linux-i686.txt @@ -67,7 +67,6 @@ REG_SS REG_TRAPNO REG_UESP SIGSTKFLT -SIGUNUSED SO_BSDCOMPAT SO_NO_CHECK SO_PRIORITY @@ -85,7 +84,6 @@ SYS_chmod SYS_chown SYS_chown32 SYS_creat -SYS_create_module SYS_dup2 SYS_epoll_create SYS_epoll_wait @@ -102,7 +100,6 @@ SYS_fstatfs64 SYS_ftime SYS_ftruncate64 SYS_futimesat -SYS_get_kernel_syms SYS_get_thread_area SYS_getdents SYS_getegid32 @@ -148,7 +145,6 @@ SYS_poll SYS_prof SYS_profil SYS_putpmsg -SYS_query_module SYS_readdir SYS_readlink SYS_rename diff --git a/libc-test/semver/linux-loongarch64.txt b/libc-test/semver/linux-loongarch64.txt index b3a7a13fbc10..2b5af5ab684d 100644 --- a/libc-test/semver/linux-loongarch64.txt +++ b/libc-test/semver/linux-loongarch64.txt @@ -57,7 +57,6 @@ NFT_MSG_NEWOBJ SCM_TIMESTAMPNS SCM_WIFI_STATUS SIGSTKFLT -SIGUNUSED SKF_AD_ALU_XOR_X SKF_AD_CPU SKF_AD_HATYPE diff --git a/libc-test/semver/linux-mips.txt b/libc-test/semver/linux-mips.txt index 8d98f5604df0..d12fd3a9cf1d 100644 --- a/libc-test/semver/linux-mips.txt +++ b/libc-test/semver/linux-mips.txt @@ -24,7 +24,6 @@ SYS_cacheflush SYS_chmod SYS_chown SYS_creat -SYS_create_module SYS_dup2 SYS_epoll_create SYS_epoll_wait @@ -37,7 +36,6 @@ SYS_fstatfs64 SYS_ftime SYS_ftruncate64 SYS_futimesat -SYS_get_kernel_syms SYS_getdents SYS_getpgrp SYS_getpmsg @@ -68,7 +66,6 @@ SYS_poll SYS_prof SYS_profil SYS_putpmsg -SYS_query_module SYS_readdir SYS_readlink SYS_recv diff --git a/libc-test/semver/linux-powerpc.txt b/libc-test/semver/linux-powerpc.txt index a559c891a4f9..d84eba1927ba 100644 --- a/libc-test/semver/linux-powerpc.txt +++ b/libc-test/semver/linux-powerpc.txt @@ -13,7 +13,6 @@ PTRACE_GETREGS PTRACE_SETFPREGS PTRACE_SETREGS SIGSTKFLT -SIGUNUSED SO_BSDCOMPAT SO_NO_CHECK SO_PRIORITY @@ -30,7 +29,6 @@ SYS_break SYS_chmod SYS_chown SYS_creat -SYS_create_module SYS_dup2 SYS_epoll_create SYS_epoll_wait @@ -46,7 +44,6 @@ SYS_fstatfs64 SYS_ftime SYS_ftruncate64 SYS_futimesat -SYS_get_kernel_syms SYS_getdents SYS_getpgrp SYS_getpmsg @@ -85,7 +82,6 @@ SYS_poll SYS_prof SYS_profil SYS_putpmsg -SYS_query_module SYS_readdir SYS_readlink SYS_recv diff --git a/libc-test/semver/linux-powerpc64.txt b/libc-test/semver/linux-powerpc64.txt index f6564fd2ae58..1e4a55d5b33a 100644 --- a/libc-test/semver/linux-powerpc64.txt +++ b/libc-test/semver/linux-powerpc64.txt @@ -11,7 +11,6 @@ NFT_MSG_NEWOBJ SCM_TIMESTAMPNS SCM_WIFI_STATUS SIGSTKFLT -SIGUNUSED SO_ATTACH_BPF SO_ATTACH_FILTER SO_BPF_EXTENSIONS @@ -44,7 +43,6 @@ SYS_break SYS_chmod SYS_chown SYS_creat -SYS_create_module SYS_dup2 SYS_epoll_create SYS_epoll_wait @@ -54,7 +52,6 @@ SYS_fstat SYS_fstatfs64 SYS_ftime SYS_futimesat -SYS_get_kernel_syms SYS_getdents SYS_getpgrp SYS_getpmsg @@ -91,7 +88,6 @@ SYS_poll SYS_prof SYS_profil SYS_putpmsg -SYS_query_module SYS_readdir SYS_readlink SYS_recv diff --git a/libc-test/semver/linux-s390x.txt b/libc-test/semver/linux-s390x.txt index e5a4c347b5e5..7012300d9ba2 100644 --- a/libc-test/semver/linux-s390x.txt +++ b/libc-test/semver/linux-s390x.txt @@ -22,7 +22,6 @@ NFT_MSG_GETOBJ NFT_MSG_GETOBJ_RESET NFT_MSG_NEWOBJ SIGSTKFLT -SIGUNUSED SO_BSDCOMPAT SO_PRIORITY SO_PROTOCOL @@ -34,7 +33,6 @@ SYS_bdflush SYS_chmod SYS_chown SYS_creat -SYS_create_module SYS_dup2 SYS_epoll_create SYS_epoll_wait @@ -44,7 +42,6 @@ SYS_fork SYS_fstat SYS_fstatfs64 SYS_futimesat -SYS_get_kernel_syms SYS_getdents SYS_getpgrp SYS_getpmsg @@ -64,7 +61,6 @@ SYS_pause SYS_pipe SYS_poll SYS_putpmsg -SYS_query_module SYS_readdir SYS_readlink SYS_rename diff --git a/libc-test/semver/linux-sparc64.txt b/libc-test/semver/linux-sparc64.txt index 95ab0c2b84fc..241f8c866ab2 100644 --- a/libc-test/semver/linux-sparc64.txt +++ b/libc-test/semver/linux-sparc64.txt @@ -29,7 +29,6 @@ SYS_bdflush SYS_chmod SYS_chown SYS_creat -SYS_create_module SYS_dup2 SYS_epoll_create SYS_epoll_wait @@ -43,7 +42,6 @@ SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 SYS_futimesat -SYS_get_kernel_syms SYS_getdents SYS_getdomainname SYS_getpagesize @@ -67,7 +65,6 @@ SYS_pciconfig_write SYS_perfctr SYS_pipe SYS_poll -SYS_query_module SYS_readdir SYS_readlink SYS_rename diff --git a/libc-test/semver/linux-x86_64.txt b/libc-test/semver/linux-x86_64.txt index 9d62f8cd3cd3..f39c4c1e22a8 100644 --- a/libc-test/semver/linux-x86_64.txt +++ b/libc-test/semver/linux-x86_64.txt @@ -66,7 +66,6 @@ REG_EFL REG_ERR REG_TRAPNO SIGSTKFLT -SIGUNUSED SKF_AD_ALU_XOR_X SKF_AD_CPU SKF_AD_HATYPE diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 6c651e52f86e..737874f32ce3 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -627,7 +627,6 @@ EM_XTENSA EM_ZSP ENAVAIL ENOANO -ENOATTR ENOCSI ENODATA ENOKEY @@ -3779,7 +3778,6 @@ VMADDR_CID_ANY VMADDR_CID_HOST VMADDR_CID_HYPERVISOR VMADDR_CID_LOCAL -VMADDR_CID_RESERVED VMADDR_PORT_ANY VREPRINT VSWTC diff --git a/src/unix/bsd/apple/b32/mod.rs b/src/unix/bsd/apple/b32/mod.rs index e71378cccf07..d6016483a6c4 100644 --- a/src/unix/bsd/apple/b32/mod.rs +++ b/src/unix/bsd/apple/b32/mod.rs @@ -56,10 +56,6 @@ s_no_extra_traits! { } } -#[doc(hidden)] -#[deprecated(since = "0.2.55")] -pub const NET_RT_MAXID: c_int = 10; - pub const BIOCSETF: c_ulong = 0x80084267; pub const BIOCSRTIMEOUT: c_ulong = 0x8008426d; pub const BIOCGRTIMEOUT: c_ulong = 0x4008426e; diff --git a/src/unix/bsd/apple/b64/mod.rs b/src/unix/bsd/apple/b64/mod.rs index 359aa79780dd..a973f3db11ec 100644 --- a/src/unix/bsd/apple/b64/mod.rs +++ b/src/unix/bsd/apple/b64/mod.rs @@ -49,10 +49,6 @@ s! { } } -#[doc(hidden)] -#[deprecated(since = "0.2.55")] -pub const NET_RT_MAXID: c_int = 11; - pub const BIOCSETF: c_ulong = 0x80104267; pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 801c1ad0d8ad..6aed401bbb00 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -3268,17 +3268,11 @@ pub const NOTE_LEASE_RELEASE: u32 = 0x00000400; pub const NOTE_EXIT: u32 = 0x80000000; pub const NOTE_FORK: u32 = 0x40000000; pub const NOTE_EXEC: u32 = 0x20000000; -#[doc(hidden)] -#[deprecated(since = "0.2.49", note = "Deprecated since MacOSX 10.9")] -pub const NOTE_REAP: u32 = 0x10000000; pub const NOTE_SIGNAL: u32 = 0x08000000; pub const NOTE_EXITSTATUS: u32 = 0x04000000; pub const NOTE_EXIT_DETAIL: u32 = 0x02000000; pub const NOTE_PDATAMASK: u32 = 0x000fffff; pub const NOTE_PCTRLMASK: u32 = 0xfff00000; -#[doc(hidden)] -#[deprecated(since = "0.2.49", note = "Deprecated since MacOSX 10.9")] -pub const NOTE_EXIT_REPARENTED: u32 = 0x00080000; pub const NOTE_EXIT_DETAIL_MASK: u32 = 0x00070000; pub const NOTE_EXIT_DECRYPTFAIL: u32 = 0x00010000; pub const NOTE_EXIT_MEMORY: u32 = 0x00020000; @@ -3486,12 +3480,6 @@ pub const KERN_KDSETRTCDEC: c_int = 15; pub const KERN_KDGETENTROPY: c_int = 16; pub const KERN_KDWRITETR: c_int = 17; pub const KERN_KDWRITEMAP: c_int = 18; -#[doc(hidden)] -#[deprecated(since = "0.2.49", note = "Removed in MacOSX 10.12")] -pub const KERN_KDENABLE_BG_TRACE: c_int = 19; -#[doc(hidden)] -#[deprecated(since = "0.2.49", note = "Removed in MacOSX 10.12")] -pub const KERN_KDDISABLE_BG_TRACE: c_int = 20; pub const KERN_KDREADCURTHRMAP: c_int = 21; pub const KERN_KDSET_TYPEFILTER: c_int = 22; pub const KERN_KDBUFWAIT: c_int = 23; @@ -4419,16 +4407,6 @@ f! { extern "C" { pub fn setgrent(); - #[doc(hidden)] - #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.5")] - #[cfg_attr(not(target_arch = "aarch64"), link_name = "daemon$1050")] - pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int; - #[doc(hidden)] - #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")] - pub fn sem_destroy(sem: *mut sem_t) -> c_int; - #[doc(hidden)] - #[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")] - pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int; pub fn aio_read(aiocbp: *mut aiocb) -> c_int; pub fn aio_write(aiocbp: *mut aiocb) -> c_int; pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index c83f32fa484d..eb4951ffc7e6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -2290,12 +2290,6 @@ pub const NOTE_ABSTIME: u32 = 0x00000010; pub const MADV_PROTECT: c_int = 10; -#[doc(hidden)] -#[deprecated( - since = "0.2.72", - note = "CTL_UNSPEC is deprecated. Use CTL_SYSCTL instead" -)] -pub const CTL_UNSPEC: c_int = 0; pub const CTL_SYSCTL: c_int = 0; pub const CTL_KERN: c_int = 1; pub const CTL_VM: c_int = 2; @@ -2763,13 +2757,6 @@ pub const IFF_POINTOPOINT: c_int = 0x10; pub const IFF_KNOWSEPOCH: c_int = 0x20; /// (d) resources allocated pub const IFF_RUNNING: c_int = 0x40; -#[doc(hidden)] -#[deprecated( - since = "0.2.54", - note = "IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead" -)] -/// (d) resources allocate -pub const IFF_DRV_RUNNING: c_int = 0x40; /// (n) no address resolution protocol pub const IFF_NOARP: c_int = 0x80; /// (n) receive all packets @@ -2778,10 +2765,6 @@ pub const IFF_PROMISC: c_int = 0x100; pub const IFF_ALLMULTI: c_int = 0x200; /// (d) tx hardware queue is full pub const IFF_OACTIVE: c_int = 0x400; -#[doc(hidden)] -#[deprecated(since = "0.2.54", note = "Use the portable `IFF_OACTIVE` instead")] -/// (d) tx hardware queue is full -pub const IFF_DRV_OACTIVE: c_int = 0x400; /// (i) can't hear own transmissions pub const IFF_SIMPLEX: c_int = 0x800; /// per link layer defined bit @@ -2986,12 +2969,6 @@ pub const IPPROTO_BLT: c_int = 30; pub const IPPROTO_NSP: c_int = 31; /// Merit Internodal pub const IPPROTO_INP: c_int = 32; -#[doc(hidden)] -#[deprecated( - since = "0.2.72", - note = "IPPROTO_SEP is deprecated. Use IPPROTO_DCCP instead" -)] -pub const IPPROTO_SEP: c_int = 33; /// Datagram Congestion Control Protocol pub const IPPROTO_DCCP: c_int = 33; /// Third Party Connect diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 2740096d5e98..4e3b5372cd34 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -995,18 +995,6 @@ pub const LOCK_NB: c_int = 4; pub const LOCK_UN: c_int = 8; pub const MAP_COPY: c_int = 0x0002; -#[doc(hidden)] -#[deprecated( - since = "0.2.54", - note = "Removed in FreeBSD 11, unused in DragonFlyBSD" -)] -pub const MAP_RENAME: c_int = 0x0020; -#[doc(hidden)] -#[deprecated( - since = "0.2.54", - note = "Removed in FreeBSD 11, unused in DragonFlyBSD" -)] -pub const MAP_NORESERVE: c_int = 0x0040; pub const MAP_HASSEMAPHORE: c_int = 0x0200; pub const MAP_STACK: c_int = 0x0400; pub const MAP_NOSYNC: c_int = 0x0800; diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index baa285e0ff63..553ffd522bdb 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -208,12 +208,10 @@ pub const SYS_modify_ldt: c_long = 123; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -256,8 +254,7 @@ pub const SYS_mremap: c_long = 163; pub const SYS_setresuid: c_long = 164; pub const SYS_getresuid: c_long = 165; pub const SYS_vm86: c_long = 166; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 167; +// 167 was SYS_query_module pub const SYS_poll: c_long = 168; pub const SYS_nfsservctl: c_long = 169; pub const SYS_setresgid: c_long = 170; diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 6fd06b00718d..de358edd5d41 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -369,14 +369,11 @@ pub const SYS_sethostname: c_long = 170; pub const SYS_setdomainname: c_long = 171; pub const SYS_iopl: c_long = 172; pub const SYS_ioperm: c_long = 173; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 174; +// 174 was SYS_create_module pub const SYS_init_module: c_long = 175; pub const SYS_delete_module: c_long = 176; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 177; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 178; +// 177 was SYS_get_kernel_syms +// 178 was SYS_query_module pub const SYS_quotactl: c_long = 179; pub const SYS_nfsservctl: c_long = 180; pub const SYS_getpmsg: c_long = 181; diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 139f28aeb041..7d2604b3a190 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -997,8 +997,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGTTIN: c_int = 21; pub const SIGTTOU: c_int = 22; pub const SIGXCPU: c_int = 24; @@ -1141,7 +1139,7 @@ pub const SOCK_DCCP: c_int = 6; #[deprecated(since = "0.2.70", note = "AF_PACKET must be used instead")] pub const SOCK_PACKET: c_int = 10; -pub const IPPROTO_MAX: c_int = 256; +pub const IPPROTO_MAX: c_int = 263; pub const SOL_SOCKET: c_int = 1; pub const SOL_SCTP: c_int = 132; @@ -2644,12 +2642,6 @@ pub const SOF_TIMESTAMPING_BIND_PHC: c_uint = 1 << 15; pub const SOF_TIMESTAMPING_OPT_ID_TCP: c_uint = 1 << 16; pub const SOF_TIMESTAMPING_OPT_RX_FILTER: c_uint = 1 << 17; -#[deprecated( - since = "0.2.55", - note = "ENOATTR is not available on Android; use ENODATA instead" -)] -pub const ENOATTR: c_int = crate::ENODATA; - // linux/if_alg.h pub const ALG_SET_KEY: c_int = 1; pub const ALG_SET_IV: c_int = 2; diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 2004d99318ca..184e3958e3d0 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -954,10 +954,6 @@ pub const RLIM_NLIMITS: c_int = RLIMIT_NLIMITS; pub const MAP_ANONYMOUS: c_int = MAP_ANON; -#[doc(hidden)] -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = crate::SIGSYS; - pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index d05bccf3811a..84503af35e23 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -407,8 +407,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; diff --git a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs index dc88c635f116..5a9ca13b2bc5 100644 --- a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs @@ -327,8 +327,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs index 2d91f986b76a..323f7b56c300 100644 --- a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs @@ -325,8 +325,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; @@ -551,12 +549,10 @@ pub const SYS_cacheflush: c_long = 123; pub const SYS_adjtimex_time32: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -592,8 +588,7 @@ pub const SYS_mremap: c_long = 163; pub const SYS_setresuid16: c_long = 164; pub const SYS_getresuid16: c_long = 165; pub const SYS_getpagesize: c_long = 166; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 167; +// 167 was SYS_query_module pub const SYS_poll: c_long = 168; pub const SYS_nfsservctl: c_long = 169; pub const SYS_setresgid16: c_long = 170; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 18bb1933925f..936551c2bcbb 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -384,12 +384,10 @@ pub const SYS_modify_ldt: c_long = 4000 + 123; pub const SYS_adjtimex: c_long = 4000 + 124; pub const SYS_mprotect: c_long = 4000 + 125; pub const SYS_sigprocmask: c_long = 4000 + 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 4000 + 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 4000 + 128; pub const SYS_delete_module: c_long = 4000 + 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 4000 + 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 4000 + 131; pub const SYS_getpgid: c_long = 4000 + 132; pub const SYS_fchdir: c_long = 4000 + 133; @@ -445,8 +443,7 @@ pub const SYS_socket: c_long = 4000 + 183; pub const SYS_socketpair: c_long = 4000 + 184; pub const SYS_setresuid: c_long = 4000 + 185; pub const SYS_getresuid: c_long = 4000 + 186; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 4000 + 187; +// 187 was SYS_query_module pub const SYS_poll: c_long = 4000 + 188; pub const SYS_nfsservctl: c_long = 4000 + 189; pub const SYS_setresgid: c_long = 4000 + 190; diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/linux_like/linux/gnu/b32/mod.rs index 11ada71ae815..6363132fde03 100644 --- a/src/unix/linux_like/linux/gnu/b32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mod.rs @@ -159,11 +159,7 @@ s! { pub totalswap: c_ulong, pub freeswap: c_ulong, pub procs: c_ushort, - #[deprecated( - since = "0.2.58", - note = "This padding field might become private in the future" - )] - pub pad: c_ushort, + pad: Padding, pub totalhigh: c_ulong, pub freehigh: c_ulong, pub mem_unit: c_uint, diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc.rs b/src/unix/linux_like/linux/gnu/b32/powerpc.rs index b5d3631a6fcf..ac946d0ac3dd 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc.rs +++ b/src/unix/linux_like/linux/gnu/b32/powerpc.rs @@ -382,8 +382,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; @@ -618,12 +616,10 @@ pub const SYS_modify_ldt: c_long = 123; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -659,8 +655,7 @@ pub const SYS_nanosleep: c_long = 162; pub const SYS_mremap: c_long = 163; pub const SYS_setresuid: c_long = 164; pub const SYS_getresuid: c_long = 165; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 166; +// 166 was SYS_query_module pub const SYS_poll: c_long = 167; pub const SYS_nfsservctl: c_long = 168; pub const SYS_setresgid: c_long = 169; diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index 76b899838bee..4cee14cc5d34 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -658,8 +658,7 @@ pub const SYS_flistxattr: c_long = 180; pub const SYS_removexattr: c_long = 181; pub const SYS_lremovexattr: c_long = 182; pub const SYS_sigpending: c_long = 183; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 184; +// 184 was SYS_query_module pub const SYS_setpgid: c_long = 185; pub const SYS_fremovexattr: c_long = 186; pub const SYS_tkill: c_long = 187; @@ -696,11 +695,9 @@ pub const SYS_clone: c_long = 217; pub const SYS_ioprio_get: c_long = 218; pub const SYS_adjtimex: c_long = 219; pub const SYS_sigprocmask: c_long = 220; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 221; +// 221 was SYS_create_module pub const SYS_delete_module: c_long = 222; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 223; +// 223 was SYS_get_kernel_syms pub const SYS_getpgid: c_long = 224; pub const SYS_bdflush: c_long = 225; pub const SYS_sysfs: c_long = 226; diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index 97429dad6428..52919b02c5b9 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -458,8 +458,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; @@ -700,12 +698,10 @@ pub const SYS_modify_ldt: c_long = 123; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -742,8 +738,7 @@ pub const SYS_mremap: c_long = 163; pub const SYS_setresuid: c_long = 164; pub const SYS_getresuid: c_long = 165; pub const SYS_vm86: c_long = 166; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 167; +// 167 was SYS_query_module pub const SYS_poll: c_long = 168; pub const SYS_nfsservctl: c_long = 169; pub const SYS_setresgid: c_long = 170; diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index a4fe3ba7e7e8..e294f1f132be 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -383,8 +383,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index 01044881f691..b02be364a6a3 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -754,7 +754,6 @@ pub const SIGIO: c_int = 29; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIGSYS: c_int = 31; -pub const SIGUNUSED: c_int = 31; pub const POLLWRNORM: c_short = 0x100; pub const POLLWRBAND: c_short = 0x200; diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs index 7fed1e538383..e5aea2547156 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -368,14 +368,11 @@ pub const SYS_swapoff: c_long = 5000 + 163; pub const SYS_reboot: c_long = 5000 + 164; pub const SYS_sethostname: c_long = 5000 + 165; pub const SYS_setdomainname: c_long = 5000 + 166; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 5000 + 167; +// 167 was SYS_create_module pub const SYS_init_module: c_long = 5000 + 168; pub const SYS_delete_module: c_long = 5000 + 169; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 5000 + 170; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 5000 + 171; +// 170 was SYS_get_kernel_syms +// 171 was SYS_query_module pub const SYS_quotactl: c_long = 5000 + 172; pub const SYS_nfsservctl: c_long = 5000 + 173; pub const SYS_getpmsg: c_long = 5000 + 174; diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs index f30450724351..51f71a8402a7 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs @@ -418,8 +418,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; @@ -734,12 +732,10 @@ pub const SYS_modify_ldt: c_long = 123; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -775,8 +771,7 @@ pub const SYS_nanosleep: c_long = 162; pub const SYS_mremap: c_long = 163; pub const SYS_setresuid: c_long = 164; pub const SYS_getresuid: c_long = 165; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 166; +// 166 was SYS_query_module pub const SYS_poll: c_long = 167; pub const SYS_nfsservctl: c_long = 168; pub const SYS_setresgid: c_long = 169; diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index c72a3f0d9609..2c54c68d2b82 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -434,8 +434,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_BLOCK: c_int = 0x000000; @@ -661,12 +659,10 @@ pub const SYS_uname: c_long = 122; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -696,8 +692,7 @@ pub const SYS_sched_get_priority_min: c_long = 160; pub const SYS_sched_rr_get_interval: c_long = 161; pub const SYS_nanosleep: c_long = 162; pub const SYS_mremap: c_long = 163; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 167; +// 167 was SYS_query_module pub const SYS_poll: c_long = 168; pub const SYS_nfsservctl: c_long = 169; pub const SYS_prctl: c_long = 172; diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs index 6e3673e35d00..e58bfd33f849 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs @@ -692,8 +692,7 @@ pub const SYS_flistxattr: c_long = 180; pub const SYS_removexattr: c_long = 181; pub const SYS_lremovexattr: c_long = 182; pub const SYS_sigpending: c_long = 183; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 184; +// 184 was SYS_query_module pub const SYS_setpgid: c_long = 185; pub const SYS_fremovexattr: c_long = 186; pub const SYS_tkill: c_long = 187; @@ -730,11 +729,9 @@ pub const SYS_clone: c_long = 217; pub const SYS_ioprio_get: c_long = 218; pub const SYS_adjtimex: c_long = 219; pub const SYS_sigprocmask: c_long = 220; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 221; +// 221 was SYS_create_module pub const SYS_delete_module: c_long = 222; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 223; +// 223 was SYS_get_kernel_syms pub const SYS_getpgid: c_long = 224; pub const SYS_bdflush: c_long = 225; pub const SYS_sysfs: c_long = 226; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 9658aeb4a536..8c5f3e5a1800 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -448,8 +448,6 @@ pub const SIGURG: c_int = 23; pub const SIGIO: c_int = 29; pub const SIGSYS: c_int = 31; pub const SIGSTKFLT: c_int = 16; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = 31; pub const SIGPOLL: c_int = 29; pub const SIGPWR: c_int = 30; pub const SIG_SETMASK: c_int = 2; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs index 9f9a618d1858..4c179540436b 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs @@ -197,14 +197,11 @@ pub const SYS_sethostname: c_long = 170; pub const SYS_setdomainname: c_long = 171; pub const SYS_iopl: c_long = 172; pub const SYS_ioperm: c_long = 173; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 174; +// 174 was SYS_create_module pub const SYS_init_module: c_long = 175; pub const SYS_delete_module: c_long = 176; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 177; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 178; +// 177 was SYS_get_kernel_syms +// 178 was SYS_query_module pub const SYS_quotactl: c_long = 179; pub const SYS_nfsservctl: c_long = 180; pub const SYS_getpmsg: c_long = 181; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 09e6a6c3aca2..6e848b4051e0 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1349,12 +1349,6 @@ pub const FALLOC_FL_ZERO_RANGE: c_int = 0x10; pub const FALLOC_FL_INSERT_RANGE: c_int = 0x20; pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x40; -#[deprecated( - since = "0.2.55", - note = "ENOATTR is not available on Linux; use ENODATA instead" -)] -pub const ENOATTR: c_int = crate::ENODATA; - pub const SO_ORIGINAL_DST: c_int = 80; pub const IP_RECVFRAGSIZE: c_int = 25; @@ -2566,12 +2560,6 @@ pub const MAP_DROPPABLE: c_int = 0x8; // uapi/linux/vm_sockets.h pub const VMADDR_CID_ANY: c_uint = 0xFFFFFFFF; pub const VMADDR_CID_HYPERVISOR: c_uint = 0; -#[deprecated( - since = "0.2.74", - note = "VMADDR_CID_RESERVED is removed since Linux v5.6 and \ - replaced with VMADDR_CID_LOCAL" -)] -pub const VMADDR_CID_RESERVED: c_uint = 1; pub const VMADDR_CID_LOCAL: c_uint = 1; pub const VMADDR_CID_HOST: c_uint = 2; pub const VMADDR_PORT_ANY: c_uint = 0xFFFFFFFF; diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index 78768ad322ab..8beb5abcdab6 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -612,12 +612,10 @@ pub const SYS_modify_ldt: c_long = 4000 + 123; pub const SYS_adjtimex: c_long = 4000 + 124; pub const SYS_mprotect: c_long = 4000 + 125; pub const SYS_sigprocmask: c_long = 4000 + 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 4000 + 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 4000 + 128; pub const SYS_delete_module: c_long = 4000 + 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 4000 + 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 4000 + 131; pub const SYS_getpgid: c_long = 4000 + 132; pub const SYS_fchdir: c_long = 4000 + 133; @@ -672,8 +670,7 @@ pub const SYS_socket: c_long = 4000 + 183; pub const SYS_socketpair: c_long = 4000 + 184; pub const SYS_setresuid: c_long = 4000 + 185; pub const SYS_getresuid: c_long = 4000 + 186; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 4000 + 187; +// 187 was SYS_query_module pub const SYS_poll: c_long = 4000 + 188; pub const SYS_nfsservctl: c_long = 4000 + 189; pub const SYS_setresgid: c_long = 4000 + 190; diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index 92b00f4847cd..00b5015084ca 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -554,12 +554,10 @@ pub const SYS_modify_ldt: c_long = 123; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -595,8 +593,7 @@ pub const SYS_nanosleep: c_long = 162; pub const SYS_mremap: c_long = 163; pub const SYS_setresuid: c_long = 164; pub const SYS_getresuid: c_long = 165; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 166; +// 166 was SYS_query_module pub const SYS_poll: c_long = 167; pub const SYS_nfsservctl: c_long = 168; pub const SYS_setresgid: c_long = 169; diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index 0b285911006e..38fcf64c3ea5 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -571,12 +571,10 @@ pub const SYS_modify_ldt: c_long = 123; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -613,8 +611,7 @@ pub const SYS_mremap: c_long = 163; pub const SYS_setresuid: c_long = 164; pub const SYS_getresuid: c_long = 165; pub const SYS_vm86: c_long = 166; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 167; +// 167 was SYS_query_module pub const SYS_poll: c_long = 168; pub const SYS_nfsservctl: c_long = 169; pub const SYS_setresgid: c_long = 170; diff --git a/src/unix/linux_like/linux/musl/b64/mips64.rs b/src/unix/linux_like/linux/musl/b64/mips64.rs index 6f926cbaf3b5..fd1321ffd64d 100644 --- a/src/unix/linux_like/linux/musl/b64/mips64.rs +++ b/src/unix/linux_like/linux/musl/b64/mips64.rs @@ -259,14 +259,11 @@ pub const SYS_swapoff: c_long = 5000 + 163; pub const SYS_reboot: c_long = 5000 + 164; pub const SYS_sethostname: c_long = 5000 + 165; pub const SYS_setdomainname: c_long = 5000 + 166; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 5000 + 167; +// 167 was SYS_create_module pub const SYS_init_module: c_long = 5000 + 168; pub const SYS_delete_module: c_long = 5000 + 169; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 5000 + 170; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 5000 + 171; +// 170 was SYS_get_kernel_syms +// 171 was SYS_query_module pub const SYS_quotactl: c_long = 5000 + 172; pub const SYS_nfsservctl: c_long = 5000 + 173; pub const SYS_getpmsg: c_long = 5000 + 174; diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/linux_like/linux/musl/b64/powerpc64.rs index 8c62d2e57a52..ef500af952b6 100644 --- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs +++ b/src/unix/linux_like/linux/musl/b64/powerpc64.rs @@ -361,12 +361,10 @@ pub const SYS_modify_ldt: c_long = 123; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -402,8 +400,7 @@ pub const SYS_nanosleep: c_long = 162; pub const SYS_mremap: c_long = 163; pub const SYS_setresuid: c_long = 164; pub const SYS_getresuid: c_long = 165; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 166; +// 166 was SYS_query_module pub const SYS_poll: c_long = 167; pub const SYS_nfsservctl: c_long = 168; pub const SYS_setresgid: c_long = 169; diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs index cb32228c3dd7..b536c0290eb9 100644 --- a/src/unix/linux_like/linux/musl/b64/s390x.rs +++ b/src/unix/linux_like/linux/musl/b64/s390x.rs @@ -448,12 +448,10 @@ pub const SYS_uname: c_long = 122; pub const SYS_adjtimex: c_long = 124; pub const SYS_mprotect: c_long = 125; pub const SYS_sigprocmask: c_long = 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 127; +// 127 was SYS_create_module pub const SYS_init_module: c_long = 128; pub const SYS_delete_module: c_long = 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 130; +// 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 131; pub const SYS_getpgid: c_long = 132; pub const SYS_fchdir: c_long = 133; @@ -484,8 +482,7 @@ pub const SYS_sched_get_priority_min: c_long = 160; pub const SYS_sched_rr_get_interval: c_long = 161; pub const SYS_nanosleep: c_long = 162; pub const SYS_mremap: c_long = 163; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 167; +// 167 was SYS_query_module pub const SYS_poll: c_long = 168; pub const SYS_nfsservctl: c_long = 169; pub const SYS_prctl: c_long = 172; diff --git a/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs b/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs index ce7ab543e490..09e07acc21a5 100644 --- a/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/wasm32/mod.rs @@ -225,11 +225,11 @@ pub const SYS_sethostname: c_long = 170; pub const SYS_setdomainname: c_long = 171; pub const SYS_iopl: c_long = 172; pub const SYS_ioperm: c_long = 173; -pub const SYS_create_module: c_long = 174; +// 174 was SYS_create_module pub const SYS_init_module: c_long = 175; pub const SYS_delete_module: c_long = 176; -pub const SYS_get_kernel_syms: c_long = 177; -pub const SYS_query_module: c_long = 178; +// 177 was SYS_get_kernel_syms +// 178 was SYS_query_module pub const SYS_quotactl: c_long = 179; pub const SYS_nfsservctl: c_long = 180; pub const SYS_getpmsg: c_long = 181; diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index caf79eb3d618..b66ae26733dd 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -339,14 +339,11 @@ pub const SYS_sethostname: c_long = 170; pub const SYS_setdomainname: c_long = 171; pub const SYS_iopl: c_long = 172; pub const SYS_ioperm: c_long = 173; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 174; +// 174 was SYS_create_module pub const SYS_init_module: c_long = 175; pub const SYS_delete_module: c_long = 176; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 177; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 178; +// 177 was SYS_get_kernel_syms +// 178 was SYS_query_module pub const SYS_quotactl: c_long = 179; pub const SYS_nfsservctl: c_long = 180; pub const SYS_getpmsg: c_long = 181; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 24e7c8c98872..99acc27c81a1 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -593,9 +593,6 @@ pub const SOCK_PACKET: c_int = 10; pub const SOMAXCONN: c_int = 128; -#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] -pub const SIGUNUSED: c_int = crate::SIGSYS; - pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; diff --git a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs index 2ecf9c7c5c98..2c253f0164f1 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs @@ -392,12 +392,10 @@ pub const SYS_modify_ldt: c_long = 4000 + 123; pub const SYS_adjtimex: c_long = 4000 + 124; pub const SYS_mprotect: c_long = 4000 + 125; pub const SYS_sigprocmask: c_long = 4000 + 126; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_create_module: c_long = 4000 + 127; +// 4000 + 127 was SYS_create_module pub const SYS_init_module: c_long = 4000 + 128; pub const SYS_delete_module: c_long = 4000 + 129; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_get_kernel_syms: c_long = 4000 + 130; +// 4000 + 130 was SYS_get_kernel_syms pub const SYS_quotactl: c_long = 4000 + 131; pub const SYS_getpgid: c_long = 4000 + 132; pub const SYS_fchdir: c_long = 4000 + 133; @@ -453,8 +451,7 @@ pub const SYS_socket: c_long = 4000 + 183; pub const SYS_socketpair: c_long = 4000 + 184; pub const SYS_setresuid: c_long = 4000 + 185; pub const SYS_getresuid: c_long = 4000 + 186; -#[deprecated(since = "0.2.70", note = "Functional up to 2.6 kernel")] -pub const SYS_query_module: c_long = 4000 + 187; +// 4000 + 187 was SYS_query_module pub const SYS_poll: c_long = 4000 + 188; pub const SYS_nfsservctl: c_long = 4000 + 189; pub const SYS_setresgid: c_long = 4000 + 190; diff --git a/src/unix/linux_like/linux_l4re_shared.rs b/src/unix/linux_like/linux_l4re_shared.rs index 310c0412403d..60a9138ef478 100644 --- a/src/unix/linux_like/linux_l4re_shared.rs +++ b/src/unix/linux_like/linux_l4re_shared.rs @@ -948,13 +948,7 @@ pub const __SIZEOF_PTHREAD_COND_T: usize = 48; // netinet/in.h // NOTE: These are in addition to the constants defined in src/unix/mod.rs -#[deprecated( - since = "0.2.80", - note = "This value was increased in the newer kernel \ - and we'll change this following upstream in the future release. \ - See #1896 for more info." -)] -pub const IPPROTO_MAX: c_int = 256; +pub const IPPROTO_MAX: c_int = 263; // System V IPC pub const IPC_PRIVATE: crate::key_t = 0; From bf2e2d852ef2b1edc7bca8489c210a7de0690f28 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 30 Aug 2026 16:39:01 +0900 Subject: [PATCH 91/93] fix: move `i686-pc-windows-gnu` to without host tools target (backport ) (cherry picked from commit abf55ad07ce6c90f51ea4a3f93628a4fc0401d36) --- .github/workflows/ci.yaml | 2 -- Cargo.toml | 2 +- ci/verify-build.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 882f37febf80..bf6aa9bc50f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -133,8 +133,6 @@ jobs: os: windows-11-arm - target: aarch64-unknown-linux-gnu os: ubuntu-26.04-arm - - target: i686-pc-windows-gnu - os: windows-2025 - target: i686-pc-windows-msvc os: windows-2025 - target: i686-unknown-linux-gnu diff --git a/Cargo.toml b/Cargo.toml index a6098cc0f17e..5ac3f724f41f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,6 @@ targets = [ "arm-unknown-linux-gnueabihf", "armv7-unknown-linux-gnueabihf", "armv7-unknown-linux-ohos", - "i686-pc-windows-gnu", "loongarch64-unknown-linux-gnu", "loongarch64-unknown-linux-musl", "powerpc-unknown-linux-gnu", @@ -80,6 +79,7 @@ targets = [ "i586-unknown-linux-gnu", "i586-unknown-linux-musl", "i686-linux-android", + "i686-pc-windows-gnu", "i686-unknown-freebsd", "i686-unknown-linux-musl", "nvptx64-nvidia-cuda", diff --git a/ci/verify-build.py b/ci/verify-build.py index fe4ae8182f92..dc8ba576901b 100755 --- a/ci/verify-build.py +++ b/ci/verify-build.py @@ -98,7 +98,6 @@ class TargetResult: Target("arm-unknown-linux-gnueabihf"), Target("armv7-unknown-linux-gnueabihf"), Target("armv7-unknown-linux-ohos", min_toolchain=Toolchain.STABLE), - Target("i686-pc-windows-gnu"), Target("loongarch64-unknown-linux-gnu", min_toolchain=Toolchain.STABLE), Target("loongarch64-unknown-linux-musl", min_toolchain=Toolchain.STABLE), Target("powerpc-unknown-linux-gnu"), @@ -136,6 +135,7 @@ class TargetResult: Target("i586-unknown-linux-gnu"), Target("i586-unknown-linux-musl"), Target("i686-linux-android"), + Target("i686-pc-windows-gnu"), Target("i686-unknown-freebsd"), Target("i686-unknown-linux-musl"), Target("nvptx64-nvidia-cuda", min_toolchain=Toolchain.STABLE), From a7bf83b000dab71c75a5df623a4320bbc9077f27 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 30 Aug 2026 17:06:58 +0900 Subject: [PATCH 92/93] fix: remove repeated reprs (backport ) (cherry picked from commit bb2382105d879773eaef4d2133a92cf5b283dad2) --- src/new/netbsd/net/if_.rs | 2 +- src/unix/linux_like/android/mod.rs | 2 +- src/unix/linux_like/linux/gnu/mod.rs | 2 +- src/unix/redox/mod.rs | 15 ++------------- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/new/netbsd/net/if_.rs b/src/new/netbsd/net/if_.rs index 68f2d9162690..3a47f0319219 100644 --- a/src/new/netbsd/net/if_.rs +++ b/src/new/netbsd/net/if_.rs @@ -50,7 +50,7 @@ pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast s! { - #[repr(C, align(8))] + #[repr(align(8))] pub struct if_msghdr { pub ifm_msglen: c_ushort, pub ifm_version: c_uchar, diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 7d2604b3a190..93c79428518a 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -659,7 +659,7 @@ s_no_extra_traits! { // linux/if_ether.h - #[repr(C, packed)] + #[repr(packed)] pub struct ethhdr { pub h_dest: [c_uchar; crate::ETH_ALEN as usize], pub h_source: [c_uchar; crate::ETH_ALEN as usize], diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index e8f0c08b95e8..b8c62331fa60 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -459,7 +459,7 @@ impl siginfo_t { s_no_extra_traits! { // linux/if_ether.h - #[repr(C, packed)] + #[repr(packed)] pub struct ethhdr { pub h_dest: [c_uchar; crate::ETH_ALEN as usize], pub h_source: [c_uchar; crate::ETH_ALEN as usize], diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 2ef0dfe4b035..ce0efa12ebd6 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -36,7 +36,6 @@ extern_ty! { } s! { - #[repr(C)] pub struct utsname { pub sysname: [c_char; UTSLENGTH], pub nodename: [c_char; UTSLENGTH], @@ -251,57 +250,47 @@ s! { pub gid: gid_t, } - #[cfg_attr(target_pointer_width = "32", repr(C, align(4)))] - #[cfg_attr(target_pointer_width = "64", repr(C, align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] pub struct pthread_attr_t { bytes: [u8; _PTHREAD_ATTR_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_barrier_t { bytes: [u8; _PTHREAD_BARRIER_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_barrierattr_t { bytes: [u8; _PTHREAD_BARRIERATTR_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_mutex_t { bytes: [u8; _PTHREAD_MUTEX_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_rwlock_t { bytes: [u8; _PTHREAD_RWLOCK_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_mutexattr_t { bytes: [u8; _PTHREAD_MUTEXATTR_SIZE], } - #[repr(C)] #[repr(align(1))] pub struct pthread_rwlockattr_t { bytes: [u8; _PTHREAD_RWLOCKATTR_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_cond_t { bytes: [u8; _PTHREAD_COND_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_condattr_t { bytes: [u8; _PTHREAD_CONDATTR_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_once_t { bytes: [u8; _PTHREAD_ONCE_SIZE], } - #[repr(C)] #[repr(align(4))] pub struct pthread_spinlock_t { bytes: [u8; _PTHREAD_SPINLOCK_SIZE], From 9662db17585a9634cc6ac1a565eea897afd60852 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 30 Aug 2026 19:47:06 +0900 Subject: [PATCH 93/93] fix: use Debian to sync with Cuttlefish (backport ) (cherry picked from commit 6ae84e49192725e0606c12c63a9e129c96f12c3d) --- ci/docker/x86_64-linux-android/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/docker/x86_64-linux-android/Dockerfile b/ci/docker/x86_64-linux-android/Dockerfile index 4b72b8c382fe..6b0e08d2cfcf 100644 --- a/ci/docker/x86_64-linux-android/Dockerfile +++ b/ci/docker/x86_64-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:26.04 +FROM debian:13 RUN apt-get update && apt-get install -y --no-install-recommends \ adb \