summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_turnstile.c
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2000-12-12 01:14:32 +0000
committerjake <jake@FreeBSD.org>2000-12-12 01:14:32 +0000
commite04de3cdaa20b55e34a44aa9540e200747947d37 (patch)
tree7118da5af73ae9b208c2b8845c541a5f8114eb78 /sys/kern/subr_turnstile.c
parent5791a3790632140a5f2e20a7962b123589408145 (diff)
downloadFreeBSD-src-e04de3cdaa20b55e34a44aa9540e200747947d37.zip
FreeBSD-src-e04de3cdaa20b55e34a44aa9540e200747947d37.tar.gz
- Add code to detect if a system call returns with locks other than Giant
held and panic if so (conditional on witness). - Change witness_list to return the number of locks held so this is easier. - Add kern/syscalls.c to the kernel build if witness is defined so that the panic message can contain the name of the offending system call. - Add assertions that Giant and sched_lock are not held when returning from a system call, which were missing for alpha and ia64.
Diffstat (limited to 'sys/kern/subr_turnstile.c')
-rw-r--r--sys/kern/subr_turnstile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c
index ee931c0..85d5624 100644
--- a/sys/kern/subr_turnstile.c
+++ b/sys/kern/subr_turnstile.c
@@ -1353,17 +1353,22 @@ witness_free(struct witness *w)
w_free = w;
}
-void
+int
witness_list(struct proc *p)
{
struct mtx *m;
+ int nheld;
+ nheld = 0;
for ((m = LIST_FIRST(&p->p_heldmtx)); m != NULL;
m = LIST_NEXT(m, mtx_held)) {
printf("\t\"%s\" (%p) locked at %s:%d\n",
m->mtx_description, m,
m->mtx_witness->w_file, m->mtx_witness->w_line);
+ nheld++;
}
+
+ return (nheld);
}
void
OpenPOWER on IntegriCloud