150 lines
4.0 KiB
Diff
150 lines
4.0 KiB
Diff
|
--- squid-2.6.STABLE1/configure.fd 2006-07-26 09:58:41.000000000 +0200
|
||
|
+++ squid-2.6.STABLE1/configure 2006-07-26 09:58:41.000000000 +0200
|
||
|
@@ -2970,6 +2970,34 @@
|
||
|
AMDEP_FALSE=
|
||
|
fi
|
||
|
|
||
|
+if false; then
|
||
|
+ USE_FD_CONFIG_TRUE=
|
||
|
+ USE_FD_CONFIG_FALSE='#'
|
||
|
+else
|
||
|
+ USE_FD_CONFIG_TRUE='#'
|
||
|
+ USE_FD_CONFIG_FALSE=
|
||
|
+fi
|
||
|
+# Check whether --enable-fd-config or --disable-fd-config was given.
|
||
|
+if test "${enable_fd_config+set}" = set; then
|
||
|
+ enableval="$enable_fd_config"
|
||
|
+ if test "$enableval" = "yes" ; then
|
||
|
+ echo "File descriptor config enabled"
|
||
|
+ cat >> confdefs.h <<\EOF
|
||
|
+#define FD_CONFIG 1
|
||
|
+EOF
|
||
|
+
|
||
|
+
|
||
|
+
|
||
|
+if true; then
|
||
|
+ USE_FD_CONFIG_TRUE=
|
||
|
+ USE_FD_CONFIG_FALSE='#'
|
||
|
+else
|
||
|
+ USE_FD_CONFIG_TRUE='#'
|
||
|
+ USE_FD_CONFIG_FALSE=
|
||
|
+fi
|
||
|
+ fi
|
||
|
+
|
||
|
+fi
|
||
|
|
||
|
|
||
|
|
||
|
--- squid-2.6.STABLE1/include/autoconf.h.in.fd 2006-07-26 09:58:41.000000000 +0200
|
||
|
+++ squid-2.6.STABLE1/include/autoconf.h.in 2006-07-26 09:58:41.000000000 +0200
|
||
|
@@ -36,6 +36,9 @@
|
||
|
/* Traffic management via "delay pools". */
|
||
|
#undef DELAY_POOLS
|
||
|
|
||
|
+/* Filedesc managment */
|
||
|
+#undef FD_CONFIG
|
||
|
+
|
||
|
/* Enable following X-Forwarded-For headers */
|
||
|
#undef FOLLOW_X_FORWARDED_FOR
|
||
|
|
||
|
--- squid-2.6.STABLE1/configure.in.fd 2006-07-26 09:58:41.000000000 +0200
|
||
|
+++ squid-2.6.STABLE1/configure.in 2006-07-26 09:58:41.000000000 +0200
|
||
|
@@ -501,6 +501,16 @@
|
||
|
fi
|
||
|
])
|
||
|
|
||
|
+AM_CONDITIONAL(USE_FD_CONFIG, false)
|
||
|
+AC_ARG_ENABLE(fd-config,
|
||
|
+[ --enable-fd-config Enable filedesc config to configure maximal number of used filedescriptors],
|
||
|
+[ if test "$enableval" = "yes" ; then
|
||
|
+ echo "Filedesc config enabled"
|
||
|
+ AC_DEFINE(FD_CONFIG)
|
||
|
+ AM_CONDITIONAL(USE_FD_CONFIG, true)
|
||
|
+ fi
|
||
|
+])
|
||
|
+
|
||
|
dnl This is a developer only option. Developers know how to set defines
|
||
|
dnl
|
||
|
dnl AC_ARG_ENABLE(mem-gen-trace,
|
||
|
--- squid-2.6.STABLE1/src/cf.data.pre.fd 2006-07-26 09:58:41.000000000 +0200
|
||
|
+++ squid-2.6.STABLE1/src/cf.data.pre 2006-07-26 10:05:54.000000000 +0200
|
||
|
@@ -5027,4 +5027,23 @@
|
||
|
or response to be rejected.
|
||
|
DOC_END
|
||
|
|
||
|
+NAME: max_filedesc
|
||
|
+IFDEF: FD_CONFIG
|
||
|
+TYPE: int
|
||
|
+DEFAULT: 1024
|
||
|
+LOC: Config.max_filedesc
|
||
|
+DOC_START
|
||
|
+ The maximum number of open file descriptors.
|
||
|
+
|
||
|
+ WARNING: Changes of this value isn't respected by reconfigure
|
||
|
+ command. This value should be changed only if there isn't
|
||
|
+ any active squid process.
|
||
|
+
|
||
|
+ NOTE: This option is only supported by system with poll()
|
||
|
+ or epoll(). You can set this value by --with-maxfd during
|
||
|
+ compilation on system whith uses select().
|
||
|
+
|
||
|
+ The maximum value for max_filedesc is set by --with-maxfd during
|
||
|
+ compilation.
|
||
|
+DOC_END
|
||
|
EOF
|
||
|
--- squid-2.6.STABLE1/src/main.c.fd 2006-07-26 09:58:41.000000000 +0200
|
||
|
+++ squid-2.6.STABLE1/src/main.c 2006-07-26 09:58:41.000000000 +0200
|
||
|
@@ -748,6 +749,8 @@
|
||
|
/* Make sure the OS allows core dumps if enabled in squid.conf */
|
||
|
enableCoredumps();
|
||
|
|
||
|
+ setMaxFD();
|
||
|
+
|
||
|
#if TEST_ACCESS
|
||
|
comm_init();
|
||
|
comm_select_init();
|
||
|
@@ -781,7 +784,6 @@
|
||
|
}
|
||
|
if (!opt_no_daemon)
|
||
|
watch_child(argv);
|
||
|
- setMaxFD();
|
||
|
|
||
|
/* init comm module */
|
||
|
comm_init();
|
||
|
--- squid-2.6.STABLE1/src/structs.h.fd 2006-07-26 09:58:41.000000000 +0200
|
||
|
+++ squid-2.6.STABLE1/src/structs.h 2006-07-26 09:58:41.000000000 +0200
|
||
|
@@ -805,6 +805,9 @@
|
||
|
#endif
|
||
|
time_t refresh_stale_window;
|
||
|
int umask;
|
||
|
+#if FD_CONFIG
|
||
|
+ int max_filedesc;
|
||
|
+#endif
|
||
|
};
|
||
|
|
||
|
struct _SquidConfig2 {
|
||
|
--- squid-2.6.STABLE1/src/tools.c.fd 2006-07-26 09:58:41.000000000 +0200
|
||
|
+++ squid-2.6.STABLE1/src/tools.c 2006-07-26 09:58:41.000000000 +0200
|
||
|
@@ -757,6 +757,21 @@
|
||
|
void
|
||
|
setMaxFD(void)
|
||
|
{
|
||
|
+
|
||
|
+/* Set up number of used filedescriptors from config file */
|
||
|
+/* Override the default settings Squid_MaxFD = FD_SETSIZE */
|
||
|
+#if FD_CONFIG
|
||
|
+ Squid_MaxFD = Config.max_filedesc;
|
||
|
+
|
||
|
+ /* don't exceed limit which was set during compilation */
|
||
|
+ if(SQUID_MAXFD < Squid_MaxFD)
|
||
|
+ Squid_MaxFD = SQUID_MAXFD;
|
||
|
+#else
|
||
|
+ /* don't exceed FD_SETSIZE */
|
||
|
+ if(FD_SETSIZE < Squid_MaxFD)
|
||
|
+ Squid_MaxFD = FD_SETSIZE;
|
||
|
+#endif
|
||
|
+
|
||
|
#if HAVE_SETRLIMIT
|
||
|
/* try to use as many file descriptors as possible */
|
||
|
/* System V uses RLIMIT_NOFILE and BSD uses RLIMIT_OFILE */
|