Re: How to determine if running on a 32 or 64 bits kernel ?
- From: phil-news-nospam@xxxxxxxx
- Date: 15 Feb 2008 16:09:19 GMT
On Fri, 15 Feb 2008 06:00:44 -0800 (PST) laurent.charmet@xxxxxxxxx wrote:
| I probably not well exposed my need, but I have a small soft who run
| on many machine/os (aix, hpux, irix, linux, bsd/mac, tru64,
| win32, ...). And it display system info (memory, swap, cpu name, cpu
| freq, number of cpu, os name), compilation option, ILP.
|
| example:
|
| E:\FF\Bin>tina_bench -bench info
| -------------- Host name: grossebaf -----------
| Version: 4.2.0 SP0 patch 2998 Build 7 (Feb 15 2008)
| OS name=Windows Server 2003, OS release=Service Pack 2, OS
| version=5.2.3790, Architecture name=Intel
| 2 X Intel(R) Pentium(R) 4 CPU 2.80GHz @ 2793 Mhz
| Mem: 1024 MB, Swap: 1450 MB
| Kernel=32 bits, Software=32 bits, Endian=little-endian, Data
| Model=ILP32
|
| Sorry if it's cut&paste from my wintel office PC lol !
|
|
| And for the last time, uname is NOT the solution:
| uname -m on a Linux on powerpc give me PPC64. It's a 64 bits OS/
| kernel ? NO ! it's a 32 bits because all system binaries are 32 bits
| ELF
If you want the capability of the kernel, uname is the best solution.
If you want the capability of the runtime library the program is
running under, then things like sizeof(void*) tell you because it
is the same as compiled with. Specifically, if the program CAN
RUN AT ALL it has a run time environment compatible with the one
it was compiled with.
If you want to have something understand other possible capabilities
of the system outside the scope of what the program happens to be
running under at that moment (for example to select the best files
to install), that will be a much more complex task because there are
no simple answers to the question.
| It's incredible that it's impossible to determine if os/kernel is 32
| or 64 bits (or 128 !) with a small call.
If you want to determine that of the KERNEL then uname is best. You do
need to keep in mind that the possible answers are NOT AS SIMPLE as
this statement suggests. A function call that does something like
return an integer with a value of 32 or 64 or 128 cannot convey the
real possible scope of possible kernels that it might encounter.
Again, the real answers may not be as simple as the questions imply.
While it could be a lot of work to build a complex multi interface
kernel, it is very easy to set up multiple run time environments on
the same system.
But if the question is what architecture and subarchitecture the kernel
as been built as (since presently there is no multi interface kernel),
then uname tells you that.
--
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
| first name lower case at ipal.net / spamtrap-2008-02-15-1001@xxxxxxxx |
|------------------------------------/-------------------------------------|
.
- References:
- How to determine if running on a 32 or 64 bits kernel ?
- From: laurent . charmet
- Re: How to determine if running on a 32 or 64 bits kernel ?
- From: Chris Friesen
- Re: How to determine if running on a 32 or 64 bits kernel ?
- From: laurent . charmet
- Re: How to determine if running on a 32 or 64 bits kernel ?
- From: phil-news-nospam
- Re: How to determine if running on a 32 or 64 bits kernel ?
- From: Joe Beanfish
- Re: How to determine if running on a 32 or 64 bits kernel ?
- From: laurent . charmet
- How to determine if running on a 32 or 64 bits kernel ?
- Prev by Date: Re: How to determine if running on a 32 or 64 bits kernel ?
- Next by Date: Re: USB device just moves
- Previous by thread: Re: How to determine if running on a 32 or 64 bits kernel ?
- Next by thread: Re: How to determine if running on a 32 or 64 bits kernel ?
- Index(es):
Relevant Pages
|