1 /*
2  * Copyright (c) 2019 Linaro Limited
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
7 #define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
8 
9 #include <zephyr/net/socket_select.h>
10 #include <sys/_timeval.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #ifndef CONFIG_NET_SOCKETS_POSIX_NAMES
17 
18 #define fd_set zsock_fd_set
19 #define FD_SETSIZE ZSOCK_FD_SETSIZE
20 #define FD_ZERO ZSOCK_FD_ZERO
21 #define FD_SET ZSOCK_FD_SET
22 #define FD_CLR ZSOCK_FD_CLR
23 #define FD_ISSET ZSOCK_FD_ISSET
24 
25 struct timeval;
26 
select(int nfds,fd_set * readfds,fd_set * writefds,fd_set * exceptfds,struct timeval * timeout)27 static inline int select(int nfds, fd_set *readfds,
28 			 fd_set *writefds, fd_set *exceptfds,
29 			 struct timeval *timeout)
30 {
31 	return zsock_select(nfds, readfds, writefds, exceptfds,
32 			    (struct zsock_timeval *)timeout);
33 }
34 
35 #endif /* CONFIG_NET_SOCKETS_POSIX_NAMES */
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif /* ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_ */
42