mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
SYSLOG: Add option to buffer SYSLOG output to avoid interleaving.
This commit is contained in:
+13
-1
@@ -189,6 +189,18 @@ struct lib_rawsostream_s
|
||||
int fd;
|
||||
};
|
||||
|
||||
/* This is a special stream that does buffered character I/O. NOTE that is
|
||||
* CONFIG_SYSLOG_BUFFER is not defined, it is the same as struct lib_outstream_s */
|
||||
|
||||
struct lib_syslogstream_s
|
||||
{
|
||||
struct lib_outstream_s public;
|
||||
#ifdef CONFIG_SYSLOG_BUFFER
|
||||
unsigned int nbuf;
|
||||
char buf[CONFIG_SYSLOG_BUFSIZE];
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
@@ -360,7 +372,7 @@ void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void syslogstream(FAR struct lib_outstream_s *stream);
|
||||
void syslogstream(FAR struct lib_syslogstream_s *stream);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: emergstream
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/****************************************************************************
|
||||
@@ -104,6 +106,7 @@ enum syslog_init_e
|
||||
|
||||
/* This structure provides the interface to a SYSLOG device */
|
||||
|
||||
typedef CODE ssize_t (*syslog_write_t)(FAR const char *buf, size_t buflen);
|
||||
typedef CODE int (*syslog_putc_t)(int ch);
|
||||
typedef CODE int (*syslog_flush_t)(void);
|
||||
|
||||
@@ -111,8 +114,11 @@ struct syslog_channel_s
|
||||
{
|
||||
/* I/O redirection methods */
|
||||
|
||||
syslog_putc_t sc_putc; /* Normal buffered output */
|
||||
syslog_putc_t sc_force; /* Low-level output for interrupt handlers */
|
||||
#ifdef CONFIG_SYSLOG_WRITE
|
||||
syslog_write_t sc_write; /* Write multiple bytes */
|
||||
#endif
|
||||
syslog_putc_t sc_putc; /* Normal buffered output */
|
||||
syslog_putc_t sc_force; /* Low-level output for interrupt handlers */
|
||||
syslog_flush_t sc_flush; /* Flush buffered output (on crash) */
|
||||
|
||||
/* Implementation specific logic may follow */
|
||||
|
||||
Reference in New Issue
Block a user