5 #include <minix/sysutil.h>
9 /*===========================================================================*
11 *===========================================================================*/
12 PUBLIC
void panic(const char *fmt
, ...)
14 /* Something awful has happened. Panics are caused when an internal
15 * inconsistency is detected, e.g., a programming error or illegal
16 * value of a defined constant.
20 void (*suicide
)(void);
21 static int panicing
= 0;
27 if(sys_whoami(&me
, name
, sizeof(name
)) == OK
&& me
!= NONE
)
28 printf("%s(%d): panic: ", name
, me
);
30 printf("(sys_whoami failed): panic: ");
37 printf("no message\n");
41 printf("syslib:panic.c: stacktrace: ");
47 /* Try to signal ourself */
50 /* If exiting nicely through PM fails for some reason, try to
51 * commit suicide. E.g., message to PM might fail due to deadlock.
53 suicide
= (void (*)(void)) -1;
56 /* If committing suicide fails for some reason, hang. */