From c2079e368c183a100c549671925b66d6b993c8c2 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 12 Feb 2012 23:54:26 +0000 Subject: Add interface to enabled/disable debug output git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4386 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/drivers/ramlog.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'nuttx/drivers') diff --git a/nuttx/drivers/ramlog.c b/nuttx/drivers/ramlog.c index b3dd81b65..e3cd057a7 100644 --- a/nuttx/drivers/ramlog.c +++ b/nuttx/drivers/ramlog.c @@ -402,6 +402,9 @@ errout_without_sem: ramlog_pollnotify(priv, POLLOUT); } #endif + + /* Return the number of characters actually read */ + return nread; } @@ -502,9 +505,12 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size } #endif - /* Return the number of bytes written */ + /* We always have to return the number of bytes requested and NOT the + * number of bytes that were actually written. Otherwise, callers + * will think that this is a short write and probably retry (causing + */ - return nwritten; + return len; } /**************************************************************************** @@ -688,16 +694,6 @@ int ramlog_consoleinit(void) /* 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 @@ -713,9 +709,11 @@ int ramlog_consoleinit(void) * ****************************************************************************/ -#if !defined(CONFIG_RAMLOG_CONSOLE) && defined(CONFIG_RAMLOG_SYSLOG) +#ifdef CONFIG_RAMLOG_SYSLOG int ramlog_sysloginit(void) { + /* Register the syslog character driver */ + return register_driver("/dev/syslog", &g_ramlogfops, 0666, &g_sysdev); } #endif -- cgit v1.2.3