19
19
* @{
20
20
*/
21
21
22
- #include <time.h>
23
-
24
22
#include <zephyr/toolchain.h>
25
23
#include <zephyr/net/socket_types.h>
26
- #include <zephyr/sys/fdtable.h>
27
24
28
25
#ifdef __cplusplus
29
26
extern "C" {
30
27
#endif
31
28
32
29
/** 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 ;
34
33
35
34
/**
36
35
* @brief Legacy function to poll multiple sockets for events
@@ -48,16 +47,13 @@ typedef struct zvfs_fd_set zsock_fd_set;
48
47
* it may conflict with generic POSIX ``select()`` function).
49
48
* @endrst
50
49
*/
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 );
58
54
59
55
/** 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)
61
57
62
58
/**
63
59
* @brief Initialize (clear) fd_set
@@ -71,10 +67,7 @@ static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *wr
71
67
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
72
68
* @endrst
73
69
*/
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 );
78
71
79
72
/**
80
73
* @brief Check whether socket is a member of fd_set
@@ -88,10 +81,7 @@ static inline void ZSOCK_FD_ZERO(zsock_fd_set *set)
88
81
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
89
82
* @endrst
90
83
*/
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 );
95
85
96
86
/**
97
87
* @brief Remove socket from fd_set
@@ -105,10 +95,7 @@ static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set)
105
95
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
106
96
* @endrst
107
97
*/
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 );
112
99
113
100
/**
114
101
* @brief Add socket to fd_set
@@ -122,10 +109,7 @@ static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set)
122
109
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
123
110
* @endrst
124
111
*/
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 );
129
113
130
114
/** @cond INTERNAL_HIDDEN */
131
115
@@ -169,6 +153,8 @@ static inline void FD_SET(int fd, zsock_fd_set *set)
169
153
}
170
154
#endif
171
155
156
+ #include <zephyr/syscalls/socket_select.h>
157
+
172
158
/**
173
159
* @}
174
160
*/
0 commit comments