[svn-commits] tilghman: branch tilghman/ast_select r281834 - in /team/tilghman/ast_select: ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 11 13:49:43 CDT 2010


Author: tilghman
Date: Wed Aug 11 13:49:39 2010
New Revision: 281834

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281834
Log:
Use ppoll(2), if we have it.

Modified:
    team/tilghman/ast_select/configure
    team/tilghman/ast_select/configure.ac
    team/tilghman/ast_select/include/asterisk/autoconfig.h.in
    team/tilghman/ast_select/main/poll.c

Modified: team/tilghman/ast_select/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/ast_select/configure.ac?view=diff&rev=281834&r1=281833&r2=281834
==============================================================================
--- team/tilghman/ast_select/configure.ac (original)
+++ team/tilghman/ast_select/configure.ac Wed Aug 11 13:49:39 2010
@@ -329,7 +329,7 @@
 AC_FUNC_STRTOD
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf ioperm])
+AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow ppoll putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf ioperm])
 
 AC_MSG_CHECKING(for timersub in time.h)
 AC_LINK_IFELSE(

Modified: team/tilghman/ast_select/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/ast_select/include/asterisk/autoconfig.h.in?view=diff&rev=281834&r1=281833&r2=281834
==============================================================================
--- team/tilghman/ast_select/include/asterisk/autoconfig.h.in (original)
+++ team/tilghman/ast_select/include/asterisk/autoconfig.h.in Wed Aug 11 13:49:39 2010
@@ -316,6 +316,9 @@
 
 /* Define to 1 if you have the `pow' function. */
 #undef HAVE_POW
+
+/* Define to 1 if you have the `ppoll' function. */
+#undef HAVE_PPOLL
 
 /* Define to 1 if you have the ISDN PRI library. */
 #undef HAVE_PRI

Modified: team/tilghman/ast_select/main/poll.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/ast_select/main/poll.c?view=diff&rev=281834&r1=281833&r2=281834
==============================================================================
--- team/tilghman/ast_select/main/poll.c (original)
+++ team/tilghman/ast_select/main/poll.c Wed Aug 11 13:49:39 2010
@@ -260,13 +260,18 @@
 }
 #endif /* AST_POLL_COMPAT */
 
-/* Note: we intentionally do not use the ppoll(2) call on Linux, because while the
- * kernel modifies the tv argument, glibc hides the change from us, and we WANT to
- * be able to check how much time remains.  Chan_phone, in particular, depends upon
- * this behavior.
- */
 int ast_poll2(struct pollfd *pArray, unsigned long n_fds, struct timeval *tv)
 {
+#ifdef HAVE_PPOLL
+	struct timeval start = ast_tvnow();
+	struct timespec ts = { tv ? tv->tv_sec : 0, tv ? tv->tv_usec * 1000 : 0 };
+	int res = ppoll(pArray, n_fds, tv ? &ts : NULL, NULL);
+	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));
+	}
+	return res;
+#else
 	ast_fdset read_descs, write_descs, except_descs;
 	int ready_descriptors, max_fd = 0;
 
@@ -285,6 +290,7 @@
 	}
 
 	return ready_descriptors;
-}
-
-
+#endif
+}
+
+




More information about the svn-commits mailing list