OpenBSD manual page server

Manual Page Search Parameters

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

assert, KASSERT, KDASSERT, KASSERTMSG, KDASSERTMSG, CTASSERTkernel assert library routines

#include <sys/systm.h>

void
assert(CONDITION);

void
KASSERT(CONDITION);

void
KDASSERT(CONDITION);

void
KASSERTMSG(CONDITION, fmt, ...);

void
KDASSERTMSG(CONDITION, fmt, ...);

void
CTASSERT(CONDITION);

The kernel library implements a set of useful functions and macros implementing expression verification.

These macros cause kernel panic(9) if the given condition evaluates to false. () tests are always compiled in. () and () tests are only included if the kernel has DIAGNOSTIC enabled. () and () tests are only included if the kernel has DEBUG enabled. 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.

() causes a compile time error if the given condition evaluates to false. Its main purpose is to verify assertions about type and struct sizes that would otherwise make the code fail at run time. CTASSERT() can be used in global scope or at the start of blocks, where variable declarations are allowed.

assert(3), panic(9)

The KASSERTMSG() and KDASSERTMSG() macros are taken from NetBSD.

May 10, 2019 OpenBSD-current