PERFORCE change 136519 for review

Randall R. Stewart rrs at FreeBSD.org
Fri Feb 29 21:33:14 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136519

Change 136519 by rrs at rrs-mips2-jnpr on 2008/02/29 21:32:25

	Adds a ddb show command to dump out things about the ttys.

Affected files ...

.. //depot/projects/mips2-jnpr/src/sys/kern/tty.c#3 edit

Differences ...

==== //depot/projects/mips2-jnpr/src/sys/kern/tty.c#3 (text+ko) ====

@@ -75,6 +75,7 @@
 
 #include "opt_compat.h"
 #include "opt_tty.h"
+#include "opt_ddb.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3469,6 +3470,54 @@
 	ttsetwater(tp);
 }
 
+#ifdef DDB
+void db_dump_all_ttys(void);
+
+
+void
+db_dump_all_ttys(void)
+{
+	struct tty *tp;
+
+	TAILQ_FOREACH(tp, &tty_list, t_list) {
+		printf("********************************************************\n");
+		printf("tp:%p dev:%p t_mdev:%p unit:%d state:%x flags:%x mutex:%p\n",
+		    tp, tp->t_dev, tp->t_mdev, (int)tp->t_devunit, (uint32_t) tp->t_state,
+		    (uint32_t) tp->t_flags, &tp->t_mtx);
+		printf("driver sc:%p linedisc sc:%p hi_input:%d low_input:%d hi_output:%d low_output:%d\n",
+		    tp->t_sc, tp->t_lsc,
+		    tp->t_ihiwat, tp->t_ilowat,
+		    tp->t_ohiwat, tp->t_olowat);
+		printf("output state c_cc:%d n_cb:%d max_cb:%d t_outcc:%ld\n",
+		    tp->t_outq.c_cc, tp->t_outq.c_cbcount, tp->t_outq.c_cbmax,
+		    tp->t_outcc
+		    );
+		printf("input state (raw) c_cc:%d n_cb:%d max_cb:%d t_rawcc:%ld\n",
+		    tp->t_rawq.c_cc, tp->t_rawq.c_cbcount, tp->t_rawq.c_cbmax,
+		    tp->t_rawcc
+		    );
+		printf("input state (can) c_cc:%d n_cb:%d max_cb:%d t_cancc:%ld\n",
+		    tp->t_canq.c_cc, tp->t_canq.c_cbcount, tp->t_canq.c_cbmax,
+		    tp->t_cancc
+		    );
+		printf("tp->t_line:%d l_rint:%p l_start:%p\n", tp->t_line,
+		    linesw[tp->t_line]->l_rint,
+		    linesw[tp->t_line]->l_start
+		    );
+
+	}
+}
+
+#include <sys/kernel.h>
+#include <ddb/ddb.h>
+
+DB_SHOW_COMMAND(ttys, ddb_dump_all_ttys)
+{
+	db_dump_all_ttys();
+}
+
+#endif
+
 /*
  * Record the relationship between the serial ports notion of modem control
  * signals and the one used in certain ioctls in a way the compiler can enforce


More information about the p4-projects mailing list