2395. [port] Avoid warning and no effect from "files unlimited"

on Linux when running as root. [RT #18335]
This commit is contained in:
Mark Andrews
2008-07-23 11:18:40 +00:00
parent 0e2a65d51f
commit ca0dfdcad0
2 changed files with 19 additions and 1 deletions
+3
View File
@@ -1,6 +1,9 @@
2396. [bug] Don't set SO_REUSEADDR for randomized ports.
[RT #18336]
2395. [port] Avoid warning and no effect from "files unlimited"
on Linux when running as root. [RT #18335]
2394. [bug] Default configuration options set the limit for
open files to 'unlimited' as described in the
documentation. [RT #18331]
+16 -1
View File
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resource.c,v 1.11.206.3 2008/01/26 23:45:31 tbox Exp $ */
/* $Id: resource.c,v 1.11.206.3.4.1 2008/07/23 11:18:40 marka Exp $ */
#include <config.h>
@@ -28,6 +28,10 @@
#include <isc/result.h>
#include <isc/util.h>
#ifdef __linux__
#include <linux/fs.h> /* To get the large NR_OPEN. */
#endif
#include "errno2result.h"
static isc_result_t
@@ -151,6 +155,17 @@ isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) {
if (unixresult == 0)
return (ISC_R_SUCCESS);
}
#elif defined(NR_OPEN) && defined(__linux__)
/*
* Some Linux kernels don't accept RLIM_INFINIT; the maximum
* possible value is the NR_OPEN defined in linux/fs.h.
*/
if (resource == isc_resource_openfiles && rlim_value == RLIM_INFINITY) {
rl.rlim_cur = rl.rlim_max = NR_OPEN;
unixresult = setrlimit(unixresource, &rl);
if (unixresult == 0)
return (ISC_R_SUCCESS);
}
#endif
return (isc__errno2result(errno));
}