isc_mem_attach(mctx, &sampledb->common.mctx);
dns_name_init(&sampledb->common.origin, NULL);
- isc_ondestroy_init(&sampledb->common.ondest);
sampledb->common.magic = DNS_DB_MAGIC;
sampledb->common.impmagic = SAMPLEDB_MAGIC;
ENSURE(*dbp == NULL);
}
-isc_result_t
-dns_db_ondestroy(dns_db_t *db, isc_task_t *task, isc_event_t **eventp)
-{
- REQUIRE(DNS_DB_VALID(db));
-
- return (isc_ondestroy_register(&db->ondest, task, eventp));
-}
-
isc_boolean_t
dns_db_iscache(dns_db_t *db) {
#include <isc/deprecated.h>
#include <isc/lang.h>
#include <isc/magic.h>
-#include <isc/ondestroy.h>
#include <isc/stats.h>
#include <isc/stdtime.h>
isc_uint16_t attributes;
dns_rdataclass_t rdclass;
dns_name_t origin;
- isc_ondestroy_t ondest;
isc_mem_t * mctx;
ISC_LIST(dns_dbonupdatelistener_t) update_listeners;
};
* all resources used by the database will be freed
*/
-isc_result_t
-dns_db_ondestroy(dns_db_t *db, isc_task_t *task, isc_event_t **eventp);
-/*%<
- * Causes 'eventp' to be sent to be sent to 'task' when the database is
- * destroyed.
- *
- * Note; ownership of the eventp is taken from the caller (and *eventp is
- * set to NULL). The sender field of the event is set to 'db' before it is
- * sent to the task.
- */
-
isc_boolean_t
dns_db_iscache(dns_db_t *db);
/*%<
#include <isc/lang.h>
#include <isc/magic.h>
-#include <isc/ondestroy.h>
#include <isc/stdtime.h>
#include <dns/db.h>
static void
free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event) {
unsigned int i;
- isc_ondestroy_t ondest;
isc_result_t result;
char buf[DNS_NAME_FORMATSIZE];
dns_rbt_t **treep;
RBTDB_DESTROYLOCK(&rbtdb->lock);
rbtdb->common.magic = 0;
rbtdb->common.impmagic = 0;
- ondest = rbtdb->common.ondest;
isc_mem_detach(&rbtdb->hmctx);
if (rbtdb->mmap_location != NULL)
}
isc_mem_putanddetach(&rbtdb->common.mctx, rbtdb, sizeof(*rbtdb));
- isc_ondestroy_notify(&ondest, rbtdb);
}
static inline void
isc_mem_attach(mctx, &rbtdb->common.mctx);
isc_mem_attach(hmctx, &rbtdb->hmctx);
- /*
- * Must be initialized before free_rbtdb() is called.
- */
- isc_ondestroy_init(&rbtdb->common.ondest);
-
/*
* Make a copy of the origin name.
*/
dns_db_newversion
dns_db_nodecount
dns_db_nodefullname
-dns_db_ondestroy
dns_db_origin
dns_db_overmem
dns_db_printnode
static void zone_viewname_tostr(dns_zone_t *zone, char *buf, size_t length);
static isc_result_t zone_send_secureserial(dns_zone_t *zone,
isc_uint32_t serial);
-
-#if 0
-/* ondestroy example */
-static void dns_zonemgr_dbdestroyed(isc_task_t *task, isc_event_t *event);
-#endif
-
static void refresh_callback(isc_task_t *, isc_event_t *);
static void stub_callback(isc_task_t *, isc_event_t *);
static void queue_soa_query(dns_zone_t *zone);
DNS_ZONEKEY_OPTION(zone, DNS_ZONEKEY_MAINTAIN))
zone->refreshkeytime = now;
-#if 0
- /* destroy notification example. */
- {
- isc_event_t *e = isc_event_allocate(zone->mctx, NULL,
- DNS_EVENT_DBDESTROYED,
- dns_zonemgr_dbdestroyed,
- zone,
- sizeof(isc_event_t));
- dns_db_ondestroy(db, zone->task, &e);
- }
-#endif
-
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_write);
if (zone->db != NULL) {
result = zone_replacedb(zone, db, ISC_FALSE);
isc_mem_put(zone->mctx, buf, buflen);
}
-#if 0
-/* Hook for ondestroy notification from a database. */
-
-static void
-dns_zonemgr_dbdestroyed(isc_task_t *task, isc_event_t *event) {
- dns_db_t *db = event->sender;
- UNUSED(task);
-
- isc_event_free(&event);
-
- isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
- DNS_LOGMODULE_ZONE, ISC_LOG_DEBUG(3),
- "database (%p) destroyed", (void*) db);
-}
-#endif
-
static void
setrl(isc_ratelimiter_t *rl, unsigned int *rate, unsigned int value) {
isc_interval_t interval;
hmacsha.@O@ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \
lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \
md5.@O@ mem.@O@ mutexblock.@O@ \
- netaddr.@O@ netscope.@O@ pool.@O@ ondestroy.@O@ \
+ netaddr.@O@ netscope.@O@ pool.@O@ \
parseint.@O@ portset.@O@ quota.@O@ radix.@O@ random.@O@ \
ratelimiter.@O@ refcount.@O@ region.@O@ regex.@O@ result.@O@ \
rwlock.@O@ \
hmacsha.c httpd.c inet_aton.c iterated_hash.c \
lex.c lfsr.c lib.c log.c \
md5.c mem.c mutexblock.c \
- netaddr.c netscope.c pool.c ondestroy.c \
+ netaddr.c netscope.c pool.c \
parseint.c portset.c quota.c radix.c random.c ${CHACHASRCS} \
ratelimiter.c refcount.c region.c regex.c result.c rwlock.c \
safe.c serial.c sha1.c sha2.c sockaddr.c stats.c string.c \
interfaceiter.h @ISC_IPV6_H@ iterated_hash.h \
json.h lang.h lex.h lfsr.h lib.h likely.h list.h log.h \
magic.h md5.h mem.h meminfo.h msgcat.h msgs.h mutexblock.h \
- netaddr.h netscope.h ondestroy.h os.h parseint.h \
+ netaddr.h netscope.h os.h parseint.h \
pool.h portset.h print.h queue.h quota.h \
radix.h random.h ratelimiter.h refcount.h regex.h \
region.h resource.h result.h resultclass.h rwlock.h \
* Destroy a memory context.
*/
-isc_result_t
-isc_mem_ondestroy(isc_mem_t *ctx,
- isc_task_t *task,
- isc_event_t **event);
-/*%<
- * Request to be notified with an event when a memory context has
- * been successfully destroyed.
- */
-
void
isc_mem_stats(isc_mem_t *mctx, FILE *out);
/*%<
+++ /dev/null
-/*
- * Copyright (C) 2000, 2001, 2004-2007, 2016 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 http://mozilla.org/MPL/2.0/.
- */
-
-/* $Id: ondestroy.h,v 1.14 2007/06/19 23:47:18 tbox Exp $ */
-
-#ifndef ISC_ONDESTROY_H
-#define ISC_ONDESTROY_H 1
-
-#include <isc/lang.h>
-#include <isc/types.h>
-
-ISC_LANG_BEGINDECLS
-
-/*! \file isc/ondestroy.h
- * ondestroy handling.
- *
- * Any class ``X'' of objects that wants to send out notifications
- * on its destruction should declare a field of type isc_ondestroy_t
- * (call it 'ondest').
- *
- * \code
- * typedef struct {
- * ...
- * isc_ondestroy_t ondest;
- * ...
- * } X;
- * \endcode
- *
- * When an object ``A'' of type X is created
- * it must initialize the field ondest with a call to
- *
- * \code
- * isc_ondestroy_init(&A->ondest).
- * \endcode
- *
- * X should also provide a registration function for third-party
- * objects to call to register their interest in being told about
- * the destruction of a particular instance of X.
- *
- * \code
- * isc_result_t
- * X_ondestroy(X *instance, isc_task_t *task,
- * isc_event_t **eventp) {
- * return(isc_ondestroy_register(&instance->ondest, task,eventp));
- * }
- * \endcode
- *
- * Note: locking of the ondestory structure embedded inside of X, is
- * X's responsibility.
- *
- * When an instance of X is destroyed, a call to isc_ondestroy_notify()
- * sends the notifications:
- *
- * \code
- * X *instance;
- * isc_ondestroy_t ondest = instance->ondest;
- *
- * ... completely cleanup 'instance' here...
- *
- * isc_ondestroy_notify(&ondest, instance);
- * \endcode
- *
- *
- * see lib/dns/zone.c for an ifdef'd-out example.
- */
-
-struct isc_ondestroy {
- unsigned int magic;
- isc_eventlist_t events;
-};
-
-void
-isc_ondestroy_init(isc_ondestroy_t *ondest);
-/*%<
- * Initialize the on ondest structure. *must* be called before first call
- * to isc_ondestroy_register().
- */
-
-isc_result_t
-isc_ondestroy_register(isc_ondestroy_t *ondest, isc_task_t *task,
- isc_event_t **eventp);
-
-/*%<
- * Stores task and *eventp away inside *ondest. Ownership of **event is
- * taken from the caller (and *eventp is set to NULL). The task is attached
- * to.
- */
-
-void
-isc_ondestroy_notify(isc_ondestroy_t *ondest, void *sender);
-/*%<
- * Dispatches the event(s) to the task(s) that were given in
- * isc_ondestroy_register call(s) (done via calls to
- * isc_task_sendanddetach()). Before dispatch, the sender value of each
- * event structure is set to the value of the sender paramater. The
- * internal structures of the ondest parameter are cleaned out, so no other
- * cleanup is needed.
- */
-
-ISC_LANG_ENDDECLS
-
-#endif /* ISC_ONDESTROY_H */
typedef struct isc_mem isc_mem_t; /*%< Memory */
typedef struct isc_mempool isc_mempool_t; /*%< Memory Pool */
typedef struct isc_msgcat isc_msgcat_t; /*%< Message Catalog */
-typedef struct isc_ondestroy isc_ondestroy_t; /*%< On Destroy */
typedef struct isc_netaddr isc_netaddr_t; /*%< Net Address */
typedef struct isc_portset isc_portset_t; /*%< Port Set */
typedef struct isc_quota isc_quota_t; /*%< Quota */
#include <isc/mem.h>
#include <isc/msgs.h>
#include <isc/once.h>
-#include <isc/ondestroy.h>
#include <isc/string.h>
#include <isc/mutex.h>
#include <isc/print.h>
struct isc__mem {
isc_mem_t common;
- isc_ondestroy_t ondestroy;
unsigned int flags;
isc_mutex_t lock;
isc_memalloc_t memalloc;
isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG);
void
isc__mem_destroy(isc_mem_t **ctxp);
-isc_result_t
-isc__mem_ondestroy(isc_mem_t *ctx, isc_task_t *task, isc_event_t **event);
void *
isc___mem_get(isc_mem_t *ctx, size_t size FLARG);
void
/*%
* The following are defined just for avoiding unused static functions.
*/
- void *createx, *create, *create2, *ondestroy, *stats,
+ void *createx, *create, *create2, *stats,
*setquota, *getquota, *setname, *getname, *gettag;
} memmethods = {
{
(void *)isc_mem_createx,
(void *)isc_mem_create,
(void *)isc_mem_create2,
- (void *)isc_mem_ondestroy,
(void *)isc_mem_stats,
(void *)isc_mem_setquota,
(void *)isc_mem_getquota,
ctx->common.impmagic = MEM_MAGIC;
ctx->common.magic = ISCAPI_MCTX_MAGIC;
ctx->common.methods = (isc_memmethods_t *)&memmethods;
- isc_ondestroy_init(&ctx->ondestroy);
ctx->memalloc = memalloc;
ctx->memfree = memfree;
ctx->arg = arg;
static void
destroy(isc__mem_t *ctx) {
unsigned int i;
- isc_ondestroy_t ondest;
LOCK(&contextslock);
ISC_LIST_UNLINK(contexts, ctx, link);
}
}
- ondest = ctx->ondestroy;
-
if ((ctx->flags & ISC_MEMFLAG_NOLOCK) == 0)
DESTROYLOCK(&ctx->lock);
ctx->malloced -= sizeof(*ctx);
if (ctx->checkfree)
INSIST(ctx->malloced == 0);
(ctx->memfree)(ctx->arg, ctx);
-
- isc_ondestroy_notify(&ondest, ctx);
}
void
*ctxp = NULL;
}
-isc_result_t
-isc_mem_ondestroy(isc_mem_t *ctx0, isc_task_t *task, isc_event_t **event) {
- isc__mem_t *ctx = (isc__mem_t *)ctx0;
- isc_result_t res;
-
- MCTXLOCK(ctx, &ctx->lock);
- res = isc_ondestroy_register(&ctx->ondestroy, task, event);
- MCTXUNLOCK(ctx, &ctx->lock);
-
- return (res);
-}
-
void *
isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) {
isc__mem_t *ctx = (isc__mem_t *)ctx0;
+++ /dev/null
-/*
- * Copyright (C) 2000, 2001, 2004, 2005, 2007, 2016 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 http://mozilla.org/MPL/2.0/.
- */
-
-/* $Id: ondestroy.c,v 1.16 2007/06/19 23:47:17 tbox Exp $ */
-
-/*! \file */
-
-#include <config.h>
-
-#include <stddef.h>
-
-#include <isc/event.h>
-#include <isc/magic.h>
-#include <isc/ondestroy.h>
-#include <isc/task.h>
-#include <isc/util.h>
-
-#define ONDESTROY_MAGIC ISC_MAGIC('D', 'e', 'S', 't')
-#define VALID_ONDESTROY(s) ISC_MAGIC_VALID(s, ONDESTROY_MAGIC)
-
-void
-isc_ondestroy_init(isc_ondestroy_t *ondest) {
- ondest->magic = ONDESTROY_MAGIC;
- ISC_LIST_INIT(ondest->events);
-}
-
-isc_result_t
-isc_ondestroy_register(isc_ondestroy_t *ondest, isc_task_t *task,
- isc_event_t **eventp)
-{
- isc_event_t *theevent;
- isc_task_t *thetask = NULL;
-
- REQUIRE(VALID_ONDESTROY(ondest));
- REQUIRE(task != NULL);
- REQUIRE(eventp != NULL);
-
- theevent = *eventp;
-
- REQUIRE(theevent != NULL);
-
- isc_task_attach(task, &thetask);
-
- theevent->ev_sender = thetask;
-
- ISC_LIST_APPEND(ondest->events, theevent, ev_link);
-
- return (ISC_R_SUCCESS);
-}
-
-void
-isc_ondestroy_notify(isc_ondestroy_t *ondest, void *sender) {
- isc_event_t *eventp;
- isc_task_t *task;
-
- REQUIRE(VALID_ONDESTROY(ondest));
-
- eventp = ISC_LIST_HEAD(ondest->events);
- while (eventp != NULL) {
- ISC_LIST_UNLINK(ondest->events, eventp, ev_link);
-
- task = eventp->ev_sender;
- eventp->ev_sender = sender;
-
- isc_task_sendanddetach(&task, &eventp);
-
- eventp = ISC_LIST_HEAD(ondest->events);
- }
-}
-
-
isc_mem_inuse
isc_mem_isovermem
isc_mem_maxinuse
-isc_mem_ondestroy
isc_mem_printallactive
isc_mem_references
isc_mem_register
isc_ntpaths_get
isc_ntpaths_init
isc_once_do
-isc_ondestroy_init
-isc_ondestroy_notify
-isc_ondestroy_register
isc_os_ncpus
isc_parse_uint16
isc_parse_uint32
<ClInclude Include="..\include\isc\netscope.h">
<Filter>Library Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\include\isc\ondestroy.h">
- <Filter>Library Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\include\isc\os.h">
<Filter>Library Header Files</Filter>
</ClInclude>
<ClCompile Include="..\netscope.c">
<Filter>Library Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\ondestroy.c">
- <Filter>Library Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\parseint.c">
<Filter>Library Source Files</Filter>
</ClCompile>
<ClInclude Include="..\include\isc\mutexblock.h" />
<ClInclude Include="..\include\isc\netaddr.h" />
<ClInclude Include="..\include\isc\netscope.h" />
- <ClInclude Include="..\include\isc\ondestroy.h" />
<ClInclude Include="..\include\isc\os.h" />
<ClInclude Include="..\include\isc\parseint.h" />
<ClInclude Include="..\include\isc\pool.h" />
<ClCompile Include="..\netaddr.c" />
<ClCompile Include="..\netscope.c" />
<ClCompile Include="..\nls\msgcat.c" />
- <ClCompile Include="..\ondestroy.c" />
<ClCompile Include="..\parseint.c" />
<ClCompile Include="..\pool.c" />
<ClCompile Include="..\portset.c" />
./lib/isc/include/isc/mutexblock.h C 1999,2000,2001,2004,2005,2006,2007,2016
./lib/isc/include/isc/netaddr.h C 1998,1999,2000,2001,2002,2004,2005,2006,2007,2009,2015,2016,2017
./lib/isc/include/isc/netscope.h C 2002,2004,2005,2006,2007,2009,2016
-./lib/isc/include/isc/ondestroy.h C 2000,2001,2004,2005,2006,2007,2016
./lib/isc/include/isc/os.h C 2000,2001,2004,2005,2006,2007,2016
./lib/isc/include/isc/parseint.h C 2001,2002,2004,2005,2006,2007,2016
./lib/isc/include/isc/platform.h.in C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2013,2014,2015,2016,2017
./lib/isc/nothreads/include/isc/thread.h C 2000,2001,2004,2007,2013,2016,2017
./lib/isc/nothreads/mutex.c C 2000,2001,2004,2006,2007,2016
./lib/isc/nothreads/thread.c C 2000,2001,2004,2007,2016,2017
-./lib/isc/ondestroy.c C 2000,2001,2004,2005,2007,2016
./lib/isc/parseint.c C 2001,2002,2003,2004,2005,2007,2012,2016
./lib/isc/pk11.c C 2014,2015,2016,2017
./lib/isc/pk11_result.c C 2014,2015,2016