2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Convert all categories and modules into static lists

Remove the complicated mechanism that could be (in theory) used by
external libraries to register new categories and modules with
statically defined lists in <isc/log.h>.  This is similar to what we
have done for <isc/result.h> result codes.  All the libraries are now
internal to BIND 9, so we don't need to provide a mechanism to register
extra categories and modules.
This commit is contained in:
Ondřej Surý
2024-08-14 13:25:50 +02:00
parent 8506102216
commit 091d738c72
122 changed files with 518 additions and 1140 deletions

View File

@@ -33,7 +33,6 @@
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
@@ -43,10 +42,6 @@
#include <dns/types.h>
#include <dns/zone.h>
#include <isccfg/log.h>
#include <ns/log.h>
#include "check-tool.h"
#ifndef CHECK_SIBLING
@@ -97,13 +92,6 @@ dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
DNS_ZONEOPT_CHECKSVCB | DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
/*
* This needs to match the list in bin/named/log.c.
*/
static isc_logcategory_t categories[] = { { "", 0 },
{ "unmatched", 0 },
{ NULL, 0 } };
static isc_symtab_t *symtab = NULL;
static isc_mem_t *sym_mctx;
@@ -550,24 +538,17 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
isc_result_t
setup_logging(FILE *errout) {
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
isc_log_registercategories(categories);
dns_log_init();
cfg_log_init();
ns_log_init();
logconfig = isc_logconfig_get();
destination.file.stream = errout;
destination.file.name = NULL;
destination.file.versions = ISC_LOG_ROLLNEVER;
destination.file.maximum_size = 0;
isc_logconfig_t *logconfig = isc_logconfig_get();
isc_logdestination_t destination = {
.file.stream = errout,
.file.versions = ISC_LOG_ROLLNEVER,
};
isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC, &destination, 0);
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
ISC_LOGCATEGORY_ALL,
ISC_LOGMODULE_ALL) == ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
}