logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

KASSERT — kernel expression verification macro

Authors

       This manual page was written by Jonathan M. Bresler <jmb@FreeBSD.org>.

Debian                                          January 14, 2000                                      KASSERT(9)

Description

       In a kernel compiled with optionsINVARIANTS, 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 optionsINVARIANTS, 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"));
                     ...
             }

Name

       KASSERT — kernel expression verification macro

See Also

config(8), panic(9)

Synopsis

optionsINVARIANTS#include<sys/param.h>#include<sys/systm.h>KASSERT(expression, msg);

See Also