Skip to content

[libc] Unify gettime implementations #65383

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

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

mikhailramalho
Copy link
Member

Similar to D159208, this patch unifies the calls to a syscall, in this patch it is the syscall SYS_clock_gettime/SYS_clock_gettime64.

This patch also fixes calls to SYS_clock_gettime64 by creating a timespec64 object, passing it to the syscall and rewriting the timespec given by the caller with timespec64 object's contents. This fixes cases where timespec has a 4 bytes long time_t member, but SYS_clock_gettime is not available (e.g., rv32).

@mikhailramalho mikhailramalho force-pushed the libc-unify-clock-gettime branch 2 times, most recently from fc68eeb to ab3c205 Compare September 5, 2023 18:25
Similar to D159208, this patch unifies the calls to a syscall, in this
patch it is the syscall SYS_clock_gettime/SYS_clock_gettime64.

This patch also fixes calls to SYS_clock_gettime64 by creating a timespec64
object, passing it to the syscall and rewriting the timespec given by
the caller with timespec64 object's contents. This fixes cases where
timespec has a 4 bytes long time_t member, but SYS_clock_gettime is not
available (e.g., rv32).
@mikhailramalho mikhailramalho force-pushed the libc-unify-clock-gettime branch from ab3c205 to af569cd Compare September 5, 2023 18:27
@lntue lntue changed the title [libc] Unify gettime implmenetations [libc] Unify gettime implementations Sep 7, 2023
@mikhailramalho
Copy link
Member Author

added @gchatelet here as I'll try to also change the bazel files before merging this PR.

@gchatelet
Copy link
Contributor

gchatelet commented Sep 8, 2023

added @gchatelet here as I'll try to also change the bazel files before merging this PR.

clock_gettime and gettimeofday are not part of the Bazel build (yet) so this is fine to submit. Thx for checking!

@mikhailramalho
Copy link
Member Author

added @gchatelet here as I'll try to also change the bazel files before merging this PR.

clock_gettime and gettimeofday are not part of the Bazel build (yet) so this is fine to submit. Thx for checking!

cool, I tested with the command Michael sent and got no errors. I'll use it before merging my PRs.

@mikhailramalho mikhailramalho merged commit 123bf08 into llvm:main Sep 8, 2023
@mikhailramalho mikhailramalho deleted the libc-unify-clock-gettime branch September 8, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants