mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
Remove libns init/shutdown functions
as libraries are no longer exported, these functions served no useful purpose.
This commit is contained in:
@@ -12,7 +12,6 @@ libns_la_HEADERS = \
|
|||||||
include/ns/events.h \
|
include/ns/events.h \
|
||||||
include/ns/hooks.h \
|
include/ns/hooks.h \
|
||||||
include/ns/interfacemgr.h \
|
include/ns/interfacemgr.h \
|
||||||
include/ns/lib.h \
|
|
||||||
include/ns/listenlist.h \
|
include/ns/listenlist.h \
|
||||||
include/ns/log.h \
|
include/ns/log.h \
|
||||||
include/ns/notify.h \
|
include/ns/notify.h \
|
||||||
@@ -29,7 +28,6 @@ libns_la_SOURCES = \
|
|||||||
client.c \
|
client.c \
|
||||||
hooks.c \
|
hooks.c \
|
||||||
interfacemgr.c \
|
interfacemgr.c \
|
||||||
lib.c \
|
|
||||||
listenlist.c \
|
listenlist.c \
|
||||||
log.c \
|
log.c \
|
||||||
notify.c \
|
notify.c \
|
||||||
|
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* See the COPYRIGHT file distributed with this work for additional
|
|
||||||
* information regarding copyright ownership.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/*! \file include/ns/lib.h */
|
|
||||||
|
|
||||||
#include <isc/lang.h>
|
|
||||||
#include <isc/types.h>
|
|
||||||
|
|
||||||
ISC_LANG_BEGINDECLS
|
|
||||||
|
|
||||||
extern unsigned int ns_pps;
|
|
||||||
|
|
||||||
isc_result_t
|
|
||||||
ns_lib_init(void);
|
|
||||||
/*%<
|
|
||||||
* A set of initialization procedures used in the NS library.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
ns_lib_shutdown(void);
|
|
||||||
/*%<
|
|
||||||
* Free temporary resources allocated in ns_lib_init().
|
|
||||||
*/
|
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
|
84
lib/ns/lib.c
84
lib/ns/lib.c
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* See the COPYRIGHT file distributed with this work for additional
|
|
||||||
* information regarding copyright ownership.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \file */
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include <isc/mem.h>
|
|
||||||
#include <isc/mutex.h>
|
|
||||||
#include <isc/once.h>
|
|
||||||
#include <isc/refcount.h>
|
|
||||||
#include <isc/util.h>
|
|
||||||
|
|
||||||
#include <dns/name.h>
|
|
||||||
|
|
||||||
#include <ns/lib.h>
|
|
||||||
|
|
||||||
/***
|
|
||||||
*** Globals
|
|
||||||
***/
|
|
||||||
|
|
||||||
unsigned int ns_pps = 0U;
|
|
||||||
|
|
||||||
/***
|
|
||||||
*** Private
|
|
||||||
***/
|
|
||||||
|
|
||||||
static isc_once_t init_once = ISC_ONCE_INIT;
|
|
||||||
static isc_mem_t *ns_g_mctx = NULL;
|
|
||||||
static bool initialize_done = false;
|
|
||||||
static isc_refcount_t references;
|
|
||||||
|
|
||||||
static void
|
|
||||||
initialize(void) {
|
|
||||||
REQUIRE(!initialize_done);
|
|
||||||
|
|
||||||
isc_mem_create(&ns_g_mctx);
|
|
||||||
|
|
||||||
isc_refcount_init(&references, 0);
|
|
||||||
initialize_done = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_result_t
|
|
||||||
ns_lib_init(void) {
|
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Since this routine is expected to be used by a normal application,
|
|
||||||
* it should be better to return an error, instead of an emergency
|
|
||||||
* abort, on any failure.
|
|
||||||
*/
|
|
||||||
result = isc_once_do(&init_once, initialize);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!initialize_done) {
|
|
||||||
return (ISC_R_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_refcount_increment0(&references);
|
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ns_lib_shutdown(void) {
|
|
||||||
if (isc_refcount_decrement(&references) == 1) {
|
|
||||||
isc_refcount_destroy(&references);
|
|
||||||
if (ns_g_mctx != NULL) {
|
|
||||||
isc_mem_detach(&ns_g_mctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1862,7 +1862,6 @@
|
|||||||
./lib/ns/include/ns/events.h C 2020,2021
|
./lib/ns/include/ns/events.h C 2020,2021
|
||||||
./lib/ns/include/ns/hooks.h C 2017,2018,2019,2020,2021
|
./lib/ns/include/ns/hooks.h C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/include/ns/interfacemgr.h C 2017,2018,2019,2020,2021
|
./lib/ns/include/ns/interfacemgr.h C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/include/ns/lib.h C 2017,2018,2019,2020,2021
|
|
||||||
./lib/ns/include/ns/listenlist.h C 2017,2018,2019,2020,2021
|
./lib/ns/include/ns/listenlist.h C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/include/ns/log.h C 2017,2018,2019,2020,2021
|
./lib/ns/include/ns/log.h C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/include/ns/notify.h C 2017,2018,2019,2020,2021
|
./lib/ns/include/ns/notify.h C 2017,2018,2019,2020,2021
|
||||||
@@ -1874,7 +1873,6 @@
|
|||||||
./lib/ns/include/ns/update.h C 2017,2018,2019,2020,2021
|
./lib/ns/include/ns/update.h C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/include/ns/xfrout.h C 2017,2018,2019,2020,2021
|
./lib/ns/include/ns/xfrout.h C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/interfacemgr.c C 2017,2018,2019,2020,2021
|
./lib/ns/interfacemgr.c C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/lib.c C 2017,2018,2019,2020,2021
|
|
||||||
./lib/ns/listenlist.c C 2017,2018,2019,2020,2021
|
./lib/ns/listenlist.c C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/log.c C 2017,2018,2019,2020,2021
|
./lib/ns/log.c C 2017,2018,2019,2020,2021
|
||||||
./lib/ns/notify.c C 2017,2018,2019,2020,2021
|
./lib/ns/notify.c C 2017,2018,2019,2020,2021
|
||||||
|
Reference in New Issue
Block a user