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.\" $DragonFly: src/share/man/man9/KASSERT.9,v 1.4 2004/07/16 05:04:36 hmp Exp $ 62.\" 63.Dd May 10, 2004 64.Os 65.Dt KASSERT 9 66.Sh NAME 67.Nm KASSERT , 68.Nm KKASSERT 69.Nd kernel expression verification macros 70.Sh SYNOPSIS 71.Cd options INVARIANTS 72.Fn KASSERT expression "const char *msg" 73.Fn KKASERT expression 74.Sh DESCRIPTION 75The macros described in this manual page are no-op unless the kernel 76is compiled with 77.Cd "options INVARIANTS" . 78.Pp 79The 80.Fn KASSERT 81macro tests the given 82.Ar expression 83and if it is false, 84the 85.Xr panic 9 86function is called to display 87.Fa msg 88and terminate the running system. 89.Pp 90The 91.Fn KKASSERT 92macro is similar to 93.Fn KASSERT , 94except it does not require a description message but instead 95displays 96.Fa expression 97and terminates the running system. 98.Sh EXAMPLES 99The kernel function 100.Fn vput 101must not be called with a NULL pointer. 102.Bd -literal -offset indent 103void 104vput(struct vnode *vp) 105{ 106 struct thread *td = curthread; 107 108 KASSERT(vp != NULL, ("vput: null vp")); 109 ... 110} 111.Ed 112.Sh SEE ALSO 113.Xr config 8 , 114.Xr panic 9 , 115.Sh AUTHORS 116.An -nosplit 117This manual page was written by 118.An Jonathan M. Bresler 119.Aq jmb@FreeBSD.org 120and modified for 121.Dx 122by 123.An Hiten Pandya Aq hmp@dragonflybsd.org . 124