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.
This commit is contained in:
Ben Gras 2007-10-23 14:17:51 +00:00
parent 515e8216e1
commit e8aec69c7b
2 changed files with 21 additions and 21 deletions

View File

@ -4,6 +4,7 @@
#include <string.h> #include <string.h>
#include <minix/com.h> #include <minix/com.h>
#include <minix/callnr.h> #include <minix/callnr.h>
#include <stdlib.h>
#include "buf.h" #include "buf.h"
#include "inode.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 * inconsistency is detected, e.g., a programming error or illegal value of a
* defined constant. * defined constant.
*/ */
if (panicking) return; /* do not panic during a sync */ if (!panicking) { /* do not panic during a sync */
panicking = TRUE; /* prevent another panic during the sync */ panicking = TRUE; /* prevent another panic during the sync */
printf("FS panic (%s): %s ", who, mess); printf("MFS panic (%s): %s ", who, mess);
if (num != NO_NUM) printf("%d",num); if (num != NO_NUM) printf("%d",num);
(void) fs_sync(); /* flush everything to the disk */ printf("\n");
sys_exit(SELF); (void) fs_sync(); /* flush everything to the disk */
} else printf("MFS re-panic\n");
exit(1);
} }
/*===========================================================================* /*===========================================================================*

View File

@ -88,27 +88,24 @@ PUBLIC int no_sys()
} }
/*===========================================================================* /*===========================================================================*
* panic * * panic *
*===========================================================================*/ *===========================================================================*/
PUBLIC void panic(who, mess, num) PUBLIC void panic(who, mess, num)
char *who; /* who caused the panic */ char *who; /* who caused the panic */
char *mess; /* panic message string */ char *mess; /* panic message string */
int num; /* number to go with it */ int num; /* number to go with it */
{ {
/* Something awful has happened. Panics are caused when an internal if (!panicking) { /* do not panic during a sync */
* inconsistency is detected, e.g., a programming error or illegal value of a panicking = TRUE; /* prevent another panic during the sync */
* 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); printf("VFS panic (%s): %s ", who, mess);
if (num != NO_NUM) printf("%d",num); if (num != NO_NUM) printf("%d",num);
(void) do_sync(); /* flush everything to the disk */ printf("\n");
sys_exit(SELF); (void) do_sync(); /* flush everything to the disk */
} else printf("VFS re-panic\n");
exit(1);
} }
/*===========================================================================* /*===========================================================================*
* isokendpt_f * * isokendpt_f *
*===========================================================================*/ *===========================================================================*/