Can the 'uname -p' (or 'uname -i') command be used to detect the CPU
architecture of a machine reliably? It seems to give different
outputs on SunOS and Linux kernels.
On an x86 Solaris installation:
uname -p gives : i386
uname -i gives : i86pc
On a Solaris Sparc version:
uname -p gives : sparc
uname -i gives : SUNW,Sun-Fire-V240
On a Linux installation on an AMD:
uname -p gives : athlon (this is the processor name, not architecture,
right?)
uname -i gives : i386 (this is the architecture?)
Is it correct to say that, on SunOS 'uname -p' gives the architecture
and on Linux the architecture is given by 'uname -i' ?
What is the reliable way to determine the cpu architecture across
different CPU/OS platforms?
Thanks,
Ishan.
PS:
SunOS man file does not recommend the use of 'uname -m'
On EG. FreeBSD, -i returns ``the kernel identity'' which is a string
supplied by whoever named the custom kernel (``GENERIC'' for the default).
> Is it correct to say that, on SunOS 'uname -p' gives the architecture
> and on Linux the architecture is given by 'uname -i' ?
This kind of thing is best looked up in the reference manual. Compare
what the linux manpage says for those two options with what the solaris
manpage says.
> What is the reliable way to determine the cpu architecture across
> different CPU/OS platforms?
Figure out what OS you're on, then adapt the hardware interrogation to
that. The closer you get to the hardware, the more unices diverge. For
extra fun, google ``rosetta stone unix''.
--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
This message was originally posted on Usenet in plain text.
Any other representation, additions, or changes do not have my
consent and may be a violation of international copyright law.
Either man pages sais this is "platform".
>
> Is it correct to say that, on SunOS 'uname -p' gives the architecture
> and on Linux the architecture is given by 'uname -i' ?
>
> What is the reliable way to determine the cpu architecture across
> different CPU/OS platforms?
uname -p
should be closest to the CPU model if implemented.
The following shell command should run on any OS,
and can be used to branch to CPU-optimized binaries:
uname -p 2>/dev/null || uname -m 2>/dev/null || uname
while
uname -m 2>/dev/null || uname
can branch to non-optimized code.
>
> Thanks,
> Ishan.
>
> PS:
> SunOS man file does not recommend the use of 'uname -m'
but is indeed better portable than "arch".
--
Michael Tosch @ hp : com