From f3975fff5c19ae7dfa91f8048de5cef9283c280d Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 4 Nov 2000 21:26:25 +0000 Subject: * 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. --- sysdeps/mach/hurd/Makefile | 4 --- sysdeps/mach/hurd/Versions | 4 --- sysdeps/mach/hurd/bits/time.h | 8 +++--- sysdeps/mach/hurd/clk_tck.c | 40 --------------------------- sysdeps/mach/hurd/getclktck.c | 55 ++++++++++++++++++++++++++++++++++++++ sysdeps/mach/hurd/i386/bits/time.h | 8 +++--- sysdeps/mach/hurd/setitimer.c | 2 +- 7 files changed, 64 insertions(+), 57 deletions(-) delete mode 100644 sysdeps/mach/hurd/clk_tck.c create mode 100644 sysdeps/mach/hurd/getclktck.c (limited to 'sysdeps/mach') 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/clk_tck.c deleted file mode 100644 index 9656e37f83..0000000000 --- a/sysdeps/mach/hurd/clk_tck.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Return run-time value of CLK_TCK for Hurd. - Copyright (C) 1999 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include -#include - -int -__libc_clk_tck () -{ - struct host_sched_info hsi; - mach_msg_type_number_t count; - error_t err; - - count = HOST_SCHED_INFO_COUNT; - err = __host_info (__mach_task_self (), HOST_SCHED_INFO, - (host_info_t) &hsi, &count); - if (err) - return 100; - - return hsi.min_quantum; -} diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c new file mode 100644 index 0000000000..8ebe1bf9c9 --- /dev/null +++ b/sysdeps/mach/hurd/getclktck.c @@ -0,0 +1,55 @@ +/* Return run-time value of CLK_TCK for Hurd. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include +#include + +#ifndef SYSTEM_CLK_TCK +# define SYSTEM_CLK_TCK 100 +#endif + +/* Return frequency of times(). */ +int +__getclktck () +{ + struct host_sched_info hsi; + mach_msg_type_number_t count; + error_t err; + + count = HOST_SCHED_INFO_COUNT; + err = __host_info (__mach_task_self (), HOST_SCHED_INFO, + (host_info_t) &hsi, &count); + if (err) + 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) -- cgit v1.2.3