1 1.7 joerg /* $NetBSD: panic.c,v 1.7 2011/07/17 20:54:52 joerg Exp $ */ 2 1.1 drochner 3 1.1 drochner /*- 4 1.1 drochner * Copyright (c) 1993 John Brezak 5 1.1 drochner * All rights reserved. 6 1.4 perry * 7 1.1 drochner * Redistribution and use in source and binary forms, with or without 8 1.1 drochner * modification, are permitted provided that the following conditions 9 1.1 drochner * are met: 10 1.1 drochner * 1. Redistributions of source code must retain the above copyright 11 1.1 drochner * notice, this list of conditions and the following disclaimer. 12 1.1 drochner * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 drochner * notice, this list of conditions and the following disclaimer in the 14 1.1 drochner * documentation and/or other materials provided with the distribution. 15 1.1 drochner * 3. The name of the author may not be used to endorse or promote products 16 1.1 drochner * derived from this software without specific prior written permission. 17 1.4 perry * 18 1.1 drochner * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 19 1.1 drochner * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 1.1 drochner * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 1.1 drochner * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 22 1.1 drochner * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 1.1 drochner * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 1.1 drochner * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 1.1 drochner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 1.1 drochner * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 1.1 drochner * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 1.1 drochner * POSSIBILITY OF SUCH DAMAGE. 29 1.1 drochner */ 30 1.7 joerg #include <sys/stdarg.h> 31 1.1 drochner 32 1.1 drochner #include "stand.h" 33 1.1 drochner 34 1.1 drochner __dead void 35 1.1 drochner panic(const char *fmt, ...) 36 1.1 drochner { 37 1.6 isaki va_list ap; 38 1.3 dsl #ifndef LIBSA_NO_FS_CLOSE 39 1.6 isaki static int paniced; 40 1.4 perry 41 1.6 isaki if (!paniced) { 42 1.6 isaki paniced = 1; 43 1.6 isaki closeall(); 44 1.6 isaki } 45 1.2 christos #endif 46 1.1 drochner 47 1.6 isaki va_start(ap, fmt); 48 1.6 isaki vprintf(fmt, ap); 49 1.6 isaki printf("\n"); 50 1.6 isaki va_end(ap); 51 1.6 isaki _rtt(); 52 1.6 isaki /*NOTREACHED*/ 53 1.1 drochner } 54