Module Name: src
Committed By: matt
Date: Wed May 25 05:35:50 UTC 2011
Modified Files:
src/sys/kern [matt-nb5-mips64]: tty.c
Log Message:
Merge in LWP_PC status change from -current. Print PC addr if lwp is
running or runnable.
To generate a diff of this commit:
cvs rdiff -u -r1.227.4.1.4.1 -r1.227.4.1.4.2 src/sys/kern/tty.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/tty.c
diff -u src/sys/kern/tty.c:1.227.4.1.4.1 src/sys/kern/tty.c:1.227.4.1.4.2
--- src/sys/kern/tty.c:1.227.4.1.4.1 Wed Apr 21 00:28:18 2010
+++ src/sys/kern/tty.c Wed May 25 05:35:49 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp $ */
+/* tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp $");
+__KERNEL_RCSID(0, "tty.c,v 1.227.4.1.4.1 2010/04/21 00:28:18 matt Exp");
#include <sys/param.h>
#include <sys/systm.h>
@@ -74,6 +74,7 @@
#undef TTYDEFCHARS
#include <sys/file.h>
#include <sys/conf.h>
+#include <sys/cpu.h>
#include <sys/dkstat.h>
#include <sys/uio.h>
#include <sys/kernel.h>
@@ -2399,15 +2400,36 @@
mutex_enter(pick->p_lock);
LIST_FOREACH(l, &pick->p_lwps, l_sibling) {
+ const char *lp;
lwp_lock(l);
- snprintf(lmsg, sizeof(lmsg), "%s%s",
- l->l_stat == LSONPROC ? "running" :
- l->l_stat == LSRUN ? "runnable" :
- l->l_wchan ? l->l_wmesg : "iowait",
- (LIST_NEXT(l, l_sibling) != NULL) ? " " : "] ");
- lwp_unlock(l);
- strlcat(buf, lmsg, bufsz);
+#ifdef LWP_PC
+#define FMT_RUN "%#"PRIxVADDR
+#define VAL_RUNNING (vaddr_t)LWP_PC(l)
+#define VAL_RUNABLE (vaddr_t)LWP_PC(l)
+#else
+#define FMT_RUN "%s"
+#define VAL_RUNNING "running"
+#define VAL_RUNABLE "runnable"
+#endif
+ switch (l->l_stat) {
+ case LSONPROC:
+ snprintf(lmsg, sizeof(lmsg), FMT_RUN"/%d", VAL_RUNNING,
+ cpu_index(l->l_cpu));
+ lp = lmsg;
+ break;
+ case LSRUN:
+ snprintf(lmsg, sizeof(lmsg), FMT_RUN, VAL_RUNABLE);
+ lp = lmsg;
+ break;
+ default:
+ lp = l->l_wchan ? l->l_wmesg : "iowait";
+ break;
+ }
+ strlcat(buf, lp, bufsz);
+ strlcat(buf, LIST_NEXT(l, l_sibling) != NULL ? " " : "] ",
+ bufsz);
pctcpu += l->l_pctcpu;
+ lwp_unlock(l);
}
pctcpu += pick->p_pctcpu;
calcru(pick, &utime, &stime, NULL, NULL);