diff --git a/drivers/syslog/Make.defs b/drivers/syslog/Make.defs index f573217d6d..9b0d4cf6d5 100644 --- a/drivers/syslog/Make.defs +++ b/drivers/syslog/Make.defs @@ -2,7 +2,7 @@ # drivers/syslog/Make.defs # These drivers support system logging devices # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,60 +35,38 @@ ############################################################################ ############################################################################ -# Include SYSLOG drivers (only one should be enabled) +# Include SYSLOG Infrastructure -ifeq ($(CONFIG_SYSLOG),y) +CSRCS += vsyslog.c vlowsyslog.c syslogstream.c -# If no special loggin devices are implemented, then the default SYSLOG -# logic at fs/fs_syslog.c will be used - -# (Add other SYSLOG drivers here) - -ifeq ($(CONFIG_RAMLOG),y) - CSRCS += ramlog.c -endif +# The note driver is hosted in this directory, but is not associated with +# SYSLOGging ifeq ($(CONFIG_DRIVER_NOTE),y) CSRCS += note_driver.c endif -# (Add other SYSLOG_CONSOLE drivers here) +############################################################################ +# Include SYSLOG drivers (only one should be enabled) + +ifeq ($(CONFIG_RAMLOG),y) + CSRCS += ramlog.c +else ifeq ($(CONFIG_SYSLOG),y) + +# If no special logging devices are implemented, then the default SYSLOG +# logic at fs/fs_syslog.c will be used + +# (Add other SYSLOG drivers here) ifeq ($(CONFIG_SYSLOG_CONSOLE),y) CSRCS += syslog_console.c endif +# (Add other SYSLOG_CONSOLE drivers here) + +endif + # Include SYSLOG build support DEPPATH += --dep-path syslog VPATH += :syslog - -############################################################################ -# The RAMLOG can be used even if system logging is not enabled. - -else ifeq ($(CONFIG_RAMLOG),y) - -CSRCS += ramlog.c - -ifeq ($(CONFIG_DRIVER_NOTE),y) - CSRCS += note_driver.c -endif - -# Include RAMLOG build support - -DEPPATH += --dep-path syslog -VPATH += :syslog - -############################################################################ -# The scheduler note driver can be used in any event. - -else ifeq ($(CONFIG_DRIVER_NOTE),y) - -CSRCS += note_driver.c - -# Include note driver build support - -DEPPATH += --dep-path syslog -VPATH += :syslog - -endif diff --git a/libc/syslog/lib_syslogstream.c b/drivers/syslog/syslogstream.c similarity index 88% rename from libc/syslog/lib_syslogstream.c rename to drivers/syslog/syslogstream.c index 4c6cfa8c2e..f37f5942d4 100644 --- a/libc/syslog/lib_syslogstream.c +++ b/drivers/syslog/syslogstream.c @@ -1,7 +1,7 @@ /**************************************************************************** - * libc/syslog/lib_syslogstream.c + * drivers/syslog/syslogstream.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,14 +47,8 @@ #include #include -#include "syslog/syslog.h" - #ifdef CONFIG_SYSLOG -/**************************************************************************** - * Pre-processor definition - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -97,21 +91,22 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch) ****************************************************************************/ /**************************************************************************** - * Name: lib_syslogstream + * Name: syslogstream * * Description: * Initializes a stream for use with the configured syslog interface. + * Only accessible from with the OS SYSLOG logic. * * Input parameters: - * lowoutstream - User allocated, uninitialized instance of struct - * lib_lowoutstream_s to be initialized. + * stream - User allocated, uninitialized instance of struct + * lib_lowoutstream_s to be initialized. * * Returned Value: * None (User allocated instance initialized). * ****************************************************************************/ -void lib_syslogstream(FAR struct lib_outstream_s *stream) +void syslogstream(FAR struct lib_outstream_s *stream) { stream->put = syslogstream_putc; #ifdef CONFIG_STDIO_LINEBUFFER diff --git a/drivers/syslog/vlowsyslog.c b/drivers/syslog/vlowsyslog.c new file mode 100644 index 0000000000..9cc2fc5c72 --- /dev/null +++ b/drivers/syslog/vlowsyslog.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * drivers/syslog/vlowsyslog.c + * + * Copyright (C) 2007-2009, 2011-2012, 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 +#include + +#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_SYSLOG) +/* The low-level SYSLOG functions can be used only if we have access to + * either the low-level serial interface, up_putc(), and to syslog_putc() + */ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: _vlowsyslog + * + * Description: + * _vlowsyslog() handles the system logging system calls. It is functionally + * equivalent to vlowsyslog() except that the pre-process priority filtering + * has already been performed and, hence, there is no priority argument. + * + ****************************************************************************/ + +int _vlowsyslog(FAR const IPTR char *fmt, va_list ap) +{ + struct lib_outstream_s stream; + + /* Wrap the stdout in a stream object and let lib_vsprintf do the work. */ + +#ifdef CONFIG_SYSLOG + 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); +} + +#endif /* CONFIG_ARCH_LOWPUTC || CONFIG_SYSLOG */ diff --git a/drivers/syslog/vsyslog.c b/drivers/syslog/vsyslog.c new file mode 100644 index 0000000000..557c71d1cc --- /dev/null +++ b/drivers/syslog/vsyslog.c @@ -0,0 +1,195 @@ +/**************************************************************************** + * drivers/syslog/vsyslog.c + * + * Copyright (C) 2007-2009, 2011-2014, 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 +#include +#include +#include +#include + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: vsyslog_internal + * + * Description: + * This is the internal implementation of vsyslog (see the description of + * syslog and vsyslog below) + * + ****************************************************************************/ + +static inline int vsyslog_internal(FAR const IPTR char *fmt, va_list ap) +{ +#if defined(CONFIG_SYSLOG) + struct lib_outstream_s stream; +#elif CONFIG_NFILE_DESCRIPTORS > 0 + struct lib_rawoutstream_s stream; +#elif defined(CONFIG_ARCH_LOWPUTC) + struct lib_outstream_s stream; +#endif + +#if defined(CONFIG_SYSLOG_TIMESTAMP) + struct timespec ts; + + /* Get the current time. Since debug output may be generated very early + * in the start-up sequence, hardware timer support may not yet be + * available. + */ + + if (!OSINIT_HW_READY() || clock_systimespec(&ts) < 0) + { + /* Timer hardware is not available, or clock_systimespec failed */ + + ts.tv_sec = 0; + ts.tv_nsec = 0; + } +#endif + +#if defined(CONFIG_SYSLOG) + /* Wrap the low-level output in a stream object and let lib_vsprintf + * do the work. + */ + + syslogstream((FAR struct lib_outstream_s *)&stream); + +#if defined(CONFIG_SYSLOG_TIMESTAMP) + /* Pre-pend the message with the current time, if available */ + + (void)lib_sprintf((FAR struct lib_outstream_s *)&stream, + "[%6d.%06d]", ts.tv_sec, ts.tv_nsec/1000); + +#endif + + return lib_vsprintf((FAR struct lib_outstream_s *)&stream, fmt, ap); + +#elif CONFIG_NFILE_DESCRIPTORS > 0 + /* Wrap the stdout in a stream object and let lib_vsprintf + * do the work. + */ + + lib_rawoutstream(&stream, 1); + +#if defined(CONFIG_SYSLOG_TIMESTAMP) + /* Pre-pend the message with the current time, if available */ + + (void)lib_sprintf((FAR struct lib_outstream_s *)&stream, + "[%6d.%06d]", ts.tv_sec, ts.tv_nsec/1000); +#endif + + return lib_vsprintf(&stream.public, fmt, ap); + +#elif defined(CONFIG_ARCH_LOWPUTC) + /* Wrap the low-level output in a stream object and let lib_vsprintf + * do the work. + * REVISIT: lib_lowoutstream() is only available in the FLAT build or + * the kernel phase of other builds. + */ + + lib_lowoutstream((FAR struct lib_outstream_s *)&stream); + +#if defined(CONFIG_SYSLOG_TIMESTAMP) + /* Pre-pend the message with the current time, if available */ + + (void)lib_sprintf((FAR struct lib_outstream_s *)&stream, + "[%6d.%06d]", ts.tv_sec, ts.tv_nsec/1000); +#endif + + return lib_vsprintf((FAR struct lib_outstream_s *)&stream, fmt, ap); + +#else /* CONFIG_SYSLOG */ + + return 0; + +#endif /* CONFIG_SYSLOG */ +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: _vsyslog + * + * Description: + * _vsyslog() handles the system logging system calls. It is functionally + * equivalent to vsyslog() except that the pre-process priority filtering + * has already been performed and, hence, there is no priority argument. + * + ****************************************************************************/ + +int _vsyslog(FAR const IPTR char *fmt, va_list ap) +{ + int ret = 0; + +#if !defined(CONFIG_SYSLOG) && CONFIG_NFILE_DESCRIPTORS > 0 + /* We are generating output on stdout. So check if this function was + * called from an interrupt handler. We cannot send data to stdout from + * an interrupt handler. + */ + + if (up_interrupt_context()) + { +#ifdef CONFIG_ARCH_LOWPUTC + /* But the low-level serial interface up_putc() is provided so we may + * be able to generate low-level serial output instead. + * NOTE: The low-level serial output is not necessarily the same + * output destination as stdout! + */ + + ret = _lowvsyslog(fmt, ap); + +#endif /* CONFIG_ARCH_LOWPUTC */ + } + else +#endif /* !CONFIG_SYSLOG && CONFIG_NFILE_DESCRIPTORS > 0 */ + { + /* Let vsylog_internal do the deed */ + + ret = vsyslog_internal(fmt, ap); + } + + return ret; +} diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h index ab57b33b35..f038991ee8 100644 --- a/include/nuttx/streams.h +++ b/include/nuttx/streams.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/streams.h * - * Copyright (C) 2009, 2011-2012, 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2012, 2014-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -354,14 +354,15 @@ void lib_nullinstream(FAR struct lib_instream_s *nullinstream); void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream); /**************************************************************************** - * Name: lib_sylogstream + * Name: syslogstream * * Description: * Initializes a stream for use with the configured syslog interface. + * Only accessible from with the OS SYSLOG logic. * * Input parameters: - * lowoutstream - User allocated, uninitialized instance of struct - * lib_lowoutstream_s to be initialized. + * stream - User allocated, uninitialized instance of struct + * lib_lowoutstream_s to be initialized. * * Returned Value: * None (User allocated instance initialized). @@ -369,7 +370,7 @@ void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream); ****************************************************************************/ #ifdef CONFIG_SYSLOG -void lib_syslogstream(FAR struct lib_outstream_s *stream); +void syslogstream(FAR struct lib_outstream_s *stream); #endif /**************************************************************************** diff --git a/include/nuttx/syslog/syslog.h b/include/nuttx/syslog/syslog.h index 836440da81..073d11646c 100644 --- a/include/nuttx/syslog/syslog.h +++ b/include/nuttx/syslog/syslog.h @@ -2,7 +2,7 @@ * include/nuttx/syslog/syslog.h * The NuttX SYSLOGing interface * - * Copyright (C) 2012, 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -128,6 +128,19 @@ int syslog_initialize(void); int syslog_putc(int ch); #endif +/**************************************************************************** + * Name: _vsyslog and _vlowsyslog + * + * Description: + * _vsyslog() handles the system logging system calls. It is functionally + * equivalent to vsyslog() except that the pre-process priority filtering + * has already been performed and, hence, there is no priority argument. + * + ****************************************************************************/ + +int _vsyslog(FAR const IPTR char *src, va_list ap); +int _lowvsyslog(FAR const IPTR char *src, va_list ap); + #undef EXTERN #ifdef __cplusplus } diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 9fc12fa39c..389c11bf08 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -232,7 +232,7 @@ /* Unconditional system logging */ -#define SYS_vsyslog (__SYS_syslog+0) +#define SYS__vsyslog (__SYS_syslog+0) #define __SYS_descriptors (__SYS_syslog+1) /* The following are defined if either file or socket descriptor are diff --git a/libc/syslog/Make.defs b/libc/syslog/Make.defs index 7ebdc907cf..907071a86b 100644 --- a/libc/syslog/Make.defs +++ b/libc/syslog/Make.defs @@ -37,10 +37,6 @@ CSRCS += lib_syslog.c lib_lowsyslog.c lib_setlogmask.c -ifeq ($(CONFIG_SYSLOG),y) -CSRCS += lib_syslogstream.c -endif - # Add the syslog directory to the build DEPPATH += --dep-path syslog diff --git a/libc/syslog/lib_lowsyslog.c b/libc/syslog/lib_lowsyslog.c index 8c4b7ed959..5cd82c1463 100644 --- a/libc/syslog/lib_lowsyslog.c +++ b/libc/syslog/lib_lowsyslog.c @@ -1,7 +1,7 @@ /**************************************************************************** * lib/syslog/lib_lowsyslog.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -39,10 +39,9 @@ #include -#include #include -#include +#include #include "syslog/syslog.h" @@ -57,33 +56,6 @@ * kernel two pass builds. */ -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: lowvsyslog_internal - * - * Description: - * This is the internal implementation of lowvsyslog (see the description - * of lowsyslog and lowvsyslog below) - * - ****************************************************************************/ - -static inline int lowvsyslog_internal(FAR const IPTR char *fmt, va_list ap) -{ - struct lib_outstream_s stream; - - /* Wrap the stdout in a stream object and let lib_vsprintf do the work. */ - -#ifdef CONFIG_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); -} - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -106,9 +78,9 @@ int lowvsyslog(int priority, FAR const IPTR char *fmt, va_list ap) if ((g_syslog_mask & LOG_MASK(priority)) != 0) { - /* Yes.. let vsylog_internal to the deed */ + /* Perform the _lowvsyslog system call */ - ret = lowvsyslog_internal(fmt, ap); + ret = _lowvsyslog(fmt, ap); } return ret; diff --git a/libc/syslog/lib_syslog.c b/libc/syslog/lib_syslog.c index 66f8b236f7..5ac55eb6b7 100644 --- a/libc/syslog/lib_syslog.c +++ b/libc/syslog/lib_syslog.c @@ -39,116 +39,12 @@ #include -#include #include -#include -#include -#include -#include +#include #include "syslog/syslog.h" -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: vsyslog_internal - * - * Description: - * This is the internal implementation of vsyslog (see the description of - * syslog and vsyslog below) - * - ****************************************************************************/ - -static inline int vsyslog_internal(FAR const IPTR char *fmt, va_list ap) -{ -#if defined(CONFIG_SYSLOG) - struct lib_outstream_s stream; -#elif CONFIG_NFILE_DESCRIPTORS > 0 - struct lib_rawoutstream_s stream; -#elif defined(CONFIG_ARCH_LOWPUTC) - struct lib_outstream_s stream; -#endif - -#if defined(CONFIG_SYSLOG_TIMESTAMP) - struct timespec ts; - - /* Get the current time. Since debug output may be generated very early - * in the start-up sequence, hardware timer support may not yet be - * available. - */ - - if (!OSINIT_HW_READY() || clock_systimespec(&ts) < 0) - { - /* Timer hardware is not available, or clock_systimespec failed */ - - ts.tv_sec = 0; - ts.tv_nsec = 0; - } -#endif - -#if defined(CONFIG_SYSLOG) - /* Wrap the low-level output in a stream object and let lib_vsprintf - * do the work. - * REVISIT: lib_syslogstream() is only available in the FLAT build or - * the kernel phase of other builds. - */ - - lib_syslogstream((FAR struct lib_outstream_s *)&stream); - -#if defined(CONFIG_SYSLOG_TIMESTAMP) - /* Pre-pend the message with the current time, if available */ - - (void)lib_sprintf((FAR struct lib_outstream_s *)&stream, - "[%6d.%06d]", ts.tv_sec, ts.tv_nsec/1000); - -#endif - - return lib_vsprintf((FAR struct lib_outstream_s *)&stream, fmt, ap); - -#elif CONFIG_NFILE_DESCRIPTORS > 0 - /* Wrap the stdout in a stream object and let lib_vsprintf - * do the work. - */ - - lib_rawoutstream(&stream, 1); - -#if defined(CONFIG_SYSLOG_TIMESTAMP) - /* Pre-pend the message with the current time, if available */ - - (void)lib_sprintf((FAR struct lib_outstream_s *)&stream, - "[%6d.%06d]", ts.tv_sec, ts.tv_nsec/1000); -#endif - - return lib_vsprintf(&stream.public, fmt, ap); - -#elif defined(CONFIG_ARCH_LOWPUTC) - /* Wrap the low-level output in a stream object and let lib_vsprintf - * do the work. - * REVISIT: lib_lowoutstream() is only available in the FLAT build or - * the kernel phase of other builds. - */ - - lib_lowoutstream((FAR struct lib_outstream_s *)&stream); - -#if defined(CONFIG_SYSLOG_TIMESTAMP) - /* Pre-pend the message with the current time, if available */ - - (void)lib_sprintf((FAR struct lib_outstream_s *)&stream, - "[%6d.%06d]", ts.tv_sec, ts.tv_nsec/1000); -#endif - - return lib_vsprintf((FAR struct lib_outstream_s *)&stream, fmt, ap); - -#else /* CONFIG_SYSLOG */ - - return 0; - -#endif /* CONFIG_SYSLOG */ -} - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -167,43 +63,13 @@ int vsyslog(int priority, FAR const IPTR char *fmt, va_list ap) { int ret = 0; -#if defined(CONFIG_BUILD_FLAT) || defined (__KERNEL__) - /* up_interrupt_context() and lowvsyslog() are only available in the FLAT - * build or during the kernel pass of the protected or kernel two pass - * builds. - */ + /* Check if this priority is enabled */ -#if !defined(CONFIG_SYSLOG) && CONFIG_NFILE_DESCRIPTORS > 0 - /* We are generating output on stdout. So check if this function was - * called from an interrupt handler. We cannot send data to stdout from - * an interrupt handler. - */ - - if (up_interrupt_context()) + if ((g_syslog_mask & LOG_MASK(priority)) != 0) { -#ifdef CONFIG_ARCH_LOWPUTC - /* But the low-level serial interface up_putc() is provided so we may - * be able to generate low-level serial output instead. - * NOTE: The low-level serial output is not necessarily the same - * output destination as stdout! - */ + /* Yes.. lPerform the _vsyslog system cal */ - ret = lowvsyslog(priority, fmt, ap); - -#endif /* CONFIG_ARCH_LOWPUTC */ - } - else -#endif /* !CONFIG_SYSLOG && CONFIG_NFILE_DESCRIPTORS > 0 */ -#endif /* CONFIG_BUILD_FLAT || __KERNEL */ - { - /* Check if this priority is enabled */ - - if ((g_syslog_mask & LOG_MASK(priority)) != 0) - { - /* Yes.. let vsylog_internal do the deed */ - - ret = vsyslog_internal(fmt, ap); - } + ret = _vsyslog(fmt, ap); } return ret; diff --git a/libc/syslog/syslog.h b/libc/syslog/syslog.h index 3188d3f2d6..31ad268770 100644 --- a/libc/syslog/syslog.h +++ b/libc/syslog/syslog.h @@ -41,7 +41,6 @@ ****************************************************************************/ #include -#include /**************************************************************************** * Public Data diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 4579f3dedb..573de95364 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -159,7 +159,7 @@ "up_assert","assert.h","","void","FAR const uint8_t*","int" #"up_assert","assert.h","","void" "vfork","unistd.h","defined(CONFIG_ARCH_HAVE_VFORK)","pid_t" -"vsyslog","syslog.h","","int","int","FAR const IPTR char*","va_list" +"_vsyslog","syslog.h","","int","FAR const IPTR char*","va_list" "wait","sys/wait.h","defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_SCHED_HAVE_PARENT)","pid_t","int*" "waitid","sys/wait.h","defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_SCHED_HAVE_PARENT)","int","idtype_t","id_t"," FAR siginfo_t *","int" "waitpid","sys/wait.h","defined(CONFIG_SCHED_WAITPID)","pid_t","pid_t","int*","int" diff --git a/syscall/syscall_funclookup.c b/syscall/syscall_funclookup.c index 7d4cbc5ef6..8e62470103 100644 --- a/syscall/syscall_funclookup.c +++ b/syscall/syscall_funclookup.c @@ -72,7 +72,6 @@ #include #include #include -#include #include /* Errno access is awkward. We need to generate get_errno() and set_errno() diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index cc72809fd0..2194a6e644 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -165,7 +165,7 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) /* System logging */ - SYSCALL_LOOKUP(vsyslog, 3, STUB_vsyslog) + SYSCALL_LOOKUP(_vsyslog, 2, STUB__vsyslog) /* The following are defined if either file or socket descriptor are * enabled. diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index 0c0c589fef..c587401b57 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -167,8 +167,7 @@ uintptr_t STUB_timer_settime(int nbr, uintptr_t parm1, uintptr_t parm2, /* System logging */ -uintptr_t STUB_vsyslog(int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3); +uintptr_t STUB__vsyslog(int nbr, uintptr_t parm1, uintptr_t parm2); /* The following are defined if either file or socket descriptor are * enabled.