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