2005-04-21 16:53:53 +02:00
|
|
|
/* This file contains a collection of miscellaneous procedures:
|
2005-08-04 11:26:36 +02:00
|
|
|
* 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
|
|
|
*===========================================================================*/
|
2005-07-20 17:25:38 +02:00
|
|
|
PUBLIC void panic(mess,nr)
|
|
|
|
_CONST char *mess;
|
|
|
|
int nr;
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
2005-06-07 14:34:25 +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;
|
2005-07-19 14:21:36 +02:00
|
|
|
if (panicking ++) return; /* prevent recursive panics */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2005-07-20 17:25:38 +02:00
|
|
|
if (mess != NULL) {
|
|
|
|
kprintf("\nKernel panic: %s", mess);
|
|
|
|
if (nr != NO_NUM) kprintf(" %d", nr);
|
2005-06-17 11:09:54 +02:00
|
|
|
kprintf("\n",NO_NUM);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
2005-07-21 20:36:40 +02:00
|
|
|
|
2005-07-27 16:32:16 +02:00
|
|
|
/* Abort MINIX. */
|
|
|
|
prepare_shutdown(RBT_PANIC);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|