diff options
author | John Baldwin <jhb@FreeBSD.org> | 2004-02-27 16:13:44 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2004-02-27 16:13:44 +0000 |
commit | 03129ba97f72bb8315ff53059e65db23103f5e17 (patch) | |
tree | 20dd837a79227b3b1cca6db0e85057c241dd6f41 /sys/kern/kern_sx.c | |
parent | 0e2ff2832c61d874df147ac8bef38f17e265a277 (diff) | |
download | src-03129ba97f72bb8315ff53059e65db23103f5e17.tar.gz src-03129ba97f72bb8315ff53059e65db23103f5e17.zip |
Fix _sx_assert() to panic() rather than printf() when an assertion fails
and ignore assertions if we have already paniced.
Notes
Notes:
svn path=/head/; revision=126316
Diffstat (limited to 'sys/kern/kern_sx.c')
-rw-r--r-- | sys/kern/kern_sx.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 70b860c6470b..2d87fa5246b6 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 |