summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a6f1362)
SCCS-vsn: share/man/man3/queue.3 8.3
.\"
.\" %sccs.include.redist.roff%
.\"
.\"
.\" %sccs.include.redist.roff%
.\"
-.\" @(#)queue.3 8.2 (Berkeley) %G%
+.\" @(#)queue.3 8.3 (Berkeley) %G%
.Nm LIST_HEAD ,
.Nm LIST_INIT ,
.Nm LIST_INSERT_AFTER ,
.Nm LIST_HEAD ,
.Nm LIST_INIT ,
.Nm LIST_INSERT_AFTER ,
+.Nm LIST_INSERT_BEFORE ,
.Nm LIST_INSERT_HEAD ,
.Nm LIST_REMOVE ,
.Nm TAILQ_ENTRY ,
.Nm TAILQ_HEAD ,
.Nm TAILQ_INIT ,
.Nm TAILQ_INSERT_AFTER ,
.Nm LIST_INSERT_HEAD ,
.Nm LIST_REMOVE ,
.Nm TAILQ_ENTRY ,
.Nm TAILQ_HEAD ,
.Nm TAILQ_INIT ,
.Nm TAILQ_INSERT_AFTER ,
+.Nm TAILQ_INSERT_BEFORE ,
.Nm TAILQ_INSERT_HEAD ,
.Nm TAILQ_INSERT_TAIL ,
.Nm TAILQ_REMOVE ,
.Nm TAILQ_INSERT_HEAD ,
.Nm TAILQ_INSERT_TAIL ,
.Nm TAILQ_REMOVE ,
.Fn LIST_HEAD "HEADNAME" "TYPE"
.Fn LIST_INIT "LIST_HEAD *head"
.Fn LIST_INSERT_AFTER "LIST_ENTRY *listelm" "TYPE *elm" "LIST_ENTRY NAME"
.Fn LIST_HEAD "HEADNAME" "TYPE"
.Fn LIST_INIT "LIST_HEAD *head"
.Fn LIST_INSERT_AFTER "LIST_ENTRY *listelm" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_INSERT_BEFORE "LIST_ENTRY *listelm" "TYPE *elm" "LIST_ENTRY NAME"
.Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
.Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
.sp
.Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
.Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
.sp
.Fn TAILQ_HEAD "HEADNAME" "TYPE"
.Fn TAILQ_INIT "TAILQ_HEAD *head"
.Fn TAILQ_INSERT_AFTER "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
.Fn TAILQ_HEAD "HEADNAME" "TYPE"
.Fn TAILQ_INIT "TAILQ_HEAD *head"
.Fn TAILQ_INSERT_AFTER "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_BEFORE "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
.Fn TAILQ_INSERT_HEAD "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
.Fn TAILQ_INSERT_TAIL "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
.Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
.Fn TAILQ_INSERT_HEAD "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
.Fn TAILQ_INSERT_TAIL "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
.Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
.It
Insertion of a new entry after any element in the list.
.It
.It
Insertion of a new entry after any element in the list.
.It
+Insertion of a new entry before any element in the list.
+.It
Removal of any entry in the list.
.It
Forward traversal through the list.
Removal of any entry in the list.
.It
Forward traversal through the list.
.It
Entries can be added at the end of a list.
.It
.It
Entries can be added at the end of a list.
.It
-Entries can be added before another entry.
-.It
They may be traversed backwards, from tail to head.
.El
However:
They may be traversed backwards, from tail to head.
.El
However:
on the list.
The elements are doubly linked so that an arbitrary element can be
removed without traversing the list.
on the list.
The elements are doubly linked so that an arbitrary element can be
removed without traversing the list.
-New elements can be added to the list after an existing element or
+New elements can be added to the list before or after an existing element or
at the head of the list.
A
.Fa LIST_HEAD
at the head of the list.
A
.Fa LIST_HEAD
.Fa listelm .
.Pp
The macro
.Fa listelm .
.Pp
The macro
+.Nm LIST_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
.Nm LIST_REMOVE
removes the element
.Fa elm
.Nm LIST_REMOVE
removes the element
.Fa elm
n2 = malloc(sizeof(struct entry)); /* Insert after. */
LIST_INSERT_AFTER(n1, n2, entries);
n2 = malloc(sizeof(struct entry)); /* Insert after. */
LIST_INSERT_AFTER(n1, n2, entries);
+
+n2 = malloc(sizeof(struct entry)); /* Insert before. */
+LIST_INSERT_BEFORE(n1, n2, entries);
/* Forward traversal. */
for (np = head.lh_first; np != NULL; np = np->entries.le_next)
np-> ...
/* Forward traversal. */
for (np = head.lh_first; np != NULL; np = np->entries.le_next)
np-> ...
.Fa listelm .
.Pp
The macro
.Fa listelm .
.Pp
The macro
+.Nm TAILQ_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
.Nm TAILQ_REMOVE
removes the element
.Fa elm
.Nm TAILQ_REMOVE
removes the element
.Fa elm
n2 = malloc(sizeof(struct entry)); /* Insert after. */
TAILQ_INSERT_AFTER(&head, n1, n2, entries);
n2 = malloc(sizeof(struct entry)); /* Insert after. */
TAILQ_INSERT_AFTER(&head, n1, n2, entries);
+
+n2 = malloc(sizeof(struct entry)); /* Insert before. */
+TAILQ_INSERT_BEFORE(&head, n1, n2, entries);
/* Forward traversal. */
for (np = head.tqh_first; np != NULL; np = np->entries.tqe_next)
np-> ...
/* Forward traversal. */
for (np = head.tqh_first; np != NULL; np = np->entries.tqe_next)
np-> ...