Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Change ^T/SIGINFO to print the PC/CPU# or PC instea...



details:   https://anonhg.NetBSD.org/src/rev/f60516496507
branches:  trunk
changeset: 761302:f60516496507
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Jan 23 07:30:07 2011 +0000

description:
Change ^T/SIGINFO to print the PC/CPU# or PC instead of "running"/"runable"
if a port provide LWP_PC.

diffstat:

 sys/kern/tty.c |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r 96f73c12415f -r f60516496507 sys/kern/tty.c
--- a/sys/kern/tty.c    Sun Jan 23 06:50:53 2011 +0000
+++ b/sys/kern/tty.c    Sun Jan 23 07:30:07 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.239 2010/11/19 06:44:43 dholland Exp $       */
+/*     $NetBSD: tty.c,v 1.240 2011/01/23 07:30:07 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.239 2010/11/19 06:44:43 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.240 2011/01/23 07:30:07 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>
@@ -2429,6 +2430,21 @@
        mutex_enter(pick->p_lock);
        LIST_FOREACH(l, &pick->p_lwps, l_sibling) {
                lwp_lock(l);
+#ifdef LWP_PC
+               if (l->l_stat == LSONPROC) {
+                       snprintf(lmsg, sizeof(lmsg), "%#"PRIxVADDR"/%d",
+                           LWP_PC(l), cpu_index(l->l_cpu));
+                       strlcat(buf, lmsg, bufsz);
+               } else if (l->l_stat == LSRUN) {
+                       snprintf(lmsg, sizeof(lmsg), "%#"PRIxVADDR, LWP_PC(l));
+                       strlcat(buf, lmsg, bufsz);
+               } else {
+                       strlcat(buf, l->l_wchan ? l->l_wmesg : "iowait", bufsz);
+               } 
+               lwp_unlock(l);
+               strlcat(buf, (LIST_NEXT(l, l_sibling) != NULL) ? " " : "] ",
+                   bufsz);
+#else
                snprintf(lmsg, sizeof(lmsg), "%s%s",
                    l->l_stat == LSONPROC ? "running" :
                    l->l_stat == LSRUN ? "runnable" :
@@ -2436,6 +2452,7 @@
                    (LIST_NEXT(l, l_sibling) != NULL) ? " " : "] ");
                lwp_unlock(l);
                strlcat(buf, lmsg, bufsz);
+#endif
                pctcpu += l->l_pctcpu;
        }
        pctcpu += pick->p_pctcpu;



Home | Main Index | Thread Index | Old Index