summaryrefslogtreecommitdiff
path: root/newlib/libc/errno/errno.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/errno/errno.c')
-rw-r--r--newlib/libc/errno/errno.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/newlib/libc/errno/errno.c b/newlib/libc/errno/errno.c
new file mode 100644
index 00000000000..fd1743d7362
--- /dev/null
+++ b/newlib/libc/errno/errno.c
@@ -0,0 +1,16 @@
+/* The errno variable is stored in the reentrancy structure. This
+ function returns its address for use by the macro errno defined in
+ errno.h. */
+
+#include <errno.h>
+#include <reent.h>
+
+#ifndef _REENT_ONLY
+
+int *
+__errno ()
+{
+ return &_REENT->_errno;
+}
+
+#endif