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@
This commit is contained in:
sthen 2013-03-23 13:44:54 +00:00
parent 8fbcd28002
commit 598ff33384
2 changed files with 23 additions and 13 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.18 2013/03/11 11:41:33 espie Exp $
# $OpenBSD: Makefile,v 1.19 2013/03/23 13:44:54 sthen Exp $
COMMENT= modified OpenBSD top command
DISTNAME= toprump-0.14.8
REVISION= 0
REVISION= 1
CATEGORIES= sysutils
HOMEPAGE= http://cyodesigns.com/toprump/

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-machine_c,v 1.2 2012/12/18 21:38:12 sthen Exp $
--- machine.c.orig Fri May 4 07:24:08 2012
+++ machine.c Thu Dec 6 15:26:14 2012
$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>
@ -22,12 +22,22 @@ $OpenBSD: patch-machine_c,v 1.2 2012/12/18 21:38:12 sthen Exp $
#include <err.h>
#include <errno.h>
@@ -511,7 +513,7 @@ format_next_process(caddr_t handle, char *(*get_userid
p_wait = pp->p_wmesg;
else {
snprintf(waddr, sizeof(waddr), "%llx",
@@ -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));
+ (unsigned long long)pp->p_wchan);
p_wait = waddr;
}
} else
- p_wait = waddr;
- }
- } else
+ if (pp->p_wmesg[0])
+ p_wait = pp->p_wmesg;
+ else
p_wait = "-";
/* format this entry */