1*3bb0445aSchs /* $NetBSD: kern_assert.c,v 1.5 2021/12/13 01:33:32 chs Exp $ */
2654415b2Spooka
3654415b2Spooka /*
4654415b2Spooka * Copyright (c) 1996 Christopher G. Demetriou
5654415b2Spooka * All rights reserved.
6654415b2Spooka *
7654415b2Spooka * Redistribution and use in source and binary forms, with or without
8654415b2Spooka * modification, are permitted provided that the following conditions
9654415b2Spooka * are met:
10654415b2Spooka * 1. Redistributions of source code must retain the above copyright
11654415b2Spooka * notice, this list of conditions and the following disclaimer.
12654415b2Spooka * 2. Redistributions in binary form must reproduce the above copyright
13654415b2Spooka * notice, this list of conditions and the following disclaimer in the
14654415b2Spooka * documentation and/or other materials provided with the distribution.
15654415b2Spooka * 3. All advertising materials mentioning features or use of this software
16654415b2Spooka * must display the following acknowledgement:
17654415b2Spooka * This product includes software developed by Christopher G. Demetriou
18654415b2Spooka * for the NetBSD Project.
19654415b2Spooka * 4. The name of the author may not be used to endorse or promote products
20654415b2Spooka * derived from this software without specific prior written permission
21654415b2Spooka *
22654415b2Spooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23654415b2Spooka * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24654415b2Spooka * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25654415b2Spooka * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26654415b2Spooka * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27654415b2Spooka * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28654415b2Spooka * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29654415b2Spooka * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30654415b2Spooka * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31654415b2Spooka * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32654415b2Spooka */
33654415b2Spooka
34654415b2Spooka #include <sys/types.h>
35654415b2Spooka #include <sys/systm.h>
36654415b2Spooka
37654415b2Spooka #ifdef _STANDALONE
38654415b2Spooka #include <lib/libkern/libkern.h>
39654415b2Spooka #endif
40654415b2Spooka
41ff19ecf7Schristos /* coverity[+kill] */
42654415b2Spooka void
kern_assert(const char * fmt,...)43b3bf6991Schristos kern_assert(const char *fmt, ...)
44654415b2Spooka {
45b3bf6991Schristos va_list ap;
46654415b2Spooka #ifdef _KERNEL
47654415b2Spooka if (panicstr != NULL)
48654415b2Spooka return;
49654415b2Spooka #endif
50b3bf6991Schristos va_start(ap, fmt);
51b3bf6991Schristos vpanic(fmt, ap);
52b3bf6991Schristos va_end(ap);
53654415b2Spooka }
54