This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch aaribaud/y2038 updated. glibc-2.24-399-g7454c97
- From: aaribaud at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 19 Jan 2017 23:27:40 -0000
- Subject: GNU C Library master sources branch aaribaud/y2038 updated. glibc-2.24-399-g7454c97
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, aaribaud/y2038 has been updated
via 7454c97bb404a2b9b3173ff147f94bc82e09e7e7 (commit)
via fb6d3288edc288884fead5a3c7dbcbf06fc30dfa (commit)
from ee7ed5c855ca8eb1e47c5bc94844cb314d5529ed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7454c97bb404a2b9b3173ff147f94bc82e09e7e7
commit 7454c97bb404a2b9b3173ff147f94bc82e09e7e7
Author: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Date: Tue Nov 22 14:26:12 2016 +0100
Support 64-bit syscalls from 32-bit GLIBC clock_gettime and vice versa
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index c7c9ef6..1c16264 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -91,12 +91,30 @@ realtime_gettime (struct timespec *tp)
int
__clock_gettime (clockid_t clock_id, struct timespec *tp)
{
+ struct timespec64 tp64;
int retval = -1;
switch (clock_id)
{
#ifdef SYSDEP_GETTIME
- SYSDEP_GETTIME;
+ SYSDEP_GETTIME (clock_id, tp);
+#endif
+#ifdef SYSDEP_GETTIME64
+ if (retval == ENOSYS)
+ {
+ SYSDEP_GETTIME64 (clock_id, &tp64);
+ if (retval >= 0)
+ {
+ if (tp64.tv_sec < 0x80000000)
+ {
+ tp->tv_sec = (__time_t) tp64.tv_sec;
+ tp->tv_nsec = (__syscall_slong_t) tp64.tv_nsec;
+ }
+ }
+ }
+#endif
+#if defined(SYSDEP_GETTIME64) || defined(SYSDEP_GETTIME)
+ break;
#endif
#ifndef HANDLED_REALTIME
@@ -114,6 +132,24 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp)
#ifdef SYSDEP_GETTIME_CPU
SYSDEP_GETTIME_CPU (clock_id, tp);
#endif
+#ifdef SYSDEP_GETTIME64_CPU
+ if (retval == ENOSYS)
+ {
+ SYSDEP_GETTIME64_CPU (clock_id, &tp64);
+ if (retval >= 0)
+ {
+ if (tp64.tv_sec < 0x80000000)
+ {
+ tp->tv_sec = (__time_t) tp64.tv_sec;
+ tp->tv_nsec = (__syscall_slong_t) tp64.tv_nsec;
+ }
+ }
+ }
+#endif
+#if defined(SYSDEP_GETTIME64_CPU) || defined(SYSDEP_GETTIME_CPU)
+ break;
+#endif
+
#if HP_TIMING_AVAIL
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
== CLOCK_THREAD_CPUTIME_ID)
@@ -139,12 +175,28 @@ libc_hidden_def (__clock_gettime)
int
__clock_gettime64 (clockid_t clock_id, struct timespec64 *tp)
{
+ struct timespec tp32;
int retval = -1;
switch (clock_id)
{
#ifdef SYSDEP_GETTIME64
- SYSDEP_GETTIME64;
+ SYSDEP_GETTIME64 (clock_id, tp);
+#endif
+#ifdef SYSDEP_GETTIME
+ if (retval == ENOSYS)
+ {
+ SYSDEP_GETTIME (clock_id, &tp32);
+ if (retval >= 0)
+ {
+ tp->tv_sec = tp32.tv_sec;
+ if (tp->tv_sec < 0) tp->tv_sec += 0x100000000;
+ tp->tv_nsec = tp32.tv_nsec;
+ }
+ }
+#endif
+#if defined(SYSDEP_GETTIME64) || defined(SYSDEP_GETTIME)
+ break;
#endif
#ifndef HANDLED_REALTIME
@@ -162,6 +214,22 @@ __clock_gettime64 (clockid_t clock_id, struct timespec64 *tp)
#ifdef SYSDEP_GETTIME64_CPU
SYSDEP_GETTIME64_CPU (clock_id, tp);
#endif
+#ifdef SYSDEP_GETTIME_CPU
+ if (retval == ENOSYS)
+ {
+ SYSDEP_GETTIME_CPU (clock_id, &tp32);
+ if (retval >= 0)
+ {
+ tp->tv_sec = tp32.tv_sec;
+ if (tp->tv_sec < 0) tp->tv_sec += 0x100000000;
+ tp->tv_nsec = tp32.tv_nsec;
+ }
+ }
+#endif
+#if defined(SYSDEP_GETTIME64_CPU) || defined(SYSDEP_GETTIME_CPU)
+ break;
+#endif
+
#if HP_TIMING_AVAIL
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
== CLOCK_THREAD_CPUTIME_ID)
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 19458ba..d755502 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -28,40 +28,36 @@
/* The REALTIME and MONOTONIC clock are definitely supported in the
kernel. */
-#define SYSDEP_GETTIME \
+#define SYSDEP_GETTIME(clock_id, tp) \
SYSDEP_GETTIME_CPUTIME; \
case CLOCK_REALTIME: \
case CLOCK_MONOTONIC: \
- retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
- break
+ retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp)
/* We handled the REALTIME clock here. */
#define HANDLED_REALTIME 1
#define HANDLED_CPUTIME 1
#define SYSDEP_GETTIME_CPU(clock_id, tp) \
- retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
- break
+ retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp)
#define SYSDEP_GETTIME_CPUTIME /* Default catches them too. */
/* 64-bit versions */
/* The REALTIME and MONOTONIC clock are definitely supported in the
kernel. */
-#define SYSDEP_GETTIME64 \
+#define SYSDEP_GETTIME64(clock_id, tp) \
SYSDEP_GETTIME64_CPUTIME; \
case CLOCK_REALTIME: \
case CLOCK_MONOTONIC: \
- retval = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); \
- break
+ retval = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp)
/* We handled the REALTIME clock here. */
#define HANDLED_REALTIME 1
#define HANDLED_CPUTIME 1
#define SYSDEP_GETTIME64_CPU(clock_id, tp) \
- retval = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); \
- break
+ retval = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp)
#define SYSDEP_GETTIME64_CPUTIME /* Default catches them too. */
#include <sysdeps/unix/clock_gettime.c>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=fb6d3288edc288884fead5a3c7dbcbf06fc30dfa
commit fb6d3288edc288884fead5a3c7dbcbf06fc30dfa
Author: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Date: Sun Nov 13 10:40:51 2016 +0100
Fix wrong ifdef SYSDEP_GETTIME in __clock_gettime64
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index f11f663..c7c9ef6 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -143,7 +143,7 @@ __clock_gettime64 (clockid_t clock_id, struct timespec64 *tp)
switch (clock_id)
{
-#ifdef SYSDEP_GETTIME
+#ifdef SYSDEP_GETTIME64
SYSDEP_GETTIME64;
#endif
-----------------------------------------------------------------------
Summary of changes:
sysdeps/unix/clock_gettime.c | 72 ++++++++++++++++++++++++++++++-
sysdeps/unix/sysv/linux/clock_gettime.c | 16 +++----
2 files changed, 76 insertions(+), 12 deletions(-)
hooks/post-receive
--
GNU C Library master sources