diff --git a/bin/named/server.c b/bin/named/server.c index ce298dae69..6fdb048cff 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.324 2001/05/09 21:35:28 bwelling Exp $ */ +/* $Id: server.c,v 1.325 2001/05/14 19:06:40 bwelling Exp $ */ #include @@ -2783,20 +2783,16 @@ isc_result_t ns_server_status(ns_server_t *server, isc_buffer_t *text) { dns_view_t *view; int zonecount = 0; + int xferrunning = 0; + int xferdeferred = 0; int n; isc_result_t result; - result = isc_task_beginexclusive(server->task); - RUNTIME_CHECK(result == ISC_R_SUCCESS); - for (view = ISC_LIST_HEAD(server->viewlist); - view != NULL; - view = ISC_LIST_NEXT(view, link)) - { - if (strcmp(view->name, "_bind") == 0) - continue; - zonecount += dns_zt_zonecount(view->zonetable); - } - isc_task_endexclusive(server->task); + zonecount = dns_zonemgr_getcount(server->zonemgr, DNS_ZONESTATE_ANY); + xferrunning = dns_zonemgr_getcount(server->zonemgr, + DNS_ZONESTATE_XFERRUNNING); + xferdeferred = dns_zonemgr_getcount(server->zonemgr, + DNS_ZONESTATE_XFERDEFERRED); n = snprintf((char *)isc_buffer_used(text), isc_buffer_availablelength(text), "number of zones: %d\n" @@ -2806,8 +2802,8 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) { "soa queries in progress: %d\n" "query logging is %s\n" "server is up and running", - zonecount, ns_g_debuglevel, - -1, -1, -1, /* XXX */ + zonecount, ns_g_debuglevel, xferrunning, xferdeferred, + -1, /* XXX */ server->log_queries ? "ON" : "OFF"); if (n < 0) return (ISC_R_NOSPACE); diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index fce44f7600..868231c3d8 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.h,v 1.104 2001/05/07 23:34:10 gson Exp $ */ +/* $Id: zone.h,v 1.105 2001/05/14 19:06:45 bwelling Exp $ */ #ifndef DNS_ZONE_H #define DNS_ZONE_H 1 @@ -73,6 +73,11 @@ typedef enum { exponential backoff */ #endif +#define DNS_ZONESTATE_XFERRUNNING 1 +#define DNS_ZONESTATE_XFERDEFERRED 2 +#define DNS_ZONESTATE_SOAQUERY 3 +#define DNS_ZONESTATE_ANY 4 + ISC_LANG_BEGINDECLS /*** @@ -1247,6 +1252,16 @@ dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr); * 'zmgr' to be a valid zone manager. */ +unsigned int +dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state); +/* + * Returns the number of zones in the specified state. + * + * Requires: + * 'zmgr' to be a valid zone manager. + * 'state' to be a valid DNS_ZONESTATE_ constant. + */ + void dns_zone_forcereload(dns_zone_t *zone); /* diff --git a/lib/dns/include/dns/zt.h b/lib/dns/include/dns/zt.h index 2a4165df12..516af52777 100644 --- a/lib/dns/include/dns/zt.h +++ b/lib/dns/include/dns/zt.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zt.h,v 1.26 2001/05/09 21:34:19 bwelling Exp $ */ +/* $Id: zt.h,v 1.27 2001/05/14 19:06:47 bwelling Exp $ */ #ifndef DNS_ZT_H #define DNS_ZT_H 1 @@ -162,18 +162,6 @@ dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, * any error code from 'action'. */ -unsigned int -dns_zt_zonecount(dns_zt_t *zt); -/* - * Count the number of zones in the table. - * - * Requires: - * 'zt' to be valid. - * - * Returns: - * The number of zones in the table. - */ - ISC_LANG_ENDDECLS #endif /* DNS_ZT_H */ diff --git a/lib/dns/zone.c b/lib/dns/zone.c index cd9af0b91d..16c60bed8b 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.323 2001/05/10 17:51:46 gson Exp $ */ +/* $Id: zone.c,v 1.324 2001/05/14 19:06:42 bwelling Exp $ */ #include @@ -5944,3 +5944,38 @@ dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup) { UNLOCK_ZONE(zone); } +unsigned int +dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state) { + dns_zone_t *zone; + unsigned int count = 0; + + REQUIRE(DNS_ZONEMGR_VALID(zmgr)); + + RWLOCK(&zmgr->rwlock, isc_rwlocktype_read); + switch (state) { + case DNS_ZONESTATE_XFERRUNNING: + for (zone = ISC_LIST_HEAD(zmgr->xfrin_in_progress); + zone != NULL; + zone = ISC_LIST_NEXT(zone, statelink)) + count++; + break; + case DNS_ZONESTATE_XFERDEFERRED: + for (zone = ISC_LIST_HEAD(zmgr->waiting_for_xfrin); + zone != NULL; + zone = ISC_LIST_NEXT(zone, statelink)) + count++; + break; + case DNS_ZONESTATE_ANY: + for (zone = ISC_LIST_HEAD(zmgr->zones); + zone != NULL; + zone = ISC_LIST_NEXT(zone, link)) + count++; + break; + default: + INSIST(0); + } + + RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_read); + + return (count); +} diff --git a/lib/dns/zt.c b/lib/dns/zt.c index 2dab936b01..95561a9cfd 100644 --- a/lib/dns/zt.c +++ b/lib/dns/zt.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zt.c,v 1.31 2001/05/09 21:34:18 bwelling Exp $ */ +/* $Id: zt.c,v 1.32 2001/05/14 19:06:43 bwelling Exp $ */ #include @@ -297,12 +297,6 @@ dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, return (result); } -unsigned int -dns_zt_zonecount(dns_zt_t *zt) { - REQUIRE(VALID_ZT(zt)); - return (dns_rbt_nodecount(zt->table)); -} - /*** *** Private ***/