From owner-freebsd-bugs Mon Feb 9 03:00:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA08267 for freebsd-bugs-outgoing; Mon, 9 Feb 1998 03:00:02 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA08260; Mon, 9 Feb 1998 03:00:01 -0800 (PST) (envelope-from gnats) Received: from korin.warman.org.pl (korin.nask.waw.pl [148.81.160.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA07717 for ; Mon, 9 Feb 1998 02:54:14 -0800 (PST) (envelope-from abial@korin.warman.org.pl) Received: (from abial@localhost) by korin.warman.org.pl (8.8.8/8.8.5) id LAA12208; Mon, 9 Feb 1998 11:38:45 +0100 (CET) Message-Id: <199802091038.LAA12208@korin.warman.org.pl> Date: Mon, 9 Feb 1998 11:38:45 +0100 (CET) From: abial@nask.pl Reply-To: abial@nask.pl To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/5689: sysctl vm.vmmeter - bogus and unsupported (patch incl.) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 #include #include +#include #include #include @@ -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