aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2000-11-04 21:26:25 +0000
committerMark Kettenis <kettenis@gnu.org>2000-11-04 21:26:25 +0000
commitf3975fff5c19ae7dfa91f8048de5cef9283c280d (patch)
tree321f86c3380d99742cfaa33eb36c7d0363aa41fd /sysdeps/mach
parentd2830ba4cc7e3da48bb8272acf5d440506aee37a (diff)
downloadglibc-f3975fff5c19ae7dfa91f8048de5cef9283c280d.zip
glibc-f3975fff5c19ae7dfa91f8048de5cef9283c280d.tar.gz
glibc-f3975fff5c19ae7dfa91f8048de5cef9283c280d.tar.bz2
* 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 <kettenis@gnu.org> * 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.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/Makefile4
-rw-r--r--sysdeps/mach/hurd/Versions4
-rw-r--r--sysdeps/mach/hurd/bits/time.h8
-rw-r--r--sysdeps/mach/hurd/getclktck.c (renamed from sysdeps/mach/hurd/clk_tck.c)21
-rw-r--r--sysdeps/mach/hurd/i386/bits/time.h8
-rw-r--r--sysdeps/mach/hurd/setitimer.c2
6 files changed, 27 insertions, 20 deletions
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index d768aec..05bf1d2 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 4cfbdfd..315f007 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 66a949d..cb9f24b 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 <bits/types.h>
+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
index 9656e37..8ebe1bf 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 <errno.h>
#include <time.h>
#include <unistd.h>
+
#include <mach.h>
#include <mach/host_info.h>
+#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 <shlib-compat.h>
+
+#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 b7c3c23..7595ae7 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 <bits/types.h>
+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 df7c69f..8a1629f 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)