+2473. [port] linux: raise the limit on open files to the possible
+ maximum value before spawning threads; 'files'
+ specified in named.conf doesn't seem to work with
+ threads as expected. [RT #18784]
+
2472. [port] linux: check the number of available cpu's before
calling chroot as it depends on "/proc". [RT #16923]
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: main.c,v 1.136.18.20 2008/10/24 01:14:35 marka Exp $ */
+/* $Id: main.c,v 1.136.18.21 2008/10/24 01:28:08 marka Exp $ */
/*! \file */
#include <isc/hash.h>
#include <isc/os.h>
#include <isc/platform.h>
+#include <isc/print.h>
#include <isc/resource.h>
#include <isc/stdio.h>
#include <isc/string.h>
static void
setup(void) {
isc_result_t result;
+ isc_resourcevalue_t old_openfiles;
#ifdef HAVE_LIBSCF
char *instance = NULL;
#endif
(void)isc_resource_getlimit(isc_resource_openfiles,
&ns_g_initopenfiles);
+ /*
+ * System resources cannot effectively be tuned on some systems.
+ * Raise the limit in such cases for safety.
+ */
+ old_openfiles = ns_g_initopenfiles;
+ ns_os_adjustnofile();
+ (void)isc_resource_getlimit(isc_resource_openfiles,
+ &ns_g_initopenfiles);
+ if (old_openfiles != ns_g_initopenfiles) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+ NS_LOGMODULE_MAIN, ISC_LOG_NOTICE,
+ "adjusted limit on open files from "
+ "%" ISC_PRINT_QUADFORMAT "u to "
+ "%" ISC_PRINT_QUADFORMAT "u",
+ old_openfiles, ns_g_initopenfiles);
+ }
+
/*
* If the named configuration filename is relative, prepend the current
* directory's name before possibly changing to another directory.
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.h,v 1.22.18.3 2005/04/29 00:15:39 marka Exp $ */
+/* $Id: os.h,v 1.22.18.4 2008/10/24 01:28:08 marka Exp $ */
#ifndef NS_OS_H
#define NS_OS_H 1
void
ns_os_changeuser(void);
+void
+ns_os_adjustnofile(void);
+
void
ns_os_minprivs(void);
void
ns_os_writepidfile(const char *filename, isc_boolean_t first_time);
-
void
ns_os_shutdown(void);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.66.18.15 2008/01/30 05:00:03 marka Exp $ */
+/* $Id: os.c,v 1.66.18.16 2008/10/24 01:28:08 marka Exp $ */
/*! \file */
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/print.h>
+#include <isc/resource.h>
#include <isc/result.h>
#include <isc/strerror.h>
#include <isc/string.h>
#endif
}
+void
+ns_os_adjustnofile() {
+#ifdef HAVE_LINUXTHREADS
+ isc_result_t result;
+ isc_resourcevalue_t newvalue;
+
+ /*
+ * Linux: max number of open files specified by one thread doesn't seem
+ * to apply to other threads on Linux.
+ */
+ newvalue = ISC_RESOURCE_UNLIMITED;
+
+ result = isc_resource_setlimit(isc_resource_openfiles, newvalue);
+ if (result != ISC_R_SUCCESS)
+ ns_main_earlywarning("couldn't adjust limit on open files");
+#endif
+}
+
void
ns_os_minprivs(void) {
#ifdef HAVE_SYS_PRCTL_H
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.h,v 1.9.18.1 2004/09/29 06:43:54 marka Exp $ */
+/* $Id: os.h,v 1.9.18.2 2008/10/24 01:28:08 marka Exp $ */
#ifndef NS_OS_H
#define NS_OS_H 1
void
ns_os_changeuser(void);
+void
+ns_os_adjustnofile(void);
+
void
ns_os_minprivs(void);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.20.18.7 2008/01/17 23:45:58 tbox Exp $ */
+/* $Id: os.c,v 1.20.18.8 2008/10/24 01:28:08 marka Exp $ */
#include <config.h>
#include <stdarg.h>
ns_os_changeuser(void) {
}
+void
+ns_os_adjustnofile(void) {
+}
+
void
ns_os_minprivs(void) {
}