Subject: misc/1311: patch to add vm.vmmeter to sysctl(8)
To: None <gnats-bugs@gnats.netbsd.org>
From: Tom Pavel <tom@Bozon.Stanford.EDU>
List: netbsd-bugs
Date: 08/02/1995 22:05:30
>Number:         1311
>Category:       misc
>Synopsis:       patch to add vm.vmmeter to sysctl(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Aug  3 01:20:01 1995
>Last-Modified:
>Originator:     Tom Pavel
>Organization:
>Release:        NetBSD-current Jul-16-1995
>Environment:
System: NetBSD bozon 1.0A NetBSD 1.0A (BOZON) #27: Sat Jul 29 23:22:57 PDT 1995 tom@bozon:/usr/src/sys/arch/i386/compile/BOZON i386


>Description:
	Here is a little patch adding vm.vmmeter to sysctl(8), if
anyone is interested in looking at these numbers.  I was trying to
compare them to the numbers reported by "top" (which come from _cnt
via libkvm).  Seems like there wasn't any reason vm.vmmeter should be
omitted from sysctl.

>How-To-Repeat:
	
>Fix:
	
diff -c sysctl/sysctl.c sysctl-new/sysctl.c
*** sysctl/sysctl.c     Sat Dec 24 03:53:30 1994
--- sysctl-new/sysctl.c Sun Jun 11 22:13:11 1995
***************
*** 285,290 ****
--- 285,316 ----
                        fprintf(stdout, "%.2f %.2f %.2f\n", 
                            loads[0], loads[1], loads[2]);
                        return;
+               } else if (mib[1] == VM_METER) {
+                       struct vmtotal tot;
+                       size = sizeof(tot);
+                       if (sysctl(mib, 2, &tot, &size, NULL, 0) < 0) {
+                               if (flags == 0)
+                                       return;
+                               if (!nflag)
+                                       fprintf(stdout, "%s: ", string);
+                               fprintf(stderr, "failed sysctl\n");
+                               return;
+                       }
+                       if (!nflag)
+                               fprintf(stdout, "%s: ", string);
+                       fprintf(stdout,
+                               "rq = %d, dw = %d, pw = %d, sl = %d, sw = %d,\n",
+                               tot.t_rq, tot.t_dw, tot.t_pw,
+                               tot.t_sl, tot.t_sw);
+                       fprintf(stdout,
+                               "\tvm = %d, avm = %d, rm = %d, arm = %d,\n",
+                               tot.t_vm, tot.t_avm, tot.t_rm, tot.t_arm);
+                       fprintf(stdout,
+                                "\tvmshr = %d, avmshr = %d, rmshr = %d, armshr = %d, free = %d\n",
+                               tot.t_vmshr, tot.t_avmshr,
+                               tot.t_rmshr, tot.t_armshr,
+                               tot.t_free);
+                       return;
                }
                if (flags == 0)
                        return;
-----------------------------
End of patch
-----------------------------
>Audit-Trail:
>Unformatted: