5 #include <minix/sysutil.h>
11 __weak_alias(panic_hook
, __panic_hook
);
13 void __panic_hook(void)
18 /*===========================================================================*
20 *===========================================================================*/
21 void panic(const char *fmt
, ...)
23 /* Something awful has happened. Panics are caused when an internal
24 * inconsistency is detected, e.g., a programming error or illegal
25 * value of a defined constant.
31 void (*suicide
)(void);
34 if(sys_whoami(&me
, name
, sizeof(name
), &priv_flags
, &init_flags
) == OK
&& me
!= NONE
)
35 printf("%s(%d): panic: ", name
, me
);
37 printf("(sys_whoami failed): panic: ");
44 printf("no message\n");
48 printf("syslib:panic.c: stacktrace: ");
56 /* Try to signal ourself */
59 /* If exiting nicely through PM fails for some reason, try to
60 * commit suicide. E.g., message to PM might fail due to deadlock.
62 suicide
= (void (*)(void)) -1;
65 /* If committing suicide fails for some reason, hang. */