[v6,4/6] eal: skip stdio on console logging
Checks
Commit Message
There is no need to use stdio when logging to console.
Using the write system call directly avoids unnecessary copy
to stdio output buffer.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/unix/eal_log.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <syslog.h>
+#include <unistd.h>
#include <rte_log.h>
@@ -21,8 +22,7 @@ console_log_write(__rte_unused void *c, const char *buf, size_t size)
ssize_t ret;
/* write on stderr */
- ret = fwrite(buf, 1, size, stderr);
- fflush(stderr);
+ ret = write(STDERR_FILENO, buf, size);
/* Syslog error levels are from 0 to 7, so subtract 1 to convert */
syslog(rte_log_cur_msg_loglevel() - 1, "%.*s", (int)size, buf);