summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/c/smp.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/perl-install/c/smp.c b/perl-install/c/smp.c
index baf786cc6..3255ce9c4 100644
--- a/perl-install/c/smp.c
+++ b/perl-install/c/smp.c
@@ -473,6 +473,17 @@ readEntry( void* entry, int size )
#endif /* __i386__ */
+static int sysconfDetectSMP(void)
+{
+ long nprocs;
+
+ /* Error: assume we are *not* SMP. */
+ if ((nprocs = sysconf(_SC_NPROCESSORS_ONLN)) < 0)
+ nprocs = 1;
+
+ return nprocs > 1;
+}
+
int detectSMP(void)
{
static int isSMP = -1;
@@ -488,12 +499,9 @@ int detectSMP(void)
return isSMP = alphaDetectSMP();
#elif __powerpc__
return isSMP = ppcDetectSMP();
-#elif __ia64__
- /* TODO: Update to check against /proc/pal/cpuX */
- return isSMP = 1;
-#elif __x86_64__
- /* TODO: Update when SMP machines are there */
- return isSMP = 0;
+#elif defined(__ia64__) || defined(__x86_64__)
+ /* TODO: IA-64, maybe check against /proc/pal/cpuX ? */
+ return isSMP = sysconfDetectSMP();
#else
#error unknown architecture
#endif