SOURCES: bind-chroot-numcpus.patch (NEW) - autodetect number of th...

arekm arekm at pld-linux.org
Fri Jun 1 20:13:52 CEST 2007


Author: arekm                        Date: Fri Jun  1 18:13:52 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- autodetect number of threads even if chroot() is used (so /proc/cpuinfo is not avilable)

---- Files affected:
SOURCES:
   bind-chroot-numcpus.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/bind-chroot-numcpus.patch
diff -u /dev/null SOURCES/bind-chroot-numcpus.patch:1.1
--- /dev/null	Fri Jun  1 20:13:52 2007
+++ SOURCES/bind-chroot-numcpus.patch	Fri Jun  1 20:13:47 2007
@@ -0,0 +1,49 @@
+diff -urN bind-9.4.1.org/bin/named/main.c bind-9.4.1/bin/named/main.c
+--- bind-9.4.1.org/bin/named/main.c	2007-06-01 19:44:51.223203000 +0200
++++ bind-9.4.1/bin/named/main.c	2007-06-01 20:08:19.703753086 +0200
+@@ -464,9 +464,7 @@
+ 	}
+ }
+ 
+-static isc_result_t
+-create_managers(void) {
+-	isc_result_t result;
++static void fill_ns_g_cpus() {
+ #ifdef ISC_PLATFORM_USETHREADS
+ 	unsigned int cpus_detected;
+ #endif
+@@ -475,13 +473,20 @@
+ 	cpus_detected = isc_os_ncpus();
+ 	if (ns_g_cpus == 0)
+ 		ns_g_cpus = 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, ns_g_cpus == 1 ? "" : "s");
+ #else
+ 	ns_g_cpus = 1;
+ #endif
++}
++
++static isc_result_t
++create_managers(void) {
++	isc_result_t result;
++
++#ifdef ISC_PLATFORM_USETHREADS
++	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
++		      ISC_LOG_INFO, "using %u worker thread%s",
++		      ns_g_cpus, ns_g_cpus == 1 ? "" : "s");
++#endif
+ 	result = isc_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr);
+ 	if (result != ISC_R_SUCCESS) {
+ 		UNEXPECTED_ERROR(__FILE__, __LINE__,
+@@ -581,6 +586,9 @@
+ 		isc_mem_free(ns_g_mctx, instance);
+ #endif /* HAVE_LIBSCF */
+ 
++	/* Fill in ns_g_cpus date before chroot happens */
++	fill_ns_g_cpus();
++
+ #ifdef PATH_RANDOMDEV
+ 	/*
+ 	 * Initialize system's random device as fallback entropy source
================================================================


More information about the pld-cvs-commit mailing list