hurd: clean up module#5242
Conversation
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.
Fix `cpu_set_t` definition under 32-bit targets. The effective size of the record was wrong in those targets [1] [2]. [1]: https://cgit.git.savannah.gnu.org/cgit/hurd/glibc.git/tree/posix/bits/cpu-set.h?h=t/sysvshm#n29 [2]: https://cgit.git.savannah.gnu.org/cgit/hurd/glibc.git/tree/sysdeps/mach/hurd/bits/typesizes.h?h=t/sysvshm#n62
|
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. |
|
☔ The latest upstream changes (possibly #5062) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
"hurd: remove duplicate routines": LGTM @ 62ccc91
| #[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, |
There was a problem hiding this comment.
"hurd: use gnu_file_offset_bits64 to expose lfs": Is this accurate? Looking at https://github.com/bminor/glibc/blob/04e750e75b73957cf1c791535a3f4319534a52fc/sysdeps/mach/hurd/bits/types/struct_flock.h and https://github.com/bminor/glibc/blob/04e750e75b73957cf1c791535a3f4319534a52fc/sysdeps/mach/hurd/i386/bits/types/struct_flock.h, it looks like c_short is the right type on non-x86-32.
|
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. |
|
Reminder, once the PR becomes ready for a review, use |
There was a problem hiding this comment.
"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.
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_OFFSET64is defined by using the existinggnu_file_offset_bits64cfg. 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
cfgset in the case of certain records.Finally, there were some routines that were duplicated in both the
unixmodule and theunix/hurdmodule. These have ben removed off of the latter. This decision was made because theunixmodule's definitions already included the right link name redirection for bindings where the actual identifier is the 64-bit suffixed one.Sources
Checklist
libc-test/semverhave been updated*LASTor*MAXare included (see #3131)cd libc-test && cargo test --target mytarget); especially relevant for platforms that may not be checked in CI@rustbot label +stable-nominated
Footnotes
https://cgit.git.savannah.gnu.org/cgit/hurd/glibc.git/tree/?h=t/sysvshm ↩