From owner-freebsd-questions@FreeBSD.ORG Sat Jul 3 02:19:32 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F2AE016A4CE for ; Sat, 3 Jul 2004 02:19:31 +0000 (GMT) Received: from mthoodcards.com (pm3-194.ppp.pdx.spiretech.com [207.173.204.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id DCC5243D31 for ; Sat, 3 Jul 2004 02:19:30 +0000 (GMT) (envelope-from gomalley@mthoodcards.com) Received: by mthoodcards.com (Postfix, from userid 1000) id 36C54BDE0; Fri, 2 Jul 2004 19:05:44 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mthoodcards.com (Postfix) with ESMTP id 28BC1BDDF for ; Fri, 2 Jul 2004 19:05:44 -0700 (PDT) Date: Fri, 2 Jul 2004 19:05:44 -0700 (PDT) From: gomalley@mthoodcards.com Sender: grania@mthoodcards.com To: freebsd-questions@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Getting swap info without kvm access X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2004 02:19:32 -0000 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