/proc/kcore size incorrect ?

From: J.A. Magallon
Date: Sun Oct 23 2005 - 16:55:44 EST


Hi all...

Probably this is a stupid question, but anyways...

I'm trying to make a script to generate an /etc/motd, and I wanted to
include memory size of the box.

I tried:

echo $(($(stat -c %s /proc/kcore) / 1024 / 1024)) "Mb"

but it gives 1022 for a 1Gb box.

In fact:

werewolf:~# ll /proc/kcore
-r-------- 1 root root 1072566272 2005.10.23 23:53 /proc/kcore
werewolf:~# stat -c %s /proc/kcore
1072566272

werewolf:~# echo $((1024*1024*1024))
1073741824

Why that difference ?

TIA

BTW, any simple method to get the real mem of the box ?

--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandriva Linux release 2006.1 (Cooker) for i586
Linux 2.6.13-jam9 (gcc 4.0.1 (4.0.1-5mdk for Mandriva Linux release 2006.0))

Attachment: signature.asc
Description: PGP signature