Index: subr_witness.c =================================================================== RCS file: /home/ncvs/src/sys/kern/subr_witness.c,v retrieving revision 1.183 diff -u -r1.183 subr_witness.c --- subr_witness.c 9 Nov 2004 06:46:14 -0000 1.183 +++ subr_witness.c 26 Dec 2004 21:44:34 -0000 @@ -1721,6 +1721,13 @@ instance->li_line); } +static int +witness_has_locks(struct thread *td) +{ + + return (td->td_sleeplocks != NULL); +} + int witness_list_locks(struct lock_list_entry **lock_list) { @@ -1917,6 +1924,27 @@ } } +DB_SHOW_COMMAND(alllocks, db_witness_list_all) +{ + struct thread *td; + struct proc *p; + + /* + * It would be nice to list only threads and processes that actually + * held sleep locks, but that information is currently not exported + * by WITNESS. + */ + FOREACH_PROC_IN_SYSTEM(p) { + printf("Process %d (%s)\n", p->p_pid, p->p_comm); + FOREACH_THREAD_IN_PROC(p, td) { + if (!witness_has_locks(td)) + continue; + printf(" Thread 0x%x\n", td->td_tid); + witness_list(td); + } + } +} + DB_SHOW_COMMAND(witness, db_witness_display) {