summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-dns/pdns-recursor/files/pdns-recursor-3.5.3-fdlimit.patch')
-rw-r--r--net-dns/pdns-recursor/files/pdns-recursor-3.5.3-fdlimit.patch67
1 files changed, 0 insertions, 67 deletions
diff --git a/net-dns/pdns-recursor/files/pdns-recursor-3.5.3-fdlimit.patch b/net-dns/pdns-recursor/files/pdns-recursor-3.5.3-fdlimit.patch
deleted file mode 100644
index 3b6e8e25d972..000000000000
--- a/net-dns/pdns-recursor/files/pdns-recursor-3.5.3-fdlimit.patch
+++ /dev/null
@@ -1,67 +0,0 @@
---- pdns-recursor-3.5.3/misc.cc
-+++ pdns-recursor-3.5.3/misc.cc
-@@ -22,6 +22,7 @@
- #include <netdb.h>
- #include <sys/time.h>
- #include <time.h>
-+#include <sys/resource.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #endif // WIN32
-@@ -697,3 +698,22 @@
- } while(!strchr(buffer, '\n'));
- return true;
- }
-+
-+unsigned int getFilenumLimit(bool hardOrSoft)
-+{
-+ struct rlimit rlim;
-+ if(getrlimit(RLIMIT_NOFILE, &rlim) < 0)
-+ unixDie("Requesting number of available file descriptors");
-+ return hardOrSoft ? rlim.rlim_max : rlim.rlim_cur;
-+}
-+
-+void setFilenumLimit(unsigned int lim)
-+{
-+ struct rlimit rlim;
-+
-+ if(getrlimit(RLIMIT_NOFILE, &rlim) < 0)
-+ unixDie("Requesting number of available file descriptors");
-+ rlim.rlim_cur=lim;
-+ if(setrlimit(RLIMIT_NOFILE, &rlim) < 0)
-+ unixDie("Setting number of available file descriptors");
-+}
---- pdns-recursor-3.5.3/misc.hh
-+++ pdns-recursor-3.5.3/misc.hh
-@@ -445,4 +445,6 @@
- regex_t d_preg;
- };
-
-+unsigned int getFilenumLimit(bool hardOrSoft=0);
-+void setFilenumLimit(unsigned int lim);
- #endif
---- pdns-recursor-3.5.3/pdns_recursor.cc
-+++ pdns-recursor-3.5.3/pdns_recursor.cc
-@@ -1740,7 +1740,21 @@
-
- g_tcpTimeout=::arg().asNum("client-tcp-timeout");
- g_maxTCPPerClient=::arg().asNum("max-tcp-per-client");
-- g_maxMThreads=::arg().asNum("max-mthreads");
-+ g_maxMThreads=::arg().asNum("max-mthreads");
-+ unsigned int availFDs=getFilenumLimit();
-+ if(g_maxMThreads * g_numThreads > availFDs) {
-+ if(getFilenumLimit(true) >= g_maxMThreads * g_numThreads) {
-+ setFilenumLimit(g_maxMThreads * g_numThreads);
-+ L<<Logger::Warning<<"Raised soft limit on number of filedescriptors to "<<g_maxMThreads * g_numThreads<<" to match max-mthreads and threads settings"<<endl;
-+ }
-+ else {
-+ int newval = getFilenumLimit(true) / g_numThreads;
-+ L<<Logger::Warning<<"Insufficient number of filedescriptors available for max-mthreads*threads setting! ("<<availFDs<<" < "<<g_maxMThreads*g_numThreads<<"), reducing max-mthreads to "<<newval<<endl;
-+ g_maxMThreads = newval;
-+ }
-+
-+
-+ }
-
- if(g_numThreads == 1) {
- L<<Logger::Warning<<"Operating unthreaded"<<endl;