[Glibc-bsd-commits] r4489 - trunk/glibc-ports/linuxthreads/sysdeps/unix/sysv/linux

Petr Salinger ps-guest at alioth.debian.org
Thu May 30 13:50:53 UTC 2013


Author: ps-guest
Date: 2013-05-30 13:50:52 +0000 (Thu, 30 May 2013)
New Revision: 4489

Modified:
   trunk/glibc-ports/linuxthreads/sysdeps/unix/sysv/linux/smp.h
Log:
sysctl is no longer supported by linux (part of any/local-sysctl.diff)


Modified: trunk/glibc-ports/linuxthreads/sysdeps/unix/sysv/linux/smp.h
===================================================================
--- trunk/glibc-ports/linuxthreads/sysdeps/unix/sysv/linux/smp.h	2013-05-30 11:46:26 UTC (rev 4488)
+++ trunk/glibc-ports/linuxthreads/sysdeps/unix/sysv/linux/smp.h	2013-05-30 13:50:52 UTC (rev 4489)
@@ -19,30 +19,10 @@
 
 #include <sys/sysctl.h>
 
-/* Test whether the machine has more than one processor.  This is not the
-   best test but good enough.  More complicated tests would require `malloc'
-   which is not available at that time.  */
+/* Test whether the machine has more than one processor. */
 static inline int
 is_smp_system (void)
 {
-  static const int sysctl_args[] = { CTL_KERN, KERN_VERSION };
-  char buf[512];
-  size_t reslen = sizeof (buf);
-
-  /* Try reading the number using `sysctl' first.  */
-  if (__sysctl ((int *) sysctl_args,
-		sizeof (sysctl_args) / sizeof (sysctl_args[0]),
-		buf, &reslen, NULL, 0) < 0)
-    {
-      /* This was not successful.  Now try reading the /proc filesystem.  */
-      int fd = __open ("/proc/sys/kernel/version", O_RDONLY);
-      if (__builtin_expect (fd, 0) == -1
-	  || (reslen = __read (fd, buf, sizeof (buf))) <= 0)
-	/* This also didn't work.  We give up and say it's a UP machine.  */
-	buf[0] = '\0';
-
-      __close (fd);
-    }
-
-  return strstr (buf, "SMP") != NULL;
+  /* Assume all machines are SMP and/or CMT and/or SMT.  */
+  return 1;
 }




More information about the Glibc-bsd-commits mailing list