xref: /netbsd-src/external/mpl/bind/dist/lib/isc/lib.c (revision f8cf1a9151c7af1cb0bd8b09c13c66bca599c027)
1 /*	$NetBSD: lib.c,v 1.11 2024/02/21 22:52:28 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 /*! \file */
17 
18 #include <isc/mem.h>
19 #include <isc/os.h>
20 #include <isc/tls.h>
21 #include <isc/util.h>
22 
23 #include "config.h"
24 #include "mem_p.h"
25 #include "os_p.h"
26 #include "tls_p.h"
27 #include "trampoline_p.h"
28 
29 #ifndef ISC_CONSTRUCTOR
30 #error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
31 #endif
32 
33 /***
34  *** Functions
35  ***/
36 
37 void
38 isc__initialize(void) ISC_CONSTRUCTOR;
39 void
40 isc__shutdown(void) ISC_DESTRUCTOR;
41 
42 void
43 isc__initialize(void) {
44 	isc__os_initialize();
45 	isc__mem_initialize();
46 	isc__tls_initialize();
47 	isc__trampoline_initialize();
48 	(void)isc_os_ncpus();
49 }
50 
51 void
52 isc__shutdown(void) {
53 	isc__trampoline_shutdown();
54 	isc__tls_shutdown();
55 	isc__mem_shutdown();
56 	isc__os_shutdown();
57 }
58