5 #include <sys/select.h>
7 #ifndef HAVE_CURL_MULTI_WAIT
9 int max_fds = FD_SETSIZE;
10 fd_set read_fd_set[FD_SETSIZE];
11 fd_set write_fd_set[FD_SETSIZE];
12 fd_set exc_fd_set[FD_SETSIZE];
15 FD_ZERO(write_fd_set);
18 CURLMcode fdset_result = curl_multi_fdset(multi_handle, read_fd_set,
19 write_fd_set, exc_fd_set, &max_fds);
21 if (CURLM_OK != fdset_result) {
25 struct timeval timeout;
35 timeout.tv_usec = 100*1000;
38 timeout.tv_sec = timeout_ms / 1000;
39 timeout.tv_usec = (timeout_ms % 1000) * 1000;
41 int select_result = select(max_fds, read_fd_set, write_fd_set, exc_fd_set,
44 if (select_result >= 0) {
45 *numfds = select_result;
51 if (errno == ENOMEM) {
52 return CURLM_OUT_OF_MEMORY;
55 return CURLM_BAD_SOCKET;
57 return CURLM_INTERNAL_ERROR;
CURLMcode curl_multi_wait_impl(CURLM *multi_handle, int timeout_ms, int *numfds)