$OpenBSD: patch-machine_c,v 1.4 2014/07/04 12:20:32 sthen Exp $
--- machine.c.orig	Fri Jul  4 12:36:19 2014
+++ machine.c	Fri Jul  4 12:36:22 2014
@@ -35,14 +35,16 @@
 
 #include <sys/types.h>
 #include <sys/param.h>
+#include <sys/dkstat.h>
+#include <sys/mount.h>
+#include <sys/proc.h>
+#include <sys/swap.h>
+#include <sys/sysctl.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/sysctl.h>
-#include <sys/dkstat.h>
-#include <sys/mount.h>
-#include <sys/swap.h>
 #include <err.h>
 #include <errno.h>
 
@@ -215,10 +217,10 @@ void
 get_system_info(struct system_info *si)
 {
 	static int sysload_mib[] = {CTL_VM, VM_LOADAVG};
-	static int vmtotal_mib[] = {CTL_VM, VM_METER};
+	static int uvmexp_mib[] = {CTL_VM, VM_UVMEXP};
 	static int bcstats_mib[] = {CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT};
 	struct loadavg sysload;
-	struct vmtotal vmtotal;
+	struct uvmexp uvmexp;
 	struct bcachestats bcstats;
 	double *infoloadp;
 	size_t size;
@@ -261,10 +263,10 @@ get_system_info(struct system_info *si)
 
 
 	/* get total -- systemwide main memory usage structure */
-	size = sizeof(vmtotal);
-	if (sysctl(vmtotal_mib, 2, &vmtotal, &size, NULL, 0) < 0) {
+	size = sizeof(uvmexp);
+	if (sysctl(uvmexp_mib, 2, &uvmexp, &size, NULL, 0) < 0) {
 		warn("sysctl failed");
-		bzero(&vmtotal, sizeof(vmtotal));
+		bzero(&uvmexp, sizeof(uvmexp));
 	}
 	size = sizeof(bcstats);
 	if (sysctl(bcstats_mib, 3, &bcstats, &size, NULL, 0) < 0) {
@@ -273,10 +275,10 @@ get_system_info(struct system_info *si)
 	}
 	/* convert memory stats to Kbytes */
 	memory_stats[0] = -1;
-	memory_stats[1] = pagetok(vmtotal.t_arm);
-	memory_stats[2] = pagetok(vmtotal.t_rm);
+	memory_stats[1] = pagetok(uvmexp.active);
+	memory_stats[2] = pagetok(uvmexp.npages - uvmexp.free);
 	memory_stats[3] = -1;
-	memory_stats[4] = pagetok(vmtotal.t_free);
+	memory_stats[4] = pagetok(uvmexp.free);
 	memory_stats[5] = -1;
 	memory_stats[6] = pagetok(bcstats.numbufpages);
 	memory_stats[7] = -1;
@@ -506,15 +508,9 @@ format_next_process(caddr_t handle, char *(*get_userid
 			pmondata.memsize = pagetok(PROCSIZE(pp)) / 1024.0;
 		}
 
-		if (pp->p_wchan) {
-			if (pp->p_wmesg)
-				p_wait = pp->p_wmesg;
-			else {
-				snprintf(waddr, sizeof(waddr), "%llx",
-				    (unsigned long long)(pp->p_wchan & ~KERNBASE));
-				p_wait = waddr;
-			}
-		} else
+		if (pp->p_wmesg[0])
+			p_wait = pp->p_wmesg;
+		else
 			p_wait = "-";
 
 		/* format this entry */
