diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-02-12 23:54:26 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-02-12 23:54:26 +0000 |
commit | c2079e368c183a100c549671925b66d6b993c8c2 (patch) | |
tree | 6e9e40c95947255b743c4a08926a407360d2a19c /nuttx/drivers/ramlog.c | |
parent | a8d12f6d37d46732011e008ac8252c4a3183e182 (diff) | |
download | px4-nuttx-c2079e368c183a100c549671925b66d6b993c8c2.tar.gz px4-nuttx-c2079e368c183a100c549671925b66d6b993c8c2.tar.bz2 px4-nuttx-c2079e368c183a100c549671925b66d6b993c8c2.zip |
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
Diffstat (limited to 'nuttx/drivers/ramlog.c')
-rw-r--r-- | nuttx/drivers/ramlog.c | 24 |
1 files changed, 11 insertions, 13 deletions
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 |