Skip to content

refactor: adjust definition of off_t in wasi#5131

Open
dybucc wants to merge 1 commit into
rust-lang:mainfrom
dybucc:wasi-offt
Open

refactor: adjust definition of off_t in wasi#5131
dybucc wants to merge 1 commit into
rust-lang:mainfrom
dybucc:wasi-offt

Conversation

@dybucc
Copy link
Copy Markdown
Contributor

@dybucc dybucc commented Jun 1, 2026

Description

This PR addresses a small misconfiguration in the way we handle bit-widths of the off_t type
in WASI. The definition for the analogous time_t type fits exactly that of the upstream repo;
Namely, a c_longlong. This is not the case with the former, as upstream defines it with the same
type as time_t, but we expose it in the libc crate as a fixed-width signed integer.

This is not so much a problem as it is an inconsistency, because WASI assumes LLP64 by their use of
c_longlong, and so the effective bit-width of a type defined as a c_longlong and a type defined
as an i64 is the same. Such change could be considered irrelevant, so assume the patch in this PR
is solely a proposal and not a required change.

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

@dybucc
Copy link
Copy Markdown
Contributor Author

dybucc commented Jun 1, 2026

CI seems to be failing for reasons unrelated to the PR. Triggering a rerun should do it.

The definition for the analogous `time_t` was using the exact same C
type as that declared in the "bottom half" of the WASI upstream C
library implementation.

On the other hand, the `off_t` type was explicitly declaring the type as
a signed 64-bit integer, which is equivalent in the case of WASI to the
upstream definition as a `c_longlong`. Still, this patch attempts to
reflect a mirrored definition, rather than an equivalent definition.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 4, 2026

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.

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.

2 participants