]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix clock_gettime for assumed kernel >= 2.6.12
authorAndreas Schwab <schwab@redhat.com>
Tue, 15 Nov 2011 14:04:26 +0000 (15:04 +0100)
committerAndreas Schwab <schwab@redhat.com>
Tue, 15 Nov 2011 14:17:15 +0000 (15:17 +0100)
ChangeLog
sysdeps/unix/sysv/linux/clock_gettime.c
sysdeps/unix/sysv/linux/x86_64/clock_gettime.c

index 8bb25138ca3a6341a7b298e57de4203e624c70db..84cd7004a3b488b4c62c7ef81e95d9e442d09e98 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-15  Andreas Schwab  <schwab@redhat.com>
 
+       * sysdeps/unix/sysv/linux/clock_gettime.c (SYSDEP_GETTIME_CPU)
+       [__ASSUME_POSIX_CPU_TIMERS > 0]: Assign to retval and break.
+       * sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
+       (SYSCALL_GETTIME): Set errno on error.
+
        * sysdeps/unix/sysv/linux/check_pf.c (make_request): Properly
        count references to noai6ai_cached.
 
index e5e032d98bd0a974b63e9e3021ff79f4a516a4dd..ad0fe1e8b59cb0c2fc99b42c8598f8bd0c4ba855 100644 (file)
@@ -110,7 +110,9 @@ maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp)
 
 # if __ASSUME_POSIX_CPU_TIMERS > 0
 
-#  define SYSDEP_GETTIME_CPU SYSCALL_GETTIME
+#  define SYSDEP_GETTIME_CPU(clock_id, tp) \
+  retval = SYSCALL_GETTIME (clock_id, tp); \
+  break
 #  define SYSDEP_GETTIME_CPUTIME       /* Default catches them too.  */
 
 # else
index 7802701e228569d8f2066608daf615d97093da78..f7121106bc2803cb2f0cc8101f90f31e93fa6dce 100644 (file)
@@ -3,8 +3,14 @@
 #ifdef SHARED
 # define SYSCALL_GETTIME(id, tp) \
   ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \
+  long int v_ret;                                                        \
   PTR_DEMANGLE (f);                                                      \
-  f (id, tp); })
+  v_ret = f (id, tp);                                                    \
+  if (INTERNAL_SYSCALL_ERROR_P (v_ret, )) {                              \
+    __set_errno (INTERNAL_SYSCALL_ERRNO (v_ret, ));                      \
+    v_ret = -1;                                                                  \
+  }                                                                      \
+  v_ret; })
 # define INTERNAL_GETTIME(id, tp) \
   ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \
   PTR_DEMANGLE (f);                                                      \