2

The system of my VPS is centos 5. I want to know if it is 32bit or 64bit.

> uname -a
Thu May 13 13:49:53 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

looks like 64 bit.

But

> getconf WORD_BIT
32

Looks like 32 bit.

Which is correct?


UPDATE

I believe the linux of my VPS is 32 bit. Because I downloaded a 64bit mongodb, found it can't start. And when I downloaded a 32bit instead, it works well.

1
  • Why would you expect getconf WORD_BIT to tell you whether you have a 32-bit or a 64-bit OS? That makes no sense. Apr 1, 2016 at 17:29

3 Answers 3

2

Well, it depends. It's possible getconf doesn't return the correct value, and it's possible you have a 32-bit kernel on 64-bit hardware. I'd say, however, that the output of uname is what you should go by, as it states that you're running a 64-bit kernel.

1
  • I don't think it's possible that it's 32-bit kernel on 64-bit hardware if uname -a gives those results...
    – Andy
    Jul 10, 2010 at 9:32
0

uname -a shows whether the OS is 32/64 bit.

6
  • welcome! fyi, getconf WORD_BIT returns 32 on my 64 bit Ubuntu. Also sizeof(int) is 32 bits... maybe that's what the getconf command is reporting.
    – Andy
    Jul 10, 2010 at 9:30
  • I'd think sizeof(void*) would be the indicator
    – David Z
    Jul 10, 2010 at 10:08
  • sizeof(void*) is going to be 8 bytes for 64 bit architectures no? I don't know what getconf WORD_BIT does, and was guessing it may be related to the size of an int because that actually is 32 bits! Edit: (on my current 64 bit OS...)
    – Andy
    Jul 10, 2010 at 10:12
  • Indeed, the size of an int is not the arch size. This nice Wikipedia table shows how int sizes can be anywhere between ¼ word to 4 words on the 80486 family.
    – roguesys
    Jul 10, 2010 at 15:39
  • The question still remains, is getconf WORD_BIT defined as the size of an int, or does it have some other meaning?
    – Andy
    Jul 11, 2010 at 9:58
-1

The glibc's WORD_BIT seems to be broken, because (in xopen_lim.h) it looks at __INT_MAX__ instead of __WORDSIZE or sizeof(__SWORD_TYPE).

To report the syscall personality of the current process, those commands are equivalent:

uname -m
arch

To change it, assuming your kernel supports it:

linux32
linux64

It is possible to have a 64bit kernel with a 32bit userland. To know what kind of kernel you have:

sudo file /proc/kcore

Your CPU:

cat /proc/cpuinfo
2
  • It's broken because it does exactly what the standard requires it to do?! Apr 1, 2016 at 17:30
  • I looked at the standard link in your other comment. The definition (Number of bits in a word or type int) is ambiguous (and so is “exactly as required”), which makes it useless already; going with "size of an int" instead of "size of a word" as the name implies is a dubious choice.
    – Tobu
    Apr 6, 2016 at 21:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .