kernel/ddb - Add 'show tokens' function.
authorAntonio Huete Jimenez <tuxillo@quantumachine.net>
Fri, 8 Mar 2013 00:40:39 +0000 (01:40 +0100)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Fri, 8 Mar 2013 00:40:39 +0000 (01:40 +0100)
sys/kern/lwkt_token.c

index 059bc18..aa02334 100644 (file)
@@ -53,6 +53,7 @@
 #include <sys/queue.h>
 #include <sys/sysctl.h>
 #include <sys/ktr.h>
+#include <ddb/ddb.h>
 #include <sys/kthread.h>
 #include <machine/cpu.h>
 #include <sys/lock.h>
@@ -931,3 +932,28 @@ lwkt_token_swap(void)
 
        crit_exit();
 }
+
+DB_SHOW_COMMAND(tokens, db_tok_all)
+{
+       struct lwkt_token *tok, **ptr;
+       struct lwkt_token *toklist[16] = {
+               &mp_token,
+               &pmap_token,
+               &dev_token,
+               &vm_token,
+               &vmspace_token,
+               &kvm_token,
+               &proc_token,
+               &tty_token,
+               &vnode_token,
+               &vmobj_token,
+               NULL
+       };
+
+       ptr = toklist;
+       for (tok = *ptr; tok; tok = *(++ptr)) {
+               db_printf("tok=%p tr_owner=%p t_colissions=%ld t_desc=%s\n", tok,
+                   (tok->t_ref ? tok->t_ref->tr_owner : NULL),
+                   tok->t_collisions, tok->t_desc);
+       }
+}