xref: /freebsd/stand/libsa/panic.c (revision ca987d4641cdcd7f27e153db17c5bf064934faf5)
1*ca987d46SWarner Losh /*
2*ca987d46SWarner Losh  * $NetBSD: panic.c,v 1.2 1997/03/22 01:48:36 thorpej Exp $
3*ca987d46SWarner Losh  */
4*ca987d46SWarner Losh /*-
5*ca987d46SWarner Losh  * Copyright (c) 1996
6*ca987d46SWarner Losh  *	Matthias Drochner.  All rights reserved.
7*ca987d46SWarner Losh  *
8*ca987d46SWarner Losh  * Redistribution and use in source and binary forms, with or without
9*ca987d46SWarner Losh  * modification, are permitted provided that the following conditions
10*ca987d46SWarner Losh  * are met:
11*ca987d46SWarner Losh  * 1. Redistributions of source code must retain the above copyright
12*ca987d46SWarner Losh  *    notice, this list of conditions and the following disclaimer.
13*ca987d46SWarner Losh  * 2. Redistributions in binary form must reproduce the above copyright
14*ca987d46SWarner Losh  *    notice, this list of conditions and the following disclaimer in the
15*ca987d46SWarner Losh  *    documentation and/or other materials provided with the distribution.
16*ca987d46SWarner Losh  * 3. All advertising materials mentioning features or use of this software
17*ca987d46SWarner Losh  *    must display the following acknowledgement:
18*ca987d46SWarner Losh  *	This product includes software developed for the NetBSD Project
19*ca987d46SWarner Losh  *	by Matthias Drochner.
20*ca987d46SWarner Losh  * 4. The name of the author may not be used to endorse or promote products
21*ca987d46SWarner Losh  *    derived from this software without specific prior written permission.
22*ca987d46SWarner Losh  *
23*ca987d46SWarner Losh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24*ca987d46SWarner Losh  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25*ca987d46SWarner Losh  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26*ca987d46SWarner Losh  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27*ca987d46SWarner Losh  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28*ca987d46SWarner Losh  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29*ca987d46SWarner Losh  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30*ca987d46SWarner Losh  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31*ca987d46SWarner Losh  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32*ca987d46SWarner Losh  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*ca987d46SWarner Losh  *
34*ca987d46SWarner Losh  */
35*ca987d46SWarner Losh 
36*ca987d46SWarner Losh #include <sys/cdefs.h>
37*ca987d46SWarner Losh __FBSDID("$FreeBSD$");
38*ca987d46SWarner Losh 
39*ca987d46SWarner Losh #include <stand.h>
40*ca987d46SWarner Losh #include <machine/stdarg.h>
41*ca987d46SWarner Losh 
42*ca987d46SWarner Losh extern void exit(int) __dead2;
43*ca987d46SWarner Losh 
44*ca987d46SWarner Losh void
45*ca987d46SWarner Losh panic(const char *fmt,...)
46*ca987d46SWarner Losh {
47*ca987d46SWarner Losh 	va_list         ap;
48*ca987d46SWarner Losh 
49*ca987d46SWarner Losh 	printf("panic: ");
50*ca987d46SWarner Losh 	va_start(ap, fmt);
51*ca987d46SWarner Losh 	vprintf(fmt, ap);
52*ca987d46SWarner Losh 	va_end(ap);
53*ca987d46SWarner Losh 	printf("\n");
54*ca987d46SWarner Losh 
55*ca987d46SWarner Losh 	printf("--> Press a key on the console to reboot <--\n");
56*ca987d46SWarner Losh 	getchar();
57*ca987d46SWarner Losh 	printf("Rebooting...\n");
58*ca987d46SWarner Losh 	exit(1);
59*ca987d46SWarner Losh }
60