This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation
- From: Lukasz Majewski <lukma at denx dot de>
- To: Joseph Myers <joseph at codesourcery dot com>, Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: Alistair Francis <alistair23 at gmail dot com>, Alistair Francis <alistair dot francis at wdc dot com>, GNU C Library <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Florian Weimer <fweimer at redhat dot com>, Florian Weimer <fw at deneb dot enyo dot de>, Zack Weinberg <zackw at panix dot com>, Carlos O'Donell <carlos at redhat dot com>, Lukasz Majewski <lukma at denx dot de>
- Date: Mon, 11 Nov 2019 22:47:55 +0100
- Subject: [PATCH 2/5] timer: Decouple x86_64 specific timer_gettime from generic Linux implementation
- References: <20191111214758.3677-1-lukma@denx.de>
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