diff options
Diffstat (limited to 'lib/select.h')
-rw-r--r-- | lib/select.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/select.h b/lib/select.h index e012c63f3..56729a3b2 100644 --- a/lib/select.h +++ b/lib/select.h @@ -89,9 +89,27 @@ int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms); +int Curl_wait_ms(int timeout_ms); + #ifdef TPF int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes, fd_set* excepts, struct timeval* tv); #endif +/* Winsock and TPF sockets are not in range [0..FD_SETSIZE-1], which + unfortunately makes it impossible for us to easily check if they're valid +*/ +#if defined(USE_WINSOCK) || defined(TPF) +#define VALID_SOCK(x) 1 +#define VERIFY_SOCK(x) Curl_nop_stmt +#else +#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE)) +#define VERIFY_SOCK(x) do { \ + if(!VALID_SOCK(x)) { \ + SET_SOCKERRNO(EINVAL); \ + return -1; \ + } \ +} WHILE_FALSE +#endif + #endif /* __SELECT_H */ |