#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/tls.h>
#include <isc/util.h>
/* Managers */
static isc_nm_t *netmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
-static isc_taskmgr_t *taskmgr = NULL;
/* TLS */
static isc_tlsctx_cache_t *tlsctx_client_cache = NULL;
argc--;
argv++;
- isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
dst_lib_destroy();
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
}
#include <isc/parseint.h>
#include <isc/result.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/time.h>
#include <isc/util.h>
#include <isc/serial.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/tls.h>
#include <isc/types.h>
isc_mem_t *mctx = NULL;
isc_log_t *lctx = NULL;
isc_nm_t *netmgr = NULL;
-isc_taskmgr_t *taskmgr = NULL;
isc_loopmgr_t *loopmgr = NULL;
isc_loop_t *mainloop = NULL;
isc_sockaddr_t localaddr;
fatal("can't find either v4 or v6 networking");
}
- isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
isc_log_create(mctx, &lctx, &logconfig);
isc_log_setcontext(lctx);
isc_mem_stats(mctx, stderr);
}
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
extern unsigned int digestbits;
extern dns_tsigkey_t *tsigkey;
extern bool validated;
-extern isc_taskmgr_t *taskmgr;
extern isc_loopmgr_t *loopmgr;
extern isc_loop_t *mainloop;
extern bool free_now;
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/byaddr.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/condition.h>
-#include <isc/event.h>
#include <isc/job.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <isc/work.h>
#include <isc/base32.h>
#include <isc/commandline.h>
#include <isc/dir.h>
-#include <isc/event.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/serial.h>
#include <isc/stdio.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/tid.h>
#include <isc/time.h>
#include <isc/util.h>
static isc_mutex_t namelock, statslock;
static isc_nm_t *netmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
-static isc_taskmgr_t *taskmgr = NULL;
static dns_db_t *gdb; /* The database */
static dns_dbversion_t *gversion; /* The database version */
static dns_dbiterator_t *gdbiter; /* The database iterator */
directory = ".";
}
- isc_managers_create(&mctx, nloops, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, nloops, &loopmgr, &netmgr);
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
isc_mem_stats(mctx, stdout);
}
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
if (printstats) {
TIME_NOW(&timer_finish);
#include <isc/attributes.h>
#include <isc/base32.h>
#include <isc/commandline.h>
-#include <isc/event.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
background-color: #99ddff;
}
- table.tasks {
- border: 1px solid grey;
- width: 500px;
- }
- table.tasks th {
- text-align: center;
- border: 1px solid grey;
- width: 150px;
- }
- table.tasks td {
- text-align: right;
- font-family: monospace;
- }
- table.tasks td:nth-child(2) {
- text-align: center;
- }
- table.tasks td:nth-child(4) {
- text-align: center;
- }
- table.tasks tr:hover{
- background-color: #99ddff;
- }
-
table.netstat {
border: 1px solid grey;
width: 500px;
<a href="/xml/v3/server">Server</a>,
<a href="/xml/v3/zones">Zones</a>,
<a href="/xml/v3/net">Network</a>,
- <a href="/xml/v3/tasks">Tasks</a>,
<a href="/xml/v3/mem">Memory</a> and
<a href="/xml/v3/traffic">Traffic Size</a></p>
<hr/>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
- <xsl:if test="taskmgr/thread-model/type">
- <h2>Task Manager Configuration</h2>
- <table class="counters">
- <tr>
- <th class="even">Thread-Model</th>
- <td>
- <xsl:value-of select="taskmgr/thread-model/type"/>
- </td>
- </tr>
- <tr class="odd">
- <th>Worker Threads</th>
- <td>
- <xsl:value-of select="taskmgr/thread-model/worker-threads"/>
- </td>
- </tr>
- <tr class="even">
- <th>Default Quantum</th>
- <td>
- <xsl:value-of select="taskmgr/thread-model/default-quantum"/>
- </td>
- </tr>
- <tr class="odd">
- <th>Tasks Running</th>
- <td>
- <xsl:value-of select="taskmgr/thread-model/tasks-running"/>
- </td>
- </tr>
- <tr class="even">
- <th>Tasks Ready</th>
- <td>
- <xsl:value-of select="taskmgr/thread-model/tasks-ready"/>
- </td>
- </tr>
- </table>
- <br/>
- </xsl:if>
- <xsl:if test="taskmgr/tasks/task">
- <h2>Tasks</h2>
- <table class="tasks">
- <tr>
- <th>ID</th>
- <th>Name</th>
- <th>References</th>
- <th>State</th>
- <th>Quantum</th>
- <th>Events</th>
- </tr>
- <xsl:for-each select="taskmgr/tasks/task">
- <xsl:sort select="name"/>
- <xsl:variable name="css-class14">
- <xsl:choose>
- <xsl:when test="position() mod 2 = 0">even</xsl:when>
- <xsl:otherwise>odd</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <tr class="{$css-class14}">
- <td>
- <xsl:value-of select="id"/>
- </td>
- <td>
- <xsl:value-of select="name"/>
- </td>
- <td>
- <xsl:value-of select="references"/>
- </td>
- <td>
- <xsl:value-of select="state"/>
- </td>
- <td>
- <xsl:value-of select="quantum"/>
- </td>
- <td>
- <xsl:value-of select="events"/>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- <br/>
- </xsl:if>
<xsl:if test="memory/summary">
<h2>Memory Usage Summary</h2>
<table class="counters">
#include <stdbool.h>
-#include <isc/event.h>
#include <isc/lex.h>
#include <isc/mem.h>
#include <isc/result.h>
EXTERN isc_mem_t *named_g_mctx INIT(NULL);
EXTERN unsigned int named_g_cpus INIT(0);
EXTERN unsigned int named_g_udpdisp INIT(0);
-EXTERN isc_taskmgr_t *named_g_taskmgr INIT(NULL);
EXTERN isc_loop_t *named_g_mainloop INIT(NULL);
EXTERN isc_loopmgr_t *named_g_loopmgr INIT(NULL);
EXTERN dns_dispatchmgr_t *named_g_dispatchmgr INIT(NULL);
#include <named/types.h>
-#define NAMED_EVENTCLASS ISC_EVENTCLASS(0x4E43)
-#define NAMED_EVENT_RELOAD (NAMED_EVENTCLASS + 0)
-#define NAMED_EVENT_DELZONE (NAMED_EVENTCLASS + 1)
-#define NAMED_EVENT_COMMAND (NAMED_EVENTCLASS + 2)
-#define NAMED_EVENT_TATSEND (NAMED_EVENTCLASS + 3)
-#define NAMED_EVENT_RUN (NAMED_EVENTCLASS + 4)
-#define NAMED_EVENT_SHUTDOWN (NAMED_EVENTCLASS + 5)
-
/*%
* Name server state. Better here than in lots of separate global variables.
*/
ns_server_t *sctx;
- isc_task_t *task;
-
char *statsfile; /*%< Statistics file name */
char *dumpfile; /*%< Dump file name */
char *secrootsfile; /*%< Secroots file name */
#include <isc/signal.h>
#include <isc/stdio.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/uv.h>
named_g_udpdisp == 1 ? "" : "s");
isc_managers_create(&named_g_mctx, named_g_cpus, &named_g_loopmgr,
- &named_g_netmgr, &named_g_taskmgr);
+ &named_g_netmgr);
isc_nm_maxudp(named_g_netmgr, maxudp);
}
}
- isc_managers_destroy(&named_g_mctx, &named_g_loopmgr, &named_g_netmgr,
- &named_g_taskmgr);
+ isc_managers_destroy(&named_g_mctx, &named_g_loopmgr, &named_g_netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
#include <isc/stats.h>
#include <isc/stdio.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/dnsrps.h>
#include <dns/dnssec.h>
#include <dns/dyndb.h>
-#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/forward.h>
#include <dns/geoip.h>
} \
} while (0)
-#define CHECKFATAL(op, msg) \
- { \
- result = (op); \
- if (result != ISC_R_SUCCESS) { \
- fatal(server, msg, result); \
- } \
+#define CHECKFATAL(op, msg) \
+ { \
+ result = (op); \
+ if (result != ISC_R_SUCCESS) { \
+ fatal(msg, result); \
+ } \
}
/*%
};
noreturn static void
-fatal(named_server_t *server, const char *msg, isc_result_t result);
+fatal(const char *msg, isc_result_t result);
static void
named_server_reload(void *arg);
(void)cfg_map_get(config, "view", &views);
/*
- * Create the views and count all the configured zones in
- * order to correctly size the zone manager's task table.
- * (We only count zones for configured views; the built-in
- * "bind" view can be ignored as it only adds a negligible
- * number of zones.)
- *
- * If we're allowing new zones, we need to be able to find the
- * new zone file and count those as well. So we setup the new
- * zone configuration context, but otherwise view configuration
- * waits until after the zone manager's task list has been sized.
+ * Create the views.
*/
for (element = cfg_list_first(views); element != NULL;
element = cfg_list_next(element))
named_server_t *server = (named_server_t *)arg;
dns_geoip_databases_t *geoip = NULL;
- CHECKFATAL(dns_zonemgr_create(named_g_mctx, named_g_loopmgr,
- named_g_taskmgr, named_g_netmgr,
- &server->zonemgr),
- "dns_zonemgr_create");
+ dns_zonemgr_create(named_g_mctx, named_g_loopmgr, named_g_netmgr,
+ &server->zonemgr);
CHECKFATAL(dns_dispatchmgr_create(named_g_mctx, named_g_netmgr,
&named_g_dispatchmgr),
geoip = NULL;
#endif /* if defined(HAVE_GEOIP2) */
- CHECKFATAL(ns_interfacemgr_create(
- named_g_mctx, server->sctx, named_g_loopmgr,
- named_g_taskmgr, named_g_netmgr, named_g_dispatchmgr,
- server->task, geoip, true, &server->interfacemgr),
+ CHECKFATAL(ns_interfacemgr_create(named_g_mctx, server->sctx,
+ named_g_loopmgr, named_g_netmgr,
+ named_g_dispatchmgr, geoip, true,
+ &server->interfacemgr),
"creating interface manager");
/*
dns_db_detach(&server->in_roothints);
isc_loopmgr_resume(named_g_loopmgr);
-
- isc_task_detach(&server->task);
}
/*%
atomic_init(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
- /*
- * Setup the server task, which is responsible for coordinating
- * startup and shutdown of the server, as well as all exclusive
- * tasks.
- */
- CHECKFATAL(isc_task_create(named_g_taskmgr, &server->task, 0),
- "creating server task");
- isc_task_setname(server->task, "server", server);
- isc_taskmgr_setexcltask(named_g_taskmgr, server->task);
-
CHECKFATAL(ns_server_create(mctx, get_matching_view, &server->sctx),
"creating server context");
}
static void
-fatal(named_server_t *server, const char *msg, isc_result_t result) {
- if (server != NULL && server->task != NULL) {
- /*
- * Prevent races between the OpenSSL on_exit registered
- * function and any other OpenSSL calls from other tasks
- * by requesting exclusive access to the task manager.
- */
- isc_loopmgr_pause(named_g_loopmgr);
- }
+fatal(const char *msg, isc_result_t result) {
+ isc_loopmgr_pause(named_g_loopmgr);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_CRITICAL, "%s: %s", msg,
isc_result_totext(result));
RWUNLOCK(&view->dynamickeys->lock,
isc_rwlocktype_write);
if (result != ISC_R_SUCCESS) {
- isc_task_endexclusive(server->task);
isc_loopmgr_resume(named_g_loopmgr);
return (result);
}
isc_mem_t *mctx;
/*
- * Locked by channel lock: can be referenced and modified by both
- * the server task and the channel task.
+ * Locked by channel lock
*/
isc_mutex_t lock;
dns_acl_t *acl;
- /* Locked by server task */
+ /* Locked by main loop. */
ISC_LINK(struct named_statschannel) link;
};
#define STATS_XML_STATUS 0x00 /* display only common statistics */
#define STATS_XML_SERVER 0x01
#define STATS_XML_ZONES 0x02
-#define STATS_XML_TASKS 0x04
#define STATS_XML_NET 0x08
#define STATS_XML_MEM 0x10
#define STATS_XML_TRAFFIC 0x20
}
TRY0(xmlTextWriterEndElement(writer)); /* /views */
- if ((flags & STATS_XML_TASKS) != 0) {
- TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "taskmgr"));
- TRY0(isc_taskmgr_renderxml(named_g_taskmgr, writer));
- TRY0(xmlTextWriterEndElement(writer)); /* /taskmgr */
- }
-
if ((flags & STATS_XML_MEM) != 0) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "memory"));
TRY0(isc_mem_renderxml(writer));
freecb, freecb_args));
}
-static isc_result_t
-render_xml_tasks(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
- void *arg, unsigned int *retcode, const char **retmsg,
- const char **mimetype, isc_buffer_t *b,
- isc_httpdfree_t **freecb, void **freecb_args) {
- UNUSED(httpd);
- UNUSED(urlinfo);
- return (render_xml(STATS_XML_TASKS, arg, retcode, retmsg, mimetype, b,
- freecb, freecb_args));
-}
-
static isc_result_t
render_xml_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
#define STATS_JSON_STATUS 0x00 /* display only common statistics */
#define STATS_JSON_SERVER 0x01
#define STATS_JSON_ZONES 0x02
-#define STATS_JSON_TASKS 0x04
#define STATS_JSON_NET 0x08
#define STATS_JSON_MEM 0x10
#define STATS_JSON_TRAFFIC 0x20
}
}
- if ((flags & STATS_JSON_TASKS) != 0) {
- json_object *tasks = json_object_new_object();
- CHECKMEM(tasks);
-
- result = isc_taskmgr_renderjson(named_g_taskmgr, tasks);
- if (result != ISC_R_SUCCESS) {
- json_object_put(tasks);
- goto cleanup;
- }
-
- json_object_object_add(bindstats, "taskmgr", tasks);
- }
-
if ((flags & STATS_JSON_MEM) != 0) {
json_object *memory = json_object_new_object();
CHECKMEM(memory);
freecb, freecb_args));
}
-static isc_result_t
-render_json_tasks(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
- void *arg, unsigned int *retcode, const char **retmsg,
- const char **mimetype, isc_buffer_t *b,
- isc_httpdfree_t **freecb, void **freecb_args) {
- UNUSED(httpd);
- UNUSED(urlinfo);
- return (render_json(STATS_JSON_TASKS, arg, retcode, retmsg, mimetype, b,
- freecb, freecb_args));
-}
-
static isc_result_t
render_json_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void *arg, unsigned int *retcode, const char **retmsg,
isc_httpdmgr_addurl(listener->httpdmgr,
"/xml/v" STATS_XML_VERSION_MAJOR "/net", false,
render_xml_net, server);
- isc_httpdmgr_addurl(listener->httpdmgr,
- "/xml/v" STATS_XML_VERSION_MAJOR "/tasks", false,
- render_xml_tasks, server);
isc_httpdmgr_addurl(listener->httpdmgr,
"/xml/v" STATS_XML_VERSION_MAJOR "/mem", false,
render_xml_mem, server);
isc_httpdmgr_addurl(listener->httpdmgr,
"/json/v" STATS_JSON_VERSION_MAJOR "/zones", false,
render_json_zones, server);
- isc_httpdmgr_addurl(listener->httpdmgr,
- "/json/v" STATS_JSON_VERSION_MAJOR "/tasks", false,
- render_json_tasks, server);
isc_httpdmgr_addurl(listener->httpdmgr,
"/json/v" STATS_JSON_VERSION_MAJOR "/net", false,
render_json_net, server);
static bool tried_other_gsstsig = false;
static bool local_only = false;
static isc_nm_t *netmgr = NULL;
-static isc_taskmgr_t *taskmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_log_t *glctx = NULL;
static isc_mem_t *gmctx = NULL;
}
#ifdef HAVE_GSSAPI
- /*
- * Cleanup GSSAPI resources after taskmgr has been destroyed.
- */
if (kserver != NULL) {
isc_mem_put(gmctx, kserver, sizeof(isc_sockaddr_t));
kserver = NULL;
}
ddebug("Shutting down managers");
- isc_managers_destroy(&gmctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&gmctx, &loopmgr, &netmgr);
}
static void
pre_parse_args(argc, argv);
- isc_managers_create(&gmctx, 1, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&gmctx, 1, &loopmgr, &netmgr);
parse_args(argc, argv);
#include <isc/result.h>
#include <isc/stdtime.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/thread.h>
#include <isc/util.h>
bool verbose;
static isc_nm_t *netmgr = NULL;
-static isc_taskmgr_t *taskmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
-static isc_task_t *rndc_task = NULL;
static const char *admin_conffile = NULL;
static const char *admin_keyfile = NULL;
atomic_load_acquire(&recvs) == 0)
{
shuttingdown = true;
- isc_task_detach(&rndc_task);
isc_loopmgr_shutdown(loopmgr);
}
}
atomic_load_acquire(&sends) == 0)
{
shuttingdown = true;
- isc_task_detach(&rndc_task);
isc_loopmgr_shutdown(loopmgr);
}
}
serial = isc_random32();
- isc_managers_create(&rndc_mctx, 1, &loopmgr, &netmgr, &taskmgr);
- isc_loopmgr_setup(loopmgr, rndc_start, rndc_task);
+ isc_managers_create(&rndc_mctx, 1, &loopmgr, &netmgr);
+ isc_loopmgr_setup(loopmgr, rndc_start, NULL);
- DO("create task", isc_task_create(taskmgr, &rndc_task, 0));
isc_log_create(rndc_mctx, &log, &logconfig);
isc_log_setcontext(log);
isc_log_settag(logconfig, progname);
isc_mem_stats(rndc_mctx, stderr);
}
- isc_managers_destroy(&rndc_mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&rndc_mctx, &loopmgr, &netmgr);
if (failed) {
return (1);
#include "instance.h"
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/db.h>
#include <inttypes.h>
#include <stdbool.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/dyndb.h>
#include <isc/parseint.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/dispatch.h>
-#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
isc_log_t *lctx = NULL;
isc_logconfig_t *lcfg = NULL;
isc_nm_t *netmgr = NULL;
- isc_taskmgr_t *taskmgr = NULL;
dns_dispatchmgr_t *dispatchmgr = NULL;
dns_dispatch_t *dispatchv4 = NULL;
dns_view_t *view = NULL;
}
isc_sockaddr_fromin(&dstaddr, &inaddr, port);
- isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
isc_log_create(mctx, &lctx, &lcfg);
isc_log_destroy(&lctx);
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
}
# grep "<h2>Glue cache statistics</h2>" xsltproc.out.${n} >/dev/null || ret=1
grep "<h3>View _default" xsltproc.out.${n} >/dev/null || ret=1
grep "<h4>Zone example" xsltproc.out.${n} >/dev/null || ret=1
- # grep "<h2>Task Manager Configuration</h2>" xsltproc.out.${n} >/dev/null || ret=1
- grep "<h2>Tasks</h2>" xsltproc.out.${n} >/dev/null || ret=1
grep "<h2>Memory Usage Summary</h2>" xsltproc.out.${n} >/dev/null || ret=1
grep "<h2>Memory Contexts</h2>" xsltproc.out.${n} >/dev/null || ret=1
else
#include <isc/random.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/dispatch.h>
main(int argc, char *argv[]) {
char *ourkeyname = NULL;
isc_nm_t *netmgr = NULL;
- isc_taskmgr_t *taskmgr = NULL;
isc_sockaddr_t bind_any;
dns_dispatchmgr_t *dispatchmgr = NULL;
dns_dispatch_t *dispatchv4 = NULL;
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
- isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
isc_log_create(mctx, &log, &logconfig);
dst_lib_destroy();
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
}
#include <isc/random.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/dispatch.h>
main(int argc, char **argv) {
char *keyname = NULL;
isc_nm_t *netmgr = NULL;
- isc_taskmgr_t *taskmgr = NULL;
isc_sockaddr_t bind_any;
dns_dispatchmgr_t *dispatchmgr = NULL;
dns_dispatch_t *dispatchv4 = NULL;
port = atoi(argv[2]);
keyname = argv[3];
- isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
isc_log_create(mctx, &log, &logconfig);
dst_lib_destroy();
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
}
static isc_mem_t *mctx = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_nm_t *netmgr = NULL;
-static isc_taskmgr_t *taskmgr = NULL;
static protocol_t protocol;
static const char *address;
static void
setup(void) {
- isc_managers_create(&mctx, workers, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, workers, &loopmgr, &netmgr);
}
static void
isc_tlsctx_free(&tls_ctx);
}
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
}
static void
static isc_mem_t *mctx = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_nm_t *netmgr = NULL;
-static isc_taskmgr_t *taskmgr = NULL;
static protocol_t protocol;
static in_port_t port;
static void
setup(void) {
- isc_managers_create(&mctx, workers, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, workers, &loopmgr, &netmgr);
}
static void
isc_tlsctx_free(&tls_ctx);
}
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
}
static void
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/time.h>
#include <isc/util.h>
#include <dns/byaddr.h>
#include <dns/dispatch.h>
-#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
isc_log_t *lctx = NULL;
isc_logconfig_t *lcfg = NULL;
isc_nm_t *netmgr = NULL;
- isc_taskmgr_t *taskmgr = NULL;
dns_dispatchmgr_t *dispatchmgr = NULL;
dns_dispatch_t *dispatchvx = NULL;
dns_view_t *view = NULL;
preparse_args(argc, argv);
- isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
isc_log_create(mctx, &lctx, &lcfg);
RUNCHECK(dst_lib_init(mctx, NULL));
isc_mem_free(mctx, default_query.ecs_addr);
}
- isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+ isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
}
resolver statistics), http://127.0.0.1:8888/xml/v3/zones (zone
statistics), http://127.0.0.1:8888/xml/v3/net (network status and socket
statistics), http://127.0.0.1:8888/xml/v3/mem (memory manager
-statistics), http://127.0.0.1:8888/xml/v3/tasks (task manager
statistics), and http://127.0.0.1:8888/xml/v3/traffic (traffic sizes).
The full set of statistics can also be read in JSON format at
resolver statistics), http://127.0.0.1:8888/json/v1/zones (zone
statistics), http://127.0.0.1:8888/json/v1/net (network status and
socket statistics), http://127.0.0.1:8888/json/v1/mem (memory manager
-statistics), http://127.0.0.1:8888/json/v1/tasks (task manager
statistics), and http://127.0.0.1:8888/json/v1/traffic (traffic sizes).
:any:`tls` Block Grammar
include/dns/dyndb.h \
include/dns/ecs.h \
include/dns/edns.h \
- include/dns/events.h \
include/dns/fixedname.h \
include/dns/forward.h \
include/dns/geoip.h \
#include <isc/rwlock.h>
#include <isc/stats.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/tid.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/db.h>
-#include <dns/events.h>
#include <dns/log.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
static void
shutdown_names(dns_adb_t *);
static void
+shutdown_entries(dns_adb_t *);
+static void
water(void *, int);
static void
dump_entry(FILE *, dns_adb_t *, dns_adbentry_t *, bool, isc_stdtime_t);
#include <isc/netaddr.h>
#include <isc/result.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/byaddr.h>
#include <dns/db.h>
-#include <dns/events.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/catz.h>
#include <dns/dbiterator.h>
-#include <dns/events.h>
#include <dns/rdatasetiter.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/client.h>
#include <dns/db.h>
#include <dns/dispatch.h>
-#include <dns/events.h>
#include <dns/forward.h>
#include <dns/keytable.h>
#include <dns/message.h>
#include <isc/util.h>
#include <dns/dnstap.h>
-#include <dns/events.h>
#include <dns/log.h>
#include <dns/message.h>
#include <dns/name.h>
*\li Drafts: TBS
*/
-#include <isc/event.h>
#include <isc/lang.h>
#include <dns/types.h>
* security issue specific to this module is anticipated.
*/
-#include <isc/event.h>
#include <isc/loop.h>
#include <isc/sockaddr.h>
#include <isc/tls.h>
* if not, set DNS_DYNDB_AGE to 0.
*/
#ifndef DNS_DYNDB_VERSION
-#define DNS_DYNDB_VERSION 1
+#define DNS_DYNDB_VERSION 2
#define DNS_DYNDB_AGE 0
#endif /* ifndef DNS_DYNDB_VERSION */
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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
-
-#include <isc/eventclass.h>
-
-/*! \file dns/events.h
- * \brief
- * Registry of DNS event numbers.
- */
-
-#define DNS_EVENT_FETCHCONTROL (ISC_EVENTCLASS_DNS + 0)
-#define DNS_EVENT_FETCHDONE (ISC_EVENTCLASS_DNS + 1)
-/* #define DNS_EVENT_VIEWRESSHUTDOWN (ISC_EVENTCLASS_DNS + 2) */
-/* #define DNS_EVENT_VIEWADBSHUTDOWN (ISC_EVENTCLASS_DNS + 3) */
-#define DNS_EVENT_UPDATE (ISC_EVENTCLASS_DNS + 4)
-#define DNS_EVENT_UPDATEDONE (ISC_EVENTCLASS_DNS + 5)
-#define DNS_EVENT_DISPATCH (ISC_EVENTCLASS_DNS + 6)
-#define DNS_EVENT_TCPMSG (ISC_EVENTCLASS_DNS + 7)
-#define DNS_EVENT_ADBMOREADDRESSES (ISC_EVENTCLASS_DNS + 8)
-#define DNS_EVENT_ADBNOMOREADDRESSES (ISC_EVENTCLASS_DNS + 9)
-#define DNS_EVENT_ADBCANCELED (ISC_EVENTCLASS_DNS + 10)
-#define DNS_EVENT_ADBNAMEDELETED (ISC_EVENTCLASS_DNS + 11)
-#define DNS_EVENT_ADBSHUTDOWN (ISC_EVENTCLASS_DNS + 12)
-#define DNS_EVENT_ADBEXPIRED (ISC_EVENTCLASS_DNS + 13)
-#define DNS_EVENT_ADBCONTROL (ISC_EVENTCLASS_DNS + 14)
-#define DNS_EVENT_CACHECLEAN (ISC_EVENTCLASS_DNS + 15)
-#define DNS_EVENT_BYADDRDONE (ISC_EVENTCLASS_DNS + 16)
-#define DNS_EVENT_ZONECONTROL (ISC_EVENTCLASS_DNS + 17)
-#define DNS_EVENT_DBDESTROYED (ISC_EVENTCLASS_DNS + 18)
-#define DNS_EVENT_VALIDATORDONE (ISC_EVENTCLASS_DNS + 19)
-#define DNS_EVENT_REQUESTDONE (ISC_EVENTCLASS_DNS + 20)
-#define DNS_EVENT_VALIDATORSTART (ISC_EVENTCLASS_DNS + 21)
-/* #define DNS_EVENT_VIEWREQSHUTDOWN (ISC_EVENTCLASS_DNS + 22) */
-#define DNS_EVENT_NOTIFYSENDTOADDR (ISC_EVENTCLASS_DNS + 23)
-#define DNS_EVENT_ZONE (ISC_EVENTCLASS_DNS + 24)
-#define DNS_EVENT_ZONESTARTXFRIN (ISC_EVENTCLASS_DNS + 25)
-/* #define DNS_EVENT_MASTERQUANTUM (ISC_EVENTCLASS_DNS + 26) */
-#define DNS_EVENT_CACHEOVERMEM (ISC_EVENTCLASS_DNS + 27)
-#define DNS_EVENT_MASTERNEXTZONE (ISC_EVENTCLASS_DNS + 28)
-#define DNS_EVENT_IOREADY (ISC_EVENTCLASS_DNS + 29)
-#define DNS_EVENT_LOOKUPDONE (ISC_EVENTCLASS_DNS + 30)
-#define DNS_EVENT_RBTDEADNODES (ISC_EVENTCLASS_DNS + 31)
-#define DNS_EVENT_DISPATCHCONTROL (ISC_EVENTCLASS_DNS + 32)
-#define DNS_EVENT_REQUESTCONTROL (ISC_EVENTCLASS_DNS + 33)
-#define DNS_EVENT_DUMPQUANTUM (ISC_EVENTCLASS_DNS + 34)
-/* #define DNS_EVENT_IMPORTRECVDONE (ISC_EVENTCLASS_DNS + 35) */
-#define DNS_EVENT_FREESTORAGE (ISC_EVENTCLASS_DNS + 36)
-/* #define DNS_EVENT_VIEWACACHESHUTDOWN (ISC_EVENTCLASS_DNS + 37) */
-#define DNS_EVENT_ACACHECONTROL (ISC_EVENTCLASS_DNS + 38)
-#define DNS_EVENT_ACACHECLEAN (ISC_EVENTCLASS_DNS + 39)
-#define DNS_EVENT_ACACHEOVERMEM (ISC_EVENTCLASS_DNS + 40)
-#define DNS_EVENT_RBTPRUNE (ISC_EVENTCLASS_DNS + 41)
-#define DNS_EVENT_MANAGEKEYS (ISC_EVENTCLASS_DNS + 42)
-#define DNS_EVENT_CLIENTRESDONE (ISC_EVENTCLASS_DNS + 43)
-#define DNS_EVENT_CLIENTREQDONE (ISC_EVENTCLASS_DNS + 44)
-#define DNS_EVENT_ADBGROWENTRIES (ISC_EVENTCLASS_DNS + 45)
-#define DNS_EVENT_ADBGROWNAMES (ISC_EVENTCLASS_DNS + 46)
-#define DNS_EVENT_ZONESECURESERIAL (ISC_EVENTCLASS_DNS + 47)
-#define DNS_EVENT_ZONESECUREDB (ISC_EVENTCLASS_DNS + 48)
-/* #define DNS_EVENT_ZONELOAD (ISC_EVENTCLASS_DNS + 49) */
-#define DNS_EVENT_KEYDONE (ISC_EVENTCLASS_DNS + 50)
-#define DNS_EVENT_SETNSEC3PARAM (ISC_EVENTCLASS_DNS + 51)
-#define DNS_EVENT_SETSERIAL (ISC_EVENTCLASS_DNS + 52)
-#define DNS_EVENT_CATZUPDATED (ISC_EVENTCLASS_DNS + 53)
-#define DNS_EVENT_CATZADDZONE (ISC_EVENTCLASS_DNS + 54)
-#define DNS_EVENT_CATZMODZONE (ISC_EVENTCLASS_DNS + 55)
-#define DNS_EVENT_CATZDELZONE (ISC_EVENTCLASS_DNS + 56)
-#define DNS_EVENT_RPZUPDATED (ISC_EVENTCLASS_DNS + 57)
-#define DNS_EVENT_STARTUPDATE (ISC_EVENTCLASS_DNS + 58)
-#define DNS_EVENT_TRYSTALE (ISC_EVENTCLASS_DNS + 59)
-#define DNS_EVENT_ZONEFLUSH (ISC_EVENTCLASS_DNS + 60)
-#define DNS_EVENT_CHECKDSSENDTOADDR (ISC_EVENTCLASS_DNS + 61)
-#define DNS_EVENT_CACHESHUTDOWN (ISC_EVENTCLASS_DNS + 62)
#include <stdbool.h>
-#include <isc/event.h>
#include <isc/lang.h>
#include <dns/types.h>
#include <inttypes.h>
#include <stdbool.h>
-#include <isc/event.h>
#include <isc/ht.h>
#include <isc/lang.h>
#include <isc/refcount.h>
#include <stdbool.h>
-#include <isc/event.h>
#include <isc/lang.h>
#include <isc/mutex.h>
#include <stdbool.h>
#include <stdio.h>
-#include <isc/event.h>
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/mutex.h>
* object from being freed but not from shutting down.
*
* Require:
- *\li The caller is running in the context of the zone's task.
+ *\li The caller is running in the context of the zone's loop.
*\li 'zone' to be a valid zone.
*\li 'target' to be non NULL and '*target' to be NULL.
*/
* zone, it will be freed.
*
* Require:
- *\li The caller is running in the context of the zone's task.
+ *\li The caller is running in the context of the zone's loop.
*\li 'zonep' to point to a valid zone.
*/
*\li Error
*/
-isc_result_t
-dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
- isc_taskmgr_t *taskmgr, isc_nm_t *netmgr,
+void
+dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t *netmgr,
dns_zonemgr_t **zmgrp);
/*%<
* Create a zone manager.
*
* Requires:
*\li 'mctx' to be a valid memory context.
- *\li 'taskmgr' to be a valid task manager.
*\li 'zmgrp' to point to a NULL pointer.
*/
*\li 'zone->zmgr' == NULL;
*/
-isc_taskmgr_t *
-dns_zonemgr_gettaskmgr(dns_zonemgr_t *zmgr);
-/*%
- * Get the tasmkgr object attached to 'zmgr'.
- */
-
void
dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, uint32_t value);
/*%<
* this signature.
*/
-typedef isc_result_t (*dns_zt_zoneloaded_t)(dns_zt_t *zt, dns_zone_t *zone,
- isc_task_t *task);
+typedef isc_result_t (*dns_zt_zoneloaded_t)(dns_zt_t *zt, dns_zone_t *zone);
/*%<
* Method prototype: when a zone finishes loading, the zt object
* can be informed via a callback function with this signature.
#include <isc/async.h>
#include <isc/atomic.h>
-#include <isc/event.h>
#include <isc/lex.h>
#include <isc/loop.h>
#include <isc/magic.h>
#include <isc/work.h>
#include <dns/callbacks.h>
-#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/master.h>
#include <dns/name.h>
#include <isc/async.h>
#include <isc/atomic.h>
#include <isc/buffer.h>
-#include <isc/event.h>
#include <isc/file.h>
#include <isc/loop.h>
#include <isc/magic.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
-#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/master.h>
#include <isc/async.h>
#include <isc/buffer.h>
-#include <isc/event.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/rwlock.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/result.h>
#include <isc/rwlock.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <isc/work.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dnsrps.h>
-#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/rbt.h>
#include <dns/dbiterator.h>
#include <dns/diff.h>
#include <dns/dnssec.h>
-#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/kasp.h>
#include <dns/db.h>
#include <dns/dnssec.h>
#include <dns/ds.h>
-#include <dns/events.h>
#include <dns/keytable.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <isc/result.h>
#include <isc/stats.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/dlz.h>
#include <dns/dns64.h>
#include <dns/dnssec.h>
-#include <dns/events.h>
#include <dns/forward.h>
#include <dns/keytable.h>
#include <dns/keyvalues.h>
#include <dns/catz.h>
#include <dns/db.h>
#include <dns/diff.h>
-#include <dns/events.h>
#include <dns/journal.h>
#include <dns/log.h>
#include <dns/message.h>
#include <isc/stdtime.h>
#include <isc/strerr.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/thread.h>
#include <isc/tid.h>
#include <isc/timer.h>
#include <dns/dbiterator.h>
#include <dns/dlz.h>
#include <dns/dnssec.h>
-#include <dns/events.h>
#include <dns/journal.h>
#include <dns/kasp.h>
#include <dns/keydata.h>
dns_remote_t notify;
dns_notifytype_t notifytype;
isc_sockaddr_t notifyfrom;
-
- isc_task_t *task;
-
isc_sockaddr_t notifysrc4;
isc_sockaddr_t notifysrc6;
isc_sockaddr_t parentalsrc4;
isc_sockaddr_t xfrsource4;
isc_sockaddr_t xfrsource6;
isc_sockaddr_t sourceaddr;
-
- dns_xfrin_ctx_t *xfr; /* task locked */
+ dns_xfrin_ctx_t *xfr; /* loop locked */
dns_tsigkey_t *tsigkey; /* key used for xfr */
dns_transport_t *transport; /* transport used for xfr */
/* Access Control Lists */
isc_mem_t *mctx;
isc_refcount_t refs;
isc_loopmgr_t *loopmgr;
- isc_taskmgr_t *taskmgr;
isc_nm_t *netmgr;
uint32_t workers;
- isc_task_t **zonetasks;
isc_mem_t **mctxpool;
isc_ratelimiter_t *checkdsrl;
isc_ratelimiter_t *notifyrl;
INSIST(zone->view == NULL);
INSIST(zone->prev_view == NULL);
- if (zone->task != NULL) {
- isc_task_detach(&zone->task);
- }
-
/* Unmanaged objects */
for (struct np3 *npe = ISC_LIST_HEAD(zone->setnsec3param_queue);
npe != NULL; npe = ISC_LIST_HEAD(zone->setnsec3param_queue))
"no master file");
}
zone->refreshtime = now;
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
zone_settimer(zone, &now);
}
result = ISC_R_SUCCESS;
/* Inform the zone table we've finished loading */
if (asl->loaded != NULL) {
- (asl->loaded)(asl->loaded_arg, zone, zone->task);
+ (asl->loaded)(asl->loaded_arg, zone);
}
isc_mem_put(zone->mctx, asl, sizeof(*asl));
if (isc_time_isepoch(&zone->nsec3chaintime)) {
TIME_NOW(&now);
zone->nsec3chaintime = now;
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
zone_settimer(zone, &now);
}
}
}
}
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
if (zone->type == dns_zone_primary) {
set_resigntime(zone);
resume_signingwithkey(zone);
/* Mark the zone for immediate refresh. */
zone->refreshtime = now;
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
zone_settimer(zone, &now);
}
result = ISC_R_SUCCESS;
* due to DNS_ZONEFLG_LOADPENDING being set when
* zone_maintenance was called.
*/
- if (zone->secure->task != NULL) {
+ if (zone->secure->loop != NULL) {
zone_settimer(zone->secure, &now);
}
}
}
UNLOCK_ZONE(zone);
if (!dumping) {
- result = zone_dump(zone, true); /* task locked */
+ result = zone_dump(zone, true); /* loop locked */
if (result != ISC_R_SUCCESS) {
dns_zone_log(zone, ISC_LOG_WARNING,
"dump failed: %s",
/* XXXMPA make separate call back */
if (result == ISC_R_SUCCESS) {
set_resigntime(zone);
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
isc_time_t now;
TIME_NOW(&now);
zone_settimer(zone, &now);
}
UNLOCK_ZONE(zone);
if (!dumping) {
- result = zone_dump(zone, true); /* Unknown task. */
+ result = zone_dump(zone, true);
}
return (result);
}
dumping = was_dumping(zone);
UNLOCK_ZONE(zone);
if (!dumping) {
- result = zone_dump(zone, false); /* Unknown task. */
+ result = zone_dump(zone, false);
}
return (result);
}
{
zone->dumptime = dumptime;
}
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
zone_settimer(zone, &now);
}
}
dns_masterrawheader_t rawdata;
/*
- * 'compact' MUST only be set if we are task locked.
+ * 'compact' MUST only be set if we are loop locked.
*/
REQUIRE(DNS_ZONE_VALID(zone));
}
/*
- * In task context, no locking required. See zone_xfrdone().
+ * In loop context, no locking required. See zone_xfrdone().
*/
if (zone->xfr != NULL) {
/* The final detach will happen in zone_xfrdone() */
LOCK_ZONE(zone);
zone->sigresigninginterval = interval;
set_resigntime(zone);
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
TIME_NOW(&now);
zone_settimer(zone, &now);
}
RWUNLOCK(&mgmt->lock, isc_rwlocktype_write);
}
-isc_result_t
-dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
- isc_taskmgr_t *taskmgr, isc_nm_t *netmgr,
+void
+dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t *netmgr,
dns_zonemgr_t **zmgrp) {
- dns_zonemgr_t *zmgr;
- isc_result_t result;
+ dns_zonemgr_t *zmgr = NULL;
isc_loop_t *loop = isc_loop_current(loopmgr);
REQUIRE(mctx != NULL);
REQUIRE(loopmgr != NULL);
- REQUIRE(taskmgr != NULL);
REQUIRE(netmgr != NULL);
REQUIRE(zmgrp != NULL && *zmgrp == NULL);
*zmgr = (dns_zonemgr_t){
.loopmgr = loopmgr,
- .taskmgr = taskmgr,
.netmgr = netmgr,
.workers = isc_loopmgr_nloops(loopmgr),
.transfersin = 10,
isc_ratelimiter_create(loop, &zmgr->startupnotifyrl);
isc_ratelimiter_create(loop, &zmgr->startuprefreshrl);
- zmgr->zonetasks = isc_mem_getx(
- zmgr->mctx, zmgr->workers * sizeof(zmgr->zonetasks[0]),
- ISC_MEM_ZERO);
- for (size_t i = 0; i < zmgr->workers; i++) {
- result = isc_task_create(zmgr->taskmgr, &zmgr->zonetasks[i], i);
- if (result != ISC_R_SUCCESS) {
- goto free_zonetasks;
- }
- isc_task_setname(zmgr->zonetasks[i], "zonemgr-zonetasks", NULL);
- }
-
zmgr->mctxpool = isc_mem_getx(zmgr->mctx,
zmgr->workers * sizeof(zmgr->mctxpool[0]),
ISC_MEM_ZERO);
zmgr->magic = ZONEMGR_MAGIC;
*zmgrp = zmgr;
- return (ISC_R_SUCCESS);
-
-#if 0
- free_iolock:
- isc_mutex_destroy(&zmgr->iolock);
-#endif /* if 0 */
-
-free_zonetasks:
- for (size_t i = 0; i < zmgr->workers; i++) {
- if (zmgr->zonetasks[i] != NULL) {
- isc_task_detach(&zmgr->zonetasks[i]);
- }
- }
- isc_mem_put(zmgr->mctx, zmgr->zonetasks,
- zmgr->workers * sizeof(zmgr->zonetasks[0]));
-
- isc_ratelimiter_shutdown(zmgr->startuprefreshrl);
- isc_ratelimiter_detach(&zmgr->startuprefreshrl);
- isc_ratelimiter_shutdown(zmgr->startupnotifyrl);
- isc_ratelimiter_detach(&zmgr->startupnotifyrl);
- isc_ratelimiter_shutdown(zmgr->refreshrl);
- isc_ratelimiter_detach(&zmgr->refreshrl);
- isc_ratelimiter_shutdown(zmgr->notifyrl);
- isc_ratelimiter_detach(&zmgr->notifyrl);
- isc_ratelimiter_shutdown(zmgr->checkdsrl);
- isc_ratelimiter_detach(&zmgr->checkdsrl);
-
- isc_rwlock_destroy(&zmgr->urlock);
- isc_rwlock_destroy(&zmgr->rwlock);
- isc_mem_put(zmgr->mctx, zmgr, sizeof(*zmgr));
- isc_mem_detach(&mctx);
- return (result);
}
isc_result_t
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(DNS_ZONEMGR_VALID(zmgr));
- if (zmgr->zonetasks == NULL) {
- return (ISC_R_FAILURE);
- }
-
RWLOCK(&zmgr->rwlock, isc_rwlocktype_write);
LOCK_ZONE(zone);
- REQUIRE(zone->task == NULL);
REQUIRE(zone->timer == NULL);
REQUIRE(zone->zmgr == NULL);
- isc_task_attach(zmgr->zonetasks[zone->tid], &zone->task);
-
- /*
- * Set the task name. The tag will arbitrarily point to one
- * of the zones sharing the task (in practice, the one
- * to be managed last).
- */
- isc_task_setname(zone->task, "zone", zone);
-
zone->loop = isc_loop_get(zmgr->loopmgr, zone->tid);
zonemgr_keymgmt_add(zmgr, zone, &zone->kfio);
isc_mem_detach(&zmgr->mctxpool[i]);
}
- for (size_t i = 0; i < zmgr->workers; i++) {
- isc_task_detach(&zmgr->zonetasks[i]);
- }
-
RWLOCK(&zmgr->rwlock, isc_rwlocktype_read);
for (zone = ISC_LIST_HEAD(zmgr->zones); zone != NULL;
zone = ISC_LIST_NEXT(zone, link))
isc_mem_put(zmgr->mctx, zmgr->mctxpool,
zmgr->workers * sizeof(zmgr->mctxpool[0]));
- isc_mem_put(zmgr->mctx, zmgr->zonetasks,
- zmgr->workers * sizeof(zmgr->zonetasks[0]));
isc_rwlock_destroy(&zmgr->urlock);
isc_rwlock_destroy(&zmgr->rwlock);
return (zmgr->transfersperns);
}
-isc_taskmgr_t *
-dns_zonemgr_gettaskmgr(dns_zonemgr_t *zmgr) {
- REQUIRE(DNS_ZONEMGR_VALID(zmgr));
-
- return (zmgr->taskmgr);
-}
-
/*
* Try to start a new incoming zone transfer to fill a quota
* slot that was just vacated.
/*
* If we are exiting just pretend we got quota so the zone will
- * be cleaned up in the zone's task context.
+ * be cleaned up in the zone's loop context.
*/
LOCK_ZONE(zone);
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) {
signing = NULL;
if (isc_time_isepoch(&zone->signingtime)) {
zone->signingtime = now;
- if (zone->task != NULL) {
+ if (zone->loop != NULL) {
zone_settimer(zone, &now);
}
}
dns_zone_rekey(dns_zone_t *zone, bool fullsign) {
isc_time_t now;
- if (zone->type == dns_zone_primary && zone->task != NULL) {
+ if (zone->type == dns_zone_primary && zone->loop != NULL) {
LOCK_ZONE(zone);
if (fullsign) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(zone->zmgr != NULL);
- REQUIRE(zone->task != NULL);
+ REQUIRE(zone->loop != NULL);
REQUIRE(zone->raw == NULL);
REQUIRE(DNS_ZONE_VALID(raw));
REQUIRE(raw->zmgr == NULL);
- REQUIRE(raw->task == NULL);
+ REQUIRE(raw->loop == NULL);
REQUIRE(raw->secure == NULL);
REQUIRE(zone != raw);
/* dns_zone_iattach(zone, &raw->secure); */
zone_iattach(zone, &raw->secure);
- isc_task_attach(zone->task, &raw->task);
-
ISC_LIST_APPEND(zmgr->zones, raw, link);
raw->zmgr = zmgr;
isc_refcount_increment(&zmgr->refs);
}
/*
- * Called from the zone task's queue after the relevant event is posted by
+ * Called from the zone loop's queue after the relevant event is posted by
* dns_zone_setnsec3param().
*/
static void
* in the "data" field of the nsec3param_t structure.
*
* Once the nsec3param_t structure is prepared, post an event to the zone's
- * task which will cause setnsec3param() to be called with the prepared
+ * loop which will cause setnsec3param() to be called with the prepared
* structure passed as an argument.
*/
isc_result_t
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/util.h>
#include <dns/log.h>
freezezones(dns_zone_t *zone, void *uap);
static isc_result_t
-doneloading(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task);
+doneloading(dns_zt_t *zt, dns_zone_t *zone);
isc_result_t
dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **ztp) {
* dns_zt_asyncload().
*/
static isc_result_t
-doneloading(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) {
- UNUSED(zone);
- UNUSED(task);
-
+doneloading(dns_zt_t *zt, dns_zone_t *zone) {
REQUIRE(VALID_ZT(zt));
+ UNUSED(zone);
+
if (isc_refcount_decrement(&zt->loads_pending) == 1) {
call_loaddone(zt);
}
include/isc/entropy.h \
include/isc/errno.h \
include/isc/error.h \
- include/isc/event.h \
- include/isc/eventclass.h \
include/isc/file.h \
include/isc/formatcheck.h \
include/isc/fsaccess.h \
include/isc/string.h \
include/isc/symtab.h \
include/isc/syslog.h \
- include/isc/task.h \
include/isc/thread.h \
include/isc/tid.h \
include/isc/time.h \
errno2result.c \
errno2result.h \
error.c \
- event.c \
file.c \
fsaccess.c \
fsaccess_common.c \
string.c \
symtab.c \
syslog.c \
- task.c \
thread.c \
tid.c \
time.c \
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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 <isc/event.h>
-#include <isc/mem.h>
-#include <isc/util.h>
-
-/***
- *** Events.
- ***/
-
-static void
-destroy(isc_event_t *event) {
- isc_mem_t *mctx = event->ev_destroy_arg;
-
- isc_mem_put(mctx, event, event->ev_size);
-}
-
-isc_event_t *
-isc__event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
- isc_taskaction_t action, void *arg,
- size_t size ISC__EVENT_FLARG) {
- isc_event_t *event;
-
- REQUIRE(size >= sizeof(struct isc_event));
- REQUIRE(action != NULL);
-
- event = isc_mem_get(mctx, size);
-
- ISC_EVENT_INIT_PASS(event, size, 0, type, action, arg, sender, destroy,
- mctx);
-
- return (event);
-}
-
-void
-isc_event_free(isc_event_t **eventp) {
- isc_event_t *event;
-
- REQUIRE(eventp != NULL);
- event = *eventp;
- *eventp = NULL;
- REQUIRE(event != NULL);
-
- REQUIRE(!ISC_LINK_LINKED(event, ev_link));
- REQUIRE(!ISC_LINK_LINKED(event, ev_ratelink));
-
- if (event->ev_destroy != NULL) {
- (event->ev_destroy)(event);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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 isc/event.h */
-
-#include <isc/backtrace.h>
-#include <isc/lang.h>
-#include <isc/string.h>
-#include <isc/types.h>
-#include <isc/util.h>
-
-/*****
-***** Events.
-*****/
-
-typedef void (*isc_eventdestructor_t)(isc_event_t *);
-
-#if TASKMGR_TRACE
-#define ISC__EVENT_TRACE_SIZE 8
-#define ISC__EVENT_FILELINE , __func__, __FILE__, __LINE__
-#define ISC__EVENT_FLARG , const char *func, const char *file, unsigned int line
-
-#define ISC_EVENT_COMMON(ltype) \
- size_t ev_size; \
- unsigned int ev_attributes; \
- isc_eventtype_t ev_type; \
- isc_taskaction_t ev_action; \
- void *ev_arg; \
- void *ev_sender; \
- isc_eventdestructor_t ev_destroy; \
- void *ev_destroy_arg; \
- void *backtrace[ISC__EVENT_TRACE_SIZE]; \
- int backtrace_size; \
- char func[PATH_MAX]; \
- char file[PATH_MAX]; \
- unsigned int line; \
- ISC_LINK(ltype) ev_link; \
- ISC_LINK(ltype) ev_ratelink
-
-#define ISC_EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da) \
- ISC__EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da, __func__, \
- __FILE__, __LINE__)
-
-#define ISC_EVENT_INIT_PASS(event, sz, at, ty, ac, ar, sn, df, da) \
- ISC__EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da, func, file, line)
-
-#define ISC__EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da, fn, fl, ln) \
- { \
- (event)->ev_size = (sz); \
- (event)->ev_attributes = (at); \
- (event)->ev_type = (ty); \
- (event)->ev_action = (ac); \
- (event)->ev_arg = (ar); \
- (event)->ev_sender = (sn); \
- (event)->ev_destroy = (df); \
- (event)->ev_destroy_arg = (da); \
- ISC_LINK_INIT((event), ev_link); \
- ISC_LINK_INIT((event), ev_ratelink); \
- strlcpy((event)->func, fn, sizeof((event)->func)); \
- strlcpy((event)->file, fl, sizeof((event)->file)); \
- (event)->line = ln; \
- (event)->backtrace_size = isc_backtrace( \
- (event)->backtrace, ISC__EVENT_TRACE_SIZE); \
- }
-
-#else
-#define ISC__EVENT_FILELINE
-#define ISC__EVENT_FLARG
-#define ISC__EVENT_FLARG_PASS
-
-#define ISC_EVENT_COMMON(ltype) \
- size_t ev_size; \
- unsigned int ev_attributes; \
- isc_eventtype_t ev_type; \
- isc_taskaction_t ev_action; \
- void *ev_arg; \
- void *ev_sender; \
- isc_eventdestructor_t ev_destroy; \
- void *ev_destroy_arg; \
- ISC_LINK(ltype) ev_link; \
- ISC_LINK(ltype) ev_ratelink
-
-#define ISC_EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da) \
- { \
- (event)->ev_size = (sz); \
- (event)->ev_attributes = (at); \
- (event)->ev_type = (ty); \
- (event)->ev_action = (ac); \
- (event)->ev_arg = (ar); \
- (event)->ev_sender = (sn); \
- (event)->ev_destroy = (df); \
- (event)->ev_destroy_arg = (da); \
- ISC_LINK_INIT((event), ev_link); \
- ISC_LINK_INIT((event), ev_ratelink); \
- }
-
-#define ISC_EVENT_INIT_PASS ISC_EVENT_INIT
-
-#endif
-
-/*%
- * Attributes matching a mask of 0x000000ff are reserved for the task library's
- * definition. Attributes of 0xffffff00 may be used by the application
- * or non-ISC libraries.
- */
-
-/*%
- * The ISC_EVENTATTR_CANCELED attribute is intended to indicate
- * that an event is delivered as a result of a canceled operation
- * rather than successful completion, by mutual agreement
- * between the sender and receiver. It is not set or used by
- * the task system.
- */
-#define ISC_EVENTATTR_CANCELED 0x00000002
-
-/*%
- * This structure is public because "subclassing" it may be useful when
- * defining new event types.
- */
-struct isc_event {
- ISC_EVENT_COMMON(struct isc_event);
-};
-
-#define ISC_EVENT_PTR(p) ((isc_event_t **)(void *)(p))
-
-ISC_LANG_BEGINDECLS
-
-#define isc_event_allocate(mctx, sender, type, action, arg, size) \
- isc__event_allocate(mctx, sender, type, action, arg, \
- size ISC__EVENT_FILELINE)
-
-isc_event_t *
-isc__event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
- isc_taskaction_t action, void *arg,
- size_t size ISC__EVENT_FLARG);
-/*%<
- * Allocate an event structure.
- *
- * Allocate and initialize in a structure with initial elements
- * defined by:
- *
- * \code
- * struct {
- * ISC_EVENT_COMMON(struct isc_event);
- * ...
- * };
- * \endcode
- *
- * Requires:
- *\li 'size' >= sizeof(struct isc_event)
- *\li 'action' to be non NULL
- *
- * Returns:
- *\li a pointer to a initialized structure of the requested size.
- *\li NULL if unable to allocate memory.
- */
-
-void
-isc_event_free(isc_event_t **);
-
-ISC_LANG_ENDDECLS
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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 isc/eventclass.h
- ***** Registry of Predefined Event Type Classes
- *****/
-
-/*%
- * An event class is an unsigned 16 bit number. Each class may contain up
- * to 65536 events. An event type is formed by adding the event number
- * within the class to the class number.
- *
- */
-
-#define ISC_EVENTCLASS(eclass) ((eclass) << 16)
-
-/*@{*/
-/*!
- * Classes < 1024 are reserved for ISC use.
- * Event classes >= 1024 and <= 65535 are reserved for application use.
- */
-
-#define ISC_EVENTCLASS_TASK ISC_EVENTCLASS(0)
-#define ISC_EVENTCLASS_TIMER ISC_EVENTCLASS(1)
-#define ISC_EVENTCLASS_SOCKET ISC_EVENTCLASS(2)
-#define ISC_EVENTCLASS_FILE ISC_EVENTCLASS(3)
-#define ISC_EVENTCLASS_DNS ISC_EVENTCLASS(4)
-#define ISC_EVENTCLASS_OMAPI ISC_EVENTCLASS(5)
-#define ISC_EVENTCLASS_RATELIMITER ISC_EVENTCLASS(6)
-#define ISC_EVENTCLASS_ISCCC ISC_EVENTCLASS(7)
-#define ISC_EVENTCLASS_NS ISC_EVENTCLASS(8)
-/*@}*/
#include <stdbool.h>
-#include <isc/event.h>
-#include <isc/eventclass.h>
#include <isc/mutex.h>
-#include <isc/task.h>
#include <isc/time.h>
#include <isc/types.h>
#include <isc/url.h>
#include <isc/loop.h>
#include <isc/netmgr.h>
#include <isc/result.h>
-#include <isc/task.h>
#include <isc/timer.h>
typedef struct isc_managers isc_managers_t;
void
isc_managers_create(isc_mem_t **mctx, uint32_t workers,
- isc_loopmgr_t **loopmgrp, isc_nm_t **netmgrp,
- isc_taskmgr_t **taskmgrp);
+ isc_loopmgr_t **loopmgrp, isc_nm_t **netmgrp);
void
isc_managers_destroy(isc_mem_t **mctx, isc_loopmgr_t **loopmgrp,
- isc_nm_t **netmgrp, isc_taskmgr_t **taskmgrp);
+ isc_nm_t **netmgrp);
* Stop listening on socket 'sock'.
*/
-void
-isc_nm_pause(isc_nm_t *mgr);
-/*%<
- * Pause all processing, equivalent to taskmgr exclusive tasks.
- * It won't return until all workers have been paused.
- */
-
-void
-isc_nm_resume(isc_nm_t *mgr);
-/*%<
- * Resume paused processing. It will return immediately after signalling
- * workers to resume.
- */
-
void
isc_nm_read(isc_nmhandle_t *handle, isc_nm_recv_cb_t cb, void *cbarg);
/*
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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
-
-/*****
- ***** Module Info
- *****/
-
-/*! \file isc/task.h
- * \brief The task system provides a lightweight execution context, which is
- * basically an event queue.
- *
- * When a task's event queue is non-empty, the
- * task is runnable. A small work crew of threads, typically one per CPU,
- * execute runnable tasks by dispatching the events on the tasks' event
- * queues. Context switching between tasks is fast.
- *
- * \li MP:
- * The module ensures appropriate synchronization of data structures it
- * creates and manipulates.
- * The caller must ensure that isc_taskmgr_destroy() is called only
- * once for a given manager.
- *
- * \li Reliability:
- * No anticipated impact.
- *
- * \li Resources:
- * TBS
- *
- * \li Security:
- * No anticipated impact.
- *
- * \li Standards:
- * None.
- *
- * \section purge Purging and Unsending
- *
- * Events which have been queued for a task but not delivered may be removed
- * from the task's event queue by purging the event.
- *
- * Purging calls isc_event_free() on the matching events.
- *
- */
-
-/***
- *** Imports.
- ***/
-
-#include <stdbool.h>
-
-#include <isc/eventclass.h>
-#include <isc/lang.h>
-#include <isc/netmgr.h>
-#include <isc/refcount.h>
-#include <isc/stdtime.h>
-#include <isc/types.h>
-#include <isc/util.h>
-
-#if TASKMGR_TRACE
-#define ISC__TASKTRACE_SIZE 8
-#define ISC__TASKFILELINE , __func__, __FILE__, __LINE__
-#define ISC__TASKFLARG , const char *func, const char *file, unsigned int line
-
-#else
-#define ISC__TASKFILELINE
-#define ISC__TASKFLARG
-#endif
-
-#define ISC_TASKEVENT_SHUTDOWN (ISC_EVENTCLASS_TASK + 0)
-#define ISC_TASKEVENT_TEST (ISC_EVENTCLASS_TASK + 1)
-
-/*****
- ***** Tasks.
- *****/
-
-ISC_LANG_BEGINDECLS
-
-/***
- *** Types
- ***/
-
-#define isc_task_create(manager, taskp, tid) \
- isc__task_create(manager, taskp, tid ISC__TASKFILELINE)
-
-isc_result_t
-isc__task_create(isc_taskmgr_t *manager, isc_task_t **taskp,
- int tid ISC__TASKFLARG);
-/*%<
- * Create a task, bound to a particular thread id.
- *
- * Requires:
- *
- *\li 'manager' is a valid task manager.
- *
- *\li taskp != NULL && *taskp == NULL
- *
- * Ensures:
- *
- *\li On success, '*taskp' is bound to the new task.
- *
- * Returns:
- *
- *\li #ISC_R_SUCCESS
- *\li #ISC_R_UNEXPECTED
- *\li #ISC_R_SHUTTINGDOWN
- */
-
-ISC_REFCOUNT_DECL(isc_task);
-
-void
-isc_task_send(isc_task_t *task, isc_event_t **eventp);
-/*%<
- * Send '*event' to 'task'.
- *
- * Requires:
- *
- *\li 'task' is a valid task.
- *\li eventp != NULL && *eventp != NULL.
- *
- * Ensures:
- *
- *\li *eventp == NULL.
- */
-
-void
-isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp);
-/*%<
- * Send '*event' to '*taskp' and then detach '*taskp' from its
- * task.
- *
- * Requires:
- *
- *\li '*taskp' is a valid task.
- *\li eventp != NULL && *eventp != NULL.
- *
- * Ensures:
- *
- *\li *eventp == NULL.
- *
- *\li *taskp == NULL.
- *
- *\li If '*taskp' is the last reference to the task, the task is
- * idle (has an empty event queue), and has not been shutdown,
- * the task will be shutdown.
- *
- *\li If '*taskp' is the last reference to the task and
- * the task has been shutdown,
- * all resources used by the task will be freed.
- */
-
-void
-isc_task_setname(isc_task_t *task, const char *name, void *tag);
-/*%<
- * Name 'task'.
- *
- * Notes:
- *
- *\li Only the first 15 characters of 'name' will be copied.
- *
- *\li Naming a task is currently only useful for debugging purposes.
- *
- * Requires:
- *
- *\li 'task' is a valid task.
- */
-
-isc_loopmgr_t *
-isc_task_getloopmgr(isc_task_t *task);
-
-const char *
-isc_task_getname(isc_task_t *task);
-/*%<
- * Get the name of 'task', as previously set using isc_task_setname().
- *
- * Notes:
- *\li This function is for debugging purposes only.
- *
- * Requires:
- *\li 'task' is a valid task.
- *
- * Returns:
- *\li A non-NULL pointer to a null-terminated string.
- * If the task has not been named, the string is
- * empty.
- *
- */
-
-void *
-isc_task_gettag(isc_task_t *task);
-/*%<
- * Get the tag value for 'task', as previously set using isc_task_settag().
- *
- * Notes:
- *\li This function is for debugging purposes only.
- *
- * Requires:
- *\li 'task' is a valid task.
- */
-
-void
-isc_task_beginexclusive(isc_task_t *task);
-/*%<
- * Request exclusive access for 'task', which must be the calling
- * task. Waits for any other concurrently executing tasks to finish their
- * current event, and prevents any new events from executing in any of the
- * tasks sharing a task manager with 'task'.
- * It also pauses processing of network events in netmgr if it was provided
- * when taskmgr was created.
- *
- * The exclusive access must be relinquished by calling
- * isc_task_endexclusive() before returning from the current event handler.
- *
- * Requires:
- *\li 'task' is the calling task.
- *
- * Returns:
- *\li #ISC_R_SUCCESS The current task now has exclusive access.
- *\li #ISC_R_LOCKBUSY Another task has already requested exclusive
- * access.
- */
-
-void
-isc_task_endexclusive(isc_task_t *task);
-/*%<
- * Relinquish the exclusive access obtained by
- *isc_task_beginexclusive(), allowing other tasks to execute.
- *
- * Requires:
- *\li 'task' is the calling task, and has obtained
- * exclusive access by calling isc_task_spl().
- */
-
-/*****
- ***** Task Manager.
- *****/
-
-void
-isc_taskmgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
- isc_taskmgr_t **managerp);
-/*%<
- * Create a new task manager.
- *
- * Notes:
- *
- *\li This is meant to be called from isc_managers_create().
- *
- * Requires:
- *
- *\li 'mctx' is a valid memory context.
-
- *\li 'loopmgr' is a valid loop manager.
- *
- *\li managerp != NULL && *managerp == NULL
- *
- * Ensures:
- *
- *\li On success, '*managerp' will be attached to the newly created task
- * manager.
- *
- * Returns:
- *
- *\li #ISC_R_SUCCESS
- *\li #ISC_R_NOMEMORY
- *\li #ISC_R_NOTHREADS No threads could be created.
- *\li #ISC_R_UNEXPECTED An unexpected error occurred.
- *\li #ISC_R_SHUTTINGDOWN The non-threaded, shared, task
- * manager shutting down.
- */
-
-void
-isc_taskmgr_destroy(isc_taskmgr_t **managerp);
-/*%<
- * Destroy '*managerp'.
- *
- * Notes:
- *
- *\li Calling isc__taskmgr_destroy() will shut down all tasks managed by
- * *managerp that haven't already been shutdown. The call will block
- * until all tasks have entered the done state.
- *
- *\li isc__taskmgr_destroy() must not be called by a task event action,
- * because it would block forever waiting for the event action to
- * complete. An event action that wants to cause task manager shutdown
- * should request some non-event action thread of execution to do the
- * shutdown, e.g. by signaling a condition variable or using
- * isc_loopmgr_shutdown().
- *
- *\li The task manager is reference counted and will be destroyed when
- * the last reference is detached. The only difference between this
- * function and isc_task_detach() is that this one will assert if
- * more than 1 reference is held. This function is only meant to be
- * called from isc_managers_destroy(), by which time all other
- * references should have been detached. If any are still being held,
- * it's a programming error, and we want to crash.
- *
- * Requires:
- *
- *\li '*managerp' is a valid task manager.
- *
- *\li No other references to the task manager are being held.
- */
-
-void
-isc_taskmgr_attach(isc_taskmgr_t *, isc_taskmgr_t **);
-void
-isc_taskmgr_detach(isc_taskmgr_t **);
-/*%<
- * Attach/detach the task manager.
- */
-
-void
-isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task);
-/*%<
- * Set a task which will be used for all task-exclusive operations.
- *
- * Requires:
- *\li 'manager' is a valid task manager.
- *
- *\li 'task' is a valid task.
- */
-
-isc_result_t
-isc_taskmgr_excltask(isc_taskmgr_t *mgr, isc_task_t **taskp);
-/*%<
- * Attach '*taskp' to the task set by isc_taskmgr_getexcltask().
- * This task should be used whenever running in task-exclusive mode,
- * so as to prevent deadlock between two exclusive tasks.
- *
- * Requires:
- *\li 'manager' is a valid task manager.
- *
- *\li taskp != NULL && *taskp == NULL
- */
-
-#ifdef HAVE_LIBXML2
-int
-isc_taskmgr_renderxml(isc_taskmgr_t *mgr, void *writer0);
-#endif /* ifdef HAVE_LIBXML2 */
-
-#ifdef HAVE_JSON_C
-isc_result_t
-isc_taskmgr_renderjson(isc_taskmgr_t *mgr, void *tasksobj0);
-#endif /* HAVE_JSON_C */
-
-ISC_LANG_ENDDECLS
typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region
*/
typedef struct isc_counter isc_counter_t; /*%< Counter */
-typedef struct isc_event isc_event_t; /*%< Event */
-typedef ISC_LIST(isc_event_t) isc_eventlist_t; /*%< Event List */
-typedef unsigned int isc_eventtype_t; /*%< Event Type */
-typedef uint32_t isc_fsaccess_t; /*%< FS Access */
-typedef struct isc_hash isc_hash_t; /*%< Hash */
-typedef struct isc_httpd isc_httpd_t; /*%< HTTP client */
+typedef uint32_t isc_fsaccess_t; /*%< FS Access */
+typedef struct isc_hash isc_hash_t; /*%< Hash */
+typedef struct isc_httpd isc_httpd_t; /*%< HTTP client */
typedef void(isc_httpdfree_t)(isc_buffer_t *, void *); /*%< HTTP free function
*/
typedef struct isc_httpdmgr isc_httpdmgr_t; /*%< HTTP manager */
typedef struct isc_stats isc_stats_t; /*%< Statistics */
typedef int_fast64_t isc_statscounter_t;
typedef struct isc_symtab isc_symtab_t; /*%< Symbol Table */
-typedef struct isc_task isc_task_t; /*%< Task */
-typedef struct isc_taskmgr isc_taskmgr_t; /*%< Task Manager */
typedef struct isc_textregion isc_textregion_t; /*%< Text Region */
typedef struct isc_time isc_time_t; /*%< Time */
typedef struct isc_timer isc_timer_t; /*%< Timer */
/*%< HTTP endpoints set */
#endif /* HAVE_LIBNGHTTP2 */
-typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *);
-
/*% Statistics formats (text file or XML) */
typedef enum {
isc_statsformat_file,
#include <isc/condition.h>
#include <isc/job.h>
#include <isc/list.h>
+#include <isc/log.h>
#include <isc/loop.h>
#include <isc/magic.h>
#include <isc/mem.h>
isc_loopmgr_pause(isc_loopmgr_t *loopmgr) {
REQUIRE(VALID_LOOPMGR(loopmgr));
+ if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
+ isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
+ "loop exclusive mode: starting");
+ }
+
for (size_t i = 0; i < loopmgr->nloops; i++) {
isc_loop_t *loop = &loopmgr->loops[i];
RUNTIME_CHECK(atomic_compare_exchange_strong(&loopmgr->paused,
&(bool){ false }, true));
pause_loop(CURRENT_LOOP(loopmgr));
+
+ if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
+ isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
+ "loop exclusive mode: started");
+ }
}
void
isc_loopmgr_resume(isc_loopmgr_t *loopmgr) {
REQUIRE(VALID_LOOPMGR(loopmgr));
+ if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
+ isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
+ "loop exclusive mode: ending");
+ }
+
RUNTIME_CHECK(atomic_compare_exchange_strong(&loopmgr->paused,
&(bool){ true }, false));
resume_loop(CURRENT_LOOP(loopmgr));
+
+ if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
+ isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
+ "loop exclusive mode: ended");
+ }
}
void
void
isc_managers_create(isc_mem_t **mctxp, uint32_t workers,
- isc_loopmgr_t **loopmgrp, isc_nm_t **netmgrp,
- isc_taskmgr_t **taskmgrp) {
+ isc_loopmgr_t **loopmgrp, isc_nm_t **netmgrp) {
REQUIRE(mctxp != NULL && *mctxp == NULL);
isc_mem_create(mctxp);
INSIST(*mctxp != NULL);
isc_netmgr_create(*mctxp, *loopmgrp, netmgrp);
INSIST(*netmgrp != NULL);
- REQUIRE(taskmgrp != NULL && *taskmgrp == NULL);
- isc_taskmgr_create(*mctxp, *loopmgrp, taskmgrp);
- INSIST(*taskmgrp != NULL);
-
isc_rwlock_setworkers(workers);
}
void
isc_managers_destroy(isc_mem_t **mctxp, isc_loopmgr_t **loopmgrp,
- isc_nm_t **netmgrp, isc_taskmgr_t **taskmgrp) {
+ isc_nm_t **netmgrp) {
REQUIRE(mctxp != NULL && *mctxp != NULL);
REQUIRE(loopmgrp != NULL && *loopmgrp != NULL);
REQUIRE(netmgrp != NULL && *netmgrp != NULL);
- REQUIRE(taskmgrp != NULL && *taskmgrp != NULL);
/*
* The sequence of operations here is important:
*/
- isc_taskmgr_destroy(taskmgrp);
isc_netmgr_destroy(netmgrp);
isc_loopmgr_destroy(loopmgrp);
isc_mem_destroy(mctxp);
#include <isc/sockaddr.h>
#include <isc/stats.h>
#include <isc/strerr.h>
-#include <isc/task.h>
#include <isc/thread.h>
#include <isc/tid.h>
#include <isc/tls.h>
#include <isc/mem.h>
#include <isc/ratelimiter.h>
#include <isc/refcount.h>
-#include <isc/task.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/util.h>
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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 <unistd.h>
-
-#include <isc/async.h>
-#include <isc/atomic.h>
-#include <isc/backtrace.h>
-#include <isc/condition.h>
-#include <isc/event.h>
-#include <isc/job.h>
-#include <isc/log.h>
-#include <isc/loop.h>
-#include <isc/magic.h>
-#include <isc/mem.h>
-#include <isc/once.h>
-#include <isc/random.h>
-#include <isc/refcount.h>
-#include <isc/string.h>
-#include <isc/task.h>
-#include <isc/thread.h>
-#include <isc/tid.h>
-#include <isc/time.h>
-#include <isc/util.h>
-#include <isc/uv.h>
-
-#ifdef HAVE_LIBXML2
-#include <libxml/xmlwriter.h>
-#define ISC_XMLCHAR (const xmlChar *)
-#endif /* HAVE_LIBXML2 */
-
-#ifdef HAVE_JSON_C
-#include <json_object.h>
-#endif /* HAVE_JSON_C */
-
-#include "loop_p.h"
-
-/*
- * Task manager is built around 'as little locking as possible' concept.
- * Each thread has his own queue of tasks to be run, if a task is in running
- * state it will stay on the runner it's currently on - that helps with data
- * locality on CPU.
- *
- * To make load even some tasks (from task pools) are bound to specific
- * queues using isc_task_create. This way load balancing between
- * CPUs/queues happens on the higher layer.
- */
-
-#ifdef ISC_TASK_TRACE
-#define XTRACE(m) \
- fprintf(stderr, "task %p.tid %zu thread %zu: %s\n", task, \
- (size_t)task->tid, (size_t)task->tid, (m))
-#define XTTRACE(t, m) \
- fprintf(stderr, "task %p thread %zu: %s\n", (t), (size_t)isc_tid(), (m))
-#define XTHREADTRACE(m) \
- fprintf(stderr, "thread %zu: %s\n", (size_t)isc_tid(), (m))
-#else /* ifdef ISC_TASK_TRACE */
-#define XTRACE(m)
-#define XTTRACE(t, m)
-#define XTHREADTRACE(m)
-#endif /* ifdef ISC_TASK_TRACE */
-
-/***
- *** Types.
- ***/
-
-typedef enum {
- task_state_idle, /* not doing anything, events queue empty */
- task_state_ready, /* waiting in worker's queue */
- task_state_running, /* actively processing events */
- task_state_done /* shutting down, no events or references */
-} task_state_t;
-
-#if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C)
-static const char *statenames[] = {
- "idle",
- "ready",
- "running",
- "done",
-};
-#endif /* if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C) */
-
-#define TASK_MAGIC ISC_MAGIC('T', 'A', 'S', 'K')
-#define VALID_TASK(t) ISC_MAGIC_VALID(t, TASK_MAGIC)
-
-#if TASKMGR_TRACE
-void
-isc__taskmgr_dump_active(isc_taskmgr_t *taskmgr);
-#endif
-
-struct isc_task {
- /* Not locked. */
- unsigned int magic;
- isc_taskmgr_t *manager;
- isc_mutex_t lock;
- /* Locked by task lock. */
- isc_loop_t *loop;
- uint32_t tid;
- task_state_t state;
- isc_refcount_t references;
- isc_eventlist_t events;
- unsigned int nevents;
- isc_stdtime_t now;
- isc_time_t tnow;
- char name[16];
- void *tag;
- /* Locked by task manager lock. */
-#if TASKMGR_TRACE
- char func[PATH_MAX];
- char file[PATH_MAX];
- unsigned int line;
- void *backtrace[ISC__TASKTRACE_SIZE];
- int backtrace_size;
-#endif
- LINK(isc_task_t) qlink;
- LINK(isc_task_t) link;
-};
-
-#define TASK_SHUTTINGDOWN(t) (atomic_load_acquire(&(t)->manager->shuttingdown))
-
-#define TASK_TASKMGR_MAGIC ISC_MAGIC('T', 'S', 'K', 'M')
-#define VALID_TASKMGR(m) ISC_MAGIC_VALID(m, TASK_TASKMGR_MAGIC)
-
-typedef ISC_LIST(isc_task_t) isc_tasklist_t;
-
-struct isc_taskmgr {
- /* Not locked. */
- unsigned int magic;
- isc_refcount_t references;
- isc_mem_t *mctx;
- isc_mutex_t lock;
- isc_loopmgr_t *loopmgr;
- uint32_t nloops;
-
- /* Locked by task manager lock. */
- isc_mutex_t *locks;
- isc_tasklist_t *tasks;
- atomic_uint_fast32_t mode;
- uint32_t exclusive_req;
- atomic_bool shuttingdown;
- isc_task_t *excl;
-};
-
-static void
-task_setstate(isc_task_t *task, task_state_t state);
-
-/***
- *** Tasks.
- ***/
-
-static void
-task_destroy(void *arg) {
- isc_task_t *task = arg;
- isc_loop_t *loop = task->loop;
- isc_taskmgr_t *taskmgr = task->manager;
- REQUIRE(EMPTY(task->events));
-
- XTRACE("task_finished");
-
- task_setstate(task, task_state_done);
-
- isc_refcount_destroy(&task->references);
-
- LOCK(&taskmgr->locks[task->tid]);
- UNLINK(taskmgr->tasks[task->tid], task, link);
- UNLOCK(&taskmgr->locks[task->tid]);
-
- isc_mutex_destroy(&task->lock);
- task->magic = 0;
-
- isc_mem_put(loop->mctx, task, sizeof(*task));
-
- isc_taskmgr_detach(&taskmgr);
-
- isc_loop_detach(&loop);
-}
-ISC_REFCOUNT_IMPL(isc_task, task_destroy);
-
-static isc_result_t
-task_run(isc_task_t *task);
-static void
-task_ready(isc_task_t *task);
-static void
-task__run(void *arg);
-
-isc_result_t
-isc__task_create(isc_taskmgr_t *taskmgr, isc_task_t **taskp,
- int tid ISC__TASKFLARG) {
- isc_task_t *task = NULL;
- isc_loop_t *loop = NULL;
-
- REQUIRE(VALID_TASKMGR(taskmgr));
- REQUIRE(taskp != NULL && *taskp == NULL);
- REQUIRE(tid >= 0 && tid < (int)taskmgr->nloops);
-
- if (atomic_load(&taskmgr->shuttingdown)) {
- return (ISC_R_SHUTTINGDOWN);
- }
-
- loop = isc_loop_get(taskmgr->loopmgr, tid);
-
- task = isc_mem_get(loop->mctx, sizeof(*task));
- *task = (isc_task_t){
- .tid = tid,
- .state = task_state_idle,
- };
-
- isc_loop_attach(loop, &task->loop);
-
-#if TASKMGR_TRACE
- strlcpy(task->func, func, sizeof(task->func));
- strlcpy(task->file, file, sizeof(task->file));
- task->line = line;
- task->backtrace_size = isc_backtrace(task->backtrace,
- ISC__TASKTRACE_SIZE);
-#endif
-
- isc_taskmgr_attach(taskmgr, &task->manager);
-
- isc_mutex_init(&task->lock);
-
- isc_refcount_init(&task->references, 1);
-
- INIT_LIST(task->events);
-
- isc_time_settoepoch(&task->tnow);
-
- INIT_LINK(task, link);
- INIT_LINK(task, qlink);
-
- task->magic = TASK_MAGIC;
-
- LOCK(&taskmgr->locks[task->tid]);
- APPEND(taskmgr->tasks[task->tid], task, link);
- UNLOCK(&taskmgr->locks[task->tid]);
-
- *taskp = task;
-
- return (ISC_R_SUCCESS);
-}
-
-static void
-task_setstate(isc_task_t *task, task_state_t state) {
- switch (state) {
- case task_state_idle:
- INSIST(task->state == task_state_running);
- break;
- case task_state_ready:
- if (task->state == task_state_idle) {
- INSIST(EMPTY(task->events));
- } else {
- INSIST(task->state == task_state_running);
- }
- break;
- case task_state_running:
- INSIST(task->state == task_state_ready);
- break;
- case task_state_done:
- INSIST(task->state == task_state_ready ||
- task->state == task_state_running ||
- task->state == task_state_idle);
- break;
- default:
- UNREACHABLE();
- }
-
- task->state = state;
-}
-
-static void
-task__run(void *arg) {
- isc_task_t *task = arg;
- isc_result_t result = task_run(task);
-
- switch (result) {
- case ISC_R_QUOTA:
- task_ready(task);
- break;
- case ISC_R_SUCCESS:
- case ISC_R_NOMORE:
- break;
- default:
- UNREACHABLE();
- }
-}
-
-/*
- * Moves a task onto the appropriate run queue.
- *
- * Caller must NOT hold queue lock.
- */
-static void
-task_ready(isc_task_t *task) {
- isc_async_run(task->loop, task__run, task);
-}
-
-static bool
-task_send(isc_task_t *task, isc_event_t **eventp) {
- bool was_idle = false;
- isc_event_t *event;
-
- /*
- * Caller must be holding the task lock.
- */
-
- REQUIRE(eventp != NULL);
- event = *eventp;
- *eventp = NULL;
- REQUIRE(event != NULL);
- REQUIRE(task->state != task_state_done);
- REQUIRE(!ISC_LINK_LINKED(event, ev_ratelink));
-
- XTRACE("task_send");
-
- if (task->state == task_state_idle) {
- was_idle = true;
- task_setstate(task, task_state_ready);
- isc_task_attach(task, &(isc_task_t *){ NULL });
- }
- INSIST(task->state == task_state_ready ||
- task->state == task_state_running);
- ENQUEUE(task->events, event, ev_link);
-
- return (was_idle);
-}
-
-void
-isc_task_send(isc_task_t *task, isc_event_t **eventp) {
- bool was_idle;
-
- /*
- * Send '*event' to 'task'.
- */
-
- REQUIRE(VALID_TASK(task));
- XTRACE("isc_task_send");
-
- /*
- * We're trying hard to hold locks for as short a time as possible.
- * We're also trying to hold as few locks as possible. This is why
- * some processing is deferred until after the lock is released.
- */
- LOCK(&task->lock);
- was_idle = task_send(task, eventp);
- UNLOCK(&task->lock);
-
- if (was_idle) {
- /*
- * We need to add this task to the ready queue.
- *
- * We've waited until now to do it because making a task
- * ready requires locking the manager. If we tried to do
- * this while holding the task lock, we could deadlock.
- *
- * We've changed the state to ready, so no one else will
- * be trying to add this task to the ready queue. The
- * only way to leave the ready state is by executing the
- * task. It thus doesn't matter if events are added,
- * removed, or a shutdown is started in the interval
- * between the time we released the task lock, and the time
- * we add the task to the ready queue.
- */
- task_ready(task);
- }
-}
-
-void
-isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) {
- isc_task_t *task = NULL;
-
- REQUIRE(taskp != NULL);
-
- task = *taskp;
- *taskp = NULL;
-
- REQUIRE(VALID_TASK(task));
- XTRACE("isc_task_sendanddetach");
-
- isc_task_send(task, eventp);
- isc_task_detach(&task);
-}
-
-void
-isc_task_setname(isc_task_t *task, const char *name, void *tag) {
- /*
- * Name 'task'.
- */
-
- REQUIRE(VALID_TASK(task));
-
- LOCK(&task->lock);
- strlcpy(task->name, name, sizeof(task->name));
- task->tag = tag;
- UNLOCK(&task->lock);
-}
-
-isc_loopmgr_t *
-isc_task_getloopmgr(isc_task_t *task) {
- REQUIRE(VALID_TASK(task));
-
- return (task->manager->loopmgr);
-}
-
-const char *
-isc_task_getname(isc_task_t *task) {
- REQUIRE(VALID_TASK(task));
-
- return (task->name);
-}
-
-void *
-isc_task_gettag(isc_task_t *task) {
- REQUIRE(VALID_TASK(task));
-
- return (task->tag);
-}
-
-/***
- *** Task Manager.
- ***/
-
-static isc_result_t
-task_run(isc_task_t *task) {
- isc_event_t *event = NULL;
- isc_result_t result = ISC_R_UNSET;
- isc_eventlist_t events;
-
- REQUIRE(VALID_TASK(task));
-
- LOCK(&task->lock);
-
- ISC_LIST_INIT(events);
- ISC_LIST_MOVE(events, task->events);
-
- REQUIRE(task->state == task_state_ready);
-
- task_setstate(task, task_state_running);
- XTRACE("running");
- XTRACE(task->name);
- TIME_NOW(&task->tnow);
- task->now = isc_time_seconds(&task->tnow);
- UNLOCK(&task->lock);
-
- event = ISC_LIST_HEAD(events);
- while (event != NULL) {
- isc_event_t *next = ISC_LIST_NEXT(event, ev_link);
- ISC_LIST_UNLINK(events, event, ev_link);
-
- /*
- * Execute the event action.
- */
- XTRACE("execute action");
- XTRACE(task->name);
- if (event->ev_action != NULL) {
- (event->ev_action)(task, event);
- }
- XTRACE("execution complete");
-
- event = next;
- }
-
- LOCK(&task->lock);
- if (EMPTY(task->events)) {
- /*
- * Nothing else to do for this task right now.
- */
- XTRACE("empty");
- XTRACE("idling");
- task_setstate(task, task_state_idle);
-
- result = ISC_R_SUCCESS;
- } else {
- /*
- * More tasks were scheduled.
- */
- XTRACE("quantum");
- task_setstate(task, task_state_ready);
- result = ISC_R_QUOTA;
- }
- UNLOCK(&task->lock);
-
- if (result == ISC_R_SUCCESS) {
- isc_task_detach(&task);
- }
-
- return (result);
-}
-
-static void
-taskmgr_destroy(isc_taskmgr_t *taskmgr) {
- taskmgr->magic = 0;
-
- for (size_t tid = 0; tid < taskmgr->nloops; tid++) {
- INSIST(EMPTY(taskmgr->tasks[tid]));
- isc_mutex_destroy(&taskmgr->locks[tid]);
- }
-
- isc_mem_put(taskmgr->mctx, taskmgr->tasks,
- taskmgr->nloops * sizeof(taskmgr->tasks[0]));
- isc_mem_put(taskmgr->mctx, taskmgr->locks,
- taskmgr->nloops * sizeof(taskmgr->locks[0]));
-
- isc_refcount_destroy(&taskmgr->references);
- isc_mutex_destroy(&taskmgr->lock);
- isc_mem_putanddetach(&taskmgr->mctx, taskmgr, sizeof(*taskmgr));
-}
-
-void
-isc_taskmgr_attach(isc_taskmgr_t *source, isc_taskmgr_t **targetp) {
- REQUIRE(VALID_TASKMGR(source));
- REQUIRE(targetp != NULL && *targetp == NULL);
-
- isc_refcount_increment(&source->references);
-
- *targetp = source;
-}
-
-void
-isc_taskmgr_detach(isc_taskmgr_t **managerp) {
- REQUIRE(managerp != NULL);
- REQUIRE(VALID_TASKMGR(*managerp));
-
- isc_taskmgr_t *manager = *managerp;
- *managerp = NULL;
-
- if (isc_refcount_decrement(&manager->references) == 1) {
- taskmgr_destroy(manager);
- }
-}
-
-static void
-taskmgr_teardown(void *arg) {
- isc_taskmgr_t *taskmgr = (void *)arg;
- uint32_t tid = isc_tid();
- isc_task_t *excl = NULL;
-
- REQUIRE(VALID_TASKMGR(taskmgr));
-
- atomic_store(&taskmgr->shuttingdown, true);
-
- isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR,
- ISC_LOG_DEBUG(1), "Shutting down task manager");
-
- LOCK(&taskmgr->lock);
- if (taskmgr->excl != NULL && taskmgr->excl->tid == tid) {
- XTTRACE(taskmgr->excl, "taskmgr_teardown: excl");
- excl = taskmgr->excl;
- taskmgr->excl = NULL;
- }
- UNLOCK(&taskmgr->lock);
- if (excl != NULL) {
- isc_task_detach(&excl);
- }
-}
-
-void
-isc_taskmgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
- isc_taskmgr_t **taskmgrp) {
- isc_taskmgr_t *taskmgr = NULL;
-
- /*
- * Create a new task manager.
- */
-
- REQUIRE(taskmgrp != NULL && *taskmgrp == NULL);
-
- taskmgr = isc_mem_get(mctx, sizeof(*taskmgr));
- *taskmgr = (isc_taskmgr_t){
- .loopmgr = loopmgr,
- .magic = TASK_TASKMGR_MAGIC,
- .nloops = isc_loopmgr_nloops(loopmgr),
- };
-
- isc_mem_attach(mctx, &taskmgr->mctx);
-
- isc_mutex_init(&taskmgr->lock);
-
- taskmgr->tasks = isc_mem_get(
- taskmgr->mctx, taskmgr->nloops * sizeof(taskmgr->tasks[0]));
- taskmgr->locks = isc_mem_get(
- taskmgr->mctx, taskmgr->nloops * sizeof(taskmgr->locks[0]));
-
- for (size_t tid = 0; tid < taskmgr->nloops; tid++) {
- isc_mutex_init(&taskmgr->locks[tid]);
- ISC_LIST_INIT(taskmgr->tasks[tid]);
- }
-
- isc_loopmgr_teardown(loopmgr, taskmgr_teardown, taskmgr);
-
- isc_refcount_init(&taskmgr->references, 1);
-
- *taskmgrp = taskmgr;
-}
-
-void
-isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
- isc_taskmgr_t *manager = NULL;
- uint_fast32_t refs;
-
- REQUIRE(managerp != NULL && VALID_TASKMGR(*managerp));
- XTHREADTRACE("isc_taskmgr_destroy");
-
- manager = *managerp;
- *managerp = NULL;
-
- /*
- * The isc_loopmgr is not running, there's nothing that can finish now
- */
- refs = isc_refcount_decrement(&manager->references);
-#if TASKMGR_TRACE
- if (refs > 1) {
- isc__taskmgr_dump_active(*managerp);
- }
-#endif
- INSIST(refs == 1);
- taskmgr_destroy(manager);
-}
-
-void
-isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task) {
- REQUIRE(VALID_TASKMGR(mgr));
- REQUIRE(VALID_TASK(task));
-
- LOCK(&task->lock);
- REQUIRE(task->tid == 0);
- UNLOCK(&task->lock);
-
- LOCK(&mgr->lock);
- if (mgr->excl != NULL) {
- isc_task_detach(&mgr->excl);
- }
- isc_task_attach(task, &mgr->excl);
- UNLOCK(&mgr->lock);
-}
-
-isc_result_t
-isc_taskmgr_excltask(isc_taskmgr_t *mgr, isc_task_t **taskp) {
- isc_result_t result;
-
- REQUIRE(VALID_TASKMGR(mgr));
- REQUIRE(taskp != NULL && *taskp == NULL);
-
- if (atomic_load(&mgr->shuttingdown)) {
- return (ISC_R_SHUTTINGDOWN);
- }
-
- LOCK(&mgr->lock);
- if (mgr->excl != NULL) {
- isc_task_attach(mgr->excl, taskp);
- result = ISC_R_SUCCESS;
- } else {
- result = ISC_R_NOTFOUND;
- }
- UNLOCK(&mgr->lock);
-
- return (result);
-}
-
-void
-isc_task_beginexclusive(isc_task_t *task) {
- isc_taskmgr_t *manager;
- bool first;
-
- REQUIRE(VALID_TASK(task));
-
- manager = task->manager;
-
- REQUIRE(task->state == task_state_running);
-
- LOCK(&manager->lock);
- REQUIRE(task == manager->excl ||
- (atomic_load(&manager->shuttingdown) && manager->excl == NULL));
- first = (manager->exclusive_req++ == 0);
- UNLOCK(&manager->lock);
-
- if (!first) {
- return;
- }
-
- if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
- isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
- ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
- "exclusive task mode: %s", "starting");
- }
-
- isc_loopmgr_pause(manager->loopmgr);
-
- if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
- isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
- ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
- "exclusive task mode: %s", "started");
- }
-}
-
-void
-isc_task_endexclusive(isc_task_t *task) {
- isc_taskmgr_t *manager = NULL;
- bool last;
-
- REQUIRE(VALID_TASK(task));
- REQUIRE(task->state == task_state_running);
-
- manager = task->manager;
-
- LOCK(&manager->lock);
- INSIST(manager->exclusive_req > 0);
- last = (--manager->exclusive_req == 0);
- UNLOCK(&manager->lock);
-
- if (!last) {
- return;
- }
-
- if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
- isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
- ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
- "exclusive task mode: %s", "ending");
- }
-
- isc_loopmgr_resume(manager->loopmgr);
-
- if (isc_log_wouldlog(isc_lctx, ISC_LOG_DEBUG(1))) {
- isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
- ISC_LOGMODULE_OTHER, ISC_LOG_DEBUG(1),
- "exclusive task mode: %s", "ended");
- }
-}
-
-#ifdef HAVE_LIBXML2
-#define TRY0(a) \
- do { \
- xmlrc = (a); \
- if (xmlrc < 0) \
- goto error; \
- } while (0)
-int
-isc_taskmgr_renderxml(isc_taskmgr_t *mgr, void *writer0) {
- isc_task_t *task = NULL;
- int xmlrc;
- xmlTextWriterPtr writer = (xmlTextWriterPtr)writer0;
-
- LOCK(&mgr->lock);
-
- TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "tasks"));
- for (size_t tid = 0; tid < mgr->nloops; tid++) {
- for (task = ISC_LIST_HEAD(mgr->tasks[tid]); task != NULL;
- task = ISC_LIST_NEXT(task, link))
- {
- LOCK(&task->lock);
- TRY0(xmlTextWriterStartElement(writer,
- ISC_XMLCHAR "task"));
-
- if (task->name[0] != 0) {
- TRY0(xmlTextWriterStartElement(
- writer, ISC_XMLCHAR "name"));
- TRY0(xmlTextWriterWriteFormatString(
- writer, "%s", task->name));
- TRY0(xmlTextWriterEndElement(writer)); /* name
- */
- }
-
- TRY0(xmlTextWriterStartElement(writer,
- ISC_XMLCHAR "reference"
- "s"));
- TRY0(xmlTextWriterWriteFormatString(
- writer, "%" PRIuFAST32,
- isc_refcount_current(&task->references)));
- TRY0(xmlTextWriterEndElement(writer)); /* references */
-
- TRY0(xmlTextWriterStartElement(writer,
- ISC_XMLCHAR "id"));
- TRY0(xmlTextWriterWriteFormatString(writer, "%p",
- task));
- TRY0(xmlTextWriterEndElement(writer)); /* id */
-
- TRY0(xmlTextWriterStartElement(writer,
- ISC_XMLCHAR "state"));
- TRY0(xmlTextWriterWriteFormatString(
- writer, "%s", statenames[task->state]));
- TRY0(xmlTextWriterEndElement(writer)); /* state */
-
- TRY0(xmlTextWriterEndElement(writer));
-
- UNLOCK(&task->lock);
- }
- }
- TRY0(xmlTextWriterEndElement(writer)); /* tasks */
-
-error:
- if (task != NULL) {
- UNLOCK(&task->lock);
- }
- UNLOCK(&mgr->lock);
-
- return (xmlrc);
-}
-#endif /* HAVE_LIBXML2 */
-
-#ifdef HAVE_JSON_C
-#define CHECKMEM(m) \
- do { \
- if (m == NULL) { \
- result = ISC_R_NOMEMORY; \
- goto error; \
- } \
- } while (0)
-
-isc_result_t
-isc_taskmgr_renderjson(isc_taskmgr_t *mgr, void *tasks0) {
- isc_result_t result = ISC_R_SUCCESS;
- isc_task_t *task = NULL;
- json_object *obj = NULL, *array = NULL, *taskobj = NULL;
- json_object *tasks = (json_object *)tasks0;
-
- LOCK(&mgr->lock);
-
- array = json_object_new_array();
- CHECKMEM(array);
-
- for (size_t tid = 0; tid < mgr->nloops; tid++) {
- for (task = ISC_LIST_HEAD(mgr->tasks[tid]); task != NULL;
- task = ISC_LIST_NEXT(task, link))
- {
- char buf[255];
-
- LOCK(&task->lock);
-
- taskobj = json_object_new_object();
- CHECKMEM(taskobj);
- json_object_array_add(array, taskobj);
-
- snprintf(buf, sizeof(buf), "%p", task);
- obj = json_object_new_string(buf);
- CHECKMEM(obj);
- json_object_object_add(taskobj, "id", obj);
-
- if (task->name[0] != 0) {
- obj = json_object_new_string(task->name);
- CHECKMEM(obj);
- json_object_object_add(taskobj, "name", obj);
- }
-
- obj = json_object_new_int(
- isc_refcount_current(&task->references));
- CHECKMEM(obj);
- json_object_object_add(taskobj, "references", obj);
-
- obj = json_object_new_string(statenames[task->state]);
- CHECKMEM(obj);
- json_object_object_add(taskobj, "state", obj);
-
- UNLOCK(&task->lock);
- }
- }
-
- json_object_object_add(tasks, "tasks", array);
- array = NULL;
- result = ISC_R_SUCCESS;
-
-error:
- if (array != NULL) {
- json_object_put(array);
- }
-
- if (task != NULL) {
- UNLOCK(&task->lock);
- }
- UNLOCK(&mgr->lock);
-
- return (result);
-}
-#endif /* ifdef HAVE_JSON_C */
-
-#if TASKMGR_TRACE
-
-static void
-event_dump(isc_event_t *event) {
- fprintf(stderr, " - event: %p\n", event);
- fprintf(stderr, " func: %s\n", event->func);
- fprintf(stderr, " file: %s\n", event->file);
- fprintf(stderr, " line: %u\n", event->line);
- fprintf(stderr, " backtrace: |\n");
- isc_backtrace_symbols_fd(event->backtrace, event->backtrace_size,
- STDERR_FILENO);
-}
-
-static void
-task_dump(isc_task_t *task) {
- LOCK(&task->lock);
- fprintf(stderr, "- task: %p\n", task);
- fprintf(stderr, " tid: %" PRIu32 "\n", task->tid);
- fprintf(stderr, " nevents: %u\n", task->nevents);
- fprintf(stderr, " func: %s\n", task->func);
- fprintf(stderr, " file: %s\n", task->file);
- fprintf(stderr, " line: %u\n", task->line);
- fprintf(stderr, " backtrace: |\n");
- isc_backtrace_symbols_fd(task->backtrace, task->backtrace_size,
- STDERR_FILENO);
- fprintf(stderr, "\n");
-
- for (isc_event_t *event = ISC_LIST_HEAD(task->events); event != NULL;
- event = ISC_LIST_NEXT(event, ev_link))
- {
- event_dump(event);
- }
-
- UNLOCK(&task->lock);
-}
-
-void
-isc__taskmgr_dump_active(isc_taskmgr_t *taskmgr) {
- LOCK(&taskmgr->lock);
- fprintf(stderr, "- taskmgr: %p\n", taskmgr);
-
- for (size_t tid = 0; tid < taskmgr->nloops; tid++) {
- for (isc_task_t *task = ISC_LIST_HEAD(taskmgr->tasks[tid]);
- task != NULL; task = ISC_LIST_NEXT(task, link))
- {
- task_dump(task);
- }
- }
-
- UNLOCK(&taskmgr->lock);
-}
-
-#endif
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/refcount.h>
-#include <isc/task.h>
#include <isc/thread.h>
#include <isc/time.h>
#include <isc/timer.h>
include/isccc/base64.h \
include/isccc/cc.h \
include/isccc/ccmsg.h \
- include/isccc/events.h \
include/isccc/sexpr.h \
include/isccc/symtab.h \
include/isccc/symtype.h \
#include <isc/util.h>
#include <isccc/ccmsg.h>
-#include <isccc/events.h>
#define CCMSG_MAGIC ISC_MAGIC('C', 'C', 'm', 's')
#define VALID_CCMSG(foo) ISC_MAGIC_VALID(foo, CCMSG_MAGIC)
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0 AND 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.
- */
-
-/*
- * Copyright (C) 2001 Nominum, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#pragma once
-
-/*! \file isccc/events.h */
-
-#include <isc/eventclass.h>
-
-/*%
- * Registry of ISCCC event numbers.
- */
-
-#define ISCCC_EVENT_CCMSG (ISC_EVENTCLASS_ISCCC + 0)
libns_la_HEADERS = \
include/ns/client.h \
- include/ns/events.h \
include/ns/hooks.h \
include/ns/interfacemgr.h \
include/ns/listenlist.h \
#include <isc/stats.h>
#include <isc/stdio.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/thread.h>
#include <isc/tid.h>
#include <isc/timer.h>
#include <dns/dispatch.h>
#include <dns/dnstap.h>
#include <dns/edns.h>
-#include <dns/events.h>
#include <dns/message.h>
#include <dns/peer.h>
#include <dns/rcode.h>
* need for locking.
*
* If a routine is ever created that allows someone other than the client's
- * task to change the client, then the client will have to be locked.
+ * loop to change the client, then the client will have to be locked.
*/
#ifdef NS_CLIENT_TRACE
ns_clientmgr_t *manager = (ns_clientmgr_t *)arg;
MTRACE("clientmgr_destroy");
- isc_refcount_destroy(&manager->references);
manager->magic = 0;
+ isc_refcount_destroy(&manager->references);
+
+ isc_loop_detach(&manager->loop);
+
dns_aclenv_detach(&manager->aclenv);
isc_mutex_destroy(&manager->reclock);
- isc_task_detach(&manager->task);
ns_server_detach(&manager->sctx);
isc_mem_putanddetach(&manager->mctx, manager, sizeof(*manager));
static void
clientmgr_destroy(ns_clientmgr_t *mgr) {
- isc_loop_t *loop = isc_loop_get(mgr->loopmgr, mgr->tid);
- isc_async_run(loop, clientmgr_destroy_cb, mgr);
+ isc_async_run(mgr->loop, clientmgr_destroy_cb, mgr);
}
ISC_REFCOUNT_IMPL(ns_clientmgr, clientmgr_destroy);
isc_result_t
-ns_clientmgr_create(ns_server_t *sctx, isc_taskmgr_t *taskmgr,
- isc_loopmgr_t *loopmgr, dns_aclenv_t *aclenv, int tid,
- ns_clientmgr_t **managerp) {
+ns_clientmgr_create(ns_server_t *sctx, isc_loopmgr_t *loopmgr,
+ dns_aclenv_t *aclenv, int tid, ns_clientmgr_t **managerp) {
ns_clientmgr_t *manager = NULL;
isc_mem_t *mctx = NULL;
- isc_result_t result;
isc_mem_create(&mctx);
isc_mem_setname(mctx, "clientmgr");
manager = isc_mem_get(mctx, sizeof(*manager));
- *manager = (ns_clientmgr_t){ .magic = 0, .mctx = mctx };
-
+ *manager = (ns_clientmgr_t){
+ .magic = 0,
+ .mctx = mctx,
+ .tid = tid,
+ .recursing = ISC_LIST_INITIALIZER,
+ };
+ isc_loop_attach(isc_loop_get(loopmgr, tid), &manager->loop);
isc_mutex_init(&manager->reclock);
-
- manager->taskmgr = taskmgr;
- manager->loopmgr = loopmgr;
- manager->tid = tid;
- manager->loop = isc_loop_get(loopmgr, tid);
-
dns_aclenv_attach(aclenv, &manager->aclenv);
-
- result = isc_task_create(manager->taskmgr, &manager->task,
- manager->tid);
- RUNTIME_CHECK(result == ISC_R_SUCCESS);
- isc_task_setname(manager->task, "clientmgr", NULL);
-
isc_refcount_init(&manager->references, 1);
- manager->sctx = NULL;
ns_server_attach(sctx, &manager->sctx);
- ISC_LIST_INIT(manager->recursing);
-
manager->magic = MANAGER_MAGIC;
MTRACE("create");
isc_mem_t *mctx;
ns_server_t *sctx;
- isc_taskmgr_t *taskmgr;
- isc_loopmgr_t *loopmgr;
isc_refcount_t references;
uint32_t tid;
- isc_task_t *task;
isc_loop_t *loop;
dns_aclenv_t *aclenv;
*/
isc_result_t
-ns_clientmgr_create(ns_server_t *sctx, isc_taskmgr_t *taskmgr,
- isc_loopmgr_t *loopmgr, dns_aclenv_t *aclenv, int tid,
- ns_clientmgr_t **managerp);
+ns_clientmgr_create(ns_server_t *sctx, isc_loopmgr_t *loopmgr,
+ dns_aclenv_t *aclenv, int tid, ns_clientmgr_t **managerp);
/*%<
* Create a client manager.
*/
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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
-
-#include <isc/eventclass.h>
-
-/*! \file ns/events.h
- * \brief
- * Registry of NS event numbers.
- */
-
-#define NS_EVENT_CLIENTCONTROL (ISC_EVENTCLASS_NS + 0)
-#define NS_EVENT_HOOKASYNCDONE (ISC_EVENTCLASS_NS + 1)
-#define NS_EVENT_IFSCAN (ISC_EVENTCLASS_NS + 2)
#include <stdbool.h>
-#include <isc/event.h>
#include <isc/list.h>
#include <isc/magic.h>
#include <isc/mem.h>
isc_result_t
ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
- isc_loopmgr_t *loopmgr, isc_taskmgr_t *taskmgr,
- isc_nm_t *nm, dns_dispatchmgr_t *dispatchmgr,
- isc_task_t *task, dns_geoip_databases_t *geoip,
- bool scan, ns_interfacemgr_t **mgrp);
+ isc_loopmgr_t *loopmgr, isc_nm_t *nm,
+ dns_dispatchmgr_t *dispatchmgr,
+ dns_geoip_databases_t *geoip, bool scan,
+ ns_interfacemgr_t **mgrp);
/*%<
* Create a new interface manager.
*
#include <dns/acl.h>
#include <dns/types.h>
-#include <ns/events.h>
#include <ns/types.h>
#define NS_SERVER_LOGQUERIES 0x00000001U /*%< log queries */
#include <isc/os.h>
#include <isc/random.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/tid.h>
#include <isc/util.h>
isc_mem_t *mctx; /*%< Memory context */
ns_server_t *sctx; /*%< Server context */
isc_loopmgr_t *loopmgr; /*%< Loop manager */
- isc_taskmgr_t *taskmgr; /*%< Task manager */
- isc_task_t *task; /*%< Task */
isc_nm_t *nm; /*%< Net manager */
uint32_t ncpus; /*%< Number of workers */
dns_dispatchmgr_t *dispatchmgr;
isc_result_t
ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
- isc_loopmgr_t *loopmgr, isc_taskmgr_t *taskmgr,
- isc_nm_t *nm, dns_dispatchmgr_t *dispatchmgr,
- isc_task_t *task, dns_geoip_databases_t *geoip,
- bool scan, ns_interfacemgr_t **mgrp) {
+ isc_loopmgr_t *loopmgr, isc_nm_t *nm,
+ dns_dispatchmgr_t *dispatchmgr,
+ dns_geoip_databases_t *geoip, bool scan,
+ ns_interfacemgr_t **mgrp) {
isc_result_t result;
ns_interfacemgr_t *mgr = NULL;
- UNUSED(task);
-
REQUIRE(mctx != NULL);
REQUIRE(mgrp != NULL);
REQUIRE(*mgrp == NULL);
mgr = isc_mem_get(mctx, sizeof(*mgr));
*mgr = (ns_interfacemgr_t){
.loopmgr = loopmgr,
- .taskmgr = taskmgr,
.nm = nm,
.dispatchmgr = dispatchmgr,
.generation = 1,
isc_mutex_init(&mgr->lock);
- result = isc_task_create(taskmgr, &mgr->task, 0);
- if (result != ISC_R_SUCCESS) {
- goto cleanup_lock;
- }
-
atomic_init(&mgr->shuttingdown, false);
ISC_LIST_INIT(mgr->interfaces);
*/
result = ns_listenlist_create(mctx, &mgr->listenon4);
if (result != ISC_R_SUCCESS) {
- goto cleanup_task;
+ goto cleanup_lock;
}
ns_listenlist_attach(mgr->listenon4, &mgr->listenon6);
mgr->clientmgrs = isc_mem_get(mgr->mctx,
mgr->ncpus * sizeof(mgr->clientmgrs[0]));
for (size_t i = 0; i < mgr->ncpus; i++) {
- result = ns_clientmgr_create(mgr->sctx, mgr->taskmgr,
- mgr->loopmgr, mgr->aclenv, (int)i,
+ result = ns_clientmgr_create(mgr->sctx, mgr->loopmgr,
+ mgr->aclenv, (int)i,
&mgr->clientmgrs[i]);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
}
cleanup_listenon:
ns_listenlist_detach(&mgr->listenon4);
ns_listenlist_detach(&mgr->listenon6);
-cleanup_task:
- isc_task_detach(&mgr->task);
cleanup_lock:
isc_mutex_destroy(&mgr->lock);
ns_server_detach(&mgr->sctx);
if (mgr->sctx != NULL) {
ns_server_detach(&mgr->sctx);
}
- isc_task_detach(&mgr->task);
mgr->magic = 0;
isc_mem_putanddetach(&mgr->mctx, mgr, sizeof(*mgr));
}
#include <dns/dns64.h>
#include <dns/dnsrps.h>
#include <dns/dnssec.h>
-#include <dns/events.h>
#include <dns/keytable.h>
#include <dns/message.h>
#include <dns/ncache.h>
#include <dns/zt.h>
#include <ns/client.h>
-#include <ns/events.h>
#include <ns/hooks.h>
#include <ns/interfacemgr.h>
#include <ns/log.h>
#include <isc/result.h>
#include <isc/stdio.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/thread.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/buffer.h>
#include <isc/net.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/tls.h>
#include <isc/util.h>
#include <cmocka.h>
#include <isc/buffer.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
static int
setup_test(void **state) {
setup_loopmgr(state);
- setup_taskmgr(state);
setup_netmgr(state);
return (0);
static int
teardown_test(void **state) {
teardown_netmgr(state);
- teardown_taskmgr(state);
teardown_loopmgr(state);
return (0);
/* create zone manager */
ISC_LOOP_TEST_IMPL(zonemgr_create) {
dns_zonemgr_t *myzonemgr = NULL;
- isc_result_t result;
UNUSED(arg);
- result = dns_zonemgr_create(mctx, loopmgr, taskmgr, netmgr, &myzonemgr);
- assert_int_equal(result, ISC_R_SUCCESS);
+ dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr);
dns_zonemgr_shutdown(myzonemgr);
dns_zonemgr_detach(&myzonemgr);
UNUSED(arg);
- result = dns_zonemgr_create(mctx, loopmgr, taskmgr, netmgr, &myzonemgr);
- assert_int_equal(result, ISC_R_SUCCESS);
+ dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr);
result = dns_test_makezone("foo", &zone, NULL, false);
assert_int_equal(result, ISC_R_SUCCESS);
UNUSED(arg);
- result = dns_zonemgr_create(mctx, loopmgr, taskmgr, netmgr, &myzonemgr);
- assert_int_equal(result, ISC_R_SUCCESS);
+ dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr);
result = dns_zonemgr_createzone(myzonemgr, &zone);
assert_int_equal(result, ISC_R_SUCCESS);
TIME_NOW(&now);
- result = dns_zonemgr_create(mctx, loopmgr, taskmgr, netmgr, &myzonemgr);
- assert_int_equal(result, ISC_R_SUCCESS);
+ dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr);
result = dns_test_makezone("foo", &zone, NULL, false);
assert_int_equal(result, ISC_R_SUCCESS);
#include <isc/atomic.h>
#include <isc/buffer.h>
#include <isc/loop.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
assert_int_equal(nzones, 1);
/* These steps are necessary so the zone can be detached properly */
- result = dns_test_setupzonemgr();
- assert_int_equal(result, ISC_R_SUCCESS);
+ dns_test_setupzonemgr();
result = dns_test_managezone(zone);
assert_int_equal(result, ISC_R_SUCCESS);
dns_test_releasezone(zone);
}
static isc_result_t
-load_done_last(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) {
+load_done_last(dns_zt_t *zt, dns_zone_t *zone) {
isc_result_t result;
UNUSED(zt);
UNUSED(zone);
- UNUSED(task);
/* The zone should now be loaded; test it */
result = dns_zone_getdb(zone, &db);
}
static isc_result_t
-load_done_new_only(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) {
+load_done_new_only(dns_zt_t *zt, dns_zone_t *zone) {
isc_result_t result;
UNUSED(zt);
UNUSED(zone);
- UNUSED(task);
/* The zone should now be loaded; test it */
result = dns_zone_getdb(zone, &db);
}
static isc_result_t
-load_done_first(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) {
+load_done_first(dns_zt_t *zt, dns_zone_t *zone) {
atomic_bool *done = (atomic_bool *)zt;
isc_result_t result;
UNUSED(zone);
- UNUSED(task);
/* The zone should now be loaded; test it */
result = dns_zone_getdb(zone, &db);
result = dns_test_makezone("foo", &zone, NULL, true);
assert_int_equal(result, ISC_R_SUCCESS);
- result = dns_test_setupzonemgr();
- assert_int_equal(result, ISC_R_SUCCESS);
+ dns_test_setupzonemgr();
result = dns_test_managezone(zone);
assert_int_equal(result, ISC_R_SUCCESS);
zt = view->zonetable;
assert_non_null(zt);
- result = dns_test_setupzonemgr();
- assert_int_equal(result, ISC_R_SUCCESS);
+ dns_test_setupzonemgr();
result = dns_test_managezone(zone1);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_test_managezone(zone2);
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view,
bool createview);
-isc_result_t
+void
dns_test_setupzonemgr(void);
isc_result_t
#include <isc/netmgr.h>
#include <isc/result.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/uv.h>
extern isc_log_t *lctx;
extern isc_loop_t *mainloop;
extern isc_loopmgr_t *loopmgr;
-extern isc_taskmgr_t *taskmgr;
extern isc_nm_t *netmgr;
extern int ncpus;
extern unsigned int workers;
int
teardown_loopmgr(void **state);
-int
-setup_taskmgr(void **state);
-int
-teardown_taskmgr(void **state);
-
int
setup_netmgr(void **state);
int
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
sockaddr_test \
stats_test \
symtab_test \
- task_test \
tcp_test \
tcpdns_test \
time_test \
$(LDADD) \
-lm
-task_test_CPPFLAGS = \
- $(AM_CPPFLAGS)
-
-task_test_LDADD = \
- $(LDADD)
-
tcp_test_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(OPENSSL_CFLAGS)
netmgr_common.c \
uv_wrap.h
-if HAVE_LIBXML2
-task_test_CPPFLAGS += $(LIBXML2_CFLAGS)
-task_test_LDADD += $(LIBXML2_LIBS)
-endif HAVE_LIBXML2
-
-if HAVE_JSON_C
-task_test_CPPFLAGS += $(JSON_C_CFLAGS)
-task_test_LDADD += $(JSON_C_LIBS)
-endif HAVE_JSON_C
-
-
EXTRA_DIST = testdata
include $(top_srcdir)/Makefile.tests
#define UNIT_TESTING
#include <cmocka.h>
-#include <isc/event.h>
#include <isc/job.h>
#include <isc/loop.h>
#include <isc/ratelimiter.h>
-#include <isc/task.h>
#include <isc/time.h>
#include "ratelimiter.c"
if (r != 0) {
return (r);
}
- r = setup_taskmgr(state);
- if (r != 0) {
- return (r);
- }
return (0);
}
teardown_test(void **state) {
int r;
- r = teardown_taskmgr(state);
- if (r != 0) {
- return (r);
- }
r = teardown_loopmgr(state);
if (r != 0) {
return (r);
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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.
- */
-
-#include <inttypes.h>
-#include <sched.h> /* IWYU pragma: keep */
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define UNIT_TESTING
-
-#include <cmocka.h>
-
-#include <isc/atomic.h>
-#include <isc/cmocka.h>
-#include <isc/commandline.h>
-#include <isc/condition.h>
-#include <isc/event.h>
-#include <isc/job.h>
-#include <isc/loop.h>
-#include <isc/managers.h>
-#include <isc/mem.h>
-#include <isc/os.h>
-#include <isc/task.h>
-#include <isc/time.h>
-#include <isc/timer.h>
-#include <isc/util.h>
-#include <isc/work.h>
-
-#include <tests/isc.h>
-
-static atomic_int_fast32_t counter;
-static int active[10];
-static atomic_bool done = false;
-
-atomic_int_fast32_t set_a, set_b;
-
-static void
-set(isc_task_t *task, isc_event_t *event) {
- atomic_int_fast32_t *value = (atomic_int_fast32_t *)event->ev_arg;
-
- UNUSED(task);
-
- isc_event_free(&event);
- atomic_store(value, atomic_fetch_add(&counter, 1));
-
- if ((atomic_load(&set_a) != 0 && atomic_load(&set_b) != 0)) {
- isc_loopmgr_shutdown(loopmgr);
- }
-}
-
-#include <isc/thread.h>
-
-ISC_LOOP_TEST_IMPL(create_task) {
- isc_result_t result;
- isc_task_t *task = NULL;
-
- result = isc_task_create(taskmgr, &task, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
-
- isc_task_detach(&task);
- assert_null(task);
-
- isc_loopmgr_shutdown(loopmgr);
-}
-
-ISC_LOOP_SETUP_IMPL(all_events) {
- atomic_init(&set_a, 0);
- atomic_init(&set_b, 0);
-}
-
-ISC_LOOP_TEARDOWN_IMPL(all_events) {
- assert_int_not_equal(atomic_load(&set_a), 0);
- assert_int_not_equal(atomic_load(&set_b), 0);
-}
-
-ISC_LOOP_TEST_SETUP_TEARDOWN_IMPL(all_events) {
- isc_result_t result;
- isc_task_t *task = NULL;
- isc_event_t *event = NULL;
-
- atomic_init(&counter, 1);
-
- result = isc_task_create(taskmgr, &task, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
-
- /* First event */
- event = isc_event_allocate(mctx, task, ISC_TASKEVENT_TEST, set, &set_a,
- sizeof(isc_event_t));
- assert_non_null(event);
-
- assert_int_equal(atomic_load(&set_a), 0);
- isc_task_send(task, &event);
-
- event = isc_event_allocate(mctx, task, ISC_TASKEVENT_TEST, set, &set_b,
- sizeof(isc_event_t));
- assert_non_null(event);
-
- assert_int_equal(atomic_load(&set_b), 0);
- isc_task_send(task, &event);
-
- isc_task_detach(&task);
- assert_null(task);
-}
-
-/*
- * Basic task functions:
- */
-static void
-basic_cb(isc_task_t *task, isc_event_t *event) {
- int i, j;
-
- UNUSED(task);
-
- j = 0;
- for (i = 0; i < 1000000; i++) {
- j += 100;
- }
-
- UNUSED(j);
- isc_event_free(&event);
-}
-
-static void
-basic_tick(void *arg __attribute__((__unused__))) {
- /* no-op */
-}
-
-static char one[] = "1";
-static char two[] = "2";
-static char three[] = "3";
-static char four[] = "4";
-static char tick[] = "tick";
-static char tock[] = "tock";
-
-isc_task_t *task1 = NULL;
-isc_task_t *task2 = NULL;
-isc_task_t *task3 = NULL;
-isc_task_t *task4 = NULL;
-isc_timer_t *ti1 = NULL;
-isc_timer_t *ti2 = NULL;
-
-static void
-basic_work(void *arg __attribute__((__unused__))) {
- char *testarray[] = { one, one, one, one, one, one, one, one,
- one, two, three, four, two, three, four, NULL };
- sleep(2);
-
- for (size_t i = 0; testarray[i] != NULL; i++) {
- /*
- * Note: (void *)1 is used as a sender here, since some
- * compilers don't like casting a function pointer to a
- * (void *).
- *
- * In a real use, it is more likely the sender would be a
- * structure (socket, timer, task, etc) but this is just a
- * test program.
- */
- isc_event_t *event = isc_event_allocate(mctx, &task1, 1,
- basic_cb, testarray[i],
- sizeof(*event));
- assert_non_null(event);
- isc_task_send(task1, &event);
- }
-}
-
-static void
-basic_after_work(void *arg) {
- UNUSED(arg);
-
- sleep(5);
-
- isc_task_detach(&task1);
- isc_task_detach(&task2);
- isc_task_detach(&task3);
- isc_task_detach(&task4);
-
- sleep(5);
-
- isc_timer_destroy(&ti1);
- isc_timer_destroy(&ti2);
-
- isc_loopmgr_shutdown(loopmgr);
-}
-
-ISC_LOOP_TEST_IMPL(basic) {
- isc_result_t result;
- isc_interval_t interval;
-
- UNUSED(arg);
-
- result = isc_task_create(taskmgr, &task1, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
- result = isc_task_create(taskmgr, &task2, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
- result = isc_task_create(taskmgr, &task3, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
- result = isc_task_create(taskmgr, &task4, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
-
- isc_interval_set(&interval, 1, 0);
- isc_timer_create(mainloop, basic_tick, tick, &ti1);
- isc_timer_start(ti1, isc_timertype_ticker, &interval);
-
- isc_interval_set(&interval, 1, 0);
- isc_timer_create(mainloop, basic_tick, tock, &ti2);
- isc_timer_start(ti2, isc_timertype_ticker, &interval);
-
- isc_work_enqueue(mainloop, basic_work, basic_after_work, NULL);
-}
-
-/*
- * Exclusive mode test:
- * When one task enters exclusive mode, all other active
- * tasks complete first.
- */
-
-static void
-exclusive_cb(isc_task_t *task, isc_event_t *event) {
- int taskno = *(int *)(event->ev_arg);
-
- /* task chosen from the middle of the range */
- if (taskno == 6) {
- int i;
-
- isc_task_beginexclusive(task);
-
- for (i = 0; i < 10; i++) {
- assert_int_equal(active[i], 0);
- }
-
- isc_task_endexclusive(task);
- atomic_store(&done, true);
- } else {
- active[taskno]++;
- isc_thread_yield();
- active[taskno]--;
- }
-
- if (atomic_load(&done)) {
- isc_mem_put(event->ev_destroy_arg, event->ev_arg, sizeof(int));
- isc_event_free(&event);
- atomic_fetch_sub(&counter, 1);
- isc_loopmgr_shutdown(loopmgr);
- } else {
- isc_task_send(task, &event);
- }
-}
-
-isc_task_t *tasks[10] = { NULL };
-
-ISC_LOOP_SETUP_IMPL(task_exclusive) {
- isc_result_t result;
-
- atomic_init(&counter, 0);
- atomic_init(&done, false);
-
- for (size_t i = 0; i < 10; i++) {
- uint32_t tid = i % isc_loopmgr_nloops(loopmgr);
-
- if (i == 6) {
- /* task chosen from the middle of the range */
- tid = 0;
- result = isc_task_create(taskmgr, &tasks[i], tid);
- assert_int_equal(result, ISC_R_SUCCESS);
-
- isc_taskmgr_setexcltask(taskmgr, tasks[i]);
- } else {
- result = isc_task_create(taskmgr, &tasks[i], tid);
- assert_int_equal(result, ISC_R_SUCCESS);
- }
- }
-}
-
-ISC_LOOP_TEST_SETUP_IMPL(task_exclusive) {
- UNUSED(arg);
-
- for (size_t i = 0; i < 10; i++) {
- isc_event_t *event = NULL;
- int *v;
-
- v = isc_mem_get(mctx, sizeof *v);
- assert_non_null(v);
-
- *v = i;
-
- event = isc_event_allocate(mctx, NULL, 1, exclusive_cb, v,
- sizeof(*event));
- assert_non_null(event);
-
- isc_task_send(tasks[i], &event);
- atomic_fetch_add(&counter, 1);
- isc_task_detach(&tasks[i]);
- }
-}
-
-static void
-maxtask_cb(isc_task_t *task, isc_event_t *event) {
- isc_result_t result;
- uintptr_t ntasks = (uintptr_t)event->ev_arg;
-
- if (event->ev_arg != NULL) {
- isc_task_t *newtask = NULL;
-
- event->ev_arg = (void *)(ntasks - 1);
-
- /*
- * Create a new task and forward the message.
- */
- result = isc_task_create(taskmgr, &newtask, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
-
- isc_task_send(newtask, &event);
- } else {
- isc_event_free(&event);
- isc_loopmgr_shutdown(loopmgr);
- }
-
- if (task != NULL) {
- isc_task_detach(&task);
- }
-}
-
-ISC_LOOP_TEST_IMPL(manytasks) {
- isc_event_t *event = NULL;
- uintptr_t ntasks = 10000;
-
- UNUSED(arg);
-
- event = isc_event_allocate(mctx, (void *)1, 1, maxtask_cb,
- (void *)ntasks, sizeof(*event));
- assert_non_null(event);
-
- maxtask_cb(NULL, event);
-}
-
-ISC_TEST_LIST_START
-
-ISC_TEST_ENTRY_CUSTOM(manytasks, setup_managers, teardown_managers)
-ISC_TEST_ENTRY_CUSTOM(all_events, setup_managers, teardown_managers)
-ISC_TEST_ENTRY_CUSTOM(basic, setup_managers, teardown_managers)
-ISC_TEST_ENTRY_CUSTOM(create_task, setup_managers, teardown_managers)
-ISC_TEST_ENTRY_CUSTOM(task_exclusive, setup_managers, teardown_managers)
-
-ISC_TEST_LIST_END
-
-ISC_TEST_MAIN
return (result);
}
-isc_result_t
+void
dns_test_setupzonemgr(void) {
- isc_result_t result;
REQUIRE(zonemgr == NULL);
- result = dns_zonemgr_create(mctx, loopmgr, taskmgr, netmgr, &zonemgr);
- return (result);
+ dns_zonemgr_create(mctx, loopmgr, netmgr, &zonemgr);
}
isc_result_t
#include <isc/mem.h>
#include <isc/os.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
isc_log_t *lctx = NULL;
isc_loop_t *mainloop = NULL;
isc_loopmgr_t *loopmgr = NULL;
-isc_taskmgr_t *taskmgr = NULL;
isc_nm_t *netmgr = NULL;
unsigned int workers = -1;
int
teardown_loopmgr(void **state __attribute__((__unused__))) {
- REQUIRE(taskmgr == NULL);
REQUIRE(netmgr == NULL);
mainloop = NULL;
return (0);
}
-int
-setup_taskmgr(void **state __attribute__((__unused__))) {
- REQUIRE(loopmgr != NULL);
-
- isc_taskmgr_create(mctx, loopmgr, &taskmgr);
-
- return (0);
-}
-
-int
-teardown_taskmgr(void **state __attribute__((__unused__))) {
- isc_taskmgr_destroy(&taskmgr);
-
- return (0);
-}
-
int
setup_netmgr(void **state __attribute__((__unused__))) {
REQUIRE(loopmgr != NULL);
int
setup_managers(void **state) {
setup_loopmgr(state);
- setup_taskmgr(state);
setup_netmgr(state);
return (0);
int
teardown_managers(void **state) {
teardown_netmgr(state);
- teardown_taskmgr(state);
teardown_loopmgr(state);
return (0);
#include <isc/result.h>
#include <isc/stdio.h>
#include <isc/string.h>
-#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <tests/ns.h>
-isc_task_t *maintask = NULL;
dns_dispatchmgr_t *dispatchmgr = NULL;
ns_interfacemgr_t *interfacemgr = NULL;
ns_server_t *sctx = NULL;
goto cleanup;
}
- result = ns_interfacemgr_create(mctx, sctx, loopmgr, taskmgr, netmgr,
- dispatchmgr, maintask, NULL, false,
+ result = ns_interfacemgr_create(mctx, sctx, loopmgr, netmgr,
+ dispatchmgr, NULL, false,
&interfacemgr);
if (result != ISC_R_SUCCESS) {
goto cleanup;
/*
* Start zone manager.
*/
- result = dns_test_setupzonemgr();
- if (result != ISC_R_SUCCESS) {
- goto free_zone;
- }
+ dns_test_setupzonemgr();
/*
* Add the zone to the zone manager.
dns_test_releasezone(served_zone);
close_zonemgr:
dns_test_closezonemgr();
-free_zone:
dns_zone_detach(&served_zone);
return (result);
#define UNIT_TESTING
#include <cmocka.h>
-#include <isc/event.h>
-#include <isc/task.h>
#include <isc/thread.h>
#include <dns/acl.h>
#include <dns/zone.h>
#include <ns/client.h>
-#include <ns/events.h>
#include <ns/hooks.h>
#include <ns/query.h>
#include <ns/server.h>