From 03c618afa3c19fe4574a5bc45eec09fd0b1d5990 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 26 Oct 2007 16:45:32 +1000 Subject: [PATCH] - otto@cvs.openbsd.org 2005/11/25 08:06:25 [openbsd-compat/sys-queue.h] Introduce debugging aid for queue macros. Disabled by default; but developers are encouraged to run with this enabled. ok krw@ fgsch@ deraadt@ --- ChangeLog | 7 ++++++- openbsd-compat/sys-queue.h | 21 ++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 238e6c45a..33798ba94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -118,6 +118,11 @@ [openbsd-compat/sys-queue.h] Some uvm problem is being exposed with the more strict macros. Revert until we've found out what's causing the panics. + - otto@cvs.openbsd.org 2005/11/25 08:06:25 + [openbsd-compat/sys-queue.h] + Introduce debugging aid for queue macros. Disabled by default; but + developers are encouraged to run with this enabled. + ok krw@ fgsch@ deraadt@ - (djm) [regress/sftp-cmds.sh] Use more restrictive glob to pick up test files from /bin - some platforms ship broken symlinks there which could spoil the test. @@ -3394,4 +3399,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4790 2007/10/26 06:44:27 djm Exp $ +$Id: ChangeLog,v 1.4791 2007/10/26 06:45:32 djm Exp $ 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 @@ -/* $OpenBSD: queue.h,v 1.30 2005/10/25 06:37:47 otto Exp $ */ +/* $OpenBSD: queue.h,v 1.31 2005/11/25 08:06:25 otto Exp $ */ /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ /* @@ -167,6 +167,12 @@ * For details on the use of these macros, see the queue(3) manual page. */ +#ifdef QUEUE_MACRO_DEBUG +#define _Q_INVALIDATE(a) (a) = ((void *)-1) +#else +#define _Q_INVALIDATE(a) +#endif + /* * Singly-linked List definitions. */ @@ -236,6 +242,7 @@ struct { \ curelm = curelm->field.sle_next; \ curelm->field.sle_next = \ curelm->field.sle_next->field.sle_next; \ + _Q_INVALIDATE((elm)->field.sle_next); \ } \ } while (0) @@ -303,6 +310,8 @@ struct { \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = (elm)->field.le_next; \ + _Q_INVALIDATE((elm)->field.le_prev); \ + _Q_INVALIDATE((elm)->field.le_next); \ } while (0) #define LIST_REPLACE(elm, elm2, field) do { \ @@ -311,6 +320,8 @@ struct { \ &(elm2)->field.le_next; \ (elm2)->field.le_prev = (elm)->field.le_prev; \ *(elm2)->field.le_prev = (elm2); \ + _Q_INVALIDATE((elm)->field.le_prev); \ + _Q_INVALIDATE((elm)->field.le_next); \ } while (0) /* @@ -465,6 +476,8 @@ struct { \ else \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ + _Q_INVALIDATE((elm)->field.tqe_prev); \ + _Q_INVALIDATE((elm)->field.tqe_next); \ } while (0) #define TAILQ_REPLACE(head, elm, elm2, field) do { \ @@ -475,6 +488,8 @@ struct { \ (head)->tqh_last = &(elm2)->field.tqe_next; \ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ *(elm2)->field.tqe_prev = (elm2); \ + _Q_INVALIDATE((elm)->field.tqe_prev); \ + _Q_INVALIDATE((elm)->field.tqe_next); \ } while (0) /* @@ -575,6 +590,8 @@ struct { \ else \ (elm)->field.cqe_prev->field.cqe_next = \ (elm)->field.cqe_next; \ + _Q_INVALIDATE((elm)->field.cqe_prev); \ + _Q_INVALIDATE((elm)->field.cqe_next); \ } while (0) #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ @@ -588,6 +605,8 @@ struct { \ (head).cqh_first = (elm2); \ else \ (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ + _Q_INVALIDATE((elm)->field.cqe_prev); \ + _Q_INVALIDATE((elm)->field.cqe_next); \ } while (0) #endif /* !_FAKE_QUEUE_H_ */