summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sx.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-02-27 16:13:44 +0000
committerjhb <jhb@FreeBSD.org>2004-02-27 16:13:44 +0000
commitb7ab1db7c3f35010ff08fbf6932a3214742a464d (patch)
tree20dd837a79227b3b1cca6db0e85057c241dd6f41 /sys/kern/kern_sx.c
parent2e191a7e19887acdc7a7f52491a57e5ed8ecdcd9 (diff)
downloadFreeBSD-src-b7ab1db7c3f35010ff08fbf6932a3214742a464d.zip
FreeBSD-src-b7ab1db7c3f35010ff08fbf6932a3214742a464d.tar.gz
Fix _sx_assert() to panic() rather than printf() when an assertion fails
and ignore assertions if we have already paniced.
Diffstat (limited to 'sys/kern/kern_sx.c')
-rw-r--r--sys/kern/kern_sx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index 70b860c..2d87fa5 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -322,6 +322,8 @@ void
_sx_assert(struct sx *sx, int what, const char *file, int line)
{
+ if (panicstr != NULL)
+ return;
switch (what) {
case SX_LOCKED:
case SX_SLOCKED:
@@ -331,7 +333,7 @@ _sx_assert(struct sx *sx, int what, const char *file, int line)
mtx_lock(sx->sx_lock);
if (sx->sx_cnt <= 0 &&
(what == SX_SLOCKED || sx->sx_xholder != curthread))
- printf("Lock %s not %slocked @ %s:%d\n",
+ panic("Lock %s not %slocked @ %s:%d\n",
sx->sx_object.lo_name, (what == SX_SLOCKED) ?
"share " : "", file, line);
mtx_unlock(sx->sx_lock);
@@ -340,7 +342,7 @@ _sx_assert(struct sx *sx, int what, const char *file, int line)
case SX_XLOCKED:
mtx_lock(sx->sx_lock);
if (sx->sx_xholder != curthread)
- printf("Lock %s not exclusively locked @ %s:%d\n",
+ panic("Lock %s not exclusively locked @ %s:%d\n",
sx->sx_object.lo_name, file, line);
mtx_unlock(sx->sx_lock);
break;
@@ -354,7 +356,7 @@ _sx_assert(struct sx *sx, int what, const char *file, int line)
*/
mtx_lock(sx->sx_lock);
if (sx->sx_xholder == curthread)
- printf("Lock %s locked @ %s:%d\n",
+ panic("Lock %s exclusively locked @ %s:%d\n",
sx->sx_object.lo_name, file, line);
mtx_unlock(sx->sx_lock);
#endif
OpenPOWER on IntegriCloud