]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2472. [port] linux: check the number of available cpu's before
authorMark Andrews <marka@isc.org>
Fri, 24 Oct 2008 01:14:52 +0000 (01:14 +0000)
committerMark Andrews <marka@isc.org>
Fri, 24 Oct 2008 01:14:52 +0000 (01:14 +0000)
                        calling chroot as it depends on "/proc". [RT #16923]

CHANGES
bin/named/include/named/globals.h
bin/named/main.c

diff --git a/CHANGES b/CHANGES
index fb41a00e28098527701284f4d7dfcfea3b644850..73521e3dbe926754dd3c9728271f27b12719d999 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2472.  [port]          linux: check the number of available cpu's before
+                       calling chroot as it depends on "/proc". [RT #16923]
+
 2469.  [port]          solaris: Work around Solaris's select() limitations.
                        [RT #18769]
 
index b8137e8d3321528b2f1c9d5b18a0d020a9cfa1a3..b7ff16b4f31a129dc83b78f592d116a0ee293541 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: globals.h,v 1.59.68.7 2006/03/02 00:37:20 marka Exp $ */
+/* $Id: globals.h,v 1.59.68.8 2008/10/24 01:14:52 marka Exp $ */
 
 #ifndef NAMED_GLOBALS_H
 #define NAMED_GLOBALS_H 1
@@ -46,6 +46,7 @@ EXTERN isc_taskmgr_t *                ns_g_taskmgr            INIT(NULL);
 EXTERN dns_dispatchmgr_t *     ns_g_dispatchmgr        INIT(NULL);
 EXTERN isc_entropy_t *         ns_g_entropy            INIT(NULL);
 EXTERN isc_entropy_t *         ns_g_fallbackentropy    INIT(NULL);
+EXTERN unsigned int            ns_g_cpus_detected      INIT(1);
 
 /*
  * XXXRTH  We're going to want multiple timer managers eventually.  One
index 0a5a28bcfa48ce4e09a1596742612ea6e3238118..1f4a6199adb1c928a5e6efb23a4ccfceeffeedae 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: main.c,v 1.119.2.3.2.27 2008/08/21 23:45:31 tbox Exp $ */
+/* $Id: main.c,v 1.119.2.3.2.28 2008/10/24 01:14:51 marka Exp $ */
 
 #include <config.h>
 
@@ -462,17 +462,13 @@ static isc_result_t
 create_managers(void) {
        isc_result_t result;
        unsigned int socks;
-#ifdef ISC_PLATFORM_USETHREADS
-       unsigned int cpus_detected;
-#endif
 
 #ifdef ISC_PLATFORM_USETHREADS
-       cpus_detected = isc_os_ncpus();
        if (ns_g_cpus == 0)
-               ns_g_cpus = cpus_detected;
+               ns_g_cpus = ns_g_cpus_detected;
        isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
                      ISC_LOG_INFO, "found %u CPU%s, using %u worker thread%s",
-                     cpus_detected, cpus_detected == 1 ? "" : "s",
+                     ns_g_cpus_detected, ns_g_cpus_detected == 1 ? "" : "s",
                      ns_g_cpus, ns_g_cpus == 1 ? "" : "s");
 #else
        ns_g_cpus = 1;
@@ -605,6 +601,13 @@ setup(void) {
        }
 #endif
 
+#ifdef ISC_PLATFORM_USETHREADS
+       /*
+        * Check for the number of cpu's before ns_os_chroot().
+        */
+       ns_g_cpus_detected = isc_os_ncpus();
+#endif
+
        ns_os_chroot(ns_g_chrootdir);
 
        /*