more of 'rndc status'

This commit is contained in:
Brian Wellington
2001-05-14 19:06:47 +00:00
parent 3e9b51fc7b
commit ecf4962155
5 changed files with 64 additions and 36 deletions
+10 -14
View File
@@ -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 <config.h>
@@ -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);
+16 -1
View File
@@ -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);
/*
+1 -13
View File
@@ -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 */
+36 -1
View File
@@ -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 <config.h>
@@ -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);
}
+1 -7
View File
@@ -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 <config.h>
@@ -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
***/