Index: subr_turnstile.c =================================================================== RCS file: /zoo/cvsup/FreeBSD-CVS/src/sys/kern/subr_turnstile.c,v retrieving revision 1.161 diff -u -p -r1.161 subr_turnstile.c --- subr_turnstile.c 12 Jul 2006 21:25:24 -0000 1.161 +++ subr_turnstile.c 17 Jul 2006 16:32:18 -0000 @@ -1177,4 +1177,29 @@ DB_SHOW_COMMAND(lockchain, db_show_lockc } else print_waiters(ts, 0); } + +DB_SHOW_COMMAND(activelocks, db_show_activelocks) +{ + struct turnstile *ts; + struct lock_object *lock; + int i; + + for (i = 0; i < TC_TABLESIZE; i++) { + LIST_FOREACH(ts, &turnstile_chains[i].tc_turnstiles, ts_hash) { + lock = ts->ts_lockobj; + db_printf("Lock: %p - (%s) %s\n", lock, + LOCK_CLASS(lock)->lc_name, lock->lo_name); + if (ts->ts_owner) + print_thread(ts->ts_owner, "Lock Owner: "); + else + db_printf("Lock Owner: none\n"); + print_queue(&ts->ts_blocked[TS_SHARED_QUEUE], + "Shared Waiters", "\t"); + print_queue(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE], + "Exclusive Waiters", "\t"); + print_queue(&ts->ts_pending, "Pending Threads", "\t"); + db_printf("\n"); + } + } +} #endif