aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_sx.c
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2004-02-04 08:14:58 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2004-02-04 08:14:58 +0000
commit19b0efd32d5085fb6a2fdb4618c7a4217c53b4bb (patch)
treefb16ab4364866d98bee657c2b36cec6000386ea4 /sys/kern/kern_sx.c
parent2ccbe4b596b63020c32613ed34a9a1a37e8b9954 (diff)
downloadsrc-19b0efd32d5085fb6a2fdb4618c7a4217c53b4bb.tar.gz
src-19b0efd32d5085fb6a2fdb4618c7a4217c53b4bb.zip
Allow assert that the current thread does not hold the sx(9) lock.
Reviewed by: jhb In cooperation with: juli, jhb Approved by: jhb, scottl (mentor)
Notes
Notes: svn path=/head/; revision=125421
Diffstat (limited to 'sys/kern/kern_sx.c')
-rw-r--r--sys/kern/kern_sx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index fd723ed513cd..e744f315b8f2 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -344,6 +344,17 @@ _sx_assert(struct sx *sx, int what, const char *file, int line)
sx->sx_object.lo_name, file, line);
mtx_unlock(sx->sx_lock);
break;
+ case SX_UNLOCKED:
+#ifdef WITNESS
+ witness_assert(&sx->sx_object, what, file, line);
+#else
+ mtx_lock(sx->sx_lock);
+ if (sx->sx_cnt != 0 && sx->sx_xholder == curthread)
+ printf("Lock %s locked @ %s:%d\n",
+ sx->sx_object.lo_name, file, line);
+ mtx_unlock(sx->sx_lock);
+#endif
+ break;
default:
panic("Unknown sx lock assertion: %d @ %s:%d", what, file,
line);