1919 * @{
2020 */
2121
22- #include <time.h>
23-
2422#include <zephyr/toolchain.h>
2523#include <zephyr/net/socket_types.h>
26- #include <zephyr/sys/fdtable.h>
2724
2825#ifdef __cplusplus
2926extern "C" {
3027#endif
3128
3229/** Socket file descriptor set. */
33- typedef struct zvfs_fd_set zsock_fd_set ;
30+ typedef struct zsock_fd_set {
31+ uint32_t bitset [(CONFIG_ZVFS_OPEN_MAX + 31 ) / 32 ];
32+ } zsock_fd_set ;
3433
3534/**
3635 * @brief Legacy function to poll multiple sockets for events
@@ -48,16 +47,13 @@ typedef struct zvfs_fd_set zsock_fd_set;
4847 * it may conflict with generic POSIX ``select()`` function).
4948 * @endrst
5049 */
51- static inline int zsock_select (int nfds , zsock_fd_set * readfds , zsock_fd_set * writefds ,
52- zsock_fd_set * exceptfds , struct zsock_timeval * timeout )
53- {
54- struct timeval ;
55-
56- return zvfs_select (nfds , readfds , writefds , exceptfds , (struct timeval * )timeout );
57- }
50+ __syscall int zsock_select (int nfds , zsock_fd_set * readfds ,
51+ zsock_fd_set * writefds ,
52+ zsock_fd_set * exceptfds ,
53+ struct zsock_timeval * timeout );
5854
5955/** Number of file descriptors which can be added to zsock_fd_set */
60- #define ZSOCK_FD_SETSIZE ZVFS_FD_SETSIZE
56+ #define ZSOCK_FD_SETSIZE (sizeof(((zsock_fd_set *)0)->bitset) * 8)
6157
6258/**
6359 * @brief Initialize (clear) fd_set
@@ -71,10 +67,7 @@ static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *wr
7167 * if :kconfig:option:`CONFIG_POSIX_API` is defined.
7268 * @endrst
7369 */
74- static inline void ZSOCK_FD_ZERO (zsock_fd_set * set )
75- {
76- ZVFS_FD_ZERO (set );
77- }
70+ void ZSOCK_FD_ZERO (zsock_fd_set * set );
7871
7972/**
8073 * @brief Check whether socket is a member of fd_set
@@ -88,10 +81,7 @@ static inline void ZSOCK_FD_ZERO(zsock_fd_set *set)
8881 * if :kconfig:option:`CONFIG_POSIX_API` is defined.
8982 * @endrst
9083 */
91- static inline int ZSOCK_FD_ISSET (int fd , zsock_fd_set * set )
92- {
93- return ZVFS_FD_ISSET (fd , set );
94- }
84+ int ZSOCK_FD_ISSET (int fd , zsock_fd_set * set );
9585
9686/**
9787 * @brief Remove socket from fd_set
@@ -105,10 +95,7 @@ static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set)
10595 * if :kconfig:option:`CONFIG_POSIX_API` is defined.
10696 * @endrst
10797 */
108- static inline void ZSOCK_FD_CLR (int fd , zsock_fd_set * set )
109- {
110- ZVFS_FD_CLR (fd , set );
111- }
98+ void ZSOCK_FD_CLR (int fd , zsock_fd_set * set );
11299
113100/**
114101 * @brief Add socket to fd_set
@@ -122,10 +109,7 @@ static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set)
122109 * if :kconfig:option:`CONFIG_POSIX_API` is defined.
123110 * @endrst
124111 */
125- static inline void ZSOCK_FD_SET (int fd , zsock_fd_set * set )
126- {
127- ZVFS_FD_SET (fd , set );
128- }
112+ void ZSOCK_FD_SET (int fd , zsock_fd_set * set );
129113
130114/** @cond INTERNAL_HIDDEN */
131115
@@ -169,6 +153,8 @@ static inline void FD_SET(int fd, zsock_fd_set *set)
169153}
170154#endif
171155
156+ #include <zephyr/syscalls/socket_select.h>
157+
172158/**
173159 * @}
174160 */
0 commit comments