summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-11 14:20:40 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-11 14:20:40 +0000
commit75e67f05d4b97efc32d95b478ec1c1f959992a4b (patch)
tree8cf471347f767130a152b249bafd7de1a6017757
parent4a62de545bf87610c2415218e144ddef4dd0e75c (diff)
downloadnuttx-75e67f05d4b97efc32d95b478ec1c1f959992a4b.tar.gz
nuttx-75e67f05d4b97efc32d95b478ec1c1f959992a4b.tar.bz2
nuttx-75e67f05d4b97efc32d95b478ec1c1f959992a4b.zip
Add logic to re-direct debug output to a sysloggin device
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4381 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/Documentation/NuttxPortingGuide.html43
-rw-r--r--nuttx/arch/arm/src/common/up_initialize.c8
-rw-r--r--nuttx/arch/arm/src/common/up_internal.h14
-rw-r--r--nuttx/arch/avr/src/at32uc3/at32uc3_config.h6
-rw-r--r--nuttx/arch/avr/src/at90usb/at90usb_config.h6
-rw-r--r--nuttx/arch/avr/src/atmega/atmega_config.h6
-rw-r--r--nuttx/arch/avr/src/common/up_initialize.c14
-rw-r--r--nuttx/arch/avr/src/common/up_internal.h8
-rwxr-xr-xnuttx/arch/hc/src/common/up_initialize.c7
-rwxr-xr-xnuttx/arch/hc/src/common/up_internal.h12
-rw-r--r--nuttx/arch/mips/src/common/up_initialize.c8
-rwxr-xr-xnuttx/arch/mips/src/common/up_internal.h14
-rw-r--r--nuttx/arch/sh/src/common/up_initialize.c7
-rw-r--r--nuttx/arch/sh/src/common/up_internal.h14
-rw-r--r--nuttx/arch/sim/src/up_initialize.c15
-rw-r--r--nuttx/arch/x86/src/common/up_initialize.c8
-rw-r--r--nuttx/arch/x86/src/common/up_internal.h14
-rw-r--r--nuttx/arch/z16/src/common/up_initialize.c8
-rw-r--r--nuttx/arch/z16/src/common/up_internal.h14
-rw-r--r--nuttx/configs/README.txt26
-rw-r--r--nuttx/drivers/ramlog.c159
-rw-r--r--nuttx/include/nuttx/lib.h10
-rw-r--r--nuttx/include/nuttx/ramlog.h59
-rw-r--r--nuttx/include/nuttx/streams.h23
-rw-r--r--nuttx/lib/stdio/Make.defs4
-rw-r--r--nuttx/lib/stdio/lib_lowprintf.c16
-rw-r--r--nuttx/lib/stdio/lib_rawprintf.c17
-rw-r--r--nuttx/lib/stdio/lib_syslogstream.c103
-rw-r--r--nuttx/tools/mkconfig.c12
30 files changed, 541 insertions, 117 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 1de3de5f0..77d4c443d 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2453,4 +2453,7 @@
* drivers/ramlog.c: Add a character driver that can substitute
for /dev/console and or be used for logging debug output when there
is no serial port available (such as when a telnet console is used).
+ * lib/stdio/lib_syslogstream: Add a stream object that will be used to
+ re-direct all debug output to the RAM log if CONFIG_SYSLOG and
+ CONFIG_RAMLOG_SYSLOG are defined.
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html
index 244f07538..4b562057d 100644
--- a/nuttx/Documentation/NuttxPortingGuide.html
+++ b/nuttx/Documentation/NuttxPortingGuide.html
@@ -3942,6 +3942,49 @@ build
</ul>
<p>
+ System Logging:
+</p>
+<ul>
+ <li>
+ <code>CONFIG_SYSLOG</code>: Enables general system logging support.
+ </li>
+ <p>
+ At present, the only system loggin device is a circular buffer in RAM.
+ If <code>CONFIG_SYSLOG</code> is selected, then these options are also available.
+ </p>
+ <li>
+ <code>CONFIG_RAMLOG</code>: Enables the RAM logging feature
+ </li>
+ <li>
+ <code>CONFIG_RAMLOG_CONSOLE</code>: Use the RAM logging device as a system console.
+ If this feature is enabled (along with <code>CONFIG_DEV_CONSOLE</code>), then all
+ console output will be re-directed to a circular buffer in RAM. This
+ is useful, for example, if the only console is a Telnet console. Then
+ in that case, console output from non-Telnet threads will go to the
+ circular buffer and can be viewed using the NSH 'dmesg' command.
+ </li>
+ <li>
+ <code>CONFIG_RAMLOG_SYSLOG</code>: Use the RAM logging device for the syslogging
+ interface. If this feature is enabled (along with <code>CONFIG_SYSLOG</code>),
+ then all debug output (only) will be re-directed to the circular
+ buffer in RAM. This RAM log can be view from NSH using the 'dmesg'
+ command.
+ </li>
+ <li>
+ <code>CONFIG_RAMLOG_NPOLLWAITERS</code>: The number of threads than can be waiting
+ for this driver on poll(). Default: 4
+ </li>
+ <p>
+ If <code>CONFIG_RAMLOG_CONSOLE</code> or <code>CONFIG_RAMLOG_SYSLOG</code> is selected, then the
+ following may also be provided:
+ </p>
+ </li>
+ <li>
+ <code>CONFIG_RAMLOG_CONSOLE_BUFSIZE</code>: Size of the console RAM log. Default: 1024
+ </li>
+</ul>
+
+<p>
Kernel build options:
</p>
<ul>
diff --git a/nuttx/arch/arm/src/common/up_initialize.c b/nuttx/arch/arm/src/common/up_initialize.c
index 9d7ba0f19..130f0721f 100644
--- a/nuttx/arch/arm/src/common/up_initialize.c
+++ b/nuttx/arch/arm/src/common/up_initialize.c
@@ -43,6 +43,8 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <nuttx/ramlog.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -159,6 +161,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
+ /* Initialize the system logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit();
+#endif
+
/* Initialize the netwok */
up_netinitialize();
diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h
index 6f98ac04d..8ade816c7 100644
--- a/nuttx/arch/arm/src/common/up_internal.h
+++ b/nuttx/arch/arm/src/common/up_internal.h
@@ -81,6 +81,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/* Check if an interrupt stack size is configured */
#ifndef CONFIG_ARCH_INTERRUPTSTACK
@@ -297,14 +303,6 @@ extern void lowconsole_init(void);
# define lowconsole_init()
#endif
-/* Defined in drivers/ramlog.c */
-
-#ifdef CONFIG_RAMLOG_CONSOLE
-extern void ramlog_consoleinit(void);
-#else
-# define ramlog_consoleinit()
-#endif
-
/* DMA **********************************************************************/
#ifdef CONFIG_ARCH_DMA
diff --git a/nuttx/arch/avr/src/at32uc3/at32uc3_config.h b/nuttx/arch/avr/src/at32uc3/at32uc3_config.h
index 72536083a..b42520531 100644
--- a/nuttx/arch/avr/src/at32uc3/at32uc3_config.h
+++ b/nuttx/arch/avr/src/at32uc3/at32uc3_config.h
@@ -168,6 +168,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/* If GPIO IRQ support is defined, then a set of GPIOs must all be included */
#if CONFIG_AVR32_GPIOIRQSETA == 0 && CONFIG_AVR32_GPIOIRQSETB == 0
diff --git a/nuttx/arch/avr/src/at90usb/at90usb_config.h b/nuttx/arch/avr/src/at90usb/at90usb_config.h
index e6d2fb89e..41ad9957c 100644
--- a/nuttx/arch/avr/src/at90usb/at90usb_config.h
+++ b/nuttx/arch/avr/src/at90usb/at90usb_config.h
@@ -87,6 +87,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/************************************************************************************
* Public Types
************************************************************************************/
diff --git a/nuttx/arch/avr/src/atmega/atmega_config.h b/nuttx/arch/avr/src/atmega/atmega_config.h
index e0a7968cc..a168a2e47 100644
--- a/nuttx/arch/avr/src/atmega/atmega_config.h
+++ b/nuttx/arch/avr/src/atmega/atmega_config.h
@@ -92,6 +92,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/************************************************************************************
* Public Types
************************************************************************************/
diff --git a/nuttx/arch/avr/src/common/up_initialize.c b/nuttx/arch/avr/src/common/up_initialize.c
index eed1b4135..3bcbc0dc4 100644
--- a/nuttx/arch/avr/src/common/up_initialize.c
+++ b/nuttx/arch/avr/src/common/up_initialize.c
@@ -43,6 +43,8 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <nuttx/ramlog.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -76,6 +78,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -183,6 +191,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
+ /* Initialize the system logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit();
+#endif
+
/* Initialize the netwok */
up_netinitialize();
diff --git a/nuttx/arch/avr/src/common/up_internal.h b/nuttx/arch/avr/src/common/up_internal.h
index bc62be720..e65b5627d 100644
--- a/nuttx/arch/avr/src/common/up_internal.h
+++ b/nuttx/arch/avr/src/common/up_internal.h
@@ -172,14 +172,6 @@ extern void lowconsole_init(void);
# define lowconsole_init()
#endif
-/* Defined in drivers/ramlog.c */
-
-#ifdef CONFIG_RAMLOG_CONSOLE
-extern void ramlog_consoleinit(void);
-#else
-# define ramlog_consoleinit()
-#endif
-
/* Defined in chip/xxx_timerisr.c */
extern void up_timerinit(void);
diff --git a/nuttx/arch/hc/src/common/up_initialize.c b/nuttx/arch/hc/src/common/up_initialize.c
index a1973e94a..5481ed7bc 100755
--- a/nuttx/arch/hc/src/common/up_initialize.c
+++ b/nuttx/arch/hc/src/common/up_initialize.c
@@ -43,6 +43,7 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <nuttx/ramlog.h>
#include "up_arch.h"
#include "up_internal.h"
@@ -158,6 +159,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
+ /* Initialize the system logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit();
+#endif
+
/* Initialize the netwok */
up_netinitialize();
diff --git a/nuttx/arch/hc/src/common/up_internal.h b/nuttx/arch/hc/src/common/up_internal.h
index 22677dd0f..93572e404 100755
--- a/nuttx/arch/hc/src/common/up_internal.h
+++ b/nuttx/arch/hc/src/common/up_internal.h
@@ -81,6 +81,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/* Check if an interrupt stack size is configured */
#ifndef CONFIG_ARCH_INTERRUPTSTACK
@@ -178,12 +184,6 @@ extern void lowconsole_init(void);
# define lowconsole_init()
#endif
-#ifdef CONFIG_RAMLOG_CONSOLE
-extern void ramlog_consoleinit(void);
-#else
-# define ramlog_consoleinit()
-#endif
-
extern void up_lowputc(char ch);
extern void up_puts(const char *str);
extern void up_lowputs(const char *str);
diff --git a/nuttx/arch/mips/src/common/up_initialize.c b/nuttx/arch/mips/src/common/up_initialize.c
index 0a061990b..11bd979f0 100644
--- a/nuttx/arch/mips/src/common/up_initialize.c
+++ b/nuttx/arch/mips/src/common/up_initialize.c
@@ -43,6 +43,8 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <nuttx/ramlog.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -159,6 +161,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
+ /* Initialize the system logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit();
+#endif
+
/* Initialize the netwok */
up_netinitialize();
diff --git a/nuttx/arch/mips/src/common/up_internal.h b/nuttx/arch/mips/src/common/up_internal.h
index 25b5174a5..d43580c65 100755
--- a/nuttx/arch/mips/src/common/up_internal.h
+++ b/nuttx/arch/mips/src/common/up_internal.h
@@ -81,6 +81,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/* Check if an interrupt stack size is configured */
#ifndef CONFIG_ARCH_INTERRUPTSTACK
@@ -188,14 +194,6 @@ extern void lowconsole_init(void);
# define lowconsole_init()
#endif
-/* Defined in drivers/ramlog.c */
-
-#ifdef CONFIG_RAMLOG_CONSOLE
-extern void ramlog_consoleinit(void);
-#else
-# define ramlog_consoleinit()
-#endif
-
/* Debug */
#ifdef CONFIG_ARCH_STACKDUMP
diff --git a/nuttx/arch/sh/src/common/up_initialize.c b/nuttx/arch/sh/src/common/up_initialize.c
index b81e3b972..837b218a0 100644
--- a/nuttx/arch/sh/src/common/up_initialize.c
+++ b/nuttx/arch/sh/src/common/up_initialize.c
@@ -43,6 +43,7 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <nuttx/ramlog.h>
#include "up_arch.h"
#include "up_internal.h"
@@ -150,6 +151,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
+ /* Initialize the system logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit();
+#endif
+
/* Initialize the netwok */
up_netinitialize();
diff --git a/nuttx/arch/sh/src/common/up_internal.h b/nuttx/arch/sh/src/common/up_internal.h
index 1b6e41635..50aad1478 100644
--- a/nuttx/arch/sh/src/common/up_internal.h
+++ b/nuttx/arch/sh/src/common/up_internal.h
@@ -85,6 +85,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/* Check if an interrupt stack size is configured */
#ifndef CONFIG_ARCH_INTERRUPTSTACK
@@ -177,14 +183,6 @@ extern void lowconsole_init(void);
# define lowconsole_init()
#endif
-/* Defined in drivers/ramlog.c */
-
-#ifdef CONFIG_RAMLOG_CONSOLE
-extern void ramlog_consoleinit(void);
-#else
-# define ramlog_consoleinit()
-#endif
-
/* Defined in up_watchdog.c */
extern void up_wdtinit(void);
diff --git a/nuttx/arch/sim/src/up_initialize.c b/nuttx/arch/sim/src/up_initialize.c
index 4e07904e4..a850d7c69 100644
--- a/nuttx/arch/sim/src/up_initialize.c
+++ b/nuttx/arch/sim/src/up_initialize.c
@@ -1,8 +1,8 @@
/****************************************************************************
* up_initialize.c
*
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,6 +43,7 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <nuttx/ramlog.h>
#include "up_internal.h"
@@ -50,6 +51,12 @@
* Private Definitions
****************************************************************************/
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -99,6 +106,10 @@ void up_initialize(void)
devzero_register(); /* Standard /dev/zero */
up_devconsole(); /* Our private /dev/console */
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit(); /* System logging device */
+#endif
+
#if defined(CONFIG_FS_FAT) && !defined(CONFIG_DISABLE_MOUNTPOINT)
up_registerblockdevice(); /* Our FAT ramdisk at /dev/ram0 */
#endif
diff --git a/nuttx/arch/x86/src/common/up_initialize.c b/nuttx/arch/x86/src/common/up_initialize.c
index 92d4d3537..eb0cdccc1 100644
--- a/nuttx/arch/x86/src/common/up_initialize.c
+++ b/nuttx/arch/x86/src/common/up_initialize.c
@@ -43,6 +43,8 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <nuttx/ramlog.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -159,6 +161,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
+ /* Initialize the system logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit();
+#endif
+
/* Initialize the netwok */
up_netinitialize();
diff --git a/nuttx/arch/x86/src/common/up_internal.h b/nuttx/arch/x86/src/common/up_internal.h
index f95a9bc74..c840cf90b 100644
--- a/nuttx/arch/x86/src/common/up_internal.h
+++ b/nuttx/arch/x86/src/common/up_internal.h
@@ -80,6 +80,12 @@
# endif
#endig
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/* Check if an interrupt stack size is configured */
#ifndef CONFIG_ARCH_INTERRUPTSTACK
@@ -203,14 +209,6 @@ extern void lowconsole_init(void);
# define lowconsole_init()
#endif
-/* Defined in drivers/ramlog.c */
-
-#ifdef CONFIG_RAMLOG_CONSOLE
-extern void ramlog_consoleinit(void);
-#else
-# define ramlog_consoleinit()
-#endif
-
/* Defined in up_watchdog.c */
extern void up_wdtinit(void);
diff --git a/nuttx/arch/z16/src/common/up_initialize.c b/nuttx/arch/z16/src/common/up_initialize.c
index ab653f368..165f0ead3 100644
--- a/nuttx/arch/z16/src/common/up_initialize.c
+++ b/nuttx/arch/z16/src/common/up_initialize.c
@@ -44,6 +44,8 @@
#include <nuttx/arch.h>
#include <nuttx/fs.h>
#include <nuttx/mm.h>
+#include <nuttx/ramlog.h>
+
#include <arch/board/board.h>
#include "up_internal.h"
@@ -174,6 +176,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
+ /* Initialize the system logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ ramlog_sysloginit();
+#endif
+
/* Initialize the netwok */
up_netinitialize();
diff --git a/nuttx/arch/z16/src/common/up_internal.h b/nuttx/arch/z16/src/common/up_internal.h
index e0c8ffc61..7d0aaaec8 100644
--- a/nuttx/arch/z16/src/common/up_internal.h
+++ b/nuttx/arch/z16/src/common/up_internal.h
@@ -70,7 +70,13 @@
# define USE_SERIALDRIVER 1
# define USE_EARLYSERIALINIT 1
#endif
-
+
+/* Determine which device to use as the system loggin device */
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
/* Macros for portability */
#define IN_INTERRUPT (current_regs != NULL)
@@ -140,12 +146,6 @@ extern void up_serialinit(void);
extern void lowconsole_init(void);
#endif
-/* Defined in drivers/ramlog.c */
-
-#ifdef CONFIG_RAMLOG_CONSOLE
-extern void ramlog_consoleinit(void);
-#endif
-
/* Defined in up_timerisr.c */
extern void up_timerinit(void);
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index a69c51e7e..81473b73b 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -357,6 +357,32 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up
the worker thread. Default: 4
+ System Logging:
+ CONFIG_SYSLOG enables general system logging support.
+
+ At present, the only system loggin device is a circular buffer in RAM.
+ If CONFIG_SYSLOG is selected, then these options are also available.
+
+ CONFIG_RAMLOG - Enables the RAM logging feature
+ CONFIG_RAMLOG_CONSOLE - Use the RAM logging device as a system console.
+ If this feature is enabled (along with CONFIG_DEV_CONSOLE), then all
+ console output will be re-directed to a circular buffer in RAM. This
+ is useful, for example, if the only console is a Telnet console. Then
+ in that case, console output from non-Telnet threads will go to the
+ circular buffer and can be viewed using the NSH 'dmesg' command.
+ CONFIG_RAMLOG_SYSLOG - Use the RAM logging device for the syslogging
+ interface. If this feature is enabled (along with CONFIG_SYSLOG),
+ then all debug output (only) will be re-directed to the circular
+ buffer in RAM. This RAM log can be view from NSH using the 'dmesg'
+ command.
+ CONFIG_RAMLOG_NPOLLWAITERS - The number of threads than can be waiting
+ for this driver on poll(). Default: 4
+
+ If CONFIG_RAMLOG_CONSOLE or CONFIG_RAMLOG_SYSLOG is selected, then the
+ following may also be provided:
+
+ CONFIG_RAMLOG_CONSOLE_BUFSIZE - Size of the console RAM log. Default: 1024
+
Kernel build options:
CONFIG_NUTTX_KERNEL - Builds NuttX as a separately compiled kernel.
CONFIG_SYS_RESERVED - Reserved system call values for use
diff --git a/nuttx/drivers/ramlog.c b/nuttx/drivers/ramlog.c
index 741979e7f..0245e6051 100644
--- a/nuttx/drivers/ramlog.c
+++ b/nuttx/drivers/ramlog.c
@@ -93,6 +93,15 @@ struct ramlog_dev_s
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
+/* Helper functions */
+
+#ifndef CONFIG_DISABLE_POLL
+static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
+ pollevent_t eventset);
+#endif
+static ssize_t ramlog_addchar(FAR struct ramlog_dev_s *priv, char ch);
+
+/* Character driver methods */
static ssize_t ramlog_read(FAR struct file *, FAR char *, size_t);
static ssize_t ramlog_write(FAR struct file *, FAR const char *, size_t);
@@ -118,10 +127,13 @@ static const struct file_operations g_ramlogfops =
#endif
};
-/* This is the pre-allocated buffer used for the console RAM log */
+/* This is the pre-allocated buffer used for the console RAM log and/or
+ * for the syslogging function.
+ */
-#ifdef CONFIG_RAMLOG_CONSOLE
-static char g_consoleramlog[CONFIG_RAMLOG_CONSOLE_BUFSIZE];
+#if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_RAMLOG_SYSLOG)
+static struct ramlog_dev_s g_sysdev;
+static char g_sysbuffer[CONFIG_RAMLOG_CONSOLE_BUFSIZE];
#endif
/****************************************************************************
@@ -133,7 +145,8 @@ static char g_consoleramlog[CONFIG_RAMLOG_CONSOLE_BUFSIZE];
****************************************************************************/
#ifndef CONFIG_DISABLE_POLL
-static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv, pollevent_t eventset)
+static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
+ pollevent_t eventset)
{
FAR struct pollfd *fds;
irqstate_t flags;
@@ -161,6 +174,46 @@ static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv, pollevent_t eventse
#endif
/****************************************************************************
+ * Name: ramlog_addchar
+ ****************************************************************************/
+
+static int ramlog_addchar(FAR struct ramlog_dev_s *priv, char ch)
+{
+ irqstate_t flags;
+ int nexthead;
+
+ /* Disable interrupts (in case we are NOT called from interrupt handler) */
+
+ flags = irqsave();
+
+ /* Calculate the write index AFTER the next byte is written */
+
+ nexthead = priv->rl_head + 1;
+ if (nexthead >= priv->rl_bufsize)
+ {
+ nexthead = 0;
+ }
+
+ /* Would the next write overflow the circular buffer? */
+
+ if (nexthead == priv->rl_tail)
+ {
+ /* Yes... then break out of the loop to return an indication that
+ * nothing was saved in the buffer.
+ */
+
+ return -EBUSY;
+ }
+
+ /* No... copy the byte and re-enable interrupts */
+
+ priv->rl_buffer[priv->rl_head] = ch;
+ priv->rl_head = nexthead;
+ irqrestore(flags);
+ return OK;
+}
+
+/****************************************************************************
* Name: ramlog_read
****************************************************************************/
@@ -310,10 +363,12 @@ static ssize_t ramlog_read(FAR struct file *filep, FAR char *buffer, size_t len)
/* Notify all poll/select waiters that they can write to the FIFO */
errout_without_sem:
+#ifndef CONFIG_DISABLE_POLL
if (nread > 0)
{
ramlog_pollnotify(priv, POLLOUT);
}
+#endif
return nread;
}
@@ -327,7 +382,6 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size
struct ramlog_dev_s *priv;
irqstate_t flags;
ssize_t nwritten;
- int nexthead;
int i;
/* Some sanity checking */
@@ -346,34 +400,16 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size
for (nwritten = 0; nwritten < len; nwritten++)
{
- /* Disable interrupts (in case we are NOT called from interrupt handler) */
-
- flags = irqsave();
-
- /* Calculate the write index AFTER the next byte is written */
-
- nexthead = priv->rl_head + 1;
- if (nexthead >= priv->rl_bufsize)
- {
- nexthead = 0;
- }
-
- /* Would the next write overflow the circular buffer? */
-
- if (nexthead == priv->rl_tail)
+ int ret = ramlog_addchar(priv, buffer[nwritten]);
+ if (ret < 0)
{
- /* Yes... then break out of the loop to return the number of bytes
- * written. The data to be written is dropped on the floor.
+ /* The buffer is full and nothing was saved. Break out of the
+ * loop to return the number of bytes written up to this point.
+ * The data to be written is dropped on the floor.
*/
- return nwritten;
+ break;
}
-
- /* No... copy the byte and re-enable interrupts */
-
- priv->rl_buffer[priv->rl_head] = buffer[nwritten];
- priv->rl_head = nexthead;
- irqrestore(flags);
}
/* Was anything written? */
@@ -393,6 +429,7 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size
/* Notify all poll/select waiters that they can write to the FIFO */
ramlog_pollnotify(priv, POLLIN);
+ irqrestore(flags);
}
/* Return the number of bytes written */
@@ -526,6 +563,7 @@ errout:
*
****************************************************************************/
+#if !defined(CONFIG_RAMLOG_CONSOLE) && !defined(CONFIG_RAMLOG_SYSLOG)
int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
{
FAR struct ramlog_dev_s *priv;
@@ -558,6 +596,7 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
return ret;
}
+#endif
/****************************************************************************
* Name: ramlog_consoleinit
@@ -571,10 +610,57 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
#ifdef CONFIG_RAMLOG_CONSOLE
int ramlog_consoleinit(void)
{
- /* Register a RAM log as the console device */
+ FAR struct ramlog_dev_s *priv = &g_sysdev;
+ int ret;
+
+ /* Initialize the RAM loggin device structure */
+
+ sem_init(&priv->rl_exclsem, 0, 1);
+ sem_init(&priv->rl_waitsem, 0, 0);
+ priv->rl_bufsize = g_sysbuffer;
+ priv->rl_buffer = CONFIG_RAMLOG_CONSOLE_BUFSIZE;
+
+ /* Register the console character driver */
+
+ ret = register_driver("/dev/console", &g_ramlogfops, 0666, priv);
+
+ /* Register the syslog character driver */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ if (ret >= 0)
+ {
+ ret = register_driver("/dev/syslog", &g_ramlogfops, 0666, priv);
+ }
+#endif
+ return ret;
+}
+#endif
+
+/****************************************************************************
+ * Name: ramlog_sysloginit
+ *
+ * Description:
+ * Create the RAM logging device and register it at the specified path.
+ * Mostly likely this path will be /dev/syslog
+ *
+ * If CONFIG_RAMLOG_CONSOLE is also defined, then this functionality is
+ * performed when ramlog_consoleinit() is called.
+ *
+ ****************************************************************************/
+
+#if !defined(CONFIG_RAMLOG_CONSOLE) && defined(CONFIG_RAMLOG_SYSLOG)
+int ramlog_sysloginit(void)
+{
+ FAR struct ramlog_dev_s *priv = &g_sysdev;
+
+ /* Initialize the RAM loggin device structure */
- return ramlog_register("/dev/console", g_consoleramlog,
- CONFIG_RAMLOG_CONSOLE_BUFSIZE);
+ sem_init(&priv->rl_exclsem, 0, 1);
+ sem_init(&priv->rl_waitsem, 0, 0);
+ priv->rl_bufsize = g_sysbuffer;
+ priv->rl_buffer = CONFIG_RAMLOG_CONSOLE_BUFSIZE;
+
+ return register_driver("/dev/syslog", &g_ramlogfops, 0666, priv);
}
#endif
@@ -591,8 +677,13 @@ int ramlog_consoleinit(void)
*
****************************************************************************/
-#ifdef CONFIG_RAMLOG_SYSLOG
-# warning "Missing logic"
+#if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_RAMLOG_SYSLOG)
+int ramlog_putc(int ch)
+{
+ FAR struct ramlog_dev_s *priv = &g_sysdev;
+ (void)ramlog_addchar(priv, ch)
+ return ch;
+}
#endif
#endif /* CONFIG_RAMLOG */
diff --git a/nuttx/include/nuttx/lib.h b/nuttx/include/nuttx/lib.h
index 3c74257d4..32910ad21 100644
--- a/nuttx/include/nuttx/lib.h
+++ b/nuttx/include/nuttx/lib.h
@@ -2,8 +2,8 @@
* include/nuttx/lib.h
* Non-standard, internal APIs available in lib/.
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,8 +34,8 @@
*
****************************************************************************/
-#ifndef __LIB_H
-#define __LIB_H
+#ifndef __INCLUDE_NUTTX_LIB_H
+#define __INCLUDE_NUTTX_LIB_H
/****************************************************************************
* Included Files
@@ -80,4 +80,4 @@ EXTERN void lib_releaselist(FAR struct streamlist *list);
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __LIB_H */
+#endif /* __INCLUDE_NUTTX_LIB_H */
diff --git a/nuttx/include/nuttx/ramlog.h b/nuttx/include/nuttx/ramlog.h
index 4f42de965..d1b9dea97 100644
--- a/nuttx/include/nuttx/ramlog.h
+++ b/nuttx/include/nuttx/ramlog.h
@@ -63,18 +63,33 @@
/* Configuration ************************************************************/
/* CONFIG_RAMLOG - Enables the RAM logging feature
* CONFIG_RAMLOG_CONSOLE - Use the RAM logging device as a system console.
+ * If this feature is enabled (along with CONFIG_DEV_CONSOLE), then all
+ * console output will be re-directed to a circular buffer in RAM. This
+ * is useful, for example, if the only console is a Telnet console. Then
+ * in that case, console output from non-Telnet threads will go to the
+ * circular buffer and can be viewed using the NSH 'dmesg' command.
* CONFIG_RAMLOG_SYSLOG - Use the RAM logging device for the syslogging
- * interface. This should have:
- * CONFIG_SYSLOG=ramlog
+ * interface. If this feature is enabled (along with CONFIG_SYSLOG),
+ * then all debug output (only) will be re-directed to the circular
+ * buffer in RAM. This RAM log can be view from NSH using the 'dmesg'
+ * command.
* CONFIG_RAMLOG_NPOLLWAITERS - The number of threads than can be waiting
* for this driver on poll(). Default: 4
*
- * If CONFIG_RAMLOG_CONSOLE is selected, then the following may also be
- * provided:
+ * If CONFIG_RAMLOG_CONSOLE or CONFIG_RAMLOG_SYSLOG is selected, then the
+ * following may also be provided:
*
* CONFIG_RAMLOG_CONSOLE_BUFSIZE - Size of the console RAM log. Default: 1024
*/
+#ifndef CONFIG_DEV_CONSOLE
+# undef CONFIG_RAMLOG_CONSOLE
+#endif
+
+#ifndef CONFIG_SYSLOG
+# undef CONFIG_RAMLOG_SYSLOG
+#endif
+
#ifndef CONFIG_RAMLOG_NPOLLWAITERS
# define CONFIG_RAMLOG_NPOLLWAITERS 4
#endif
@@ -104,19 +119,31 @@ extern "C" {
*
* Description:
* Create the RAM logging device and register it at the specified path.
- * Mostly likely this path will be /dev/console
+ * Mostly likely this path will be /dev/console.
+ *
+ * This interface is not normally used but can be made available is
+ * someone just wants to tinker with the RAM log as a generic character
+ * device. Normally both CONFIG_RAMLOG_CONSOLE and CONFIG_RAMLOG_SYSLOG
+ * would be set (to capture all output in the log) -OR- just
+ * CONFIG_RAMLOG_SYSLOG would be set to capture debug output only
+ * in the log.
*
****************************************************************************/
+#if !defined(CONFIG_RAMLOG_CONSOLE) && !defined(CONFIG_RAMLOG_SYSLOG)
EXTERN int ramlog_register(FAR const char *devpath, FAR char *buffer,
size_t buflen);
+#endif
/****************************************************************************
* Name: ramlog_consoleinit
*
* Description:
* Create the RAM logging device and register it at the specified path.
- * Mostly likely this path will be /dev/console
+ * Mostly likely this path will be /dev/console.
+ *
+ * If CONFIG_RAMLOG_SYSLOG is also defined, then the same RAM logging
+ * device is also registered at /dev/syslog
*
****************************************************************************/
@@ -125,6 +152,22 @@ EXTERN int ramlog_consoleinit(void)
#endif
/****************************************************************************
+ * Name: ramlog_sysloginit
+ *
+ * Description:
+ * Create the RAM logging device and register it at the specified path.
+ * Mostly likely this path will be /dev/syslog
+ *
+ * If CONFIG_RAMLOG_CONSOLE is also defined, then this functionality is
+ * performed when ramlog_consoleinit() is called.
+ *
+ ****************************************************************************/
+
+#if !defined(CONFIG_RAMLOG_CONSOLE) && defined(CONFIG_RAMLOG_SYSLOG)
+EXTERN int ramlog_sysloginit(void)
+#endif
+
+/****************************************************************************
* Name: ramlog
*
* Description:
@@ -137,8 +180,8 @@ EXTERN int ramlog_consoleinit(void)
*
****************************************************************************/
-#ifdef CONFIG_RAMLOG_SYSLOG
-# warning "Missing logic"
+#if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_RAMLOG_SYSLOG)
+EXTERN int ramlog_putc(int ch);
#endif
#undef EXTERN
diff --git a/nuttx/include/nuttx/streams.h b/nuttx/include/nuttx/streams.h
index e8b6e2b2d..8317eacbd 100644
--- a/nuttx/include/nuttx/streams.h
+++ b/nuttx/include/nuttx/streams.h
@@ -1,8 +1,8 @@
/****************************************************************************
* include/nuttx/streams.h
*
- * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -268,6 +268,25 @@ EXTERN void lib_zeroinstream(FAR struct lib_instream_s *zeroinstream);
EXTERN void lib_nullinstream(FAR struct lib_instream_s *nullinstream);
EXTERN void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream);
+/****************************************************************************
+ * Name: lib_sylogstream
+ *
+ * Description:
+ * Initializes a stream for use with the configured syslog interface.
+ *
+ * Input parameters:
+ * lowoutstream - User allocated, uninitialized instance of struct
+ * lib_lowoutstream_s to be initialized.
+ *
+ * Returned Value:
+ * None (User allocated instance initialized).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SYSLOG
+EXTERN void lib_sylogstream(FAR struct lib_outstream_s *stream);
+#endif
+
#undef EXTERN
#if defined(__cplusplus)
}
diff --git a/nuttx/lib/stdio/Make.defs b/nuttx/lib/stdio/Make.defs
index 7bffb2340..690c83641 100644
--- a/nuttx/lib/stdio/Make.defs
+++ b/nuttx/lib/stdio/Make.defs
@@ -52,6 +52,10 @@ STDIO_SRCS += lib_fopen.c lib_fclose.c lib_fread.c lib_libfread.c lib_fseek.c \
endif
endif
+ifdef ($(CONFIG_SYSLOG)
+STDIO_SRCS += lib_syslogstream.c
+endif
+
ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
STDIO_SRCS += lib_dtoa.c
endif
diff --git a/nuttx/lib/stdio/lib_lowprintf.c b/nuttx/lib/stdio/lib_lowprintf.c
index 576402d61..0314a27f0 100644
--- a/nuttx/lib/stdio/lib_lowprintf.c
+++ b/nuttx/lib/stdio/lib_lowprintf.c
@@ -1,8 +1,8 @@
/****************************************************************************
* lib/stdio/lib_lowprintf.c
*
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -82,17 +82,19 @@
* Name: lib_lowvprintf
****************************************************************************/
-#ifdef CONFIG_ARCH_LOWPUTC
+#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_SYSLOG)
int lib_lowvprintf(const char *fmt, va_list ap)
{
struct lib_outstream_s stream;
- /* Wrap the stdout in a stream object and let lib_vsprintf
- * do the work.
- */
+ /* Wrap the stdout in a stream object and let lib_vsprintf do the work. */
+#if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_RAMLOG_SYSLOG)
+ lib_syslogstream((FAR struct lib_outstream_s *)&stream);
+#else
lib_lowoutstream((FAR struct lib_outstream_s *)&stream);
+#endif
return lib_vsprintf((FAR struct lib_outstream_s *)&stream, fmt, ap);
}
@@ -111,4 +113,4 @@ int lib_lowprintf(const char *fmt, ...)
return ret;
}
-#endif /* CONFIG_ARCH_LOWPUTC */
+#endif /* CONFIG_ARCH_LOWPUTC || CONFIG_SYSLOG*/
diff --git a/nuttx/lib/stdio/lib_rawprintf.c b/nuttx/lib/stdio/lib_rawprintf.c
index 915fd833b..d738b212a 100644
--- a/nuttx/lib/stdio/lib_rawprintf.c
+++ b/nuttx/lib/stdio/lib_rawprintf.c
@@ -1,8 +1,8 @@
/****************************************************************************
* lib/stdio/lib_rawprintf.c
*
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -83,7 +83,18 @@
int lib_rawvprintf(const char *fmt, va_list ap)
{
-#if CONFIG_NFILE_DESCRIPTORS > 0
+#if defined(CONFIG_SYSLOG)
+
+ struct lib_outstream_s stream;
+
+ /* Wrap the low-level output in a stream object and let lib_vsprintf
+ * do the work.
+ */
+
+ lib_syslogstream((FAR struct lib_outstream_s *)&stream);
+ return lib_vsprintf((FAR struct lib_outstream_s *)&stream, fmt, ap);
+
+#elif CONFIG_NFILE_DESCRIPTORS > 0
struct lib_rawoutstream_s rawoutstream;
diff --git a/nuttx/lib/stdio/lib_syslogstream.c b/nuttx/lib/stdio/lib_syslogstream.c
new file mode 100644
index 000000000..0b5a95144
--- /dev/null
+++ b/nuttx/lib/stdio/lib_syslogstream.c
@@ -0,0 +1,103 @@
+/****************************************************************************
+ * lib/stdio/lib_syslogstream.c
+ *
+ * Copyright (C) 2023 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <unistd.h>
+#include <errno.h>
+
+#include <nuttx/ramlog.h>
+
+#include "lib_internal.h"
+
+#ifdef CONFIG_SYSLOG
+
+/****************************************************************************
+ * Pre-processor definition
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: syslogstream_putc
+ ****************************************************************************/
+
+static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
+{
+ /* At present, the RAM log is the only supported logging device */
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+ (void)ramlog_putc(ch);
+ this->nput++;
+#endif
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lib_sylogstream
+ *
+ * Description:
+ * Initializes a stream for use with the coinfigured syslog interface.
+ *
+ * Input parameters:
+ * lowoutstream - User allocated, uninitialized instance of struct
+ * lib_lowoutstream_s to be initialized.
+ *
+ * Returned Value:
+ * None (User allocated instance initialized).
+ *
+ ****************************************************************************/
+
+void lib_sylogstream(FAR struct lib_outstream_s *stream)
+{
+ stream->put = syslogstream_putc;
+#ifdef CONFIG_STDIO_LINEBUFFER
+ stream->flush = lib_noflush;
+#endif
+ stream->nput = 0;
+}
+
+#endif /* CONFIG_SYSLOG */
+
+
diff --git a/nuttx/tools/mkconfig.c b/nuttx/tools/mkconfig.c
index 22594c0ae..7e3162b8f 100644
--- a/nuttx/tools/mkconfig.c
+++ b/nuttx/tools/mkconfig.c
@@ -1,8 +1,8 @@
/****************************************************************************
* tools/mkconfig.c
*
- * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -144,7 +144,13 @@ int main(int argc, char **argv, char **envp)
printf("# if CONFIG_NFILE_STREAMS > 0 && CONFIG_NFILE_STREAMS < 3\n");
printf("# undef CONFIG_NFILE_STREAMS\n");
printf("# define CONFIG_NFILE_STREAMS 3\n");
- printf("# endif\n");
+ printf("# endif\n\n");
+ printf("/* If no console is selected, then disable all console devices */\n\n");
+ printf("#else\n");
+ printf("# undef CONFIG_DEV_LOWCONSOLE\n");
+ printf("# undef CONFIG_RAMLOG_CONSOLE\n");
+ printf("# undef CONFIG_CDCACM_CONSOLE\n");
+ printf("# undef CONFIG_PL2303_CONSOLE\n");
printf("#endif\n\n");
printf("/* If priority inheritance is disabled, then do not allocate any\n");
printf(" * associated resources.\n");