Index: sys/kern/kern_shutdown.c =================================================================== --- sys/kern/kern_shutdown.c +++ sys/kern/kern_shutdown.c @@ -614,7 +614,7 @@ * or if we will log via printf and/or ktr. */ void -kassert_panic(const char *fmt, ...) +_kassert_panic(int fatal, const char *fmt, ...) { static char buf[256]; va_list ap; @@ -627,9 +627,9 @@ * panic if we're not just warning, or if we've exceeded * kassert_log_panic_at warnings. */ - if (!kassert_warn_only || + if (fatal && (!kassert_warn_only || (kassert_log_panic_at > 0 && - kassert_warnings >= kassert_log_panic_at)) { + kassert_warnings >= kassert_log_panic_at))) { va_start(ap, fmt); vpanic(fmt, ap); /* NORETURN */ Index: sys/sys/systm.h =================================================================== --- sys/sys/systm.h +++ sys/sys/systm.h @@ -76,24 +76,35 @@ VM_LAST }; #if defined(WITNESS) || defined(INVARIANTS) -void kassert_panic(const char *fmt, ...) __printflike(1, 2); +#define kassert_panic(format, ...) _kassert_panic(1, format, \ + ## __VA_ARGS__) +#define kassert_warn(format, ...) _kassert_panic(0, format, \ + ## __VA_ARGS__) +void _kassert_panic(int fatal, const char *fmt, ...) __printflike(2, 3); #endif #ifdef INVARIANTS /* The option is always available */ #define KASSERT(exp,msg) do { \ if (__predict_false(!(exp))) \ - kassert_panic msg; \ + kassert_panic msg; \ +} while (0) +#define KASSERT_WARN(exp,msg) do { \ + if (__predict_false(!(exp))) \ + kassert_warn msg; \ } while (0) #define VNASSERT(exp, vp, msg) do { \ if (__predict_false(!(exp))) { \ vn_printf(vp, "VNASSERT failed\n"); \ - kassert_panic msg; \ + kassert_panic msg; \ } \ } while (0) #else #define KASSERT(exp,msg) do { \ } while (0) +#define KASSERT_WARN(exp,msg) do { \ +} while (0) + #define VNASSERT(exp, vp, msg) do { \ } while (0) #endif