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]
* 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>
#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
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));
}