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