From 36e8c1a185fe698f1ad2149f58a1dad46333ac13 Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Wed, 15 Mar 2006 12:06:18 +0000 Subject: [PATCH] Added assert to syslib. Moved panic from sysutil to syslib for assert. Panic now tries sys_kill with SIGKILL first. --- lib/syslib/Makefile.in | 2 ++ lib/syslib/assert.c | 14 ++++++++++++++ lib/{sysutil => syslib}/panic.c | 8 +++++--- lib/sysutil/Makefile.in | 1 - 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 lib/syslib/assert.c rename lib/{sysutil => syslib}/panic.c (89%) diff --git a/lib/syslib/Makefile.in b/lib/syslib/Makefile.in index 295286dda..11215b999 100644 --- a/lib/syslib/Makefile.in +++ b/lib/syslib/Makefile.in @@ -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 index 000000000..22f312532 --- /dev/null +++ b/lib/syslib/assert.c @@ -0,0 +1,14 @@ +/* + * assert.c - diagnostics + */ + +#include +#include +#include +#include +#include + +void __bad_assertion(const char *mess) { + printf("%s", mess); + panic(NULL, NULL, NO_NUM); +} diff --git a/lib/sysutil/panic.c b/lib/syslib/panic.c similarity index 89% rename from lib/sysutil/panic.c rename to lib/syslib/panic.c index b08621e45..72d732907 100644 --- a/lib/sysutil/panic.c +++ b/lib/syslib/panic.c @@ -1,6 +1,8 @@ #include +#include +#include -#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. diff --git a/lib/sysutil/Makefile.in b/lib/sysutil/Makefile.in index c6254554d..06cd6d32f 100644 --- a/lib/sysutil/Makefile.in +++ b/lib/sysutil/Makefile.in @@ -15,7 +15,6 @@ libsysutil_FILES=" \ env_panic.c \ env_prefix.c \ fkey_ctl.c \ - panic.c \ report.c \ taskcall.c" -- 2.44.0