1*bcda20f6Schristos /* $NetBSD: lib.c,v 1.12 2025/01/26 16:25:37 christos Exp $ */ 2d68c78b8Schristos 3d68c78b8Schristos /* 4d68c78b8Schristos * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5d68c78b8Schristos * 68596601aSchristos * SPDX-License-Identifier: MPL-2.0 78596601aSchristos * 8d68c78b8Schristos * This Source Code Form is subject to the terms of the Mozilla Public 9d68c78b8Schristos * License, v. 2.0. If a copy of the MPL was not distributed with this 10fce770bdSchristos * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11d68c78b8Schristos * 12d68c78b8Schristos * See the COPYRIGHT file distributed with this work for additional 13d68c78b8Schristos * information regarding copyright ownership. 14d68c78b8Schristos */ 15d68c78b8Schristos 16d68c78b8Schristos /*! \file */ 17d68c78b8Schristos 18*bcda20f6Schristos #include <isc/hash.h> 19*bcda20f6Schristos #include <isc/iterated_hash.h> 20*bcda20f6Schristos #include <isc/md.h> 2199a1c298Schristos #include <isc/mem.h> 22bb5aa156Schristos #include <isc/os.h> 23bb5aa156Schristos #include <isc/tls.h> 24*bcda20f6Schristos #include <isc/urcu.h> 2599a1c298Schristos #include <isc/util.h> 26*bcda20f6Schristos #include <isc/uv.h> 27*bcda20f6Schristos #include <isc/xml.h> 2899a1c298Schristos 2999a1c298Schristos #include "config.h" 3099a1c298Schristos #include "mem_p.h" 31*bcda20f6Schristos #include "mutex_p.h" 32bb5aa156Schristos #include "os_p.h" 3399a1c298Schristos 3499a1c298Schristos #ifndef ISC_CONSTRUCTOR 3599a1c298Schristos #error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9. 3699a1c298Schristos #endif 37d68c78b8Schristos 38d68c78b8Schristos /*** 39d68c78b8Schristos *** Functions 40d68c78b8Schristos ***/ 41d68c78b8Schristos 42d68c78b8Schristos void 4309f4e0c3Schristos isc__initialize(void) ISC_CONSTRUCTOR; 4499a1c298Schristos void 4509f4e0c3Schristos isc__shutdown(void) ISC_DESTRUCTOR; 4699a1c298Schristos 4799a1c298Schristos void 4899a1c298Schristos isc__initialize(void) { 49bb5aa156Schristos isc__os_initialize(); 50*bcda20f6Schristos isc__mutex_initialize(); 5199a1c298Schristos isc__mem_initialize(); 5299a1c298Schristos isc__tls_initialize(); 53*bcda20f6Schristos isc__uv_initialize(); 54*bcda20f6Schristos isc__xml_initialize(); 55*bcda20f6Schristos isc__md_initialize(); 56*bcda20f6Schristos isc__hash_initialize(); 57*bcda20f6Schristos isc__iterated_hash_initialize(); 58bb5aa156Schristos (void)isc_os_ncpus(); 59*bcda20f6Schristos rcu_register_thread(); 6099a1c298Schristos } 6199a1c298Schristos 6299a1c298Schristos void 6399a1c298Schristos isc__shutdown(void) { 64*bcda20f6Schristos isc__iterated_hash_shutdown(); 65*bcda20f6Schristos isc__md_shutdown(); 66*bcda20f6Schristos isc__xml_shutdown(); 67*bcda20f6Schristos isc__uv_shutdown(); 6899a1c298Schristos isc__tls_shutdown(); 6999a1c298Schristos isc__mem_shutdown(); 70*bcda20f6Schristos isc__mutex_shutdown(); 71bb5aa156Schristos isc__os_shutdown(); 72*bcda20f6Schristos /* should be after isc__mem_shutdown() which calls rcu_barrier() */ 73*bcda20f6Schristos rcu_unregister_thread(); 7499a1c298Schristos } 75