From f3975fff5c19ae7dfa91f8048de5cef9283c280d Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 4 Nov 2000 21:26:25 +0000 Subject: [PATCH] * sysdeps/mach/hurd/Versions [libc] (GLIBC_2.1.1): Remove __libc_clk_tck. * sysdeps/mach/hurd/Makefile [$(subdir)==posix] (sysdep_routines): Remove clk_tck. * sysdeps/mach/hurd/clk_tck.c: Removed. * sysdeps/mach/hurd/getclktck.c: New file. * sysdeps/mach/hurd/setitimer.c (quantize_timeval): Use __getclktck instead of __libc_clk_tck. * sysdeps/mach/hurd/bits/time.h: Use __sysconf for CLK_TCK instead of __libc_clk_tck. * sysdeps/mach/hurd/i386/bits/time.h: Likewise. 2000-11-04 Mark Kettenis * sysdeps/mach/hurd/Versions [libc] (GLIBC_2.1.1): Remove __libc_clk_tck. * sysdeps/mach/hurd/Makefile [$(subdir)==posix] (sysdep_routines): Remove clk_tck. * sysdeps/mach/hurd/clk_tck.c: Removed. * sysdeps/mach/hurd/getclktck.c: New file. * sysdeps/mach/hurd/setitimer.c (quantize_timeval): Use __getclktck instead of __libc_clk_tck. * sysdeps/mach/hurd/bits/time.h: Use __sysconf for CLK_TCK instead of __libc_clk_tck. * sysdeps/mach/hurd/i386/bits/time.h: Likewise. --- ChangeLog | 14 +++++++++++++ sysdeps/mach/hurd/Makefile | 4 ---- sysdeps/mach/hurd/Versions | 4 ---- sysdeps/mach/hurd/bits/time.h | 8 ++++---- sysdeps/mach/hurd/{clk_tck.c => getclktck.c} | 21 +++++++++++++++++--- sysdeps/mach/hurd/i386/bits/time.h | 8 ++++---- sysdeps/mach/hurd/setitimer.c | 2 +- 7 files changed, 41 insertions(+), 20 deletions(-) rename sysdeps/mach/hurd/{clk_tck.c => getclktck.c} (72%) diff --git a/ChangeLog b/ChangeLog index ace2b6fd46..e517f4e01b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2000-11-04 Mark Kettenis + + * sysdeps/mach/hurd/Versions [libc] (GLIBC_2.1.1): Remove + __libc_clk_tck. + * sysdeps/mach/hurd/Makefile [$(subdir)==posix] (sysdep_routines): + Remove clk_tck. + * sysdeps/mach/hurd/clk_tck.c: Removed. + * sysdeps/mach/hurd/getclktck.c: New file. + * sysdeps/mach/hurd/setitimer.c (quantize_timeval): Use + __getclktck instead of __libc_clk_tck. + * sysdeps/mach/hurd/bits/time.h: Use __sysconf for CLK_TCK instead + of __libc_clk_tck. + * sysdeps/mach/hurd/i386/bits/time.h: Likewise. + 2000-11-03 Ulrich Drepper * posix/Versions: Export __sysconf. diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index d768aec1c5..05bf1d222d 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -183,10 +183,6 @@ ifeq (hurd, $(subdir)) sysdep_routines += cthreads endif -ifeq (posix, $(subdir)) -sysdep_routines += clk_tck -endif - ifeq ($(subdir),sunrpc) sysdep_headers += nfs/nfs.h endif diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions index 4cfbdfd1b7..315f0072f7 100644 --- a/sysdeps/mach/hurd/Versions +++ b/sysdeps/mach/hurd/Versions @@ -3,10 +3,6 @@ libc { # functions with a weak definition in the dynamic linker __getcwd; __mmap; } - GLIBC_2.1.1 { - # functions used in inline functions or macros - __libc_clk_tck; - } } ld { diff --git a/sysdeps/mach/hurd/bits/time.h b/sysdeps/mach/hurd/bits/time.h index 66a949d579..cb9f24bda7 100644 --- a/sysdeps/mach/hurd/bits/time.h +++ b/sysdeps/mach/hurd/bits/time.h @@ -35,10 +35,10 @@ # ifndef __STRICT_ANSI__ /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK - presents the real value for clock ticks per second for the system. - This value is determined at runtime. */ -# define CLK_TCK __libc_clk_tck() -extern int __libc_clk_tck (void) __attribute__ ((__const__)); + presents the real value for clock ticks per second for the system. */ +# include +extern long int __sysconf (int); +# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ # endif # ifdef __USE_POSIX199309 diff --git a/sysdeps/mach/hurd/clk_tck.c b/sysdeps/mach/hurd/getclktck.c similarity index 72% rename from sysdeps/mach/hurd/clk_tck.c rename to sysdeps/mach/hurd/getclktck.c index 9656e37f83..8ebe1bf9c9 100644 --- a/sysdeps/mach/hurd/clk_tck.c +++ b/sysdeps/mach/hurd/getclktck.c @@ -1,5 +1,5 @@ /* Return run-time value of CLK_TCK for Hurd. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,11 +20,17 @@ #include #include #include + #include #include +#ifndef SYSTEM_CLK_TCK +# define SYSTEM_CLK_TCK 100 +#endif + +/* Return frequency of times(). */ int -__libc_clk_tck () +__getclktck () { struct host_sched_info hsi; mach_msg_type_number_t count; @@ -34,7 +40,16 @@ __libc_clk_tck () err = __host_info (__mach_task_self (), HOST_SCHED_INFO, (host_info_t) &hsi, &count); if (err) - return 100; + return SYSTEM_CLK_TCK; return hsi.min_quantum; } + +/* Before glibc 2.2, the Hurd actually did this differently, so we + need to keep a compatibility symbol. */ + +#include + +#if SHLIB_COMPAT (libc, GLIBC_2_1_1, GLIBC_2_2) +compat_symbol (libc, __getclktck, __libc_clk_tck, GLIBC_2_1_1); +#endif diff --git a/sysdeps/mach/hurd/i386/bits/time.h b/sysdeps/mach/hurd/i386/bits/time.h index b7c3c23172..7595ae7a6a 100644 --- a/sysdeps/mach/hurd/i386/bits/time.h +++ b/sysdeps/mach/hurd/i386/bits/time.h @@ -35,10 +35,10 @@ # ifndef __STRICT_ANSI__ /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK - presents the real value for clock ticks per second for the system. - This value is determined at runtime. */ -# define CLK_TCK __libc_clk_tck() -extern int __libc_clk_tck (void) __attribute__ ((__const__)); + presents the real value for clock ticks per second for the system. */ +# include +extern long int __sysconf (int); +# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ # endif # ifdef __USE_POSIX199309 diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c index df7c69f4f9..8a1629f38a 100644 --- a/sysdeps/mach/hurd/setitimer.c +++ b/sysdeps/mach/hurd/setitimer.c @@ -42,7 +42,7 @@ quantize_timeval (struct timeval *tv) static time_t quantum = -1; if (quantum == -1) - quantum = 1000000 / __libc_clk_tck (); + quantum = 1000000 / __getclktck (); tv->tv_usec = ((tv->tv_usec + (quantum - 1)) / quantum) * quantum; if (tv->tv_usec >= 1000000)