Skip to content

[0.2] Backports - #5581

Merged
tgross35 merged 33 commits into
rust-lang:libc-0.2from
tgross35:backport-amandine
Oct 1, 2026
Merged

tgross35 merged 33 commits into
rust-lang:libc-0.2from
tgross35:backport-amandine

Conversation

@rustbot

rustbot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an Android module

cc @maurer

Some changes occurred in a NetBSD-like module

cc @semarie

Some changes occurred in a solarish module

cc @jclulow, @pfmooney

Some changes occurred in an OpenBSD module

cc @semarie

tgross35 and others added 3 commits October 1, 2026 07:11
The musl implementation doesn't call it `__glibc_reserved`.

[ note: I also marked this field private to match `main` since it's a
  more recent target, and nobody should be accessing it anyway - Trevor ]

(backport <rust-lang#5533>)
(cherry picked from commit 35c8b7d)
Skip AIX targets from CI tests while rust-lang/rust#162979 gets sorted
out.

(backport <rust-lang#5541>)
(cherry picked from commit d770f3e)
`linux_time_bits64` should correlate to the kernel's
`__USE_TIME_BITS64`, which is set on both 32- and 64-bit platforms where
`time_t` is 64 bits. The uclibc version of this config is
`UCLIBC_USE_TIME64` which is only set on 32-bit platforms.

Split this up by introducing `uclibc32_time64` to closer match
`UCLIBC_USE_TIME64`. As an effect, setting `libc_unstable_uclibc_time64`
no longer crashes builds for 64-bit uclibc targets. The setup also
closer matches what is done for GNU targets.

Note that `linux_time_bits64` is not actually the "64-bit time_t on any
platform" yet that the kernel's version is, so it still isn't set on
64-bit platforms after this change.

* `UCLIBC_USE_TIME64` definition:
  https://github.com/wbx-github/uclibc-ng/blob/3f2ef085d8455a13fcdc4d4d473c0385dd65d55e/extra/Configs/Config.in#L1036-L1055
* Implication of `__USE_TIME_BITS64`:
  https://github.com/wbx-github/uclibc-ng/blob/3f2ef085d8455a13fcdc4d4d473c0385dd65d55e/include/features.h#L458-L460
* Entrypoint for 64-bit `time_t`:
  https://github.com/wbx-github/uclibc-ng/blob/3f2ef085d8455a13fcdc4d4d473c0385dd65d55e/libc/sysdeps/linux/common/bits/typesizes.h#L50-L54
* Arm `struct shimd_ds`:
  https://github.com/wbx-github/uclibc-ng/blob/3f2ef085d8455a13fcdc4d4d473c0385dd65d55e/libc/sysdeps/linux/arm/bits/shm.h#L48-L69

(backport <rust-lang#5540>)
(cherry picked from commit 3de6a1a)
tgross35 and others added 6 commits October 1, 2026 07:12
Make the skip more accurate to cover ppc32 as well.

Link: torvalds/linux@24e41bf

(backport <rust-lang#5546>)
(cherry picked from commit 2cf22d5)
POSIX requires HOST_NAME_MAX in <limits.h> for use with gethostname, and it
was missing everywhere except Fuchsia. Added it per family, glibc and uclibc
at 64 and the musl-derived and BSD-ish libcs at 255, skipping FreeBSD, NetBSD,
DragonFly, Apple, Solaris/illumos and Hurd, which deliberately leave it
undefined for sysconf instead.

glibc 64: https://github.com/bminor/glibc/blob/04e750e75b73957cf1c791535a3f4319534a52fc/sysdeps/unix/sysv/linux/bits/local_lim.h#L93
uclibc-ng 64: https://github.com/kraj/uclibc-ng/blob/f6f9f40cb17ae95610c4fe36f6ee77cfbcf05df1/libc/sysdeps/linux/common/bits/local_lim.h#L93
musl 255: https://git.musl-libc.org/cgit/musl/tree/include/limits.h?id=5e9972eaef08ccf55dabe254ac829a30329793d3#n56
android bionic 255: https://github.com/aosp-mirror/platform_bionic/blob/731631f300090436d7f5df80d50b6275c8c60a93/libc/include/bits/posix_limits.h#L135
openbsd 255: https://github.com/openbsd/src/blob/78e3ccc2aa1724882faaab7fa2366e535f039976/sys/sys/syslimits.h#L76
haiku 255: https://github.com/haiku/haiku/blob/89141b6857474342330f6205850b59435165187b/headers/posix/limits.h#L35
redox 255: https://github.com/redox-os/relibc/blob/381772ec81fced6d055f0f0ba6fa92c7f3256fbb/src/header/limits/mod.rs#L145
emscripten 255: https://github.com/emscripten-core/emscripten/blob/06e8b0d84d8b409b1b5ee59832948877bda6137e/system/lib/libc/musl/include/limits.h#L63
wasi 255: https://github.com/WebAssembly/wasi-libc/blob/06513b9ae0c1b14ca3010924939c007ed27628a1/libc-top-half/musl/include/limits.h#L56
cygwin 255: https://github.com/cygwin/cygwin/blob/00208dc31e790b8c130f32c4a0528c781fc07328/winsup/cygwin/include/cygwin/limits.h#L22

(backport <rust-lang#5531>)
(cherry picked from commit 904efa2)
`renameat2` first appeared in FreeBSD 15.1 (freebsd/freebsd-src@28599a1e5f1b),
so it is skipped in libc-test while CI runs 14.4 and 15.0.

Source:
https://github.com/freebsd/freebsd-src/blob/b5f0e7f36afc20bf17e9e955454b445d686cda06/include/stdio.h#L409

(backport <rust-lang#5563>)
(cherry picked from commit f9bac8d)
NetBSD's sleep(1) only accepts a number of seconds and rejects `3s` with
"usage: sleep seconds". The script runs with `set -e`, so the first failed
install exits the script instead of being retried, and the retry loop has
never worked on NetBSD.

`sleep 3` is the POSIX form, so it works everywhere this script runs.

(backport <rust-lang#5559>)
(cherry picked from commit a73f854)
[1] has been fixed.

This reverts commit 297152a.

[1]: rust-lang/rust#160439

(backport <rust-lang#5568>)
(cherry picked from commit a7522fa)
@rustbot

rustbot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • Pull requests are usually filed against the main branch for this repo, but this one is against libc-0.2. Please double check that you specified the right target!

tgross35 and others added 5 commits October 1, 2026 07:17
This should match the `freebsd-version` command anyway, but is more
consistent with what we do on other platforms.

(backport <rust-lang#5566>)
(cherry picked from commit 33021a4)
(backport <rust-lang#5569>)
(cherry picked from commit 513b995)
Bind the flags for FreeBSD's `renameat2`. `AT_RENAME_NOREPLACE` and
`RENAME_NOREPLACE` first ship in FreeBSD 15.1; `AT_RENAME_EXCHANGE` and
`RENAME_EXCHANGE` were merged to stable/15 after releng/15.1 branched, so
they first ship in 15.2. libc-test skips each pair below that version.

The `AT_RENAME_*` flags are `c_int` like the other FreeBSD `AT_*` flags;
the `RENAME_*` aliases are `c_uint`, matching the Linux and Redox bindings
and the `unsigned int` flags argument of `renameat2`.

Link: https://github.com/freebsd/freebsd-src/blob/96841ea08dcfa84b954a32dc5ae1a26c28966cf4/sys/sys/fcntl.h#L255-L256
Link: freebsd/freebsd-src@e0fe823

(backport <rust-lang#5560>)
(cherry picked from commit c274424)
@tgross35
tgross35 force-pushed the backport-amandine branch 4 times, most recently from 209c86f to 5d98bb9 Compare October 1, 2026 07:43
@tgross35
tgross35 enabled auto-merge October 1, 2026 07:55
tgross35 and others added 6 commits October 1, 2026 07:59
Give these structs the impls for `Default`.

(backport <rust-lang#5576>)
(cherry picked from commit e66976a)
Add commas to look more like struct syntax and remove `{ }` around
literals.

(backport <rust-lang#5577>)
(cherry picked from commit 8c1d1ec)
Add a more automatic union `Default` implementation and make use of it.

(backport <rust-lang#5577>)
(cherry picked from commit 1b75eaa)
Passing a file descriptor that is negative or >= FD_SETSIZE to FD_SET,
FD_CLR or FD_ISSET is undefined behavior per POSIX, and the previous
"index out of bounds" panic gave no hint of the required range. Panic
with a message that states the valid 0..FD_SETSIZE range instead.

Applies the fix across all platforms: linux_like, bsd, solarish, redox,
nto, newlib, fuchsia, haiku, cygwin, hurd, aix (bitmask via get/get_mut
+ let-else) and wasi (explicit range check). FD_ZERO is unchanged (takes
no fd). WASI has no FD_CLR.

Also adds panic! and Option::{self, None, Some} to the prelude so the
new code resolves under no_core (rustc-dep-of-std) builds.

Part of rust-lang#1401

(backport <rust-lang#5528>)
(cherry picked from commit 5b6e5a6)

[ needed to add an extra cast on WASI for the 0.2 branch - Trevor ]
`__USE_TIME_BITS64` is set on both 32-bit and 64-bit platforms if
`time_t` is 64 bits. Update the usage of `linux_time_bits64` to match.

(backport <rust-lang#5545>)
(cherry picked from commit b6de484)
* In the CI tests, treat FreeBSD 16 identically to 15.  We don't
  currently need or have separate definitions in the source code for
  FreeBSD 15 vs 16.  So treat them identically during CI.

* Remove some more mask constants from FreeBSD.  These are bitmasks that
  are intended to be used within the kernel.  New features may widen
  them, so their values aren't stable.  They probably don't have any
  legitimate uses in userland.  And their values have changed in FreeBSD
  16.

* A few constants got removed in 15.1 and 16.0 .

* The in_conninfo struct's internal substructs got renamed in 16.0.

* ifi2creq's padding fields got partially used up in 16.0, in the process
  relaxing its alignment requirement.

* max_align_t's size increased in 16.0.  But that struct should never be
  instantiated, so its size doesn't matter.

(backport <rust-lang#5575>)
(cherry picked from commit d1df215)
@tgross35
tgross35 added this pull request to the merge queue Oct 1, 2026
Merged via the queue into rust-lang:libc-0.2 with commit a227f33 Oct 1, 2026
58 checks passed
@tgross35
tgross35 deleted the backport-amandine branch October 1, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants