diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2010-09-02 05:02:54 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2010-09-02 05:02:54 +0000 |
commit | 5eae9f44f74f9869e46e416a2d5d092834043483 (patch) | |
tree | afc6eb9b08ef4ba9f7e0ad1bb4a59b13d5269d90 /include/asterisk/poll-compat.h | |
parent | c28c620936e31ec5a63147ae20d82d621541ae90 (diff) |
Merged revisions 284597 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r284597 | tilghman | 2010-09-02 00:00:34 -0500 (Thu, 02 Sep 2010) | 29 lines
Merged revisions 284593,284595 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r284593 | tilghman | 2010-09-01 17:59:50 -0500 (Wed, 01 Sep 2010) | 18 lines
Merged revisions 284478 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r284478 | tilghman | 2010-09-01 13:49:11 -0500 (Wed, 01 Sep 2010) | 11 lines
Ensure that all areas that previously used select(2) now use poll(2), with implementations that need poll(2) implemented with select(2) safe against 1024-bit overflows.
This is a followup to the fix for the pthread timer in 1.6.2 and beyond, fixing
a potential crash bug in all supported releases.
(closes issue #17678)
Reported by: russell
Branch: https://origsvn.digium.com/svn/asterisk/team/tilghman/ast_select
Review: https://reviewboard.asterisk.org/r/824/
........
................
r284595 | tilghman | 2010-09-01 22:57:43 -0500 (Wed, 01 Sep 2010) | 2 lines
Failed to rerun bootstrap.sh after last commit
................
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@284598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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 */ |