Subject: pkg/17912: new patch for x11/kdebase3
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hclsmith@yahoo.ca>
List: netbsd-bugs
Date: 08/11/2002 18:28:20
>Number:         17912
>Category:       pkg
>Synopsis:       patch for ksysguardd memory data
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 11 14:13:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.5.3
>Organization:
>Environment:
System: NetBSD gussie.hclsmith 1.5.3 NetBSD 1.5.3 (GUSSIE) #0: Sat Aug 3 15:25:36 ADT 2002 kwantus@gussie.hclsmith:/mnt/B/hclsmith/usr/src/sys/arch/i386/compile/GUSSIE i386
Architecture: i386
Machine: i386
>Description:
	The existing ksysguardd has provided nearly no memory data
>How-To-Repeat:
	run  ksysguardd
	say  mem/physical/used
	say  mem/physical/free
	say  mem/swap/free
	say  mem/swap/used
	all 0 or -1
	or view plots by ksysguard (the client)
>Fix:
	replace x11/kdebase3/patches/patch-dd with the following
	(there remain memory data that have no NetBSD correlation apparent to me)

$NetBSD$

*** ksysguard/ksysguardd/FreeBSD/Memory.c.orig	Fri Sep 14 18:11:20 2001
--- ksysguard/ksysguardd/FreeBSD/Memory.c	Sun Aug 11 18:10:20 2002
***************
*** 32,38 ****
--- 32,43 ----
  #include <sys/types.h>
  #include <sys/vmmeter.h>
  #include <unistd.h>
+ /* Everything post 1.5.x uses uvm/uvm_* includes */
+ #if __NetBSD_Version__ >= 105010000
+ #include <uvm/uvm_param.h>
+ #else
  #include <vm/vm_param.h>
+ #endif
  
  #include "Command.h"
  #include "Memory.h"
***************
*** 77,82 ****
--- 82,130 ----
  int
  updateMemory(void)
  {
+ #ifdef __NetBSD__
+ #define ARRLEN(X) (sizeof(X)/sizeof(X[0]))
+ 	long pagesize; /* using a long promotes the arithmetic */
+ 	size_t len;
+ 
+ 	{	static int mib[]={ CTL_HW, HW_PHYSMEM };
+ 
+		len = sizeof(Total);
+ 		sysctl(mib, ARRLEN(mib), &Total, &len, NULL, 0);
+ 		Total >>= 10;
+ 	}
+ 
+ 	{	struct uvmexp x;
+ 		static int mib[] = { CTL_VM, VM_UVMEXP };
+ 
+ 		len = sizeof(x);
+ 		STotal = SUsed = SFree = -1;
+ 		pagesize = 1;
+ 		if (-1 < sysctl(mib, ARRLEN(mib), &x, &len, NULL, 0)) {
+ 			pagesize = x.pagesize;
+ 			STotal = (pagesize*x.swpages) >> 10;
+ 			SUsed = (pagesize*x.swpginuse) >> 10;
+ 			SFree = STotal - SUsed;
+ 		}
+ 	}
+ 
+ 	/* can't find NetBSD filesystem buffer info */
+ 	Buffers = -1;
+ 
+ 	/* NetBSD doesn't know about vm.stats */
+ 	Cached = -1;
+ 
+ 	{	static int mib[]={ CTL_VM, VM_METER };
+ 		struct vmtotal x;
+ 
+ 		len = sizeof(x);
+ 		MFree = Used = -1;
+ 		if (sysctl(mib, ARRLEN(mib), &x, &len, NULL, 0) > -1) {
+ 			MFree = (x.t_free * pagesize) >> 10;
+ 			Used = (x.t_arm * pagesize) >> 10;
+ 		}
+ 	}
+ #else
  	int mib[2];
  	size_t len;
  	struct vmtotal p;
***************
*** 119,124 ****
--- 167,173 ----
  	sysctlbyname("vm.vmmeter", &p, &len, NULL, 0);
          MFree = p.t_free * getpagesize() / 1024;
          Used = p.t_arm * getpagesize() / 1024 + Buffers + Cached;
+ #endif
  
  	return 0;
  }





>Release-Note:
>Audit-Trail:
>Unformatted: