diff --git a/doc/dev/dev.md b/doc/dev/dev.md
index d769d6f18b..7fbbc8ac86 100644
--- a/doc/dev/dev.md
+++ b/doc/dev/dev.md
@@ -654,10 +654,6 @@ Items can be removed from the list using `ISC_LIST_UNLINK`:
ISC_LIST_UNLINK(foolist, foo, link);
-A similar but smaller set of `ISC_QUEUE` macros, including `ISC_QUEUE_PUSH`
-and `ISC_QUEUE_POP`, are provided to implement strict FIFO lists, with
-built-in fine-grained locking.
-
#### Names
The `dns_name` API has facilities for processing DNS names and labels,
diff --git a/lib/dns/include/dns/fixedname.h b/lib/dns/include/dns/fixedname.h
index 623313439c..6a9b555105 100644
--- a/lib/dns/include/dns/fixedname.h
+++ b/lib/dns/include/dns/fixedname.h
@@ -51,7 +51,6 @@
#include
#include
-#include
#include
diff --git a/lib/isc/app.c b/lib/isc/app.c
index 9f228278bb..1a013f1f01 100644
--- a/lib/isc/app.c
+++ b/lib/isc/app.c
@@ -29,7 +29,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h
index 6dec61ef64..07d259956c 100644
--- a/lib/isc/include/isc/buffer.h
+++ b/lib/isc/include/isc/buffer.h
@@ -105,7 +105,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/lib/isc/include/isc/event.h b/lib/isc/include/isc/event.h
index 3e9fe19c8a..99d867cd5a 100644
--- a/lib/isc/include/isc/event.h
+++ b/lib/isc/include/isc/event.h
@@ -16,7 +16,6 @@
/*! \file isc/event.h */
#include
-#include
#include
/*****
diff --git a/lib/isc/include/isc/list.h b/lib/isc/include/isc/list.h
index b7b245c1bd..bc90bb974e 100644
--- a/lib/isc/include/isc/list.h
+++ b/lib/isc/include/isc/list.h
@@ -9,14 +9,11 @@
* information regarding copyright ownership.
*/
+
#ifndef ISC_LIST_H
#define ISC_LIST_H 1
-#include
-
#include
-#include
-#include
#ifdef ISC_LIST_CHECKINIT
#define ISC_LINK_INSIST(x) ISC_INSIST(x)
@@ -24,6 +21,7 @@
#define ISC_LINK_INSIST(x)
#endif
+#define ISC_LIST(type) struct { type *head, *tail; }
#define ISC_LIST_INIT(list) \
do { (list).head = NULL; (list).tail = NULL; } while (0)
@@ -191,144 +189,4 @@
#define __ISC_LIST_DEQUEUEUNSAFE_TYPE(list, elt, link, type) \
__ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type)
-/*
- * This is a generic implementation of a two-lock concurrent queue.
- * There are built-in mutex locks for the head and tail of the queue,
- * allowing elements to be safely added and removed at the same time.
- *
- * NULL is "end of list"
- * -1 is "not linked"
- */
-
-#ifdef ISC_QUEUE_CHECKINIT
-#define ISC_QLINK_INSIST(x) ISC_INSIST(x)
-#else
-#define ISC_QLINK_INSIST(x) (void)0
-#endif
-
-#define ISC_QLINK(type) struct { type *prev, *next; }
-
-#define ISC_QLINK_INIT(elt, link) \
- do { \
- (elt)->link.next = (elt)->link.prev = (void *)(-1); \
- } while(0)
-
-#define ISC_QLINK_LINKED(elt, link) ((void*)(elt)->link.next != (void*)(-1))
-
-#define ISC_QUEUE(type) struct { \
- type *head, *tail; \
- isc_mutex_t headlock, taillock; \
-}
-
-#define ISC_QUEUE_INIT(queue, link) \
- do { \
- isc_mutex_init(&(queue).taillock); \
- isc_mutex_init(&(queue).headlock); \
- (queue).tail = (queue).head = NULL; \
- } while (0)
-
-#define ISC_QUEUE_EMPTY(queue) ((queue).head == NULL)
-
-#define ISC_QUEUE_DESTROY(queue) \
- do { \
- ISC_QLINK_INSIST(ISC_QUEUE_EMPTY(queue)); \
- isc_mutex_destroy(&(queue).taillock); \
- isc_mutex_destroy(&(queue).headlock); \
- } while (0)
-
-/*
- * queues are meant to separate the locks at either end. For best effect, that
- * means keeping the ends separate - i.e. non-empty queues work best.
- *
- * a push to an empty queue has to take the pop lock to update
- * the pop side of the queue.
- * Popping the last entry has to take the push lock to update
- * the push side of the queue.
- *
- * The order is (pop, push), because a pop is presumably in the
- * latency path and a push is when we're done.
- *
- * We do an MT hot test in push to see if we need both locks, so we can
- * acquire them in order. Hopefully that makes the case where we get
- * the push lock and find we need the pop lock (and have to release it) rare.
- *
- * > 1 entry - no collision, push works on one end, pop on the other
- * 0 entry - headlock race
- * pop wins - return(NULL), push adds new as both head/tail
- * push wins - updates head/tail, becomes 1 entry case.
- * 1 entry - taillock race
- * pop wins - return(pop) sets head/tail NULL, becomes 0 entry case
- * push wins - updates {head,tail}->link.next, pop updates head
- * with new ->link.next and doesn't update tail
- *
- */
-#define ISC_QUEUE_PUSH(queue, elt, link) \
- do { \
- bool headlocked = false; \
- ISC_QLINK_INSIST(!ISC_QLINK_LINKED(elt, link)); \
- if ((queue).head == NULL) { \
- LOCK(&(queue).headlock); \
- headlocked = true; \
- } \
- LOCK(&(queue).taillock); \
- if ((queue).tail == NULL && !headlocked) { \
- UNLOCK(&(queue).taillock); \
- LOCK(&(queue).headlock); \
- LOCK(&(queue).taillock); \
- headlocked = true; \
- } \
- (elt)->link.prev = (queue).tail; \
- (elt)->link.next = NULL; \
- if ((queue).tail != NULL) \
- (queue).tail->link.next = (elt); \
- (queue).tail = (elt); \
- UNLOCK(&(queue).taillock); \
- if (headlocked) { \
- if ((queue).head == NULL) \
- (queue).head = (elt); \
- UNLOCK(&(queue).headlock); \
- } \
- } while (0)
-
-#define ISC_QUEUE_POP(queue, link, ret) \
- do { \
- LOCK(&(queue).headlock); \
- ret = (queue).head; \
- while (ret != NULL) { \
- if (ret->link.next == NULL) { \
- LOCK(&(queue).taillock); \
- if (ret->link.next == NULL) { \
- (queue).head = (queue).tail = NULL; \
- UNLOCK(&(queue).taillock); \
- break; \
- }\
- UNLOCK(&(queue).taillock); \
- } \
- (queue).head = ret->link.next; \
- (queue).head->link.prev = NULL; \
- break; \
- } \
- UNLOCK(&(queue).headlock); \
- if (ret != NULL) \
- (ret)->link.next = (ret)->link.prev = (void *)(-1); \
- } while(0)
-
-#define ISC_QUEUE_UNLINK(queue, elt, link) \
- do { \
- ISC_QLINK_INSIST(ISC_QLINK_LINKED(elt, link)); \
- LOCK(&(queue).headlock); \
- LOCK(&(queue).taillock); \
- if ((elt)->link.prev == NULL) \
- (queue).head = (elt)->link.next; \
- else \
- (elt)->link.prev->link.next = (elt)->link.next; \
- if ((elt)->link.next == NULL) \
- (queue).tail = (elt)->link.prev; \
- else \
- (elt)->link.next->link.prev = (elt)->link.prev; \
- UNLOCK(&(queue).taillock); \
- UNLOCK(&(queue).headlock); \
- (elt)->link.next = (elt)->link.prev = (void *)(-1); \
- } while(0)
-
#endif /* ISC_LIST_H */
diff --git a/lib/isc/include/isc/sockaddr.h b/lib/isc/include/isc/sockaddr.h
index a1d5080881..1588ba9645 100644
--- a/lib/isc/include/isc/sockaddr.h
+++ b/lib/isc/include/isc/sockaddr.h
@@ -18,7 +18,6 @@
#include
#include
-#include
#include
#include
#ifdef ISC_PLATFORM_HAVESYSUNH
diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h
index 5548d9989d..3d1eb779b7 100644
--- a/lib/isc/include/isc/types.h
+++ b/lib/isc/include/isc/types.h
@@ -20,16 +20,15 @@
*/
#include
#include
-
-#include
#include
-/* Core Types. Alphabetized by defined type. */
-
/*
- * Defined here so we don't need to include list.h.
+ * XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other
+ * list macros too.
*/
-#define ISC_LIST(type) struct { type *head, *tail; }
+#include
+
+/* Core Types. Alphabetized by defined type. */
typedef struct isc_astack isc_astack_t; /*%< Array-based fast stack */
typedef struct isc_appctx isc_appctx_t; /*%< Application context */
diff --git a/lib/isc/tests/Kyuafile b/lib/isc/tests/Kyuafile
index 4f25e19392..834261b321 100644
--- a/lib/isc/tests/Kyuafile
+++ b/lib/isc/tests/Kyuafile
@@ -16,7 +16,6 @@ tap_test_program{name='mem_test'}
tap_test_program{name='netaddr_test'}
tap_test_program{name='parse_test'}
tap_test_program{name='pool_test'}
-tap_test_program{name='queue_test'}
tap_test_program{name='radix_test'}
tap_test_program{name='regex_test'}
tap_test_program{name='result_test'}
diff --git a/lib/isc/tests/Makefile.in b/lib/isc/tests/Makefile.in
index abeca57a62..046b8dcff3 100644
--- a/lib/isc/tests/Makefile.in
+++ b/lib/isc/tests/Makefile.in
@@ -33,7 +33,7 @@ SRCS = isctest.c aes_test.c buffer_test.c \
counter_test.c crc64_test.c errno_test.c file_test.c hash_test.c \
heap_test.c hmac_test.c ht_test.c lex_test.c \
mem_test.c md_test.c netaddr_test.c parse_test.c pool_test.c \
- queue_test.c radix_test.c random_test.c \
+ radix_test.c random_test.c \
regex_test.c result_test.c safe_test.c siphash_test.c sockaddr_test.c \
socket_test.c socket_test.c symtab_test.c task_test.c \
taskpool_test.c time_test.c timer_test.c
@@ -46,7 +46,7 @@ TARGETS = aes_test@EXEEXT@ buffer_test@EXEEXT@ \
ht_test@EXEEXT@ \
lex_test@EXEEXT@ mem_test@EXEEXT@ md_test@EXEEXT@ \
netaddr_test@EXEEXT@ parse_test@EXEEXT@ pool_test@EXEEXT@ \
- queue_test@EXEEXT@ radix_test@EXEEXT@ \
+ radix_test@EXEEXT@ \
random_test@EXEEXT@ regex_test@EXEEXT@ result_test@EXEEXT@ \
safe_test@EXEEXT@ siphash_test@EXEEXT@ sockaddr_test@EXEEXT@ socket_test@EXEEXT@ \
socket_test@EXEEXT@ symtab_test@EXEEXT@ task_test@EXEEXT@ \
@@ -134,11 +134,6 @@ pool_test@EXEEXT@: pool_test.@O@ isctest.@O@ ${ISCDEPLIBS}
${LDFLAGS} -o $@ pool_test.@O@ isctest.@O@ \
${ISCLIBS} ${LIBS}
-queue_test@EXEEXT@: queue_test.@O@ isctest.@O@ ${ISCDEPLIBS}
- ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
- ${LDFLAGS} -o $@ queue_test.@O@ isctest.@O@ \
- ${ISCLIBS} ${LIBS}
-
radix_test@EXEEXT@: radix_test.@O@ isctest.@O@ ${ISCDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
${LDFLAGS} -o $@ radix_test.@O@ isctest.@O@ \
diff --git a/lib/isc/tests/queue_test.c b/lib/isc/tests/queue_test.c
deleted file mode 100644
index 73025776cd..0000000000
--- a/lib/isc/tests/queue_test.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-#if HAVE_CMOCKA
-
-#include
-#include
-#include
-
-#include /* IWYU pragma: keep */
-#include
-#include
-#include
-#include
-
-#define UNIT_TESTING
-#include
-
-#include
-#include
-
-#include "isctest.h"
-
-static int
-_setup(void **state) {
- isc_result_t result;
-
- UNUSED(state);
-
- result = isc_test_begin(NULL, true, 0);
- assert_int_equal(result, ISC_R_SUCCESS);
-
- return (0);
-}
-
-static int
-_teardown(void **state) {
- UNUSED(state);
-
- isc_test_end();
-
- return (0);
-}
-
-typedef struct item item_t;
-struct item {
- int value;
- ISC_QLINK(item_t) qlink;
-};
-
-typedef ISC_QUEUE(item_t) item_queue_t;
-
-static void
-item_init(item_t *item, int value) {
- item->value = value;
- ISC_QLINK_INIT(item, qlink);
-}
-
-/* Test UDP sendto/recv (IPv4) */
-static void
-queue_valid(void **state) {
- item_queue_t queue;
- item_t one, two, three, four, five;
- item_t *p;
-
- UNUSED(state);
-
- ISC_QUEUE_INIT(queue, qlink);
-
- item_init(&one, 1);
- item_init(&two, 2);
- item_init(&three, 3);
- item_init(&four, 4);
- item_init(&five, 5);
-
- assert_true(ISC_QUEUE_EMPTY(queue));
-
- ISC_QUEUE_POP(queue, qlink, p);
- assert_null(p);
-
- assert_false(ISC_QLINK_LINKED(&one, qlink));
- ISC_QUEUE_PUSH(queue, &one, qlink);
- assert_true(ISC_QLINK_LINKED(&one, qlink));
-
- assert_false(ISC_QUEUE_EMPTY(queue));
-
- ISC_QUEUE_POP(queue, qlink, p);
- assert_non_null(p);
- assert_int_equal(p->value, 1);
- assert_true(ISC_QUEUE_EMPTY(queue));
- assert_false(ISC_QLINK_LINKED(p, qlink));
-
- ISC_QUEUE_PUSH(queue, p, qlink);
- assert_false(ISC_QUEUE_EMPTY(queue));
- assert_true(ISC_QLINK_LINKED(p, qlink));
-
- assert_false(ISC_QLINK_LINKED(&two, qlink));
- ISC_QUEUE_PUSH(queue, &two, qlink);
- assert_true(ISC_QLINK_LINKED(&two, qlink));
-
- assert_false(ISC_QLINK_LINKED(&three, qlink));
- ISC_QUEUE_PUSH(queue, &three, qlink);
- assert_true(ISC_QLINK_LINKED(&three, qlink));
-
- assert_false(ISC_QLINK_LINKED(&four, qlink));
- ISC_QUEUE_PUSH(queue, &four, qlink);
- assert_true(ISC_QLINK_LINKED(&four, qlink));
-
- assert_false(ISC_QLINK_LINKED(&five, qlink));
- ISC_QUEUE_PUSH(queue, &five, qlink);
- assert_true(ISC_QLINK_LINKED(&five, qlink));
-
- /* Test unlink by removing one item from the middle */
- ISC_QUEUE_UNLINK(queue, &three, qlink);
-
- ISC_QUEUE_POP(queue, qlink, p);
- assert_non_null(p);
- assert_int_equal(p->value, 1);
-
- ISC_QUEUE_POP(queue, qlink, p);
- assert_non_null(p);
- assert_int_equal(p->value, 2);
-
- ISC_QUEUE_POP(queue, qlink, p);
- assert_non_null(p);
- assert_int_equal(p->value, 4);
-
- ISC_QUEUE_POP(queue, qlink, p);
- assert_non_null(p);
- assert_int_equal(p->value, 5);
-
- assert_null(queue.head);
- assert_null(queue.tail);
- assert_true(ISC_QUEUE_EMPTY(queue));
-
- ISC_QUEUE_DESTROY(queue);
-}
-
-int
-main(void) {
- const struct CMUnitTest tests[] = {
- cmocka_unit_test_setup_teardown(queue_valid,
- _setup, _teardown),
- };
-
- return (cmocka_run_group_tests(tests, NULL, NULL));
-}
-
-#else /* HAVE_CMOCKA */
-
-#include
-
-int
-main(void) {
- printf("1..0 # Skipped: cmocka not available\n");
- return (0);
-}
-
-#endif
diff --git a/lib/ns/client.c b/lib/ns/client.c
index 9104c3809e..69400141a1 100644
--- a/lib/ns/client.c
+++ b/lib/ns/client.c
@@ -16,7 +16,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/lib/ns/include/ns/client.h b/lib/ns/include/ns/client.h
index 0ad452ad8a..613a91f822 100644
--- a/lib/ns/include/ns/client.h
+++ b/lib/ns/include/ns/client.h
@@ -58,7 +58,6 @@
#include
#include
-#include
#include
#include
#include
diff --git a/lib/ns/notify.c b/lib/ns/notify.c
index be4ef5dca7..3c0ad5db17 100644
--- a/lib/ns/notify.c
+++ b/lib/ns/notify.c
@@ -9,7 +9,6 @@
* information regarding copyright ownership.
*/
-#include
#include
#include
diff --git a/util/copyrights b/util/copyrights
index 66eb5bed7d..92a4506c57 100644
--- a/util/copyrights
+++ b/util/copyrights
@@ -2314,7 +2314,6 @@
./lib/isc/tests/netaddr_test.c C 2016,2018,2019
./lib/isc/tests/parse_test.c C 2012,2013,2016,2018,2019
./lib/isc/tests/pool_test.c C 2013,2016,2018,2019
-./lib/isc/tests/queue_test.c C 2011,2012,2016,2018,2019
./lib/isc/tests/radix_test.c C 2014,2016,2018,2019
./lib/isc/tests/random_test.c C 2014,2015,2016,2017,2018,2019
./lib/isc/tests/regex_test.c C 2013,2015,2016,2018,2019