aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-10-25 10:36:50 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-10-25 10:42:45 +0100
commitec99c74df30b1e763377c1eaf1288b4186bcd7c7 (patch)
tree9e3c259e5a5d4919cb782ea99983acd4aed43e26
parentace289978091a40018465afc2b22615ea83e174a (diff)
downloadman-pages-ec99c74df30b1e763377c1eaf1288b4186bcd7c7.tar.gz
tailq.3: Add remaining details to complete the page
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man3/tailq.337
1 files changed, 37 insertions, 0 deletions
diff --git a/man3/tailq.3 b/man3/tailq.3
index e38cc7e862..cac4a9c3f9 100644
--- a/man3/tailq.3
+++ b/man3/tailq.3
@@ -55,6 +55,7 @@ TAILQ_NEXT,
TAILQ_PREV,
TAILQ_REMOVE
.\"TAILQ_SWAP
+\- implementation of a doubly-linked tail queue
.SH SYNOPSIS
.nf
.B #include sys/queue.h
@@ -110,6 +111,7 @@ TAILQ_REMOVE
.\" .PP
.\" .BI "void TAILQ_SWAP(TAILQ_HEAD *" head1 ", TAILQ_HEAD *" head2 ", TYPE, TAILQ_ENTRY " NAME ");"
.SH DESCRIPTION
+These macros define and operate on doubly-linked tail queues.
.PP
In the macro definitions,
.I TYPE
@@ -336,11 +338,44 @@ from the tail queue.
.\" and
.\" .IR head2 .
.SH RETURN VALUE
+.BR TAILQ_EMPTY ()
+returns nonzero if the queue is empty,
+and zero if the queue contains at least one entry.
+.PP
+.BR TAILQ_FIRST (),
+.BR TAILQ_LAST (),
+.BR TAILQ_NEXT (),
+and
+.BR TAILQ_PREV ()
+return a pointer to the first, last, next or previous
+.I TYPE
+structure, respectively.
+.PP
+.BR TAILQ_HEAD_INITIALIZER ()
+returns an initializer that can be assigned to the queue
+.IR head .
.SH CONFORMING TO
Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
Present on the BSDs.
(TAILQ functions first appeared in 4.4BSD).
.SH BUGS
+The macros
+.BR TAILQ_FOREACH ()
+and
+.BR TAILQ_FOREACH_REVERSE ()
+don't allow
+.I var
+to be removed or freed within the loop,
+as it would interfere with the traversal.
+The macros
+.BR TAILQ_FOREACH_SAFE ()
+and
+.BR TAILQ_FOREACH_REVERSE_SAFE (),
+which are present on the BSDs but are not present in glibc,
+fix this limitation by allowing
+.I var
+to safely be removed from the list and freed from within the loop
+without interfering with the traversal.
.SH EXAMPLES
.EX
#include <stddef.h>
@@ -398,3 +433,5 @@ main(void)
}
.EE
.SH SEE ALSO
+.BR insque (3),
+.BR queue (3)