Source-Changes-HG archive

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

[src/trunk]: src/sys/ddb Add a "show kqueue <addr>" command.



details:   https://anonhg.NetBSD.org/src/rev/a54189e72d46
branches:  trunk
changeset: 989040:a54189e72d46
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Oct 10 18:08:12 2021 +0000

description:
Add a "show kqueue <addr>" command.

diffstat:

 sys/ddb/db_command.c |  30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diffs (72 lines):

diff -r d804442b01a7 -r a54189e72d46 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Sun Oct 10 18:07:51 2021 +0000
+++ b/sys/ddb/db_command.c      Sun Oct 10 18:08:12 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.178 2021/08/21 23:00:31 andvar Exp $  */
+/*     $NetBSD: db_command.c,v 1.179 2021/10/10 18:08:12 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.178 2021/08/21 23:00:31 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.179 2021/10/10 18:08:12 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -79,6 +79,7 @@
 #include <sys/systm.h>
 #include <sys/reboot.h>
 #include <sys/device.h>
+#include <sys/eventvar.h>
 #include <sys/lwp.h>
 #include <sys/mbuf.h>
 #include <sys/namei.h>
@@ -204,6 +205,7 @@
 static void    db_mount_print_cmd(db_expr_t, bool, db_expr_t, const char *);
 static void    db_show_all_mount(db_expr_t, bool, db_expr_t, const char *);
 static void    db_mbuf_print_cmd(db_expr_t, bool, db_expr_t, const char *);
+static void    db_kqueue_print_cmd(db_expr_t, bool, db_expr_t, const char *);
 static void    db_map_print_cmd(db_expr_t, bool, db_expr_t, const char *);
 static void    db_namecache_print_cmd(db_expr_t, bool, db_expr_t,
                    const char *);
@@ -269,6 +271,8 @@
        { DDB_ADD_CMD("lockstats",
                                db_show_lockstats,      0,
            "Print statistics of locks", NULL, NULL) },
+       { DDB_ADD_CMD("kqueue", db_kqueue_print_cmd,    0,
+           "Print the kqueue at address.", "[/f] address",NULL) },
        { DDB_ADD_CMD("map",    db_map_print_cmd,       0,
            "Print the vm_map at address.", "[/f] address",NULL) },
        { DDB_ADD_CMD("mbuf",   db_mbuf_print_cmd,      0,NULL,NULL,
@@ -1014,6 +1018,28 @@
 
 /*ARGSUSED*/
 static void
+db_kqueue_print_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
+    const char *modif)
+{
+#ifdef _KERNEL
+       bool full = false;
+
+       if (modif[0] == 'f')
+               full = true;
+
+       if (have_addr == false) {
+               db_printf("%s: must specify kqueue address\n", __func__);
+               return;
+       }
+
+       kqueue_printit((struct kqueue *)(uintptr_t) addr, full, db_printf);
+#else
+       db_kernelonly();
+#endif /* XXX CRASH(8) */
+}
+
+/*ARGSUSED*/
+static void
 db_map_print_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
     const char *modif)
 {



Home | Main Index | Thread Index | Old Index