diff options
Diffstat (limited to 'cpukit/sapi')
-rw-r--r-- | cpukit/sapi/Makefile.am | 1 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/fatal.h | 12 | ||||
-rw-r--r-- | cpukit/sapi/src/panic.c | 32 |
3 files changed, 45 insertions, 0 deletions
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am index 85d89ef494..326d67f193 100644 --- a/cpukit/sapi/Makefile.am +++ b/cpukit/sapi/Makefile.am @@ -43,6 +43,7 @@ libsapi_a_SOURCES += src/delaynano.c libsapi_a_SOURCES += src/rbtree.c libsapi_a_SOURCES += src/rbtreefind.c libsapi_a_SOURCES += src/rbtreeinsert.c +libsapi_a_SOURCES += src/panic.c libsapi_a_SOURCES += src/profilingiterate.c libsapi_a_SOURCES += src/profilingreportxml.c libsapi_a_SOURCES += src/tcsimpleinstall.c diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h index 80929cd274..291af42c6e 100644 --- a/cpukit/sapi/include/rtems/fatal.h +++ b/cpukit/sapi/include/rtems/fatal.h @@ -89,6 +89,18 @@ RTEMS_NO_RETURN RTEMS_INLINE_ROUTINE void rtems_fatal( } /** + * @brief Prints the specified message via printk() and terminates the system. + * + * @param[in] fmt The message format. + * @param[in] ... The message parameters. + * + * @see _Terminate(). + */ +RTEMS_NO_RETURN void rtems_panic( + const char *fmt, ... +) RTEMS_PRINTFLIKE( 1, 2 ); + +/** * @brief Returns a text for a fatal source. * * The text for each fatal source is the enumerator constant. 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 ); +} |