aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-10-25 00:21:16 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-10-25 09:49:38 +0100
commit906766f590c1ea4db083fdf799ae48595198914c (patch)
treed63cb5c93656f6a250df6234db355e90d4623d43
parent00ba3a085e595808e7c4420787f6e444f4a203d1 (diff)
downloadman-pages-906766f590c1ea4db083fdf799ae48595198914c.tar.gz
stailq.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/stailq.330
1 files changed, 30 insertions, 0 deletions
diff --git a/man3/stailq.3 b/man3/stailq.3
index 0abacd824e..2896d27c98 100644
--- a/man3/stailq.3
+++ b/man3/stailq.3
@@ -51,6 +51,7 @@ STAILQ_REMOVE,
.\"STAILQ_REMOVE_AFTER,
STAILQ_REMOVE_HEAD,
.\"STAILQ_SWAP
+\- implementation of a singly-linked tail queue
.SH SYNOPSIS
.nf
.B #include <sys/queue.h>
@@ -100,6 +101,8 @@ STAILQ_REMOVE_HEAD,
.\" .BI " STAILQ_ENTRY " NAME ");"
.fi
.SH DESCRIPTION
+These macros define and operate on singly-linked tail queues.
+.PP
In the macro definitions,
.I TYPE
is the name of a user-defined structure,
@@ -292,11 +295,38 @@ from the tail queue.
.\" and
.\" .IR head2 .
.SH RETURN VALUE
+.BR STAILQ_EMPTY ()
+returns nonzero if the queue is empty,
+and zero if the queue contains at least one entry.
+.PP
+.BR STAILQ_FIRST (),
+and
+.BR STAILQ_NEXT ()
+return a pointer to the first or next
+.I STAILQ_ENTRY
+structure, respectively.
+.PP
+.BR STAILQ_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
(STAILQ macros first appeared in 4.4BSD).
.SH BUGS
+The macro
+.BR STAILQ_FOREACH ()
+doesn't allow
+.I var
+to be removed or freed within the loop,
+as it would interfere with the traversal.
+The macro
+.BR STAILQ_FOREACH_SAFE (),
+which is present on the BSDs but is not present in glibc,
+fixes 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>