KASSERT(9freebsd)

KASSERT9freebsd

Kernel expression verification macro

Usage

options INVARIANTS

#include <sys/param.h>

#include <sys/systm.h>

KASSERT(expression, msg);

Overview

In a kernel compiled with options INVARIANTS, the KASSERT() macro tests the given expression and if it is false, calls the panic(9) function, terminating the running system.

In a kernel that does not have options INVARIANTS, the KASSERT() macro is defined to be a no-op. The second argument is a printf(9) format string and its arguments, enclosed in parentheses.

Examples

The kernel function vput() must not be called with a NULL pointer.

void
vput(vp)
        struct vnode *vp;
{
	struct proc *p = curproc;
	KASSERT(vp != NULL, ("vput: null vp"));
	...
}

Releases

9 releases since Debian 5.0 (Lenny); the text changed 6 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9
  6. 10
  7. 11–13

Authors

This manual page was written by Jonathan M. Bresler ⟨[email protected]⟩.

From freebsd-manpages 12.2-2 in Debian 13 (Trixie). Parsed by carta from the page's mdoc source.