Date: Fri, 2 Jul 2004 19:05:44 -0700 (PDT) From: gomalley@mthoodcards.com To: freebsd-questions@freebsd.org Subject: Getting swap info without kvm access Message-ID: <Pine.LNX.4.20.0407021623160.7716-100000@grace.rockwood.loc>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.20.0407021623160.7716-100000>