From: Witold Kręcicki Date: Mon, 19 Nov 2018 10:31:09 +0000 (+0000) Subject: - Make isc_mutex_destroy return void X-Git-Tag: v9.13.5~43^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=929ea7c2c48ff7da36d9c5eadf7b8db3209fced0;p=thirdparty%2Fbind9.git - Make isc_mutex_destroy return void - Make isc_mutexblock_init/destroy return void - Minor cleanups --- diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index c362ba57411..2b6cab552e8 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -4198,7 +4198,7 @@ destroy_libs(void) { } UNLOCK_LOOKUP; - DESTROYLOCK(&lookup_lock); + isc_mutex_destroy(&lookup_lock); debug("Removing log context"); isc_log_destroy(&lctx); diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index d5423902e88..7e2e6c67c1c 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -3936,9 +3936,9 @@ main(int argc, char *argv[]) { check_result(result, "dns_master_dumptostream3"); } - DESTROYLOCK(&namelock); + isc_mutex_destroy(&namelock); if (printstats) - DESTROYLOCK(&statslock); + isc_mutex_destroy(&statslock); if (!output_stdout) { result = isc_stdio_close(outfp); diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 7e023f064ad..4566a6f73f5 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -3226,7 +3226,7 @@ destroy_listener(void *arg) { /* We don't have to acquire the lock here since it's already unlinked */ dns_acl_detach(&listener->acl); - DESTROYLOCK(&listener->lock); + isc_mutex_destroy(&listener->lock); isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener)); } @@ -3348,7 +3348,7 @@ cleanup: if (result != ISC_R_SUCCESS) { if (listener->acl != NULL) dns_acl_detach(&listener->acl); - DESTROYLOCK(&listener->lock); + isc_mutex_destroy(&listener->lock); isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener)); } diff --git a/bin/named/unix/dlz_dlopen_driver.c b/bin/named/unix/dlz_dlopen_driver.c index 61602f3aea7..8f540edb55c 100644 --- a/bin/named/unix/dlz_dlopen_driver.c +++ b/bin/named/unix/dlz_dlopen_driver.c @@ -362,15 +362,19 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], failed: dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname); - if (cd->dl_path != NULL) + if (cd->dl_path != NULL) { isc_mem_free(mctx, cd->dl_path); - if (cd->dlzname != NULL) + } + if (cd->dlzname != NULL) { isc_mem_free(mctx, cd->dlzname); - if (dlopen_flags != 0) - (void) isc_mutex_destroy(&cd->lock); + } + if (dlopen_flags != 0) { + isc_mutex_destroy(&cd->lock); + } #ifdef HAVE_DLCLOSE - if (cd->dl_handle) + if (cd->dl_handle) { dlclose(cd->dl_handle); + } #endif isc_mem_put(mctx, cd, sizeof(*cd)); isc_mem_destroy(&mctx); @@ -393,17 +397,20 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) { MAYBE_UNLOCK(cd); } - if (cd->dl_path) + if (cd->dl_path) { isc_mem_free(cd->mctx, cd->dl_path); - if (cd->dlzname) + } + if (cd->dlzname) { isc_mem_free(cd->mctx, cd->dlzname); + } #ifdef HAVE_DLCLOSE - if (cd->dl_handle) + if (cd->dl_handle) { dlclose(cd->dl_handle); + } #endif - (void) isc_mutex_destroy(&cd->lock); + isc_mutex_destroy(&cd->lock); mctx = cd->mctx; isc_mem_put(mctx, cd, sizeof(*cd)); diff --git a/bin/named/win32/dlz_dlopen_driver.c b/bin/named/win32/dlz_dlopen_driver.c index 650f56aba36..350773b252e 100644 --- a/bin/named/win32/dlz_dlopen_driver.c +++ b/bin/named/win32/dlz_dlopen_driver.c @@ -347,17 +347,21 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], return (ISC_R_SUCCESS); cleanup_lock: - DESTROYLOCK(&cd->lock); + isc_mutex_destroy(&cd->lock); failed: dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname); - if (cd->dl_path) + if (cd->dl_path) { isc_mem_free(mctx, cd->dl_path); - if (cd->dlzname) + } + if (cd->dlzname) { isc_mem_free(mctx, cd->dlzname); - if (triedload) - (void) isc_mutex_destroy(&cd->lock); - if (cd->dl_handle) + } + if (triedload) { + isc_mutex_destroy(&cd->lock); + } + if (cd->dl_handle) { FreeLibrary(cd->dl_handle); + } isc_mem_put(mctx, cd, sizeof(*cd)); isc_mem_destroy(&mctx); return (result); @@ -388,7 +392,7 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) { if (cd->dl_handle) FreeLibrary(cd->dl_handle); - DESTROYLOCK(&cd->lock); + isc_mutex_destroy(&cd->lock); mctx = cd->mctx; isc_mem_put(mctx, cd, sizeof(*cd)); diff --git a/bin/tests/optional/mempool_test.c b/bin/tests/optional/mempool_test.c index f696ce0f69a..dc8b3b8a742 100644 --- a/bin/tests/optional/mempool_test.c +++ b/bin/tests/optional/mempool_test.c @@ -114,7 +114,7 @@ main(int argc, char *argv[]) { isc_mem_destroy(&mctx); - DESTROYLOCK(&lock); + isc_mutex_destroy(&lock); return (0); } diff --git a/bin/tests/optional/sig0_test.c b/bin/tests/optional/sig0_test.c index 3416f3588be..9db47c66b8c 100644 --- a/bin/tests/optional/sig0_test.c +++ b/bin/tests/optional/sig0_test.c @@ -282,7 +282,7 @@ main(int argc, char *argv[]) { isc_mem_stats(mctx, stdout); isc_mem_destroy(&mctx); - DESTROYLOCK(&lock); + isc_mutex_destroy(&lock); isc_app_finish(); diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 3e5bab999b1..ac0ab18fc5f 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -610,9 +610,7 @@ grow_entries(isc_task_t *task, isc_event_t *ev) { /* * Initialise the new resources. */ - result = isc_mutexblock_init(newentrylocks, n); - if (result != ISC_R_SUCCESS) - goto cleanup; + isc_mutexblock_init(newentrylocks, n); for (i = 0; i < n; i++) { ISC_LIST_INIT(newentries[i]); @@ -655,7 +653,7 @@ grow_entries(isc_task_t *task, isc_event_t *ev) { /* * Cleanup old resources. */ - DESTROYMUTEXBLOCK(adb->entrylocks, adb->nentries); + isc_mutexblock_destroy(adb->entrylocks, adb->nentries); isc_mem_put(adb->mctx, adb->entries, sizeof(*adb->entries) * adb->nentries); isc_mem_put(adb->mctx, adb->deadentries, @@ -767,9 +765,7 @@ grow_names(isc_task_t *task, isc_event_t *ev) { /* * Initialise the new resources. */ - result = isc_mutexblock_init(newnamelocks, n); - if (result != ISC_R_SUCCESS) - goto cleanup; + isc_mutexblock_init(newnamelocks, n); for (i = 0; i < n; i++) { ISC_LIST_INIT(newnames[i]); @@ -812,7 +808,7 @@ grow_names(isc_task_t *task, isc_event_t *ev) { /* * Cleanup old resources. */ - DESTROYMUTEXBLOCK(adb->namelocks, adb->nnames); + isc_mutexblock_destroy(adb->namelocks, adb->nnames); isc_mem_put(adb->mctx, adb->names, sizeof(*adb->names) * adb->nnames); isc_mem_put(adb->mctx, adb->deadnames, @@ -1979,7 +1975,7 @@ free_adbfind(dns_adb_t *adb, dns_adbfind_t **findp) { find->magic = 0; - DESTROYLOCK(&find->lock); + isc_mutex_destroy(&find->lock); isc_mempool_put(adb->ahmp, find); return (dec_adb_irefcnt(adb)); } @@ -2475,7 +2471,7 @@ destroy(dns_adb_t *adb) { isc_mempool_destroy(&adb->aimp); isc_mempool_destroy(&adb->afmp); - DESTROYMUTEXBLOCK(adb->entrylocks, adb->nentries); + isc_mutexblock_destroy(adb->entrylocks, adb->nentries); isc_mem_put(adb->mctx, adb->entries, sizeof(*adb->entries) * adb->nentries); isc_mem_put(adb->mctx, adb->deadentries, @@ -2487,7 +2483,7 @@ destroy(dns_adb_t *adb) { isc_mem_put(adb->mctx, adb->entry_refcnt, sizeof(*adb->entry_refcnt) * adb->nentries); - DESTROYMUTEXBLOCK(adb->namelocks, adb->nnames); + isc_mutexblock_destroy(adb->namelocks, adb->nnames); isc_mem_put(adb->mctx, adb->names, sizeof(*adb->names) * adb->nnames); isc_mem_put(adb->mctx, adb->deadnames, @@ -2499,12 +2495,12 @@ destroy(dns_adb_t *adb) { isc_mem_put(adb->mctx, adb->name_refcnt, sizeof(*adb->name_refcnt) * adb->nnames); - DESTROYLOCK(&adb->reflock); - DESTROYLOCK(&adb->lock); - DESTROYLOCK(&adb->mplock); - DESTROYLOCK(&adb->overmemlock); - DESTROYLOCK(&adb->entriescntlock); - DESTROYLOCK(&adb->namescntlock); + isc_mutex_destroy(&adb->reflock); + isc_mutex_destroy(&adb->lock); + isc_mutex_destroy(&adb->mplock); + isc_mutex_destroy(&adb->overmemlock); + isc_mutex_destroy(&adb->entriescntlock); + isc_mutex_destroy(&adb->namescntlock); isc_mem_putanddetach(&adb->mctx, adb, sizeof(dns_adb_t)); } @@ -2644,9 +2640,8 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, * Initialize the bucket locks for names and elements. * May as well initialize the list heads, too. */ - result = isc_mutexblock_init(adb->namelocks, adb->nnames); - if (result != ISC_R_SUCCESS) - goto fail1; + isc_mutexblock_init(adb->namelocks, adb->nnames); + for (i = 0; i < adb->nnames; i++) { ISC_LIST_INIT(adb->names[i]); ISC_LIST_INIT(adb->deadnames[i]); @@ -2661,9 +2656,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, adb->entry_refcnt[i] = 0; adb->irefcnt++; } - result = isc_mutexblock_init(adb->entrylocks, adb->nentries); - if (result != ISC_R_SUCCESS) - goto fail2; + isc_mutexblock_init(adb->entrylocks, adb->nentries); /* * Memory pools @@ -2671,12 +2664,12 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, #define MPINIT(t, p, n) do { \ result = isc_mempool_create(mem, sizeof(t), &(p)); \ if (result != ISC_R_SUCCESS) \ - goto fail3; \ + goto fail2; \ isc_mempool_setfreemax((p), FREE_ITEMS); \ isc_mempool_setfillcount((p), FILL_COUNT); \ isc_mempool_setname((p), n); \ isc_mempool_associatelock((p), &adb->mplock); \ -} while (0) + } while (0) MPINIT(dns_adbname_t, adb->nmp, "adbname"); MPINIT(dns_adbnamehook_t, adb->nhmp, "adbnamehook"); @@ -2693,13 +2686,13 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, */ result = isc_task_create(adb->taskmgr, 0, &adb->task); if (result != ISC_R_SUCCESS) - goto fail3; + goto fail2; isc_task_setname(adb->task, "ADB", adb); result = isc_stats_create(adb->mctx, &view->adbstats, dns_adbstats_max); if (result != ISC_R_SUCCESS) - goto fail3; + goto fail2; set_adbstat(adb, adb->nentries, dns_adbstats_nentries); set_adbstat(adb, adb->nnames, dns_adbstats_nnames); @@ -2711,15 +2704,13 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, *newadb = adb; return (ISC_R_SUCCESS); - fail3: + fail2: if (adb->task != NULL) isc_task_detach(&adb->task); /* clean up entrylocks */ - DESTROYMUTEXBLOCK(adb->entrylocks, adb->nentries); - - fail2: /* clean up namelocks */ - DESTROYMUTEXBLOCK(adb->namelocks, adb->nnames); + isc_mutexblock_destroy(adb->entrylocks, adb->nentries); + isc_mutexblock_destroy(adb->namelocks, adb->nnames); fail1: /* clean up only allocated memory */ if (adb->entries != NULL) @@ -2767,12 +2758,12 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, if (adb->afmp != NULL) isc_mempool_destroy(&adb->afmp); - DESTROYLOCK(&adb->namescntlock); - DESTROYLOCK(&adb->entriescntlock); - DESTROYLOCK(&adb->overmemlock); - DESTROYLOCK(&adb->reflock); - DESTROYLOCK(&adb->mplock); - DESTROYLOCK(&adb->lock); + isc_mutex_destroy(&adb->namescntlock); + isc_mutex_destroy(&adb->entriescntlock); + isc_mutex_destroy(&adb->overmemlock); + isc_mutex_destroy(&adb->reflock); + isc_mutex_destroy(&adb->mplock); + isc_mutex_destroy(&adb->lock); if (adb->excl != NULL) isc_task_detach(&adb->excl); isc_mem_putanddetach(&adb->mctx, adb, sizeof(dns_adb_t)); diff --git a/lib/dns/badcache.c b/lib/dns/badcache.c index 3802f601195..cea0f5d57ec 100644 --- a/lib/dns/badcache.c +++ b/lib/dns/badcache.c @@ -94,7 +94,7 @@ dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) { return (ISC_R_SUCCESS); destroy_lock: - DESTROYLOCK(&bc->lock); + isc_mutex_destroy(&bc->lock); isc_mem_putanddetach(&bc->mctx, bc, sizeof(dns_badcache_t)); return (result); } @@ -109,7 +109,7 @@ dns_badcache_destroy(dns_badcache_t **bcp) { dns_badcache_flush(bc); bc->magic = 0; - DESTROYLOCK(&bc->lock); + isc_mutex_destroy(&bc->lock); isc_mem_put(bc->mctx, bc->table, sizeof(dns_bcentry_t *) * bc->size); isc_mem_putanddetach(&bc->mctx, bc, sizeof(dns_badcache_t)); *bcp = NULL; diff --git a/lib/dns/byaddr.c b/lib/dns/byaddr.c index 63a5a9d3811..0ef75a34b5d 100644 --- a/lib/dns/byaddr.c +++ b/lib/dns/byaddr.c @@ -248,7 +248,7 @@ dns_byaddr_create(isc_mem_t *mctx, const isc_netaddr_t *address, return (ISC_R_SUCCESS); cleanup_lock: - DESTROYLOCK(&byaddr->lock); + isc_mutex_destroy(&byaddr->lock); ievent = (isc_event_t *)byaddr->event; isc_event_free(&ievent); @@ -288,7 +288,7 @@ dns_byaddr_destroy(dns_byaddr_t **byaddrp) { REQUIRE(byaddr->task == NULL); dns_lookup_destroy(&byaddr->lookup); - DESTROYLOCK(&byaddr->lock); + isc_mutex_destroy(&byaddr->lock); byaddr->magic = 0; isc_mem_putanddetach(&byaddr->mctx, byaddr, sizeof(*byaddr)); diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 7a0b5142e92..1082d5f084e 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -320,10 +320,10 @@ cleanup_dbargv: cleanup_dbtype: isc_mem_free(cmctx, cache->db_type); cleanup_filelock: - DESTROYLOCK(&cache->filelock); + isc_mutex_destroy(&cache->filelock); cleanup_stats: isc_stats_detach(&cache->stats); - DESTROYLOCK(&cache->lock); + isc_mutex_destroy(&cache->lock); cleanup_mem: if (cache->name != NULL) { isc_mem_free(cmctx, cache->name); @@ -354,7 +354,7 @@ cache_free(dns_cache_t *cache) { if (cache->cleaner.iterator != NULL) dns_dbiterator_destroy(&cache->cleaner.iterator); - DESTROYLOCK(&cache->cleaner.lock); + isc_mutex_destroy(&cache->cleaner.lock); if (cache->filename) { isc_mem_free(cache->mctx, cache->filename); @@ -388,8 +388,8 @@ cache_free(dns_cache_t *cache) { if (cache->stats != NULL) isc_stats_detach(&cache->stats); - DESTROYLOCK(&cache->lock); - DESTROYLOCK(&cache->filelock); + isc_mutex_destroy(&cache->lock); + isc_mutex_destroy(&cache->filelock); cache->magic = 0; isc_mem_detach(&cache->hmctx); @@ -679,7 +679,7 @@ cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr, isc_task_detach(&cleaner->task); if (cleaner->iterator != NULL) dns_dbiterator_destroy(&cleaner->iterator); - DESTROYLOCK(&cleaner->lock); + isc_mutex_destroy(&cleaner->lock); return (result); } diff --git a/lib/dns/catz.c b/lib/dns/catz.c index a0a653f0081..775e54c0e1a 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -793,7 +793,7 @@ dns_catz_catzs_detach(dns_catz_zones_t **catzsp) { if (isc_refcount_decrement(&catzs->refs) == 1) { isc_task_destroy(&catzs->updater); - DESTROYLOCK(&catzs->lock); + isc_mutex_destroy(&catzs->lock); if (catzs->zones != NULL) { isc_ht_iter_t *iter = NULL; isc_result_t result; diff --git a/lib/dns/client.c b/lib/dns/client.c index 0ab615bb5c5..f08dec7f9e1 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -573,7 +573,7 @@ destroyclient(dns_client_t **clientp) { isc_appctx_destroy(&client->actx); } - DESTROYLOCK(&client->lock); + isc_mutex_destroy(&client->lock); client->magic = 0; isc_mem_putanddetach(&client->mctx, client, sizeof(*client)); @@ -1208,7 +1208,7 @@ resolve_done(isc_task_t *task, isc_event_t *event) { * unexpected event). Just clean the arg up. */ UNLOCK(&resarg->lock); - DESTROYLOCK(&resarg->lock); + isc_mutex_destroy(&resarg->lock); isc_mem_put(resarg->client->mctx, resarg, sizeof(*resarg)); } } @@ -1252,7 +1252,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name, client->task, resolve_done, resarg, &resarg->trans); if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&resarg->lock); + isc_mutex_destroy(&resarg->lock); isc_mem_put(client->mctx, resarg, sizeof(*resarg)); return (result); } @@ -1288,7 +1288,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name, } else { UNLOCK(&resarg->lock); - DESTROYLOCK(&resarg->lock); + isc_mutex_destroy(&resarg->lock); isc_mem_put(client->mctx, resarg, sizeof(*resarg)); } @@ -1402,7 +1402,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name, if (sigrdataset != NULL) putrdataset(client->mctx, &sigrdataset); if (rctx != NULL) { - DESTROYLOCK(&rctx->lock); + isc_mutex_destroy(&rctx->lock); isc_mem_put(mctx, rctx, sizeof(*rctx)); } if (event != NULL) @@ -1490,7 +1490,7 @@ dns_client_destroyrestrans(dns_clientrestrans_t **transp) { INSIST(ISC_LIST_EMPTY(rctx->namelist)); - DESTROYLOCK(&rctx->lock); + isc_mutex_destroy(&rctx->lock); rctx->magic = 0; isc_mem_put(mctx, rctx, sizeof(*rctx)); @@ -1608,7 +1608,7 @@ localrequest_done(isc_task_t *task, isc_event_t *event) { * unexpected event). Just clean the arg up. */ UNLOCK(&reqarg->lock); - DESTROYLOCK(&reqarg->lock); + isc_mutex_destroy(&reqarg->lock); isc_mem_put(reqarg->client->mctx, reqarg, sizeof(*reqarg)); } } @@ -1656,7 +1656,7 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage, client->task, localrequest_done, reqarg, &reqarg->trans); if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&reqarg->lock); + isc_mutex_destroy(&reqarg->lock); isc_mem_put(client->mctx, reqarg, sizeof(*reqarg)); return (result); } @@ -1684,7 +1684,7 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage, } else { UNLOCK(&reqarg->lock); - DESTROYLOCK(&reqarg->lock); + isc_mutex_destroy(&reqarg->lock); isc_mem_put(client->mctx, reqarg, sizeof(*reqarg)); } @@ -1783,7 +1783,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage, LOCK(&client->lock); ISC_LIST_UNLINK(client->reqctxs, ctx, link); UNLOCK(&client->lock); - DESTROYLOCK(&ctx->lock); + isc_mutex_destroy(&ctx->lock); isc_mem_put(client->mctx, ctx, sizeof(*ctx)); } if (event != NULL) @@ -1844,7 +1844,7 @@ dns_client_destroyreqtrans(dns_clientreqtrans_t **transp) { UNLOCK(&client->lock); - DESTROYLOCK(&ctx->lock); + isc_mutex_destroy(&ctx->lock); ctx->magic = 0; isc_mem_put(mctx, ctx, sizeof(*ctx)); @@ -2662,7 +2662,7 @@ internal_update_callback(isc_task_t *task, isc_event_t *event) { * unexpected event). Just clean the arg up. */ UNLOCK(&uarg->lock); - DESTROYLOCK(&uarg->lock); + isc_mutex_destroy(&uarg->lock); isc_mem_put(uarg->client->mctx, uarg, sizeof(*uarg)); } } @@ -2708,7 +2708,7 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass, internal_update_callback, uarg, &uarg->trans); if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&uarg->lock); + isc_mutex_destroy(&uarg->lock); isc_mem_put(client->mctx, uarg, sizeof(*uarg)); return (result); } @@ -2737,7 +2737,7 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass, } else { UNLOCK(&uarg->lock); - DESTROYLOCK(&uarg->lock); + isc_mutex_destroy(&uarg->lock); isc_mem_put(client->mctx, uarg, sizeof(*uarg)); } @@ -2975,7 +2975,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass, if (uctx->tsigkey != NULL) dns_tsigkey_detach(&uctx->tsigkey); isc_task_detach(&tclone); - DESTROYLOCK(&uctx->lock); + isc_mutex_destroy(&uctx->lock); uctx->magic = 0; isc_mem_put(client->mctx, uctx, sizeof(*uctx)); dns_view_detach(&view); @@ -3045,7 +3045,7 @@ dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp) { UNLOCK(&client->lock); - DESTROYLOCK(&uctx->lock); + isc_mutex_destroy(&uctx->lock); uctx->magic = 0; isc_mem_put(mctx, uctx, sizeof(*uctx)); diff --git a/lib/dns/dbtable.c b/lib/dns/dbtable.c index 934baac9d1d..24358b20bd2 100644 --- a/lib/dns/dbtable.c +++ b/lib/dns/dbtable.c @@ -85,7 +85,7 @@ dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, return (ISC_R_SUCCESS); clean3: - DESTROYLOCK(&dbtable->lock); + isc_mutex_destroy(&dbtable->lock); dns_rbt_destroy(&dbtable->rbt); diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 969153d0efc..874415d777c 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -526,7 +526,7 @@ destroy_disp(isc_task_t *task, isc_event_t *event) { if (disp->sepool != NULL) { isc_mempool_destroy(&disp->sepool); - (void)isc_mutex_destroy(&disp->sepool_lock); + isc_mutex_destroy(&disp->sepool_lock); } if (disp->socket != NULL) @@ -1625,7 +1625,7 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) { mgr->magic = 0; mgr->mctx = NULL; - DESTROYLOCK(&mgr->lock); + isc_mutex_destroy(&mgr->lock); mgr->state = 0; isc_mempool_destroy(&mgr->depool); @@ -1636,16 +1636,16 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) { if (mgr->spool != NULL) isc_mempool_destroy(&mgr->spool); - DESTROYLOCK(&mgr->spool_lock); - DESTROYLOCK(&mgr->bpool_lock); - DESTROYLOCK(&mgr->dpool_lock); - DESTROYLOCK(&mgr->rpool_lock); - DESTROYLOCK(&mgr->depool_lock); + isc_mutex_destroy(&mgr->spool_lock); + isc_mutex_destroy(&mgr->bpool_lock); + isc_mutex_destroy(&mgr->dpool_lock); + isc_mutex_destroy(&mgr->rpool_lock); + isc_mutex_destroy(&mgr->depool_lock); if (mgr->qid != NULL) qid_destroy(mctx, &mgr->qid); - DESTROYLOCK(&mgr->buffer_lock); + isc_mutex_destroy(&mgr->buffer_lock); if (mgr->blackhole != NULL) dns_acl_detach(&mgr->blackhole); @@ -1772,7 +1772,7 @@ dns_dispatchmgr_create(isc_mem_t *mctx, dns_dispatchmgr_t **mgrp) if (isc_mempool_create(mgr->mctx, sizeof(dns_dispatchevent_t), &mgr->depool) != ISC_R_SUCCESS) { result = ISC_R_NOMEMORY; - goto kill_spool_lock; + goto kill_locks; } mgr->rpool = NULL; @@ -1846,14 +1846,14 @@ dns_dispatchmgr_create(isc_mem_t *mctx, dns_dispatchmgr_t **mgrp) isc_mempool_destroy(&mgr->rpool); kill_depool: isc_mempool_destroy(&mgr->depool); - kill_spool_lock: - DESTROYLOCK(&mgr->spool_lock); - DESTROYLOCK(&mgr->bpool_lock); - DESTROYLOCK(&mgr->dpool_lock); - DESTROYLOCK(&mgr->rpool_lock); - DESTROYLOCK(&mgr->depool_lock); - DESTROYLOCK(&mgr->buffer_lock); - DESTROYLOCK(&mgr->lock); + kill_locks: + isc_mutex_destroy(&mgr->spool_lock); + isc_mutex_destroy(&mgr->bpool_lock); + isc_mutex_destroy(&mgr->dpool_lock); + isc_mutex_destroy(&mgr->rpool_lock); + isc_mutex_destroy(&mgr->depool_lock); + isc_mutex_destroy(&mgr->buffer_lock); + isc_mutex_destroy(&mgr->lock); isc_mem_put(mctx, mgr, sizeof(dns_dispatchmgr_t)); isc_mem_detach(&mctx); @@ -2296,7 +2296,7 @@ qid_destroy(isc_mem_t *mctx, dns_qid_t **qidp) { isc_mem_put(mctx, qid->sock_table, qid->qid_nbuckets * sizeof(dispsocketlist_t)); } - DESTROYLOCK(&qid->lock); + isc_mutex_destroy(&qid->lock); isc_mem_put(mctx, qid, sizeof(*qid)); } @@ -2364,7 +2364,7 @@ dispatch_allocate(dns_dispatchmgr_t *mgr, unsigned int maxrequests, * error returns */ kill_lock: - DESTROYLOCK(&disp->lock); + isc_mutex_destroy(&disp->lock); isc_mempool_put(mgr->dpool, disp); return (result); @@ -2416,7 +2416,7 @@ dispatch_free(dns_dispatch_t **dispp) { isc_mempool_destroy(&disp->portpool); disp->mgr = NULL; - DESTROYLOCK(&disp->lock); + isc_mutex_destroy(&disp->lock); disp->magic = 0; isc_mempool_put(mgr->dpool, disp); } @@ -3689,7 +3689,7 @@ dns_dispatchset_create(isc_mem_t *mctx, isc_socketmgr_t *sockmgr, isc_mem_detach(&dset->mctx); fail_lock: - DESTROYLOCK(&dset->lock); + isc_mutex_destroy(&dset->lock); isc_mem_put(mctx, dset, sizeof(dns_dispatchset_t)); return (result); } @@ -3719,7 +3719,7 @@ dns_dispatchset_destroy(dns_dispatchset_t **dsetp) { dns_dispatch_detach(&(dset->dispatches[i])); isc_mem_put(dset->mctx, dset->dispatches, sizeof(dns_dispatch_t *) * dset->ndisp); - DESTROYLOCK(&dset->lock); + isc_mutex_destroy(&dset->lock); isc_mem_putanddetach(&dset->mctx, dset, sizeof(dns_dispatchset_t)); *dsetp = NULL; diff --git a/lib/dns/dnsrps.c b/lib/dns/dnsrps.c index f2027fb52a7..784a055dada 100644 --- a/lib/dns/dnsrps.c +++ b/lib/dns/dnsrps.c @@ -77,7 +77,7 @@ static void dnsrps_mutex_destroy(void *mutex0) { isc_mutex_t *mutex = mutex0; - DESTROYLOCK(mutex); + isc_mutex_destroy(mutex); } static void diff --git a/lib/dns/ecdb.c b/lib/dns/ecdb.c index cdf1a8e2c9c..10e0dfebfaa 100644 --- a/lib/dns/ecdb.c +++ b/lib/dns/ecdb.c @@ -173,7 +173,7 @@ destroy_ecdb(dns_ecdb_t **ecdbp) { if (dns_name_dynamic(&ecdb->common.origin)) dns_name_free(&ecdb->common.origin, mctx); - DESTROYLOCK(&ecdb->lock); + isc_mutex_destroy(&ecdb->lock); ecdb->common.impmagic = 0; ecdb->common.magic = 0; @@ -249,7 +249,7 @@ destroynode(dns_ecdbnode_t *node) { isc_mem_put(mctx, header, headersize); } - DESTROYLOCK(&node->lock); + isc_mutex_destroy(&node->lock); node->magic = 0; isc_mem_put(mctx, node, sizeof(*node)); @@ -359,7 +359,7 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_name_init(&node->name, NULL); result = dns_name_dup(name, mctx, &node->name); if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&node->lock); + isc_mutex_destroy(&node->lock); isc_mem_put(mctx, node, sizeof(*node)); return (result); } diff --git a/lib/dns/lookup.c b/lib/dns/lookup.c index ecf9c8dab8c..af00365cf26 100644 --- a/lib/dns/lookup.c +++ b/lib/dns/lookup.c @@ -435,7 +435,7 @@ dns_lookup_create(isc_mem_t *mctx, const dns_name_t *name, dns_rdatatype_t type, return (ISC_R_SUCCESS); cleanup_lock: - DESTROYLOCK(&lookup->lock); + isc_mutex_destroy(&lookup->lock); ievent = (isc_event_t *)lookup->event; isc_event_free(&ievent); lookup->event = NULL; @@ -480,7 +480,7 @@ dns_lookup_destroy(dns_lookup_t **lookupp) { if (dns_rdataset_isassociated(&lookup->sigrdataset)) dns_rdataset_disassociate(&lookup->sigrdataset); - DESTROYLOCK(&lookup->lock); + isc_mutex_destroy(&lookup->lock); lookup->magic = 0; isc_mem_putanddetach(&lookup->mctx, lookup, sizeof(*lookup)); diff --git a/lib/dns/master.c b/lib/dns/master.c index ac4c1374686..4002dbc2e7f 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -463,7 +463,7 @@ loadctx_destroy(dns_loadctx_t *lctx) { if (lctx->task != NULL) isc_task_detach(&lctx->task); - DESTROYLOCK(&lctx->lock); + isc_mutex_destroy(&lctx->lock); mctx = NULL; isc_mem_attach(lctx->mctx, &mctx); isc_mem_detach(&lctx->mctx); diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 109bffdc335..1eff6f53833 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -1266,7 +1266,7 @@ static void dumpctx_destroy(dns_dumpctx_t *dctx) { dctx->magic = 0; - DESTROYLOCK(&dctx->lock); + isc_mutex_destroy(&dctx->lock); dns_dbiterator_destroy(&dctx->dbiter); if (dctx->version != NULL) dns_db_closeversion(dctx->db, &dctx->version, false); diff --git a/lib/dns/openssl_link.c b/lib/dns/openssl_link.c index 8781406096f..e1fa7972e2a 100644 --- a/lib/dns/openssl_link.c +++ b/lib/dns/openssl_link.c @@ -117,9 +117,7 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine) { locks = isc_mem_allocate(dst__mctx, sizeof(isc_mutex_t) * nlocks); if (locks == NULL) return (ISC_R_NOMEMORY); - result = isc_mutexblock_init(locks, nlocks); - if (result != ISC_R_SUCCESS) - goto cleanup_mutexalloc; + isc_mutexblock_init(locks, nlocks); CRYPTO_set_locking_callback(lock_callback); # if defined(LIBRESSL_VERSION_NUMBER) CRYPTO_set_id_callback(id_callback); @@ -181,8 +179,7 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine) { #endif #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) CRYPTO_set_locking_callback(NULL); - DESTROYMUTEXBLOCK(locks, nlocks); - cleanup_mutexalloc: + isc_mutexblock_destroy(locks, nlocks); isc_mem_free(dst__mctx, locks); locks = NULL; #endif @@ -219,7 +216,7 @@ dst__openssl_destroy(void) { if (locks != NULL) { CRYPTO_set_locking_callback(NULL); - DESTROYMUTEXBLOCK(locks, nlocks); + isc_mutexblock_destroy(locks, nlocks); isc_mem_free(dst__mctx, locks); locks = NULL; } diff --git a/lib/dns/portlist.c b/lib/dns/portlist.c index 882058de3b9..26bfc790a7c 100644 --- a/lib/dns/portlist.c +++ b/lib/dns/portlist.c @@ -240,7 +240,7 @@ dns_portlist_detach(dns_portlist_t **portlistp) { isc_mem_put(portlist->mctx, portlist->list, portlist->allocated * sizeof(*portlist->list)); - DESTROYLOCK(&portlist->lock); + isc_mutex_destroy(&portlist->lock); isc_mem_putanddetach(&portlist->mctx, portlist, sizeof(*portlist)); } diff --git a/lib/dns/request.c b/lib/dns/request.c index df19ebc37a3..728744c8065 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -385,9 +385,9 @@ mgr_destroy(dns_requestmgr_t *requestmgr) { REQUIRE(requestmgr->eref == 0); REQUIRE(requestmgr->iref == 0); - DESTROYLOCK(&requestmgr->lock); + isc_mutex_destroy(&requestmgr->lock); for (i = 0; i < DNS_REQUEST_NLOCKS; i++) - DESTROYLOCK(&requestmgr->locks[i]); + isc_mutex_destroy(&requestmgr->locks[i]); if (requestmgr->dispatchv4 != NULL) dns_dispatch_detach(&requestmgr->dispatchv4); if (requestmgr->dispatchv6 != NULL) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 1d25f44505e..bfb58f1779f 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -9732,14 +9732,14 @@ destroy(dns_resolver_t *res) { INSIST(res->nfctx == 0); - DESTROYLOCK(&res->primelock); - DESTROYLOCK(&res->nlock); - DESTROYLOCK(&res->lock); + isc_mutex_destroy(&res->primelock); + isc_mutex_destroy(&res->nlock); + isc_mutex_destroy(&res->lock); for (i = 0; i < res->nbuckets; i++) { INSIST(ISC_LIST_EMPTY(res->buckets[i].fctxs)); isc_task_shutdown(res->buckets[i].task); isc_task_detach(&res->buckets[i].task); - DESTROYLOCK(&res->buckets[i].lock); + isc_mutex_destroy(&res->buckets[i].lock); isc_mem_detach(&res->buckets[i].mctx); } isc_mem_put(res->mctx, res->buckets, @@ -9747,7 +9747,7 @@ destroy(dns_resolver_t *res) { for (i = 0; i < RES_DOMAIN_BUCKETS; i++) { INSIST(ISC_LIST_EMPTY(res->dbuckets[i].list)); isc_mem_detach(&res->dbuckets[i].mctx); - DESTROYLOCK(&res->dbuckets[i].lock); + isc_mutex_destroy(&res->dbuckets[i].lock); } isc_mem_put(res->mctx, res->dbuckets, RES_DOMAIN_BUCKETS * sizeof(zonebucket_t)); @@ -9926,7 +9926,7 @@ dns_resolver_create(dns_view_t *view, res->buckets[i].task = NULL; result = isc_task_create(taskmgr, 0, &res->buckets[i].task); if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&res->buckets[i].lock); + isc_mutex_destroy(&res->buckets[i].lock); goto cleanup_buckets; } res->buckets[i].mctx = NULL; @@ -9939,7 +9939,7 @@ dns_resolver_create(dns_view_t *view, result = isc_mem_create(0, 0, &res->buckets[i].mctx); if (result != ISC_R_SUCCESS) { isc_task_detach(&res->buckets[i].task); - DESTROYLOCK(&res->buckets[i].lock); + isc_mutex_destroy(&res->buckets[i].lock); goto cleanup_buckets; } isc_mem_setname(res->buckets[i].mctx, name, NULL); @@ -10038,9 +10038,9 @@ dns_resolver_create(dns_view_t *view, #endif cleanup_primelock: - DESTROYLOCK(&res->primelock); - DESTROYLOCK(&res->nlock); - DESTROYLOCK(&res->lock); + isc_mutex_destroy(&res->primelock); + isc_mutex_destroy(&res->nlock); + isc_mutex_destroy(&res->lock); if (res->dispatches6 != NULL) dns_dispatchset_destroy(&res->dispatches6); @@ -10048,7 +10048,7 @@ dns_resolver_create(dns_view_t *view, dns_dispatchset_destroy(&res->dispatches4); for (i = 0; i < dbuckets_created; i++) { - DESTROYLOCK(&res->dbuckets[i].lock); + isc_mutex_destroy(&res->dbuckets[i].lock); isc_mem_detach(&res->dbuckets[i].mctx); } isc_mem_put(view->mctx, res->dbuckets, @@ -10057,7 +10057,7 @@ dns_resolver_create(dns_view_t *view, cleanup_buckets: for (i = 0; i < buckets_created; i++) { isc_mem_detach(&res->buckets[i].mctx); - DESTROYLOCK(&res->buckets[i].lock); + isc_mutex_destroy(&res->buckets[i].lock); isc_task_shutdown(res->buckets[i].task); isc_task_detach(&res->buckets[i].task); } diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 09b71ba0a4e..0d75ff0c66b 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -1485,7 +1485,7 @@ cleanup_rbt: INSIST(isc_refcount_decrement(&zones->refs) > 0); isc_refcount_destroy(&zones->refs); - DESTROYLOCK(&zones->maint_lock); + isc_mutex_destroy(&zones->maint_lock); isc_rwlock_destroy(&zones->search_lock); @@ -2177,7 +2177,7 @@ dns_rpz_detach_rpzs(dns_rpz_zones_t **rpzsp) { if (rpzs->rbt != NULL) { dns_rbt_destroy(&rpzs->rbt); } - DESTROYLOCK(&rpzs->maint_lock); + isc_mutex_destroy(&rpzs->maint_lock); isc_rwlock_destroy(&rpzs->search_lock); isc_refcount_destroy(&rpzs->refs); isc_mem_putanddetach(&rpzs->mctx, rpzs, sizeof(*rpzs)); diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index 9a15bc813ac..b603a98dda6 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -1263,7 +1263,7 @@ dns_rrl_view_destroy(dns_view_t *view) { if (rrl->exempt != NULL) dns_acl_detach(&rrl->exempt); - DESTROYLOCK(&rrl->lock); + isc_mutex_destroy(&rrl->lock); while (!ISC_LIST_EMPTY(rrl->blocks)) { b = ISC_LIST_HEAD(rrl->blocks); diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index fcde0e045e0..c319dbd1d9b 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -238,7 +238,7 @@ dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods, return (ISC_R_SUCCESS); cleanup_mutex: - DESTROYLOCK(&imp->driverlock); + isc_mutex_destroy(&imp->driverlock); isc_mem_put(mctx, imp, sizeof(dns_sdbimplementation_t)); return (result); } @@ -252,7 +252,7 @@ dns_sdb_unregister(dns_sdbimplementation_t **sdbimp) { imp = *sdbimp; dns_db_unregister(&imp->dbimp); - DESTROYLOCK(&imp->driverlock); + isc_mutex_destroy(&imp->driverlock); mctx = imp->mctx; isc_mem_put(mctx, imp, sizeof(dns_sdbimplementation_t)); @@ -554,7 +554,7 @@ destroy(dns_sdb_t *sdb) { } isc_mem_free(mctx, sdb->zone); - DESTROYLOCK(&sdb->lock); + isc_mutex_destroy(&sdb->lock); sdb->common.magic = 0; sdb->common.impmagic = 0; @@ -704,7 +704,7 @@ destroynode(dns_sdbnode_t *node) { dns_name_free(node->name, mctx); isc_mem_put(mctx, node->name, sizeof(dns_name_t)); } - DESTROYLOCK(&node->lock); + isc_mutex_destroy(&node->lock); node->magic = 0; isc_mem_put(mctx, node, sizeof(dns_sdbnode_t)); detach((dns_db_t **) (void *)&sdb); @@ -1367,7 +1367,7 @@ dns_sdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, cleanup_origin: dns_name_free(&sdb->common.origin, mctx); cleanup_lock: - (void)isc_mutex_destroy(&sdb->lock); + isc_mutex_destroy(&sdb->lock); isc_mem_put(mctx, sdb, sizeof(dns_sdb_t)); isc_mem_detach(&mctx); diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index 405b14973fe..1104bbcc057 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -336,7 +336,7 @@ destroy(dns_sdlz_db_t *sdlz) { sdlz->common.magic = 0; sdlz->common.impmagic = 0; - (void)isc_mutex_destroy(&sdlz->refcnt_lock); + isc_mutex_destroy(&sdlz->refcnt_lock); dns_name_free(&sdlz->common.origin, mctx); @@ -520,7 +520,7 @@ destroynode(dns_sdlznode_t *node) { dns_name_free(node->name, mctx); isc_mem_put(mctx, node->name, sizeof(dns_name_t)); } - DESTROYLOCK(&node->lock); + isc_mutex_destroy(&node->lock); node->magic = 0; isc_mem_put(mctx, node, sizeof(dns_sdlznode_t)); db = &sdlz->common; @@ -2102,7 +2102,7 @@ dns_sdlzregister(const char *drivername, const dns_sdlzmethods_t *methods, cleanup_mutex: /* destroy the driver lock, we don't need it anymore */ - DESTROYLOCK(&imp->driverlock); + isc_mutex_destroy(&imp->driverlock); /* * return the memory back to the available memory pool and @@ -2132,7 +2132,7 @@ dns_sdlzunregister(dns_sdlzimplementation_t **sdlzimp) { dns_dlzunregister(&imp->dlz_imp); /* destroy the driver lock, we don't need it anymore */ - DESTROYLOCK(&imp->driverlock); + isc_mutex_destroy(&imp->driverlock); mctx = imp->mctx; diff --git a/lib/dns/ssu.c b/lib/dns/ssu.c index 7a6b530670a..9cb79c773c0 100644 --- a/lib/dns/ssu.c +++ b/lib/dns/ssu.c @@ -103,7 +103,7 @@ destroy(dns_ssutable_t *table) { rule->magic = 0; isc_mem_put(mctx, rule, sizeof(dns_ssurule_t)); } - DESTROYLOCK(&table->lock); + isc_mutex_destroy(&table->lock); table->magic = 0; isc_mem_putanddetach(&table->mctx, table, sizeof(dns_ssutable_t)); } diff --git a/lib/dns/stats.c b/lib/dns/stats.c index 4e63d424708..6f0deeb946f 100644 --- a/lib/dns/stats.c +++ b/lib/dns/stats.c @@ -117,7 +117,7 @@ dns_stats_detach(dns_stats_t **statsp) { if (stats->references == 0) { isc_stats_detach(&stats->counters); - DESTROYLOCK(&stats->lock); + isc_mutex_destroy(&stats->lock); isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats)); } } @@ -154,7 +154,7 @@ create_stats(isc_mem_t *mctx, dns_statstype_t type, int ncounters, return (ISC_R_SUCCESS); clean_mutex: - DESTROYLOCK(&stats->lock); + isc_mutex_destroy(&stats->lock); isc_mem_put(mctx, stats, sizeof(*stats)); return (result); diff --git a/lib/dns/validator.c b/lib/dns/validator.c index 1354e0b895f..fe046a3c2bd 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -3810,7 +3810,7 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, return (ISC_R_SUCCESS); cleanup_mutex: - DESTROYLOCK(&val->lock); + isc_mutex_destroy(&val->lock); isc_task_detach(&tclone); isc_event_free(ISC_EVENT_PTR(&event)); @@ -3895,7 +3895,7 @@ destroy(dns_validator_t *val) { mctx = val->view->mctx; if (val->siginfo != NULL) isc_mem_put(mctx, val->siginfo, sizeof(*val->siginfo)); - DESTROYLOCK(&val->lock); + isc_mutex_destroy(&val->lock); dns_view_weakdetach(&val->view); val->magic = 0; isc_mem_put(mctx, val, sizeof(*val)); diff --git a/lib/dns/view.c b/lib/dns/view.c index a568f624ed0..8820a95c6db 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -304,7 +304,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, } cleanup_new_zone_lock: - DESTROYLOCK(&view->new_zone_lock); + isc_mutex_destroy(&view->new_zone_lock); dns_badcache_destroy(&view->failcache); @@ -327,7 +327,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, } cleanup_mutex: - DESTROYLOCK(&view->lock); + isc_mutex_destroy(&view->lock); if (view->nta_file != NULL) { isc_mem_free(mctx, view->nta_file); @@ -546,8 +546,8 @@ destroy(dns_view_t *view) { dns_aclenv_destroy(&view->aclenv); if (view->failcache != NULL) dns_badcache_destroy(&view->failcache); - DESTROYLOCK(&view->new_zone_lock); - DESTROYLOCK(&view->lock); + isc_mutex_destroy(&view->new_zone_lock); + isc_mutex_destroy(&view->lock); isc_mem_free(view->mctx, view->nta_file); isc_mem_free(view->mctx, view->name); isc_mem_putanddetach(&view->mctx, view, sizeof(*view)); diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 5ac43fba53c..4d7b9e21ec0 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -1088,7 +1088,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) { ZONEDB_DESTROYLOCK(&zone->dblock); free_mutex: - DESTROYLOCK(&zone->lock); + isc_mutex_destroy(&zone->lock); isc_mem_putanddetach(&zone->mctx, zone, sizeof(*zone)); return (result); @@ -1253,7 +1253,7 @@ zone_free(dns_zone_t *zone) { /* last stuff */ ZONEDB_DESTROYLOCK(&zone->dblock); - DESTROYLOCK(&zone->lock); + isc_mutex_destroy(&zone->lock); zone->magic = 0; mctx = zone->mctx; isc_mem_put(mctx, zone, sizeof(*zone)); @@ -16194,7 +16194,7 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, #if 0 free_iolock: - DESTROYLOCK(&zmgr->iolock); + isc_mutex_destroy(&zmgr->iolock); #endif free_startupnotifyrl: isc_ratelimiter_detach(&zmgr->startupnotifyrl); @@ -16531,7 +16531,7 @@ zonemgr_free(dns_zonemgr_t *zmgr) { zmgr->magic = 0; - DESTROYLOCK(&zmgr->iolock); + isc_mutex_destroy(&zmgr->iolock); isc_ratelimiter_detach(&zmgr->notifyrl); isc_ratelimiter_detach(&zmgr->refreshrl); isc_ratelimiter_detach(&zmgr->startupnotifyrl); diff --git a/lib/irs/getaddrinfo.c b/lib/irs/getaddrinfo.c index e78b9267f65..2ff54c2c66c 100644 --- a/lib/irs/getaddrinfo.c +++ b/lib/irs/getaddrinfo.c @@ -955,7 +955,7 @@ resolve_name(int family, const char *hostname, int flags, ISC_LIST_INIT(head.resstates); result = make_resstates(mctx, hostname, &head, conf); if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&head.list_lock); + isc_mutex_destroy(&head.list_lock); return (EAI_FAIL); } @@ -1066,7 +1066,7 @@ resolve_name(int family, const char *hostname, int flags, irs_context_destroy(&irsctx); #endif - DESTROYLOCK(&head.list_lock); + isc_mutex_destroy(&head.list_lock); return (error); } diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index 2cdec11f7ca..f6a01a45789 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -309,7 +309,7 @@ isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task, isc_task_detach(&httpdmgr->task); isc_socket_detach(&httpdmgr->sock); isc_mem_detach(&httpdmgr->mctx); - (void)isc_mutex_destroy(&httpdmgr->lock); + isc_mutex_destroy(&httpdmgr->lock); isc_mem_put(mctx, httpdmgr, sizeof(isc_httpdmgr_t)); return (result); } @@ -357,7 +357,7 @@ httpdmgr_destroy(isc_httpdmgr_t *httpdmgr) { } UNLOCK(&httpdmgr->lock); - (void)isc_mutex_destroy(&httpdmgr->lock); + isc_mutex_destroy(&httpdmgr->lock); if (httpdmgr->ondestroy != NULL) (httpdmgr->ondestroy)(httpdmgr->cb_arg); diff --git a/lib/isc/include/isc/mutexblock.h b/lib/isc/include/isc/mutexblock.h index f00088dbc67..e40196991c4 100644 --- a/lib/isc/include/isc/mutexblock.h +++ b/lib/isc/include/isc/mutexblock.h @@ -21,7 +21,7 @@ ISC_LANG_BEGINDECLS -isc_result_t +void isc_mutexblock_init(isc_mutex_t *block, unsigned int count); /*%< * Initialize a block of locks. If an error occurs all initialized locks @@ -33,13 +33,9 @@ isc_mutexblock_init(isc_mutex_t *block, unsigned int count); * *\li count > 0 * - * Returns: - * - *\li Any code isc_mutex_init() can return is a valid return for this - * function. */ -isc_result_t +void isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count); /*%< * Destroy a block of locks. @@ -53,10 +49,6 @@ isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count); *\li Each lock in the block be initialized via isc_mutex_init() or * the whole block was initialized via isc_mutex_initblock(). * - * Returns: - * - *\li Any code isc_mutex_init() can return is a valid return for this - * function. */ ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/queue.h b/lib/isc/include/isc/queue.h index 6f8919da241..43080a81340 100644 --- a/lib/isc/include/isc/queue.h +++ b/lib/isc/include/isc/queue.h @@ -59,8 +59,8 @@ #define ISC_QUEUE_DESTROY(queue) \ do { \ ISC_QLINK_INSIST(ISC_QUEUE_EMPTY(queue)); \ - (void) isc_mutex_destroy(&(queue).taillock); \ - (void) isc_mutex_destroy(&(queue).headlock); \ + isc_mutex_destroy(&(queue).taillock); \ + isc_mutex_destroy(&(queue).headlock); \ } while (0) /* diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index ecd9e8c52ac..c4f6da8ef12 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -106,9 +106,6 @@ ISC_MSG_UNLOCKED, "UNLOCKED"), \ (lp), __FILE__, __LINE__)); \ } while (0) -#define DESTROYLOCK(lp) \ - RUNTIME_CHECK(isc_mutex_destroy((lp)) == ISC_R_SUCCESS) - #define BROADCAST(cvp) do { \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ @@ -171,9 +168,6 @@ RUNTIME_CHECK(isc_rwlock_unlock((lp), (t)) == ISC_R_SUCCESS); \ } while (0) -#define DESTROYMUTEXBLOCK(bp, n) \ - RUNTIME_CHECK(isc_mutexblock_destroy((bp), (n)) == ISC_R_SUCCESS) - /* * List Macros. */ diff --git a/lib/isc/log.c b/lib/isc/log.c index 1626ffcd0ab..c2a98a17131 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -466,7 +466,7 @@ isc_log_destroy(isc_log_t **lctxp) { isc_logconfig_destroy(&lcfg); } - DESTROYLOCK(&lctx->lock); + isc_mutex_destroy(&lctx->lock); while ((message = ISC_LIST_HEAD(lctx->messages)) != NULL) { ISC_LIST_UNLINK(lctx->messages, message, link); diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 2733f618f7d..e9f935ffe35 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -893,7 +893,7 @@ isc_mem_createx(size_t init_max_size, size_t target_size, (ctx->memfree)(ctx->arg, ctx->debuglist); #endif /* ISC_MEM_TRACKLINES */ if ((ctx->flags & ISC_MEMFLAG_NOLOCK) == 0) - DESTROYLOCK(&ctx->lock); + isc_mutex_destroy(&ctx->lock); (memfree)(arg, ctx); } @@ -970,7 +970,7 @@ destroy(isc__mem_t *ctx) { } if ((ctx->flags & ISC_MEMFLAG_NOLOCK) == 0) - DESTROYLOCK(&ctx->lock); + isc_mutex_destroy(&ctx->lock); ctx->malloced -= sizeof(*ctx); if (ctx->checkfree) INSIST(ctx->malloced == 0); diff --git a/lib/isc/mutexblock.c b/lib/isc/mutexblock.c index 9cbd4703180..95d262a8ea1 100644 --- a/lib/isc/mutexblock.c +++ b/lib/isc/mutexblock.c @@ -17,27 +17,20 @@ #include #include -isc_result_t +void isc_mutexblock_init(isc_mutex_t *block, unsigned int count) { unsigned int i; for (i = 0; i < count; i++) { isc_mutex_init(&block[i]); } - - return (ISC_R_SUCCESS); } -isc_result_t +void isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count) { - isc_result_t result; unsigned int i; for (i = 0; i < count; i++) { - result = isc_mutex_destroy(&block[i]); - if (result != ISC_R_SUCCESS) - return (result); + isc_mutex_destroy(&block[i]); } - - return (ISC_R_SUCCESS); } diff --git a/lib/isc/pthreads/include/isc/mutex.h b/lib/isc/pthreads/include/isc/mutex.h index ed9c7c71eee..4f3a4d467ed 100644 --- a/lib/isc/pthreads/include/isc/mutex.h +++ b/lib/isc/pthreads/include/isc/mutex.h @@ -103,12 +103,10 @@ void isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line); #if ISC_MUTEX_PROFILE #define isc_mutex_destroy(mp) \ - ((pthread_mutex_destroy((&(mp)->mutex)) == 0) ? \ - ISC_R_SUCCESS : ISC_R_UNEXPECTED) + (RUNTIME_CHECK(pthread_mutex_destroy((&(mp)->mutex)) == 0)) #else #define isc_mutex_destroy(mp) \ - ((pthread_mutex_destroy((mp)) == 0) ? \ - ISC_R_SUCCESS : ISC_R_UNEXPECTED) + (RUNTIME_CHECK(pthread_mutex_destroy((mp)) == 0)) #endif #if ISC_MUTEX_PROFILE diff --git a/lib/isc/quota.c b/lib/isc/quota.c index c7ab96ede98..803bd4594ce 100644 --- a/lib/isc/quota.c +++ b/lib/isc/quota.c @@ -33,7 +33,7 @@ isc_quota_destroy(isc_quota_t *quota) { quota->max = 0; quota->used = 0; quota->soft = 0; - DESTROYLOCK("a->lock); + isc_mutex_destroy("a->lock); } void diff --git a/lib/isc/ratelimiter.c b/lib/isc/ratelimiter.c index e59301ca728..cd8755a5e9f 100644 --- a/lib/isc/ratelimiter.c +++ b/lib/isc/ratelimiter.c @@ -97,7 +97,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr, return (ISC_R_SUCCESS); free_mutex: - DESTROYLOCK(&rl->lock); + isc_mutex_destroy(&rl->lock); isc_mem_put(mctx, rl, sizeof(*rl)); return (result); } @@ -278,7 +278,7 @@ ratelimiter_shutdowncomplete(isc_task_t *task, isc_event_t *event) { static void ratelimiter_free(isc_ratelimiter_t *rl) { - DESTROYLOCK(&rl->lock); + isc_mutex_destroy(&rl->lock); isc_mem_put(rl->mctx, rl, sizeof(*rl)); } diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index c4e87ed9869..98a835e8610 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -137,7 +137,7 @@ isc_rwlock_destroy(isc_rwlock_t *rwl) { rwl->magic = 0; (void)isc_condition_destroy(&rwl->readable); (void)isc_condition_destroy(&rwl->writeable); - DESTROYLOCK(&rwl->lock); + isc_mutex_destroy(&rwl->lock); } /* diff --git a/lib/isc/stats.c b/lib/isc/stats.c index 9fec2831557..1229e53568f 100644 --- a/lib/isc/stats.c +++ b/lib/isc/stats.c @@ -101,7 +101,7 @@ clean_counters: isc_mem_put(mctx, stats->counters, sizeof(isc_stat_t) * ncounters); clean_mutex: - DESTROYLOCK(&stats->lock); + isc_mutex_destroy(&stats->lock); isc_mem_put(mctx, stats, sizeof(*stats)); return (result); @@ -137,7 +137,7 @@ isc_stats_detach(isc_stats_t **statsp) { isc_mem_put(stats->mctx, stats->counters, sizeof(isc_stat_t) * stats->ncounters); UNLOCK(&stats->lock); - DESTROYLOCK(&stats->lock); + isc_mutex_destroy(&stats->lock); isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats)); return; } diff --git a/lib/isc/task.c b/lib/isc/task.c index 58080541354..ef0d311c629 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -235,7 +235,7 @@ task_finished(isc__task_t *task) { */ wake_all_queues(manager); } - DESTROYLOCK(&task->lock); + isc_mutex_destroy(&task->lock); task->common.impmagic = 0; task->common.magic = 0; isc_mem_put(manager->mctx, task, sizeof(*task)); @@ -288,7 +288,7 @@ isc_task_create(isc_taskmgr_t *manager0, unsigned int quantum, UNLOCK(&manager->lock); if (exiting) { - DESTROYLOCK(&task->lock); + isc_mutex_destroy(&task->lock); isc_mem_put(manager->mctx, task, sizeof(*task)); return (ISC_R_SHUTTINGDOWN); } @@ -1301,10 +1301,10 @@ run(void *queuep) { static void manager_free(isc__taskmgr_t *manager) { for (unsigned int i = 0; i < manager->workers; i++) { - DESTROYLOCK(&manager->queues[i].lock); + isc_mutex_destroy(&manager->queues[i].lock); } - DESTROYLOCK(&manager->lock); - DESTROYLOCK(&manager->halt_lock); + isc_mutex_destroy(&manager->lock); + isc_mutex_destroy(&manager->halt_lock); isc_mem_put(manager->mctx, manager->queues, manager->workers * sizeof(isc__taskqueue_t)); manager->common.impmagic = 0; diff --git a/lib/isc/tests/timer_test.c b/lib/isc/tests/timer_test.c index 7df08db4f43..1415a3fae2d 100644 --- a/lib/isc/tests/timer_test.c +++ b/lib/isc/tests/timer_test.c @@ -136,7 +136,7 @@ setup_test(isc_timertype_t timertype, isc_time_t *expires, UNLOCK(&mx); isc_task_detach(&task); - DESTROYLOCK(&mx); + isc_mutex_destroy(&mx); (void) isc_condition_destroy(&cv); } @@ -558,7 +558,7 @@ purge(void **state) { isc_timer_detach(&oncetimer); isc_task_destroy(&task1); isc_task_destroy(&task2); - DESTROYLOCK(&mx); + isc_mutex_destroy(&mx); } int diff --git a/lib/isc/timer.c b/lib/isc/timer.c index 540bf28ee85..94c55fbb433 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -234,7 +234,7 @@ destroy(isc__timer_t *timer) { UNLOCK(&manager->lock); isc_task_detach(&timer->task); - DESTROYLOCK(&timer->lock); + isc_mutex_destroy(&timer->lock); timer->common.impmagic = 0; timer->common.magic = 0; isc_mem_put(manager->mctx, timer, sizeof(*timer)); @@ -347,7 +347,7 @@ isc_timer_create(isc_timermgr_t *manager0, isc_timertype_t type, if (result != ISC_R_SUCCESS) { timer->common.impmagic = 0; timer->common.magic = 0; - DESTROYLOCK(&timer->lock); + isc_mutex_destroy(&timer->lock); isc_task_detach(&timer->task); isc_mem_put(manager->mctx, timer, sizeof(*timer)); return (result); @@ -745,7 +745,7 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) { ISC_R_SUCCESS) { isc_mem_detach(&manager->mctx); (void)isc_condition_destroy(&manager->wakeup); - DESTROYLOCK(&manager->lock); + isc_mutex_destroy(&manager->lock); isc_heap_destroy(&manager->heap); isc_mem_put(mctx, manager, sizeof(*manager)); UNEXPECTED_ERROR(__FILE__, __LINE__, @@ -807,7 +807,7 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) { * Clean up. */ (void)isc_condition_destroy(&manager->wakeup); - DESTROYLOCK(&manager->lock); + isc_mutex_destroy(&manager->lock); isc_heap_destroy(&manager->heap); manager->common.impmagic = 0; manager->common.magic = 0; diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index 983ce9f2518..c248672ac33 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -568,7 +568,7 @@ isc_app_ctxfinish(isc_appctx_t *ctx0) { REQUIRE(VALID_APPCTX(ctx)); - DESTROYLOCK(&ctx->lock); + isc_mutex_destroy(&ctx->lock); } void diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index f667d497b8a..ff9efe535c7 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -1967,7 +1967,7 @@ free_socket(isc__socket_t **socketp) { sock->common.magic = 0; sock->common.impmagic = 0; - DESTROYLOCK(&sock->lock); + isc_mutex_destroy(&sock->lock); isc_mem_put(sock->manager->mctx, sock, sizeof(*sock)); @@ -3890,7 +3890,7 @@ cleanup_thread(isc_mem_t *mctx, isc__socketthread_t *thread) { if (thread->fdlock != NULL) { for (i = 0; i < FDLOCK_COUNT; i++) { - DESTROYLOCK(&thread->fdlock[i]); + isc_mutex_destroy(&thread->fdlock[i]); } isc_mem_put(thread->manager->mctx, thread->fdlock, FDLOCK_COUNT * sizeof(isc_mutex_t)); @@ -4045,7 +4045,7 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) { if (manager->stats != NULL) { isc_stats_detach(&manager->stats); } - DESTROYLOCK(&manager->lock); + isc_mutex_destroy(&manager->lock); manager->common.magic = 0; manager->common.impmagic = 0; mctx= manager->mctx; diff --git a/lib/isc/win32/app.c b/lib/isc/win32/app.c index e3d4c7b37d7..156c8ff7f8c 100644 --- a/lib/isc/win32/app.c +++ b/lib/isc/win32/app.c @@ -328,7 +328,7 @@ isc_app_ctxfinish(isc_appctx_t *ctx0) { REQUIRE(VALID_APPCTX(ctx)); - DESTROYLOCK(&ctx->lock); + isc_mutex_destroy(&ctx->lock); } void diff --git a/lib/isc/win32/include/isc/mutex.h b/lib/isc/win32/include/isc/mutex.h index 1d49430cd1c..28a08a05bbf 100644 --- a/lib/isc/win32/include/isc/mutex.h +++ b/lib/isc/win32/include/isc/mutex.h @@ -38,7 +38,7 @@ TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); #define isc_mutex_trylock(mp) \ (TryEnterCriticalSection((mp)) ? ISC_R_SUCCESS : ISC_R_LOCKBUSY) #define isc_mutex_destroy(mp) \ - (DeleteCriticalSection((mp)), ISC_R_SUCCESS) + (DeleteCriticalSection((mp))) /* * This is a placeholder for now since we are not keeping any mutex stats diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index 761a1d2abf6..9e5969bbfaa 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -1507,7 +1507,7 @@ free_socket(isc_socket_t **sockp, int lineno) { lineno, sock->fd, &sock->lock, sock->lock.LockSemaphore); sock->magic = 0; - DESTROYLOCK(&sock->lock); + isc_mutex_destroy(&sock->lock); if (sock->recvbuf.base != NULL) isc_mem_put(manager->mctx, sock->recvbuf.base, @@ -2647,7 +2647,7 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) { (void)isc_condition_destroy(&manager->shutdown_ok); - DESTROYLOCK(&manager->lock); + isc_mutex_destroy(&manager->lock); if (manager->stats != NULL) isc_stats_detach(&manager->stats); manager->magic = 0; diff --git a/lib/ns/client.c b/lib/ns/client.c index 83d6342737f..9ae04be7581 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -652,7 +652,7 @@ exit_check(ns_client_t *client) { * Destroy the fetchlock mutex that was created in * ns_query_init(). */ - DESTROYLOCK(&client->query.fetchlock); + isc_mutex_destroy(&client->query.fetchlock); if (client->sctx != NULL) ns_server_detach(&client->sctx); @@ -3394,9 +3394,9 @@ clientmgr_destroy(ns_clientmgr_t *manager) { ISC_QUEUE_DESTROY(manager->inactive); - DESTROYLOCK(&manager->lock); - DESTROYLOCK(&manager->listlock); - DESTROYLOCK(&manager->reclock); + isc_mutex_destroy(&manager->lock); + isc_mutex_destroy(&manager->listlock); + isc_mutex_destroy(&manager->reclock); if (manager->excl != NULL) isc_task_detach(&manager->excl); @@ -3456,9 +3456,9 @@ ns_clientmgr_create(isc_mem_t *mctx, ns_server_t *sctx, isc_taskmgr_t *taskmgr, return (ISC_R_SUCCESS); cleanup_reclock: - (void) isc_mutex_destroy(&manager->reclock); - (void) isc_mutex_destroy(&manager->listlock); - (void) isc_mutex_destroy(&manager->lock); + isc_mutex_destroy(&manager->reclock); + isc_mutex_destroy(&manager->listlock); + isc_mutex_destroy(&manager->lock); isc_mem_put(manager->mctx, manager, sizeof(*manager)); diff --git a/lib/ns/interfacemgr.c b/lib/ns/interfacemgr.c index ae539c245da..865abe7d31a 100644 --- a/lib/ns/interfacemgr.c +++ b/lib/ns/interfacemgr.c @@ -306,7 +306,7 @@ ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) { ns_listenlist_detach(&mgr->listenon4); ns_listenlist_detach(&mgr->listenon6); clearlistenon(mgr); - DESTROYLOCK(&mgr->lock); + isc_mutex_destroy(&mgr->lock); if (mgr->sctx != NULL) ns_server_detach(&mgr->sctx); if (mgr->excl != NULL) @@ -443,7 +443,7 @@ ns_interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, return (ISC_R_SUCCESS); clientmgr_create_failure: - DESTROYLOCK(&ifp->lock); + isc_mutex_destroy(&ifp->lock); ifp->magic = 0; isc_mem_put(mgr->mctx, ifp, sizeof(*ifp)); @@ -656,7 +656,7 @@ ns_interface_destroy(ns_interface_t *ifp) { if (ifp->tcpsocket != NULL) isc_socket_detach(&ifp->tcpsocket); - DESTROYLOCK(&ifp->lock); + isc_mutex_destroy(&ifp->lock); ns_interfacemgr_detach(&ifp->mgr); diff --git a/lib/ns/query.c b/lib/ns/query.c index b649254caa8..64a38e45621 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -949,13 +949,13 @@ ns_query_init(ns_client_t *client) { query_reset(client, false); result = query_newdbversion(client, 3); if (result != ISC_R_SUCCESS) { - DESTROYLOCK(&client->query.fetchlock); + isc_mutex_destroy(&client->query.fetchlock); return (result); } result = query_newnamebuf(client); if (result != ISC_R_SUCCESS) { query_freefreeversions(client, true); - DESTROYLOCK(&client->query.fetchlock); + isc_mutex_destroy(&client->query.fetchlock); } return (result); diff --git a/lib/ns/stats.c b/lib/ns/stats.c index 0555fc32029..d34ce9bd888 100644 --- a/lib/ns/stats.c +++ b/lib/ns/stats.c @@ -61,7 +61,7 @@ ns_stats_detach(ns_stats_t **statsp) { if (stats->references == 0) { isc_stats_detach(&stats->counters); - DESTROYLOCK(&stats->lock); + isc_mutex_destroy(&stats->lock); isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats)); } } @@ -94,7 +94,7 @@ ns_stats_create(isc_mem_t *mctx, int ncounters, ns_stats_t **statsp) { return (ISC_R_SUCCESS); clean_mutex: - DESTROYLOCK(&stats->lock); + isc_mutex_destroy(&stats->lock); isc_mem_put(mctx, stats, sizeof(*stats)); return (result);