]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Y2038: add function __timer_gettime64
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Thu, 7 Sep 2017 22:41:46 +0000 (00:41 +0200)
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Wed, 24 Oct 2018 10:53:27 +0000 (12:53 +0200)
For Linux this uses the 32-bit time syscall, so it
converts the syscall output into 64-bit time.

rt/Versions
sysdeps/unix/sysv/linux/arm/librt.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
sysdeps/unix/sysv/linux/timer_gettime.c

index 91e3fd2a204ded9c1c0ab25e606a02788e5e4458..e55faa062901cf81796db3ea46b3f0466d91adfa 100644 (file)
@@ -37,4 +37,7 @@ librt {
   GLIBC_2.7 {
    __mq_open_2;
   }
+  GLIBC_2.29 {
+   __timer_gettime64;
+  }
 }
index cfbbd2755765e720d9424060856bbf177b0cb36f..e18f5ee3f5c43f45ae1df3c71f4ca587d16c567e 100644 (file)
@@ -1,3 +1,4 @@
+GLIBC_2.29 __timer_gettime64 F
 GLIBC_2.4 aio_cancel F
 GLIBC_2.4 aio_cancel64 F
 GLIBC_2.4 aio_error F
index 595f1b712a4e8d70c00ff0a29ed83e0f88fddf34..cb6ba7248ebdbbf50dffb89babe0252a8b1d26ec 100644 (file)
@@ -27,6 +27,7 @@ GLIBC_2.2 timer_delete F
 GLIBC_2.2 timer_getoverrun F
 GLIBC_2.2 timer_gettime F
 GLIBC_2.2 timer_settime F
+GLIBC_2.29 __timer_gettime64 F
 GLIBC_2.3.4 mq_close F
 GLIBC_2.3.4 mq_getattr F
 GLIBC_2.3.4 mq_notify F
index 10a19d9ee7931101b7a7c19d01f19bddfb2654a6..85806f428238337f1606acd8619d3a0da5413e52 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <sysdep.h>
+#include <y2038-support.h>
 #include "kernel-posix-timers.h"
 
 
@@ -39,3 +40,35 @@ timer_gettime (timer_t timerid, struct itimerspec *value)
 
   return res;
 }
+
+/* 64-bit time version */
+
+int
+__timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
+{
+  struct itimerspec value32;
+  struct timer *kt = (struct timer *) timerid;
+  int res;
+
+#ifdef __NR_timer_gettime64
+  if (__y2038_get_kernel_support () > 0)
+    {
+      res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
+      if (res == 0 || errno != ENOSYS)
+        return res;
+      __y2038_set_kernel_support (-1);
+    }
+#endif
+
+  res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, &value32);
+
+  if (res == 0)
+    {
+      value->it_value.tv_sec = value32.it_value.tv_sec;
+      value->it_value.tv_nsec = value32.it_value.tv_nsec;
+      value->it_interval.tv_sec = value32.it_interval.tv_sec;
+      value->it_interval.tv_nsec = value32.it_interval.tv_nsec;
+    }
+
+  return res;
+}