summaryrefslogtreecommitdiffstats
path: root/share/man/man3/queue.3
diff options
context:
space:
mode:
Diffstat (limited to 'share/man/man3/queue.3')
-rw-r--r--share/man/man3/queue.3154
1 files changed, 80 insertions, 74 deletions
diff --git a/share/man/man3/queue.3 b/share/man/man3/queue.3
index b089c00761f..17866ba68ef 100644
--- a/share/man/man3/queue.3
+++ b/share/man/man3/queue.3
@@ -93,11 +93,12 @@
These macros define and operate on three types of data structures:
lists, tail queues, and circular queues.
All three structures support the following functionality:
+.Pp
.Bl -enum -compact -offset indent
.It
Insertion of a new entry at the head of the list.
.It
-Insertion of a new entry before or after any element in the list.
+Insertion of a new entry before or after any list element.
.It
Removal of any entry in the list.
.It
@@ -108,11 +109,13 @@ Lists are the simplest of the three data structures and support
only the above functionality.
.Pp
Tail queues add the following functionality:
-.Bl -enum -compact -offset indent
+.Bl -enum -offset indent
.It
-Entries can be added at the end of a list.
+Entries can be added to the end of a list.
.El
+.Pp
However:
+.Pp
.Bl -enum -compact -offset indent
.It
All list insertions and removals, except insertion before another element, must
@@ -125,13 +128,16 @@ than lists.
.El
.Pp
Circular queues add the following functionality:
+.Pp
.Bl -enum -compact -offset indent
.It
-Entries can be added at the end of a list.
+Entries can be added to the end of a list.
.It
They may be traversed backwards, from tail to head.
.El
+.Pp
However:
+.Pp
.Bl -enum -compact -offset indent
.It
All list insertions and removals must specify the head of the list.
@@ -158,15 +164,15 @@ The argument
.Fa HEADNAME
is the name of a user defined structure that must be declared
using the macros
-.Li LIST_HEAD ,
-.Li TAILQ_HEAD ,
+.Fn LIST_HEAD ,
+.Fn TAILQ_HEAD ,
or
-.Li CIRCLEQ_HEAD .
+.Fn CIRCLEQ_HEAD .
See the examples below for further explanation of how these
macros are used.
.Sh LISTS
A list is headed by a structure defined by the
-.Nm LIST_HEAD
+.Fn LIST_HEAD
macro.
This structure contains a single pointer to the first element
on the list.
@@ -197,39 +203,39 @@ and
.Li headp
are user selectable.)
.Pp
-The macro
-.Nm LIST_ENTRY
-declares a structure that connects the elements in
+The
+.Fn LIST_ENTRY
+macro declares a structure that connects the elements in
the list.
.Pp
-The macro
-.Nm LIST_INIT
-initializes the list referenced by
+The
+.Fn LIST_INIT
+macro initializes the list referenced by
.Fa head .
.Pp
-The macro
-.Nm LIST_INSERT_HEAD
-inserts the new element
+The
+.Fn LIST_INSERT_HEAD
+macro inserts the new element
.Fa elm
at the head of the list.
.Pp
-The macro
-.Nm LIST_INSERT_AFTER
-inserts the new element
+The
+.Fn LIST_INSERT_AFTER
+macro inserts the new element
.Fa elm
after the element
.Fa listelm .
.Pp
-The macro
-.Nm LIST_INSERT_BEFORE
-inserts the new element
+The
+.Fn LIST_INSERT_BEFORE
+macro inserts the new element
.Fa elm
before the element
.Fa listelm .
.Pp
-The macro
-.Nm LIST_REMOVE
-removes the element
+The
+.Fn LIST_REMOVE
+macro removes the element
.Fa elm
from the list.
.Sh LIST EXAMPLE
@@ -261,7 +267,7 @@ while (head.lh_first != NULL) /* Delete. */
.Ed
.Sh TAIL QUEUES
A tail queue is headed by a structure defined by the
-.Nm TAILQ_HEAD
+.Fn TAILQ_HEAD
macro.
This structure contains a pair of pointers,
one to the first element in the tail queue and the other to
@@ -279,9 +285,9 @@ TAILQ_HEAD(HEADNAME, TYPE) head;
.Ed
.sp
where
-.Li HEADNAME
+.Fa HEADNAME
is the name of the structure to be defined, and
-.Li TYPE
+.Fa TYPE
is the type of the elements to be linked into the tail queue.
A pointer to the head of the tail queue can later be declared as:
.Bd -literal -offset indent
@@ -294,45 +300,45 @@ and
.Li headp
are user selectable.)
.Pp
-The macro
-.Nm TAILQ_ENTRY
-declares a structure that connects the elements in
+The
+.Fn TAILQ_ENTRY
+macro declares a structure that connects the elements in
the tail queue.
.Pp
-The macro
-.Nm TAILQ_INIT
-initializes the tail queue referenced by
+The
+.Fn TAILQ_INIT
+macro initializes the tail queue referenced by
.Fa head .
.Pp
-The macro
-.Nm TAILQ_INSERT_HEAD
-inserts the new element
+The
+.Fn TAILQ_INSERT_HEAD
+macro inserts the new element
.Fa elm
at the head of the tail queue.
.Pp
-The macro
-.Nm TAILQ_INSERT_TAIL
-inserts the new element
+The
+.Fn TAILQ_INSERT_TAIL
+macro inserts the new element
.Fa elm
at the end of the tail queue.
.Pp
-The macro
-.Nm TAILQ_INSERT_AFTER
-inserts the new element
+The
+.Fn TAILQ_INSERT_AFTER
+macro inserts the new element
.Fa elm
after the element
.Fa listelm .
.Pp
-The macro
-.Nm TAILQ_INSERT_BEFORE
-inserts the new element
+The
+.Fn TAILQ_INSERT_BEFORE
+macro inserts the new element
.Fa elm
before the element
.Fa listelm .
.Pp
-The macro
-.Nm TAILQ_REMOVE
-removes the element
+The
+.Fn TAILQ_REMOVE
+macro removes the element
.Fa elm
from the tail queue.
.Sh TAIL QUEUE EXAMPLE
@@ -367,7 +373,7 @@ while (head.tqh_first != NULL)
.Ed
.Sh CIRCULAR QUEUES
A circular queue is headed by a structure defined by the
-.Nm CIRCLEQ_HEAD
+.Fn CIRCLEQ_HEAD
macro.
This structure contains a pair of pointers,
one to the first element in the circular queue and the other to the
@@ -385,9 +391,9 @@ CIRCLEQ_HEAD(HEADNAME, TYPE) head;
.Ed
.sp
where
-.Li HEADNAME
+.Fa HEADNAME
is the name of the structure to be defined, and
-.Li TYPE
+.Fa TYPE
is the type of the elements to be linked into the circular queue.
A pointer to the head of the circular queue can later be declared as:
.Bd -literal -offset indent
@@ -400,45 +406,45 @@ and
.Li headp
are user selectable.)
.Pp
-The macro
-.Nm CIRCLEQ_ENTRY
-declares a structure that connects the elements in
+The
+.Fn CIRCLEQ_ENTRY
+macro declares a structure that connects the elements in
the circular queue.
.Pp
-The macro
-.Nm CIRCLEQ_INIT
-initializes the circular queue referenced by
+The
+.Fn CIRCLEQ_INIT
+macro initializes the circular queue referenced by
.Fa head .
.Pp
-The macro
-.Nm CIRCLEQ_INSERT_HEAD
-inserts the new element
+The
+.Fn CIRCLEQ_INSERT_HEAD
+macro inserts the new element
.Fa elm
at the head of the circular queue.
.Pp
-The macro
-.Nm CIRCLEQ_INSERT_TAIL
-inserts the new element
+The
+.Fn CIRCLEQ_INSERT_TAIL
+macro inserts the new element
.Fa elm
at the end of the circular queue.
.Pp
-The macro
-.Nm CIRCLEQ_INSERT_AFTER
-inserts the new element
+The
+.Fn CIRCLEQ_INSERT_AFTER
+macro inserts the new element
.Fa elm
after the element
.Fa listelm .
.Pp
-The macro
-.Nm CIRCLEQ_INSERT_BEFORE
-inserts the new element
+The
+.Fn CIRCLEQ_INSERT_BEFORE
+macro inserts the new element
.Fa elm
before the element
.Fa listelm .
.Pp
-The macro
-.Nm CIRCLEQ_REMOVE
-removes the element
+The
+.Fn CIRCLEQ_REMOVE
+macro removes the element
.Fa elm
from the circular queue.
.Sh CIRCULAR QUEUE EXAMPLE