From 5eae9f44f74f9869e46e416a2d5d092834043483 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Thu, 2 Sep 2010 05:02:54 +0000 Subject: 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 --- configure.ac | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e409b2321..59efab72b 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ case "${host_os}" in ;; darwin*) AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]) + AC_DEFINE([_DARWIN_UNLIMITED_SELECT], 1, [Define to 1 if running on Darwin.]) ;; *) AC_PREFIX_DEFAULT([/usr]) @@ -466,7 +467,7 @@ AC_FUNC_STRNLEN AC_FUNC_STRTOD AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll newlocale putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl]) +AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl]) # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks, # so that AC_CHECK_FUNCS can detect functions in that library. @@ -741,6 +742,48 @@ AC_RUN_IFELSE( AC_MSG_RESULT(unknown) ) +AC_MSG_CHECKING(if we can increase the maximum select-able file descriptor) +AC_RUN_IFELSE( +AC_LANG_PROGRAM([ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +], [[ + struct rlimit rlim = { FD_SETSIZE * 2, FD_SETSIZE * 2 }; + int fd0, fd1; + struct timeval tv = { 0, }; + struct ast_fdset { long fds_bits[[1024]]; } fds = { { 0, } }; + if (setrlimit(RLIMIT_NOFILE, &rlim)) { exit(1); } + if ((fd0 = open("/dev/null", O_RDONLY)) < 0) { exit(1); } + if (dup2(fd0, (fd1 = FD_SETSIZE + 1)) < 0) { exit(1); } + FD_SET(fd0, (fd_set *) &fds); + FD_SET(fd1, (fd_set *) &fds); + if (select(FD_SETSIZE + 2, (fd_set *) &fds, NULL, NULL, &tv) < 0) { exit(1); } + exit(0)]]), + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_VARIABLE_FDSET], 1, [Define to 1 if your system can support larger than default select bitmasks.]), + AC_MSG_RESULT(no), + AC_MSG_RESULT(cross-compile) +) + +if test "${ac_cv_have_variable_fdset}x" = "0x"; then + AC_RUN_IFELSE( + AC_LANG_PROGRAM([ +#include +#include +#include +], [if (getuid() != 0) { exit(1); }]), + AC_DEFINE([CONFIGURE_RAN_AS_ROOT], 1, [Some configure tests will unexpectedly fail if configure is run by a non-root user. These may be able to be tested at runtime.])) +fi + AST_GCC_ATTRIBUTE(pure) AST_GCC_ATTRIBUTE(malloc) AST_GCC_ATTRIBUTE(const) -- cgit v1.2.3