summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-04-25 20:24:23 +0000
committerjhb <jhb@FreeBSD.org>2006-04-25 20:24:23 +0000
commit9a8083cd6c7387ec362c8e5c7b7810bf7c642554 (patch)
tree9db4a371128a17ccd4c1a04b6b7afa3cb0493848
parent819f9866cd1dc759418685f6f6b7a0743dd17df7 (diff)
downloadFreeBSD-src-9a8083cd6c7387ec362c8e5c7b7810bf7c642554.zip
FreeBSD-src-9a8083cd6c7387ec362c8e5c7b7810bf7c642554.tar.gz
Use db_lookup_thread() to lookup the thread for the passed in address
and change 'show locks' to only list the locks for a given thread rather than for all the threads in the process containing a specified thread.
-rw-r--r--sys/kern/subr_witness.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index d797e36..9bcef08 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -1955,30 +1955,12 @@ witness_list(struct thread *td)
DB_SHOW_COMMAND(locks, db_witness_list)
{
struct thread *td;
- pid_t pid;
- struct proc *p;
- if (have_addr) {
- pid = (addr % 16) + ((addr >> 4) % 16) * 10 +
- ((addr >> 8) % 16) * 100 + ((addr >> 12) % 16) * 1000 +
- ((addr >> 16) % 16) * 10000;
- /* sx_slock(&allproc_lock); */
- FOREACH_PROC_IN_SYSTEM(p) {
- if (p->p_pid == pid)
- break;
- }
- /* sx_sunlock(&allproc_lock); */
- if (p == NULL) {
- db_printf("pid %d not found\n", pid);
- return;
- }
- FOREACH_THREAD_IN_PROC(p, td) {
- witness_list(td);
- }
- } else {
- td = curthread;
- witness_list(td);
- }
+ if (have_addr)
+ td = db_lookup_thread(addr, TRUE);
+ else
+ td = kdb_thread;
+ witness_list(td);
}
DB_SHOW_COMMAND(alllocks, db_witness_list_all)
OpenPOWER on IntegriCloud