]>
Commit | Line | Data |
---|---|---|
2912277c | 1 | --- squid-2.6.STABLE1/configure.fd 2006-07-26 09:58:41.000000000 +0200 |
2 | +++ squid-2.6.STABLE1/configure 2006-07-26 09:58:41.000000000 +0200 | |
3 | @@ -2970,6 +2970,34 @@ | |
4 | AMDEP_FALSE= | |
5 | fi | |
6 | ||
7 | +if false; then | |
8 | + USE_FD_CONFIG_TRUE= | |
9 | + USE_FD_CONFIG_FALSE='#' | |
10 | +else | |
11 | + USE_FD_CONFIG_TRUE='#' | |
12 | + USE_FD_CONFIG_FALSE= | |
13 | +fi | |
14 | +# Check whether --enable-fd-config or --disable-fd-config was given. | |
15 | +if test "${enable_fd_config+set}" = set; then | |
16 | + enableval="$enable_fd_config" | |
17 | + if test "$enableval" = "yes" ; then | |
18 | + echo "File descriptor config enabled" | |
19 | + cat >> confdefs.h <<\EOF | |
20 | +#define FD_CONFIG 1 | |
21 | +EOF | |
22 | + | |
23 | + | |
24 | + | |
25 | +if true; then | |
26 | + USE_FD_CONFIG_TRUE= | |
27 | + USE_FD_CONFIG_FALSE='#' | |
28 | +else | |
29 | + USE_FD_CONFIG_TRUE='#' | |
30 | + USE_FD_CONFIG_FALSE= | |
31 | +fi | |
32 | + fi | |
33 | + | |
34 | +fi | |
35 | ||
36 | ||
37 | ||
38 | --- squid-2.6.STABLE1/include/autoconf.h.in.fd 2006-07-26 09:58:41.000000000 +0200 | |
39 | +++ squid-2.6.STABLE1/include/autoconf.h.in 2006-07-26 09:58:41.000000000 +0200 | |
40 | @@ -36,6 +36,9 @@ | |
41 | /* Traffic management via "delay pools". */ | |
42 | #undef DELAY_POOLS | |
43 | ||
44 | +/* Filedesc managment */ | |
45 | +#undef FD_CONFIG | |
46 | + | |
47 | /* Enable following X-Forwarded-For headers */ | |
48 | #undef FOLLOW_X_FORWARDED_FOR | |
49 | ||
50 | --- squid-2.6.STABLE1/configure.in.fd 2006-07-26 09:58:41.000000000 +0200 | |
51 | +++ squid-2.6.STABLE1/configure.in 2006-07-26 09:58:41.000000000 +0200 | |
52 | @@ -501,6 +501,16 @@ | |
0dee7b7b JR |
53 | fi |
54 | ]) | |
55 | ||
56 | +AM_CONDITIONAL(USE_FD_CONFIG, false) | |
57 | +AC_ARG_ENABLE(fd-config, | |
2912277c | 58 | +[ --enable-fd-config Enable filedesc config to configure maximal number of used filedescriptors], |
0dee7b7b JR |
59 | +[ if test "$enableval" = "yes" ; then |
60 | + echo "Filedesc config enabled" | |
2912277c | 61 | + AC_DEFINE(FD_CONFIG, 1, [Maximum number of open file descriptors]) |
0dee7b7b JR |
62 | + AM_CONDITIONAL(USE_FD_CONFIG, true) |
63 | + fi | |
64 | +]) | |
65 | + | |
66 | dnl This is a developer only option. Developers know how to set defines | |
67 | dnl | |
68 | dnl AC_ARG_ENABLE(mem-gen-trace, | |
2912277c | 69 | --- squid-2.6.STABLE1/src/cf.data.pre.fd 2006-07-26 09:58:41.000000000 +0200 |
70 | +++ squid-2.6.STABLE1/src/cf.data.pre 2006-07-26 10:05:54.000000000 +0200 | |
71 | @@ -5027,4 +5027,23 @@ | |
0dee7b7b JR |
72 | or response to be rejected. |
73 | DOC_END | |
2912277c | 74 | |
0dee7b7b JR |
75 | +NAME: max_filedesc |
76 | +IFDEF: FD_CONFIG | |
77 | +TYPE: int | |
78 | +DEFAULT: 8192 | |
79 | +LOC: Config.max_filedesc | |
80 | +DOC_START | |
2912277c | 81 | + The maximum number of open file descriptors. |
82 | + | |
83 | + WARNING: Changes of this value isn't respected by reconfigure | |
84 | + command. This value should be changed only if there isn't | |
85 | + any active squid process. | |
86 | + | |
87 | + NOTE: This option is only supported by system with poll() | |
88 | + or epoll(). You can set this value by --with-maxfd during | |
89 | + compilation on system whith uses select(). | |
90 | + | |
91 | + The maximum value for max_filedesc is set by --with-maxfd during | |
92 | + compilation. | |
0dee7b7b JR |
93 | +DOC_END |
94 | EOF | |
2912277c | 95 | --- squid-2.6.STABLE1/src/main.c.fd 2006-07-26 09:58:41.000000000 +0200 |
96 | +++ squid-2.6.STABLE1/src/main.c 2006-07-26 09:58:41.000000000 +0200 | |
97 | @@ -748,6 +749,8 @@ | |
98 | /* Make sure the OS allows core dumps if enabled in squid.conf */ | |
99 | enableCoredumps(); | |
0dee7b7b JR |
100 | |
101 | + setMaxFD(); | |
102 | + | |
2912277c | 103 | #if TEST_ACCESS |
104 | comm_init(); | |
105 | comm_select_init(); | |
106 | @@ -781,7 +784,6 @@ | |
0dee7b7b JR |
107 | } |
108 | if (!opt_no_daemon) | |
109 | watch_child(argv); | |
110 | - setMaxFD(); | |
111 | ||
112 | /* init comm module */ | |
113 | comm_init(); | |
2912277c | 114 | --- squid-2.6.STABLE1/src/structs.h.fd 2006-07-26 09:58:41.000000000 +0200 |
115 | +++ squid-2.6.STABLE1/src/structs.h 2006-07-26 09:58:41.000000000 +0200 | |
116 | @@ -805,6 +805,9 @@ | |
0dee7b7b | 117 | #endif |
2912277c | 118 | time_t refresh_stale_window; |
119 | int umask; | |
0dee7b7b | 120 | +#if FD_CONFIG |
2912277c | 121 | + int max_filedesc; |
0dee7b7b | 122 | +#endif |
2912277c | 123 | }; |
0dee7b7b | 124 | |
2912277c | 125 | struct _SquidConfig2 { |
126 | --- squid-2.6.STABLE1/src/tools.c.fd 2006-07-26 09:58:41.000000000 +0200 | |
127 | +++ squid-2.6.STABLE1/src/tools.c 2006-07-26 09:58:41.000000000 +0200 | |
128 | @@ -757,6 +757,21 @@ | |
0dee7b7b | 129 | void |
2912277c | 130 | setMaxFD(void) |
0dee7b7b | 131 | { |
0dee7b7b | 132 | + |
2912277c | 133 | +/* Set up number of used filedescriptors from config file */ |
134 | +/* Override the default settings Squid_MaxFD = FD_SETSIZE */ | |
0dee7b7b | 135 | +#if FD_CONFIG |
2912277c | 136 | + Squid_MaxFD = Config.max_filedesc; |
137 | + | |
138 | + /* don't exceed limit which was set during compilation */ | |
139 | + if(SQUID_MAXFD < Squid_MaxFD) | |
140 | + Squid_MaxFD = SQUID_MAXFD; | |
0dee7b7b | 141 | +#else |
2912277c | 142 | + /* don't exceed FD_SETSIZE */ |
143 | + if(FD_SETSIZE < Squid_MaxFD) | |
144 | + Squid_MaxFD = FD_SETSIZE; | |
0dee7b7b JR |
145 | +#endif |
146 | + | |
2912277c | 147 | #if HAVE_SETRLIMIT |
148 | /* try to use as many file descriptors as possible */ | |
149 | /* System V uses RLIMIT_NOFILE and BSD uses RLIMIT_OFILE */ |