From be387a25bd4a009bbb4c4dda47e353aaa3a5c8e7 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 5 Jun 2024 21:47:56 +0200 Subject: [PATCH] sys/posix: Don't shadow on native This fixes compilation issues on musl, where the host POSIX headers don't mix well with RIOT's POSIX headers. This adds an conditional `#include_next ` to RIOT's `` header. --- sys/posix/include/sys/select.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/posix/include/sys/select.h b/sys/posix/include/sys/select.h index 8bf98f7c42..afe63aac15 100644 --- a/sys/posix/include/sys/select.h +++ b/sys/posix/include/sys/select.h @@ -29,6 +29,13 @@ #ifndef SYS_SELECT_H #define SYS_SELECT_H +#ifdef CPU_NATIVE +/* On native, system headers may depend on system's . Hence, + * include the real sys/select.h here. */ +__extension__ +#include_next +#endif + #include /* prevent cyclic dependency with newlib/picolibc's `sys/types.h` */ #if (defined(MODULE_NEWLIB) || defined(MODULE_PICOLIBC)) && !defined(CPU_ESP8266) @@ -43,6 +50,13 @@ extern "C" { #endif +/** + * @brief @ref core_thread_flags for POSIX select + */ +#define POSIX_SELECT_THREAD_FLAG (1U << 3) + +#ifndef CPU_NATIVE + /** * @addtogroup config_posix * @{ @@ -59,11 +73,6 @@ extern "C" { #endif /** @} */ -/** - * @brief @ref core_thread_flags for POSIX select - */ -#define POSIX_SELECT_THREAD_FLAG (1U << 3) - /* ESP's newlib has this already defined in `sys/types.h` */ #if !defined(CPU_ESP8266) /** @@ -164,6 +173,8 @@ static inline void FD_ZERO(fd_set *fdsetp) int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout); +#endif /* CPU_NATIVE */ + #ifdef __cplusplus } #endif