nrelease - fix/improve livecd
[dragonfly.git] / share / man / man9 / KASSERT.9
1 .\"
2 .\" Copyright (c) 2004 The DragonFly Project.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to The DragonFly Project
5 .\" by Hiten Pandya <hmp@backplane.com>.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in
15 .\"    the documentation and/or other materials provided with the
16 .\"    distribution.
17 .\" 3. Neither the name of The DragonFly Project nor the names of its
18 .\"    contributors may be used to endorse or promote products derived
19 .\"    from this software without specific, prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .\" Copyright (c) 2000 Jonathan M. Bresler
35 .\"
36 .\" All rights reserved.
37 .\"
38 .\" This program is free software.
39 .\"
40 .\" Redistribution and use in source and binary forms, with or without
41 .\" modification, are permitted provided that the following conditions
42 .\" are met:
43 .\" 1. Redistributions of source code must retain the above copyright
44 .\"    notice, this list of conditions and the following disclaimer.
45 .\" 2. Redistributions in binary form must reproduce the above copyright
46 .\"    notice, this list of conditions and the following disclaimer in the
47 .\"    documentation and/or other materials provided with the distribution.
48 .\"
49 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
50 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
51 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
53 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
54 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
55 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
56 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
57 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
58 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 .\"
60 .\" $FreeBSD: src/share/man/man9/KASSERT.9,v 1.1.2.4 2001/07/21 09:16:54 schweikh Exp $
61 .\"
62 .Dd May 10, 2004
63 .Dt KASSERT 9
64 .Os
65 .Sh NAME
66 .Nm KASSERT ,
67 .Nm KKASSERT
68 .Nd kernel expression verification macros
69 .Sh SYNOPSIS
70 .Cd options INVARIANTS
71 .Fn KASSERT expression "const char *msg"
72 .Fn KKASSERT expression
73 .Sh DESCRIPTION
74 The macros described in this manual page are no-op unless the kernel
75 is compiled with
76 .Cd "options INVARIANTS" .
77 .Pp
78 The
79 .Fn KASSERT
80 macro tests the given
81 .Ar expression
82 and if it is false,
83 the
84 .Xr panic 9
85 function is called to display
86 .Fa msg
87 and terminate the running system.
88 .Pp
89 The
90 .Fn KKASSERT
91 macro is similar to
92 .Fn KASSERT ,
93 except it does not require a description message but instead
94 displays
95 .Fa expression
96 and terminates the running system.
97 .Sh EXAMPLES
98 The kernel function
99 .Fn vput
100 must not be called with a NULL pointer.
101 .Bd -literal -offset indent
102 void
103 vput(struct vnode *vp)
104 {
105         struct thread *td = curthread;
106
107         KASSERT(vp != NULL, ("vput: null vp"));
108         ...
109 }
110 .Ed
111 .Sh SEE ALSO
112 .Xr panic 9
113 .Sh AUTHORS
114 .An -nosplit
115 This manual page was written by
116 .An Jonathan M. Bresler Aq Mt jmb@FreeBSD.org
117 and modified for
118 .Dx
119 by
120 .An Hiten Pandya Aq Mt hmp@dragonflybsd.org .