84 lines
2.4 KiB
Groff
84 lines
2.4 KiB
Groff
.\" -*- nroff -*-
|
|
.\"
|
|
.\" Copyright (c) 2000 Jonathan M. Bresler
|
|
.\"
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" This program is free software.
|
|
.\"
|
|
.\" 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.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
|
|
.\"
|
|
.\" %FreeBSD: src/share/man/man9/KASSERT.9,v 1.12 2003/05/16 19:54:20 hmp Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd January 14, 2000
|
|
.Os
|
|
.Dt KASSERT 9
|
|
.Sh 名称
|
|
.Nm KASSERT
|
|
.Nd カーネル数式検証マクロ
|
|
.Sh 書式
|
|
.Cd "options INVARIANTS"
|
|
.Pp
|
|
.In sys/param.h
|
|
.In sys/systm.h
|
|
.Fn KASSERT expression msg
|
|
.Sh 解説
|
|
.Cd "options INVARIANTS"
|
|
オプション付きでコンパイルされたカーネル内では、
|
|
.Fn KASSERT
|
|
マクロは与えられた数式
|
|
.Fa expression
|
|
をテストし、それが偽である場合には
|
|
.Xr panic 9
|
|
関数を呼び出し、稼働中のシステムを停止させます。
|
|
.Pp
|
|
.Cd "options INVARIANTS"
|
|
オプションの無いカーネル内では、
|
|
.Fn KASSERT
|
|
マクロは何もしない様に定義されます。
|
|
第 2 引数は、
|
|
.Xr printf 9
|
|
フォーマット文字列とその引数を括弧に括ったものです。
|
|
.Sh 使用例
|
|
カーネル関数
|
|
.Fn vput
|
|
は、
|
|
.Dv NULL
|
|
ポインタを引数として呼び出されてはなりません。
|
|
.Bd -literal -offset indent
|
|
void
|
|
vput(vp)
|
|
struct vnode *vp;
|
|
{
|
|
struct proc *p = curproc;
|
|
KASSERT(vp != NULL, ("vput: null vp"));
|
|
...
|
|
}
|
|
.Ed
|
|
.Sh 関連項目
|
|
.Xr config 8 ,
|
|
.Xr panic 9
|
|
.Sh 作者
|
|
このマニュアルページは
|
|
.An Jonathan M. Bresler
|
|
.Aq jmb@FreeBSD.org
|
|
が書きました。
|