openbsd-ports/sysutils/toprump/patches/patch-machine_c
sthen 598ff33384 don't test wchan before printing wmesg, this can now only be done as root.
adapted from a base top(1) diff from tedu, ok lum@
2013-03-23 13:44:54 +00:00

44 lines
1020 B
Plaintext

$OpenBSD: patch-machine_c,v 1.3 2013/03/23 13:44:54 sthen Exp $
--- machine.c.orig Fri May 4 14:24:08 2012
+++ machine.c Sat Mar 23 10:55:29 2013
@@ -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>
@@ -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 */