diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 5408af4de4fa..994e584ceee4 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 ba6b8b7bee00..67ccb320848e 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)