[rtems-libbsd commit] PRINTF(9): Do not use printk() for log()

Sebastian Huber sebh at rtems.org
Thu Jan 30 15:35:13 UTC 2014


Module:    rtems-libbsd
Branch:    master
Commit:    08c858844083b21f68c42d3b2388509d0899d498
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=08c858844083b21f68c42d3b2388509d0899d498

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jan 20 12:50:23 2014 +0100

PRINTF(9): Do not use printk() for log()

The BSD library functions must use printk().  The %D format specifier is
not supported, thus we cannot use the printf() family for output.

---

 libbsd.txt                     |    3 +++
 rtemsbsd/rtems/rtems-bsd-log.c |   13 +++----------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/libbsd.txt b/libbsd.txt
index 7ecb75e..628890a 100644
--- a/libbsd.txt
+++ b/libbsd.txt
@@ -115,6 +115,9 @@ the current Git submodule commit is this
   destruction.  Add support for file descriptor transmission via control
   messages.
 
+* PRINTF(9): Add support for log(), the %D format specifier is missing in the
+  normal printf() family.
+
 [listing]
 ----
     /* sysinit section? */
diff --git a/rtemsbsd/rtems/rtems-bsd-log.c b/rtemsbsd/rtems/rtems-bsd-log.c
index 4afc16b..ec5f705 100644
--- a/rtemsbsd/rtems/rtems-bsd-log.c
+++ b/rtemsbsd/rtems/rtems-bsd-log.c
@@ -37,17 +37,10 @@
 #include <rtems/bsd/sys/types.h>
 #include <sys/systm.h>
 
-/*
- * Log writes to the log buffer, and guarantees not to sleep (so can be
- * called by interrupt routines).  If there is no process reading the
- * log yet, it writes to the console also.
- */
+#include <stdio.h>
+
 void
 log(int level, const char *fmt, ...)
 {
-        va_list ap;
-
-        va_start(ap, fmt);
-        vprintk(fmt, ap);
-        va_end(ap);
+	puts(fmt);
 }




More information about the vc mailing list