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 <step...@networkplumber.org> --- lib/eal/unix/eal_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/eal/unix/eal_log.c b/lib/eal/unix/eal_log.c index d44416fd6570..baa721021991 100644 --- a/lib/eal/unix/eal_log.c +++ b/lib/eal/unix/eal_log.c @@ -5,6 +5,7 @@ #include <stdio.h> #include <sys/types.h> #include <syslog.h> +#include <unistd.h> #include <rte_log.h> @@ -19,8 +20,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); -- 2.39.2