[PATCH] vprintf: Add handler that mutes all output.

Christian Mauderer christian.mauderer at embedded-brains.de
Thu Mar 22 06:40:47 UTC 2018


This adds a vprintf handler that can be used to suppress all outputs of
the libbsd.
---
 rtemsbsd/include/rtems/bsd/bsd.h      |  9 +++++++++
 rtemsbsd/rtems/rtems-kernel-vprintf.c | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/rtemsbsd/include/rtems/bsd/bsd.h b/rtemsbsd/include/rtems/bsd/bsd.h
index 19428a51..cec14ac4 100755
--- a/rtemsbsd/include/rtems/bsd/bsd.h
+++ b/rtemsbsd/include/rtems/bsd/bsd.h
@@ -294,6 +294,15 @@ int rtems_bsd_vprintf(int level, const char *fmt, va_list ap);
  */
 int rtems_bsd_setlogpriority(const char* priority);
 
+/**
+ * @brief Set this vprintf handler to suppress all output.
+ *
+ * @retval Allways 0.
+ *
+ * @see rtems_bsd_vprintf() for the parameters.
+ */
+int rtems_bsd_vprintf_handler_mute(int level, const char *fmt, va_list ap);
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/rtemsbsd/rtems/rtems-kernel-vprintf.c b/rtemsbsd/rtems/rtems-kernel-vprintf.c
index 7364ec6d..29dc1ff4 100644
--- a/rtemsbsd/rtems/rtems-kernel-vprintf.c
+++ b/rtemsbsd/rtems/rtems-kernel-vprintf.c
@@ -103,6 +103,16 @@ default_vprintf_handler(int level, const char *fmt, va_list ap)
 static int (*vprintf_handler)(int, const char *, va_list) =
     default_vprintf_handler;
 
+int
+rtems_bsd_vprintf_handler_mute(int level, const char *fmt, va_list ap)
+{
+	(void) level;
+	(void) fmt;
+	(void) ap;
+
+	return 0;
+}
+
 rtems_bsd_vprintf_handler
 rtems_bsd_set_vprintf_handler(rtems_bsd_vprintf_handler new_handler)
 {
-- 
2.13.6



More information about the devel mailing list