queue.h revision 67447
1/*
2 * Copyright (c) 1991, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 *	@(#)queue.h	8.5 (Berkeley) 8/20/94
34 * $FreeBSD: head/sys/sys/queue.h 67447 2000-10-22 19:43:01Z phk $
35 */
36
37#ifndef _SYS_QUEUE_H_
38#define	_SYS_QUEUE_H_
39
40/*
41 * This file defines five types of data structures: singly-linked lists,
42 * singly-linked tail queues, lists, tail queues, and circular queues.
43 *
44 * A singly-linked list is headed by a single forward pointer. The elements
45 * are singly linked for minimum space and pointer manipulation overhead at
46 * the expense of O(n) removal for arbitrary elements. New elements can be
47 * added to the list after an existing element or at the head of the list.
48 * Elements being removed from the head of the list should use the explicit
49 * macro for this purpose for optimum efficiency. A singly-linked list may
50 * only be traversed in the forward direction.  Singly-linked lists are ideal
51 * for applications with large datasets and few or no removals or for
52 * implementing a LIFO queue.
53 *
54 * A singly-linked tail queue is headed by a pair of pointers, one to the
55 * head of the list and the other to the tail of the list. The elements are
56 * singly linked for minimum space and pointer manipulation overhead at the
57 * expense of O(n) removal for arbitrary elements. New elements can be added
58 * to the list after an existing element, at the head of the list, or at the
59 * end of the list. Elements being removed from the head of the tail queue
60 * should use the explicit macro for this purpose for optimum efficiency.
61 * A singly-linked tail queue may only be traversed in the forward direction.
62 * Singly-linked tail queues are ideal for applications with large datasets
63 * and few or no removals or for implementing a FIFO queue.
64 *
65 * A list is headed by a single forward pointer (or an array of forward
66 * pointers for a hash table header). The elements are doubly linked
67 * so that an arbitrary element can be removed without a need to
68 * traverse the list. New elements can be added to the list before
69 * or after an existing element or at the head of the list. A list
70 * may only be traversed in the forward direction.
71 *
72 * A tail queue is headed by a pair of pointers, one to the head of the
73 * list and the other to the tail of the list. The elements are doubly
74 * linked so that an arbitrary element can be removed without a need to
75 * traverse the list. New elements can be added to the list before or
76 * after an existing element, at the head of the list, or at the end of
77 * the list. A tail queue may be traversed in either direction.
78 *
79 * A circle queue is headed by a pair of pointers, one to the head of the
80 * list and the other to the tail of the list. The elements are doubly
81 * linked so that an arbitrary element can be removed without a need to
82 * traverse the list. New elements can be added to the list before or after
83 * an existing element, at the head of the list, or at the end of the list.
84 * A circle queue may be traversed in either direction, but has a more
85 * complex end of list detection.
86 *
87 * For details on the use of these macros, see the queue(3) manual page.
88 *
89 *
90 *			SLIST	LIST	STAILQ	TAILQ	CIRCLEQ
91 * _HEAD		+	+	+	+	+
92 * _HEAD_INITIALIZER	+	+	+	+	+
93 * _ENTRY		+	+	+	+	+
94 * _INIT		+	+	+	+	+
95 * _EMPTY		+	+	+	+	+
96 * _FIRST		+	+	+	+	+
97 * _NEXT		+	+	+	+	+
98 * _PREV		-	-	-	+	+
99 * _LAST		-	-	+	+	+
100 * _FOREACH		+	+	+	+	+
101 * _FOREACH_REVERSE	-	-	-	+	+
102 * _INSERT_HEAD		+	+	+	+	+
103 * _INSERT_BEFORE	-	+	-	+	+
104 * _INSERT_AFTER	+	+	+	+	+
105 * _INSERT_TAIL		-	-	+	+	+
106 * _REMOVE_HEAD		+	-	+	-	-
107 * _REMOVE		+	+	+	+	+
108 *
109 */
110
111/*
112 * XXX: temporary, we need to find the real home of these.
113 */
114
115/* Offset of the field in the structure. */
116#define	__qfldoff(name, field) \
117	((int)&(((struct name *)0)->field))
118
119/* Address of the structure from a field. */
120#define	__qstrbase(name, addr, field) \
121	((struct name *)((char *)(addr) - __qfldoff(name, field)))
122
123/*
124 * Singly-linked List declarations.
125 */
126#define	SLIST_HEAD(name, type)						\
127struct name {								\
128	struct type *slh_first;	/* first element */			\
129}
130
131#define	SLIST_HEAD_INITIALIZER(head)					\
132	{ NULL }
133
134#define	SLIST_ENTRY(type)						\
135struct {								\
136	struct type *sle_next;	/* next element */			\
137}
138
139/*
140 * Singly-linked List functions.
141 */
142#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
143
144#define	SLIST_FIRST(head)	((head)->slh_first)
145
146#define	SLIST_FOREACH(var, head, field)					\
147	for ((var) = SLIST_FIRST((head));				\
148	    (var);							\
149	    (var) = SLIST_NEXT((var), field))
150
151#define	SLIST_INIT(head) do {						\
152	SLIST_FIRST((head)) = NULL;					\
153} while (0)
154
155#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
156	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\
157	SLIST_NEXT((slistelm), field) = (elm);				\
158} while (0)
159
160#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
161	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\
162	SLIST_FIRST((head)) = (elm);					\
163} while (0)
164
165#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
166
167#define	SLIST_REMOVE(head, elm, type, field) do {			\
168	if (SLIST_FIRST((head)) == (elm)) {				\
169		SLIST_REMOVE_HEAD((head), field);			\
170	}								\
171	else {								\
172		struct type *curelm = SLIST_FIRST((head));		\
173		while (SLIST_NEXT(curelm, field) != (elm))		\
174			curelm = SLIST_NEXT(curelm, field);		\
175		SLIST_NEXT(curelm, field) =				\
176		    SLIST_NEXT(SLIST_NEXT(curelm, field), field);	\
177	}								\
178} while (0)
179
180#define	SLIST_REMOVE_HEAD(head, field) do {				\
181	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\
182} while (0)
183
184/*
185 * Singly-linked Tail queue declarations.
186 */
187#define	STAILQ_HEAD(name, type)						\
188struct name {								\
189	struct type *stqh_first;/* first element */			\
190	struct type **stqh_last;/* addr of last next element */		\
191}
192
193#define	STAILQ_HEAD_INITIALIZER(head)					\
194	{ NULL, &(head).stqh_first }
195
196#define	STAILQ_ENTRY(type)						\
197struct {								\
198	struct type *stqe_next;	/* next element */			\
199}
200
201/*
202 * Singly-linked Tail queue functions.
203 */
204#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
205
206#define	STAILQ_FIRST(head)	((head)->stqh_first)
207
208#define	STAILQ_FOREACH(var, head, field)				\
209	for((var) = STAILQ_FIRST((head));				\
210	   (var);							\
211	   (var) = STAILQ_NEXT((var), field))
212
213#define	STAILQ_INIT(head) do {						\
214	STAILQ_FIRST((head)) = NULL;					\
215	(head)->stqh_last = &STAILQ_FIRST((head));			\
216} while (0)
217
218#define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\
219	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
220		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
221	STAILQ_NEXT((tqelm), field) = (elm);				\
222} while (0)
223
224#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
225	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\
226		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
227	STAILQ_FIRST((head)) = (elm);					\
228} while (0)
229
230#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
231	STAILQ_NEXT((elm), field) = NULL;				\
232	*(head)->stqh_last = (elm);					\
233	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
234} while (0)
235
236#define	STAILQ_LAST(head, type, field)					\
237	(STAILQ_EMPTY(head) ?						\
238		NULL :							\
239		__qstrbase(type, (head)->stqh_last, field))
240
241#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
242
243#define	STAILQ_REMOVE(head, elm, type, field) do {			\
244	if (STAILQ_FIRST((head)) == (elm)) {				\
245		STAILQ_REMOVE_HEAD(head, field);			\
246	}								\
247	else {								\
248		struct type *curelm = STAILQ_FIRST((head));		\
249		while (STAILQ_NEXT(curelm, field) != (elm))		\
250			curelm = STAILQ_NEXT(curelm, field);		\
251		if ((STAILQ_NEXT(curelm, field) =			\
252		     STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\
253			(head)->stqh_last = &STAILQ_NEXT((curelm), field);\
254	}								\
255} while (0)
256
257#define	STAILQ_REMOVE_HEAD(head, field) do {				\
258	if ((STAILQ_FIRST((head)) =					\
259	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
260		(head)->stqh_last = &STAILQ_FIRST((head));		\
261} while (0)
262
263#define	STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do {			\
264	if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL)	\
265		(head)->stqh_last = &STAILQ_FIRST((head));		\
266} while (0)
267
268/*
269 * List declarations.
270 */
271#define	LIST_HEAD(name, type)						\
272struct name {								\
273	struct type *lh_first;	/* first element */			\
274}
275
276#define	LIST_HEAD_INITIALIZER(head)					\
277	{ NULL }
278
279#define	LIST_ENTRY(type)						\
280struct {								\
281	struct type *le_next;	/* next element */			\
282	struct type **le_prev;	/* address of previous next element */	\
283}
284
285/*
286 * List functions.
287 */
288
289#define	LIST_EMPTY(head)	((head)->lh_first == NULL)
290
291#define	LIST_FIRST(head)	((head)->lh_first)
292
293#define	LIST_FOREACH(var, head, field)					\
294	for ((var) = LIST_FIRST((head));				\
295	    (var);							\
296	    (var) = LIST_NEXT((var), field))
297
298#define	LIST_INIT(head) do {						\
299	LIST_FIRST((head)) = NULL;					\
300} while (0)
301
302#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
303	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
304		LIST_NEXT((listelm), field)->field.le_prev =		\
305		    &LIST_NEXT((elm), field);				\
306	LIST_NEXT((listelm), field) = (elm);				\
307	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\
308} while (0)
309
310#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
311	(elm)->field.le_prev = (listelm)->field.le_prev;		\
312	LIST_NEXT((elm), field) = (listelm);				\
313	*(listelm)->field.le_prev = (elm);				\
314	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
315} while (0)
316
317#define	LIST_INSERT_HEAD(head, elm, field) do {				\
318	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
319		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
320	LIST_FIRST((head)) = (elm);					\
321	(elm)->field.le_prev = &LIST_FIRST((head));			\
322} while (0)
323
324#define	LIST_NEXT(elm, field)	((elm)->field.le_next)
325
326#define	LIST_REMOVE(elm, field) do {					\
327	if (LIST_NEXT((elm), field) != NULL)				\
328		LIST_NEXT((elm), field)->field.le_prev = 		\
329		    (elm)->field.le_prev;				\
330	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
331} while (0)
332
333/*
334 * Tail queue declarations.
335 */
336#define	TAILQ_HEAD(name, type)						\
337struct name {								\
338	struct type *tqh_first;	/* first element */			\
339	struct type **tqh_last;	/* addr of last next element */		\
340}
341
342#define	TAILQ_HEAD_INITIALIZER(head)					\
343	{ NULL, &(head).tqh_first }
344
345#define	TAILQ_ENTRY(type)						\
346struct {								\
347	struct type *tqe_next;	/* next element */			\
348	struct type **tqe_prev;	/* address of previous next element */	\
349}
350
351/*
352 * Tail queue functions.
353 */
354#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
355
356#define	TAILQ_FIRST(head)	((head)->tqh_first)
357
358#define	TAILQ_FOREACH(var, head, field)					\
359	for ((var) = TAILQ_FIRST((head));				\
360	    (var);							\
361	    (var) = TAILQ_NEXT((var), field))
362
363#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
364	for ((var) = TAILQ_LAST((head), headname);			\
365	    (var);							\
366	    (var) = TAILQ_PREV((var), headname, field))
367
368#define	TAILQ_INIT(head) do {						\
369	TAILQ_FIRST((head)) = NULL;					\
370	(head)->tqh_last = &TAILQ_FIRST((head));			\
371} while (0)
372
373#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
374	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
375		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
376		    &TAILQ_NEXT((elm), field);				\
377	else								\
378		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
379	TAILQ_NEXT((listelm), field) = (elm);				\
380	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
381} while (0)
382
383#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
384	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
385	TAILQ_NEXT((elm), field) = (listelm);				\
386	*(listelm)->field.tqe_prev = (elm);				\
387	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
388} while (0)
389
390#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
391	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
392		TAILQ_FIRST((head))->field.tqe_prev =			\
393		    &TAILQ_NEXT((elm), field);				\
394	else								\
395		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
396	TAILQ_FIRST((head)) = (elm);					\
397	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
398} while (0)
399
400#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
401	TAILQ_NEXT((elm), field) = NULL;				\
402	(elm)->field.tqe_prev = (head)->tqh_last;			\
403	*(head)->tqh_last = (elm);					\
404	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
405} while (0)
406
407#define	TAILQ_LAST(head, headname)					\
408	(*(((struct headname *)((head)->tqh_last))->tqh_last))
409
410#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
411
412#define	TAILQ_PREV(elm, headname, field)				\
413	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
414
415#define	TAILQ_REMOVE(head, elm, field) do {				\
416	if ((TAILQ_NEXT((elm), field)) != NULL)				\
417		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
418		    (elm)->field.tqe_prev;				\
419	else								\
420		(head)->tqh_last = (elm)->field.tqe_prev;		\
421	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
422} while (0)
423
424/*
425 * Circular queue declarations.
426 */
427#define	CIRCLEQ_HEAD(name, type)					\
428struct name {								\
429	struct type *cqh_first;		/* first element */		\
430	struct type *cqh_last;		/* last element */		\
431}
432
433#define	CIRCLEQ_HEAD_INITIALIZER(head)					\
434	{ (void *)&(head), (void *)&(head) }
435
436#define	CIRCLEQ_ENTRY(type)						\
437struct {								\
438	struct type *cqe_next;		/* next element */		\
439	struct type *cqe_prev;		/* previous element */		\
440}
441
442/*
443 * Circular queue functions.
444 */
445#define	CIRCLEQ_EMPTY(head)	((head)->cqh_first == (void *)(head))
446
447#define	CIRCLEQ_FIRST(head)	((head)->cqh_first)
448
449#define	CIRCLEQ_FOREACH(var, head, field)				\
450	for ((var) = CIRCLEQ_FIRST((head));				\
451	    (var) != (void *)(head);					\
452	    (var) = CIRCLEQ_NEXT((var), field))
453
454#define	CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
455	for ((var) = CIRCLEQ_LAST((head));				\
456	    (var) != (void *)(head);					\
457	    (var) = CIRCLEQ_PREV((var), field))
458
459#define	CIRCLEQ_INIT(head) do {						\
460	CIRCLEQ_FIRST((head)) = (void *)(head);				\
461	CIRCLEQ_LAST((head)) = (void *)(head);				\
462} while (0)
463
464#define	CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
465	CIRCLEQ_NEXT((elm), field) = CIRCLEQ_NEXT((listelm), field);	\
466	CIRCLEQ_PREV((elm), field) = (listelm);				\
467	if (CIRCLEQ_NEXT((listelm), field) == (void *)(head))		\
468		CIRCLEQ_LAST((head)) = (elm);				\
469	else								\
470		CIRCLEQ_PREV(CIRCLEQ_NEXT((listelm), field), field) = (elm);\
471	CIRCLEQ_NEXT((listelm), field) = (elm);				\
472} while (0)
473
474#define	CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {		\
475	CIRCLEQ_NEXT((elm), field) = (listelm);				\
476	CIRCLEQ_PREV((elm), field) = CIRCLEQ_PREV((listelm), field);	\
477	if (CIRCLEQ_PREV((listelm), field) == (void *)(head))		\
478		CIRCLEQ_FIRST((head)) = (elm);				\
479	else								\
480		CIRCLEQ_NEXT(CIRCLEQ_PREV((listelm), field), field) = (elm);\
481	CIRCLEQ_PREV((listelm), field) = (elm);				\
482} while (0)
483
484#define	CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
485	CIRCLEQ_NEXT((elm), field) = CIRCLEQ_FIRST((head));		\
486	CIRCLEQ_PREV((elm), field) = (void *)(head);			\
487	if (CIRCLEQ_LAST((head)) == (void *)(head))			\
488		CIRCLEQ_LAST((head)) = (elm);				\
489	else								\
490		CIRCLEQ_PREV(CIRCLEQ_FIRST((head)), field) = (elm);	\
491	CIRCLEQ_FIRST((head)) = (elm);					\
492} while (0)
493
494#define	CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
495	CIRCLEQ_NEXT((elm), field) = (void *)(head);			\
496	CIRCLEQ_PREV((elm), field) = CIRCLEQ_LAST((head));		\
497	if (CIRCLEQ_FIRST((head)) == (void *)(head))			\
498		CIRCLEQ_FIRST((head)) = (elm);				\
499	else								\
500		CIRCLEQ_NEXT(CIRCLEQ_LAST((head)), field) = (elm);	\
501	CIRCLEQ_LAST((head)) = (elm);					\
502} while (0)
503
504#define	CIRCLEQ_LAST(head)	((head)->cqh_last)
505
506#define	CIRCLEQ_NEXT(elm,field)	((elm)->field.cqe_next)
507
508#define	CIRCLEQ_PREV(elm,field)	((elm)->field.cqe_prev)
509
510#define	CIRCLEQ_REMOVE(head, elm, field) do {				\
511	if (CIRCLEQ_NEXT((elm), field) == (void *)(head))		\
512		CIRCLEQ_LAST((head)) = CIRCLEQ_PREV((elm), field);	\
513	else								\
514		CIRCLEQ_PREV(CIRCLEQ_NEXT((elm), field), field) =	\
515		    CIRCLEQ_PREV((elm), field);				\
516	if (CIRCLEQ_PREV((elm), field) == (void *)(head))		\
517		CIRCLEQ_FIRST((head)) = CIRCLEQ_NEXT((elm), field);	\
518	else								\
519		CIRCLEQ_NEXT(CIRCLEQ_PREV((elm), field), field) =	\
520		    CIRCLEQ_NEXT((elm), field);				\
521} while (0)
522
523#ifdef _KERNEL
524
525/*
526 * XXX insque() and remque() are an old way of handling certain queues.
527 * They bogusly assumes that all queue heads look alike.
528 */
529
530struct quehead {
531	struct quehead *qh_link;
532	struct quehead *qh_rlink;
533};
534
535#ifdef	__GNUC__
536
537static __inline void
538insque(void *a, void *b)
539{
540	struct quehead *element = a, *head = b;
541
542	element->qh_link = head->qh_link;
543	element->qh_rlink = head;
544	head->qh_link = element;
545	element->qh_link->qh_rlink = element;
546}
547
548static __inline void
549remque(void *a)
550{
551	struct quehead *element = a;
552
553	element->qh_link->qh_rlink = element->qh_rlink;
554	element->qh_rlink->qh_link = element->qh_link;
555	element->qh_rlink = 0;
556}
557
558#else /* !__GNUC__ */
559
560void	insque __P((void *a, void *b));
561void	remque __P((void *a));
562
563#endif /* __GNUC__ */
564
565#endif /* _KERNEL */
566
567#endif /* !_SYS_QUEUE_H_ */
568