unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time
@ 2019-11-11 21:47 Lukasz Majewski
  2019-11-11 21:47 ` [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64 Lukasz Majewski
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-11 21:47 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell, Lukasz Majewski

This patch series converts timer_[sg]ettime functions to support
64 bit time.

The glibc internal struct __itimerspec64 is introduced in first patch.
Two next patches decouple x86_64 specific timer_[sg]ettime implementations
from the Linux generic ones for easier conversion (as x86_64 already
supports 64 bit time).
Two last patches are converting Linux generic timer syscalls.

Lukasz Majewski (5):
  time: Introduce glibc's internal struct __itimerspec64
  timer: Decouple x86_64 specific timer_gettime from generic Linux
    implementation
  timer: Decouple x86_64 specific timer_settime from generic Linux
    implementation
  y2038: linux: Provide __timer_gettime64 implementation
  y2038: linux: Provide __timer_settime64 implementation

 include/time.h                                | 27 +++++++
 sysdeps/unix/sysv/linux/timer_gettime.c       | 49 ++++++++++---
 sysdeps/unix/sysv/linux/timer_settime.c       | 71 ++++++++++++++++---
 .../unix/sysv/linux/x86_64/timer_gettime.c    | 12 ++--
 .../unix/sysv/linux/x86_64/timer_settime.c    | 14 ++--
 5 files changed, 144 insertions(+), 29 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64
  2019-11-11 21:47 [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
@ 2019-11-11 21:47 ` Lukasz Majewski
  2019-11-27 16:59   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  2019-11-11 21:47 ` [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation Lukasz Majewski
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-11 21:47 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell, Lukasz Majewski

This change provides the glibc's internal struct itimerspec representation,
which is explicitly supporting 64 bit time (by using struct __timespec64).

Such representation is necessary to provide correct time after Y2038
(time_t overflow) on devides with __TIMESIZE == 32.
---
 include/time.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/time.h b/include/time.h
index d7800eb30f..52ee213669 100644
--- a/include/time.h
+++ b/include/time.h
@@ -82,6 +82,17 @@ struct __timespec64
 };
 #endif
 
+#if __TIMESIZE == 64
+# define __itimerspec64 itimerspec
+#else
+/* The glibc's internal representation of the struct itimerspec.  */
+struct __itimerspec64
+{
+  struct __timespec64 it_interval;
+  struct __timespec64 it_value;
+};
+#endif
+
 #if __TIMESIZE == 64
 # define __ctime64 ctime
 #else
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation
  2019-11-11 21:47 [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
  2019-11-11 21:47 ` [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64 Lukasz Majewski
@ 2019-11-11 21:47 ` Lukasz Majewski
  2019-11-27 16:59   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  2019-11-11 21:47 ` [PATCH 3/5] timer: Decouple x86_64 specific timer_settime " Lukasz Majewski
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-11 21:47 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell, Lukasz Majewski

The x86_64 specific timer_gettime implementation (from
./linux/x86_64/timer_gettime.c) reused the Linux generic one (from
./linux/timer_gettime.c) to implement handling some compatible timers
(previously defined in librt, now in libc).

As the generic implementation now is going to also support new (available
from Linux 5.1+) timer_gettime64 syscall, those two implementations have
been decoupled for easier conversion.
---
 sysdeps/unix/sysv/linux/timer_gettime.c        |  7 -------
 sysdeps/unix/sysv/linux/x86_64/timer_gettime.c | 12 ++++++++----
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
index 799e2c935e..8d9bef9196 100644
--- a/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -22,16 +22,9 @@
 #include <sysdep.h>
 #include "kernel-posix-timers.h"
 
-
-#ifdef timer_gettime_alias
-# define timer_gettime timer_gettime_alias
-#endif
-
-
 int
 timer_gettime (timer_t timerid, struct itimerspec *value)
 {
-#undef timer_gettime
   struct timer *kt = (struct timer *) timerid;
 
   /* Delete the kernel timer object.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
index 54daee2f4c..5755cc44fb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
@@ -17,13 +17,17 @@
    not, see <https://www.gnu.org/licenses/>.  */
 
 #include <shlib-compat.h>
+#include <sysdep.h>
+#include "kernel-posix-timers.h"
 #include "compat-timer.h"
 
+int
+__timer_gettime_new (timer_t timerid, struct itimerspec *value)
+{
+  struct timer *kt = (struct timer *) timerid;
 
-#define timer_gettime_alias __timer_gettime_new
-#include <sysdeps/unix/sysv/linux/timer_gettime.c>
-
-#undef timer_gettime
+  return INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
+}
 versioned_symbol (librt, __timer_gettime_new, timer_gettime, GLIBC_2_3_3);
 
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/5] timer: Decouple x86_64 specific timer_settime from generic Linux implementation
  2019-11-11 21:47 [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
  2019-11-11 21:47 ` [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64 Lukasz Majewski
  2019-11-11 21:47 ` [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation Lukasz Majewski
@ 2019-11-11 21:47 ` Lukasz Majewski
  2019-11-27 16:59   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  2019-11-11 21:47 ` [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation Lukasz Majewski
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-11 21:47 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell, Lukasz Majewski

The x86_64 specific timer_settime implementation (from
./linux/x86_64/timer_settime.c) reused the Linux generic one (from
./linux/timer_settime.c) to implement handling some compatible timers
(previously defined in librt, now in libc).

As the generic implementation now is going to also support new (available
from Linux 5.1+) timer_settime64 syscall, those two implementations have
been decoupled for easier conversion.
---
 sysdeps/unix/sysv/linux/timer_settime.c        |  7 -------
 sysdeps/unix/sysv/linux/x86_64/timer_settime.c | 14 ++++++++++----
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
index a8350aedaa..51f24200aa 100644
--- a/sysdeps/unix/sysv/linux/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/timer_settime.c
@@ -22,17 +22,10 @@
 #include <sysdep.h>
 #include "kernel-posix-timers.h"
 
-
-#ifdef timer_settime_alias
-# define timer_settime timer_settime_alias
-#endif
-
-
 int
 timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
 	       struct itimerspec *ovalue)
 {
-#undef timer_settime
   struct timer *kt = (struct timer *) timerid;
 
   /* Delete the kernel timer object.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
index ea8978d5cd..b71a82e8cc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
@@ -17,13 +17,19 @@
    not, see <https://www.gnu.org/licenses/>.  */
 
 #include <shlib-compat.h>
+#include <sysdep.h>
+#include "kernel-posix-timers.h"
 #include "compat-timer.h"
 
+int
+__timer_settime_new (timer_t timerid, int flags, const struct itimerspec *value,
+                     struct itimerspec *ovalue)
+{
+  struct timer *kt = (struct timer *) timerid;
 
-#define timer_settime_alias __timer_settime_new
-#include <sysdeps/unix/sysv/linux/timer_settime.c>
-
-#undef timer_settime
+  return INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
+                         value, ovalue);
+}
 versioned_symbol (librt, __timer_settime_new, timer_settime, GLIBC_2_3_3);
 
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-11-11 21:47 [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
                   ` (2 preceding siblings ...)
  2019-11-11 21:47 ` [PATCH 3/5] timer: Decouple x86_64 specific timer_settime " Lukasz Majewski
@ 2019-11-11 21:47 ` Lukasz Majewski
  2019-11-27 17:00   ` Lukasz Majewski
                     ` (2 more replies)
  2019-11-11 21:47 ` [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation Lukasz Majewski
  2019-11-18 22:00 ` [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
  5 siblings, 3 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-11 21:47 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell, Lukasz Majewski

This patch provides new __timer_gettime64 explicit 64 bit function for reading
status of specified timer. To be more precise - the remaining time and interval
set with timer_settime.
Moreover, a 32 bit version - __timer_gettime has been refactored to internally
use __timer_gettime64.

The __timer_gettime is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversion from 64 bit struct
__timespec64 to struct timespec.

The new __timer_gettime64 syscall available from Linux 5.1+ has been used, when
applicable.

Build tests:
- The code has been tested on x86_64/x86 (native compilation):
make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
make xcheck PARALLELMFLAGS="-j8"

- The glibc has been build tested (make PARALLELMFLAGS="-j8") for
x86 (i386), x86_64-x32, and armv7

Run-time tests:
- Run specific tests on ARM/x86 32bit systems (qemu):
  https://github.com/lmajewski/meta-y2038 and run tests:
  https://github.com/lmajewski/y2038-tests/commits/master

- Use of cross-test-ssh.sh for ARM (armv7):
  make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck

Linux kernel, headers and minimal kernel version for glibc build test
matrix:
- Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as
  minimal kernel version (--enable-kernel="5.1.0")
  The __ASSUME_TIME64_SYSCALLS flag defined.

- Linux v5.1 and default minimal kernel version
  The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_gettime64
  syscall.

- Linux v4.19 (no timer_gettime64 support) with default minimal kernel version
  for contemporary glibc (3.2.0)
  This kernel doesn't support timer_gettime64 syscall, so the fallback to
  timer_gettime is tested.

Above tests were performed with Y2038 redirection applied as well as without
(so the __TIMESIZE != 64 execution path is checked as well).

No regressions were observed.
---
 include/time.h                          |  7 ++++
 sysdeps/unix/sysv/linux/timer_gettime.c | 44 ++++++++++++++++++++++---
 2 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/include/time.h b/include/time.h
index 52ee213669..8b9a4b7a60 100644
--- a/include/time.h
+++ b/include/time.h
@@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct __timespec64 tsp[2]);
 libc_hidden_proto (__futimens64);
 #endif
 
+#if __TIMESIZE == 64
+# define __timer_gettime64 __timer_gettime
+#else
+extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value);
+libc_hidden_proto (__timer_gettime64);
+#endif
+
 /* Compute the `struct tm' representation of T,
    offset OFFSET seconds east of UTC,
    and store year, yday, mon, mday, wday, hour, min, sec into *TP.
diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
index 8d9bef9196..31bf5ce25b 100644
--- a/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -20,15 +20,51 @@
 #include <stdlib.h>
 #include <time.h>
 #include <sysdep.h>
+#include <kernel-features.h>
 #include "kernel-posix-timers.h"
 
 int
-timer_gettime (timer_t timerid, struct itimerspec *value)
+__timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
 {
   struct timer *kt = (struct timer *) timerid;
 
-  /* Delete the kernel timer object.  */
-  int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
+#ifdef __ASSUME_TIME64_SYSCALLS
+# ifndef __NR_timer_gettime64
+#  define __NR_timer_gettime64 __NR_timer_gettime
+# endif
+  return INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);
+#else
+# ifdef __NR_timer_gettime64
+  int ret = INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);
+  if (ret == 0 || errno != ENOSYS)
+    return ret;
+# endif
+  struct itimerspec its32;
+  int retval = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, &its32);
+  if (! retval)
+    {
+      value->it_interval = valid_timespec_to_timespec64 (its32.it_interval);
+      value->it_value = valid_timespec_to_timespec64 (its32.it_value);
+    }
 
-  return res;
+  return retval;
+#endif
 }
+
+#if __TIMESIZE != 64
+int
+__timer_gettime (timer_t timerid, struct itimerspec *value)
+{
+  struct __itimerspec64 its64;
+  int retval = __timer_gettime64 (timerid, &its64);
+  if (! retval)
+    {
+      value->it_interval = valid_timespec64_to_timespec (its64.it_interval);
+      value->it_value = valid_timespec64_to_timespec (its64.it_value);
+    }
+
+  return retval;
+}
+#endif
+weak_alias (__timer_gettime, timer_gettime)
+libc_hidden_def (timer_gettime)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation
  2019-11-11 21:47 [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
                   ` (3 preceding siblings ...)
  2019-11-11 21:47 ` [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation Lukasz Majewski
@ 2019-11-11 21:47 ` Lukasz Majewski
  2019-11-27 17:00   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  2019-11-18 22:00 ` [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
  5 siblings, 2 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-11 21:47 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell, Lukasz Majewski

This patch provides new __timer_settime64 explicit 64 bit function for setting
flags, interval and value of specified timer.
Moreover, a 32 bit version - __timer_settime has been refactored to internally
use __timer_settime64.

The __timer_settime is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct
__timespec64 from struct timespec (and opposite when old_value pointer is
provided).

The new __timer_settime64 syscall available from Linux 5.1+ has been used, when
applicable.

Build tests:
- The code has been tested on x86_64/x86 (native compilation):
make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
make xcheck PARALLELMFLAGS="-j8"

- The glibc has been build tested (make PARALLELMFLAGS="-j8") for
x86 (i386), x86_64-x32, and armv7

Run-time tests:
- Run specific tests on ARM/x86 32bit systems (qemu):
  https://github.com/lmajewski/meta-y2038 and run tests:
  https://github.com/lmajewski/y2038-tests/commits/master

- Use of cross-test-ssh.sh for ARM (armv7):
  make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck

Linux kernel, headers and minimal kernel version for glibc build test
matrix:
- Linux v5.1 (with timer_settime64) and glibc build with v5.1 as
  minimal kernel version (--enable-kernel="5.1.0")
  The __ASSUME_TIME64_SYSCALLS flag defined.

- Linux v5.1 and default minimal kernel version
  The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_settime64
  syscall.

- Linux v4.19 (no timer_settime64 support) with default minimal kernel version
  for contemporary glibc (3.2.0)
  This kernel doesn't support timer_settime64 syscall, so the fallback to
  timer_settime is tested.

Above tests were performed with Y2038 redirection applied as well as without
(so the __TIMESIZE != 64 execution path is checked as well).

No regressions were observed.
---
 include/time.h                          |  9 ++++
 sysdeps/unix/sysv/linux/timer_settime.c | 68 ++++++++++++++++++++++---
 2 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/include/time.h b/include/time.h
index 8b9a4b7a60..a46fd2f08a 100644
--- a/include/time.h
+++ b/include/time.h
@@ -186,6 +186,15 @@ extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value);
 libc_hidden_proto (__timer_gettime64);
 #endif
 
+#if __TIMESIZE == 64
+# define __timer_settime64 __timer_settime
+#else
+extern int __timer_settime64 (timer_t timerid, int flags,
+                              const struct __itimerspec64 *value,
+                              struct __itimerspec64 *ovalue);
+libc_hidden_proto (__timer_settime64);
+#endif
+
 /* Compute the `struct tm' representation of T,
    offset OFFSET seconds east of UTC,
    and store year, yday, mon, mday, wday, hour, min, sec into *TP.
diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
index 51f24200aa..f847e3e44a 100644
--- a/sysdeps/unix/sysv/linux/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/timer_settime.c
@@ -20,17 +20,73 @@
 #include <stdlib.h>
 #include <time.h>
 #include <sysdep.h>
+#include <kernel-features.h>
 #include "kernel-posix-timers.h"
 
 int
-timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
-	       struct itimerspec *ovalue)
+__timer_settime64 (timer_t timerid, int flags,
+                   const struct __itimerspec64 *value,
+                   struct __itimerspec64 *ovalue)
 {
   struct timer *kt = (struct timer *) timerid;
 
-  /* Delete the kernel timer object.  */
-  int res = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
-			    value, ovalue);
+#ifdef __ASSUME_TIME64_SYSCALLS
+# ifndef __NR_timer_settime64
+#  define __NR_timer_settime64 __NR_timer_settime
+# endif
+  return INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags, value,
+                         ovalue);
+#else
+# ifdef __NR_timer_settime64
+  int ret = INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags, value,
+                            ovalue);
+  if (ret == 0 || errno != ENOSYS)
+    return ret;
+# endif
+  struct itimerspec its32, oits32;
 
-  return res;
+  if (! in_time_t_range ((value->it_value).tv_sec)
+      || ! in_time_t_range ((value->it_interval).tv_sec))
+    {
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+
+  its32.it_interval = valid_timespec64_to_timespec (value->it_interval);
+  its32.it_value = valid_timespec64_to_timespec (value->it_value);
+
+  int retval = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
+                               &its32, ovalue ? &oits32 : NULL);
+  if (! retval && ovalue)
+    {
+      ovalue->it_interval = valid_timespec_to_timespec64 (oits32.it_interval);
+      ovalue->it_value = valid_timespec_to_timespec64 (oits32.it_value);
+    }
+
+  return retval;
+#endif
+}
+
+#if __TIMESIZE != 64
+int
+__timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
+                 struct itimerspec *ovalue)
+{
+  struct __itimerspec64 its64, oits64;
+  int retval;
+
+  its64.it_interval = valid_timespec_to_timespec64 (value->it_interval);
+  its64.it_value = valid_timespec_to_timespec64 (value->it_value);
+
+  retval = __timer_settime64 (timerid, flags, &its64, ovalue ? &oits64 : NULL);
+  if (! retval && ovalue)
+    {
+      ovalue->it_interval = valid_timespec64_to_timespec (oits64.it_interval);
+      ovalue->it_value = valid_timespec64_to_timespec (oits64.it_value);
+    }
+
+  return retval;
 }
+#endif
+weak_alias (__timer_settime, timer_settime)
+libc_hidden_def (timer_settime)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time
  2019-11-11 21:47 [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
                   ` (4 preceding siblings ...)
  2019-11-11 21:47 ` [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation Lukasz Majewski
@ 2019-11-18 22:00 ` Lukasz Majewski
  2019-11-25  8:34   ` Lukasz Majewski
  5 siblings, 1 reply; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-18 22:00 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 1492 bytes --]

Dear All,

> This patch series converts timer_[sg]ettime functions to support
> 64 bit time.
> 
> The glibc internal struct __itimerspec64 is introduced in first patch.
> Two next patches decouple x86_64 specific timer_[sg]ettime
> implementations from the Linux generic ones for easier conversion (as
> x86_64 already supports 64 bit time).
> Two last patches are converting Linux generic timer syscalls.

Gentle ping on this series.

> 
> Lukasz Majewski (5):
>   time: Introduce glibc's internal struct __itimerspec64
>   timer: Decouple x86_64 specific timer_gettime from generic Linux
>     implementation
>   timer: Decouple x86_64 specific timer_settime from generic Linux
>     implementation
>   y2038: linux: Provide __timer_gettime64 implementation
>   y2038: linux: Provide __timer_settime64 implementation
> 
>  include/time.h                                | 27 +++++++
>  sysdeps/unix/sysv/linux/timer_gettime.c       | 49 ++++++++++---
>  sysdeps/unix/sysv/linux/timer_settime.c       | 71
> ++++++++++++++++--- .../unix/sysv/linux/x86_64/timer_gettime.c    |
> 12 ++-- .../unix/sysv/linux/x86_64/timer_settime.c    | 14 ++--
>  5 files changed, 144 insertions(+), 29 deletions(-)
> 


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time
  2019-11-18 22:00 ` [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
@ 2019-11-25  8:34   ` Lukasz Majewski
  0 siblings, 0 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-25  8:34 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 1902 bytes --]

Dear All,

> Dear All,
> 
> > This patch series converts timer_[sg]ettime functions to support
> > 64 bit time.
> > 
> > The glibc internal struct __itimerspec64 is introduced in first
> > patch. Two next patches decouple x86_64 specific timer_[sg]ettime
> > implementations from the Linux generic ones for easier conversion
> > (as x86_64 already supports 64 bit time).
> > Two last patches are converting Linux generic timer syscalls.  
> 
> Gentle ping on this series.

Gentle ping ping on this series :-).

> 
> > 
> > Lukasz Majewski (5):
> >   time: Introduce glibc's internal struct __itimerspec64
> >   timer: Decouple x86_64 specific timer_gettime from generic Linux
> >     implementation
> >   timer: Decouple x86_64 specific timer_settime from generic Linux
> >     implementation
> >   y2038: linux: Provide __timer_gettime64 implementation
> >   y2038: linux: Provide __timer_settime64 implementation
> > 
> >  include/time.h                                | 27 +++++++
> >  sysdeps/unix/sysv/linux/timer_gettime.c       | 49 ++++++++++---
> >  sysdeps/unix/sysv/linux/timer_settime.c       | 71
> > ++++++++++++++++--- .../unix/sysv/linux/x86_64/timer_gettime.c    |
> > 12 ++-- .../unix/sysv/linux/x86_64/timer_settime.c    | 14 ++--
> >  5 files changed, 144 insertions(+), 29 deletions(-)
> >   
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64
  2019-11-11 21:47 ` [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64 Lukasz Majewski
@ 2019-11-27 16:59   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-27 16:59 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

Dear All,

> This change provides the glibc's internal struct itimerspec
> representation, which is explicitly supporting 64 bit time (by using
> struct __timespec64).
> 
> Such representation is necessary to provide correct time after Y2038
> (time_t overflow) on devides with __TIMESIZE == 32.
> ---
>  include/time.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/time.h b/include/time.h
> index d7800eb30f..52ee213669 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -82,6 +82,17 @@ struct __timespec64
>  };
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __itimerspec64 itimerspec
> +#else
> +/* The glibc's internal representation of the struct itimerspec.  */
> +struct __itimerspec64
> +{
> +  struct __timespec64 it_interval;
> +  struct __timespec64 it_value;
> +};
> +#endif
> +
>  #if __TIMESIZE == 64
>  # define __ctime64 ctime
>  #else

Gentle ping.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation
  2019-11-11 21:47 ` [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation Lukasz Majewski
@ 2019-11-27 16:59   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-27 16:59 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 2472 bytes --]

Dear All,

> The x86_64 specific timer_gettime implementation (from
> ./linux/x86_64/timer_gettime.c) reused the Linux generic one (from
> ./linux/timer_gettime.c) to implement handling some compatible timers
> (previously defined in librt, now in libc).
> 
> As the generic implementation now is going to also support new
> (available from Linux 5.1+) timer_gettime64 syscall, those two
> implementations have been decoupled for easier conversion.
> ---
>  sysdeps/unix/sysv/linux/timer_gettime.c        |  7 -------
>  sysdeps/unix/sysv/linux/x86_64/timer_gettime.c | 12 ++++++++----
>  2 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c
> b/sysdeps/unix/sysv/linux/timer_gettime.c index
> 799e2c935e..8d9bef9196 100644 ---
> a/sysdeps/unix/sysv/linux/timer_gettime.c +++
> b/sysdeps/unix/sysv/linux/timer_gettime.c @@ -22,16 +22,9 @@
>  #include <sysdep.h>
>  #include "kernel-posix-timers.h"
>  
> -
> -#ifdef timer_gettime_alias
> -# define timer_gettime timer_gettime_alias
> -#endif
> -
> -
>  int
>  timer_gettime (timer_t timerid, struct itimerspec *value)
>  {
> -#undef timer_gettime
>    struct timer *kt = (struct timer *) timerid;
>  
>    /* Delete the kernel timer object.  */
> diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
> b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c index
> 54daee2f4c..5755cc44fb 100644 ---
> a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c +++
> b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c @@ -17,13 +17,17 @@
>     not, see <https://www.gnu.org/licenses/>.  */
>  
>  #include <shlib-compat.h>
> +#include <sysdep.h>
> +#include "kernel-posix-timers.h"
>  #include "compat-timer.h"
>  
> +int
> +__timer_gettime_new (timer_t timerid, struct itimerspec *value)
> +{
> +  struct timer *kt = (struct timer *) timerid;
>  
> -#define timer_gettime_alias __timer_gettime_new
> -#include <sysdeps/unix/sysv/linux/timer_gettime.c>
> -
> -#undef timer_gettime
> +  return INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
> +}
>  versioned_symbol (librt, __timer_gettime_new, timer_gettime,
> GLIBC_2_3_3); 
>  

Gentle ping.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/5] timer: Decouple x86_64 specific timer_settime from generic Linux implementation
  2019-11-11 21:47 ` [PATCH 3/5] timer: Decouple x86_64 specific timer_settime " Lukasz Majewski
@ 2019-11-27 16:59   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-27 16:59 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 2639 bytes --]

Dear All,

> The x86_64 specific timer_settime implementation (from
> ./linux/x86_64/timer_settime.c) reused the Linux generic one (from
> ./linux/timer_settime.c) to implement handling some compatible timers
> (previously defined in librt, now in libc).
> 
> As the generic implementation now is going to also support new
> (available from Linux 5.1+) timer_settime64 syscall, those two
> implementations have been decoupled for easier conversion.
> ---
>  sysdeps/unix/sysv/linux/timer_settime.c        |  7 -------
>  sysdeps/unix/sysv/linux/x86_64/timer_settime.c | 14 ++++++++++----
>  2 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/timer_settime.c
> b/sysdeps/unix/sysv/linux/timer_settime.c index
> a8350aedaa..51f24200aa 100644 ---
> a/sysdeps/unix/sysv/linux/timer_settime.c +++
> b/sysdeps/unix/sysv/linux/timer_settime.c @@ -22,17 +22,10 @@
>  #include <sysdep.h>
>  #include "kernel-posix-timers.h"
>  
> -
> -#ifdef timer_settime_alias
> -# define timer_settime timer_settime_alias
> -#endif
> -
> -
>  int
>  timer_settime (timer_t timerid, int flags, const struct itimerspec
> *value, struct itimerspec *ovalue)
>  {
> -#undef timer_settime
>    struct timer *kt = (struct timer *) timerid;
>  
>    /* Delete the kernel timer object.  */
> diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
> b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c index
> ea8978d5cd..b71a82e8cc 100644 ---
> a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c +++
> b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c @@ -17,13 +17,19 @@
>     not, see <https://www.gnu.org/licenses/>.  */
>  
>  #include <shlib-compat.h>
> +#include <sysdep.h>
> +#include "kernel-posix-timers.h"
>  #include "compat-timer.h"
>  
> +int
> +__timer_settime_new (timer_t timerid, int flags, const struct
> itimerspec *value,
> +                     struct itimerspec *ovalue)
> +{
> +  struct timer *kt = (struct timer *) timerid;
>  
> -#define timer_settime_alias __timer_settime_new
> -#include <sysdeps/unix/sysv/linux/timer_settime.c>
> -
> -#undef timer_settime
> +  return INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
> +                         value, ovalue);
> +}
>  versioned_symbol (librt, __timer_settime_new, timer_settime,
> GLIBC_2_3_3); 
>  

Gentle ping,


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-11-11 21:47 ` [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation Lukasz Majewski
@ 2019-11-27 17:00   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  2019-12-11 17:51   ` Andreas Schwab
  2 siblings, 0 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-27 17:00 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 5244 bytes --]

Dear All,

> This patch provides new __timer_gettime64 explicit 64 bit function
> for reading status of specified timer. To be more precise - the
> remaining time and interval set with timer_settime.
> Moreover, a 32 bit version - __timer_gettime has been refactored to
> internally use __timer_gettime64.
> 
> The __timer_gettime is now supposed to be used on systems still
> supporting 32 bit time (__TIMESIZE != 64) - hence the necessary
> conversion from 64 bit struct __timespec64 to struct timespec.
> 
> The new __timer_gettime64 syscall available from Linux 5.1+ has been
> used, when applicable.
> 
> Build tests:
> - The code has been tested on x86_64/x86 (native compilation):
> make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
> make xcheck PARALLELMFLAGS="-j8"
> 
> - The glibc has been build tested (make PARALLELMFLAGS="-j8") for
> x86 (i386), x86_64-x32, and armv7
> 
> Run-time tests:
> - Run specific tests on ARM/x86 32bit systems (qemu):
>   https://github.com/lmajewski/meta-y2038 and run tests:
>   https://github.com/lmajewski/y2038-tests/commits/master
> 
> - Use of cross-test-ssh.sh for ARM (armv7):
>   make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh
> root@192.168.7.2' xcheck
> 
> Linux kernel, headers and minimal kernel version for glibc build test
> matrix:
> - Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as
>   minimal kernel version (--enable-kernel="5.1.0")
>   The __ASSUME_TIME64_SYSCALLS flag defined.
> 
> - Linux v5.1 and default minimal kernel version
>   The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports
> timer_gettime64 syscall.
> 
> - Linux v4.19 (no timer_gettime64 support) with default minimal
> kernel version for contemporary glibc (3.2.0)
>   This kernel doesn't support timer_gettime64 syscall, so the
> fallback to timer_gettime is tested.
> 
> Above tests were performed with Y2038 redirection applied as well as
> without (so the __TIMESIZE != 64 execution path is checked as well).
> 
> No regressions were observed.
> ---
>  include/time.h                          |  7 ++++
>  sysdeps/unix/sysv/linux/timer_gettime.c | 44
> ++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 4
> deletions(-)
> 
> diff --git a/include/time.h b/include/time.h
> index 52ee213669..8b9a4b7a60 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct
> __timespec64 tsp[2]); libc_hidden_proto (__futimens64);
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __timer_gettime64 __timer_gettime
> +#else
> +extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64
> *value); +libc_hidden_proto (__timer_gettime64);
> +#endif
> +
>  /* Compute the `struct tm' representation of T,
>     offset OFFSET seconds east of UTC,
>     and store year, yday, mon, mday, wday, hour, min, sec into *TP.
> diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c
> b/sysdeps/unix/sysv/linux/timer_gettime.c index
> 8d9bef9196..31bf5ce25b 100644 ---
> a/sysdeps/unix/sysv/linux/timer_gettime.c +++
> b/sysdeps/unix/sysv/linux/timer_gettime.c @@ -20,15 +20,51 @@
>  #include <stdlib.h>
>  #include <time.h>
>  #include <sysdep.h>
> +#include <kernel-features.h>
>  #include "kernel-posix-timers.h"
>  
>  int
> -timer_gettime (timer_t timerid, struct itimerspec *value)
> +__timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
>  {
>    struct timer *kt = (struct timer *) timerid;
>  
> -  /* Delete the kernel timer object.  */
> -  int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
> +#ifdef __ASSUME_TIME64_SYSCALLS
> +# ifndef __NR_timer_gettime64
> +#  define __NR_timer_gettime64 __NR_timer_gettime
> +# endif
> +  return INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);
> +#else
> +# ifdef __NR_timer_gettime64
> +  int ret = INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);
> +  if (ret == 0 || errno != ENOSYS)
> +    return ret;
> +# endif
> +  struct itimerspec its32;
> +  int retval = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid,
> &its32);
> +  if (! retval)
> +    {
> +      value->it_interval = valid_timespec_to_timespec64
> (its32.it_interval);
> +      value->it_value = valid_timespec_to_timespec64
> (its32.it_value);
> +    }
>  
> -  return res;
> +  return retval;
> +#endif
>  }
> +
> +#if __TIMESIZE != 64
> +int
> +__timer_gettime (timer_t timerid, struct itimerspec *value)
> +{
> +  struct __itimerspec64 its64;
> +  int retval = __timer_gettime64 (timerid, &its64);
> +  if (! retval)
> +    {
> +      value->it_interval = valid_timespec64_to_timespec
> (its64.it_interval);
> +      value->it_value = valid_timespec64_to_timespec
> (its64.it_value);
> +    }
> +
> +  return retval;
> +}
> +#endif
> +weak_alias (__timer_gettime, timer_gettime)
> +libc_hidden_def (timer_gettime)

Gentle ping,


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation
  2019-11-11 21:47 ` [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation Lukasz Majewski
@ 2019-11-27 17:00   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-11-27 17:00 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 6388 bytes --]

Dear All,

> This patch provides new __timer_settime64 explicit 64 bit function
> for setting flags, interval and value of specified timer.
> Moreover, a 32 bit version - __timer_settime has been refactored to
> internally use __timer_settime64.
> 
> The __timer_settime is now supposed to be used on systems still
> supporting 32 bit time (__TIMESIZE != 64) - hence the necessary
> conversion to 64 bit struct __timespec64 from struct timespec (and
> opposite when old_value pointer is provided).
> 
> The new __timer_settime64 syscall available from Linux 5.1+ has been
> used, when applicable.
> 
> Build tests:
> - The code has been tested on x86_64/x86 (native compilation):
> make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
> make xcheck PARALLELMFLAGS="-j8"
> 
> - The glibc has been build tested (make PARALLELMFLAGS="-j8") for
> x86 (i386), x86_64-x32, and armv7
> 
> Run-time tests:
> - Run specific tests on ARM/x86 32bit systems (qemu):
>   https://github.com/lmajewski/meta-y2038 and run tests:
>   https://github.com/lmajewski/y2038-tests/commits/master
> 
> - Use of cross-test-ssh.sh for ARM (armv7):
>   make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh
> root@192.168.7.2' xcheck
> 
> Linux kernel, headers and minimal kernel version for glibc build test
> matrix:
> - Linux v5.1 (with timer_settime64) and glibc build with v5.1 as
>   minimal kernel version (--enable-kernel="5.1.0")
>   The __ASSUME_TIME64_SYSCALLS flag defined.
> 
> - Linux v5.1 and default minimal kernel version
>   The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports
> timer_settime64 syscall.
> 
> - Linux v4.19 (no timer_settime64 support) with default minimal
> kernel version for contemporary glibc (3.2.0)
>   This kernel doesn't support timer_settime64 syscall, so the
> fallback to timer_settime is tested.
> 
> Above tests were performed with Y2038 redirection applied as well as
> without (so the __TIMESIZE != 64 execution path is checked as well).
> 
> No regressions were observed.
> ---
>  include/time.h                          |  9 ++++
>  sysdeps/unix/sysv/linux/timer_settime.c | 68
> ++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 6
> deletions(-)
> 
> diff --git a/include/time.h b/include/time.h
> index 8b9a4b7a60..a46fd2f08a 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -186,6 +186,15 @@ extern int __timer_gettime64 (timer_t timerid,
> struct __itimerspec64 *value); libc_hidden_proto (__timer_gettime64);
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __timer_settime64 __timer_settime
> +#else
> +extern int __timer_settime64 (timer_t timerid, int flags,
> +                              const struct __itimerspec64 *value,
> +                              struct __itimerspec64 *ovalue);
> +libc_hidden_proto (__timer_settime64);
> +#endif
> +
>  /* Compute the `struct tm' representation of T,
>     offset OFFSET seconds east of UTC,
>     and store year, yday, mon, mday, wday, hour, min, sec into *TP.
> diff --git a/sysdeps/unix/sysv/linux/timer_settime.c
> b/sysdeps/unix/sysv/linux/timer_settime.c index
> 51f24200aa..f847e3e44a 100644 ---
> a/sysdeps/unix/sysv/linux/timer_settime.c +++
> b/sysdeps/unix/sysv/linux/timer_settime.c @@ -20,17 +20,73 @@
>  #include <stdlib.h>
>  #include <time.h>
>  #include <sysdep.h>
> +#include <kernel-features.h>
>  #include "kernel-posix-timers.h"
>  
>  int
> -timer_settime (timer_t timerid, int flags, const struct itimerspec
> *value,
> -	       struct itimerspec *ovalue)
> +__timer_settime64 (timer_t timerid, int flags,
> +                   const struct __itimerspec64 *value,
> +                   struct __itimerspec64 *ovalue)
>  {
>    struct timer *kt = (struct timer *) timerid;
>  
> -  /* Delete the kernel timer object.  */
> -  int res = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
> -			    value, ovalue);
> +#ifdef __ASSUME_TIME64_SYSCALLS
> +# ifndef __NR_timer_settime64
> +#  define __NR_timer_settime64 __NR_timer_settime
> +# endif
> +  return INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags,
> value,
> +                         ovalue);
> +#else
> +# ifdef __NR_timer_settime64
> +  int ret = INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags,
> value,
> +                            ovalue);
> +  if (ret == 0 || errno != ENOSYS)
> +    return ret;
> +# endif
> +  struct itimerspec its32, oits32;
>  
> -  return res;
> +  if (! in_time_t_range ((value->it_value).tv_sec)
> +      || ! in_time_t_range ((value->it_interval).tv_sec))
> +    {
> +      __set_errno (EOVERFLOW);
> +      return -1;
> +    }
> +
> +  its32.it_interval = valid_timespec64_to_timespec
> (value->it_interval);
> +  its32.it_value = valid_timespec64_to_timespec (value->it_value);
> +
> +  int retval = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
> +                               &its32, ovalue ? &oits32 : NULL);
> +  if (! retval && ovalue)
> +    {
> +      ovalue->it_interval = valid_timespec_to_timespec64
> (oits32.it_interval);
> +      ovalue->it_value = valid_timespec_to_timespec64
> (oits32.it_value);
> +    }
> +
> +  return retval;
> +#endif
> +}
> +
> +#if __TIMESIZE != 64
> +int
> +__timer_settime (timer_t timerid, int flags, const struct itimerspec
> *value,
> +                 struct itimerspec *ovalue)
> +{
> +  struct __itimerspec64 its64, oits64;
> +  int retval;
> +
> +  its64.it_interval = valid_timespec_to_timespec64
> (value->it_interval);
> +  its64.it_value = valid_timespec_to_timespec64 (value->it_value);
> +
> +  retval = __timer_settime64 (timerid, flags, &its64, ovalue ?
> &oits64 : NULL);
> +  if (! retval && ovalue)
> +    {
> +      ovalue->it_interval = valid_timespec64_to_timespec
> (oits64.it_interval);
> +      ovalue->it_value = valid_timespec64_to_timespec
> (oits64.it_value);
> +    }
> +
> +  return retval;
>  }
> +#endif
> +weak_alias (__timer_settime, timer_settime)
> +libc_hidden_def (timer_settime)

Gentle ping,


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64
  2019-11-11 21:47 ` [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64 Lukasz Majewski
  2019-11-27 16:59   ` Lukasz Majewski
@ 2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Adhemerval Zanella @ 2019-12-04 19:41 UTC (permalink / raw)
  To: GNU C Library



On 11/11/2019 18:47, Lukasz Majewski wrote:
> This change provides the glibc's internal struct itimerspec representation,
> which is explicitly supporting 64 bit time (by using struct __timespec64).
> 
> Such representation is necessary to provide correct time after Y2038
> (time_t overflow) on devides with __TIMESIZE == 32.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  include/time.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/time.h b/include/time.h
> index d7800eb30f..52ee213669 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -82,6 +82,17 @@ struct __timespec64
>  };
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __itimerspec64 itimerspec
> +#else
> +/* The glibc's internal representation of the struct itimerspec.  */
> +struct __itimerspec64
> +{
> +  struct __timespec64 it_interval;
> +  struct __timespec64 it_value;
> +};
> +#endif
> +
>  #if __TIMESIZE == 64
>  # define __ctime64 ctime
>  #else
> 

Ok, __timespec64 already handles both the padding and endianess.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation
  2019-11-11 21:47 ` [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation Lukasz Majewski
  2019-11-27 16:59   ` Lukasz Majewski
@ 2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Adhemerval Zanella @ 2019-12-04 19:41 UTC (permalink / raw)
  To: GNU C Library



On 11/11/2019 18:47, Lukasz Majewski wrote:
> The x86_64 specific timer_gettime implementation (from
> ./linux/x86_64/timer_gettime.c) reused the Linux generic one (from
> ./linux/timer_gettime.c) to implement handling some compatible timers
> (previously defined in librt, now in libc).
> 
> As the generic implementation now is going to also support new (available
> from Linux 5.1+) timer_gettime64 syscall, those two implementations have
> been decoupled for easier conversion.

LGTM with a nit below.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/timer_gettime.c        |  7 -------
>  sysdeps/unix/sysv/linux/x86_64/timer_gettime.c | 12 ++++++++----
>  2 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
> index 799e2c935e..8d9bef9196 100644
> --- a/sysdeps/unix/sysv/linux/timer_gettime.c
> +++ b/sysdeps/unix/sysv/linux/timer_gettime.c
> @@ -22,16 +22,9 @@
>  #include <sysdep.h>
>  #include "kernel-posix-timers.h"
>  
> -
> -#ifdef timer_gettime_alias
> -# define timer_gettime timer_gettime_alias
> -#endif
> -
> -
>  int
>  timer_gettime (timer_t timerid, struct itimerspec *value)
>  {
> -#undef timer_gettime
>    struct timer *kt = (struct timer *) timerid;
>  
>    /* Delete the kernel timer object.  */

Ok.

> diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
> index 54daee2f4c..5755cc44fb 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
> +++ b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
> @@ -17,13 +17,17 @@
>     not, see <https://www.gnu.org/licenses/>.  */
>  
>  #include <shlib-compat.h>
> +#include <sysdep.h>
> +#include "kernel-posix-timers.h"
>  #include "compat-timer.h"
>  
> +int
> +__timer_gettime_new (timer_t timerid, struct itimerspec *value)
> +{
> +  struct timer *kt = (struct timer *) timerid;
>  
> -#define timer_gettime_alias __timer_gettime_new
> -#include <sysdeps/unix/sysv/linux/timer_gettime.c>
> -
> -#undef timer_gettime
> +  return INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);

Use INLINE_SYSCALL_CALL.

> +}
>  versioned_symbol (librt, __timer_gettime_new, timer_gettime, GLIBC_2_3_3);
>  
>  
>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/5] timer: Decouple x86_64 specific timer_settime from generic Linux implementation
  2019-11-11 21:47 ` [PATCH 3/5] timer: Decouple x86_64 specific timer_settime " Lukasz Majewski
  2019-11-27 16:59   ` Lukasz Majewski
@ 2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Adhemerval Zanella @ 2019-12-04 19:41 UTC (permalink / raw)
  To: Lukasz Majewski, Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library, Florian Weimer,
	Florian Weimer, Zack Weinberg, Carlos O'Donell



On 11/11/2019 18:47, Lukasz Majewski wrote:
> The x86_64 specific timer_settime implementation (from
> ./linux/x86_64/timer_settime.c) reused the Linux generic one (from
> ./linux/timer_settime.c) to implement handling some compatible timers
> (previously defined in librt, now in libc).
> 
> As the generic implementation now is going to also support new (available
> from Linux 5.1+) timer_settime64 syscall, those two implementations have
> been decoupled for easier conversion.


LGTM with a nit below.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/timer_settime.c        |  7 -------
>  sysdeps/unix/sysv/linux/x86_64/timer_settime.c | 14 ++++++++++----
>  2 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
> index a8350aedaa..51f24200aa 100644
> --- a/sysdeps/unix/sysv/linux/timer_settime.c
> +++ b/sysdeps/unix/sysv/linux/timer_settime.c
> @@ -22,17 +22,10 @@
>  #include <sysdep.h>
>  #include "kernel-posix-timers.h"
>  
> -
> -#ifdef timer_settime_alias
> -# define timer_settime timer_settime_alias
> -#endif
> -
> -
>  int
>  timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
>  	       struct itimerspec *ovalue)
>  {
> -#undef timer_settime
>    struct timer *kt = (struct timer *) timerid;
>  
>    /* Delete the kernel timer object.  */

Ok.

> diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
> index ea8978d5cd..b71a82e8cc 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
> +++ b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
> @@ -17,13 +17,19 @@
>     not, see <https://www.gnu.org/licenses/>.  */
>  
>  #include <shlib-compat.h>
> +#include <sysdep.h>
> +#include "kernel-posix-timers.h"
>  #include "compat-timer.h"
>  
> +int
> +__timer_settime_new (timer_t timerid, int flags, const struct itimerspec *value,
> +                     struct itimerspec *ovalue)
> +{
> +  struct timer *kt = (struct timer *) timerid;
>  
> -#define timer_settime_alias __timer_settime_new
> -#include <sysdeps/unix/sysv/linux/timer_settime.c>
> -
> -#undef timer_settime
> +  return INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
> +                         value, ovalue);
> +}

Use INLINE_SYSCALL_CALL.

>  versioned_symbol (librt, __timer_settime_new, timer_settime, GLIBC_2_3_3);
>  
>  
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-11-11 21:47 ` [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation Lukasz Majewski
  2019-11-27 17:00   ` Lukasz Majewski
@ 2019-12-04 19:41   ` Adhemerval Zanella
  2019-12-05  9:42     ` Lukasz Majewski
  2019-12-11 17:51   ` Andreas Schwab
  2 siblings, 1 reply; 26+ messages in thread
From: Adhemerval Zanella @ 2019-12-04 19:41 UTC (permalink / raw)
  To: GNU C Library



On 11/11/2019 18:47, Lukasz Majewski wrote:
> This patch provides new __timer_gettime64 explicit 64 bit function for reading
> status of specified timer. To be more precise - the remaining time and interval
> set with timer_settime.
> Moreover, a 32 bit version - __timer_gettime has been refactored to internally
> use __timer_gettime64.
> 
> The __timer_gettime is now supposed to be used on systems still supporting 32
> bit time (__TIMESIZE != 64) - hence the necessary conversion from 64 bit struct
> __timespec64 to struct timespec.
> 
> The new __timer_gettime64 syscall available from Linux 5.1+ has been used, when
> applicable.
> 
> Build tests:
> - The code has been tested on x86_64/x86 (native compilation):
> make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
> make xcheck PARALLELMFLAGS="-j8"
> 
> - The glibc has been build tested (make PARALLELMFLAGS="-j8") for
> x86 (i386), x86_64-x32, and armv7
> 
> Run-time tests:
> - Run specific tests on ARM/x86 32bit systems (qemu):
>   https://github.com/lmajewski/meta-y2038 and run tests:
>   https://github.com/lmajewski/y2038-tests/commits/master

Does it have any additional coverage not present in glibc tests? If yes, would
be possible to enhance glibc tests?

> 
> - Use of cross-test-ssh.sh for ARM (armv7):
>   make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck
> 
> Linux kernel, headers and minimal kernel version for glibc build test
> matrix:
> - Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as
>   minimal kernel version (--enable-kernel="5.1.0")
>   The __ASSUME_TIME64_SYSCALLS flag defined.
> 
> - Linux v5.1 and default minimal kernel version
>   The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_gettime64
>   syscall.
> 
> - Linux v4.19 (no timer_gettime64 support) with default minimal kernel version
>   for contemporary glibc (3.2.0)
>   This kernel doesn't support timer_gettime64 syscall, so the fallback to
>   timer_gettime is tested.
> 
> Above tests were performed with Y2038 redirection applied as well as without
> (so the __TIMESIZE != 64 execution path is checked as well).
> 
> No regressions were observed.

LGTM with some changes below.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  include/time.h                          |  7 ++++
>  sysdeps/unix/sysv/linux/timer_gettime.c | 44 ++++++++++++++++++++++---
>  2 files changed, 47 insertions(+), 4 deletions(-)
> 
> diff --git a/include/time.h b/include/time.h
> index 52ee213669..8b9a4b7a60 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct __timespec64 tsp[2]);
>  libc_hidden_proto (__futimens64);
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __timer_gettime64 __timer_gettime
> +#else
> +extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value);
> +libc_hidden_proto (__timer_gettime64);
> +#endif
> +
>  /* Compute the `struct tm' representation of T,
>     offset OFFSET seconds east of UTC,
>     and store year, yday, mon, mday, wday, hour, min, sec into *TP.

Ok, it follows current practice.

> diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
> index 8d9bef9196..31bf5ce25b 100644
> --- a/sysdeps/unix/sysv/linux/timer_gettime.c
> +++ b/sysdeps/unix/sysv/linux/timer_gettime.c
> @@ -20,15 +20,51 @@
>  #include <stdlib.h>
>  #include <time.h>
>  #include <sysdep.h>
> +#include <kernel-features.h>
>  #include "kernel-posix-timers.h"
>  
>  int
> -timer_gettime (timer_t timerid, struct itimerspec *value)
> +__timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
>  {
>    struct timer *kt = (struct timer *) timerid;
>  
> -  /* Delete the kernel timer object.  */
> -  int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
> +#ifdef __ASSUME_TIME64_SYSCALLS
> +# ifndef __NR_timer_gettime64
> +#  define __NR_timer_gettime64 __NR_timer_gettime
> +# endif
> +  return INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);

Use INLINE_SYSCALL_CALL.

> +#else
> +# ifdef __NR_timer_gettime64
> +  int ret = INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);

Ditto.

> +  if (ret == 0 || errno != ENOSYS)
> +    return ret;
> +# endif
> +  struct itimerspec its32;
> +  int retval = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, &its32);

Ditto.

> +  if (! retval)

Please use an explicit comparison with == 0.

> +    {
> +      value->it_interval = valid_timespec_to_timespec64 (its32.it_interval);
> +      value->it_value = valid_timespec_to_timespec64 (its32.it_value);
> +    }
>  
> -  return res;
> +  return retval;
> +#endif
>  }
> +

Ok.

> +#if __TIMESIZE != 64
> +int
> +__timer_gettime (timer_t timerid, struct itimerspec *value)
> +{
> +  struct __itimerspec64 its64;
> +  int retval = __timer_gettime64 (timerid, &its64);
> +  if (! retval)

Please use an explicit comparison with == 0.

> +    {
> +      value->it_interval = valid_timespec64_to_timespec (its64.it_interval);
> +      value->it_value = valid_timespec64_to_timespec (its64.it_value);
> +    }
> +
> +  return retval;
> +}
> +#endif
> +weak_alias (__timer_gettime, timer_gettime)
> +libc_hidden_def (timer_gettime)
> 

Ok.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation
  2019-11-11 21:47 ` [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation Lukasz Majewski
  2019-11-27 17:00   ` Lukasz Majewski
@ 2019-12-04 19:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 26+ messages in thread
From: Adhemerval Zanella @ 2019-12-04 19:41 UTC (permalink / raw)
  To: GNU C Library



On 11/11/2019 18:47, Lukasz Majewski wrote:
> This patch provides new __timer_settime64 explicit 64 bit function for setting
> flags, interval and value of specified timer.
> Moreover, a 32 bit version - __timer_settime has been refactored to internally
> use __timer_settime64.
> 
> The __timer_settime is now supposed to be used on systems still supporting 32
> bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct
> __timespec64 from struct timespec (and opposite when old_value pointer is
> provided).
> 
> The new __timer_settime64 syscall available from Linux 5.1+ has been used, when
> applicable.
> 
> Build tests:
> - The code has been tested on x86_64/x86 (native compilation):
> make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
> make xcheck PARALLELMFLAGS="-j8"
> 
> - The glibc has been build tested (make PARALLELMFLAGS="-j8") for
> x86 (i386), x86_64-x32, and armv7
> 
> Run-time tests:
> - Run specific tests on ARM/x86 32bit systems (qemu):
>   https://github.com/lmajewski/meta-y2038 and run tests:
>   https://github.com/lmajewski/y2038-tests/commits/master

Does it have any additional coverage not present in glibc tests? If yes, would
be possible to enhance glibc tests?

> 
> - Use of cross-test-ssh.sh for ARM (armv7):
>   make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck
> 
> Linux kernel, headers and minimal kernel version for glibc build test
> matrix:
> - Linux v5.1 (with timer_settime64) and glibc build with v5.1 as
>   minimal kernel version (--enable-kernel="5.1.0")
>   The __ASSUME_TIME64_SYSCALLS flag defined.
> 
> - Linux v5.1 and default minimal kernel version
>   The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_settime64
>   syscall.
> 
> - Linux v4.19 (no timer_settime64 support) with default minimal kernel version
>   for contemporary glibc (3.2.0)
>   This kernel doesn't support timer_settime64 syscall, so the fallback to
>   timer_settime is tested.
> 
> Above tests were performed with Y2038 redirection applied as well as without
> (so the __TIMESIZE != 64 execution path is checked as well).
> 
> No regressions were observed.


LGTM with some changes below.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  include/time.h                          |  9 ++++
>  sysdeps/unix/sysv/linux/timer_settime.c | 68 ++++++++++++++++++++++---
>  2 files changed, 71 insertions(+), 6 deletions(-)
> 
> diff --git a/include/time.h b/include/time.h
> index 8b9a4b7a60..a46fd2f08a 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -186,6 +186,15 @@ extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value);
>  libc_hidden_proto (__timer_gettime64);
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __timer_settime64 __timer_settime
> +#else
> +extern int __timer_settime64 (timer_t timerid, int flags,
> +                              const struct __itimerspec64 *value,
> +                              struct __itimerspec64 *ovalue);
> +libc_hidden_proto (__timer_settime64);
> +#endif
> +
>  /* Compute the `struct tm' representation of T,
>     offset OFFSET seconds east of UTC,
>     and store year, yday, mon, mday, wday, hour, min, sec into *TP.

Ok, it follows current practice.

> diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
> index 51f24200aa..f847e3e44a 100644
> --- a/sysdeps/unix/sysv/linux/timer_settime.c
> +++ b/sysdeps/unix/sysv/linux/timer_settime.c
> @@ -20,17 +20,73 @@
>  #include <stdlib.h>
>  #include <time.h>
>  #include <sysdep.h>
> +#include <kernel-features.h>
>  #include "kernel-posix-timers.h"
>  
>  int
> -timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
> -	       struct itimerspec *ovalue)
> +__timer_settime64 (timer_t timerid, int flags,
> +                   const struct __itimerspec64 *value,
> +                   struct __itimerspec64 *ovalue)
>  {
>    struct timer *kt = (struct timer *) timerid;
>  
> -  /* Delete the kernel timer object.  */
> -  int res = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
> -			    value, ovalue);
> +#ifdef __ASSUME_TIME64_SYSCALLS
> +# ifndef __NR_timer_settime64
> +#  define __NR_timer_settime64 __NR_timer_settime
> +# endif
> +  return INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags, value,
> +                         ovalue);
> +#else

Use INLINE_SYSCALL_CALL.

> +# ifdef __NR_timer_settime64
> +  int ret = INLINE_SYSCALL (timer_settime64, 4, kt->ktimerid, flags, value,
> +                            ovalue);
> +  if (ret == 0 || errno != ENOSYS)
> +    return ret;
> +# endif

Ditto.

> +  struct itimerspec its32, oits32;
>  
> -  return res;
> +  if (! in_time_t_range ((value->it_value).tv_sec)
> +      || ! in_time_t_range ((value->it_interval).tv_sec))
> +    {
> +      __set_errno (EOVERFLOW);
> +      return -1;
> +    }

Ok.

> +
> +  its32.it_interval = valid_timespec64_to_timespec (value->it_interval);
> +  its32.it_value = valid_timespec64_to_timespec (value->it_value);
> +
> +  int retval = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
> +                               &its32, ovalue ? &oits32 : NULL);

Use INLINE_SYSCALL_CALL.

> +  if (! retval && ovalue)

Use explicit comparisons.

> +    {
> +      ovalue->it_interval = valid_timespec_to_timespec64 (oits32.it_interval);
> +      ovalue->it_value = valid_timespec_to_timespec64 (oits32.it_value);
> +    }
> +
> +  return retval;
> +#endif
> +}
> +

Ok.

> +#if __TIMESIZE != 64
> +int
> +__timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
> +                 struct itimerspec *ovalue)
> +{
> +  struct __itimerspec64 its64, oits64;
> +  int retval;
> +
> +  its64.it_interval = valid_timespec_to_timespec64 (value->it_interval);
> +  its64.it_value = valid_timespec_to_timespec64 (value->it_value);
> +
> +  retval = __timer_settime64 (timerid, flags, &its64, ovalue ? &oits64 : NULL);
> +  if (! retval && ovalue)

Use explicit comparisons.

> +    {
> +      ovalue->it_interval = valid_timespec64_to_timespec (oits64.it_interval);
> +      ovalue->it_value = valid_timespec64_to_timespec (oits64.it_value);
> +    }
> +
> +  return retval;
>  }
> +#endif
> +weak_alias (__timer_settime, timer_settime)
> +libc_hidden_def (timer_settime)
> 

Ok.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-12-04 19:41   ` Adhemerval Zanella
@ 2019-12-05  9:42     ` Lukasz Majewski
  0 siblings, 0 replies; 26+ messages in thread
From: Lukasz Majewski @ 2019-12-05  9:42 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library

[-- Attachment #1: Type: text/plain, Size: 6745 bytes --]

Hi Adhemerval,

Thank you for your review. I'm making those pointed out minor
adjustments, re-test the code and pull to master.

> On 11/11/2019 18:47, Lukasz Majewski wrote:
> > This patch provides new __timer_gettime64 explicit 64 bit function
> > for reading status of specified timer. To be more precise - the
> > remaining time and interval set with timer_settime.
> > Moreover, a 32 bit version - __timer_gettime has been refactored to
> > internally use __timer_gettime64.
> > 
> > The __timer_gettime is now supposed to be used on systems still
> > supporting 32 bit time (__TIMESIZE != 64) - hence the necessary
> > conversion from 64 bit struct __timespec64 to struct timespec.
> > 
> > The new __timer_gettime64 syscall available from Linux 5.1+ has
> > been used, when applicable.
> > 
> > Build tests:
> > - The code has been tested on x86_64/x86 (native compilation):
> > make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\
> > make xcheck PARALLELMFLAGS="-j8"
> > 
> > - The glibc has been build tested (make PARALLELMFLAGS="-j8") for
> > x86 (i386), x86_64-x32, and armv7
> > 
> > Run-time tests:
> > - Run specific tests on ARM/x86 32bit systems (qemu):
> >   https://github.com/lmajewski/meta-y2038 and run tests:
> >   https://github.com/lmajewski/y2038-tests/commits/master  
> 
> Does it have any additional coverage not present in glibc tests? If
> yes, would be possible to enhance glibc tests?

Those tests are for 32 bit archs (ARM, x86, x86-x32, RISC-V) with set
-D_TIME_BITS=64 during the compilation (to check if the system is Y2038
safe).

As glibc is not yet supporting this flag, I don't add them to glibc's
tests.

I do plan to add them when we make "the big switch" and instantly add
-D_TIME_BITS64 support to glibc.

In the meanwhile I do rely on current glibc's setup to catch
regressions when I convert functions eligible for Y2038 enhancement
(which do support __ASSUME_TIME64_SYSCALLS flag).

> 
> > 
> > - Use of cross-test-ssh.sh for ARM (armv7):
> >   make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh
> > root@192.168.7.2' xcheck
> > 
> > Linux kernel, headers and minimal kernel version for glibc build
> > test matrix:
> > - Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as
> >   minimal kernel version (--enable-kernel="5.1.0")
> >   The __ASSUME_TIME64_SYSCALLS flag defined.
> > 
> > - Linux v5.1 and default minimal kernel version
> >   The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports
> > timer_gettime64 syscall.
> > 
> > - Linux v4.19 (no timer_gettime64 support) with default minimal
> > kernel version for contemporary glibc (3.2.0)
> >   This kernel doesn't support timer_gettime64 syscall, so the
> > fallback to timer_gettime is tested.
> > 
> > Above tests were performed with Y2038 redirection applied as well
> > as without (so the __TIMESIZE != 64 execution path is checked as
> > well).
> > 
> > No regressions were observed.  
> 
> LGTM with some changes below.
> 
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> 
> > ---
> >  include/time.h                          |  7 ++++
> >  sysdeps/unix/sysv/linux/timer_gettime.c | 44
> > ++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 4
> > deletions(-)
> > 
> > diff --git a/include/time.h b/include/time.h
> > index 52ee213669..8b9a4b7a60 100644
> > --- a/include/time.h
> > +++ b/include/time.h
> > @@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct
> > __timespec64 tsp[2]); libc_hidden_proto (__futimens64);
> >  #endif
> >  
> > +#if __TIMESIZE == 64
> > +# define __timer_gettime64 __timer_gettime
> > +#else
> > +extern int __timer_gettime64 (timer_t timerid, struct
> > __itimerspec64 *value); +libc_hidden_proto (__timer_gettime64);
> > +#endif
> > +
> >  /* Compute the `struct tm' representation of T,
> >     offset OFFSET seconds east of UTC,
> >     and store year, yday, mon, mday, wday, hour, min, sec into *TP.
> >  
> 
> Ok, it follows current practice.
> 
> > diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c
> > b/sysdeps/unix/sysv/linux/timer_gettime.c index
> > 8d9bef9196..31bf5ce25b 100644 ---
> > a/sysdeps/unix/sysv/linux/timer_gettime.c +++
> > b/sysdeps/unix/sysv/linux/timer_gettime.c @@ -20,15 +20,51 @@
> >  #include <stdlib.h>
> >  #include <time.h>
> >  #include <sysdep.h>
> > +#include <kernel-features.h>
> >  #include "kernel-posix-timers.h"
> >  
> >  int
> > -timer_gettime (timer_t timerid, struct itimerspec *value)
> > +__timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
> >  {
> >    struct timer *kt = (struct timer *) timerid;
> >  
> > -  /* Delete the kernel timer object.  */
> > -  int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
> > +#ifdef __ASSUME_TIME64_SYSCALLS
> > +# ifndef __NR_timer_gettime64
> > +#  define __NR_timer_gettime64 __NR_timer_gettime
> > +# endif
> > +  return INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid, value);
> >  
> 
> Use INLINE_SYSCALL_CALL.
> 
> > +#else
> > +# ifdef __NR_timer_gettime64
> > +  int ret = INLINE_SYSCALL (timer_gettime64, 2, kt->ktimerid,
> > value);  
> 
> Ditto.
> 
> > +  if (ret == 0 || errno != ENOSYS)
> > +    return ret;
> > +# endif
> > +  struct itimerspec its32;
> > +  int retval = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid,
> > &its32);  
> 
> Ditto.
> 
> > +  if (! retval)  
> 
> Please use an explicit comparison with == 0.
> 
> > +    {
> > +      value->it_interval = valid_timespec_to_timespec64
> > (its32.it_interval);
> > +      value->it_value = valid_timespec_to_timespec64
> > (its32.it_value);
> > +    }
> >  
> > -  return res;
> > +  return retval;
> > +#endif
> >  }
> > +  
> 
> Ok.
> 
> > +#if __TIMESIZE != 64
> > +int
> > +__timer_gettime (timer_t timerid, struct itimerspec *value)
> > +{
> > +  struct __itimerspec64 its64;
> > +  int retval = __timer_gettime64 (timerid, &its64);
> > +  if (! retval)  
> 
> Please use an explicit comparison with == 0.
> 
> > +    {
> > +      value->it_interval = valid_timespec64_to_timespec
> > (its64.it_interval);
> > +      value->it_value = valid_timespec64_to_timespec
> > (its64.it_value);
> > +    }
> > +
> > +  return retval;
> > +}
> > +#endif
> > +weak_alias (__timer_gettime, timer_gettime)
> > +libc_hidden_def (timer_gettime)
> >   
> 
> Ok.




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-11-11 21:47 ` [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation Lukasz Majewski
  2019-11-27 17:00   ` Lukasz Majewski
  2019-12-04 19:41   ` Adhemerval Zanella
@ 2019-12-11 17:51   ` Andreas Schwab
  2019-12-11 22:26     ` Lukasz Majewski
  2 siblings, 1 reply; 26+ messages in thread
From: Andreas Schwab @ 2019-12-11 17:51 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Joseph Myers, Paul Eggert, Alistair Francis, Alistair Francis,
	GNU C Library, Adhemerval Zanella, Florian Weimer, Florian Weimer,
	Zack Weinberg, Carlos O'Donell

On Nov 11 2019, Lukasz Majewski wrote:

> diff --git a/include/time.h b/include/time.h
> index 52ee213669..8b9a4b7a60 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct __timespec64 tsp[2]);
>  libc_hidden_proto (__futimens64);
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __timer_gettime64 __timer_gettime
> +#else
> +extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value);
> +libc_hidden_proto (__timer_gettime64);

This libc_hidden_proto is wrong since timer_gettime64 lives in librt.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-12-11 17:51   ` Andreas Schwab
@ 2019-12-11 22:26     ` Lukasz Majewski
  2019-12-12 15:26       ` Andreas Schwab
  0 siblings, 1 reply; 26+ messages in thread
From: Lukasz Majewski @ 2019-12-11 22:26 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Joseph Myers, Paul Eggert, Alistair Francis, Alistair Francis,
	GNU C Library, Adhemerval Zanella, Florian Weimer, Florian Weimer,
	Zack Weinberg, Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]

Hi Andreas,

> On Nov 11 2019, Lukasz Majewski wrote:
> 
> > diff --git a/include/time.h b/include/time.h
> > index 52ee213669..8b9a4b7a60 100644
> > --- a/include/time.h
> > +++ b/include/time.h
> > @@ -179,6 +179,13 @@ extern int __futimens64 (int fd, const struct
> > __timespec64 tsp[2]); libc_hidden_proto (__futimens64);
> >  #endif
> >  
> > +#if __TIMESIZE == 64
> > +# define __timer_gettime64 __timer_gettime
> > +#else
> > +extern int __timer_gettime64 (timer_t timerid, struct
> > __itimerspec64 *value); +libc_hidden_proto (__timer_gettime64);  
> 
> This libc_hidden_proto is wrong since timer_gettime64 lives in librt.
> 

I may be not so experienced glibc developer, but isn't the
libc_hidden_proto macro used to bypass plt access to this function when
it is used internally in glibc?

For librt there is the same symbol (and stub function defined) for
backward compatibility.

Or am I missing something important? Thanks in advance for the
explanation.

> Andreas.
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-12-11 22:26     ` Lukasz Majewski
@ 2019-12-12 15:26       ` Andreas Schwab
  2019-12-12 15:33         ` Lukasz Majewski
  0 siblings, 1 reply; 26+ messages in thread
From: Andreas Schwab @ 2019-12-12 15:26 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Joseph Myers, Paul Eggert, Alistair Francis, Alistair Francis,
	GNU C Library, Adhemerval Zanella, Florian Weimer, Florian Weimer,
	Zack Weinberg, Carlos O'Donell

On Dez 11 2019, Lukasz Majewski wrote:

> I may be not so experienced glibc developer, but isn't the
> libc_hidden_proto macro used to bypass plt access to this function when
> it is used internally in glibc?

But there is no timer_gettime in libc.

> For librt there is the same symbol (and stub function defined) for
> backward compatibility.

??? The implementation in librt is not a stub function.

Andreas.
 
-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-12-12 15:26       ` Andreas Schwab
@ 2019-12-12 15:33         ` Lukasz Majewski
  2019-12-12 15:46           ` Andreas Schwab
  0 siblings, 1 reply; 26+ messages in thread
From: Lukasz Majewski @ 2019-12-12 15:33 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Joseph Myers, Paul Eggert, Alistair Francis, Alistair Francis,
	GNU C Library, Adhemerval Zanella, Florian Weimer, Florian Weimer,
	Zack Weinberg, Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Hi Andreas,

> On Dez 11 2019, Lukasz Majewski wrote:
> 
> > I may be not so experienced glibc developer, but isn't the
> > libc_hidden_proto macro used to bypass plt access to this function
> > when it is used internally in glibc?  
> 
> But there is no timer_gettime in libc.

Please find below link:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/timer_gettime.c;h=20d34dbfa97de7e9d8e4071426fa463bb524e863;hb=HEAD

> 
> > For librt there is the same symbol (and stub function defined) for
> > backward compatibility.  
> 
> ??? The implementation in librt is not a stub function.
> 

Please find following link:
https://sourceware.org/git/?p=glibc.git;a=tree;f=rt;h=8187c0183ec2a9ef1a71fc7916e37e6242ef83ca;hb=HEAD

> Andreas.
>  


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-12-12 15:33         ` Lukasz Majewski
@ 2019-12-12 15:46           ` Andreas Schwab
  2019-12-12 16:05             ` Lukasz Majewski
  0 siblings, 1 reply; 26+ messages in thread
From: Andreas Schwab @ 2019-12-12 15:46 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Joseph Myers, Paul Eggert, Alistair Francis, Alistair Francis,
	GNU C Library, Adhemerval Zanella, Florian Weimer, Florian Weimer,
	Zack Weinberg, Carlos O'Donell

On Dez 12 2019, Lukasz Majewski wrote:

> Please find below link:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/timer_gettime.c;h=20d34dbfa97de7e9d8e4071426fa463bb524e863;hb=HEAD

What does that show?

> Please find following link:
> https://sourceware.org/git/?p=glibc.git;a=tree;f=rt;h=8187c0183ec2a9ef1a71fc7916e37e6242ef83ca;hb=HEAD

What does that show?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-12-12 15:46           ` Andreas Schwab
@ 2019-12-12 16:05             ` Lukasz Majewski
  2019-12-12 16:08               ` Andreas Schwab
  0 siblings, 1 reply; 26+ messages in thread
From: Lukasz Majewski @ 2019-12-12 16:05 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Joseph Myers, Paul Eggert, Alistair Francis, Alistair Francis,
	GNU C Library, Adhemerval Zanella, Florian Weimer, Florian Weimer,
	Zack Weinberg, Carlos O'Donell

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

On Thu, 12 Dec 2019 16:46:50 +0100
Andreas Schwab <schwab@suse.de> wrote:

> On Dez 12 2019, Lukasz Majewski wrote:
> 
> > Please find below link:
> > https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/timer_gettime.c;h=20d34dbfa97de7e9d8e4071426fa463bb524e863;hb=HEAD
> >  
> 
> What does that show?
> 
> > Please find following link:
> > https://sourceware.org/git/?p=glibc.git;a=tree;f=rt;h=8187c0183ec2a9ef1a71fc7916e37e6242ef83ca;hb=HEAD
> >  
> 
> What does that show?


It shows that for rt you have one version of timer_gettime (with
stub_warning) in /rt and another one in the Linux specific one for
glibc.

At least from the directory structure POV. However, I don't know how it
is resolved with compatibility symbols.

> 
> Andreas.
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation
  2019-12-12 16:05             ` Lukasz Majewski
@ 2019-12-12 16:08               ` Andreas Schwab
  0 siblings, 0 replies; 26+ messages in thread
From: Andreas Schwab @ 2019-12-12 16:08 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Joseph Myers, Paul Eggert, Alistair Francis, Alistair Francis,
	GNU C Library, Adhemerval Zanella, Florian Weimer, Florian Weimer,
	Zack Weinberg, Carlos O'Donell

There is only one timer_gettime, and that lives in librt.  The source
file rt/timer_gettime.c is not used.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2019-12-12 16:08 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 21:47 [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
2019-11-11 21:47 ` [PATCH 1/5] time: Introduce glibc's internal struct __itimerspec64 Lukasz Majewski
2019-11-27 16:59   ` Lukasz Majewski
2019-12-04 19:41   ` Adhemerval Zanella
2019-11-11 21:47 ` [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation Lukasz Majewski
2019-11-27 16:59   ` Lukasz Majewski
2019-12-04 19:41   ` Adhemerval Zanella
2019-11-11 21:47 ` [PATCH 3/5] timer: Decouple x86_64 specific timer_settime " Lukasz Majewski
2019-11-27 16:59   ` Lukasz Majewski
2019-12-04 19:41   ` Adhemerval Zanella
2019-11-11 21:47 ` [PATCH 4/5] y2038: linux: Provide __timer_gettime64 implementation Lukasz Majewski
2019-11-27 17:00   ` Lukasz Majewski
2019-12-04 19:41   ` Adhemerval Zanella
2019-12-05  9:42     ` Lukasz Majewski
2019-12-11 17:51   ` Andreas Schwab
2019-12-11 22:26     ` Lukasz Majewski
2019-12-12 15:26       ` Andreas Schwab
2019-12-12 15:33         ` Lukasz Majewski
2019-12-12 15:46           ` Andreas Schwab
2019-12-12 16:05             ` Lukasz Majewski
2019-12-12 16:08               ` Andreas Schwab
2019-11-11 21:47 ` [PATCH 5/5] y2038: linux: Provide __timer_settime64 implementation Lukasz Majewski
2019-11-27 17:00   ` Lukasz Majewski
2019-12-04 19:41   ` Adhemerval Zanella
2019-11-18 22:00 ` [PATCH 0/5] y2038: linux: timer_[sg]ettime conversion to 64 bit time Lukasz Majewski
2019-11-25  8:34   ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).