Skip to content

hurd: clean up module#5242

Open
dybucc wants to merge 5 commits into
rust-lang:mainfrom
dybucc:hurd-cleanup
Open

hurd: clean up module#5242
dybucc wants to merge 5 commits into
rust-lang:mainfrom
dybucc:hurd-cleanup

Conversation

@dybucc

@dybucc dybucc commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR consists of an overall clean up of the GNU Hurd module. It adds proper handling of types and routines when _USE_FILE_OFFSET64 is defined by using the existing gnu_file_offset_bits64 cfg. It also fixes a type definition and more closely mirrors those of upstream. We assume upstream to be the GNU Hurd's fork of glibc hosted at 1.

It also adds a number of deprecation notices. These apply only to 64-bit targets on type aliases. They apply to both 64-bit targets and any target with the afore mentioned cfg set in the case of certain records.

Finally, there were some routines that were duplicated in both the unix module and the unix/hurd module. These have ben removed off of the latter. This decision was made because the unix module's definitions already included the right link name redirection for bindings where the actual identifier is the 64-bit suffixed one.

Sources

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

Footnotes

  1. https://cgit.git.savannah.gnu.org/cgit/hurd/glibc.git/tree/?h=t/sysvshm

@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 2, 2026
dybucc added 5 commits July 3, 2026 07:25
Add correct support for LFS64 types and routines. It uses the same
`cfg` as glibc because the GNU Hurd uses glibc. This patch ensures
file offset types have the right bit width when
`_USE_FILE_OFFSET_BITS64` is defined upstream.

Add link name redirection to certain routines when the above feature
test macro is defined.
Add deprecation notices to certain types/routines under 64-bit targets
or when `_USE_FILE_OFFSET_BITS64` is defined. Type aliases almost always
apply only in the former predicate. Sum types generally apply in both
cases. An exception is `statfs`. 32-bit targets with the feature test
macro defined will continue having a different field layout in that one
record.
Remove duplicate bindings already present in the top-level `unix`
module. These have equivalent definitions. The `unix` module definitions
implement support for link name redirection under the
`gnu_file_offset_bits64` `cfg`. These have been preferred.
@rustbot

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot

rustbot commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #5062) made this pull request unmergeable. Please resolve the merge conflicts.

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just saw the one thing then noticed the links, are you sure that's the most recent source? Per https://cgit.git.savannah.gnu.org/cgit/hurd/glibc.git/log/?h=t/sysvshm the branch you're linking hasn't been updated since 2021, and none of the branches at https://cgit.git.savannah.gnu.org/cgit/hurd/glibc.git/refs/heads are any newer.

View changes since this review

Comment thread src/unix/hurd/mod.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"hurd: remove duplicate routines": LGTM @ 62ccc91

Comment thread src/unix/hurd/mod.rs
Comment on lines -892 to 965
#[cfg(target_pointer_width = "32")]
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,
}

pub struct flock64 {
#[cfg(target_pointer_width = "32")]
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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tgross35

tgross35 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Yeah - the author of #4127 is the lead Hurd developer as I understand it, and that PR links to the regular glibc sourceware repos. I assume that at some point the deviations were resolved and they just switched to developing upstream.

@rustbot author since there's probably some things to revisit with that in mind.

@rustbot

rustbot commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Comment thread src/unix/hurd/mod.rs

@tgross35 tgross35 Jul 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"hurd: deprecate lfs types and routines": Note that like the others, I am not comfortable deprecating the time bindings while users don't have a clean-cut solution.

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants