diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html
index 27604c44f7b..701398f4ec8 100644
--- a/Documentation/NuttxUserGuide.html
+++ b/Documentation/NuttxUserGuide.html
@@ -10299,13 +10299,13 @@ OS resources. These hidden structures include:
#include <errno.h>
-#define errno *get_errno_ptr()
-int *get_errno_ptr(void);
+#define errno *__errno()
+int *__errno(void);
Description:
- get_errno_ptr() returns a pointer to the thread-specific errno value.
- Note that the symbol errno is defined to be get_errno_ptr() so that the usual
+ __errno() returns a pointer to the thread-specific errno value.
+ Note that the symbol errno is defined to be __errno() so that the usual
access by referencing the symbol errno will work as expected.
diff --git a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_symtab.c b/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_symtab.c
index af5ddc91c15..db3a341708a 100644
--- a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_symtab.c
+++ b/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_symtab.c
@@ -48,7 +48,6 @@ extern void *exit;
extern void *fflush;
extern void *fopen;
extern void *fprintf;
-extern void *get_errno_ptr;
extern void *getpid;
extern void *kill;
extern void *memset;
@@ -80,7 +79,6 @@ const struct symtab_s lpc17_40_exports[] =
{"fflush", &fflush},
{"fopen", &fopen},
{"fprintf", &fprintf},
- {"get_errno_ptr", &get_errno_ptr},
{"getpid", &getpid},
{"kill", &kill},
{"memset", &memset},
@@ -107,4 +105,9 @@ const struct symtab_s lpc17_40_exports[] =
{"usleep", &usleep},
};
-const int lpc17_40_nexports = sizeof(lpc17_40_exports) / sizeof(struct symtab_s);
+const int lpc17_40_nexports =
+ sizeof(lpc17_40_exports) / sizeof(struct symtab_s);
+
+/*****************************************************************************
+ * Public Functions
+ *****************************************************************************/
diff --git a/include/errno.h b/include/errno.h
index 8bd8bcf683f..76a1bc4d6c7 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -91,7 +91,7 @@
#ifdef __DIRECT_ERRNO_ACCESS
-# define errno *get_errno_ptr()
+# define errno *__errno()
# define set_errno(e) do { errno = (int)(e); } while (0)
# define get_errno() errno
@@ -406,7 +406,7 @@ extern "C"
* either as macros or via syscalls.
*/
-FAR int *get_errno_ptr(void);
+FAR int *__errno(void);
#ifndef __DIRECT_ERRNO_ACCESS
void set_errno(int errcode);
diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv
index a979851ac69..2eafa1e92ae 100644
--- a/libs/libc/libc.csv
+++ b/libs/libc/libc.csv
@@ -1,3 +1,4 @@
+"__errno","errno.h","defined(CONFIG_BUILD_FLAT)","FAR int *"
"abort","stdlib.h","","void"
"abs","stdlib.h","","int","int"
"aio_error","aio.h","defined(CONFIG_FS_AIO)","int","FAR struct aiocb *"
@@ -47,7 +48,6 @@
"fsetpos","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *"
"ftell","stdio.h","CONFIG_NFILE_STREAMS > 0","long","FAR FILE *"
"fwrite","stdio.h","CONFIG_NFILE_STREAMS > 0","size_t","FAR const void *","size_t","size_t","FAR FILE *"
-"get_errno_ptr","errno.h","defined(CONFIG_BUILD_FLAT)","FAR int *"
"getcwd","unistd.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char","FAR char *","size_t"
"gethostname","unistd.h","","int","FAR char*","size_t"
"getopt","unistd.h","","int","int","FAR char *const[]","FAR const char *"
diff --git a/sched/errno/Make.defs b/sched/errno/Make.defs
index d233b1147b7..6c51ee2feff 100644
--- a/sched/errno/Make.defs
+++ b/sched/errno/Make.defs
@@ -33,7 +33,7 @@
#
############################################################################
-CSRCS += errno_getptr.c
+CSRCS += errno_errno.c
ifeq ($(CONFIG_LIB_SYSCALL),y)
CSRCS += errno_get.c errno_set.c
diff --git a/sched/errno/errno_getptr.c b/sched/errno/errno_errno.c
similarity index 86%
rename from sched/errno/errno_getptr.c
rename to sched/errno/errno_errno.c
index 537fdb900fc..a262b5bfaf2 100644
--- a/sched/errno/errno_getptr.c
+++ b/sched/errno/errno_errno.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * sched/errno/errno_getptr.c
+ * sched/errno/errno_errno.c
*
* Copyright (C) 2007, 2008, 2011, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -43,19 +43,12 @@
#include
#include "sched/sched.h"
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#undef get_errno_ptr
-#undef errno
-
/****************************************************************************
* Private Data
****************************************************************************/
/* This is a 'dummy' errno value to use in context where there is no valid
- * errno location to use. For example, when running from an interrupt handler
+ * errno location to use. For example, when running from an interrupt handler
* or early in initialization when task structures have not yet been
* initialized.
*/
@@ -67,7 +60,7 @@ static int g_irqerrno;
****************************************************************************/
/****************************************************************************
- * Name: get_errno_ptr
+ * Name: __errno
*
* Description:
* Return a pointer to the thread specific errno.
@@ -82,7 +75,7 @@ static int g_irqerrno;
*
****************************************************************************/
-FAR int *get_errno_ptr(void)
+FAR int *__errno(void)
{
/* Check if this function was called from an interrupt handler. In that
* case, we have to do things a little differently to prevent the interrupt
@@ -113,12 +106,12 @@ FAR int *get_errno_ptr(void)
}
/* We were called either from (1) an interrupt handler or (2) from normally
- * code but in an unhealthy state. In either event, do not permit access to
+ * code but in an unhealthy state. In either event, do not permit access to
* the errno in the TCB of the task at the head of the ready-to-run list.
- * Instead, use a separate errno just for interrupt handlers. Of course, this
- * would have to change if we ever wanted to support nested interrupts or if
- * we really cared about the stability of the errno during those "unhealthy
- * states."
+ * Instead, use a separate errno just for interrupt handlers. Of course,
+ * this would have to change if we ever wanted to support nested interrupts
+ * or if we really cared about the stability of the errno during those
+ * "unhealthy states."
*/
return &g_irqerrno;
diff --git a/sched/errno/errno_get.c b/sched/errno/errno_get.c
index be5c30b5aac..2d91497e3da 100644
--- a/sched/errno/errno_get.c
+++ b/sched/errno/errno_get.c
@@ -45,9 +45,7 @@
* Pre-processor Definitions
****************************************************************************/
-#undef get_errno_ptr
#undef get_errno
-#undef errno
/****************************************************************************
* Public Functions
@@ -74,5 +72,5 @@
int get_errno(void)
{
- return *get_errno_ptr();
+ return *__errno();
}
diff --git a/sched/errno/errno_set.c b/sched/errno/errno_set.c
index 7a6f1ebb1f4..2eada24b92a 100644
--- a/sched/errno/errno_set.c
+++ b/sched/errno/errno_set.c
@@ -45,9 +45,7 @@
* Pre-processor Definitions
****************************************************************************/
-#undef get_errno_ptr
#undef set_errno
-#undef errno
/****************************************************************************
* Public Functions
@@ -62,7 +60,7 @@
* thread-specific errno value.
*
* Input Parameters:
- * errcode - The thread specific errno will be set to this error code value.
+ * errcode - The thread specific errno will be set to this value.
*
* Returned Value:
* None
@@ -73,5 +71,5 @@
void set_errno(int errcode)
{
- *get_errno_ptr() = errcode;
+ *__errno() = errcode;
}
diff --git a/sched/task/task_exit.c b/sched/task/task_exit.c
index 78af294f5a0..8311dd906c8 100644
--- a/sched/task/task_exit.c
+++ b/sched/task/task_exit.c
@@ -129,7 +129,7 @@ int nxtask_exit(void)
/* We are now in a bad state -- the head of the ready to run task list
* does not correspond to the thread that is running. Disabling pre-
* emption on this TCB and marking the new ready-to-run task as not
- * running (see, for example, get_errno_ptr()).
+ * running.
*
* We disable pre-emption here by directly incrementing the lockcount
* (vs. calling sched_lock()).
diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index b539e72b197..a7e4a1cd3a7 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -30,7 +30,6 @@
"fsync","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int"
"ftruncate","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int","off_t"
"get_errno","errno.h","!defined(__DIRECT_ERRNO_ACCESS)","int"
-"get_errno_ptr","errno.h","defined(__DIRECT_ERRNO_ACCESS)","FAR int*"
"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*"
"getgid","unistd.h","defined(CONFIG_SCHED_USER_IDENTITY)","gid_t"
"getitimer","sys/time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","int","FAR struct itimerval *"