Home | History | Annotate | Line # | Download | only in libsa
panic.c revision 1.5.46.1
      1  1.5.46.1      matt /*	$NetBSD: panic.c,v 1.5.46.1 2008/01/09 01:56:43 matt 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.1  drochner #ifdef __STDC__
     31       1.1  drochner #include <machine/stdarg.h>
     32       1.1  drochner #else
     33       1.1  drochner #include <machine/varargs.h>
     34       1.1  drochner #endif
     35       1.1  drochner 
     36       1.1  drochner #include "stand.h"
     37       1.1  drochner 
     38       1.1  drochner __dead void
     39       1.1  drochner #ifdef __STDC__
     40       1.1  drochner panic(const char *fmt, ...)
     41       1.1  drochner #else
     42       1.1  drochner panic(fmt /*, va_alist */)
     43       1.1  drochner 	char *fmt;
     44       1.1  drochner #endif
     45       1.1  drochner {
     46  1.5.46.1      matt 	va_list ap;
     47       1.3       dsl #ifndef LIBSA_NO_FS_CLOSE
     48  1.5.46.1      matt 	static int paniced;
     49       1.4     perry 
     50  1.5.46.1      matt 	if (!paniced) {
     51  1.5.46.1      matt 		paniced = 1;
     52  1.5.46.1      matt 		closeall();
     53  1.5.46.1      matt 	}
     54       1.2  christos #endif
     55       1.1  drochner 
     56       1.1  drochner #ifdef __STDC__
     57  1.5.46.1      matt 	va_start(ap, fmt);
     58       1.1  drochner #else
     59  1.5.46.1      matt 	va_start(ap);
     60       1.1  drochner #endif
     61  1.5.46.1      matt 	vprintf(fmt, ap);
     62  1.5.46.1      matt 	printf("\n");
     63  1.5.46.1      matt 	va_end(ap);
     64  1.5.46.1      matt 	_rtt();
     65  1.5.46.1      matt 	/*NOTREACHED*/
     66       1.1  drochner }
     67