File glibc-2.15-clock_gettime.patch of Package glibc.342
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.
2011-11-12 Ulrich Drepper <drepper@gmail.com>
* sysdeps/unix/clock_gettime.c (clock_gettime): No need to assign
result of SYSDEP_GETTIME_CPU to retval.
* sysdeps/unix/sysv/linux/clock_gettime.c (SYSDEP_GETTIME_CPU): Add
parameter list to macro. Remove trailing semicolon. Adjust users.
Index: glibc-2.14.1/sysdeps/unix/clock_gettime.c
===================================================================
--- glibc-2.14.1.orig/sysdeps/unix/clock_gettime.c
+++ glibc-2.14.1/sysdeps/unix/clock_gettime.c
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stdint.h>
@@ -113,7 +112,7 @@ clock_gettime (clockid_t clock_id, struc
default:
#ifdef SYSDEP_GETTIME_CPU
- retval = SYSDEP_GETTIME_CPU (clock_id, tp);
+ SYSDEP_GETTIME_CPU (clock_id, tp);
#endif
#if HP_TIMING_AVAIL
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
Index: glibc-2.14.1/sysdeps/unix/sysv/linux/clock_gettime.c
===================================================================
--- glibc-2.14.1.orig/sysdeps/unix/sysv/linux/clock_gettime.c
+++ glibc-2.14.1/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include <errno.h>
@@ -45,8 +44,8 @@
/* This means the REALTIME and MONOTONIC clock are definitely
supported in the kernel. */
-# define SYSDEP_GETTIME \
- SYSDEP_GETTIME_CPUTIME \
+# define SYSDEP_GETTIME \
+ SYSDEP_GETTIME_CPUTIME; \
case CLOCK_REALTIME: \
case CLOCK_MONOTONIC: \
retval = SYSCALL_GETTIME (clock_id, tp); \
@@ -82,8 +81,8 @@ maybe_syscall_gettime (clockid_t clock_i
/* The REALTIME and MONOTONIC clock might be available. Try the
syscall first. */
-# define SYSDEP_GETTIME \
- SYSDEP_GETTIME_CPUTIME \
+# define SYSDEP_GETTIME \
+ SYSDEP_GETTIME_CPUTIME; \
case CLOCK_REALTIME: \
case CLOCK_MONOTONIC: \
case CLOCK_MONOTONIC_RAW: \
@@ -100,7 +99,7 @@ maybe_syscall_gettime (clockid_t clock_i
__set_errno (retval); \
retval = -1; \
} \
- break;
+ break
#endif
#ifdef __NR_clock_gettime
@@ -110,7 +109,9 @@ maybe_syscall_gettime (clockid_t clock_i
# 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
@@ -164,7 +165,7 @@ maybe_syscall_gettime_cpu (clockid_t clo
return e;
}
-# define SYSDEP_GETTIME_CPU \
+# define SYSDEP_GETTIME_CPU(clock_id, tp) \
retval = maybe_syscall_gettime_cpu (clock_id, tp); \
if (retval == 0) \
break; \
@@ -199,7 +200,7 @@ maybe_syscall_gettime_cputime (clockid_t
break; \
} \
retval = hp_timing_gettime (clock_id, tp); \
- break;
+ break
# if !HP_TIMING_AVAIL
# define hp_timing_gettime(clock_id, tp) (__set_errno (EINVAL), -1)
# endif
Index: glibc-2.14.1/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
===================================================================
--- glibc-2.14.1.orig/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
+++ glibc-2.14.1/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
@@ -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); \