summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/sys-queue.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/openbsd-compat/sys-queue.h b/openbsd-compat/sys-queue.h
index db747befa..7d231bca8 100644
--- a/openbsd-compat/sys-queue.h
+++ b/openbsd-compat/sys-queue.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: queue.h,v 1.30 2005/10/25 06:37:47 otto Exp $ */ 1/* $OpenBSD: queue.h,v 1.31 2005/11/25 08:06:25 otto Exp $ */
2/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ 2/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
3 3
4/* 4/*
@@ -167,6 +167,12 @@
167 * For details on the use of these macros, see the queue(3) manual page. 167 * For details on the use of these macros, see the queue(3) manual page.
168 */ 168 */
169 169
170#ifdef QUEUE_MACRO_DEBUG
171#define _Q_INVALIDATE(a) (a) = ((void *)-1)
172#else
173#define _Q_INVALIDATE(a)
174#endif
175
170/* 176/*
171 * Singly-linked List definitions. 177 * Singly-linked List definitions.
172 */ 178 */
@@ -236,6 +242,7 @@ struct { \
236 curelm = curelm->field.sle_next; \ 242 curelm = curelm->field.sle_next; \
237 curelm->field.sle_next = \ 243 curelm->field.sle_next = \
238 curelm->field.sle_next->field.sle_next; \ 244 curelm->field.sle_next->field.sle_next; \
245 _Q_INVALIDATE((elm)->field.sle_next); \
239 } \ 246 } \
240} while (0) 247} while (0)
241 248
@@ -303,6 +310,8 @@ struct { \
303 (elm)->field.le_next->field.le_prev = \ 310 (elm)->field.le_next->field.le_prev = \
304 (elm)->field.le_prev; \ 311 (elm)->field.le_prev; \
305 *(elm)->field.le_prev = (elm)->field.le_next; \ 312 *(elm)->field.le_prev = (elm)->field.le_next; \
313 _Q_INVALIDATE((elm)->field.le_prev); \
314 _Q_INVALIDATE((elm)->field.le_next); \
306} while (0) 315} while (0)
307 316
308#define LIST_REPLACE(elm, elm2, field) do { \ 317#define LIST_REPLACE(elm, elm2, field) do { \
@@ -311,6 +320,8 @@ struct { \
311 &(elm2)->field.le_next; \ 320 &(elm2)->field.le_next; \
312 (elm2)->field.le_prev = (elm)->field.le_prev; \ 321 (elm2)->field.le_prev = (elm)->field.le_prev; \
313 *(elm2)->field.le_prev = (elm2); \ 322 *(elm2)->field.le_prev = (elm2); \
323 _Q_INVALIDATE((elm)->field.le_prev); \
324 _Q_INVALIDATE((elm)->field.le_next); \
314} while (0) 325} while (0)
315 326
316/* 327/*
@@ -465,6 +476,8 @@ struct { \
465 else \ 476 else \
466 (head)->tqh_last = (elm)->field.tqe_prev; \ 477 (head)->tqh_last = (elm)->field.tqe_prev; \
467 *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ 478 *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
479 _Q_INVALIDATE((elm)->field.tqe_prev); \
480 _Q_INVALIDATE((elm)->field.tqe_next); \
468} while (0) 481} while (0)
469 482
470#define TAILQ_REPLACE(head, elm, elm2, field) do { \ 483#define TAILQ_REPLACE(head, elm, elm2, field) do { \
@@ -475,6 +488,8 @@ struct { \
475 (head)->tqh_last = &(elm2)->field.tqe_next; \ 488 (head)->tqh_last = &(elm2)->field.tqe_next; \
476 (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ 489 (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
477 *(elm2)->field.tqe_prev = (elm2); \ 490 *(elm2)->field.tqe_prev = (elm2); \
491 _Q_INVALIDATE((elm)->field.tqe_prev); \
492 _Q_INVALIDATE((elm)->field.tqe_next); \
478} while (0) 493} while (0)
479 494
480/* 495/*
@@ -575,6 +590,8 @@ struct { \
575 else \ 590 else \
576 (elm)->field.cqe_prev->field.cqe_next = \ 591 (elm)->field.cqe_prev->field.cqe_next = \
577 (elm)->field.cqe_next; \ 592 (elm)->field.cqe_next; \
593 _Q_INVALIDATE((elm)->field.cqe_prev); \
594 _Q_INVALIDATE((elm)->field.cqe_next); \
578} while (0) 595} while (0)
579 596
580#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ 597#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
@@ -588,6 +605,8 @@ struct { \
588 (head).cqh_first = (elm2); \ 605 (head).cqh_first = (elm2); \
589 else \ 606 else \
590 (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ 607 (elm2)->field.cqe_prev->field.cqe_next = (elm2); \
608 _Q_INVALIDATE((elm)->field.cqe_prev); \
609 _Q_INVALIDATE((elm)->field.cqe_next); \
591} while (0) 610} while (0)
592 611
593#endif /* !_FAKE_QUEUE_H_ */ 612#endif /* !_FAKE_QUEUE_H_ */