From 698abbaa04a45ccb62e542525b883537ecef14c1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 2 Mar 2023 22:54:22 -0800 Subject: [PATCH] sys/picolibc_syscalls_default: Fix read/write return for picolibc >= 1.8 Picolibc switched to standard posix types for read/write return in version 1.8. Signed-off-by: Keith Packard --- sys/picolibc_syscalls_default/syscalls.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/picolibc_syscalls_default/syscalls.c b/sys/picolibc_syscalls_default/syscalls.c index 2e4c430852..eb7d450871 100644 --- a/sys/picolibc_syscalls_default/syscalls.c +++ b/sys/picolibc_syscalls_default/syscalls.c @@ -118,7 +118,8 @@ _exit(int n) { LOG_INFO("#! exit %i: powering off\n", n); pm_off(); - while(1); + for (;;) { + } } /** @@ -304,6 +305,13 @@ int open(const char *name, int flags, int mode) #endif } +/* + * Picolibc newer than 1.8 uses standard posix types for read/write + * return values + */ +#if __PICOLIBC_MAJOR__ > 1 || __PICOLIBC_MINOR__ >= 8 +#define _READ_WRITE_RETURN_TYPE ssize_t +#endif /** * @brief Read bytes from an open file *