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

[libc][NFC] Adjust use of off_t internally #68269

Merged
merged 1 commit into from
Jul 8, 2024

Commits on Jul 4, 2024

  1. [libc][NFC] Adjust use of off_t internally

    This patch includes changes to the use of off_t in libc,
    targeted at 32-bit systems: in several places, the offset is used either
    as a long or an off_t (64-bit signed int), but in 32-bit systems a long
    type is only 32 bits long.
    
    1. Fix a warning in mmap where a long offset is expected, but we were
       passing an off_t. A static_cast and a comment were added to explain
       that we know we are ignoring the upper 32-bit of the off_t in 32-bit
       systems.
    2. The code in pread and pwrite was slightly improved to remove a
       #ifdef LIBC_TARGET_ARCH_IS_RISCV32; we are using an if constexpr now.
    3. The Linux file operations were changed to use off_t instead of a long
       where applicable. No changes were made to the standard API, e.g.,
       ftell returns the offset as an int so we added a static_cast and a
       comment explaining that this will cause a loss of integer precision
       in 32-bit systems.
    mikhailramalho committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    824b220 View commit details
    Browse the repository at this point in the history