1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/posix: Don't shadow <sys/select.h> 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 <sys/select.h>` to RIOT's
`<sys/select.h>` header.
This commit is contained in:
Marian Buschsieweke 2024-06-05 21:47:56 +02:00
parent 54cd5248c9
commit be387a25bd
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6

View File

@ -29,6 +29,13 @@
#ifndef SYS_SELECT_H
#define SYS_SELECT_H
#ifdef CPU_NATIVE
/* On native, system headers may depend on system's <sys/select.h>. Hence,
* include the real sys/select.h here. */
__extension__
#include_next <sys/select.h>
#endif
#include <string.h>
/* 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