Fix a small RAM log bug (the RAM log still does not work)

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4385 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-02-12 20:27:49 +00:00
parent a563ce3647
commit 686d0f0daa
16 changed files with 90 additions and 59 deletions

View File

@ -1,4 +1,4 @@
NuttX TODO List (Last updated February 2, 2012)
NuttX TODO List (Last updated February 12, 2012)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@ -13,7 +13,7 @@ nuttx/
(1) pthreads (sched/)
(2) C++ Support
(5) Binary loaders (binfmt/)
(16) Network (net/, drivers/net)
(17) Network (net/, drivers/net)
(2) USB (drivers/usbdev, drivers/usbhost)
(8) Libraries (lib/)
(10) File system/Generic drivers (fs/, drivers/)
@ -390,13 +390,6 @@ o Network (net/, drivers/net)
Status: Open
Priority: Low unless you need it.
Title: UNFINISHED ENC28J60 DRIVER
Description: So far, I have not come up with a usable hardware platform to
verify the ENC28J60 Ethernet driver (drivers/net/enc28j60.c).
So it is untested.
Status: Open
Priority: Low unless you need it.
Title: UNTESTED IGMPv2
Description: Support for client-side IGMPv2 multicast has been added but not yet
tested (because I don't have a proper environment for multicast testing).
@ -437,6 +430,13 @@ o Network (net/, drivers/net)
Status: Open
Priority: Low... fix defconfig files as necessary.
Title: UNFINISHED ENC28J60 DRIVER
Description: So far, I have not come up with a usable hardware platform to
verify the ENC28J60 Ethernet driver (drivers/net/enc28j60.c).
So it is untested.
Status: Open
Priority: Low unless you need it.
o USB (drivers/usbdev, drivers/usbhost)
^^^^^^^^^^^^^^^^^^^^
@ -584,12 +584,6 @@ o File system / Generic drivers (fs/, drivers/)
Status: Open
Priority: Low
Title: ENC29J60 DRIVER UNTESTED
Description: ENC28J60 driver is complete, but untested (I still haven't got
a good ENC28J60 test platform).
Status: Open
Priority: Low
Title: SERIAL DRIVER DOES NOT RETURN WHEN SIGNAL RECEIVED
Description: The serial driver (drivers/serial) should return with an
error and errno=EINTR when an interrupt is received. However,
@ -611,6 +605,16 @@ o File system / Generic drivers (fs/, drivers/)
Status: Open
Priority: Medium-Low
Title: CONFIG_RAMLOG_CONSOLE/SYSLOG DOES NOT WORK
Description: When I enable CONFIG_RAMLOG_CONSOLE, the system does not come up
property (using configuration stm3240g-eval/nsh2). Apparently the
RAM logging console is non-functional(and difficult to debug with
no console). If I enabled CONFIG_RAMLOG_SYSLOG, the system comes
up, but If I enable CONFIG_DEBUG, it again hangs. Apparently any
kind of early output is fatal.
Status: Open
Priority: Medium/high
o Graphics subystem (graphics/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -81,7 +81,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -168,7 +168,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -87,7 +87,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -92,7 +92,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -78,7 +78,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -81,7 +81,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -81,7 +81,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -85,7 +85,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -51,7 +51,7 @@
* Private Definitions
****************************************************************************/
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -80,7 +80,7 @@
# endif
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -71,7 +71,7 @@
# define USE_EARLYSERIALINIT 1
#endif
/* Determine which device to use as the system loggin device */
/* Determine which device to use as the system logging device */
#ifndef CONFIG_SYSLOG
# undef CONFIG_RAMLOG_SYSLOG

View File

@ -526,6 +526,38 @@ CONFIG_SIG_SIGWORK=4
CONFIG_SCHED_WAITPID=y
CONFIG_SCHED_ATEXIT=n
#
# System Logging
#
# CONFIG_SYSLOG - Enables the System Logging feature.
# 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
#
CONFIG_SYSLOG=n
CONFIG_RAMLOG=n
CONFIG_RAMLOG_CONSOLE=n
CONFIG_RAMLOG_SYSLOG=n
#CONFIG_RAMLOG_NPOLLWAITERS
#CONFIG_RAMLOG_CONSOLE_BUFSIZE
#
# Settings for NXFLAT
#

View File

@ -553,8 +553,8 @@ CONFIG_SCHED_ATEXIT=n
CONFIG_SYSLOG=y
CONFIG_RAMLOG=y
CONFIG_RAMLOG_CONSOLE=y
CONFIG_RAMLOG_SYSLOG=y=
CONFIG_RAMLOG_CONSOLE=n
CONFIG_RAMLOG_SYSLOG=y
#CONFIG_RAMLOG_NPOLLWAITERS
#CONFIG_RAMLOG_CONSOLE_BUFSIZE

View File

@ -136,8 +136,27 @@ static const struct file_operations g_ramlogfops =
*/
#if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_RAMLOG_SYSLOG)
static struct ramlog_dev_s g_sysdev;
static char g_sysbuffer[CONFIG_RAMLOG_CONSOLE_BUFSIZE];
static char g_sysbuffer[CONFIG_RAMLOG_CONSOLE_BUFSIZE];
/* This is the device structure for the console or syslogging function. It
* must be statically initialized because the ramlog_putc function could be
* called before the driver initialization logic executes.
*/
static struct ramlog_dev_s g_sysdev =
{
#ifndef CONFIG_RAMLOG_NONBLOCKING
0, /* rl_nwaiters */
#endif
0, /* rl_head */
0, /* rl_tail */
SEM_INITIALIZER(1), /* rl_exclsem */
#ifndef CONFIG_RAMLOG_NONBLOCKING
SEM_INITIALIZER(0), /* rl_waitsem */
#endif
CONFIG_RAMLOG_CONSOLE_BUFSIZE, /* rl_bufsize */
g_sysbuffer /* rl_buffer */
};
#endif
/****************************************************************************
@ -202,10 +221,9 @@ static int ramlog_addchar(FAR struct ramlog_dev_s *priv, char ch)
if (nexthead == priv->rl_tail)
{
/* Yes... then break out of the loop to return an indication that
* nothing was saved in the buffer.
*/
/* Yes... Return an indication that nothing was saved in the buffer. */
irqrestore(flags);
return -EBUSY;
}
@ -667,15 +685,6 @@ int ramlog_consoleinit(void)
FAR struct ramlog_dev_s *priv = &g_sysdev;
int ret;
/* Initialize the RAM loggin device structure */
sem_init(&priv->rl_exclsem, 0, 1);
#ifndef CONFIG_RAMLOG_NONBLOCKING
sem_init(&priv->rl_waitsem, 0, 0);
#endif
priv->rl_bufsize = CONFIG_RAMLOG_CONSOLE_BUFSIZE;
priv->rl_buffer = g_sysbuffer;
/* Register the console character driver */
ret = register_driver("/dev/console", &g_ramlogfops, 0666, priv);
@ -707,18 +716,7 @@ int ramlog_consoleinit(void)
#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 */
sem_init(&priv->rl_exclsem, 0, 1);
#ifndef CONFIG_RAMLOG_NONBLOCKING
sem_init(&priv->rl_waitsem, 0, 0);
#endif
priv->rl_bufsize = CONFIG_RAMLOG_CONSOLE_BUFSIZE;
priv->rl_buffer = g_sysbuffer;
return register_driver("/dev/syslog", &g_ramlogfops, 0666, priv);
return register_driver("/dev/syslog", &g_ramlogfops, 0666, &g_sysdev);
}
#endif
@ -756,10 +754,7 @@ int ramlog_putc(int ch)
ret = ramlog_addchar(priv, '\r');
if (ret < 0)
{
/* 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.
*/
/* The buffer is full and nothing was saved. */
return ch;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/stdio/lib_syslogstream.c
*
* Copyright (C) 2023 Gregory Nutt. All rights reserved.
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without