Re: FW: 64 bit or 32 bit | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Benoit Rouits wrote:
> > > > How can I tell if a given system is running a 32bit krnel or a 64bit
> > > > kernel. I a system capable of running either, but I cannot figure
> > > > out which kernel is installed on it.
> > >
> > > just make a C program like this:
> > >
> > > int main()
> > > {
> > > printf("address bus is %d bytes\n",sizeof(void*));
> > > }
> > > and compile it with cc then run it.
> > > If it prints 8, it is a 64 bit OS, if it prints 4, it is a 32 bit OS.
> >
> > That tells you which architecture the program was compiled for, not
> > which architecture the kernel was compiled for. x86_64 can run both
> > 32- and 64-bit code.
>
> well, if we have a 64-bit kernel /and/ a compiler for 64 bits
> architectures, i think that a long int must be 8 bytes, no ?
If you compile the code into a 64-bit executable, it will either print
"address bus is 8 bytes" or refuse to run.
If you compile the code into a 32-bit executable, it will print
"address bus is 4 bytes" regardless of whether you run it on a 32- or
64-bit system.
--
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Site Home] [Linux Newbie] [Audio] [Hams] [Kernel Newbies] [Memory] [Util Linux NG] [Security] [Netfilter] [Bugtraq] [Writing Drivers] [Photo] [Yosemite Photos] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Samba] [Video 4 Linux] [Git] [Linux Resources] [Fedora Users]
![]() |