From 3bd953316f0d1439f625727c08c0d3e9e79ac054 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 19 Jun 2016 09:12:33 -0600 Subject: [PATCH 1/4] Add a hook before the existing syslog_initialize() call; rename the old syslog_initialize() to syslog_dev_initialize(). --- drivers/syslog/Make.defs | 2 +- drivers/syslog/syslog.h | 108 +++++++++++++++++++++++++++++ drivers/syslog/syslog_device.c | 27 ++++++-- drivers/syslog/syslog_initialize.c | 87 +++++++++++++++++++++++ include/nuttx/syslog/syslog.h | 18 +++-- 5 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 drivers/syslog/syslog.h create mode 100644 drivers/syslog/syslog_initialize.c diff --git a/drivers/syslog/Make.defs b/drivers/syslog/Make.defs index 845d11f17b2..d736da59278 100644 --- a/drivers/syslog/Make.defs +++ b/drivers/syslog/Make.defs @@ -37,7 +37,7 @@ ############################################################################ # Include SYSLOG Infrastructure -CSRCS += vsyslog.c vlowsyslog.c syslogstream.c +CSRCS += syslog_initialize.c vsyslog.c vlowsyslog.c syslogstream.c # The note driver is hosted in this directory, but is not associated with # SYSLOGging diff --git a/drivers/syslog/syslog.h b/drivers/syslog/syslog.h new file mode 100644 index 00000000000..b0b6781b3de --- /dev/null +++ b/drivers/syslog/syslog.h @@ -0,0 +1,108 @@ +/**************************************************************************** + * drivers/syslog/syslog.h + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __DRIVERS_SYSLOG_SYSLOG_H +#define __DRIVERS_SYSLOG_SYSLOG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: syslog_dev_initialize + * + * Description: + * Initialize to use the character device (or file) at + * CONFIG_SYSLOG_DEVPATH as the SYSLOG sink. + * + * One power up, the SYSLOG facility is non-existent or limited to very + * low-level output. This function may be called later in the + * intialization sequence after full driver support has been initialized. + * (via syslog_initialize()) It installs the configured SYSLOG drivers + * and enables full SYSLOGing capability. + * + * NOTE that this implementation excludes using a network connection as + * SYSLOG device. That would be a good extension. + * + * Input Parameters: + * None + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SYSLOG_CHAR +int syslog_dev_initialize(void); +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __DRIVERS_SYSLOG_SYSLOG_H */ diff --git a/drivers/syslog/syslog_device.c b/drivers/syslog/syslog_device.c index 959ecc13964..360edc61af6 100644 --- a/drivers/syslog/syslog_device.c +++ b/drivers/syslog/syslog_device.c @@ -226,18 +226,31 @@ static inline void syslog_flush(void) ****************************************************************************/ /**************************************************************************** - * Name: syslog_initialize + * Name: syslog_dev_initialize * * Description: * Initialize to use the character device (or file) at * CONFIG_SYSLOG_DEVPATH as the SYSLOG sink. * + * One power up, the SYSLOG facility is non-existent or limited to very + * low-level output. This function may be called later in the + * intialization sequence after full driver support has been initialized. + * (via syslog_initialize()) It installs the configured SYSLOG drivers + * and enables full SYSLOGing capability. + * * NOTE that this implementation excludes using a network connection as * SYSLOG device. That would be a good extension. * + * Input Parameters: + * None + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure. + * ****************************************************************************/ -int syslog_initialize(void) +int syslog_dev_initialize(void) { int fd; int ret; @@ -322,9 +335,9 @@ int syslog_putc(int ch) * * (1) Before the SYSLOG device has been initialized. This could happen * from debug output that occurs early in the boot sequence before - * syslog_initialize() is called (SYSLOG_UNINITIALIZED). + * syslog_dev_initialize() is called (SYSLOG_UNINITIALIZED). * (2) While the device is being initialized. The case could happen if - * debug output is generated while syslog_initialize() executes + * debug output is generated while syslog_dev_initialize() executes * (SYSLOG_INITIALIZING). * (3) While we are generating SYSLOG output. The case could happen if * debug output is generated while syslog_putc() executes @@ -374,7 +387,7 @@ int syslog_putc(int ch) goto errout_with_errcode; } - /* syslog_initialize() is called as soon as enough of the operating + /* syslog_dev_initialize() is called as soon as enough of the operating * system is in place to support the open operation... but it is * possible that the SYSLOG device is not yet registered at that time. * In this case, we know that the system is sufficiently initialized @@ -390,12 +403,12 @@ int syslog_putc(int ch) { /* Try again to initialize the device. We may do this repeatedly * because the log device might be something that was not ready - * the first time that syslog_initializee() was called (such as a + * the first time that syslog_dev_initializee() was called (such as a * USB serial device that has not yet been connected or a file in * an NFS mounted file system that has not yet been mounted). */ - ret = syslog_initialize(); + ret = syslog_dev_initialize(); if (ret < 0) { sched_unlock(); diff --git a/drivers/syslog/syslog_initialize.c b/drivers/syslog/syslog_initialize.c new file mode 100644 index 00000000000..4ac34bc8f6d --- /dev/null +++ b/drivers/syslog/syslog_initialize.c @@ -0,0 +1,87 @@ +/**************************************************************************** + * drivers/syslog/syslog_initialize.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include + +#include + +#include "syslog.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: syslog_initialize + * + * Description: + * One power up, the SYSLOG facility is non-existent or limited to very + * low-level output. This function is called later in the intialization + * sequence after full driver support has been initialized. It installs + * the configured SYSLOG drivers and enables full SYSLOGing capability. + * + * Input Parameters: + * None + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure. + * + ****************************************************************************/ + +int syslog_initialize(void) +{ + int ret; + + /* Not much to this yet... more is coming */ + +#if defined(CONFIG_SYSLOG) && defined(CONFIG_SYSLOG_CHAR) + /* Enable use of a character device as the SYSLOG device */ + + ret = syslog_dev_initialize(); +#else + /* Nothing needs to be done */ + + ret = 0; +#endif + + return ret; +} diff --git a/include/nuttx/syslog/syslog.h b/include/nuttx/syslog/syslog.h index d6010448adb..e9572ba7903 100644 --- a/include/nuttx/syslog/syslog.h +++ b/include/nuttx/syslog/syslog.h @@ -67,7 +67,7 @@ * CONFIG_SYSLOG_CHAR - Enable the generic character device for the SYSLOG. * The full path to the SYSLOG device is provided by CONFIG_SYSLOG_DEVPATH. * A valid character device must exist at this path. It will by opened - * by syslog_initialize. + * by logic in syslog_initialize() based on the current configuration. * * NOTE: No more than one SYSLOG device should be configured. */ @@ -101,17 +101,21 @@ extern "C" * Name: syslog_initialize * * Description: - * Initialize to use the character device (or file) at - * CONFIG_SYSLOG_DEVPATH as the SYSLOG sink. + * One power up, the SYSLOG facility is non-existent or limited to very + * low-level output. This function is called later in the intialization + * sequence after full driver support has been initialized. It installs + * the configured SYSLOG drivers and enables full SYSLOGing capability. * - * NOTE that this implementation excludes using a network connection as - * SYSLOG device. That would be a good extension. + * Input Parameters: + * None + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure. * ****************************************************************************/ -#ifdef CONFIG_SYSLOG_CHAR int syslog_initialize(void); -#endif /**************************************************************************** * Name: syslog_putc From de58cb60271d90e8b165d6c245e9e05d175648bd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 19 Jun 2016 09:21:52 -0600 Subject: [PATCH 2/4] Some higher level SYSLOG features are disabled if the architecture-specific logic provides its own SYSLOG functionality --- arch/arm/src/armv7-m/Kconfig | 1 + drivers/Kconfig | 3 --- drivers/syslog/Kconfig | 25 +++++++++++++++---------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/arch/arm/src/armv7-m/Kconfig b/arch/arm/src/armv7-m/Kconfig index 406e2e46624..06527715679 100644 --- a/arch/arm/src/armv7-m/Kconfig +++ b/arch/arm/src/armv7-m/Kconfig @@ -160,6 +160,7 @@ config ARMV7M_STACKCHECK config ARMV7M_ITMSYSLOG bool "ITM SYSLOG support" default n + select ARCH_HAVE_SYSLOG select SYSLOG ---help--- Enable hooks to support ITM syslog output. This requires additional diff --git a/drivers/Kconfig b/drivers/Kconfig index df45c0d1722..a38908e5429 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -524,7 +524,4 @@ menuconfig DRIVERS_WIRELESS Drivers for various wireless devices. source drivers/wireless/Kconfig - -comment "System Logging Device Options" - source drivers/syslog/Kconfig diff --git a/drivers/syslog/Kconfig b/drivers/syslog/Kconfig index c6e0cb089e0..e8a426383a3 100644 --- a/drivers/syslog/Kconfig +++ b/drivers/syslog/Kconfig @@ -5,6 +5,12 @@ comment "System Logging" +# Selected if the architecture has its own, built-in SYSLOGgin enabled + +config ARCH_HAVE_SYSLOG + bool + default n + config RAMLOG bool "RAM log device support" default n @@ -23,7 +29,7 @@ if RAMLOG config RAMLOG_SYSLOG bool "Use RAMLOG for SYSLOG" default n - depends on SYSLOG + depends on SYSLOG && !ARCH_HAVE_SYSLOG ---help--- Use the RAM logging device for the syslogging interface. If this feature is enabled (along with SYSLOG), then all debug output (only) will be re-directed @@ -72,7 +78,13 @@ config RAMLOG_NPOLLWAITERS endif -comment "System Logging" +config DRIVER_NOTE + bool "Scheduler instrumentation driver" + default n + depends on SCHED_INSTRUMENTATION_BUFFER + ---help--- + Enable building a serial driver that can be used by an application to read data + from the in-memory, scheduler instrumentatin "note" buffer. config SYSLOG bool "Advanced SYSLOG features" @@ -95,6 +107,7 @@ if SYSLOG config SYSLOG_CHAR bool "System log character device support" default y + depends on !ARCH_HAVE_SYSLOG ---help--- Enable the generic character device for the SYSLOG. The full path to the SYSLOG device is provided by SYSLOG_DEVPATH. A valid character device (or @@ -124,11 +137,3 @@ config SYSLOG_CONSOLE output (syslog_putc). 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 syslog output. - -config DRIVER_NOTE - bool "Scheduler instrumentation driver" - default n - depends on SCHED_INSTRUMENTATION_BUFFER - ---help--- - Enable building a serial driver that can be used by an application to read data - from the in-memory, scheduler instrumentatin "note" buffer. From 0f18f3bd153d13d7acfab02700de075b9c811a16 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 19 Jun 2016 09:39:21 -0600 Subject: [PATCH 3/4] Move RAMLOG initialize from up_initialilize.c files to syslog_initialize(). up_initialize.c files now call syslog_initialize() unconditionally --- arch/arm/src/common/up_initialize.c | 7 +------ arch/avr/src/common/up_initialize.c | 7 +------ arch/hc/src/common/up_initialize.c | 7 +------ arch/mips/src/common/up_initialize.c | 7 +------ arch/sh/src/common/up_initialize.c | 7 +------ arch/sim/src/up_initialize.c | 9 +++------ arch/x86/src/common/up_initialize.c | 7 +------ arch/z16/src/common/up_initialize.c | 7 +------ arch/z80/src/common/up_initialize.c | 7 ++++++- drivers/syslog/ramlog.c | 4 ++-- drivers/syslog/syslog_initialize.c | 8 +++++++- include/nuttx/syslog/ramlog.h | 4 ++-- 12 files changed, 27 insertions(+), 54 deletions(-) diff --git a/arch/arm/src/common/up_initialize.c b/arch/arm/src/common/up_initialize.c index f926b7f0381..a37fc33e7f0 100644 --- a/arch/arm/src/common/up_initialize.c +++ b/arch/arm/src/common/up_initialize.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include @@ -248,12 +248,7 @@ void up_initialize(void) /* Initialize the system logging device */ -#ifdef CONFIG_SYSLOG_CHAR syslog_initialize(); -#endif -#ifdef CONFIG_RAMLOG_SYSLOG - ramlog_sysloginit(); -#endif #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/arch/avr/src/common/up_initialize.c b/arch/avr/src/common/up_initialize.c index b79f95876cb..6e26835f296 100644 --- a/arch/avr/src/common/up_initialize.c +++ b/arch/avr/src/common/up_initialize.c @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include @@ -267,12 +267,7 @@ void up_initialize(void) /* Initialize the system logging device */ -#ifdef CONFIG_SYSLOG_CHAR syslog_initialize(); -#endif -#ifdef CONFIG_RAMLOG_SYSLOG - ramlog_sysloginit(); -#endif #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/arch/hc/src/common/up_initialize.c b/arch/hc/src/common/up_initialize.c index 47c8abfe94a..621fae32cda 100644 --- a/arch/hc/src/common/up_initialize.c +++ b/arch/hc/src/common/up_initialize.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include "up_arch.h" @@ -186,12 +186,7 @@ void up_initialize(void) /* Initialize the system logging device */ -#ifdef CONFIG_SYSLOG_CHAR syslog_initialize(); -#endif -#ifdef CONFIG_RAMLOG_SYSLOG - ramlog_sysloginit(); -#endif #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/arch/mips/src/common/up_initialize.c b/arch/mips/src/common/up_initialize.c index dbb950424bb..d09c34e5479 100644 --- a/arch/mips/src/common/up_initialize.c +++ b/arch/mips/src/common/up_initialize.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include @@ -188,12 +188,7 @@ void up_initialize(void) /* Initialize the system logging device */ -#ifdef CONFIG_SYSLOG_CHAR syslog_initialize(); -#endif -#ifdef CONFIG_RAMLOG_SYSLOG - ramlog_sysloginit(); -#endif #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/arch/sh/src/common/up_initialize.c b/arch/sh/src/common/up_initialize.c index 89fb6579c34..6bfebb2f0dc 100644 --- a/arch/sh/src/common/up_initialize.c +++ b/arch/sh/src/common/up_initialize.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include "up_arch.h" @@ -180,12 +180,7 @@ void up_initialize(void) /* Initialize the system logging device */ -#ifdef CONFIG_SYSLOG_CHAR syslog_initialize(); -#endif -#ifdef CONFIG_RAMLOG_SYSLOG - ramlog_sysloginit(); -#endif #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/arch/sim/src/up_initialize.c b/arch/sim/src/up_initialize.c index 7efcfb23738..445012443e4 100644 --- a/arch/sim/src/up_initialize.c +++ b/arch/sim/src/up_initialize.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include "up_internal.h" @@ -168,12 +168,9 @@ void up_initialize(void) ramlog_consoleinit(); #endif -#ifdef CONFIG_SYSLOG_CHAR + /* Initialize the system logging device */ + syslog_initialize(); -#endif -#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 */ diff --git a/arch/x86/src/common/up_initialize.c b/arch/x86/src/common/up_initialize.c index 15197e93a5f..72f1b7a0758 100644 --- a/arch/x86/src/common/up_initialize.c +++ b/arch/x86/src/common/up_initialize.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include @@ -188,12 +188,7 @@ void up_initialize(void) /* Initialize the system logging device */ -#ifdef CONFIG_SYSLOG_CHAR syslog_initialize(); -#endif -#ifdef CONFIG_RAMLOG_SYSLOG - ramlog_sysloginit(); -#endif #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/arch/z16/src/common/up_initialize.c b/arch/z16/src/common/up_initialize.c index 853ae0ce7a8..597170a276f 100644 --- a/arch/z16/src/common/up_initialize.c +++ b/arch/z16/src/common/up_initialize.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include @@ -188,12 +188,7 @@ void up_initialize(void) /* Initialize the system logging device */ -#ifdef CONFIG_SYSLOG_CHAR syslog_initialize(); -#endif -#ifdef CONFIG_RAMLOG_SYSLOG - ramlog_sysloginit(); -#endif #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/arch/z80/src/common/up_initialize.c b/arch/z80/src/common/up_initialize.c index b773d958925..3032b9cdf5a 100644 --- a/arch/z80/src/common/up_initialize.c +++ b/arch/z80/src/common/up_initialize.c @@ -48,7 +48,8 @@ #include #include #include -#include +#include +#include #include @@ -182,6 +183,10 @@ void up_initialize(void) ramlog_consoleinit(); #endif + /* Initialize the system logging device */ + + syslog_initialize(); + #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c index ad62e935f15..77381017324 100644 --- a/drivers/syslog/ramlog.c +++ b/drivers/syslog/ramlog.c @@ -704,7 +704,7 @@ int ramlog_consoleinit(void) #endif /**************************************************************************** - * Name: ramlog_sysloginit + * Name: ramlog_syslog_initialize * * Description: * Use a pre-allocated RAM logging device and register it at the path @@ -716,7 +716,7 @@ int ramlog_consoleinit(void) ****************************************************************************/ #ifdef CONFIG_RAMLOG_SYSLOG -int ramlog_sysloginit(void) +int ramlog_syslog_initialize(void) { /* Register the syslog character driver */ diff --git a/drivers/syslog/syslog_initialize.c b/drivers/syslog/syslog_initialize.c index 4ac34bc8f6d..cda142268fa 100644 --- a/drivers/syslog/syslog_initialize.c +++ b/drivers/syslog/syslog_initialize.c @@ -73,10 +73,16 @@ int syslog_initialize(void) /* Not much to this yet... more is coming */ -#if defined(CONFIG_SYSLOG) && defined(CONFIG_SYSLOG_CHAR) +#if defined(CONFIG_SYSLOG_CHAR) /* Enable use of a character device as the SYSLOG device */ ret = syslog_dev_initialize(); + +#elif defined(CONFIG_RAMLOG_SYSLOG) + /* Use the RAMLOG as the SYSLOG device */ + + ramlog_syslog_initialize(); +#endif #else /* Nothing needs to be done */ diff --git a/include/nuttx/syslog/ramlog.h b/include/nuttx/syslog/ramlog.h index 75c767819cb..84d651038b8 100644 --- a/include/nuttx/syslog/ramlog.h +++ b/include/nuttx/syslog/ramlog.h @@ -183,7 +183,7 @@ int ramlog_consoleinit(void); #endif /**************************************************************************** - * Name: ramlog_sysloginit + * Name: ramlog_syslog_initialize * * Description: * Create the RAM logging device and register it at the specified path. @@ -195,7 +195,7 @@ int ramlog_consoleinit(void); ****************************************************************************/ #ifdef CONFIG_RAMLOG_SYSLOG -int ramlog_sysloginit(void); +int ramlog_syslog_initialize(void); #endif #undef EXTERN From 99ad3e9bcf340a41b150291ff67f3e6170dc6561 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 19 Jun 2016 09:41:35 -0600 Subject: [PATCH 4/4] Need to capture return value from ramlog_syslog_initialize() --- drivers/syslog/syslog_initialize.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/syslog/syslog_initialize.c b/drivers/syslog/syslog_initialize.c index cda142268fa..7c4956c6afb 100644 --- a/drivers/syslog/syslog_initialize.c +++ b/drivers/syslog/syslog_initialize.c @@ -81,12 +81,13 @@ int syslog_initialize(void) #elif defined(CONFIG_RAMLOG_SYSLOG) /* Use the RAMLOG as the SYSLOG device */ - ramlog_syslog_initialize(); -#endif + ret = ramlog_syslog_initialize(); + #else /* Nothing needs to be done */ ret = 0; + #endif return ret;