Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

kassertmsg(9) [netbsd man page]

KASSERT(9)						   BSD Kernel Developer's Manual						KASSERT(9)

NAME
KASSERT, KASSERTMSG, KDASSERT, KDASSERTMSG -- kernel expression verification macros SYNOPSIS
void KASSERT(expression); void KASSERTMSG(expression, format, ...); void KDASSERT(expression); void KDASSERTMSG(expression, format, ...); DESCRIPTION
These machine independent assertion-checking macros cause a kernel panic(9) if the given expression evaluates to false. Two compile-time options(4) define the behavior of the checks. 1. The KASSERT() and KASSERTMSG() tests are included only in kernels compiled with the DIAGNOSTIC configuration option. In a kernel that does not have this configuration option, the macros are defined to be no-ops. 2. The KDASSERT() and KDASSERTMSG() tests are included only in kernels compiled with the DEBUG configuration option. The KDASSERT() and KASSERT() macros are identical except for the controlling option (DEBUG vs DIAGNOSTIC). Basically, KASSERT() should be used for light-weight checks and KDASSERT() should be used for heavier ones. Callers should not rely on the side effects of expression because, depending on the kernel compile options mentioned above, expression might not be evaluated at all. The panic message will display the style of assertion (debugging vs. diagnostic), the expression that failed and the filename, and line num- ber the failure happened on. The KASSERTMSG() and KDASSERTMSG() macros append to the panic(9) format string the message specified by format and its subsequent arguments, similar to printf(9) functions. SEE ALSO
config(1), options(4), CTASSERT(9), panic(9), printf(9) AUTHORS
These macros were written by Chris G. Demetriou <cgd@netbsd.org>. BSD
September 27, 2011 BSD

Check Out this Related Man Page

PANIC(9)						   BSD Kernel Developer's Manual						  PANIC(9)

NAME
panic -- Bring down system on fatal error SYNOPSIS
#include <sys/types.h> #include <sys/systm.h> void vpanic(const char *fmt, va_list ap); void panic(const char *fmt, ...); DESCRIPTION
The panic() and vpanic() functions terminate the NetBSD system. The message fmt is a printf(3) style format string which is printed to the console and saved in the variable panicstr for later retrieval via core dump inspection. A newline character is added at the end automati- cally, and is thus not needed in the format string. If a kernel debugger is installed, control is passed to it after the message is printed. If the kernel debugger is ddb(4), control may be passed to it, depending on the value of ddb.onpanic. See options(4) for more details on setting ddb.onpanic. If control is not passed through to ddb(4), a ddb(4)-specific function is used to print the kernel stack trace, and then control returns to panic(). If control remains in panic(), an attempt is made to save an image of system memory on the configured dump device. If during the process of handling the panic, panic() is called again (from the filesystem synchronization routines, for example), the system is rebooted immediately without synchronizing any filesystems. panic() is meant to be used in situations where something unexpected has happened and it is difficult to recover the system to a stable state, or in situations where proceeding might make the things worse, leading to data corruption/loss. It is not meant to be used in scenar- ios where the system could easily ignore and/or isolate the condition/subsystem and proceed. In general developers should try to reduce the number of panic() calls in the kernel to improve stability. RETURN VALUES
The panic() function does not return. SEE ALSO
sysctl(3), ddb(4), ipkdb(4), options(4), savecore(8), swapctl(8), sysctl(8) BSD
September 29, 2011 BSD
Man Page