aboutsummaryrefslogtreecommitdiff
path: root/platforms/chibios/errno.h
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/chibios/errno.h')
-rw-r--r--platforms/chibios/errno.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/platforms/chibios/errno.h b/platforms/chibios/errno.h
new file mode 100644
index 0000000000..a411ed9821
--- /dev/null
+++ b/platforms/chibios/errno.h
@@ -0,0 +1,13 @@
+// Copyright 2025 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+#include_next <errno.h>
+
+// Newer versions of picolibc don't seem to provide `__errno_r(r)` in the header file, but is used by ChibiOS.
+#ifndef __errno_r
+# ifdef __REENT_ERRNO
+# define __errno_r(r) _REENT_ERRNO(r)
+# else
+# define __errno_r(r) (errno)
+# endif
+#endif