2006-07-30 04:20:06 +04:00
|
|
|
.\" $NetBSD: KASSERT.9,v 1.2 2006/07/30 00:20:06 wiz Exp $
|
2006-07-27 04:00:56 +04:00
|
|
|
.\"
|
|
|
|
.\" 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 April 17, 2006
|
|
|
|
.Dt KASSERT 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm KASSERT ,
|
|
|
|
.Nm KDASSERT
|
|
|
|
.Nd kernel expression verification macros
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Ft void
|
|
|
|
.Fn KASSERT expression msg
|
|
|
|
.Ft void
|
|
|
|
.Fn KDASSERT expression msg
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
These machine independent assertion-checking macros cause a kernel
|
|
|
|
.Xr panic 9
|
|
|
|
if the given
|
|
|
|
.Ar expression
|
|
|
|
evaluates to false, terminating the running system.
|
|
|
|
.Pp
|
|
|
|
.Fn KASSERT
|
|
|
|
tests are included only in kernels compiled with the
|
|
|
|
.Dv DIAGNOSTIC
|
2006-07-30 04:20:06 +04:00
|
|
|
configuration option.
|
|
|
|
In a kernel that does not have this configuration option, the
|
2006-07-27 04:00:56 +04:00
|
|
|
.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 second argument to both macros, i.e.\&
|
|
|
|
.Ar msg ,
|
|
|
|
is a
|
|
|
|
.Xr printf 9
|
|
|
|
format string whose arguments are enclosed in parentheses.
|
|
|
|
.Sh SEE ALSO
|
2006-07-30 04:20:06 +04:00
|
|
|
.Xr config 1 ,
|
2006-07-27 04:00:56 +04:00
|
|
|
.Xr panic 9 ,
|
|
|
|
.Xr printf 9
|
|
|
|
.Sh AUTHORS
|
|
|
|
These macros were written by
|
2006-07-30 04:20:06 +04:00
|
|
|
.An Chris G. Demetriou
|
|
|
|
Aq cgd@netbsd.org .
|