Subject: bin/1012: vmstat -m doesn't detail "undefined" types
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Ken Raeburn <raeburn@kr-pc.cygnus.com>
List: netbsd-bugs
Date: 05/01/1995 15:05:30
>Number:         1012
>Category:       bin
>Synopsis:       vmstat -m doesn't detail "undefined" types
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon May  1 15:05:28 1995
>Originator:     Ken Raeburn
>Organization:
	Cygnus Support
>Release:        4/30/95
>Environment:
	
System: NetBSD kr-pc.cygnus.com 1.0A NetBSD 1.0A (RAEBURN) #2: Mon Mar 6 18:29:10 EST 1995 raeburn@kr-pc.cygnus.com:/red/NetBSD/src/sys/arch/i386/compile/RAEBURN i386


>Description:

If a loaded kernel module allocates storage using its own type
numbers, "vmstat -m" just lists it as "undefined", which won't
distinguish it from "undefined" type blocks allocated by another
module or a different "undefined" type used by that same module.  This
makes the "usage type by bucket size" listing vague.

>How-To-Repeat:
	
>Fix:

With this patch, each undefined type gets its own distinct
"undefined/##" name.

--- /pc/d1/NetBSD-current/src/usr.bin/vmstat/vmstat.c	Sat Apr 29 06:14:43 1995
+++ vmstat.c	Sun Apr 30 14:34:50 1995
@@ -800,7 +800,11 @@ domem()
 				continue;
 			if ((ks->ks_size & j) == 0)
 				continue;
-			name = kmemnames[i] ? kmemnames[i] : "undefined";
+			if (kmemnames[i] == 0) {
+				kmemnames[i] = malloc (20);
+				sprintf (kmemnames[i], "undefined/%d", i);
+			}
+			name = kmemnames[i];
 			len += 2 + strlen(name);
 			if (first)
 				printf("%8d  %s", j, name);
>Audit-Trail:
>Unformatted: