diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2013-03-23 21:12:33 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2013-03-23 21:12:33 +0000 |
commit | 8a6dd206be34bbb42145c02ddee41781c0aba770 (patch) | |
tree | 29d7cafc9359f9a3074afe08e235e098f12ac3c0 | |
parent | 69378e871875fff8da9b7a6d918e1cc12b7d9321 (diff) |
wchan is no longer exposed, just check if wmesg is not empty.
(wmesg hasn't itself been a pointer since conversion to kinfo_proc.)
noticed by sthen.
ok deraadt jsing millert sthen
-rw-r--r-- | bin/ps/print.c | 4 | ||||
-rw-r--r-- | usr.bin/top/machine.c | 16 |
2 files changed, 7 insertions, 13 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 61e34227e8d..46d06c66c82 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.53 2012/07/10 17:24:45 deraadt Exp $ */ +/* $OpenBSD: print.c,v 1.54 2013/03/23 21:12:31 tedu Exp $ */ /* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */ /*- @@ -447,7 +447,7 @@ wchan(const struct kinfo_proc *kp, VARENT *ve) VAR *v; v = ve->var; - if (kp->p_wchan) { + if (kp->p_wmesg[0]) { (void)printf("%-*s", (int)v->width, kp->p_wmesg); } else (void)printf("%-*s", v->width, "-"); diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 8d022e7e709..0837ec8ea38 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.c,v 1.75 2012/12/18 21:28:45 millert Exp $ */ +/* $OpenBSD: machine.c,v 1.76 2013/03/23 21:12:32 tedu Exp $ */ /*- * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com> @@ -464,7 +464,7 @@ format_comm(struct kinfo_proc *kp) char * format_next_process(caddr_t handle, char *(*get_userid)(uid_t), pid_t *pid) { - char *p_wait, waddr[sizeof(void *) * 2 + 3]; /* Hexify void pointer */ + char *p_wait; struct kinfo_proc *pp; struct handle *hp; int cputime; @@ -480,15 +480,9 @@ format_next_process(caddr_t handle, char *(*get_userid)(uid_t), pid_t *pid) /* calculate the base for cpu percentages */ pct = pctdouble(pp->p_pctcpu); - 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); - p_wait = waddr; - } - } else + if (pp->p_wmesg[0]) + p_wait = pp->p_wmesg; + else p_wait = "-"; /* format this entry */ |