Home | History | Annotate | Line # | Download | only in isc
lib.c revision 1.1.1.6
      1 /*	$NetBSD: lib.c,v 1.1.1.6 2021/04/29 16:46:32 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      5  *
      6  * This Source Code Form is subject to the terms of the Mozilla Public
      7  * License, v. 2.0. If a copy of the MPL was not distributed with this
      8  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
      9  *
     10  * See the COPYRIGHT file distributed with this work for additional
     11  * information regarding copyright ownership.
     12  */
     13 
     14 /*! \file */
     15 
     16 #include <isc/bind9.h>
     17 #include <isc/lib.h>
     18 #include <isc/mem.h>
     19 #include <isc/tls.h>
     20 #include <isc/util.h>
     21 
     22 #include "config.h"
     23 #include "mem_p.h"
     24 #include "tls_p.h"
     25 #include "trampoline_p.h"
     26 
     27 #ifndef ISC_CONSTRUCTOR
     28 #error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
     29 #endif
     30 
     31 /***
     32  *** Functions
     33  ***/
     34 
     35 void
     36 isc_lib_register(void) {
     37 	isc_bind9 = false;
     38 }
     39 
     40 void
     41 isc__initialize(void) ISC_CONSTRUCTOR(101);
     42 void
     43 isc__shutdown(void) ISC_DESTRUCTOR(101);
     44 
     45 void
     46 isc__initialize(void) {
     47 	isc__mem_initialize();
     48 	isc__tls_initialize();
     49 	isc__trampoline_initialize();
     50 }
     51 
     52 void
     53 isc__shutdown(void) {
     54 	isc__trampoline_shutdown();
     55 	isc__tls_shutdown();
     56 	isc__mem_shutdown();
     57 }
     58 
     59 /*
     60  * This is a workaround for situation when libisc is statically linked.  Under
     61  * normal situation, the linker throws out all symbols from compilation unit
     62  * when no symbols are used in the final binary.  This empty function must be
     63  * called at least once from different compilation unit (mem.c in this case).
     64  */
     65 void
     66 isc_enable_constructors() {
     67 	/* do nothing */
     68 }
     69