- our fd_config patch was replaced by upstream's version
- Source1 (FAQ.sgml) points to local source (upstream's moved to wiki)
This commit is contained in:
parent
b4a4477887
commit
a6a48fdd8c
189
squid-2.6.STABLE16-fd.patch
Normal file
189
squid-2.6.STABLE16-fd.patch
Normal file
@ -0,0 +1,189 @@
|
||||
diff -up squid-2.6.STABLE16/src/tools.c.fd squid-2.6.STABLE16/src/tools.c
|
||||
--- squid-2.6.STABLE16/src/tools.c.fd 2007-09-01 22:09:50.000000000 +0200
|
||||
+++ squid-2.6.STABLE16/src/tools.c 2007-09-21 15:01:32.000000000 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
- * $Id: tools.c,v 1.250.2.3 2007/09/01 20:09:50 hno Exp $
|
||||
+ * $Id: tools.c,v 1.255 2007/06/29 00:08:18 hno Exp $
|
||||
*
|
||||
* DEBUG: section 21 Misc Functions
|
||||
* AUTHOR: Harvest Derived
|
||||
@@ -735,46 +735,62 @@ readPidFile(void)
|
||||
}
|
||||
|
||||
|
||||
+/* A little piece of glue for odd systems */
|
||||
+#ifndef RLIMIT_NOFILE
|
||||
+#ifdef RLIMIT_OFILE
|
||||
+#define RLIMIT_NOFILE RLIMIT_OFILE
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
+/* Figure out the number of supported filedescriptors */
|
||||
void
|
||||
setMaxFD(void)
|
||||
{
|
||||
-#if HAVE_SETRLIMIT
|
||||
- /* try to use as many file descriptors as possible */
|
||||
- /* System V uses RLIMIT_NOFILE and BSD uses RLIMIT_OFILE */
|
||||
+#if HAVE_SETRLIMIT && defined(RLIMIT_NOFILE)
|
||||
struct rlimit rl;
|
||||
-#if !defined(_SQUID_CYGWIN_)
|
||||
-#if defined(RLIMIT_NOFILE)
|
||||
if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
|
||||
- debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
|
||||
- } else {
|
||||
- rl.rlim_cur = Squid_MaxFD;
|
||||
- if (rl.rlim_cur > rl.rlim_max)
|
||||
- Squid_MaxFD = rl.rlim_cur = rl.rlim_max;
|
||||
- if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
|
||||
- snprintf(tmp_error_buf, ERROR_BUF_SZ,
|
||||
- "setrlimit: RLIMIT_NOFILE: %s", xstrerror());
|
||||
- fatal_dump(tmp_error_buf);
|
||||
- }
|
||||
+ debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
|
||||
+ } else if (Config.max_filedescriptors > 0) {
|
||||
+ rl.rlim_cur = Config.max_filedescriptors;
|
||||
+ if (rl.rlim_cur > rl.rlim_max)
|
||||
+ rl.rlim_max = rl.rlim_cur;
|
||||
+ if (setrlimit(RLIMIT_NOFILE, &rl)) {
|
||||
+ debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
|
||||
+ getrlimit(RLIMIT_NOFILE, &rl);
|
||||
+ rl.rlim_cur = rl.rlim_max;
|
||||
+ if (setrlimit(RLIMIT_NOFILE, &rl)) {
|
||||
+ debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
-#elif defined(RLIMIT_OFILE)
|
||||
- if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
|
||||
- debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
|
||||
+ if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
|
||||
+ debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
|
||||
} else {
|
||||
- rl.rlim_cur = Squid_MaxFD;
|
||||
- if (rl.rlim_cur > rl.rlim_max)
|
||||
- Squid_MaxFD = rl.rlim_cur = rl.rlim_max;
|
||||
- if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
|
||||
- snprintf(tmp_error_buf, ERROR_BUF_SZ,
|
||||
- "setrlimit: RLIMIT_OFILE: %s", xstrerror());
|
||||
- fatal_dump(tmp_error_buf);
|
||||
- }
|
||||
+ Squid_MaxFD = rl.rlim_cur;
|
||||
}
|
||||
-#endif
|
||||
-#endif
|
||||
-#else /* HAVE_SETRLIMIT */
|
||||
- debug(21, 1) ("setMaxFD: Cannot increase: setrlimit() not supported on this system\n");
|
||||
#endif /* HAVE_SETRLIMIT */
|
||||
+}
|
||||
|
||||
+void
|
||||
+setSystemLimits(void)
|
||||
+{
|
||||
+#if HAVE_SETRLIMIT && defined(RLIMIT_NOFILE) && !defined(_SQUID_CYGWIN_)
|
||||
+ /* limit system filedescriptors to our own limit */
|
||||
+ struct rlimit rl;
|
||||
+ if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
|
||||
+ debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
|
||||
+ } else {
|
||||
+ rl.rlim_cur = Squid_MaxFD;
|
||||
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
|
||||
+ snprintf(tmp_error_buf, ERROR_BUF_SZ,
|
||||
+ "setrlimit: RLIMIT_NOFILE: %s", xstrerror());
|
||||
+ fatal_dump(tmp_error_buf);
|
||||
+ }
|
||||
+ }
|
||||
+ #endif /* HAVE_SETRLIMIT */
|
||||
+ if (Config.max_filedescriptors > Squid_MaxFD) {
|
||||
+ debug(50, 1) ("NOTICE: Could not increase the number of filedescriptors\n");
|
||||
+ }
|
||||
#if HAVE_SETRLIMIT && defined(RLIMIT_DATA)
|
||||
if (getrlimit(RLIMIT_DATA, &rl) < 0) {
|
||||
debug(50, 0) ("getrlimit: RLIMIT_DATA: %s\n", xstrerror());
|
||||
diff -up squid-2.6.STABLE16/src/cf.data.pre.fd squid-2.6.STABLE16/src/cf.data.pre
|
||||
--- squid-2.6.STABLE16/src/cf.data.pre.fd 2007-09-21 12:52:28.000000000 +0200
|
||||
+++ squid-2.6.STABLE16/src/cf.data.pre 2007-09-21 15:07:15.000000000 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#
|
||||
-# $Id: cf.data.pre,v 1.382.2.14 2007/09/05 21:50:15 hno Exp $
|
||||
+# $Id: cf.data.pre,v 1.424 2007/09/19 11:50:39 hno Exp $
|
||||
#
|
||||
# SQUID Web Proxy Cache http://www.squid-cache.org/
|
||||
# ----------------------------------------------------------
|
||||
@@ -5216,4 +5216,16 @@ DOC_START
|
||||
rounded to 1000.
|
||||
DOC_END
|
||||
|
||||
+NAME: max_filedescriptors max_filedesc
|
||||
+TYPE: int
|
||||
+DEFAULT: 0
|
||||
+LOC: Config.max_filedescriptors
|
||||
+DOC_START
|
||||
+ The maximum number of filedescriptors supported.
|
||||
+
|
||||
+ The default "0" means Squid inherits the current ulimit setting.
|
||||
+
|
||||
+ Note: Changing this requires a restart of Squid. Also
|
||||
+ not all comm loops supports values larger than --with-maxfd.
|
||||
+DOC_END
|
||||
EOF
|
||||
diff -up squid-2.6.STABLE16/src/protos.h.fd squid-2.6.STABLE16/src/protos.h
|
||||
--- squid-2.6.STABLE16/src/protos.h.fd 2007-07-15 11:52:17.000000000 +0200
|
||||
+++ squid-2.6.STABLE16/src/protos.h 2007-09-21 15:03:14.000000000 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
- * $Id: protos.h,v 1.520.2.3 2007/07/15 09:52:17 hno Exp $
|
||||
+ * $Id: protos.h,v 1.531 2007/06/29 00:08:18 hno Exp $
|
||||
*
|
||||
*
|
||||
* SQUID Web Proxy Cache http://www.squid-cache.org/
|
||||
@@ -1102,6 +1102,7 @@ extern void no_suid(void);
|
||||
extern void writePidFile(void);
|
||||
extern void setSocketShutdownLifetimes(int);
|
||||
extern void setMaxFD(void);
|
||||
+extern void setSystemLimits(void);
|
||||
extern time_t getCurrentTime(void);
|
||||
extern int percent(int, int);
|
||||
extern double dpercent(double, double);
|
||||
diff -up squid-2.6.STABLE16/src/main.c.fd squid-2.6.STABLE16/src/main.c
|
||||
--- squid-2.6.STABLE16/src/main.c.fd 2007-08-31 15:52:10.000000000 +0200
|
||||
+++ squid-2.6.STABLE16/src/main.c 2007-09-21 15:04:01.000000000 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
- * $Id: main.c,v 1.393.2.4 2007/08/31 13:52:10 hno Exp $
|
||||
+ * $Id: main.c,v 1.397 2007/06/29 00:08:18 hno Exp $
|
||||
*
|
||||
* DEBUG: section 1 Startup and Main Loop
|
||||
* AUTHOR: Harvest Derived
|
||||
@@ -552,6 +552,7 @@ mainInitialize(void)
|
||||
debug(1, 0) ("Running on %s\n", WIN32_OS_string);
|
||||
#endif
|
||||
debug(1, 1) ("Process ID %d\n", (int) getpid());
|
||||
+ setSystemLimits();
|
||||
debug(1, 1) ("With %d file descriptors available\n", Squid_MaxFD);
|
||||
#ifdef _SQUID_MSWIN_
|
||||
debug(1, 1) ("With %d CRT stdio descriptors available\n", _getmaxstdio());
|
||||
diff -up squid-2.6.STABLE16/src/structs.h.fd squid-2.6.STABLE16/src/structs.h
|
||||
--- squid-2.6.STABLE16/src/structs.h.fd 2007-09-05 23:28:34.000000000 +0200
|
||||
+++ squid-2.6.STABLE16/src/structs.h 2007-09-21 15:04:49.000000000 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
- * $Id: structs.h,v 1.507.2.8 2007/09/05 21:28:34 hno Exp $
|
||||
+ * $Id: structs.h,v 1.517 2007/06/28 23:22:01 hno Exp $
|
||||
*
|
||||
*
|
||||
* SQUID Web Proxy Cache http://www.squid-cache.org/
|
||||
@@ -810,6 +810,7 @@ struct _SquidConfig {
|
||||
#endif
|
||||
time_t refresh_stale_window;
|
||||
int umask;
|
||||
+ int max_filedescriptors;
|
||||
};
|
||||
|
||||
struct _SquidConfig2 {
|
11
squid.spec
11
squid.spec
@ -5,13 +5,13 @@
|
||||
Summary: The Squid proxy caching server
|
||||
Name: squid
|
||||
Version: 2.6.STABLE16
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Epoch: 7
|
||||
License: GPL
|
||||
Group: System Environment/Daemons
|
||||
URL: http://www.squid-cache.org
|
||||
Source: http://www.squid-cache.org/Squid/Versions/v2/2.6/squid-%{version}.tar.bz2
|
||||
Source1: http://www.squid-cache.org/Squid/FAQ/FAQ.sgml
|
||||
Source1: FAQ.sgml
|
||||
Source2: squid.init
|
||||
Source3: squid.logrotate
|
||||
Source4: squid.sysconfig
|
||||
@ -31,7 +31,8 @@ Patch202: squid-2.5.STABLE4-location.patch
|
||||
Patch203: squid-2.6.STABLE2-build.patch
|
||||
Patch204: squid-2.5.STABLE4-perlpath.patch
|
||||
Patch205: squid-2.5.STABLE12-smb-path.patch
|
||||
Patch206: squid-2.6.STABLE5-fd-config.patch
|
||||
#Patch206: squid-2.6.STABLE5-fd-config.patch
|
||||
Patch206: squid-2.6.STABLE16-fd.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
Prereq: /sbin/chkconfig logrotate shadow-utils
|
||||
@ -326,6 +327,10 @@ fi
|
||||
chgrp squid /var/cache/samba/winbindd_privileged >/dev/null 2>&1 || :
|
||||
|
||||
%changelog
|
||||
* Tue Sep 25 2007 Martin Bacovsky <mbacovsk@redhat.com> - 7:2.6.STABLE16-2
|
||||
- our fd_config patch was replaced by upstream's version
|
||||
- Source1 (FAQ.sgml) points to local source (upstream's moved to wiki)
|
||||
|
||||
* Fri Sep 14 2007 Martin Bacovsky <mbacovsk@redhat.com> - 7:2.6.STABLE16-1
|
||||
- upgrade to latest upstream 2.6.STABLE16
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user