[asterisk-commits] tilghman: branch 1.6.2 r285267 - in /branches/1.6.2: ./ main/poll.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 7 14:07:21 CDT 2010
Author: tilghman
Date: Tue Sep 7 14:07:17 2010
New Revision: 285267
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=285267
Log:
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.
........
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/main/poll.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Tue Sep 7 14:07:17 2010
@@ -1,1 +1,1 @@
-/branches/1.4:1-279056,279206,279945,280088,280341,280448,280811,280982,281390,281566,281762,281819,281911,282129,282430,282729,282893,283048,283123,283380,283690,283880,283960,284316,284393,284478,284703,284777,284881,285088,285194
+/branches/1.4:1-279056,279206,279945,280088,280341,280448,280811,280982,281390,281566,281762,281819,281911,282129,282430,282729,282893,283048,283123,283380,283690,283880,283960,284316,284393,284478,284703,284777,284881,285088,285194,285266
Modified: branches/1.6.2/main/poll.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/poll.c?view=diff&rev=285267&r1=285266&r2=285267
==============================================================================
--- branches/1.6.2/main/poll.c (original)
+++ branches/1.6.2/main/poll.c Tue Sep 7 14:07:17 2010
@@ -89,7 +89,7 @@
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)
{
@@ -263,10 +263,14 @@
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));
More information about the asterisk-commits
mailing list