From 348d706236d2bf7e09bc8214b657faef0b0a30c5 Mon Sep 17 00:00:00 2001 From: Stew Benedict Date: Sat, 3 Mar 2001 00:16:02 +0000 Subject: *** empty log message *** --- perl-install/c/smp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'perl-install/c/smp.c') diff --git a/perl-install/c/smp.c b/perl-install/c/smp.c index 08b2b0a7c..e54cac62f 100644 --- a/perl-install/c/smp.c +++ b/perl-install/c/smp.c @@ -64,6 +64,35 @@ int sparcDetectSMP(void) } #endif /* __sparc__ */ +/* I'm sure this is not right - but don't know what to look for at +this point - before adding this a machine that was definitely NOT +SMP was identified as such Feb 12, 2001 sbenedict */ + +#ifdef __powerpc__ +int ppcDetectSMP(void) +{ + int issmp = 0; + FILE *f; + + f = fopen("/proc/cpuinfo", "r"); + if (f) { + char buff[1024]; + + while (fgets (buff, 1024, f) != NULL) { + if (!strncmp (buff, "ncpus active\t: ", 15)) { + if (strtoul (buff + 15, NULL, 0) > 1) + issmp = 1; + break; + } + } + fclose(f); + } else + return -1; + + return issmp; +} +#endif /* __powerpc__ */ + #ifdef __i386__ #define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_') @@ -337,6 +366,8 @@ int detectSMP(void) return isSMP = sparcDetectSMP(); #elif __alpha__ return isSMP = alphaDetectSMP(); +#elif __powerpc__ + return isSMP = ppcDetectSMP(); #endif } -- cgit v1.2.1