summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-09-17 12:44:56 (GMT)
committerWez Furlong <wez@php.net>2004-09-17 12:44:56 (GMT)
commit99e290f882c9116e74418b9271a75d557533c4f5 (patch)
tree737c6e4ec61d02067b60372407542e3235d511e6 /configure.in
parent9085689d6faec9eeae6802638ff2dea233d536b8 (diff)
downloadphp-99e290f882c9116e74418b9271a75d557533c4f5.tar.gz
Fix for Bug #24189: possibly unsafe select(2) usage.
We avoid the problem by using poll(2). On systems without poll(2) (older bsd-ish systems, and win32), we emulate poll(2) using select(2) and check for valid descriptors before attempting to access them via the descriptor sets. If an out-of-range descriptor is detected, an E_WARNING is raised suggesting that PHP should be recompiled with a larger FD_SETSIZE (and also with a suggested value). Most uses of select(2) in the source are to poll a single descriptor, so a couple of handy wrapper functions have been added to make this easier. A configure option --enable-fd-setsize has been added to both the unix and win32 builds; on unix we default to 16384 and on windows we default to 256. Windows FD_SETSIZE imposes a limit on the maximum number of descriptors that can be select()ed at once, whereas the unix FD_SETSIZE limit is based on the highest numbered descriptor; 256 should be plenty for PHP scripts under windows (the default OS setting is 64). The win32 specific parts are untested; will do that now.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in16
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 9271a7a..53fb324 100644
--- a/configure.in
+++ b/configure.in
@@ -569,6 +569,9 @@ AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
AC_TRY_RUN([
#include <netdb.h>
#include <sys/types.h>
+#ifndef AF_INET
+# include <sys/socket.h>
+#endif
int main(void) {
struct addrinfo *ai, *pai, hints;
@@ -789,6 +792,19 @@ if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
fi
+AC_MSG_CHECKING([how big to make fd sets])
+AC_ARG_ENABLE(fd-setsize,
+[ --enable-fd-setsize Set size of descriptor sets],[
+ if test "x$enableval" != "xyes"; then
+ CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$enableval"
+ AC_MSG_RESULT(using $enableval)
+ else
+ AC_MSG_RESULT(using system default)
+ fi
+],[
+ AC_MSG_RESULT(using system default)
+])
+
AC_MSG_CHECKING([whether to enable versioning])
AC_ARG_ENABLE(versioning,
[ --enable-versioning Export only required symbols.