]> Zhao Yanbai Git Server - minix.git/commitdiff
Added assert to syslib. Moved panic from sysutil to syslib for assert.
authorPhilip Homburg <philip@cs.vu.nl>
Wed, 15 Mar 2006 12:06:18 +0000 (12:06 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Wed, 15 Mar 2006 12:06:18 +0000 (12:06 +0000)
Panic now tries sys_kill with SIGKILL first.

lib/syslib/Makefile.in
lib/syslib/assert.c [new file with mode: 0644]
lib/syslib/panic.c [moved from lib/sysutil/panic.c with 89% similarity]
lib/sysutil/Makefile.in

index 295286ddad915963691ad5155a9fc01b520fa78a..11215b9996867267aa8761806926a2b298e6d419 100644 (file)
@@ -5,6 +5,8 @@ CFLAGS="-O -D_MINIX -D_POSIX_SOURCE"
 LIBRARIES=libsys
 
 libsys_FILES=" \
+       assert.c \
+       panic.c \
        pci_attr_r16.c \
        pci_attr_r32.c \
        pci_attr_r8.c \
diff --git a/lib/syslib/assert.c b/lib/syslib/assert.c
new file mode 100644 (file)
index 0000000..22f3125
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * assert.c - diagnostics
+ */
+
+#include       <assert.h>
+#include       <stdio.h>
+#include       <minix/config.h>
+#include       <minix/const.h>
+#include       <minix/sysutil.h>
+
+void __bad_assertion(const char *mess) {
+       printf("%s", mess);
+       panic(NULL, NULL, NO_NUM);
+}
similarity index 89%
rename from lib/sysutil/panic.c
rename to lib/syslib/panic.c
index b08621e45b8c696f3ae0b8e08145c80fdbf01295..72d7329073e074e73fed35609e2a633af5a1c2d8 100644 (file)
@@ -1,6 +1,8 @@
 #include <stdlib.h>
+#include <signal.h>
+#include <minix/sysutil.h>
 
-#include "sysutil.h"
+#include "syslib.h"
 
 int panicing= 0;
 
@@ -28,8 +30,8 @@ int num;                      /* number to go with format string */
       }
   }
 
-  /* Exit nicely through PM. */
-  exit(1);
+  /* Try to signal ourself */
+  sys_kill(SELF, SIGKILL);
 
   /* If exiting nicely through PM fails for some reason, try to
    * commit suicide. E.g., message to PM might fail due to deadlock.
index c6254554dfaf4ed9d2764c7b7eb50550fc8dd039..06cd6d32fd88195edc5b1033d2e7bcd9e08e3a1b 100644 (file)
@@ -15,7 +15,6 @@ libsysutil_FILES=" \
        env_panic.c \
        env_prefix.c \
        fkey_ctl.c \
-       panic.c \
        report.c \
        taskcall.c"