NetBSD/share/man/man9/KASSERT.9

83 lines
2.8 KiB
Groff

.\" $NetBSD: KASSERT.9,v 1.3 2006/12/10 23:03:03 pooka Exp $
.\"
.\" Copyright (c) 2006 Igor Sobrado
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Matt THomas.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 10, 2006
.Dt KASSERT 9
.Os
.Sh NAME
.Nm KASSERT ,
.Nm KDASSERT
.Nd kernel expression verification macros
.Sh SYNOPSIS
.Ft void
.Fn KASSERT expression
.Ft void
.Fn KDASSERT expression
.Sh DESCRIPTION
These machine independent assertion-checking macros cause a kernel
.Xr panic 9
if the given
.Ar expression
evaluates to false.
.Pp
.Fn KASSERT
tests are included only in kernels compiled with the
.Dv DIAGNOSTIC
configuration option.
In a kernel that does not have this configuration option, the
.Fn KASSERT
macro is defined to be a no-op.
.Pp
.Fn KDASSERT
tests are included in only kernels that has been compiled with the
.Dv DEBUG
configuration option.
.Fn KDASSERT
and
.Fn KASSERT
are identical except for the controlling option
.Pf ( Dv DEBUG
vs
.Dv DIAGNOSTIC ) .
.Pp
The panic message will display the style of assertion (debugging
vs. diagnostic), the expression that failed and the filename, and line
number the failure happened on.
.Sh SEE ALSO
.Xr config 1 ,
.Xr panic 9 ,
.Xr printf 9
.Sh AUTHORS
These macros were written by
.An Chris G. Demetriou
.Aq cgd@netbsd.org .