about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/i386/sysconf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-04 19:28:07 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-04 19:28:07 +0000
commit94d824f920209243c72eb4a6fedbb5a039be2af3 (patch)
treebbd2b74f817b833d5b7e4c776927329bec5d353e /sysdeps/unix/sysv/linux/i386/sysconf.c
parent3078cba2f7272dab753c45b733af2e693e86d83c (diff)
downloadglibc-94d824f920209243c72eb4a6fedbb5a039be2af3.tar.gz
glibc-94d824f920209243c72eb4a6fedbb5a039be2af3.tar.xz
glibc-94d824f920209243c72eb4a6fedbb5a039be2af3.zip
Update.
	* sysdeps/unix/sysv/linux/ia64/sysconf.c: New file.
	* sysdeps/unix/sysv/linux/ia64/Dist: Add has_cpuclock.c.
	* sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c: Move actual
	testing code to...
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c: ...here.  New file.
	* sysdeps/unix/sysv/linux/i386/sysconf.c: Add dynamic check for
	_SC_CPUTIME and _SC_THREAD_CPUTIME.
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/sysconf.c')
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysconf.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/sysconf.c b/sysdeps/unix/sysv/linux/i386/sysconf.c
index cb4706de73..8a9ab61912 100644
--- a/sysdeps/unix/sysv/linux/i386/sysconf.c
+++ b/sysdeps/unix/sysv/linux/i386/sysconf.c
@@ -319,16 +319,9 @@ handle_amd (int name)
 }
 
 
-/* Get the value of the system variable NAME.  */
-long int
-__sysconf (int name)
+static int
+i386_i486_test (void)
 {
-  /* We only handle the cache information here (for now).  */
-  if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE)
-    return linux_sysconf (name);
-
-  /* Recognize i386 and compatible.  These don't have any cache on
-     board.  */
   int eflags;
   int ac;
   asm volatile ("pushfl;\n\t"
@@ -343,6 +336,35 @@ __sysconf (int name)
 		"pushl %0;\n\t"
 		"popfl"
 		: "=r" (eflags), "=r" (ac));
+
+  return ac;
+}
+
+
+/* Get the value of the system variable NAME.  */
+long int
+__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.  */
+      // XXX We can add  here test for machines which cannot support a
+      // XXX usabel TSC.
+      return ac == 0 || (ac & (1 << 21)) == 0 ? -1 : 200112L;
+    }
+
+  /* All the remainder, except the cache information, is handled in
+     the generic code.  */
+  if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE)
+    return linux_sysconf (name);
+
+  /* Recognize i386 and compatible.  These don't have any cache on
+     board.  */
+  int ac = i386_i486_test ();
+
   if (ac == 0)
     /* This is an i386.  */
     // XXX Is this true for all brands?