5 #include <minix/sysutil.h>
9 /*===========================================================================*
11 *===========================================================================*/
12 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.
21 void (*suicide
)(void);
24 if(sys_whoami(&me
, name
, sizeof(name
), &priv_flags
) == OK
&& me
!= NONE
)
25 printf("%s(%d): panic: ", name
, me
);
27 printf("(sys_whoami failed): panic: ");
34 printf("no message\n");
38 printf("syslib:panic.c: stacktrace: ");
45 /* Try to signal ourself */
49 /* If exiting nicely through PM fails for some reason, try to
50 * commit suicide. E.g., message to PM might fail due to deadlock.
52 suicide
= (void (*)(void)) -1;
55 /* If committing suicide fails for some reason, hang. */