Skip to content

Add missing constants from unistd.h for newlib targets#4811

Merged
tgross35 merged 1 commit intorust-lang:mainfrom
FenrirWolf:newlib_constants
Nov 4, 2025
Merged

Add missing constants from unistd.h for newlib targets#4811
tgross35 merged 1 commit intorust-lang:mainfrom
FenrirWolf:newlib_constants

Conversation

@FenrirWolf
Copy link
Copy Markdown
Contributor

Description

A new API was recently added to std, and as a result a number of newlib-based targets are failing to build due to a missing definition for _SC_HOST_NAME_MAX from the unistd.h header. This PR adds that missing constant along with a number of other sysconf symbols that never made it into the crate for these targets.

Sources

https://github.com/bminor/newlib/blob/master/newlib/libc/include/sys/unistd.h#L354-L512

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot rustbot added O-newlib O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Nov 4, 2025
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, I have a few small nits here.

Could you also move these constants to src/new/newlib/unistd.rs? We're slowly migrating to a structure that follows the source closer.

@FenrirWolf
Copy link
Copy Markdown
Contributor Author

Sure, I moved the definitions and changed them to match the source too.

Copy link
Copy Markdown
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@tgross35 tgross35 enabled auto-merge November 4, 2025 01:39
@tgross35 tgross35 added this pull request to the merge queue Nov 4, 2025
Merged via the queue into rust-lang:main with commit e654f3a Nov 4, 2025
154 of 166 checks passed
@FenrirWolf FenrirWolf deleted the newlib_constants branch November 4, 2025 03:02
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Nov 4, 2025
(backport <rust-lang#4811>)
(cherry picked from commit e654f3a)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Nov 4, 2025
(backport <rust-lang#4811>)
(cherry picked from commit e654f3a)
pheki pushed a commit to vita-rust/libc that referenced this pull request Nov 21, 2025
(backport <rust-lang#4811>)
(cherry picked from commit e654f3a)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Dec 2, 2025
(backport <rust-lang#4811>)
(cherry picked from commit e654f3a)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Dec 2, 2025
(backport <rust-lang#4811>)
(cherry picked from commit e654f3a)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Dec 2, 2025
(backport <rust-lang#4811>)
(cherry picked from commit e654f3a)
@tgross35
Copy link
Copy Markdown
Contributor

tgross35 commented Dec 2, 2025

I'm going through the backports and just FYI, this commit didn't get attributed to you for some reason. Per https://github.com/rust-lang/libc/commit/8a4b635aeae3b68da7ef8c40d190c10a73e30526.patch this was authored by From: = <=>.

Perhaps that is intentional, but figured it's worth letting you know in case it comes from a bad bash env or something :)

github-merge-queue bot pushed a commit that referenced this pull request Dec 2, 2025
(backport <#4811>)
(cherry picked from commit e654f3a)
github-merge-queue bot pushed a commit that referenced this pull request Dec 2, 2025
(backport <#4811>)
(cherry picked from commit e654f3a)
@tgross35 tgross35 mentioned this pull request Dec 2, 2025
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-newlib O-unix S-waiting-on-author stable-applied This PR has been cherry-picked to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants