From 050796374b29c330ec800798a08336e8066bdd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Tue, 5 Nov 2002 15:52:22 +0000 Subject: Add generic cpu detection on x86-64 and IA-64, based on sysconf(_SC_NPROCESSORS_ONLN) --- perl-install/c/smp.c | 20 ++++++++++++++------ 1 file 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 -- cgit v1.2.1