diff options
Diffstat (limited to 'include/asterisk/poll-compat.h')
-rw-r--r-- | include/asterisk/poll-compat.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/asterisk/poll-compat.h b/include/asterisk/poll-compat.h index 1156e694b..cbb610925 100644 --- a/include/asterisk/poll-compat.h +++ b/include/asterisk/poll-compat.h @@ -79,6 +79,8 @@ #ifndef __AST_POLL_COMPAT_H #define __AST_POLL_COMPAT_H +#include "asterisk/select.h" + #ifndef AST_POLL_COMPAT #include <sys/poll.h> @@ -114,4 +116,24 @@ int ast_internal_poll(struct pollfd *pArray, unsigned long n_fds, int timeout); #endif /* AST_POLL_COMPAT */ +/*! + * \brief Same as poll(2), except the time is specified in microseconds and + * the tv argument is modified to indicate the time remaining. + */ +int ast_poll2(struct pollfd *pArray, unsigned long n_fds, struct timeval *tv); + +/*! + * \brief Shortcut for conversion of FD_ISSET to poll(2)-based + */ +static inline int ast_poll_fd_index(struct pollfd *haystack, int nfds, int needle) +{ + int i; + for (i = 0; i < nfds; i++) { + if (haystack[i].fd == needle) { + return i; + } + } + return -1; +} + #endif /* __AST_POLL_COMPAT_H */ |