sysinfo vs sysconf

Stephen Weeks MLton@sourcelight.com
Wed, 20 Feb 2002 14:21:08 -0800


I am about to implement the code to handle the case where the amount
of RAM or swap is greater than 4G.

Henry, at some point you suggested using
	sysconf(_SC_PHYS_PAGES)
to obtain the amount of RAM, because it is in page size and hence
won't overflow.  Is there a similar _SC for swap?

I see that sysinfo sets sbuf.mem_unit, which is a multiplier for all
of the other fields.  I assume this is how it handles the overflow
problem.  How about I just use sysinfo and do the multiplication by
mem_unit in 64 bit words?