diff --git a/include/zephyr/posix/sys/select.h b/include/zephyr/posix/sys/select.h index 78d900f5316b2f..ef3e0f5674ed59 100644 --- a/include/zephyr/posix/sys/select.h +++ b/include/zephyr/posix/sys/select.h @@ -6,18 +6,16 @@ #ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_ #define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_ -#include -#include +#include #ifdef __cplusplus extern "C" { #endif -#undef fd_set -#define fd_set zsock_fd_set - #define FD_SETSIZE ZVFS_FD_SETSIZE +typedef struct zvfs_fd_set fd_set; + struct timeval; int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, diff --git a/include/zephyr/sys/fdtable.h b/include/zephyr/sys/fdtable.h index e9447ee618fc6c..1664c6cd260918 100644 --- a/include/zephyr/sys/fdtable.h +++ b/include/zephyr/sys/fdtable.h @@ -39,6 +39,18 @@ extern "C" { #endif +/* FIXME: use k_off_t and k_ssize_t to avoid the POSIX->Zephyr->POSIX dependency cycle */ +#ifdef CONFIG_NEWLIB_LIBC +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif +#ifndef _SSIZE_T_DECLARED +typedef _ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif +#endif + /** * File descriptor virtual method table. * Currently all operations beyond read/write/close go thru ioctl method.