gabriel rosenkoetter on Wed, 6 Nov 2002 10:10:08 -0500 |
On Wed, Nov 06, 2002 at 08:35:34AM -0500, christophe barbe wrote: > To get the total (including free swap) free memory I read /proc/meminfo. > I have no knowledge of BSD but IIRC there is no proc filesystem. Say what? grappa:~% uname -a NetBSD grappa 1.6F NetBSD 1.6F (GRAPPA) #8: Thu Aug 15 00:54:54 EDT 2002 gr@grappa:/mp3/tmp/netbsd/src/sys/arch/i386/compile/GRAPPA i386 grappa:~% ls -ld /proc /kern dr-xr-xr-x 2 root wheel 512 Nov 6 09:33 /kern/ dr-xr-xr-x 1 root wheel 512 Nov 6 09:33 /proc/ Long, long ago, BSD systems didn't have /proc because it was a SysV thing. But since it's been part of both POSIX and SuS standards for quite a while now, any modern BSD system has it. Note that Linux *way* overloads /proc, keeping *far* more than what belongs there there. (The only thing that belongs there is information about processes... things like meminfo, cpuinfo, modules, pci, iomem, et cetera just don't fit logically.) > What would be the BSD way to get the quantity of free memory? The closest you can get to /proc/meminfo on a (Net)BSD system is /kern/physmem, but it's not what you want. You really want to be doing the same thing that top(whatever, probably 1) and vmstat(8) do, though, which is groveling through /dev/[k]mem. Check their sources for the details. Or, if you're lazy, just shell out a call to vmstat(8), I suppose, with the appropriate flags. -- gabriel rosenkoetter gr@eclipsed.net Attachment:
pgpm6Fp02F7b6.pgp
|
|