diff options
author | Zheng Da <zhengda1936@gmail.com> | 2009-12-03 16:46:34 +0100 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2009-12-03 16:46:34 +0100 |
commit | b6bc230f90c7ca641f4555647649bdf681a268c1 (patch) | |
tree | e99fe924889362233e0c17e42b5bfe8948a800b7 /libddekit/include/ddekit | |
parent | 09b6164c0b107cae65a48c2e070c83a4da676bec (diff) |
Implement panic.
Diffstat (limited to 'libddekit/include/ddekit')
-rw-r--r-- | libddekit/include/ddekit/panic.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/libddekit/include/ddekit/panic.h b/libddekit/include/ddekit/panic.h index 1468675f..11c46ebb 100644 --- a/libddekit/include/ddekit/panic.h +++ b/libddekit/include/ddekit/panic.h @@ -3,14 +3,29 @@ /** \defgroup DDEKit_util */ +#include <stdio.h> + /** Panic - print error message and enter the kernel debugger. * \ingroup DDEKit_util */ -void ddekit_panic(char *fmt, ...) __attribute__((noreturn)); +#define ddekit_panic(format, ...) do \ +{ \ + char buf[1024]; \ + snprintf (buf, 1024, "%s", format); \ + fprintf (stderr , buf, ## __VA_ARGS__); \ + fflush (stderr); \ + abort (); \ +} while (0) /** Print a debug message. * \ingroup DDEKit_util */ -void ddekit_debug(char *fmt, ...); +#define ddekit_debug(format, ...) do \ +{ \ + char buf[1024]; \ + snprintf (buf, 1024, "%s: %s\n", __func__, format); \ + fprintf (stderr , buf, ## __VA_ARGS__); \ + fflush (stderr); \ +} while (0) #endif |