[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

uname -p

From: Todd Ostermeier
Subject: uname -p
Date: Fri, 13 Oct 2000 02:19:18 -0700

Though I've noticed it before, I finally decided to "fix" uname to display my 
processor type when doing uname -p or uname -a.  Currently, uname -p simply 
returns "unknown" for all processor types under Linux (tested on kernel 
2.2.16), since the header file sys/systeminfo.h does not exist.

I've attached a patch that gets around this problem.  On my x86 machine, I get 
the following output:

  address@hidden:~ > src/uname -p
  Pentium MMX

and the same code built on my ppc machine returns

  address@hidden:~$ ./uname -p

The patch essentially pulls either the "model name" or "cpu\t\t:" from Linux's 
/proc/cpuinfo.  The reason for needing both of those is that my ppc machine 
(running kernel 2.2.16) does not have a "model name" field in /proc/cpuinfo, so 
I pulled the next best field instead.  If neither field exists, it just returns 
the old "unknown".

I've only tested this on x86 and ppc machines, so I'm not sure how it works on 
Sparcs, MIPS, Alpha, and others.  Assuming that /proc/cpuinfo contains one of 
the two fields the patch looks for on those machines, then it'll work.



Todd Ostermeier                           
address@hidden - school
address@hidden - personal

"I used to get high on life but lately I've built up a resistance."

Attachment: uname.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]