123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #ifndef HEADER_CURL_SELECT_H
- #define HEADER_CURL_SELECT_H
- #include "curl_setup.h"
- #ifdef HAVE_SYS_POLL_H
- #include <sys/poll.h>
- #elif defined(HAVE_POLL_H)
- #include <poll.h>
- #endif
- #if !defined(HAVE_STRUCT_POLLFD) && \
- !defined(HAVE_SYS_POLL_H) && \
- !defined(HAVE_POLL_H) && \
- !defined(POLLIN)
- #define POLLIN 0x01
- #define POLLPRI 0x02
- #define POLLOUT 0x04
- #define POLLERR 0x08
- #define POLLHUP 0x10
- #define POLLNVAL 0x20
- struct pollfd
- {
- curl_socket_t fd;
- short events;
- short revents;
- };
- #endif
- #ifndef POLLRDNORM
- #define POLLRDNORM POLLIN
- #endif
- #ifndef POLLWRNORM
- #define POLLWRNORM POLLOUT
- #endif
- #ifndef POLLRDBAND
- #define POLLRDBAND POLLPRI
- #endif
- #define CURL_CSELECT_IN2 (CURL_CSELECT_ERR << 1)
- int Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2,
- curl_socket_t writefd,
- time_t timeout_ms);
- #define SOCKET_READABLE(x,z) \
- Curl_socket_check(x, CURL_SOCKET_BAD, CURL_SOCKET_BAD, z)
- #define SOCKET_WRITABLE(x,z) \
- Curl_socket_check(CURL_SOCKET_BAD, CURL_SOCKET_BAD, x, z)
- int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);
- extern int Curl_ack_eintr;
- 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
- #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
|