123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- #ifndef ZEPHYR_INCLUDE_NET_SOCKET_SELECT_H_
- #define ZEPHYR_INCLUDE_NET_SOCKET_SELECT_H_
- #include <toolchain.h>
- #include <net/socket_types.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef struct zsock_fd_set {
- uint32_t bitset[(CONFIG_POSIX_MAX_FDS + 31) / 32];
- } zsock_fd_set;
- __syscall int zsock_select(int nfds, zsock_fd_set *readfds,
- zsock_fd_set *writefds,
- zsock_fd_set *exceptfds,
- struct zsock_timeval *timeout);
- #define ZSOCK_FD_SETSIZE (sizeof(((zsock_fd_set *)0)->bitset) * 8)
- void ZSOCK_FD_ZERO(zsock_fd_set *set);
- int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set);
- void ZSOCK_FD_CLR(int fd, zsock_fd_set *set);
- void ZSOCK_FD_SET(int fd, zsock_fd_set *set);
- #ifdef CONFIG_NET_SOCKETS_POSIX_NAMES
- #define fd_set zsock_fd_set
- #define timeval zsock_timeval
- #define FD_SETSIZE ZSOCK_FD_SETSIZE
- static inline int select(int nfds, zsock_fd_set *readfds,
- zsock_fd_set *writefds, zsock_fd_set *exceptfds,
- struct timeval *timeout)
- {
- return zsock_select(nfds, readfds, writefds, exceptfds, timeout);
- }
- static inline void FD_ZERO(zsock_fd_set *set)
- {
- ZSOCK_FD_ZERO(set);
- }
- static inline int FD_ISSET(int fd, zsock_fd_set *set)
- {
- return ZSOCK_FD_ISSET(fd, set);
- }
- static inline void FD_CLR(int fd, zsock_fd_set *set)
- {
- ZSOCK_FD_CLR(fd, set);
- }
- static inline void FD_SET(int fd, zsock_fd_set *set)
- {
- ZSOCK_FD_SET(fd, set);
- }
- #endif
- #ifdef __cplusplus
- }
- #endif
- #include <syscalls/socket_select.h>
- #endif
|