From 4240b90033cfdb19ed933b496eba80b0b96102c6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 7 Sep 2004 22:31:40 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4165 --- checkin_notes | 6 ++++++ client/hostinfo_unix.C | 44 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/checkin_notes b/checkin_notes index ee35c3ad92..193a8583a2 100755 --- a/checkin_notes +++ b/checkin_notes @@ -17116,3 +17116,9 @@ David 7 Sept 2004 tools/ upgrade + +David 7 Sept 2004 + - recognize CPU type on HP (DEC) alpha (from Duane Krahn) + + client/ + hostinfo_unix.C diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index d1b7d1ed60..3c41fc0a97 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -217,7 +217,49 @@ void parse_cpuinfo(HOST_INFO& host) { fclose(f); } -#else // mips +#elif __alpha__ + +void parse_cpuinfo(HOST_INFO& host) { + char buf[256]; + char buf2[256]; + int system_found=0,model_found=0; + + strcpy(host.p_vendor, "HP (DEC) "); + + FILE* f = fopen("/proc/cpuinfo", "r"); + if (!f) return; + + while (fgets(buf, 256, f)) { + if ((strstr(buf, "cpu\t\t\t: ") == buf) && + (system_found == 0) + ) { + system_found = 1; + strncpy(buf2, strchr(buf, ':') + 2, sizeof(host.p_vendor) - strlen(host.p_vendor) - 1); + + strcat(host.p_vendor, buf2); + char * p = strchr(host.p_vendor, '\n'); + if (p) { + *p = '\0'; + } + } + if ( (strstr(buf, "cpu model\t\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'; + } + } + } + + fclose(f); +} + +#else // not mips or alpha // Unfortunately the format of /proc/cpuinfo is not standardized. // See http://people.nl.linux.org/~hch/cpuinfo/ for some examples.