Commit ee6c0ce7 authored by Mark Andrews's avatar Mark Andrews

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

                        on Linux when running as root. [RT #18335]
parent 28631bf0
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]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resource.c,v 1.18 2008/07/11 23:05:46 jinmei Exp $ */
/* $Id: resource.c,v 1.19 2008/07/21 03:37:17 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));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment