From 7985075a2b4baf2b7bbe8fdbe9e1c9938660fa01 Mon Sep 17 00:00:00 2001 From: Sven Wegener Date: Sun, 29 Jun 2014 18:51:20 +0000 Subject: Also patch 3.5.3 for bug #514946. (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 0x64D4CF24) --- net-dns/pdns-recursor/ChangeLog | 8 ++- .../files/pdns-recursor-3.5.3-fdlimit.patch | 67 ++++++++++++++++++++++ .../pdns-recursor/pdns-recursor-3.5.3-r1.ebuild | 61 ++++++++++++++++++++ 3 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 net-dns/pdns-recursor/files/pdns-recursor-3.5.3-fdlimit.patch create mode 100644 net-dns/pdns-recursor/pdns-recursor-3.5.3-r1.ebuild (limited to 'net-dns/pdns-recursor') diff --git a/net-dns/pdns-recursor/ChangeLog b/net-dns/pdns-recursor/ChangeLog index 63928d3e57a5..865bd6ececd3 100644 --- a/net-dns/pdns-recursor/ChangeLog +++ b/net-dns/pdns-recursor/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for net-dns/pdns-recursor # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-dns/pdns-recursor/ChangeLog,v 1.44 2014/06/29 18:18:56 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-dns/pdns-recursor/ChangeLog,v 1.45 2014/06/29 18:51:19 swegener Exp $ + +*pdns-recursor-3.5.3-r1 (29 Jun 2014) + + 29 Jun 2014; Sven Wegener + +pdns-recursor-3.5.3-r1.ebuild, +files/pdns-recursor-3.5.3-fdlimit.patch: + Also patch 3.5.3 for bug #514946. *pdns-recursor-3.3-r1 (29 Jun 2014) 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 new file mode 100644 index 000000000000..3b6e8e25d972 --- /dev/null +++ b/net-dns/pdns-recursor/files/pdns-recursor-3.5.3-fdlimit.patch @@ -0,0 +1,67 @@ +--- pdns-recursor-3.5.3/misc.cc ++++ pdns-recursor-3.5.3/misc.cc +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include + #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<