aboutsummaryrefslogtreecommitdiff
path: root/circuitpython/shared/libc/__errno.c
diff options
context:
space:
mode:
Diffstat (limited to 'circuitpython/shared/libc/__errno.c')
-rw-r--r--circuitpython/shared/libc/__errno.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/circuitpython/shared/libc/__errno.c b/circuitpython/shared/libc/__errno.c
new file mode 100644
index 0000000..86417a0
--- /dev/null
+++ b/circuitpython/shared/libc/__errno.c
@@ -0,0 +1,13 @@
+// This file provides a version of __errno() for embedded systems that do not have one.
+// This function is needed for expressions of the form: &errno
+
+static int embed_errno;
+
+#if defined(__linux__)
+int *__errno_location(void)
+#else
+int *__errno(void)
+#endif
+{
+ return &embed_errno;
+}