From: Ben Gras Date: Mon, 17 Oct 2005 13:19:22 +0000 (+0000) Subject: A new panic that makes processes exit with PM knowing about it, instead X-Git-Tag: v3.1.2a~621 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/syslog.3.html?a=commitdiff_plain;h=c79574aba4c8560cfcf3509efe2c8527ae0076c4;p=minix.git A new panic that makes processes exit with PM knowing about it, instead of sys_exit, so that PM functions (e.g. findproc) keep working properly, and RS finds out about process deaths. --- diff --git a/lib/sysutil/panic.c b/lib/sysutil/panic.c index 6fa0bcf63..a3a479cea 100644 --- a/lib/sysutil/panic.c +++ b/lib/sysutil/panic.c @@ -1,3 +1,5 @@ +#include + #include "sysutil.h" /*===========================================================================* @@ -13,6 +15,7 @@ int num; /* number to go with format string */ * value of a defined constant. */ message m; + void (*suicide)(void); if (NULL != who && NULL != mess) { if (num != NO_NUM) { printf("Panic in %s: %s: %d\n", who, mess, num); @@ -21,8 +24,16 @@ int num; /* number to go with format string */ } } - m.PR_PROC_NR = SELF; - _taskcall(SYSTASK, SYS_EXIT, &m); - /* never reached */ + /* Exit nicely through PM. */ + exit(1); + + /* If exiting nicely through PM fails for some reason, try to + * commit suicide. E.g., message to PM might fail due to deadlock. + */ + suicide = (void (*)(void)) -1; + suicide(); + + /* If committing suicide fails for some reason, hang. */ + for(;;) { } }