minix/kernel/utility.c

28 lines
776 B
C
Raw Normal View History

2005-04-21 16:53:53 +02:00
/* This file contains a collection of miscellaneous procedures:
* panic: abort MINIX due to a fatal error
2005-04-21 16:53:53 +02:00
*/
#include "kernel.h"
#include <unistd.h>
/*===========================================================================*
2005-09-11 18:44:06 +02:00
* panic *
2005-04-21 16:53:53 +02:00
*===========================================================================*/
PUBLIC void panic(mess,nr)
_CONST char *mess;
int nr;
2005-04-21 16:53:53 +02:00
{
/* The system has run aground of a fatal kernel error. Terminate execution. */
2005-04-21 16:53:53 +02:00
static int panicking = 0;
if (panicking ++) return; /* prevent recursive panics */
2005-04-21 16:53:53 +02:00
if (mess != NULL) {
kprintf("\nKernel panic: %s", mess);
if (nr != NO_NUM) kprintf(" %d", nr);
kprintf("\n",NO_NUM);
2005-04-21 16:53:53 +02:00
}
/* Abort MINIX. */
prepare_shutdown(RBT_PANIC);
2005-04-21 16:53:53 +02:00
}