From e8aec69c7b96468e2e8b6d9f6b3837e64bc280e9 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 23 Oct 2007 14:17:51 +0000 Subject: [PATCH] tweak to panic functions of mfs and vfs. . print newline . when recursive panic detected, don't simply return, confusing the caller, but print a diagnostic and exit . don't call sys_exit as this may confuse PM; it should be OK to call PM exit() nowadays. --- servers/mfs/utility.c | 15 +++++++++------ servers/vfs/utility.c | 29 +++++++++++++---------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/servers/mfs/utility.c b/servers/mfs/utility.c index 0eda1994f..f4af5cfd8 100644 --- a/servers/mfs/utility.c +++ b/servers/mfs/utility.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "buf.h" #include "inode.h" @@ -35,13 +36,15 @@ int num; /* number to go with it */ * inconsistency is detected, e.g., a programming error or illegal value of a * defined constant. */ - if (panicking) return; /* do not panic during a sync */ - panicking = TRUE; /* prevent another panic during the sync */ + if (!panicking) { /* do not panic during a sync */ + panicking = TRUE; /* prevent another panic during the sync */ - printf("FS panic (%s): %s ", who, mess); - if (num != NO_NUM) printf("%d",num); - (void) fs_sync(); /* flush everything to the disk */ - sys_exit(SELF); + printf("MFS panic (%s): %s ", who, mess); + if (num != NO_NUM) printf("%d",num); + printf("\n"); + (void) fs_sync(); /* flush everything to the disk */ + } else printf("MFS re-panic\n"); + exit(1); } /*===========================================================================* diff --git a/servers/vfs/utility.c b/servers/vfs/utility.c index a3e893409..8e62473f0 100644 --- a/servers/vfs/utility.c +++ b/servers/vfs/utility.c @@ -88,27 +88,24 @@ PUBLIC int no_sys() } /*===========================================================================* - * panic * + * panic * *===========================================================================*/ PUBLIC void panic(who, mess, num) -char *who; /* who caused the panic */ -char *mess; /* panic message string */ -int num; /* number to go with it */ +char *who; /* who caused the panic */ +char *mess; /* panic message string */ +int num; /* number to go with it */ { -/* Something awful has happened. Panics are caused when an internal - * inconsistency is detected, e.g., a programming error or illegal value of a - * defined constant. - */ - if (panicking) return; /* do not panic during a sync */ - panicking = TRUE; /* prevent another panic during the sync */ - - printf("VFS panic (%s): %s ", who, mess); - if (num != NO_NUM) printf("%d",num); - (void) do_sync(); /* flush everything to the disk */ - sys_exit(SELF); + if (!panicking) { /* do not panic during a sync */ + panicking = TRUE; /* prevent another panic during the sync */ + + printf("VFS panic (%s): %s ", who, mess); + if (num != NO_NUM) printf("%d",num); + printf("\n"); + (void) do_sync(); /* flush everything to the disk */ + } else printf("VFS re-panic\n"); + exit(1); } - /*===========================================================================* * isokendpt_f * *===========================================================================*/ -- 2.44.0