From a6e556d31ce3932fb24ab7eab0ab1cebdd3ff7b4 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Tue, 16 May 2017 10:56:49 -0600 Subject: [PATCH] I had to make following change to fix interrupt context syslog (INTBUFFER untested) --- drivers/syslog/syslog_write.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/syslog/syslog_write.c b/drivers/syslog/syslog_write.c index a3100702ca..390f594237 100644 --- a/drivers/syslog/syslog_write.c +++ b/drivers/syslog/syslog_write.c @@ -40,6 +40,7 @@ #include #include +#include #include #include "syslog.h" @@ -100,8 +101,21 @@ ssize_t syslog_default_write(FAR const char *buffer, size_t buflen) ssize_t syslog_write(FAR const char *buffer, size_t buflen) { #ifdef CONFIG_SYSLOG_WRITE - return g_syslog_channel->sc_write(buffer, buflen); -#else - return syslog_default_write(buffer, buflen); + if (!up_interrupt_context() && !sched_idletask()) + { +#ifdef CONFIG_SYSLOG_INTBUFFER + /* Flush any characters that may have been added to the interrupt + * buffer. + */ + + (void)syslog_flush_intbuffer(g_syslog_channel, false); #endif + + return g_syslog_channel->sc_write(buffer, buflen); + } + else +#endif + { + return syslog_default_write(buffer, buflen); + } }