Hey all,
Attached is a patch exposing rtems_verror().
I'd personally like this as I'm writing up BSD err() / warn()-style
wrappers (taking variable arguments) to try to cut down on the spread of
RTEMS-specific code in my application and to allow some bonus niftyness
(like sysloging).
Does it appeal to any generous committer, at all? :-)
P.S.: I made the name of the first parameter in the declaration match
rtems_error()'s, though they're (both) inconsistent between
declaration / definition ("error_code" versus "error_flag").
P.P.S: I also removed the "Currently just used by RTEMS monitor" Doxygen
comment on the error.h file
--
Nick Withers
Embedded Systems Programmer
Room 2.26, Building 57
Department of Nuclear Physics
Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)
eMail: [email protected]
Phone: +61 2 6125 2091
Mobile: +61 414 397 446
>From 505a2aa48aaef2bd5119a75f59c16062ca3f7d1d Mon Sep 17 00:00:00 2001
From: Nick Withers <[email protected]>
Date: Wed, 14 Aug 2013 17:56:27 +1000
Subject: [PATCH] Expose rtems_verror()
---
cpukit/libcsupport/include/rtems/error.h | 27 ++++++++++++++++++++++++---
cpukit/libcsupport/src/error.c | 2 +-
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/cpukit/libcsupport/include/rtems/error.h b/cpukit/libcsupport/include/rtems/error.h
index 4eae14f..9556763 100644
--- a/cpukit/libcsupport/include/rtems/error.h
+++ b/cpukit/libcsupport/include/rtems/error.h
@@ -5,8 +5,6 @@
*
* Defines and externs for rtems error reporting
*
- * Currently just used by RTEMS monitor.
- *
* These routines provide general purpose error reporting.
* rtems_error reports an error to stderr and allows use of
* printf style formatting. A newline is appended to all messages.
@@ -52,6 +50,8 @@
#include <rtems/rtems/status.h>
#include <rtems/score/interr.h>
+#include <stdarg.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -67,7 +67,7 @@ extern "C" {
typedef Internal_errors_t rtems_error_code_t;
/*
- * rtems_error() and rtems_panic() support
+ * rtems_error(), rtems_verror() and rtems_panic() support
*/
#if 0
@@ -106,6 +106,27 @@ int rtems_error(
);
/**
+ * @brief Report an Error
+ *
+ * @param[in] error_code can be specified as any of the following:
+ * RTEMS_ERROR_ERRNO -- include errno text in output
+ * RTEMS_ERROR_PANIC -- halts local system after output
+ * RTEMS_ERROR_ABORT -- abort after output
+ *
+ * @param[in] printf_format is a normal printf(3) format string,
+ * with its concommitant arguments
+ * @param[in] @p arglist is a varargs list corresponding to
+ * printf_format
+ *
+ * @return the number of characters written.
+ */
+int rtems_verror(
+ rtems_error_code_t error_code,
+ const char *printf_format,
+ va_list arglist
+);
+
+/**
* rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...)
*/
void rtems_panic(
diff --git a/cpukit/libcsupport/src/error.c b/cpukit/libcsupport/src/error.c
index 1a682c0..0e63fa4 100644
--- a/cpukit/libcsupport/src/error.c
+++ b/cpukit/libcsupport/src/error.c
@@ -66,7 +66,7 @@ const char *rtems_status_text(
}
-static int rtems_verror(
+int rtems_verror(
rtems_error_code_t error_flag,
const char *printf_format,
va_list arglist
--
1.8.3.4
_______________________________________________
rtems-devel mailing list
[email protected]
http://www.rtems.org/mailman/listinfo/rtems-devel