summaryrefslogtreecommitdiff
path: root/main/poll.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-09-07 19:09:08 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-09-07 19:09:08 +0000
commita3a02316f26f2559aeff0db0e834417fae3a90fd (patch)
tree0365bae22445c7f0c68dce255e8c662e0f55a12a /main/poll.c
parentf5418e227958a2601809ec594cac00abeb5676ce (diff)
Merged revisions 285268 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r285268 | tilghman | 2010-09-07 14:08:09 -0500 (Tue, 07 Sep 2010) | 18 lines Merged revisions 285267 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r285267 | tilghman | 2010-09-07 14:07:17 -0500 (Tue, 07 Sep 2010) | 11 lines Merged revisions 285266 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r285266 | tilghman | 2010-09-07 14:04:50 -0500 (Tue, 07 Sep 2010) | 4 lines Use poll, if indicated to do so, in the ast_poll2 implementation. This fixes the unit tests on FreeBSD 8.0. ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@285269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/poll.c')
-rw-r--r--main/poll.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/main/poll.c b/main/poll.c
index 0b2106d13..e0f695504 100644
--- a/main/poll.c
+++ b/main/poll.c
@@ -93,7 +93,7 @@ unsigned int ast_FD_SETSIZE = FD_SETSIZE;
Private Functions
\*---------------------------------------------------------------------------*/
-#if defined(AST_POLL_COMPAT) || !defined(HAVE_PPOLL)
+#if defined(AST_POLL_COMPAT)
static int map_poll_spec(struct pollfd *pArray, unsigned long n_fds,
ast_fdset *pReadSet, ast_fdset *pWriteSet, ast_fdset *pExceptSet)
{
@@ -267,10 +267,14 @@ int ast_internal_poll(struct pollfd *pArray, unsigned long n_fds, int timeout)
int ast_poll2(struct pollfd *pArray, unsigned long n_fds, struct timeval *tv)
{
-#ifdef HAVE_PPOLL
+#if !defined(AST_POLL_COMPAT)
struct timeval start = ast_tvnow();
+#if defined(HAVE_PPOLL)
struct timespec ts = { tv ? tv->tv_sec : 0, tv ? tv->tv_usec * 1000 : 0 };
int res = ppoll(pArray, n_fds, tv ? &ts : NULL, NULL);
+#else
+ int res = poll(pArray, n_fds, tv ? tv->tv_sec * 1000 + tv->tv_usec / 1000 : -1);
+#endif
struct timeval after = ast_tvnow();
if (res > 0 && tv && ast_tvdiff_ms(ast_tvadd(*tv, start), after) > 0) {
*tv = ast_tvsub(*tv, ast_tvsub(after, start));