]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
circleq.3: Add remaining details to complete the page
authorAlejandro Colomar <colomar.6.4.3@gmail.com>
Fri, 23 Oct 2020 14:57:35 +0000 (16:57 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Fri, 23 Oct 2020 16:13:27 +0000 (18:13 +0200)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/circleq.3

index f24df2e156ec531a679b16e2a86b2feaa125ed4c..33215be77f6133915cf98973235f247e128d8a9a 100644 (file)
@@ -49,6 +49,7 @@ CIRCLEQ_LOOP_PREV,
 CIRCLEQ_NEXT,
 CIRCLEQ_PREV,
 CIRCLEQ_REMOVE
+\- implementation of a double-linked circular queue
 .SH SYNOPSIS
 .nf
 .B #include <sys/queue.h>
@@ -96,6 +97,8 @@ CIRCLEQ_REMOVE
 .PP
 .BI "void CIRCLEQ_REMOVE(CIRCLEQ_HEAD *" head ", TYPE *" elm ", CIRCLEQ_ENTRY " NAME ");"
 .SH DESCRIPTION
+These macros define and operate on doubly-linked circular queues.
+.PP
 In the macro definitions,
 .I TYPE
 is the name of a user-defined structure,
@@ -252,11 +255,44 @@ removes the element
 .I elm
 from the circular queue.
 .SH RETURN VALUE
+.BR CIRCLEQ_EMPTY ()
+returns nonzero if the queue is empty,
+and zero if the queue contains at least one entry.
+.PP
+.BR CIRCLEQ_FIRST (),
+.BR CIRCLEQ_LAST (),
+.BR CIRCLEQ_NEXT (),
+and
+.BR CIRCLEQ_PREV ()
+return a pointer to the first, last, next or previous
+.I CIRCLEQ_ENTRY
+structure, respectively.
+.PP
+.BR CIRCLEQ_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
 (CIRCLEQ macros first appeared in 4.4BSD).
 .SH BUGS
+The macros
+.BR CIRCLEQ_FOREACH ()
+and
+.BR CIRCLEQ_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 CIRCLEQ_FOREACH_SAFE ()
+and
+.BR CIRCLEQ_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>
@@ -314,3 +350,5 @@ main(void)
 }
 .EE
 .SH SEE ALSO
+.BR insque (3),
+.BR queue (3)