Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Feb 1998 11:38:45 +0100 (CET)
From:      abial@nask.pl
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/5689: sysctl vm.vmmeter - bogus and unsupported (patch incl.)
Message-ID:  <199802091038.LAA12208@korin.warman.org.pl>

next in thread | raw e-mail | index | archive | help

>Number:         5689
>Category:       kern
>Synopsis:       sysctl vm.vmmeter - bogus and unsupported (patch incl.)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb  9 03:00:01 PST 1998
>Last-Modified:
>Originator:     Andrzej Bialecki
>Organization:
Research and Academic Network in Poland
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	-current as of today

>Description:

	The oid name for sysctl vm.vmmeter is bogus and misleading. In fact,
	it refers to 'struct vmtotal', and not to the 'struct vmmeter' as its
	name would suggest. Besides, it's silently skipped in sysctl -a
	listing, as there's no specific handler for it.


>How-To-Repeat:

	sysctl vm.vmmeter 		# returns nothing
	sysctl -A|grep vm.vmmeter	# returns Format: S,vmtotal ...

>Fix:
	1. change the name of the oid in /sys/vm/vm_meter.c to the correct
	   one (i.e. vmmeter -> vmtotal)
	2. patch the sysctl(8) to correctly display the values (patch follows).


--- sysctl.c.orig	Tue Nov 18 03:37:45 1997
+++ sysctl.c	Mon Feb  9 08:43:57 1998
@@ -49,6 +49,7 @@
 #include <sys/stat.h>
 #include <sys/sysctl.h>
 #include <sys/resource.h>
+#include <sys/vmmeter.h>
 
 #include <ctype.h>
 #include <err.h>
@@ -242,6 +243,22 @@
 }
 
 static int
+S_vmtotal(int l2, void *p)
+{
+	struct vmtotal *v = (struct vmtotal*)p;
+
+	if (l2 != sizeof *v)
+		err(1, "S_vmtotal %d != %d", l2, sizeof *v);
+
+	printf("\n  procs       virt mem      real mem     shared vm   shared real    free\n");
+	printf(" r d p s    tot    act    tot    act    tot    act    tot    act\n");
+	printf("%2d%2d%2d%2d",v->t_rq,v->t_dw,v->t_pw,v->t_sl);
+	printf("%7d%7d%7d%7d",v->t_vm,v->t_avm,v->t_rm,v->t_arm);
+	printf("%7d%7d%7d%7d%7d",v->t_vmshr,v->t_avmshr,v->t_rmshr,v->t_armshr,v->t_free);
+	return (0);
+}
+
+static int
 S_timeval(int l2, void *p)
 {
 	struct timeval *tv = (struct timeval*)p;
@@ -393,6 +410,7 @@
 		if (!strcmp(fmt, "S,clockinfo"))	func = S_clockinfo;
 		else if (!strcmp(fmt, "S,timeval"))	func = S_timeval;
 		else if (!strcmp(fmt, "S,loadavg"))	func = S_loadavg;
+		else if (!strcmp(fmt, "S,vmtotal"))	func = S_vmtotal;
 		else if (!strcmp(fmt, "T,dev_t"))	func = T_dev_t;
 		if (func) {
 			if (!nflag)

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802091038.LAA12208>