diff --git a/bin/named/log.c b/bin/named/log.c index a43980ab3c..ecaa717c32 100644 --- a/bin/named/log.c +++ b/bin/named/log.c @@ -83,9 +83,6 @@ ns_log_init(void) { goto cleanup; isc_log_registermodules(ns_g_lctx, ns_g_modules); result = dns_log_init(ns_g_lctx); - if (result != ISC_R_SUCCESS) - goto cleanup; - result = isc_log_usecontext(ns_g_lctx); if (result != ISC_R_SUCCESS) goto cleanup; diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index 68fd493b88..8c0537ec03 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -19,19 +19,16 @@ top_srcdir = @top_srcdir@ @BIND9_INCLUDES@ -OMAPI_INCLUDES = -I${top_srcdir}/lib/omapi/include -CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${OMAPI_INCLUDES} +CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} CDEFINES = CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ -OMAPILIBS = ../../lib/omapi/libomapi.@A@ DNSDEPLIBS = ../../lib/dns/libdns.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ -OMAPIDEPLIBS = ../../lib/omapi/libomapi.@A@ LIBS = @LIBS@ @@ -52,7 +49,6 @@ TARGETS = adb_test \ name_test \ nconf_test \ nxtify \ - omapi_test \ ratelimiter_test \ rbt_test \ rdata_test \ @@ -84,7 +80,6 @@ SRCS = adb_test.c \ name_test.c \ nconf_test.c \ nxtify.c \ - omapi_test.c \ printmsg.c \ ratelimiter_test.c \ rbt_test.c \ @@ -145,10 +140,6 @@ name_test: name_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} ${LIBTOOL} ${CC} ${CFLAGS} -o $@ name_test.@O@ \ ${DNSLIBS} ${ISCLIBS} ${LIBS} -omapi_test: omapi_test.@O@ ${ISCDEPLIBS} ${OMAPIDEPLIBS} - ${LIBTOOL} ${CC} ${CFLAGS} -o $@ omapi_test.@O@ \ - ${OMAPILIBS} ${ISCLIBS} ${LIBS} - sock_test: sock_test.@O@ ${ISCDEPLIBS} ${LIBTOOL} ${CC} ${CFLAGS} -o $@ sock_test.@O@ \ ${ISCLIBS} ${LIBS} diff --git a/bin/tests/log_test.c b/bin/tests/log_test.c index f4a0b42007..62b51114a1 100644 --- a/bin/tests/log_test.c +++ b/bin/tests/log_test.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log_test.c,v 1.5 2000/01/06 14:47:35 tale Exp $ */ +/* $Id: log_test.c,v 1.6 2000/01/06 15:00:24 tale Exp $ */ /* Principal Authors: DCL */ @@ -115,7 +115,6 @@ main (int argc, char **argv) { CHECK_ISC(isc_mem_create(0, 0, &mctx)); CHECK_ISC(isc_log_create(mctx, &lctx)); CHECK_DNS(dns_log_init(lctx)); - CHECK_ISC(isc_log_usecontext(lctx)); /* * Create a file channel to test file opening, size limiting and @@ -250,13 +249,12 @@ main (int argc, char **argv) { /* * Write debugging messages to a dynamic debugging channel. - * Also check that dns_lctx is set and working. */ isc_log_setdebuglevel(lctx, 3); - isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, - ISC_LOG_DEBUG(1), "Dynamic debug to dns_lctx stderr"); - isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_DEBUG(1), "Dynamic debugging to stderr"); + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, ISC_LOG_DEBUG(5), "This debug level is too high and should not appear!"); diff --git a/lib/dns/log.c b/lib/dns/log.c index c88f076c72..98e0aaf8f9 100644 --- a/lib/dns/log.c +++ b/lib/dns/log.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.c,v 1.11 2000/01/06 14:47:37 tale Exp $ */ +/* $Id: log.c,v 1.12 2000/01/06 15:00:48 tale Exp $ */ /* Principal Authors: DCL */ @@ -78,7 +78,7 @@ dns_log_init(isc_log_t *lctx) { if (result == ISC_R_SUCCESS) { isc_log_registermodules(lctx, dns_modules); - result = isc_log_registercontext(lctx, &dns_lctx); + dns_lctx = lctx; } return (result); diff --git a/lib/isc/include/isc/log.h b/lib/isc/include/isc/log.h index ec20cf84d6..b5574c24e7 100644 --- a/lib/isc/include/isc/log.h +++ b/lib/isc/include/isc/log.h @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.h,v 1.6 2000/01/06 14:47:38 tale Exp $ */ +/* $Id: log.h,v 1.7 2000/01/06 15:01:49 tale Exp $ */ #ifndef ISC_LOG_H #define ISC_LOG_H 1 @@ -184,6 +184,7 @@ isc_log_destroy(isc_log_t **lctxp); * The logging context is marked as invalid. */ + isc_result_t isc_log_registercategories(isc_log_t *lctx, isc_logcategory_t categories[]); /* @@ -247,31 +248,6 @@ isc_log_registermodules(isc_log_t *lctx, isc_logmodule_t modules[]); * used with isc_log_usechannel() and isc_log_write(). */ -isc_result_t -isc_log_registercontext(isc_log_t *lctx, isc_log_t **lctxp); -/* - * Note a log context pointer that needs to be updated when the the configured - * context is activated with dns_log_usecontext(). - * - * Notes: - * This is mainly intended for use by libraries to assign a logging - * context to their own internal pointer, such as dns_lctx in libdns.a. - * It is not sufficient to have, for example, 'dns_lctx = lctx' in the - * the libraries dns_log_init() function because of multithreading - * pitfalls. - * - * Requires: - * lctx is a valid logging context and not yet active. - * lctxp is not NULL. - * - * Ensures: - * lctxp is registered to be updated when lctx is made active. - * - * Returns: - * ISC_R_SUCCESS Success. - * ISC_R_NOMEMORY No memory was available to store lctxp. - */ - isc_result_t isc_log_createchannel(isc_log_t *lctx, const char *name, unsigned int type, int level, isc_logdestination_t *destination, @@ -399,31 +375,6 @@ isc_log_usechannel(isc_log_t *lctx, const char *name, * ISC_R_NOMEMORY Resource limit: Out of memory */ -isc_result_t -isc_log_usecontext(isc_log_t *lctx); -/* - * Start using a logging context. - * - * Notes: - * This is the last thing that should be done after the logging - * context is fully configured via isc_log_registercategories - * and isc_log_registermodules, but before any isc_log_*write* function - * is used with the context. Channels can be created/used at any time - * before or after isc_log_usecontext(). - * - * Requires: - * lctx is a valid logging context. - * - * isc_log_usecontext has not been previously called on lctx. - * - * Ensures: - * - * Returns: - * ISC_R_SUCCESS Success - * Any unsuccessful return from isc_mutex_lock() - * or isc_mutex_unlock(). - */ - void isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, ...); diff --git a/lib/isc/log.c b/lib/isc/log.c index 7e73e93ee6..0d0ac62635 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.c,v 1.13 2000/01/06 14:47:37 tale Exp $ */ +/* $Id: log.c,v 1.14 2000/01/06 15:01:16 tale Exp $ */ /* Principal Authors: DCL */ @@ -105,7 +105,6 @@ struct isc_log { unsigned int magic; isc_mem_t * mctx; isc_mutex_t lock; - isc_boolean_t active; char buffer[LOG_BUFFER_SIZE]; int debug_level; unsigned int duplicate_interval; @@ -114,8 +113,6 @@ struct isc_log { unsigned int category_count; isc_logmodule_t ** modules; unsigned int module_count; - isc_log_t *** contexts; - unsigned int context_count; ISC_LIST(isc_logmessage_t) messages; }; @@ -204,16 +201,13 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp) { return (ISC_R_NOMEMORY); lctx->mctx = mctx; - lctx->active = ISC_FALSE; - lctx->debug_level = 0; - lctx->duplicate_interval = 0; lctx->channels = NULL; lctx->categories = NULL; lctx->category_count = 0; + lctx->debug_level = 0; + lctx->duplicate_interval = 0; lctx->modules = NULL; lctx->module_count = 0; - lctx->contexts = NULL; - lctx->context_count = 0; ISC_LIST_INIT(lctx->messages); @@ -334,13 +328,8 @@ isc_log_destroy(isc_log_t **lctxp) { } ISC_LIST_INIT(lctx->messages); - if (lctx->context_count > 0) - isc_mem_put(mctx, lctx->contexts, - lctx->context_count * sizeof(isc_log_t **)); - isc_mutex_destroy(&lctx->lock); - lctx->active = ISC_FALSE; lctx->magic = 0; isc_mem_put(mctx, lctx, sizeof(*lctx)); @@ -405,33 +394,6 @@ isc_log_registermodules(isc_log_t *lctx, isc_logmodule_t modules[]) { lctx->module_count = new_count; } -isc_result_t -isc_log_registercontext(isc_log_t *lctx, isc_log_t **lctxp) { - isc_log_t ***contexts; - - REQUIRE(VALID_CONTEXT(lctx)); - REQUIRE(! lctx->active); - REQUIRE(lctxp != NULL); - - contexts = (isc_log_t ***)isc_mem_get(lctx->mctx, - (lctx->context_count + 1) * - sizeof(isc_log_t **)); - if (contexts == NULL) - return (ISC_R_NOMEMORY); - - if (lctx->context_count > 0) { - memcpy(contexts, lctx->contexts, - (lctx->context_count + 1) * sizeof(isc_log_t **)); - isc_mem_put(lctx->mctx, lctx->contexts, - lctx->context_count * sizeof(isc_log_t **)); - } - - lctx->contexts = contexts; - lctx->context_count++; - - return (ISC_R_SUCCESS); -} - isc_result_t isc_log_createchannel(isc_log_t *lctx, const char *name, unsigned int type, int level, isc_logdestination_t *destination, @@ -557,27 +519,6 @@ isc_log_usechannel(isc_log_t *lctx, const char *name, return (result); } -isc_result_t -isc_log_usecontext(isc_log_t *lctx) { - isc_result_t result; - unsigned int i; - - REQUIRE(VALID_CONTEXT(lctx)); - REQUIRE(! lctx->active); - - result = isc_mutex_lock(&lctx->lock); - if (result != ISC_R_SUCCESS) - return (result); - - for (i = 0; i < lctx->context_count; i++) - *(lctx->contexts[i]) = lctx; - - lctx->active = ISC_TRUE; - - result = isc_mutex_unlock(&lctx->lock); - return (result); -} - void isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, ...) @@ -913,7 +854,6 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, REQUIRE(module != NULL && module->id < lctx->module_count); REQUIRE(level != ISC_LOG_DYNAMIC); REQUIRE(format != NULL); - REQUIRE(lctx->active); time_string[0] = '\0'; level_string[0] = '\0'; diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 6ff4168013..faff3b9213 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -84,9 +84,6 @@ #ifndef ISC_PLATFORM_HAVEIPV6 #include -#else -/* XXXDCL this is just for BSD/OS 4.01 to compile. */ -#include #endif /*