explanations with common test3 errors.
[minix3.git] / lib / syslib / panic.c
blobdae8adbccdbb8c51dfdf69d402c4a49575618385
1 #include <stdlib.h>
2 #include <signal.h>
3 #include <minix/sysutil.h>
5 #include "syslib.h"
7 int panicing= 0;
9 /*===========================================================================*
10 * panic *
11 *===========================================================================*/
12 PUBLIC void panic(who, mess, num)
13 char *who; /* server identification */
14 char *mess; /* message format string */
15 int num; /* number to go with format string */
17 /* Something awful has happened. Panics are caused when an internal
18 * inconsistency is detected, e.g., a programming error or illegal
19 * value of a defined constant.
21 message m;
22 void (*suicide)(void);
24 panicing= 1;
25 if (NULL != who && NULL != mess) {
26 if (num != NO_NUM) {
27 printf("Panic in %s: %s: %d\n", who, mess, num);
28 } else {
29 printf("Panic in %s: %s\n", who, mess);
33 /* If exiting nicely through PM fails for some reason, try to
34 * commit suicide. E.g., message to PM might fail due to deadlock.
36 suicide = (void (*)(void)) -1;
37 suicide();
39 /* If committing suicide fails for some reason, hang. */
40 for(;;) { }