Re: Q: How to get physical memory size from user space without proc

Alexander Viro (viro@math.psu.edu)
Sat, 3 Mar 2001 14:17:48 -0500 (EST)


On 3 Mar 2001, Michael Rothwell wrote:

> pyhsmem = `free | grep Mem | tr -s "/ / /" | cut -f2 -d" "`

% strace free 2>&1 |grep /proc
open("/proc/cpuinfo", O_RDONLY) = 3
open("/proc/uptime", O_RDONLY) = 3
open("/proc/stat", O_RDONLY) = 4
open("/proc/meminfo", O_RDONLY) = 5

I.e. it still uses procfs. Which is perfectly fine, just encapsulate
it in initscripts so that information would be obtained when system
is booted. Should work for people who don't want procfs around after
that.
Cheers,
Al

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/