pkgsrc/sysutils/xosview/patches/patch-ab
2013-01-11 23:33:35 +00:00

32 lines
1.2 KiB
Text

$NetBSD: patch-ab,v 1.13 2013/01/11 23:33:36 joerg Exp $
--- bsd/memmeter.cc.orig 2002-07-14 03:48:45.000000000 +0000
+++ bsd/memmeter.cc
@@ -26,6 +26,8 @@
#include <sys/sysctl.h> /* Needed for kvm_cnt, kvm_uvm_exp. */
-#if defined(XOSVIEW_BSDI) || defined(XOSVIEW_FREEBSD) || defined(XOSVIEW_OPENBSD) /* Does
- OpenBSD need this? */
+#if defined(XOSVIEW_BSDI) || defined(XOSVIEW_FREEBSD) || defined(XOSVIEW_OPENBSD)
# include <sys/vmmeter.h>
#endif
+#if defined(__NetBSD__)
+#include <uvm/uvm_extern.h>
+#endif
@@ -79,3 +81,3 @@ void MemMeter::getmeminfo (void) {
size_t meminfosize = sizeof (struct vmtotal);
- sysctl (params, 2, &meminfo, &meminfosize, NULL, NULL);
+ sysctl (params, 2, &meminfo, &meminfosize, NULL, 0);
/* Note that the numbers are in terms of 4K pages. */
@@ -93,4 +95,11 @@ void MemMeter::getmeminfo (void) {
#if defined(UVM) && (defined(XOSVIEW_NETBSD) || defined(XOSVIEW_OPENBSD))
+#ifdef VM_UVMEXP2
+ int params[] = {CTL_VM, VM_UVMEXP2};
+ struct uvmexp_sysctl kvm_uvm_exp;
+ size_t kvm_uvm_exp_size = sizeof (kvm_uvm_exp);
+ sysctl (params, 2, &kvm_uvm_exp, &kvm_uvm_exp_size, NULL, 0);
+#else
struct uvmexp kvm_uvm_exp;
BSDGetUVMPageStats(&kvm_uvm_exp);
+#endif
int pgsize = kvm_uvm_exp.pagesize;