public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Return -1 for i386 sysconf (_SC_CPUTIME) if !HP_TIMING_AVAIL
@ 2004-10-05  8:10 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2004-10-05  8:10 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-05  8:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-05  8:10 [PATCH] Return -1 for i386 sysconf (_SC_CPUTIME) if !HP_TIMING_AVAIL Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).