summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-28 19:01:14 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-28 19:01:14 +0000
commit96c66099109df5198d95ed32b5278bb574f4c8e5 (patch)
treeacd75c9f9d73075b8a1beef2a26e939f63ae353c
parenta9ead1328ee2c67363e580946564c80ed91d96ff (diff)
downloadnuttx-96c66099109df5198d95ed32b5278bb574f4c8e5.tar.gz
nuttx-96c66099109df5198d95ed32b5278bb574f4c8e5.tar.bz2
nuttx-96c66099109df5198d95ed32b5278bb574f4c8e5.zip
Add perror()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5061 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xapps/ChangeLog.txt4
-rw-r--r--apps/nshlib/Kconfig3
-rw-r--r--apps/nshlib/README.txt4
-rw-r--r--apps/nshlib/nsh.h7
-rw-r--r--nuttx/ChangeLog10
-rw-r--r--nuttx/Documentation/NuttShell.html7
-rw-r--r--nuttx/Documentation/NuttxPortingGuide.html27
-rw-r--r--nuttx/configs/README.txt31
-rw-r--r--nuttx/include/stdio.h1
-rw-r--r--nuttx/lib/Kconfig44
-rw-r--r--nuttx/lib/stdio/lib_perror.c130
-rw-r--r--nuttx/lib/string/lib_strerror.c144
-rw-r--r--nuttx/sched/sem_holder.c5
13 files changed, 396 insertions, 21 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 361fb97dc..e5c0b33a5 100755
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -289,5 +289,5 @@
threds to no more than 3 of each priority. Bad things happen
when the existing logic tried to created several hundred test
treads!
-
-
+ * apps/nshlib/nsh.h: Both CONFIG_LIBC_STRERROR and CONFIG_NSH_STRERROR
+ must be defined to use strerror() with NSH.
diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig
index 7e419bdde..ff692f43b 100644
--- a/apps/nshlib/Kconfig
+++ b/apps/nshlib/Kconfig
@@ -148,9 +148,12 @@ config NSH_FILEIOSIZE
config NSH_STRERROR
bool "Use strerror()"
default n
+ depends on LIBC_STRERROR
---help---
strerror(errno) makes more readable output but strerror() is
very large and will not be used unless this setting is 'y'
+ This setting depends upon the strerror() having been enabled
+ with LIBC_STRERROR.
config NSH_LINELEN
int "Max command line length"
diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt
index d8edd8969..0f6aee759 100644
--- a/apps/nshlib/README.txt
+++ b/apps/nshlib/README.txt
@@ -915,7 +915,9 @@ NSH-Specific Configuration Settings
* CONFIG_NSH_STRERROR
strerror(errno) makes more readable output but strerror() is
- very large and will not be used unless this setting is 'y'
+ very large and will not be used unless this setting is 'y'.
+ This setting depends upon the strerror() having been enabled
+ with CONFIG_LIBC_STRERROR.
* CONFIG_NSH_LINELEN
The maximum length of one command line and of one output line.
diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h
index 439c2ffd1..dac91ba05 100644
--- a/apps/nshlib/nsh.h
+++ b/apps/nshlib/nsh.h
@@ -238,9 +238,14 @@
#define NSH_MAX_ARGUMENTS 6
/* strerror() produces much nicer output but is, however, quite large and
- * will only be used if CONFIG_NSH_STRERROR is defined.
+ * will only be used if CONFIG_NSH_STRERROR is defined. Note that the strerror
+ * interface must also have been enabled with CONFIG_LIBC_STRERROR.
*/
+#ifndef CONFIG_LIBC_STRERROR
+# undef CONFIG_NSH_STRERROR
+#endif
+
#ifdef CONFIG_NSH_STRERROR
# define NSH_ERRNO strerror(errno)
# define NSH_ERRNO_OF(err) strerror(err)
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index eff224f79..c3c81108e 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -3202,4 +3202,12 @@
for control transfers but does not resolve all of the issues.
* configs/stm3220g-eval/*/defconfig: Calibrated delay loop. It had
never been calibrated was was way off.
-
+ * sched/sem_holder.c: Add logic to handler some priority inheritance
+ cases when sem_post() is called from an interrupt handler. The
+ logic is clearly wrong, but it is not known if this is the
+ cause of any known bugs.
+ * lib/stdio/lib_perror(): Add perror(). Contributed by Kate.
+ * lib/string/lib_strerror(): Add option CONFIG_LIBC_STRERROR that
+ is now required to enabled strerror(). Add an option
+ CONFIG_LIBC_STRERROR_SHORT that can be used to output shortened
+ strings by strerror().
diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html
index ca7e82627..2cb4bc9a4 100644
--- a/nuttx/Documentation/NuttShell.html
+++ b/nuttx/Documentation/NuttShell.html
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
- <p>Last Updated: August 7, 2012</p>
+ <p>Last Updated: August 28, 2012</p>
</td>
</tr>
</table>
@@ -2284,8 +2284,9 @@ nsh>
<tr>
<td valign="top"><b><code>CONFIG_NSH_STRERROR</code></b></td>
<td>
- strerror(errno) makes more readable output but strerror() is
- very large and will not be used unless this setting is <i>y</i>
+ <code>strerror(errno)</code> makes more readable output but <code>strerror()</code> is
+ very large and will not be used unless this setting is <i>y</i>.
+ This setting depends upon the <code>strerror()</code> having been enabled with <code>CONFIG_LIBC_STRERROR</code>.
</td>
</tr>
<tr>
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html
index 78c1327e2..a0f23e1e8 100644
--- a/nuttx/Documentation/NuttxPortingGuide.html
+++ b/nuttx/Documentation/NuttxPortingGuide.html
@@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec">
<i>NuttX RTOS Porting Guide</i>
</font></big></h1>
- <p>Last Updated: July 8, 2012</p>
+ <p>Last Updated: August 28, 2012</p>
</td>
</tr>
</table>
@@ -4350,6 +4350,31 @@ build
<code>CONFIG_LIBC_FLOATINGPOINT</code>: By default, floating point
support in <code>printf</code>, <code>sscanf</code>, etc. is disabled.
</li>
+ <li>
+ <code>CONFIG_LIBC_STRERROR</code>:
+ <code>strerror()</code> is useful because it decodes <code>errno</code> values into a human readable strings.
+ But it can also require a lot of memory to store the strings.
+ If this option is selected, <code>strerror()</code> will still exist in the build but it will not decode error values.
+ This option should be used by other logic to decide if it should use <code>strerror()</code> or not.
+ For example, the NSH application will not use <code>strerror()</code> if this option is not selected;
+ <code>perror(</code>) will not use strerror() is this option is not selected (see also <code>CONFIG_NSH_STRERROR</code>).
+ </li>
+ <li>
+ <code>CONFIG_LIBC_STRERROR_SHORT</code>:
+ If this option is selected, then <code>strerror()</code> will use a shortened string when it decodes the error.
+ Specifically, <code>strerror()</code> is simply use the string that is the common name for the error.
+ For example, the <code>errno</code> value of 2 will produce the string &quot;No such file or directory&quot; is <code>CONFIG_LIBC_STRERROR_SHORT</code> is not defined but the string &quot;ENOENT&quot; is <code>CONFIG_LIBC_STRERROR_SHORT</code> is defined.
+ </li>
+ <li>
+ <code>CONFIG_LIBC_PERROR_STDOUT</code>:
+ POSIX requires that <code>perror()</code> provide its output on <code>stderr</code>.
+ This option may be defined, however, to provide <code>perror()</code> output that is serialized with other <code>stdout</code> messages.
+ </li>
+ <li>
+ <code>CONFIG_LIBC_PERROR_DEVNAME</code>:
+ Another non-standard option is to provide <code>perror()</code> output to a logging device or file.
+ <code>CONFIG_LIBC_PERROR_DEVNAME<code> may be defined to be any write-able, character device (or file).
+ </li>
</ul>
<h2>Allow for architecture optimized implementations</h2>
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index 7da0aa062..1a5e3c9d7 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -331,7 +331,7 @@ defconfig -- This is a configuration file similar to the Linux
threads (minus 1) than can be waiting for another thread
to release a count on a semaphore. This value may be set
to zero if no more than one thread is expected to wait for
- a semaphore. If defined, then this should be a relatively
+ a semaphore. If defined, then this should be a relatively
small number because this the number of maximumum of waiters
on one semaphore (like 4 or 8).
CONFIG_FDCLONE_DISABLE. Disable cloning of all file descriptors
@@ -546,10 +546,31 @@ defconfig -- This is a configuration file similar to the Linux
Misc libc settings
- CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
- little smaller if we do not support fieldwidthes
- CONFIG_LIBC_FLOATINGPOINT - By default, floating point
- support in printf, sscanf, etc. is disabled.
+ CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a little smaller
+ if we do not support fieldwidthes
+ CONFIG_LIBC_FLOATINGPOINT - By default, floating point support in printf,
+ sscanf, etc. is disabled.
+ CONFIG_LIBC_STRERROR - strerror() is useful because it decodes 'errno'
+ values into a human readable strings. But it can also require
+ a lot of memory. If this option is selected, strerror() will still
+ exist in the build but it will not decode error values. This option
+ should be used by other logic to decide if it should use strerror() or
+ not. For example, the NSH application will not use strerror() if this
+ option is not selected; perror() will not use strerror() is this option
+ is not selected (see also CONFIG_NSH_STRERROR).
+ CONFIG_LIBC_STRERROR_SHORT - If this option is selected, then strerror()
+ will use a shortened string when it decodes the error. Specifically,
+ strerror() is simply use the string that is the common name for the
+ error. For example, the 'errno' value of 2 will produce the string
+ "No such file or directory" is CONFIG_LIBC_STRERROR_SHORT is not
+ defined but the string "ENOENT" is CONFIG_LIBC_STRERROR_SHORT is
+ defined.
+ CONFIG_LIBC_PERROR_STDOUT - POSIX requires that perror() provide its output
+ on stderr. This option may be defined, however, to provide perror() output
+ that is serialized with other stdout messages.
+ CONFIG_LIBC_PERROR_DEVNAME - Another non-standard option is to provide
+ perror() output to a logging device or file. CONFIG_LIBC_PERROR_DEVNAME
+ may be defined to be any write-able, character device (or file).
Allow for architecture optimized implementations
diff --git a/nuttx/include/stdio.h b/nuttx/include/stdio.h
index 82bf0eaf6..e9218046c 100644
--- a/nuttx/include/stdio.h
+++ b/nuttx/include/stdio.h
@@ -128,6 +128,7 @@ EXTERN int sprintf(FAR char *buf, const char *format, ...);
EXTERN int asprintf (FAR char **ptr, const char *fmt, ...);
EXTERN int snprintf(FAR char *buf, size_t size, const char *format, ...);
EXTERN int sscanf(const char *buf, const char *fmt, ...);
+EXTERN void perror(FAR const char *s);
EXTERN int ungetc(int c, FAR FILE *stream);
EXTERN int vprintf(FAR const char *format, va_list ap);
diff --git a/nuttx/lib/Kconfig b/nuttx/lib/Kconfig
index 9e60201c2..d94a274f9 100644
--- a/nuttx/lib/Kconfig
+++ b/nuttx/lib/Kconfig
@@ -23,7 +23,7 @@ config NUNGET_CHARS
---help---
Number of characters that can be buffered by ungetc() (Only if NFILE_STREAMS > 0)
-config CONFIG_LIB_HOMEDIR
+config LIB_HOMEDIR
string "Home directory"
default "/"
depends on !DISABLE_ENVIRON
@@ -51,6 +51,46 @@ config LIBC_FLOATINGPOINT
By default, floating point
support in printf, sscanf, etc. is disabled.
+config LIBC_STRERROR
+ bool "Enable strerror"
+ default n
+ ---help---
+ strerror() is useful because it decodes 'errno' values into a human readable
+ strings. But it can also require a lot of memory. If this option is selected,
+ strerror() will still exist in the build but it will not decode error values.
+ This option should be used by other logic to decide if it should use strerror()
+ or not. For example, the NSH application will not use strerror() if this
+ option is not selected; perror() will not use strerror() is this option is not
+ selected (see also NSH_STRERROR).
+
+config LIBC_STRERROR_SHORT
+ bool "Use short error descriptions in strerror()"
+ default n
+ depends on LIBC_STRERROR
+ ---help---
+ If this option is selected, then strerror() will use a shortened string when
+ it decodes the error. Specifically, strerror() is simply use the string that
+ is the common name for the error. For example, the 'errno' value of 2 will
+ produce the string "No such file or directory" is LIBC_STRERROR_SHORT
+ is not defined but the string "ENOENT" is LIBC_STRERROR_SHORT is defined.
+
+config LIBC_PERROR_STDOUT
+ bool "perror() to stdout"
+ default n
+ ---help---
+ POSIX requires that perror() provide its output on stderr. This option may
+ be defined, however, to provide perror() output that is serialized with
+ other stdout messages.
+
+config LIBC_PERROR_DEVNAME
+ string "perror() to device"
+ default "/dev/console"
+ depends on !LIBC_PERROR_STDOUT
+ ---help---
+ Another non-standard option is to provide perror() output to a logging device
+ or file. LIBC_PERROR_DEVNAME may be defined to be any write-able,
+ character device (or file).
+
config ARCH_LOWPUTC
bool "Low-level console output"
default "y"
@@ -68,7 +108,7 @@ config ENABLE_ARCH_OPTIMIZED_FUN
The architecture may provide custom versions of certain
standard header files:
- config ARCH_MATH_H, CONFIG_ARCH_STDBOOL_H, CONFIG_ARCH_STDINT_H
+ config ARCH_MATH_H, ARCH_STDBOOL_H, ARCH_STDINT_H
if ENABLE_ARCH_OPTIMIZED_FUN
config ARCH_MEMCPY
diff --git a/nuttx/lib/stdio/lib_perror.c b/nuttx/lib/stdio/lib_perror.c
new file mode 100644
index 000000000..e065e14b8
--- /dev/null
+++ b/nuttx/lib/stdio/lib_perror.c
@@ -0,0 +1,130 @@
+/****************************************************************************
+ * lib/stdio/lib_perror.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * 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 <nuttx/config.h>
+
+#include <stdio.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* POSIX requires that perror provide its output on stderr. This option may
+ * be defined, however, to provide perror output that is serialized with
+ * other stdout messages.
+ */
+
+#ifdef CONFIG_LIBC_PERROR_STDOUT
+# define PERROR_STREAM stdout
+# undef CONFIG_LIBC_PERROR_DEVNAME
+#endif
+
+/* Another non-standard option is to provide perror output to a logging
+ * device or file. CONFIG_LIBC_PERROR_DEVNAME may be defined to be any write-
+ * able, character device (or file).
+ */
+
+#ifndef CONFIG_LIBC_PERROR_DEVNAME
+# define PERROR_STREAM stderr
+#else
+# define PERROR_STREAM perror_stream;
+#endif
+
+/****************************************************************************
+ * Private Type Declarations
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifndef CONFIG_LIBC_PERROR_DEVNAME
+static FILE *perror_stream;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: perror
+ ****************************************************************************/
+
+void perror(FAR const char *s)
+{
+ /* If we are using a custom output device (something other than
+ * /dev/console), then make sure that the device has been opened.
+ */
+
+#ifdef CONFIG_LIBC_PERROR_DEVNAME
+ if (!perror_stream)
+ {
+ /* Not yet.. open it now */
+
+ perror_stream = fopen(CONFIG_LIBC_PERROR_DEVNAME, "w");
+ if (!perror_stream)
+ {
+ /* Oops... we couldn't open the device */
+
+ return;
+ }
+ }
+#endif
+
+ /* If strerror() is not enabled, then just print the error number */
+
+#ifdef CONFIG_LIBC_STRERROR
+ (void)fprintf(PERROR_STREAM, "%s: %s\n", s, strerror(errno));
+#else
+ (void)fprintf(PERROR_STREAM, "%s: Error %d\n", s, errno);
+#endif
+}
diff --git a/nuttx/lib/string/lib_strerror.c b/nuttx/lib/string/lib_strerror.c
index 580974fa6..249f695c1 100644
--- a/nuttx/lib/string/lib_strerror.c
+++ b/nuttx/lib/string/lib_strerror.c
@@ -1,8 +1,8 @@
/************************************************************************
* lib/string/lib_strerror.c
*
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -61,6 +61,8 @@ struct errno_strmap_s
* Private Data
************************************************************************/
+#ifdef CONFIG_LIBC_STRERROR
+
/* This table maps all error numbers to descriptive strings.
* The only assumption that the code makes with regard to this
* this table is that it is ordered by error number.
@@ -70,6 +72,8 @@ struct errno_strmap_s
* strings.
*/
+#ifndef CONFIG_LIBC_STRERROR_SHORT
+
static const struct errno_strmap_s g_errnomap[] =
{
{ EPERM, EPERM_STR },
@@ -196,8 +200,140 @@ static const struct errno_strmap_s g_errnomap[] =
{ EMEDIUMTYPE, EMEDIUMTYPE_STR }
};
+#else /* CONFIG_LIBC_STRERROR_SHORT */
+
+static const struct errno_strmap_s g_errnomap[] =
+{
+ { EPERM, "EPERM" },
+ { ENOENT, "ENOENT" },
+ { ESRCH, "ESRCH" },
+ { EINTR, "EINTR" },
+ { EIO, "EIO" },
+ { ENXIO, "ENXIO" },
+ { E2BIG, "E2BIG" },
+ { ENOEXEC, "ENOEXEC" },
+ { EBADF, "EBADF" },
+ { ECHILD, "ECHILD" },
+ { EAGAIN, "EAGAIN" },
+ { ENOMEM, "ENOMEM" },
+ { EACCES, "EACCES" },
+ { EFAULT, "EFAULT" },
+ { ENOTBLK, "ENOTBLK" },
+ { EBUSY, "EBUSY" },
+ { EEXIST, "EEXIST" },
+ { EXDEV, "EXDEV" },
+ { ENODEV, "ENODEV" },
+ { ENOTDIR, "ENOTDIR" },
+ { EISDIR, "EISDIR" },
+ { EINVAL, "EINVAL" },
+ { ENFILE, "ENFILE" },
+ { EMFILE, "EMFILE" },
+ { ENOTTY, "ENOTTY" },
+ { ETXTBSY, "ETXTBSY" },
+ { EFBIG, "EFBIG" },
+ { ENOSPC, "ENOSPC" },
+ { ESPIPE, "ESPIPE" },
+ { EROFS, "EROFS" },
+ { EMLINK, "EMLINK" },
+ { EPIPE, "EPIPE" },
+ { EDOM, "EDOM" },
+ { ERANGE, "ERANGE" },
+ { EDEADLK, "EDEADLK" },
+ { ENAMETOOLONG, "ENAMETOOLONG" },
+ { ENOLCK, "ENOLCK" },
+ { ENOSYS, "ENOSYS" },
+ { ENOTEMPTY, "ENOTEMPTY" },
+ { ELOOP, "ELOOP" },
+ { ENOMSG, "ENOMSG" },
+ { EIDRM, "EIDRM" },
+ { ECHRNG, "ECHRNG" },
+ { EL2NSYNC, "EL2NSYNC" },
+ { EL3HLT, "EL3HLT" },
+ { EL3RST, "EL3RST" },
+ { EL3RST, "EL3RST" },
+ { EUNATCH, "EUNATCH" },
+ { ENOCSI, "ENOCSI" },
+ { EL2HLT, "EL2HLT" },
+ { EBADE, "EBADE" },
+ { EBADR, "EBADR" },
+ { EXFULL, "EXFULL" },
+ { ENOANO, "ENOANO" },
+ { EBADRQC, "EBADRQC" },
+ { EBADSLT, "EBADSLT" },
+ { EBFONT, "EBFONT" },
+ { ENOSTR, "ENOSTR" },
+ { ENODATA, "ENODATA" },
+ { ETIME, "ETIME" },
+ { ENOSR, "ENOSR" },
+ { ENONET, "ENONET" },
+ { ENOPKG, "ENOPKG" },
+ { EREMOTE, "EREMOTE" },
+ { ENOLINK, "ENOLINK" },
+ { EADV, "EADV" },
+ { ESRMNT, "ESRMNT" },
+ { ECOMM, "ECOMM" },
+ { EPROTO, "EPROTO" },
+ { EMULTIHOP, "EMULTIHOP" },
+ { EDOTDOT, "EDOTDOT" },
+ { EBADMSG, "EBADMSG" },
+ { EOVERFLOW, "EOVERFLOW" },
+ { ENOTUNIQ, "ENOTUNIQ" },
+ { EBADFD, "EBADFD" },
+ { EREMCHG, "EREMCHG" },
+ { ELIBACC, "ELIBACC" },
+ { ELIBBAD, "ELIBBAD" },
+ { ELIBSCN, "ELIBSCN" },
+ { ELIBMAX, "ELIBMAX" },
+ { ELIBEXEC, "ELIBEXEC" },
+ { EILSEQ, "EILSEQ" },
+ { ERESTART, "ERESTART" },
+ { ESTRPIPE, "ESTRPIPE" },
+ { EUSERS, "EUSERS" },
+ { ENOTSOCK, "ENOTSOCK" },
+ { EDESTADDRREQ, "EDESTADDRREQ" },
+ { EMSGSIZE, "EMSGSIZE" },
+ { EPROTOTYPE, "EPROTOTYPE" },
+ { ENOPROTOOPT, "ENOPROTOOPT" },
+ { EPROTONOSUPPORT, "EPROTONOSUPPORT" },
+ { ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT" },
+ { EOPNOTSUPP, "EOPNOTSUPP" },
+ { EPFNOSUPPORT, "EPFNOSUPPORT" },
+ { EAFNOSUPPORT, "EAFNOSUPPORT" },
+ { EADDRINUSE, "EADDRINUSE" },
+ { EADDRNOTAVAIL, "EADDRNOTAVAIL" },
+ { ENETDOWN, "ENETDOWN" },
+ { ENETUNREACH, "ENETUNREACH" },
+ { ENETRESET, "ENETRESET" },
+ { ECONNABORTED, "ECONNABORTED" },
+ { ECONNRESET, "ECONNRESET" },
+ { ENOBUFS, "ENOBUFS" },
+ { EISCONN, "EISCONN" },
+ { ENOTCONN, "ENOTCONN" },
+ { ESHUTDOWN, "ESHUTDOWN" },
+ { ETOOMANYREFS, "ETOOMANYREFS" },
+ { ETIMEDOUT, "ETIMEDOUT" },
+ { ECONNREFUSED, "ECONNREFUSED" },
+ { EHOSTDOWN, "EHOSTDOWN" },
+ { EHOSTUNREACH, "EHOSTUNREACH" },
+ { EALREADY, "EALREADY" },
+ { EINPROGRESS, "EINPROGRESS" },
+ { ESTALE, "ESTALE" },
+ { EUCLEAN, "EUCLEAN" },
+ { ENOTNAM, "ENOTNAM" },
+ { ENAVAIL, "ENAVAIL" },
+ { EISNAM, "EISNAM" },
+ { EREMOTEIO, "EREMOTEIO" },
+ { EDQUOT, "EDQUOT" },
+ { ENOMEDIUM, "ENOMEDIUM" },
+ { EMEDIUMTYPE, "EMEDIUMTYPE" }
+};
+
+#endif /* CONFIG_LIBC_STRERROR_SHORT */
+
#define NERRNO_STRS (sizeof(g_errnomap) / sizeof(struct errno_strmap_s))
+#endif /* CONFIG_LIBC_STRERROR */
+
/************************************************************************
* Private Functions
************************************************************************/
@@ -210,8 +346,9 @@ static const struct errno_strmap_s g_errnomap[] =
* Name: strerror
************************************************************************/
-const char *strerror(int errnum)
+FAR const char *strerror(int errnum)
{
+#ifdef CONFIG_LIBC_STRERROR
int ndxlow = 0;
int ndxhi = NERRNO_STRS - 1;
int ndxmid;
@@ -233,5 +370,6 @@ const char *strerror(int errnum)
}
}
while (ndxlow <= ndxhi);
+#endif
return "Unknown error";
}
diff --git a/nuttx/sched/sem_holder.c b/nuttx/sched/sem_holder.c
index abe7e9e28..c850a3b5a 100644
--- a/nuttx/sched/sem_holder.c
+++ b/nuttx/sched/sem_holder.c
@@ -948,10 +948,11 @@ void sem_restorebaseprio(FAR _TCB *stcb, FAR sem_t *sem)
(sem->semcount <= 0 && stcb != NULL));
/* Handler semaphore counts posed from an interrupt handler differently
- * from interrupts posted from threads. The priority difference is that
+ * from interrupts posted from threads. The primary difference is that
* if the semaphore is posted from a thread, then the poster thread is
* a player in the priority inheritance scheme. The interrupt handler
- * externally injects the new count without participated itself.
+ * externally injects the new count without otherwise participating
+ * itself.
*/
if (up_interrupt_context())