Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux_like: Unify statx definitions #3978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neuschaefer
Copy link
Contributor

@neuschaefer neuschaefer commented Oct 16, 2024

Description

The statx system call and corresponding constants are defined by the Linux kernel and don't depend on the libc or architecture. The only difference is whether a libc exports the statx syscall wrapper or not.

We can thus unify the statx definitions for all Linux "like" platforms: GNU (glibc), Android (bionic), and (in a later commit) musl.

The statx struct is in a separate file because the style check doesn't allow multiple s! macros in one file, and #[cfg()] doesn't work in s!.

Plain u64 (or uint64_t in C) can't be used for the statx fields because bionic defines them as __u64, and provides incompatible definitions of uint64_t and __u64.

Sources

none

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 (failed due to unrelated error, linux/errqueue.h)

The statx system call and corresponding constants are defined by the
Linux kernel and don't depend on the libc or architecture. The only
difference is whether a libc exports the statx syscall wrapper or not.

We can thus unify the statx definitions for all Linux "like" platforms:
GNU (glibc), Android (bionic), and (in a later commit) musl.

The statx struct is in a separate file because the style check doesn't
allow multiple s! macros in one file, and #[cfg()] doesn't work in s!.

Plain u64 (or uint64_t in C) can't be used for the statx fields because
bionic defines them as __u64, and provides incompatible definitions of
uint64_t and __u64.
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

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.

3 participants