Getting swap info without kvm access
gomalley at mthoodcards.com
gomalley at mthoodcards.com
Fri Jul 2 19:19:32 PDT 2004
I've written an Afterstep applet that retrieves and displays different
time and system information. The Linux port uses a few functions like
gmtime() and gethostname() and reads most of the info from /proc
files. The FreeBSD port used the function calls and gets most of the
info from sysctl() calls, except for the swap space. As written now,
that info is retrieved with kvm_getswapinfo(). The problem is that
that function requires access to /dev/mem which isn't available
without sgid privileges. The current work-around is to display 0 for
swap space if the applet is running un-privileged.
I've searched and browsed the mailing lists, I've poured over the
.h's, .c's, sysctl -a and man pages for weeks but I'm stumped. Is
there some way to get total and either free or used swap space without
using /dev/mem? If not, why is that one piece of info not available
through a sysctl() call?
Details about the applet including screen shots, an on-line man page
and the source tar-ball are available at:
http://www.mthoodcards.com/cgi-bin/index.py?grania
It's the 1.2.0 version below the "The latest version." screen shot.
The earlier 1.0.0 version at the is also available on
http://www.tigr.net.
Tricia
More information about the freebsd-questions
mailing list