summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi/src/panic.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-21 11:29:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-22 09:40:23 +0100
commit15e19273b2a6ebda3b2d55b28d693e7b8a0740b2 (patch)
tree4fb0c67c21f6f9f947e5400fc0a40e03acff00eb /cpukit/sapi/src/panic.c
parentINTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL (diff)
downloadrtems-15e19273b2a6ebda3b2d55b28d693e7b8a0740b2.tar.bz2
sapi: New implementation of rtems_panic()
The previous rtems_panic() implementation was quite heavy weight. It depended on _exit() which calls the global destructors. It used fprintf(stderr, ...) for output which depends on an initialized console device and the complex fprintf(). Introduce a new fatal source RTEMS_FATAL_SOURCE_PANIC for rtems_panic() and output via vprintk(). Update #3244.
Diffstat (limited to 'cpukit/sapi/src/panic.c')
-rw-r--r--cpukit/sapi/src/panic.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/cpukit/sapi/src/panic.c b/cpukit/sapi/src/panic.c
new file mode 100644
index 0000000000..34b6f75213
--- /dev/null
+++ b/cpukit/sapi/src/panic.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/fatal.h>
+
+#include <stdarg.h>
+
+void rtems_panic( const char *fmt, ... )
+{
+ va_list ap;
+
+ va_start( ap, fmt );
+ vprintk( fmt, ap );
+ va_end( ap);
+
+ _Terminate( RTEMS_FATAL_SOURCE_PANIC, (Internal_errors_t) fmt );
+}