[all-commits] [llvm/llvm-project] 9a4ad0: [libc] Assorted improvements to [gs]etitimer (#206...
Pavel Labath via All-commits
all-commits at lists.llvm.org
Fri Jul 10 01:46:49 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9a4ad0acce7abf452746a5eab7c85730031152a3
https://github.com/llvm/llvm-project/commit/9a4ad0acce7abf452746a5eab7c85730031152a3
Author: Pavel Labath <pavel at labath.sk>
Date: 2026-07-10 (Fri, 10 Jul 2026)
Changed paths:
M libc/hdr/CMakeLists.txt
A libc/hdr/sys_time_macros.h
M libc/include/llvm-libc-macros/linux/sys-time-macros.h
M libc/include/sys/time.yaml
M libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
A libc/src/__support/OSUtil/linux/syscall_wrappers/alarm.h
A libc/src/__support/OSUtil/linux/syscall_wrappers/getitimer.h
A libc/src/__support/OSUtil/linux/syscall_wrappers/setitimer.h
M libc/src/sys/time/linux/CMakeLists.txt
M libc/src/sys/time/linux/getitimer.cpp
M libc/src/sys/time/linux/setitimer.cpp
M libc/src/unistd/linux/CMakeLists.txt
M libc/src/unistd/linux/alarm.cpp
M libc/test/src/sys/time/CMakeLists.txt
M libc/test/src/sys/time/getitimer_test.cpp
M libc/test/src/sys/time/setitimer_test.cpp
Log Message:
-----------
[libc] Assorted improvements to [gs]etitimer (#206974)
This started out as a patch adding a syscall wrapper for the two
functions. It still does that, but along the way I (or rather AI)
discovered an edge case in the truncation of microsecond values, where
we could turn bogus values into seemingly valid ones by throwing away
the high-order bits.
Additionally, when writing a test case, I noticed that the (64-bit)
kernel returns EINVAL for these out-or-range values. Our check returns
EOVERFLOW in this case, so I also change our error code in order to
provide an uniform behavior for the test case.
Neither of these (the check and the EINVAL error code) are present in
glibc (which lets truncated usec values through and returns EOVERFLOW on
second truncation), but I think it's better to be consistent with the
64-bit behavior. The EOVERFLOW error also has no foundation in POSIX
whereas EINVAL is mentioned as an error for invalid microseconds.
While in there, I also define ITIMER_REAL, ITIMER_VIRTUAL, and
ITIMER_PROF in linux/sys-time-macros.h and update code to use them
instead of raw numbers.
Assisted by Gemini.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list