[PATCH] Return -1 for i386 sysconf (_SC_CPUTIME) if !HP_TIMING_AVAIL
Jakub Jelinek
jakub@redhat.com
Tue Oct 5 08:10:00 GMT 2004
Hi!
Even if you run say i486 or i586 glibc on i686, HP_TIMING_AVAIL
is not defined and therefore sysconf (_SC_{,THREAD_}CPUTIME) should
IMHO return -1 in that case.
For i686 compiled glibc, it has no sense to test for i386 or i486 CPU.
2004-10-05 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/sysconf.c: Include hp-timing.h.
(__sysconf): Return -1 for _SC_CPUTIME or _SC_THREAD_CPUTIME if
!HP_TIMING_AVAIL.
--- libc/sysdeps/unix/sysv/linux/i386/sysconf.c.jj 2004-10-05 09:05:00.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/i386/sysconf.c 2004-10-05 09:37:08.686520442 +0200
@@ -21,7 +21,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
-
+#include <hp-timing.h>
static long int linux_sysconf (int name);
@@ -347,13 +347,13 @@ __sysconf (int name)
{
if (name == _SC_CPUTIME || name == _SC_THREAD_CPUTIME)
{
- /* Check dynamically. */
- int ac = i386_i486_test ();
-
- /* Only i386 and i486 have no TSC. */
+#if HP_TIMING_AVAIL
// XXX We can add here test for machines which cannot support a
- // XXX usabel TSC.
- return ac == 0 || (ac & (1 << 21)) == 0 ? -1 : 200112L;
+ // XXX usable TSC.
+ return 200112L;
+#else
+ return -1;
+#endif
}
/* All the remainder, except the cache information, is handled in
Jakub
More information about the Libc-hacker
mailing list