From da4a7772ebb33f27104bca5ceb9a9bca60136387 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 4 Mar 2015 15:56:33 -0800 Subject: [PATCH] [master] improve thread support reporting 4083. [cleanup] Print of the number of CPUs and UDP listeners in the log and in "rndc status" output; indicate whether threads are supported in "named -V" output. [RT #38811] --- CHANGES | 5 +++++ bin/named/main.c | 7 +++++++ bin/named/server.c | 5 ++++- lib/dns/geoip.c | 6 +++--- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 0ee653891d..76562e1d65 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +4083. [cleanup] Print of the number of CPUs and UDP listeners + in the log and in "rndc status" output; indicate + whether threads are supported in "named -V" output. + [RT #38811] + 4082. [bug] Incrementally sign large inline zone deltas. [RT #37927] diff --git a/bin/named/main.c b/bin/named/main.c index a1bccce721..60ceb4721f 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -670,6 +670,11 @@ parse_command_line(int argc, char *argv[]) { JSON_C_VERSION); printf("linked to libjson-c version: %s\n", json_c_version()); +#endif +#ifdef ISC_PLATFORM_USETHREADS + printf("threads support is enabled\n"); +#else + printf("threads support is disabled\n"); #endif exit(0); case 'x': @@ -742,9 +747,11 @@ create_managers(void) { if (ns_g_udpdisp > ns_g_cpus) ns_g_udpdisp = ns_g_cpus; #endif +#ifdef ISC_PLATFORM_USETHREADS isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_INFO, "using %u UDP listener%s per interface", ns_g_udpdisp, ns_g_udpdisp == 1 ? "" : "s"); +#endif result = isc_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr); if (result != ISC_R_SUCCESS) { diff --git a/bin/named/server.c b/bin/named/server.c index 08fd750dc1..63d46cd4a5 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -8459,8 +8459,11 @@ ns_server_status(ns_server_t *server, isc_buffer_t **text) { snprintf(line, sizeof(line), "UDP listeners per interface: %u\n", ns_g_udpdisp); CHECK(putstr(text, line)); - +#else + snprintf(line, sizeof(line), "CPUs found: N/A (threads disabled)\n"); + CHECK(putstr(text, line)); #endif + snprintf(line, sizeof(line), "number of zones: %u (%u automatic)\n", zonecount, automatic); CHECK(putstr(text, line)); diff --git a/lib/dns/geoip.c b/lib/dns/geoip.c index 40a5c08240..c018f5e042 100644 --- a/lib/dns/geoip.c +++ b/lib/dns/geoip.c @@ -137,7 +137,7 @@ state_key_init(void) { return (result); } #else -geoip_state_t prev_state; +static geoip_state_t saved_state; #endif static void @@ -193,7 +193,7 @@ set_state(unsigned int family, isc_uint32_t ipnum, const geoipv6_t *ipnum6, } else clean_state(state); #else - state = &prev_state; + state = &saved_state; clean_state(state); #endif @@ -231,7 +231,7 @@ get_state_for(unsigned int family, isc_uint32_t ipnum, if (state == NULL) return (NULL); #else - state = &prev_state; + state = &saved_state; #endif if (state->family == family &&