This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 5/7] y2038: clock_settime: implementation for Unix generic


* 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(-)

diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index dcf9ff660a..abaac6e293 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -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
-- 
2.11.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]