From d53a73acdbf6ac6eb99cd06f5dd695da58d9e8f5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 6 Sep 2011 20:22:37 -0400 Subject: Avoid gettimeofday vsyscall --- sysdeps/unix/sysv/linux/getsysstats.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c index b9bae3df98..7feb7a1802 100644 --- a/sysdeps/unix/sysv/linux/getsysstats.c +++ b/sysdeps/unix/sysv/linux/getsysstats.c @@ -37,15 +37,6 @@ #include #include -#ifndef HAVE_CLOCK_GETTIME_VSYSCALL -# undef INTERNAL_VSYSCALL -# define INTERNAL_VSYSCALL INTERNAL_SYSCALL -# undef INLINE_VSYSCALL -# define INLINE_VSYSCALL INLINE_SYSCALL -#else -# include -#endif - /* How we can determine the number of available processors depends on the configuration. There is currently (as of version 2.0.21) no @@ -141,17 +132,10 @@ __get_nprocs () static int cached_result; static time_t timestamp; -#ifdef __ASSUME_POSIX_TIMERS - struct timespec ts; - INTERNAL_SYSCALL_DECL (err); - INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts); -#else - struct timeval ts; - __gettimeofday (&ts, NULL); -#endif + time_t now = time (NULL); time_t prev = timestamp; atomic_read_barrier (); - if (ts.tv_sec == prev) + if (now == prev) return cached_result; /* XXX Here will come a test for the new system call. */ @@ -243,7 +227,7 @@ __get_nprocs () out: cached_result = result; atomic_write_barrier (); - timestamp = ts.tv_sec; + timestamp = now; return result; } -- cgit 1.4.1