mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 03:10:05 +00:00
Don't unconditionally use clock_gettime vsyscall on x86-64
This commit is contained in:
parent
d53a73acdb
commit
a77d3c17dc
11
ChangeLog
11
ChangeLog
@ -1,5 +1,16 @@
|
|||||||
2011-09-06 Ulrich Drepper <drepper@gmail.com>
|
2011-09-06 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/x86_64/clock_gettime.c: New file.
|
||||||
|
* sysdeps/unix/sysv/linux/clock_gettime.c (SYSCALL_GETTIME): Allow
|
||||||
|
already be defined. Change to take two parameters and don't assign
|
||||||
|
result to variable. Adjust all users.
|
||||||
|
Define INTERNAL_GETTIME if not already defined.
|
||||||
|
Use INTERNAL_GETTIME instead of INTERNAL_VSYSCALL got clock_gettime
|
||||||
|
call.
|
||||||
|
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Don't define
|
||||||
|
HAVE_CLOCK_GETTIME_VSYSCALL.
|
||||||
|
* sysdeps/unix/clock_gettime.c: Adjust use of SYSDEP_GETTIME_CPU.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Don't use
|
* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Don't use
|
||||||
gettimeofday vsyscall, just use time.
|
gettimeofday vsyscall, just use time.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* clock_gettime -- Get the current time from a POSIX clockid_t. Unix version.
|
/* clock_gettime -- Get the current time from a POSIX clockid_t. Unix version.
|
||||||
Copyright (C) 1999-2004, 2005, 2007 Free Software Foundation, Inc.
|
Copyright (C) 1999-2004, 2005, 2007, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -113,7 +113,7 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef SYSDEP_GETTIME_CPU
|
#ifdef SYSDEP_GETTIME_CPU
|
||||||
SYSDEP_GETTIME_CPU;
|
retval = SYSDEP_GETTIME_CPU (clock_id, tp);
|
||||||
#endif
|
#endif
|
||||||
#if HP_TIMING_AVAIL
|
#if HP_TIMING_AVAIL
|
||||||
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
|
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* clock_gettime -- Get current time from a POSIX clockid_t. Linux version.
|
/* clock_gettime -- Get current time from a POSIX clockid_t. Linux version.
|
||||||
Copyright (C) 2003,2004,2005,2006,2007,2010 Free Software Foundation, Inc.
|
Copyright (C) 2003,2004,2005,2006,2007,2010,2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -32,9 +32,14 @@
|
|||||||
# include <bits/libc-vdso.h>
|
# include <bits/libc-vdso.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SYSCALL_GETTIME \
|
#ifndef SYSCALL_GETTIME
|
||||||
retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
|
# define SYSCALL_GETTIME(id, tp) \
|
||||||
break
|
INLINE_VSYSCALL (clock_gettime, 2, id, tp)
|
||||||
|
#endif
|
||||||
|
#ifndef INTERNAL_GETTIME
|
||||||
|
# define INTERNAL_GETTIME(id, tp) \
|
||||||
|
INTERNAL_VSYSCALL (clock_gettime, err, 2, id, tp)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __ASSUME_POSIX_TIMERS
|
#ifdef __ASSUME_POSIX_TIMERS
|
||||||
|
|
||||||
@ -44,7 +49,8 @@
|
|||||||
SYSDEP_GETTIME_CPUTIME \
|
SYSDEP_GETTIME_CPUTIME \
|
||||||
case CLOCK_REALTIME: \
|
case CLOCK_REALTIME: \
|
||||||
case CLOCK_MONOTONIC: \
|
case CLOCK_MONOTONIC: \
|
||||||
SYSCALL_GETTIME
|
retval = SYSCALL_GETTIME (clock_id, tp); \
|
||||||
|
break
|
||||||
|
|
||||||
# define __libc_missing_posix_timers 0
|
# define __libc_missing_posix_timers 0
|
||||||
#elif defined __NR_clock_gettime
|
#elif defined __NR_clock_gettime
|
||||||
@ -59,7 +65,7 @@ maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp)
|
|||||||
if (!__libc_missing_posix_timers)
|
if (!__libc_missing_posix_timers)
|
||||||
{
|
{
|
||||||
INTERNAL_SYSCALL_DECL (err);
|
INTERNAL_SYSCALL_DECL (err);
|
||||||
int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
|
int r = INTERNAL_GETTIME (clock_id, tp);
|
||||||
if (!INTERNAL_SYSCALL_ERROR_P (r, err))
|
if (!INTERNAL_SYSCALL_ERROR_P (r, err))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -119,7 +125,7 @@ maybe_syscall_gettime_cpu (clockid_t clock_id, struct timespec *tp)
|
|||||||
if (!__libc_missing_posix_cpu_timers)
|
if (!__libc_missing_posix_cpu_timers)
|
||||||
{
|
{
|
||||||
INTERNAL_SYSCALL_DECL (err);
|
INTERNAL_SYSCALL_DECL (err);
|
||||||
int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
|
int r = INTERNAL_GETTIME (clock_id, tp);
|
||||||
if (!INTERNAL_SYSCALL_ERROR_P (r, err))
|
if (!INTERNAL_SYSCALL_ERROR_P (r, err))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
10
sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
Normal file
10
sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "bits/libc-vdso.h"
|
||||||
|
|
||||||
|
#ifdef SHARED
|
||||||
|
# define SYSCALL_GETTIME(id, tp) \
|
||||||
|
(*__vdso_clock_gettime) (id, tp)
|
||||||
|
# define INTERNAL_GETTIME(id, tp) \
|
||||||
|
(*__vdso_clock_gettime) (id, tp)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../clock_gettime.c"
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2001-2005, 2007 Free Software Foundation, Inc.
|
/* Copyright (C) 2001-2005, 2007, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -304,9 +304,6 @@
|
|||||||
v_ret; \
|
v_ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
/* List of system calls which are supported as vsyscalls. */
|
|
||||||
# define HAVE_CLOCK_GETTIME_VSYSCALL 1
|
|
||||||
|
|
||||||
# else
|
# else
|
||||||
# define INLINE_VSYSCALL(name, nr, args...) \
|
# define INLINE_VSYSCALL(name, nr, args...) \
|
||||||
INLINE_SYSCALL (name, nr, ##args)
|
INLINE_SYSCALL (name, nr, ##args)
|
||||||
|
Loading…
Reference in New Issue
Block a user