queue.h revision 1450
48N/A/* $NetBSD: queue.h,v 1.42 2005/07/13 15:08:24 wiz Exp $ */ 48N/A * Copyright (c) 1991, 1993 48N/A * The Regents of the University of California. All rights reserved. 48N/A * Redistribution and use in source and binary forms, with or without 48N/A * modification, are permitted provided that the following conditions 48N/A * 1. Redistributions of source code must retain the above copyright 48N/A * notice, this list of conditions and the following disclaimer. 48N/A * 2. Redistributions in binary form must reproduce the above copyright 48N/A * notice, this list of conditions and the following disclaimer in the 48N/A * documentation and/or other materials provided with the distribution. 48N/A * 3. Neither the name of the University nor the names of its contributors 48N/A * may be used to endorse or promote products derived from this software 48N/A * without specific prior written permission. 48N/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 48N/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 48N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 48N/A * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 48N/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 48N/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 48N/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 48N/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 48N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 48N/A * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. 48N/A * This file defines five types of data structures: singly-linked lists, 48N/A * lists, simple queues, tail queues, and circular queues. 70N/A * A singly-linked list is headed by a single forward pointer. The 70N/A * elements are singly linked for minimum space and pointer manipulation 70N/A * overhead at the expense of O(n) removal for arbitrary elements. New 70N/A * elements can be added to the list after an existing element or at the 48N/A * head of the list. Elements being removed from the head of the list 48N/A * should use the explicit macro for this purpose for optimum 70N/A * efficiency. A singly-linked list may only be traversed in the forward 70N/A * direction. Singly-linked lists are ideal for applications with large 70N/A * datasets and few or no removals or for implementing a LIFO queue. 48N/A * A list is headed by a single forward pointer (or an array of forward 70N/A * pointers for a hash table header). The elements are doubly linked 70N/A * so that an arbitrary element can be removed without a need to 70N/A * traverse the list. New elements can be added to the list before 70N/A * or after an existing element or at the head of the list. A list 70N/A * may only be traversed in the forward direction. 70N/A * A simple queue is headed by a pair of pointers, one the head of the 70N/A * list and the other to the tail of the list. The elements are singly 48N/A * linked to save space, so elements can only be removed from the 48N/A * head of the list. New elements can be added to the list after 48N/A * an existing element, at the head of the list, or at the end of the 48N/A * list. A simple queue may only be traversed in the forward direction. * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * A circle queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the list. * A circle queue may be traversed in either direction, but has a more * complex end of list detection. * For details on the use of these macros, see the queue(3) manual page. struct type **
le_prev;
/* address of previous next element */ \
panic(
"LIST_INSERT_HEAD %p %s:%d", (
void *)(
head), \
panic(
"LIST_* forw %p %s:%d", (
void *)(
elm), \
* Singly-linked List definitions. * Singly-linked List functions. * Singly-linked List access methods. * Singly-linked Tail queue declarations. * Singly-linked Tail queue functions. * Singly-linked Tail queue access methods. * Simple queue definitions. * Simple queue functions. * Simple queue access methods. * Tail queue definitions. panic(
"TAILQ_INSERT_HEAD %p %s:%d", (
void *)(
head), \
panic(
"TAILQ_INSERT_TAIL %p %s:%d", (
void *)(
head), \
panic(
"TAILQ_* forw %p %s:%d", (
void *)(
elm), \
panic(
"TAILQ_* back %p %s:%d", (
void *)(
elm), \
panic(
"TAILQ_PREREMOVE head %p elm %p %s:%d", \
* Tail queue access methods. * Circular queue definitions. * Circular queue functions. * Circular queue access methods. #
endif /* !_SYS_QUEUE_H */