From: Evan Hunt Date: Thu, 9 Sep 2021 22:25:08 +0000 (-0700) Subject: Remove DISPATH_TRACE, RESOLVER_TRACE and REQ_TRACE logging X-Git-Tag: v9.17.19~15^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=81a22cbf5fa7e8662dff02d68a92cc82eb41c099;p=thirdparty%2Fbind9.git Remove DISPATH_TRACE, RESOLVER_TRACE and REQ_TRACE logging Remove the debugging printfs. (leaving this as a separate commit rather than squashing it so we can restore it in the future if we ever need it again.) --- diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 75803f210d3..a839164a7b1 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -37,8 +37,6 @@ #include #include -#define DISPATCH_TRACE - typedef ISC_LIST(dns_dispentry_t) dns_displist_t; typedef struct dns_qid { @@ -489,34 +487,18 @@ allocate_devent(dns_dispatch_t *disp) { return (ev); } -#define dispentry_attach(r, rp) \ - __dispentry_attach(r, rp, __func__, __FILE__, __LINE__) - static void -__dispentry_attach(dns_dispentry_t *resp, dns_dispentry_t **respp, - const char *func, const char *file, unsigned int line) { - uint_fast32_t ref; - +dispentry_attach(dns_dispentry_t *resp, dns_dispentry_t **respp) { REQUIRE(VALID_RESPONSE(resp)); REQUIRE(respp != NULL && *respp == NULL); - ref = isc_refcount_increment(&resp->references); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, resp, respp, ref + 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* DISPATCH_TRACE */ + isc_refcount_increment(&resp->references); *respp = resp; } static void -__dispentry_destroy(dns_dispentry_t *resp) { +dispentry_destroy(dns_dispentry_t *resp) { dns_dispatch_t *disp = resp->disp; resp->magic = 0; @@ -527,23 +509,14 @@ __dispentry_destroy(dns_dispentry_t *resp) { isc_refcount_destroy(&resp->references); -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%d:%s:isc_task_detach(%p) -> %p\n", __FILE__, - __LINE__, __func__, &resp->task, resp->task); -#endif /* DISPATCH_TRACE */ - isc_task_detach(&resp->task); isc_mem_put(disp->mgr->mctx, resp, sizeof(*resp)); dns_dispatch_detach(&disp); } -#define dispentry_detach(rp) \ - __dispentry_detach(rp, __func__, __FILE__, __LINE__) - static void -__dispentry_detach(dns_dispentry_t **respp, const char *func, const char *file, - unsigned int line) { +dispentry_detach(dns_dispentry_t **respp) { dns_dispentry_t *resp = NULL; uint_fast32_t ref; @@ -553,18 +526,8 @@ __dispentry_detach(dns_dispentry_t **respp, const char *func, const char *file, *respp = NULL; ref = isc_refcount_decrement(&resp->references); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, resp, respp, ref - 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); -#endif /* DISPATCH_TRACE */ - if (ref == 1) { - __dispentry_destroy(resp); + dispentry_destroy(resp); } } @@ -1016,31 +979,17 @@ dns_dispatchmgr_create(isc_mem_t *mctx, isc_nm_t *nm, } void -dns__dispatchmgr_attach(dns_dispatchmgr_t *mgr, dns_dispatchmgr_t **mgrp, - const char *func, const char *file, unsigned int line) { - uint_fast32_t ref; - +dns_dispatchmgr_attach(dns_dispatchmgr_t *mgr, dns_dispatchmgr_t **mgrp) { REQUIRE(VALID_DISPATCHMGR(mgr)); REQUIRE(mgrp != NULL && *mgrp == NULL); - ref = isc_refcount_increment(&mgr->references); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, mgr, mgrp, ref + 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* DISPATCH_TRACE */ + isc_refcount_increment(&mgr->references); *mgrp = mgr; } void -dns__dispatchmgr_detach(dns_dispatchmgr_t **mgrp, const char *func, - const char *file, unsigned int line) { +dns_dispatchmgr_detach(dns_dispatchmgr_t **mgrp) { dns_dispatchmgr_t *mgr = NULL; uint_fast32_t ref; @@ -1050,16 +999,6 @@ dns__dispatchmgr_detach(dns_dispatchmgr_t **mgrp, const char *func, *mgrp = NULL; ref = isc_refcount_decrement(&mgr->references); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, mgr, mgrp, ref - 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); -#endif /* DISPATCH_TRACE */ - if (ref == 1) { dispatchmgr_destroy(mgr); } @@ -1293,12 +1232,6 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, isc_taskmgr_t *taskmgr, } result = isc_task_create(taskmgr, 50, &disp->task); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%d:%s:isc_task_create() -> %p\n", __FILE__, - __LINE__, __func__, disp->task); -#endif /* DISPATCH_TRACE */ - if (result != ISC_R_SUCCESS) { goto cleanup; } @@ -1456,12 +1389,6 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_taskmgr_t *taskmgr, disp->local = *localaddr; result = isc_task_create(taskmgr, 0, &disp->task); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%d:%s:isc_task_create() -> %p\n", __FILE__, - __LINE__, __func__, disp->task); -#endif /* DISPATCH_TRACE */ - if (result != ISC_R_SUCCESS) { goto cleanup; } @@ -1502,11 +1429,6 @@ dns_dispatch_destroy(dns_dispatch_t *disp) { isc_nmhandle_detach(&disp->handle); } -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%d:%s:isc_task_detach(%p) -> %p\n", __FILE__, - __LINE__, __func__, &disp->task, disp->task); -#endif /* DISPATCH_TRACE */ - isc_task_detach(&disp->task); dispatch_free(&disp); @@ -1518,31 +1440,17 @@ dns_dispatch_destroy(dns_dispatch_t *disp) { } void -dns__dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp, - const char *func, const char *file, unsigned int line) { - uint_fast32_t ref; - +dns_dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp) { REQUIRE(VALID_DISPATCH(disp)); REQUIRE(dispp != NULL && *dispp == NULL); - ref = isc_refcount_increment(&disp->references); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, disp, dispp, ref + 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* DISPATCH_TRACE */ + isc_refcount_increment(&disp->references); *dispp = disp; } void -dns__dispatch_detach(dns_dispatch_t **dispp, const char *func, const char *file, - unsigned int line) { +dns_dispatch_detach(dns_dispatch_t **dispp) { dns_dispatch_t *disp = NULL; uint_fast32_t ref; @@ -1552,18 +1460,7 @@ dns__dispatch_detach(dns_dispatch_t **dispp, const char *func, const char *file, *dispp = NULL; ref = isc_refcount_decrement(&disp->references); - -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, disp, dispp, ref - 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); -#endif /* DISPATCH_TRACE */ - dispatch_log(disp, LVL(90), "detach: refcount %" PRIuFAST32, ref - 1); - if (ref == 1) { LOCK(&disp->lock); REQUIRE(disp->recv_pending == 0); @@ -1696,11 +1593,6 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, unsigned int options, dns_dispatch_attach(disp, &res->disp); -#ifdef DISPATCH_TRACE - fprintf(stderr, "%s:%d:%s:isc_task_attach(%p, %p)\n", __FILE__, - __LINE__, __func__, task, &res->task); -#endif /* DISPATCH_TRACE */ - isc_task_attach(task, &res->task); res->id = id; diff --git a/lib/dns/include/dns/dispatch.h b/lib/dns/include/dns/dispatch.h index 01054a1dc00..70a6f426238 100644 --- a/lib/dns/include/dns/dispatch.h +++ b/lib/dns/include/dns/dispatch.h @@ -147,22 +147,22 @@ dns_dispatchmgr_create(isc_mem_t *mctx, isc_nm_t *nm, dns_dispatchmgr_t **mgrp); *\li anything else -- failure */ -#define dns_dispatchmgr_attach(mgr, mgrp) \ - dns__dispatchmgr_attach(mgr, mgrp, __func__, __FILE__, __LINE__) - void -dns__dispatchmgr_attach(dns_dispatchmgr_t *mgr, dns_dispatchmgr_t **mgrp, - const char *func, const char *file, unsigned int line); - -#define dns_dispatchmgr_detach(mgrp) \ - dns__dispatchmgr_detach(mgrp, __func__, __FILE__, __LINE__) +dns_dispatchmgr_attach(dns_dispatchmgr_t *mgr, dns_dispatchmgr_t **mgrp); +/*%< + * Attach to a dispatch manger. + * + * Requires: + *\li is valid. + * + *\li mgrp != NULL && *mgrp == NULL + */ void -dns__dispatchmgr_detach(dns_dispatchmgr_t **mgrp, const char *func, - const char *file, unsigned int line); +dns_dispatchmgr_detach(dns_dispatchmgr_t **mgrp); /*%< - * Destroys the dispatchmgr when it becomes empty. This could be - * immediately. + * Detach from the dispatch manager, and destroy it if no references + * remain. * * Requires: *\li mgrp != NULL && *mgrp is a valid dispatchmgr. @@ -258,12 +258,8 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, isc_taskmgr_t *taskmgr, *\li Anything else -- failure. */ -#define dns_dispatch_attach(d, dp) \ - dns__dispatch_attach(d, dp, __func__, __FILE__, __LINE__) - void -dns__dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp, - const char *func, const char *file, unsigned int line); +dns_dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp); /*%< * Attach to a dispatch handle. * @@ -273,12 +269,8 @@ dns__dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp, *\li dispp != NULL && *dispp == NULL */ -#define dns_dispatch_detach(dp) \ - dns__dispatch_detach(dp, __func__, __FILE__, __LINE__) - void -dns__dispatch_detach(dns_dispatch_t **dispp, const char *func, const char *file, - unsigned int line); +dns_dispatch_detach(dns_dispatch_t **dispp); /*%< * Detaches from the dispatch. * diff --git a/lib/dns/include/dns/request.h b/lib/dns/include/dns/request.h index fd8e08cebe8..9554603b50b 100644 --- a/lib/dns/include/dns/request.h +++ b/lib/dns/include/dns/request.h @@ -124,12 +124,8 @@ dns_requestmgr_shutdown(dns_requestmgr_t *requestmgr); *\li 'requestmgr' is a valid requestmgr. */ -#define dns_requestmgr_attach(source, targetp) \ - dns__requestmgr_attach(source, targetp, __FILE__, __LINE__, __func__) - void -dns__requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp, - const char *file, unsigned int line, const char *func); +dns_requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp); /*%< * Attach to the request manager. dns_requestmgr_shutdown() must not * have been called on 'source' prior to calling dns_requestmgr_attach(). @@ -141,12 +137,8 @@ dns__requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp, *\li 'targetp' to be non NULL and '*targetp' to be NULL. */ -#define dns_requestmgr_detach(requestmgrp) \ - dns__requestmgr_detach(requestmgrp, __FILE__, __LINE__, __func__) - void -dns__requestmgr_detach(dns_requestmgr_t **requestmgrp, const char *file, - unsigned int line, const char *func); +dns_requestmgr_detach(dns_requestmgr_t **requestmgrp); /*%< * Detach from the given requestmgr. If this is the final detach * requestmgr will be destroyed. dns_requestmgr_shutdown() must diff --git a/lib/dns/request.c b/lib/dns/request.c index 7d2b938fa3a..9d4bb57f3d6 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -32,8 +32,6 @@ #include #include -#define REQ_TRACE - #define REQUESTMGR_MAGIC ISC_MAGIC('R', 'q', 'u', 'M') #define VALID_REQUESTMGR(mgr) ISC_MAGIC_VALID(mgr, REQUESTMGR_MAGIC) @@ -120,11 +118,9 @@ req_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg); static void req_timeout(isc_nmhandle_t *handle, isc_result_t eresult, void *arg); static void -__req_attach(dns_request_t *source, dns_request_t **targetp, const char *file, - unsigned int line, const char *func); +req_attach(dns_request_t *source, dns_request_t **targetp); static void -__req_detach(dns_request_t **requestp, const char *file, unsigned int line, - const char *func); +req_detach(dns_request_t **requestp); static void req_destroy(dns_request_t *request); static void @@ -132,11 +128,6 @@ req_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); void request_cancel(dns_request_t *request); -#define req_attach(source, targetp) \ - __req_attach(source, targetp, __FILE__, __LINE__, __func__) -#define req_detach(requestp) \ - __req_detach(requestp, __FILE__, __LINE__, __func__) - /*** *** Public ***/ @@ -257,8 +248,7 @@ dns_requestmgr_shutdown(dns_requestmgr_t *requestmgr) { } void -dns__requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp, - const char *file, unsigned int line, const char *func) { +dns_requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp) { uint_fast32_t ref; REQUIRE(VALID_REQUESTMGR(source)); @@ -268,16 +258,6 @@ dns__requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp, ref = isc_refcount_increment(&source->references); -#ifdef REQ_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, source, targetp, ref + 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* REQ_TRACE */ - req_log(ISC_LOG_DEBUG(3), "dns_requestmgr_attach: %p: references = %" PRIuFAST32, source, ref + 1); @@ -286,8 +266,7 @@ dns__requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp, } void -dns__requestmgr_detach(dns_requestmgr_t **requestmgrp, const char *file, - unsigned int line, const char *func) { +dns_requestmgr_detach(dns_requestmgr_t **requestmgrp) { dns_requestmgr_t *requestmgr = NULL; uint_fast32_t ref; @@ -298,16 +277,6 @@ dns__requestmgr_detach(dns_requestmgr_t **requestmgrp, const char *file, ref = isc_refcount_decrement(&requestmgr->references); -#ifdef REQ_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, requestmgr, requestmgrp, ref - 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* REQ_TRACE */ - req_log(ISC_LOG_DEBUG(3), "dns_requestmgr_detach: %p: references = %" PRIuFAST32, requestmgr, ref - 1); @@ -1181,31 +1150,17 @@ req_sendevent(dns_request_t *request, isc_result_t result) { } static void -__req_attach(dns_request_t *source, dns_request_t **targetp, const char *file, - unsigned int line, const char *func) { - uint_fast32_t ref; - +req_attach(dns_request_t *source, dns_request_t **targetp) { REQUIRE(VALID_REQUEST(source)); REQUIRE(targetp != NULL && *targetp == NULL); - ref = isc_refcount_increment(&source->references); - -#ifdef REQ_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, source, targetp, ref + 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* REQ_TRACE */ + isc_refcount_increment(&source->references); *targetp = source; } static void -__req_detach(dns_request_t **requestp, const char *file, unsigned int line, - const char *func) { +req_detach(dns_request_t **requestp) { dns_request_t *request = NULL; uint_fast32_t ref; @@ -1216,16 +1171,6 @@ __req_detach(dns_request_t **requestp, const char *file, unsigned int line, ref = isc_refcount_decrement(&request->references); -#ifdef REQ_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, request, requestp, ref - 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* REQ_TRACE */ - if (request->requestmgr != NULL && atomic_load_acquire(&request->requestmgr->exiting)) { diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 2a65090906c..ff246080621 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -62,10 +62,6 @@ #include #include -#define RESOLVER_TRACE 1 - -#define WANT_QUERYTRACE 1 - #ifdef WANT_QUERYTRACE #define RTRACE(m) \ isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, \ @@ -1169,37 +1165,18 @@ resquery_destroy(resquery_t *query) { } } -#define resquery_attach(s, t) \ - __resquery_attach(s, t, __FILE__, __LINE__, __func__) - -static void __attribute__((unused)) -__resquery_attach(resquery_t *source, resquery_t **targetp, const char *file, - unsigned int line, const char *func) { - uint_fast32_t ref; - +static void +resquery_attach(resquery_t *source, resquery_t **targetp) { REQUIRE(VALID_QUERY(source)); REQUIRE(targetp != NULL && *targetp == NULL); - ref = isc_refcount_increment(&source->references); - -#ifdef RESOLVER_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, source, targetp, ref + 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); - UNUSED(ref); -#endif /* RESOLVER_TRACE */ + isc_refcount_increment(&source->references); *targetp = source; } -#define resquery_detach(q) __resquery_detach(q, __FILE__, __LINE__, __func__) - static void -__resquery_detach(resquery_t **queryp, const char *file, unsigned int line, - const char *func) { +resquery_detach(resquery_t **queryp) { uint_fast32_t ref; resquery_t *query = NULL; @@ -1209,16 +1186,6 @@ __resquery_detach(resquery_t **queryp, const char *file, unsigned int line, *queryp = NULL; ref = isc_refcount_decrement(&query->references); - -#ifdef RESOLVER_TRACE - fprintf(stderr, "%s:%s:%u:%s(%p, %p) = %" PRIuFAST32 "\n", func, file, - line, __func__, query, queryp, ref - 1); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); -#endif /* RESOLVER_TRACE */ - if (ref == 1) { resquery_destroy(query); } @@ -1243,13 +1210,9 @@ update_edns_stats(resquery_t *query) { } } -#define fctx_cancelquery(q, d, f, n, a) \ - __fctx_cancelquery(q, d, f, n, a, __FILE__, __LINE__, __func__) - static void -__fctx_cancelquery(resquery_t *query, dns_dispatchevent_t **deventp, - isc_time_t *finish, bool no_response, bool age_untried, - const char *file, unsigned int line, const char *func) { +fctx_cancelquery(resquery_t *query, dns_dispatchevent_t **deventp, + isc_time_t *finish, bool no_response, bool age_untried) { fetchctx_t *fctx = NULL; unsigned int rtt, rttms; unsigned int factor; @@ -1259,15 +1222,6 @@ __fctx_cancelquery(resquery_t *query, dns_dispatchevent_t **deventp, fctx = query->fctx; -#ifdef RESOLVER_TRACE - fprintf(stderr, "%s:%s:%u:%s(query = %p, ...)\n", func, file, line, - __func__, query); -#else - UNUSED(func); - UNUSED(file); - UNUSED(line); -#endif /* RESOLVER_TRACE */ - FCTXTRACE("cancelquery"); if (RESQUERY_CANCELED(query)) {