summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-10-24 14:18:33 +0000
committerjhb <jhb@FreeBSD.org>2001-10-24 14:18:33 +0000
commitdb9a37a27ac55295c0d14f5f452955bfc74b1cef (patch)
treea6a73c42b375fd5076ba6b31a0cc71046c8cdbaf
parenta6a7b0b031fec270567d2b976e077fa5db6e1d74 (diff)
downloadFreeBSD-src-db9a37a27ac55295c0d14f5f452955bfc74b1cef.zip
FreeBSD-src-db9a37a27ac55295c0d14f5f452955bfc74b1cef.tar.gz
Fix this to actually compile in the !INVARIANTS case.
Reported by: Maxime Henrion <mux@qualys.com>
-rw-r--r--sys/kern/kern_sx.c8
-rw-r--r--sys/sys/sx.h4
2 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index 5408af4..994e584 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -48,6 +48,10 @@ struct lock_class lock_class_sx = {
LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE | LC_UPGRADABLE
};
+#ifndef INVARIANTS
+#define _sx_assert(sx, what, file, line)
+#endif
+
void
sx_init(struct sx *sx, const char *description)
{
@@ -294,6 +298,10 @@ _sx_downgrade(struct sx *sx, const char *file, int line)
}
#ifdef INVARIANT_SUPPORT
+#ifndef INVARIANTS
+#undef _sx_assert
+#endif
+
/*
* In the non-WITNESS case, sx_assert() can only detect that at least
* *some* thread owns an slock, but it cannot guarantee that *this*
diff --git a/sys/sys/sx.h b/sys/sys/sx.h
index ba6b8b7..67ccb32 100644
--- a/sys/sys/sx.h
+++ b/sys/sys/sx.h
@@ -70,11 +70,13 @@ void _sx_assert(struct sx *sx, int what, const char *file, int line);
#define sx_try_upgrade(sx) _sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE)
#define sx_downgrade(sx) _sx_downgrade((sx), LOCK_FILE, LOCK_LINE)
-#ifdef INVARIANTS
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
#define SX_LOCKED LA_LOCKED
#define SX_SLOCKED LA_SLOCKED
#define SX_XLOCKED LA_XLOCKED
+#endif /* INVARIANTS || INVARIANT_SUPPORT */
+#ifdef INVARIANTS
#define sx_assert(sx, what) _sx_assert((sx), (what), LOCK_FILE, LOCK_LINE)
#else /* INVARIANTS */
#define sx_assert(sx, what)
OpenPOWER on IntegriCloud