Package: boinc-client Version: 5.4.11-4 Severity: minor Tags: patch The attached patch fixes CPU description for ia64, hppa and powerpc.
Successfully tested on the following machines: HP rx2600 (ia64) HP A500 (hppa) HP J6000 (hppa) HP rp3440 (hppa) PowerMac G5 (powerpc) PowerMac G3 (powerpc) CHRP Pegasos II (powerpc) HTH T-Bone -- System Information: Debian Release: 4.0 APT prefers testing APT policy: (500, 'testing') Architecture: powerpc (ppc) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.19-ck2 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
--- boinc-5.4.11.orig/client/hostinfo_unix.C 2006-03-02 08:17:17.000000000 +0100 +++ boinc-5.4.11/client/hostinfo_unix.C 2007-01-14 16:17:36.915386332 +0100 @@ -323,7 +323,133 @@ fclose(f); } -#else // not mips or alpha +#elif __ia64__ + +void parse_cpuinfo(HOST_INFO& host) { + char buf[256]; + int system_found=0,model_found=0; + int n; + host.m_cache = 0; + + FILE* f = fopen("/proc/cpuinfo", "r"); + if (!f) return; + + while (fgets(buf, 256, f)) { + if ( (strstr(buf, "vendor : ") == buf) && + (system_found == 0) ) { + system_found = 1; + strncpy(host.p_vendor, strchr(buf, ':') + 2, sizeof(host.p_vendor) - 1); + char * p = strchr(host.p_vendor, '\n'); + if (p) { + *p = '\0'; + } + } + if ( (strstr(buf, "family : ") == buf) && + (model_found == 0) ) { + model_found = 1; + strncpy(host.p_model, strchr(buf, ':') + 2, sizeof(host.p_model) - 1); + char * p = strchr(host.p_model, '\n'); + if (p) { + *p = '\0'; + } + } + } + + fclose(f); +} + +#elif __hppa__ + +void parse_cpuinfo(HOST_INFO& host) { + char buf[256]; + int system_found=0,model_found=0,icache_found=0,dcache_found=0; + int n; + host.m_cache = 0; + + FILE* f = fopen("/proc/cpuinfo", "r"); + if (!f) return; + + while (fgets(buf, 256, f)) { + if ( (strstr(buf, "cpu\t\t: ") == buf) && + (system_found == 0) ) { + system_found = 1; + strncpy(host.p_vendor, strchr(buf, ':') + 2, sizeof(host.p_vendor) - 1); + char * p = strchr(host.p_vendor, '\n'); + if (p) { + *p = '\0'; + } + } + if ( (strstr(buf, "model name\t: ") == buf) && + (model_found == 0) ) { + model_found = 1; + strncpy(host.p_model, strchr(buf, ':') + 2, sizeof(host.p_model) - 1); + char * p = strchr(host.p_model, '\n'); + if (p) { + *p = '\0'; + } + } + if ( (strstr(buf, "I-cache\t\t: ") == buf) && + (icache_found == 0) ) { + icache_found = 1; + sscanf(buf, "I-cache\t\t: %d", &n); + host.m_cache += n*1024; + } + if ( (strstr(buf, "D-cache\t\t: ") == buf) && + (dcache_found == 0) ) { + dcache_found = 1; + sscanf(buf, "D-cache\t\t: %d", &n); + host.m_cache += n*1024; + } + } + + fclose(f); +} + +#elif __powerpc__ + +void parse_cpuinfo(HOST_INFO& host) { + char buf[256]; + int system_found=0,model_found=0,cache_found=0; + int n; + char* coma=NULL; + host.m_cache=0; + + FILE* f = fopen("/proc/cpuinfo", "r"); + if (!f) return; + + while (fgets(buf, 256, f)) { + if ( (strstr(buf, "machine\t\t: ") == buf) && + (system_found == 0) ) { + system_found = 1; + strncpy(host.p_vendor, strchr(buf, ':') + 2, sizeof(host.p_vendor) - 1); + char * p = strchr(host.p_vendor, '\n'); + if (p) { + *p = '\0'; + } + } + if ( (strstr(buf, "cpu\t\t: ") == buf) && + (model_found == 0) ) { + model_found = 1; + if ((coma = strrchr(buf, ','))) + *coma = '\0'; /* we don't want the ", altivec supported" */ + strncpy(host.p_model, strchr(buf, ':') + 2, sizeof(host.p_model) - 1); + char * p = strchr(host.p_model, '\n'); + if (p) { + *p = '\0'; + } + } + if ( (strstr(buf, "L2-cache\t: ") == buf) && + (cache_found == 0) ) { + cache_found = 1; + sscanf(buf, "L2-cache\t: %d", &n); + host.m_cache = n*1024; + } + } + + fclose(f); +} + +#else // not mips or alpha or ia64 or hppa or powerpc // Unfortunately the format of /proc/cpuinfo is not standardized. // See http://people.nl.linux.org/~hch/cpuinfo/ for some examples.