KASSERT(9) BSD Kernel Developer's Manual KASSERT(9)NAME
KASSERT, KKASSERT — kernel expression verification macros
SYNOPSIS
options INVARIANTS
KASSERT(expression, const char *msg);
KKASSERT(expression);
DESCRIPTION
The macros described in this manual page are no-op unless the kernel is
compiled with options INVARIANTS.
The KASSERT() macro tests the given expression and if it is false, the
panic(9) function is called to display msg and terminate the running sys‐
tem.
The KKASSERT() macro is similar to KASSERT(), except it does not require
a description message but instead displays expression and terminates the
running system.
EXAMPLES
The kernel function vput() must not be called with a NULL pointer.
void
vput(struct vnode *vp)
{
struct thread *td = curthread;
KASSERT(vp != NULL, ("vput: null vp"));
...
}
SEE ALSOconfig(8), panic(9)AUTHORS
This manual page was written by Jonathan M. Bresler ⟨jmb@FreeBSD.org⟩ and
modified for DragonFly by Hiten Pandya ⟨hmp@dragonflybsd.org⟩.
BSD May 10, 2004 BSD