[14812] in Athena Bugs
sgi 8.0H: machtype
daemon@ATHENA.MIT.EDU (Albert Dvornik)
Thu Nov 7 21:56:26 1996
To: bugs@MIT.EDU
Date: Thu, 07 Nov 1996 21:56:21 EST
From: "Albert Dvornik" <bert@MIT.EDU>
System name: steve-dallas
Type and version: IP22 8.0H
Display type: NG1
What were you trying to do?
Check the CPU type on a SGI machine with a little "R5000" wing
thing.
What's incorrect:
% machtype -c -v
SGI IP22
FPU:MIPS R4610
CPU: MIPS R4600
What's ***WRONG***:
I found the following code in machtype_sgi.c:
if (i->inv_type == INV_CPUBOARD ) {
switch (i->inv_state) {
...switch cases deleted...
}
} else if (verbose) {
if (i->inv_type == INV_CPUCHIP) {
fprintf(stdout,"CPU: MIPS R4600\n");
} else {
fprintf(stdout,"FPU:MIPS R4610\n");
}
There are two fundamental errors here, apart from the horrible
formatting:
(1) it hardcodes information which ain't constant across machines.
(2) anything that isn't a board or the CPU is an FPU? huh???
[There is at least one other type for class
INV_PROCESSOR listed in sys/invent.h, so you ought to
be checking for INV_FPUCHIP.]
What should have happened:
I/S should have gotten a bigger budget so they can raise
salaries so this type of thing doesn't have to happen. =)
Please describe any relevant documentation references:
Here is a direct steal^H^H^H^H^Hquote from sysinfo sources,
available in /mit/outland/src/sysinfo-3.1.3/os-irix.c:
@subtle[HINT, HINT...]
static char build[BUFSIZ];
char *pos = build;
int Len = 0;
....
if (sysinfo(SI_ARCHITECTURE, pos, sizeof(build)) >= 0) {
Len = strlen(build);
pos += Len;
*(pos++) = ' ';
}
if (sysinfo(_MIPS_SI_PROCESSORS, pos, sizeof(build) - Len + 2) >= 0)
if ( ( pos = strchr(build,',')) != NULL)
*pos = CNULL;