From 9d096e014bc12fa64a984f0a3d0111396ba3ab22 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 11 Dec 2008 14:23:58 +0000 Subject: [PATCH] . print kernel stacktrace unconditionally on panic . provide a panic() in the kernel for if a library function wants to panic --- kernel/utility.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/kernel/utility.c b/kernel/utility.c index b7377b1cc..9998067dd 100755 --- a/kernel/utility.c +++ b/kernel/utility.c @@ -14,6 +14,21 @@ #include #include +/*===========================================================================* + * panic * + *===========================================================================*/ +PUBLIC void panic(what, mess,nr) +char *what; +char *mess; +int nr; +{ +/* This function is for when a library call wants to panic. + * The library call calls printf() and tries to exit a process, + * which isn't applicable in the kernel. + */ + minix_panic(mess, nr); +} + /*===========================================================================* * minix_panic * *===========================================================================*/ @@ -29,10 +44,11 @@ int nr; if(nr != NO_NUM) kprintf(" %d", nr); kprintf("\n"); - kprintf("kernel stacktrace: "); - util_stacktrace(); } + kprintf("kernel stacktrace: "); + util_stacktrace(); + /* Abort MINIX. */ minix_shutdown(NULL); }