Parent document is top of "comp.sys.hp.hpux FAQ"
Previous document is "9.17 What is the largest disk partition I can have at 9.x?"
Next document is "9.19 How can I turn off the lpspooler cover page?"

9.18 How can I determine how much RAM I have non-interactively?

Here is a short program that returns the RAM size:

#include <sys/pstat.h>
main()
{
   struct pst_static buf;
   pstat(PSTAT_STATIC, &buf, sizeof(buf), 0, 0);
   printf("Physical RAM = %ldMB\n", buf.physical_memory/256);
}

If you are root, you can use adb as follows:

echo "physmem/D" | adb /hp-ux /dev/kmem | tail -1 | \
awk '$2 > 0 { print $2 / 256 }'

Or if /etc/dmesg is still current, you can grep it:

/etc/dmesg | grep "real mem" | tail -1 | awk '$4 > 0 { print $4 / 1048576 }'

(thanks to Richard Lloyd <rkl@csc.liv.ac.uk> and
 Mike Frison <mike_frison@mentorg.com>)

Parent document is top of "comp.sys.hp.hpux FAQ"
Previous document is "9.17 What is the largest disk partition I can have at 9.x?"
Next document is "9.19 How can I turn off the lpspooler cover page?"