]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
remove isc_task completely
authorEvan Hunt <each@isc.org>
Sat, 29 Oct 2022 21:22:56 +0000 (14:22 -0700)
committerOndřej Surý <ondrej@isc.org>
Thu, 16 Feb 2023 17:35:32 +0000 (18:35 +0100)
as there is no further use of isc_task in BIND, this commit removes
it, along with isc_taskmgr, isc_event, and all other related types.

functions that accepted taskmgr as a parameter have been cleaned up.
as a result of this change, some functions can no longer fail, so
they've been changed to type void, and their callers have been
updated accordingly.

the tasks table has been removed from the statistics channel and
the stats version has been updated. dns_dyndbctx has been changed
to reference the loopmgr instead of taskmgr, and DNS_DYNDB_VERSION
has been udpated as well.

96 files changed:
bin/check/named-checkzone.c
bin/delv/delv.c
bin/dig/dig.c
bin/dig/dighost.c
bin/dig/dighost.h
bin/dig/host.c
bin/dig/nslookup.c
bin/dnssec/dnssec-signzone.c
bin/dnssec/dnssec-verify.c
bin/named/bind9.xsl
bin/named/control.c
bin/named/include/named/globals.h
bin/named/include/named/server.h
bin/named/main.c
bin/named/server.c
bin/named/statschannel.c
bin/nsupdate/nsupdate.c
bin/rndc/rndc.c
bin/tests/system/dyndb/driver/instance.c
bin/tests/system/dyndb/driver/zone.c
bin/tests/system/pipelined/pipequeries.c
bin/tests/system/statistics/tests.sh
bin/tests/system/tkey/keycreate.c
bin/tests/system/tkey/keydelete.c
bin/tests/test_client.c
bin/tests/test_server.c
bin/tools/mdig.c
doc/arm/reference.rst
lib/dns/Makefile.am
lib/dns/adb.c
lib/dns/byaddr.c
lib/dns/catz.c
lib/dns/client.c
lib/dns/dnstap.c
lib/dns/include/dns/byaddr.h
lib/dns/include/dns/client.h
lib/dns/include/dns/dyndb.h
lib/dns/include/dns/events.h [deleted file]
lib/dns/include/dns/request.h
lib/dns/include/dns/rpz.h
lib/dns/include/dns/validator.h
lib/dns/include/dns/view.h
lib/dns/include/dns/zone.h
lib/dns/include/dns/zt.h
lib/dns/master.c
lib/dns/masterdump.c
lib/dns/nta.c
lib/dns/rpz.c
lib/dns/update.c
lib/dns/validator.c
lib/dns/view.c
lib/dns/xfrin.c
lib/dns/zone.c
lib/dns/zt.c
lib/isc/Makefile.am
lib/isc/event.c [deleted file]
lib/isc/include/isc/event.h [deleted file]
lib/isc/include/isc/eventclass.h [deleted file]
lib/isc/include/isc/httpd.h
lib/isc/include/isc/managers.h
lib/isc/include/isc/netmgr.h
lib/isc/include/isc/task.h [deleted file]
lib/isc/include/isc/types.h
lib/isc/loop.c
lib/isc/managers.c
lib/isc/netmgr/netmgr.c
lib/isc/ratelimiter.c
lib/isc/task.c [deleted file]
lib/isc/timer.c
lib/isccc/Makefile.am
lib/isccc/ccmsg.c
lib/isccc/include/isccc/events.h [deleted file]
lib/ns/Makefile.am
lib/ns/client.c
lib/ns/include/ns/client.h
lib/ns/include/ns/events.h [deleted file]
lib/ns/include/ns/hooks.h
lib/ns/include/ns/interfacemgr.h
lib/ns/include/ns/server.h
lib/ns/interfacemgr.c
lib/ns/query.c
tests/dns/rbt_test.c
tests/dns/resolver_test.c
tests/dns/zonemgr_test.c
tests/dns/zt_test.c
tests/include/tests/dns.h
tests/include/tests/isc.h
tests/include/tests/ns.h
tests/isc/Makefile.am
tests/isc/ratelimiter_test.c
tests/isc/task_test.c [deleted file]
tests/libtest/dns.c
tests/libtest/isc.c
tests/libtest/ns.c
tests/ns/notify_test.c
tests/ns/query_test.c

index a5d6183617757710007de104e82de6a079c0c350..795624651ad82bf4c60e5ddbf417c671e4019b87 100644 (file)
@@ -26,7 +26,6 @@
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
index 82bdef9845840476f5782a5c302039d988d93628..7fa6eb867948f84e9e11049616533c21b9cac842 100644 (file)
@@ -38,7 +38,6 @@
 #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>
@@ -83,7 +82,6 @@ static isc_log_t *lctx = NULL;
 /* 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;
@@ -1813,7 +1811,7 @@ main(int argc, char *argv[]) {
        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) {
@@ -1871,7 +1869,7 @@ cleanup:
 
        dst_lib_destroy();
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
 
        return (0);
 }
index 0d1814cda50407ad1484aa0c4160bf026df97205..06940123dc040b13bee73348f037deeab3acd7dc 100644 (file)
@@ -26,7 +26,6 @@
 #include <isc/parseint.h>
 #include <isc/result.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/time.h>
 #include <isc/util.h>
 
index 25c3bdde333ee62086c111b05ece7c24f42eae6d..5c73e28522d8c5bb3680a27150b803def26da04b 100644 (file)
@@ -51,7 +51,6 @@
 #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>
@@ -104,7 +103,6 @@ unsigned int extrabytes;
 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;
@@ -1369,7 +1367,7 @@ setup_libs(void) {
                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);
@@ -4716,7 +4714,7 @@ destroy_libs(void) {
                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);
index 4c12260338a840f96ff6f02ef601ad0a022592d2..5daffbc5002ab3521794e3de8ff4b9f365ed827b 100644 (file)
@@ -263,7 +263,6 @@ extern const dns_name_t *hmacname;
 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;
index 42b567f0e7198da687c4e84955d2dfbf9d640340..35ef45e8195b0b64405ed986be1491c9e5b9ce57 100644 (file)
@@ -24,7 +24,6 @@
 #include <isc/loop.h>
 #include <isc/netaddr.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/util.h>
 
 #include <dns/byaddr.h>
index 7c21225af2523dc7692f5a0e189aab38399dfd30..2d5f0b890d465314ccdb1c2a23d168cab390c171 100644 (file)
 #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>
 
index 215e44ebe0844bd264f4951f0d4d05194518e1b6..ac21797bc318fed68aceeda5384b84936fa9d717 100644 (file)
@@ -38,7 +38,6 @@
 #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>
@@ -56,7 +55,6 @@
 #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>
@@ -140,7 +138,6 @@ static const char *directory = NULL, *dsdir = NULL;
 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 */
@@ -3636,7 +3633,7 @@ main(int argc, char *argv[]) {
                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) {
@@ -4021,7 +4018,7 @@ main(int argc, char *argv[]) {
                isc_mem_stats(mctx, stdout);
        }
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
 
        if (printstats) {
                TIME_NOW(&timer_finish);
index 9e51547ae739cb1de43becc480cb0bb896dc2122..539b1552753d67ae29c42edba97f2b1a8b5272e8 100644 (file)
@@ -20,7 +20,6 @@
 #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>
index f86bf871412b7b770427705315af8f932c62bda8..91f59440d2bc6afea2085f509274a072e122318b 100644 (file)
       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">
index 7186358793285522e8e4883d72efc3e7df847176..47749644b6f27b86dba4132f5d8cd9c9b7c39c89 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <stdbool.h>
 
-#include <isc/event.h>
 #include <isc/lex.h>
 #include <isc/mem.h>
 #include <isc/result.h>
index ddcd81179aba489eaa929e358337a52d3f679529..40b37143bc141ff1782419c48c13a7b4de78bcd0 100644 (file)
@@ -50,7 +50,6 @@
 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);
index 57b29d4206b853e9a9de03e01c2aabd1e92b8cfa..4d87fc99c189b2ee4d0a2f49cdf16a666cc7a5b4 100644 (file)
 
 #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.
  */
@@ -55,8 +47,6 @@ struct named_server {
 
        ns_server_t *sctx;
 
-       isc_task_t *task;
-
        char *statsfile;    /*%< Statistics file name */
        char *dumpfile;     /*%< Dump file name */
        char *secrootsfile; /*%< Secroots file name */
index f09f655d235a550e8f3b8f8f2168e6db4acb4550..42b550d3bdf63a1aca42c4aa0e0c7476d79fe474 100644 (file)
@@ -38,7 +38,6 @@
 #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>
@@ -1026,7 +1025,7 @@ create_managers(void) {
                      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);
 
@@ -1543,8 +1542,7 @@ main(int argc, char *argv[]) {
                }
        }
 
-       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);
index 47713427c83cf88e908f7615f51d05e2b571b439..bf4b3e10c7a8e73510eab8f2347fd56c92249c98 100644 (file)
@@ -58,7 +58,6 @@
 #include <isc/stats.h>
 #include <isc/stdio.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
@@ -73,7 +72,6 @@
 #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);    \
+               }                              \
        }
 
 /*%
@@ -404,7 +402,7 @@ const char *empty_zones[] = {
 };
 
 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);
@@ -9145,16 +9143,7 @@ load_configuration(const char *filename, named_server_t *server,
        (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))
@@ -9977,10 +9966,8 @@ run_server(void *arg) {
        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),
@@ -9994,10 +9981,10 @@ run_server(void *arg) {
        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");
 
        /*
@@ -10145,8 +10132,6 @@ shutdown_server(void *arg) {
        dns_db_detach(&server->in_roothints);
 
        isc_loopmgr_resume(named_g_loopmgr);
-
-       isc_task_detach(&server->task);
 }
 
 /*%
@@ -10226,16 +10211,6 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
 
        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");
 
@@ -10355,15 +10330,8 @@ named_server_destroy(named_server_t **serverp) {
 }
 
 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));
@@ -12440,7 +12408,6 @@ named_server_tsigdelete(named_server_t *server, isc_lex_t *lex,
                        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);
                        }
index aafdecbfbbb9e602405d4d857c6a91cfc62b8576..180f75581c36936e175906db883dbe419709afde 100644 (file)
@@ -77,13 +77,12 @@ struct named_statschannel {
        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;
 };
 
@@ -1778,7 +1777,6 @@ cleanup:
 #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
@@ -2334,12 +2332,6 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
        }
        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));
@@ -2461,17 +2453,6 @@ render_xml_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
                           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,
@@ -2503,7 +2484,6 @@ render_xml_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
 #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
@@ -3138,19 +3118,6 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
                }
        }
 
-       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);
@@ -3403,17 +3370,6 @@ render_json_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
                            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,
@@ -3611,9 +3567,6 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
        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);
@@ -3636,9 +3589,6 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
        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);
index 0e81a99532fe96ca4c1a861f91992f9feee68bb5..58b36619a4efc283637bc27669dbcdd5ee92ce71 100644 (file)
@@ -125,7 +125,6 @@ static bool use_win2k_gsstsig = false;
 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;
@@ -3443,9 +3442,6 @@ cleanup(void) {
        }
 
 #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;
@@ -3479,7 +3475,7 @@ cleanup(void) {
        }
 
        ddebug("Shutting down managers");
-       isc_managers_destroy(&gmctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&gmctx, &loopmgr, &netmgr);
 }
 
 static void
@@ -3526,7 +3522,7 @@ main(int argc, char **argv) {
 
        pre_parse_args(argc, argv);
 
-       isc_managers_create(&gmctx, 1, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_create(&gmctx, 1, &loopmgr, &netmgr);
 
        parse_args(argc, argv);
 
index 04f6705a2ecb8e50d9c5d8557bf4b18f018d61e7..3d226ac03ce32c4ab58f972760c9dc3f47db73d5 100644 (file)
@@ -33,7 +33,6 @@
 #include <isc/result.h>
 #include <isc/stdtime.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/thread.h>
 #include <isc/util.h>
 
@@ -59,9 +58,7 @@ const char *progname = NULL;
 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;
@@ -307,7 +304,6 @@ rndc_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
            atomic_load_acquire(&recvs) == 0)
        {
                shuttingdown = true;
-               isc_task_detach(&rndc_task);
                isc_loopmgr_shutdown(loopmgr);
        }
 }
@@ -393,7 +389,6 @@ rndc_recvdone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
            atomic_load_acquire(&sends) == 0)
        {
                shuttingdown = true;
-               isc_task_detach(&rndc_task);
                isc_loopmgr_shutdown(loopmgr);
        }
 }
@@ -1025,10 +1020,9 @@ main(int argc, char **argv) {
 
        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);
@@ -1098,7 +1092,7 @@ main(int argc, char **argv) {
                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);
index 046f9e8ebb9f234a9d8c01b25dda0061975770b6..4ce0d1b31bec510001015e0d324b46837df203c4 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "instance.h"
 
-#include <isc/task.h>
 #include <isc/util.h>
 
 #include <dns/db.h>
index 564ed73d7da324fdf02cb0b70c9537c6e096fa2c..a8d36058d7f75d08e6ca7a86fda971ef56591ee4 100644 (file)
@@ -35,7 +35,6 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <isc/task.h>
 #include <isc/util.h>
 
 #include <dns/dyndb.h>
index 7c1fa8ab6854c42d85819b8a8bd47ff457cfe521..8d8cb453725822cb81f234c6d5ca393760f36d46 100644 (file)
 #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>
@@ -194,7 +192,6 @@ main(int argc, char *argv[]) {
        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;
@@ -247,7 +244,7 @@ main(int argc, char *argv[]) {
        }
        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);
 
@@ -277,7 +274,7 @@ main(int argc, char *argv[]) {
 
        isc_log_destroy(&lctx);
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
 
        return (0);
 }
index edfce8b3ebdc8e52d6f868172e50234d47039142..0fc1b6b71d92cb998e64443f43380007f562788f 100644 (file)
@@ -215,8 +215,6 @@ if $FEATURETEST --have-libxml2 && "${CURL}" --http1.1 http://10.53.0.3:${EXTRAPO
     # 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
index 86e0c4fc674e859d83274f670c73cbf030e72dc2..d4c01d19c021c9fb5636d4838006a56f064198e5 100644 (file)
@@ -25,7 +25,6 @@
 #include <isc/random.h>
 #include <isc/result.h>
 #include <isc/sockaddr.h>
-#include <isc/task.h>
 #include <isc/util.h>
 
 #include <dns/dispatch.h>
@@ -183,7 +182,6 @@ int
 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;
@@ -208,7 +206,7 @@ main(int argc, char *argv[]) {
 
        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);
 
@@ -256,7 +254,7 @@ main(int argc, char *argv[]) {
 
        dst_lib_destroy();
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
 
        return (0);
 }
index d6530bb43d02b8380bb93c95097b97e35973512d..eb1bef1af18624c6adf45089f4f3a1d7ee05f842 100644 (file)
@@ -24,7 +24,6 @@
 #include <isc/random.h>
 #include <isc/result.h>
 #include <isc/sockaddr.h>
-#include <isc/task.h>
 #include <isc/util.h>
 
 #include <dns/dispatch.h>
@@ -127,7 +126,6 @@ int
 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;
@@ -151,7 +149,7 @@ main(int argc, char **argv) {
        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);
 
@@ -198,7 +196,7 @@ main(int argc, char **argv) {
 
        dst_lib_destroy();
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
 
        return (0);
 }
index eaecb83ef89b01dddd4bd406e7a839972229fa5c..872651cd69768a2172914b0d1fd9006f5864987e 100644 (file)
@@ -53,7 +53,6 @@ static const char *protocols[] = { "udp",         "tcp",
 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;
@@ -287,7 +286,7 @@ parse_options(int argc, char **argv) {
 
 static void
 setup(void) {
-       isc_managers_create(&mctx, workers, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_create(&mctx, workers, &loopmgr, &netmgr);
 }
 
 static void
@@ -300,7 +299,7 @@ teardown(void) {
                isc_tlsctx_free(&tls_ctx);
        }
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
 }
 
 static void
index 05acf8430a5cfad8c91bcf822af47ff254d0ecdc..e0d3bb45ec8798a60d277488b0c92eabebf7735d 100644 (file)
@@ -35,7 +35,6 @@ static const char *protocols[] = { "udp", "tcp", "dot", "https", "http-plain" };
 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;
@@ -168,7 +167,7 @@ parse_options(int argc, char **argv) {
 
 static void
 setup(void) {
-       isc_managers_create(&mctx, workers, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_create(&mctx, workers, &loopmgr, &netmgr);
 }
 
 static void
@@ -177,7 +176,7 @@ teardown(void) {
                isc_tlsctx_free(&tls_ctx);
        }
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
 }
 
 static void
index 4e3187dfbaedcf737b3625977eeb230be8347632..f519696af42592711601b77978d74dcbfbae0744 100644 (file)
 #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>
@@ -2080,7 +2078,6 @@ main(int argc, char *argv[]) {
        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;
@@ -2099,7 +2096,7 @@ main(int argc, char *argv[]) {
 
        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));
@@ -2215,6 +2212,6 @@ main(int argc, char *argv[]) {
                isc_mem_free(mctx, default_query.ecs_addr);
        }
 
-       isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
+       isc_managers_destroy(&mctx, &loopmgr, &netmgr);
        return (0);
 }
index 97459524037595f069966cbaa827fd699132c840..4a159e72efb1856abdec2d82283f3bf5d2d4bf00 100644 (file)
@@ -5756,7 +5756,6 @@ reconfiguration time), http://127.0.0.1:8888/xml/v3/server (server and
 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
@@ -5766,7 +5765,6 @@ reconfiguration time), http://127.0.0.1:8888/json/v1/server (server and
 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
index 4f657192abaa61c1f27137092c07ebf5ae1b1802..c15de0d57a117c8d4ee89457eed391b2ffe016cf 100644 (file)
@@ -73,7 +73,6 @@ libdns_la_HEADERS =                   \
        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             \
index 02e713df1c61e32be6077f42db3bd94eb6fd0ed1..df88cbd5b1103dc90baf7b7e622182f0eab9781d 100644 (file)
 #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>
@@ -379,6 +377,8 @@ destroy(dns_adb_t *);
 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);
index b4d7b79b37d8a9180e1a3f3fdea42a11b9b317ea..df53ebdab4c1aac1e9600a6ac3da965b7b17acbb 100644 (file)
 #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>
index 2f1b900b9210a6ab1b61d3336cd9c11d8cc6d661..1b5b8c2029a1149f428982c869948af0c444169b 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <dns/catz.h>
 #include <dns/dbiterator.h>
-#include <dns/events.h>
 #include <dns/rdatasetiter.h>
 #include <dns/view.h>
 #include <dns/zone.h>
index 72588ce0e634717301f7abcb88651f98af34a10a..c6f94acab54d95e94dd5452ddf1aa94284575bc8 100644 (file)
@@ -31,7 +31,6 @@
 #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>
index 52115520dc1ce7bc4a793d353b192651a841c0e6..6e8f8319254cfb6dd54b263911d9706d7e578b10 100644 (file)
@@ -69,7 +69,6 @@
 #include <isc/util.h>
 
 #include <dns/dnstap.h>
-#include <dns/events.h>
 #include <dns/log.h>
 #include <dns/message.h>
 #include <dns/name.h>
index 4c18ddad282c0931f8d0448decda0f0c4b464642..718221f084afa2eb57c7b7b9b60216f819e6c309 100644 (file)
@@ -40,7 +40,6 @@
  *\li  Drafts: TBS
  */
 
-#include <isc/event.h>
 #include <isc/lang.h>
 
 #include <dns/types.h>
index 3bfde55f00a6a21cd2e2e9d0e101f042de9c011e..166822433ba01616d442653139cda7f00916fa4f 100644 (file)
@@ -39,7 +39,6 @@
  *     security issue specific to this module is anticipated.
  */
 
-#include <isc/event.h>
 #include <isc/loop.h>
 #include <isc/sockaddr.h>
 #include <isc/tls.h>
index f3020b87f57418142bbd64765bbf5ced7a0bc482..82026d154eb4f9d7c7371521e96428b314a31e61 100644 (file)
@@ -55,7 +55,7 @@ struct dns_dyndbctx {
  * 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 */
 
diff --git a/lib/dns/include/dns/events.h b/lib/dns/include/dns/events.h
deleted file mode 100644 (file)
index 19655aa..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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)
index e6213514edc1ea1394373949176cef2e028a1df5..e33119742b657a6b07acf759a35e2b247faa1c95 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <stdbool.h>
 
-#include <isc/event.h>
 #include <isc/lang.h>
 
 #include <dns/types.h>
index a11dd1c63afdc55c203d774b08806a9c68a68f44..d28d6e14b9312738a9ca4b19ada0a568c575b288 100644 (file)
@@ -21,7 +21,6 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
-#include <isc/event.h>
 #include <isc/ht.h>
 #include <isc/lang.h>
 #include <isc/refcount.h>
index 704b830799232f689cd377bac20099b5f2a7b2bc..c00e60bf78aea1d8fa00f68366ad62aad1d3a488 100644 (file)
@@ -48,7 +48,6 @@
 
 #include <stdbool.h>
 
-#include <isc/event.h>
 #include <isc/lang.h>
 #include <isc/mutex.h>
 
index f315def13cf43c55e6b46adde62dd522f8bd7159..30d1a174da0ab9ed1d7ca51863cf366188f052a6 100644 (file)
@@ -57,7 +57,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#include <isc/event.h>
 #include <isc/lang.h>
 #include <isc/magic.h>
 #include <isc/mutex.h>
index e7a162d3b4bbb214f02d101eb3e8a80f33aa57fa..4969c910854891cc3671a5509dcccff3548fb681 100644 (file)
@@ -480,7 +480,7 @@ dns_zone_iattach(dns_zone_t *source, dns_zone_t **target);
  *     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.
  */
@@ -493,7 +493,7 @@ dns_zone_idetach(dns_zone_t **zonep);
  *     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.
  */
 
@@ -1587,16 +1587,14 @@ dns_zone_getdnsseckeys(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver,
  *\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.
  */
 
@@ -1681,12 +1679,6 @@ dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
  *\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);
 /*%<
index 037d0a9495bb7055e2c9a53382496de484df07b5..afe13ead85859d9750dd77d95069da66716e3ec6 100644 (file)
@@ -34,8 +34,7 @@ typedef isc_result_t (*dns_zt_allloaded_t)(void *arg);
  * 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.
index 4808002d2e4d3ad3fc5aca29784d5b13f60d3d66..6df8fc298d9db4b815e780e322ef7d828f67d460 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <isc/async.h>
 #include <isc/atomic.h>
-#include <isc/event.h>
 #include <isc/lex.h>
 #include <isc/loop.h>
 #include <isc/magic.h>
@@ -33,7 +32,6 @@
 #include <isc/work.h>
 
 #include <dns/callbacks.h>
-#include <dns/events.h>
 #include <dns/fixedname.h>
 #include <dns/master.h>
 #include <dns/name.h>
index c3c1d5428b5840a685d3f11da6688487dc7fc7ae..728b1d3dde5c0c58fc9eb7ebe4dcd824ac3a02c3 100644 (file)
@@ -20,7 +20,6 @@
 #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>
@@ -36,7 +35,6 @@
 
 #include <dns/db.h>
 #include <dns/dbiterator.h>
-#include <dns/events.h>
 #include <dns/fixedname.h>
 #include <dns/log.h>
 #include <dns/master.h>
index 5096ce658a43880dabf4abf11fa29280ac5428c5..0b44f6433950c3b5cbfde21cbad9ce262bd39ccf 100644 (file)
 
 #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>
index bcb0b222bdf3585cd2208c79d0dcd90da3f67644..92ab5980d3961686c59c67421d37980f99b30d95 100644 (file)
 #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>
index 9f1c66279ea45180447faa6b2037279116fa195d..d3899e8e511b74a591de3e93ca32320dcae10721 100644 (file)
@@ -32,7 +32,6 @@
 #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>
index 53b35c1e8db9370849d7f5237b4a268c715a6458..baffeb3b9c0b54888f323bf082b3a94636c53a53 100644 (file)
@@ -26,7 +26,6 @@
 #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>
index cc5315e96d3259d6929a5f9bbe1a674d5ba2923e..35ce0d824b3bbe50cd66ceb89d04f8ae56084411 100644 (file)
@@ -29,7 +29,6 @@
 #include <isc/result.h>
 #include <isc/stats.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/util.h>
 
 #include <dns/acl.h>
@@ -41,7 +40,6 @@
 #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>
index 8115cbb7172846c1921155a72337aac0082b50b3..05e505b188f891056f387b6b6c18aa08307f830f 100644 (file)
@@ -27,7 +27,6 @@
 #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>
index 48b9221dffb7985e4864a3eb7507ba94fa1eca92..36cdfe3619bb8661f046609446b05104df5af38d 100644 (file)
@@ -36,7 +36,6 @@
 #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>
@@ -51,7 +50,6 @@
 #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>
@@ -318,9 +316,6 @@ struct dns_zone {
        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;
@@ -328,8 +323,7 @@ struct dns_zone {
        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 */
@@ -592,10 +586,8 @@ struct dns_zonemgr {
        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;
@@ -1189,10 +1181,6 @@ zone_free(dns_zone_t *zone) {
        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))
@@ -2247,7 +2235,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) {
                                              "no master file");
                        }
                        zone->refreshtime = now;
-                       if (zone->task != NULL) {
+                       if (zone->loop != NULL) {
                                zone_settimer(zone, &now);
                        }
                        result = ISC_R_SUCCESS;
@@ -2351,7 +2339,7 @@ zone_asyncload(void *arg) {
 
        /* 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));
@@ -3657,7 +3645,7 @@ zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) {
                if (isc_time_isepoch(&zone->nsec3chaintime)) {
                        TIME_NOW(&now);
                        zone->nsec3chaintime = now;
-                       if (zone->task != NULL) {
+                       if (zone->loop != NULL) {
                                zone_settimer(zone, &now);
                        }
                }
@@ -5144,7 +5132,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
                }
        }
 
-       if (zone->task != NULL) {
+       if (zone->loop != NULL) {
                if (zone->type == dns_zone_primary) {
                        set_resigntime(zone);
                        resume_signingwithkey(zone);
@@ -5260,7 +5248,7 @@ cleanup:
 
                /* 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;
@@ -5295,7 +5283,7 @@ done:
                 * 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);
                }
        }
@@ -11000,7 +10988,7 @@ zone_maintenance(dns_zone_t *zone) {
                }
                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",
@@ -11156,7 +11144,7 @@ again:
                /* 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);
@@ -11442,7 +11430,7 @@ dns_zone_flush(dns_zone_t *zone) {
        }
        UNLOCK_ZONE(zone);
        if (!dumping) {
-               result = zone_dump(zone, true); /* Unknown task. */
+               result = zone_dump(zone, true);
        }
        return (result);
 }
@@ -11458,7 +11446,7 @@ dns_zone_dump(dns_zone_t *zone) {
        dumping = was_dumping(zone);
        UNLOCK_ZONE(zone);
        if (!dumping) {
-               result = zone_dump(zone, false); /* Unknown task. */
+               result = zone_dump(zone, false);
        }
        return (result);
 }
@@ -11495,7 +11483,7 @@ zone_needdump(dns_zone_t *zone, unsigned int delay) {
        {
                zone->dumptime = dumptime;
        }
-       if (zone->task != NULL) {
+       if (zone->loop != NULL) {
                zone_settimer(zone, &now);
        }
 }
@@ -11636,7 +11624,7 @@ zone_dump(dns_zone_t *zone, bool compact) {
        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));
@@ -14488,7 +14476,7 @@ zone_shutdown(void *arg) {
        }
 
        /*
-        * 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() */
@@ -17354,7 +17342,7 @@ dns_zone_setsigresigninginterval(dns_zone_t *zone, uint32_t interval) {
        LOCK_ZONE(zone);
        zone->sigresigninginterval = interval;
        set_resigntime(zone);
-       if (zone->task != NULL) {
+       if (zone->loop != NULL) {
                TIME_NOW(&now);
                zone_settimer(zone, &now);
        }
@@ -17999,17 +17987,14 @@ zonemgr_keymgmt_delete(dns_zonemgr_t *zmgr, dns_keyfileio_t **deleted) {
        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);
 
@@ -18017,7 +18002,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
 
        *zmgr = (dns_zonemgr_t){
                .loopmgr = loopmgr,
-               .taskmgr = taskmgr,
                .netmgr = netmgr,
                .workers = isc_loopmgr_nloops(loopmgr),
                .transfersin = 10,
@@ -18045,17 +18029,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
        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);
@@ -18081,38 +18054,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
        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
@@ -18150,25 +18091,11 @@ dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
        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);
@@ -18287,10 +18214,6 @@ dns_zonemgr_shutdown(dns_zonemgr_t *zmgr) {
                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))
@@ -18317,8 +18240,6 @@ zonemgr_free(dns_zonemgr_t *zmgr) {
 
        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);
@@ -18359,13 +18280,6 @@ dns_zonemgr_gettransfersperns(dns_zonemgr_t *zmgr) {
        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.
@@ -18434,7 +18348,7 @@ zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
 
        /*
         * 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)) {
@@ -19271,7 +19185,7 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, uint16_t keyid,
                signing = NULL;
                if (isc_time_isepoch(&zone->signingtime)) {
                        zone->signingtime = now;
-                       if (zone->task != NULL) {
+                       if (zone->loop != NULL) {
                                zone_settimer(zone, &now);
                        }
                }
@@ -21039,7 +20953,7 @@ void
 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) {
@@ -21418,12 +21332,12 @@ dns_zone_link(dns_zone_t *zone, dns_zone_t *raw) {
 
        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);
@@ -21445,8 +21359,6 @@ dns_zone_link(dns_zone_t *zone, dns_zone_t *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);
@@ -21675,7 +21587,7 @@ failure:
 }
 
 /*
- * 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
@@ -22157,7 +22069,7 @@ failure:
  *     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
index da4eac74ce545b82a8e795d913fa71963a13d0f2..48713d207f9351dfb1e566569639c47db159e660 100644 (file)
@@ -22,7 +22,6 @@
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/util.h>
 
 #include <dns/log.h>
@@ -78,7 +77,7 @@ static isc_result_t
 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) {
@@ -585,12 +584,11 @@ cleanup:
  * 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);
        }
index 55eac3a7c98ca1bda431ec4c9aa83210854cb10b..dff12e76c9e3db0a8df7a33ed5e178764fb4373b 100644 (file)
@@ -27,8 +27,6 @@ libisc_la_HEADERS =                   \
        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          \
@@ -87,7 +85,6 @@ libisc_la_HEADERS =                   \
        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              \
@@ -129,7 +126,6 @@ libisc_la_SOURCES =         \
        errno2result.c          \
        errno2result.h          \
        error.c                 \
-       event.c                 \
        file.c                  \
        fsaccess.c              \
        fsaccess_common.c       \
@@ -191,7 +187,6 @@ libisc_la_SOURCES =         \
        string.c                \
        symtab.c                \
        syslog.c                \
-       task.c                  \
        thread.c                \
        tid.c                   \
        time.c                  \
diff --git a/lib/isc/event.c b/lib/isc/event.c
deleted file mode 100644 (file)
index cf5bdee..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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);
-       }
-}
diff --git a/lib/isc/include/isc/event.h b/lib/isc/include/isc/event.h
deleted file mode 100644 (file)
index b7a8be3..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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
diff --git a/lib/isc/include/isc/eventclass.h b/lib/isc/include/isc/eventclass.h
deleted file mode 100644 (file)
index f9c4c07..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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)
-/*@}*/
index 1f69a4c99d1b8b4f176191faafc33c3d2b5dd91f..23472d0f821bac687192cb20c9712857de540544 100644 (file)
 
 #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>
index 3f2061d0c68b2f3f8c634790a08f69a2d06e7af1..9b7e0311ea0d5198a9b061abb44078ac4dafdb35 100644 (file)
 #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);
index e41bbdf859138a34a86379dcd06103775f0e032c..2221897a9a39da98119cfcaca4d31e4edbc1ed67 100644 (file)
@@ -292,20 +292,6 @@ isc_nm_stoplistening(isc_nmsocket_t *sock);
  * 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);
 /*
diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h
deleted file mode 100644 (file)
index 09d20b5..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * 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
index 8e3e9b5b19c62a3d27e4257987113545df3dd4b8..e8c08043bff48bfbd007d9701be7039a5c80e9a4 100644 (file)
@@ -38,12 +38,9 @@ typedef struct isc_constregion          isc_constregion_t;     /*%< Const region */
 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 */
@@ -78,8 +75,6 @@ typedef ISC_LIST(isc_sockaddr_t) isc_sockaddrlist_t; /*%< Socket Address List
 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 */
@@ -91,8 +86,6 @@ typedef struct isc_nm_http_endpoints isc_nm_http_endpoints_t;
 /*%< 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,
index e8eb88cc06a159d303a849059eda951d3482acca..6482b6be504ff444b069025cdf32ae32b360452f 100644 (file)
@@ -21,6 +21,7 @@
 #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>
@@ -484,6 +485,12 @@ void
 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];
 
@@ -499,15 +506,33 @@ isc_loopmgr_pause(isc_loopmgr_t *loopmgr) {
        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
index 9fcade3e6195a634ae25c2b53736e2f8701dd907..5471122300aaea06d04d1e4cb7489f3c0357e39c 100644 (file)
@@ -18,8 +18,7 @@
 
 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);
@@ -32,26 +31,20 @@ isc_managers_create(isc_mem_t **mctxp, uint32_t workers,
        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);
index fbd3c89f9c9f7a54e322f5a49623edab022ad884..cf9601e5be418e5d3a41bb2cae107c13bd62193a 100644 (file)
@@ -36,7 +36,6 @@
 #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>
index 8873600acc9381a8f376ceaccb1bc78c92fc2fbc..a7c59152117fcac3fa178f917cefa3f1bcd77ec0 100644 (file)
@@ -22,7 +22,6 @@
 #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>
diff --git a/lib/isc/task.c b/lib/isc/task.c
deleted file mode 100644 (file)
index 8b75e49..0000000
+++ /dev/null
@@ -1,939 +0,0 @@
-/*
- * 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
index 0d9efbe5c39c46b68339036f94e67582b7138546..e277ea7559f523cf663a3e80c8128122e605269c 100644 (file)
@@ -24,7 +24,6 @@
 #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>
index 7877bfbb180dcad745d62739d44ce3b4aa76fe06..cb70a6686bd3e26db3d45653dab6a4fb2a1c22c5 100644 (file)
@@ -8,7 +8,6 @@ libisccc_la_HEADERS =                   \
        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         \
index 1ef5eb6ea2d197e19015c48313945f2c0fc77757..1f0d2f00dd6f0b177addfc8574e486848a991ecb 100644 (file)
@@ -38,7 +38,6 @@
 #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)
diff --git a/lib/isccc/include/isccc/events.h b/lib/isccc/include/isccc/events.h
deleted file mode 100644 (file)
index ddbfbcd..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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)
index eb86aebe1861aa773c86040b226780c0be41f121..37274babe55bf03c6f5688b18e76476688c6b6eb 100644 (file)
@@ -9,7 +9,6 @@ libns_ladir = $(includedir)/ns
 
 libns_la_HEADERS =                     \
        include/ns/client.h             \
-       include/ns/events.h             \
        include/ns/hooks.h              \
        include/ns/interfacemgr.h       \
        include/ns/listenlist.h         \
index 335508d65b28f9c8d6cfc7cadff6303ac7607e15..a5d3aa6aa05dfa1e35c53c6be9f08184f5b8f022 100644 (file)
@@ -32,7 +32,6 @@
 #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>
@@ -45,7 +44,6 @@
 #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>
@@ -82,7 +80,7 @@
  * 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
@@ -2392,14 +2390,16 @@ clientmgr_destroy_cb(void *arg) {
        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));
@@ -2407,46 +2407,33 @@ clientmgr_destroy_cb(void *arg) {
 
 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");
index e1701371d59b7a9b2db7d3b67b90a64b81280848..bfd4e131c40f3efaed12f25530e058cb99057947 100644 (file)
@@ -145,11 +145,8 @@ struct ns_clientmgr {
 
        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;
@@ -320,9 +317,8 @@ ns_client_settimeout(ns_client_t *client, unsigned int seconds);
  */
 
 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.
  */
diff --git a/lib/ns/include/ns/events.h b/lib/ns/include/ns/events.h
deleted file mode 100644 (file)
index b651827..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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)
index b50327219e6cf3f3277300376a57ca9a29130925..3d34a962e0de089a415772e0b4a57ddc0ab1f8a7 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <stdbool.h>
 
-#include <isc/event.h>
 #include <isc/list.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
index 317b722405d9e72a1aa0e7513c1d0031dd0a358e..3da1c93d85ce4db2547af6d7f39e751079321748 100644 (file)
@@ -100,10 +100,10 @@ struct ns_interface {
 
 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.
  *
index 2d8f19139f29f301fda3ed98a713df7f24c980b6..431470c2eb969577f2e4341ca9b51b810bae346c 100644 (file)
@@ -29,7 +29,6 @@
 #include <dns/acl.h>
 #include <dns/types.h>
 
-#include <ns/events.h>
 #include <ns/types.h>
 
 #define NS_SERVER_LOGQUERIES   0x00000001U /*%< log queries */
index c159369a64b958b26bf41c4b1d7cd0449588aaa1..bb5160396072151cf2951e3914d1b71804e9285c 100644 (file)
@@ -21,7 +21,6 @@
 #include <isc/os.h>
 #include <isc/random.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/tid.h>
 #include <isc/util.h>
 
@@ -70,8 +69,6 @@ struct ns_interfacemgr {
        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;
@@ -272,15 +269,13 @@ route_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
 
 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);
@@ -288,7 +283,6 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
        mgr = isc_mem_get(mctx, sizeof(*mgr));
        *mgr = (ns_interfacemgr_t){
                .loopmgr = loopmgr,
-               .taskmgr = taskmgr,
                .nm = nm,
                .dispatchmgr = dispatchmgr,
                .generation = 1,
@@ -300,11 +294,6 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
 
        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);
@@ -315,7 +304,7 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
         */
        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);
 
@@ -336,8 +325,8 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
        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);
        }
@@ -361,8 +350,6 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
 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);
@@ -390,7 +377,6 @@ ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) {
        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));
 }
index 13c7a33534fe368a0413555186cf428ef0d59616..c86a97880e548f908d853ff8f4f565e2b66037a0 100644 (file)
@@ -40,7 +40,6 @@
 #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>
@@ -65,7 +64,6 @@
 #include <dns/zt.h>
 
 #include <ns/client.h>
-#include <ns/events.h>
 #include <ns/hooks.h>
 #include <ns/interfacemgr.h>
 #include <ns/log.h>
index fc56d7dc6a903d4b3085ea669b9c4404d48ed0a3..24944e0601a4be36cdc002eb467e14fc9268f900 100644 (file)
@@ -36,7 +36,6 @@
 #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>
index 99da02df55e966f77c2822dbfb4a8f807cd0809b..e5bdea7ce9c328983a9bfc8c3786203046aaa551 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <isc/buffer.h>
 #include <isc/net.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/tls.h>
 #include <isc/util.h>
index 83f874659c9e26a4a3004ad6f847da5856f4f9ce..b6fe475fabf49b3757bcae457ce48b4bc7ba480a 100644 (file)
@@ -23,7 +23,6 @@
 #include <cmocka.h>
 
 #include <isc/buffer.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
@@ -36,7 +35,6 @@
 static int
 setup_test(void **state) {
        setup_loopmgr(state);
-       setup_taskmgr(state);
        setup_netmgr(state);
 
        return (0);
@@ -45,7 +43,6 @@ setup_test(void **state) {
 static int
 teardown_test(void **state) {
        teardown_netmgr(state);
-       teardown_taskmgr(state);
        teardown_loopmgr(state);
 
        return (0);
@@ -54,12 +51,10 @@ teardown_test(void **state) {
 /* 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);
@@ -76,8 +71,7 @@ ISC_LOOP_TEST_IMPL(zonemgr_managezone) {
 
        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);
@@ -110,8 +104,7 @@ ISC_LOOP_TEST_IMPL(zonemgr_createzone) {
 
        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);
@@ -142,8 +135,7 @@ ISC_LOOP_TEST_IMPL(zonemgr_unreachable) {
 
        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);
index 00b8345dc356dae5074b9193acb49454f3b6e29e..70b7cbca2477e5c027947016cc3e60c8da80badb 100644 (file)
@@ -26,7 +26,6 @@
 #include <isc/atomic.h>
 #include <isc/buffer.h>
 #include <isc/loop.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
@@ -71,8 +70,7 @@ ISC_LOOP_TEST_IMPL(apply) {
        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);
@@ -85,12 +83,11 @@ ISC_LOOP_TEST_IMPL(apply) {
 }
 
 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);
@@ -113,12 +110,11 @@ load_done_last(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) {
 }
 
 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);
@@ -131,12 +127,11 @@ load_done_new_only(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) {
 }
 
 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);
@@ -169,8 +164,7 @@ ISC_LOOP_TEST_IMPL(asyncload_zone) {
        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);
 
@@ -257,8 +251,7 @@ ISC_LOOP_TEST_IMPL(asyncload_zt) {
        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);
index 583a299e1409586722240b7fe9761ff3f1da88c6..4a3896e4e06e37a0d4e48c2db4cd3741a852b799 100644 (file)
@@ -25,7 +25,6 @@
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
@@ -73,7 +72,7 @@ isc_result_t
 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
index 241f32f4b2fe27bc19aa28623e72dd639eb0baef..8d51f22bbbb084c7cfaaaf5f39b9b507fe551a94 100644 (file)
@@ -25,7 +25,6 @@
 #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>
@@ -34,7 +33,6 @@ extern isc_mem_t     *mctx;
 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;
@@ -49,11 +47,6 @@ setup_loopmgr(void **state);
 int
 teardown_loopmgr(void **state);
 
-int
-setup_taskmgr(void **state);
-int
-teardown_taskmgr(void **state);
-
 int
 setup_netmgr(void **state);
 int
index 8738a57fb686ac932f58a730e033da4a0ce11304..90e2cf180ed7110b62480ef93bacb1f895690798 100644 (file)
@@ -25,7 +25,6 @@
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
index b0c63516360bf40260db6ee06b2098d171f13fdf..c68c1b7da937bb2648381ba167a5aca72bd45493 100644 (file)
@@ -42,7 +42,6 @@ check_PROGRAMS =      \
        sockaddr_test   \
        stats_test      \
        symtab_test     \
-       task_test       \
        tcp_test        \
        tcpdns_test     \
        time_test       \
@@ -101,12 +100,6 @@ random_test_LDADD =        \
        $(LDADD)        \
        -lm
 
-task_test_CPPFLAGS =   \
-       $(AM_CPPFLAGS)
-
-task_test_LDADD =      \
-       $(LDADD)
-
 tcp_test_CPPFLAGS =    \
        $(AM_CPPFLAGS)  \
        $(OPENSSL_CFLAGS)
@@ -177,17 +170,6 @@ udp_test_SOURCES = \
        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
index 848902d7b9989fdec1b1b27cc473b17697b304e4..d260686726d90b6a5031fa0932db7d94ba34632a 100644 (file)
 #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"
@@ -279,10 +277,6 @@ setup_test(void **state) {
        if (r != 0) {
                return (r);
        }
-       r = setup_taskmgr(state);
-       if (r != 0) {
-               return (r);
-       }
 
        return (0);
 }
@@ -291,10 +285,6 @@ static int
 teardown_test(void **state) {
        int r;
 
-       r = teardown_taskmgr(state);
-       if (r != 0) {
-               return (r);
-       }
        r = teardown_loopmgr(state);
        if (r != 0) {
                return (r);
diff --git a/tests/isc/task_test.c b/tests/isc/task_test.c
deleted file mode 100644 (file)
index 1f489f0..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * 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
index e14cfdc3db4ac298c07393a5f08c289f8fa1ce1d..db99494493e2738e16ec6154652432842a188a78 100644 (file)
@@ -155,13 +155,11 @@ detach_zone:
        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
index 1604d66ee47ac9c2c0707091b71b4f6968c89f44..d9da8e2e610ffedd52d1f834a16fa22a8396040d 100644 (file)
@@ -27,7 +27,6 @@
 #include <isc/mem.h>
 #include <isc/os.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
@@ -37,7 +36,6 @@ isc_mem_t *mctx = NULL;
 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;
 
@@ -91,7 +89,6 @@ setup_loopmgr(void **state __attribute__((__unused__))) {
 
 int
 teardown_loopmgr(void **state __attribute__((__unused__))) {
-       REQUIRE(taskmgr == NULL);
        REQUIRE(netmgr == NULL);
 
        mainloop = NULL;
@@ -100,22 +97,6 @@ teardown_loopmgr(void **state __attribute__((__unused__))) {
        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);
@@ -139,7 +120,6 @@ teardown_netmgr(void **state __attribute__((__unused__))) {
 int
 setup_managers(void **state) {
        setup_loopmgr(state);
-       setup_taskmgr(state);
        setup_netmgr(state);
 
        return (0);
@@ -148,7 +128,6 @@ setup_managers(void **state) {
 int
 teardown_managers(void **state) {
        teardown_netmgr(state);
-       teardown_taskmgr(state);
        teardown_loopmgr(state);
 
        return (0);
index 2128b50a2b31ce78ff6f6c0224809f31c8289df1..49c60256e20edcc03ad7cfb8dadc1b46af5f59a5 100644 (file)
@@ -32,7 +32,6 @@
 #include <isc/result.h>
 #include <isc/stdio.h>
 #include <isc/string.h>
-#include <isc/task.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 
@@ -52,7 +51,6 @@
 
 #include <tests/ns.h>
 
-isc_task_t *maintask = NULL;
 dns_dispatchmgr_t *dispatchmgr = NULL;
 ns_interfacemgr_t *interfacemgr = NULL;
 ns_server_t *sctx = NULL;
@@ -92,8 +90,8 @@ setup_server(void **state) {
                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;
@@ -159,10 +157,7 @@ ns_test_serve_zone(const char *zonename, const char *filename,
        /*
         * 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.
@@ -201,7 +196,6 @@ release_zone:
        dns_test_releasezone(served_zone);
 close_zonemgr:
        dns_test_closezonemgr();
-free_zone:
        dns_zone_detach(&served_zone);
 
        return (result);
index ae867c9e28199fe962e7d89dc68be94711de15e5..615cb57a25ebaa6abd244727211b79d3189e6e78 100644 (file)
@@ -25,8 +25,6 @@
 #define UNIT_TESTING
 #include <cmocka.h>
 
-#include <isc/event.h>
-#include <isc/task.h>
 #include <isc/thread.h>
 
 #include <dns/acl.h>
index e71b1e7186a1c4a3baaa5f9a76d7eba6fc59318a..d0466cb083d6a64e7447cbf0461c472ac34b4946 100644 (file)
@@ -32,7 +32,6 @@
 #include <dns/zone.h>
 
 #include <ns/client.h>
-#include <ns/events.h>
 #include <ns/hooks.h>
 #include <ns/query.h>
 #include <ns/server.h>