Re: How to determine if running on a 32 or 64 bits kernel ?



phil-news-nospam@xxxxxxxx wrote:
On Thu, 14 Feb 2008 07:39:27 -0800 (PST) laurent.charmet@xxxxxxxxx wrote:
| On Feb 14, 3:45 pm, Chris Friesen <cbf...@xxxxxxxxxxxxx> wrote:
|> laurent.char...@xxxxxxxxx wrote:
|> > I'm looking for an API or whatever to determine if kernel/os is 32 or
|> > 64 bits. It must be dynamic, because my binary can be compiled on a
|> > machine and run on another.
|>
|> If you run a 32-bit app on a 64-bit system, it was still compiled as a
|> 32-bit app.
|>
|> Why do you want to know the word size of the kernel?
|>
|> Chris
| | Because I want to check if installed/running binaries are well fited.
| It's perfectly legal to run 32 bits on a 64 bits os, but in some case
| my program load external dll or external program load some of my libs.
| And mixed 32/64 bits dll is a source of errors. So I prefer warm user
| that installed version is not the right. On same spirit, it's not good
| to run X86 binaries on itatium because emulation has a big cost.

So you would want to know also if your program is running inside some kind
of virtualization or emulation? You could be running on an emulated 32-bit
sparc system inside qemu running on a 32-bit kernel running in a domU of a
Xen system running with a 64-bit dom0 kernel on an AMD CPU. Have fun.


It doesn't matter what underlying hosts etc there are. The point is to
know the architecture of the top level os being installed onto.

I know much of the Linux community things everything should be
recompiled on every system it runs on, but suppose for a moment that
someone wants to distribute a program in binary form. A good install
program for that package would want to check the system architecture
and install the binary (x86, x86_64, ia64, etc...) best suited to
the environment where it will run.
.



Relevant Pages

  • Re: restored partition with systemrescue, cant boot
    ... But I am not going to boot a grub to check! ... VMWARE emulation? ... You prove that every time you get A KERNEL MESSAGE saying that the kernel ...
    (comp.os.linux.misc)
  • Re: Unbloating the kernel, action list
    ... > Can you quantify the performance impact of cmov emulation (or whatever ... kernel. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: [PATCH 1/7] KVM: userspace interface
    ... My initial impression is that you've taken the Xen approach of trying to use QEMU only for IO emulation. ... While you can use vm86 mode for 16 bit virtualization for most cases, it cannot handle big real mode. ... This would let you have a much reduced partial emulator in kernel space that only did the most common instructions. ...
    (Linux-Kernel)
  • Re: Re[2]: vkernel & GSoC, some questions
    ... kernel process itself) on a page-by-page basis, ... real kernel caches page mappings with real hardware pmaps. ... virtual kernel process by the real kernel. ... Insofar as virtual kernels verses machine emulation and performance goes, ...
    (freebsd-hackers)
  • Re: Intel Itaniums very survival in doubt - inquirer article
    ... > Yes, I work for HP, but it is a bit of a stretch to say that the bind ... Customers may well know what their kernel/user split ... > It would say how fast emulation is for applications that spend no time ... > in the kernel. ...
    (comp.os.vms)