[RFC,5/7] y2038: clock_settime: implementation for Unix generic
Commit Message
* sysdeps/unix/clock_settime (hp_timing_settime):
Use __timespec64 in function prototype
* sysdeps/unix/clock_settime: Rename __clock_settime to __clock_settime64
* sysdeps/unix/clock_settime: Remove weak_alias for __clock_settime
* sysdeps/unix/clock_settime: Add clock_settime when __TIMESIZE != 64
---
sysdeps/unix/clock_settime.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
Comments
On Wed, 27 Mar 2019, Lukasz Majewski wrote:
> * sysdeps/unix/clock_settime (hp_timing_settime):
> Use __timespec64 in function prototype
> * sysdeps/unix/clock_settime: Rename __clock_settime to __clock_settime64
> * sysdeps/unix/clock_settime: Remove weak_alias for __clock_settime
> * sysdeps/unix/clock_settime: Add clock_settime when __TIMESIZE != 64
Please write an actual textual explanation, however many paragraphs are
needed, for each patch. Not just the ChangeLog entry. There are various
formatting issues with this ChangeLog entry, but the textual description
is what's needed first for review.
(You should also, for every patch, give details of how it was tested, on
at least one 32-bit and at least one 64-bit architecture, with the full
glibc testsuite without causing any regressions. If the code being
changed is generic code not actually used for any glibc configuration,
please say so. In the case of this patch, the code is used *only* for
Hurd, as systems using the Linux kernel use
sysdeps/unix/sysv/linux/clock_settime.c. Thus, you should at least
compile and run the compilation tests for i686-gnu for this patch, using
build-many-glibcs.py, and report on that verification in the proposed
commit message.)
@@ -34,7 +34,7 @@ extern void __pthread_clock_settime (clockid_t clock_id, hp_timing_t offset)
static int
-hp_timing_settime (clockid_t clock_id, const struct timespec *tp)
+hp_timing_settime (clockid_t clock_id, const struct __timespec64 *tp)
{
hp_timing_t tsc;
hp_timing_t usertime;
@@ -68,10 +68,9 @@ hp_timing_settime (clockid_t clock_id, const struct timespec *tp)
}
#endif
-
/* Set CLOCK to value TP. */
int
-__clock_settime (clockid_t clock_id, const struct timespec *tp)
+__clock_settime64 (clockid_t clock_id, const struct __timespec64 *tp)
{
int retval;
@@ -108,4 +107,20 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
return retval;
}
-weak_alias (__clock_settime, clock_settime)
+
+#if __TIMESIZE != 64
+int
+clock_settime (clockid_t clock_id, const struct timespec *tp)
+{
+ struct __timespec64 ts64;
+
+ if (! in_time_t_range (tp->tv_sec))
+ {
+ __set_errno (EOVERFLOW);
+ return -1;
+ }
+
+ valid_timespec_to_timespec64 (tp, &ts64);
+ return __clock_settime64 (clock_id, &ts64);
+}
+#endif