diff options
author | Alejandro Colomar <colomar.6.4.3@gmail.com> | 2020-10-23 16:57:35 +0200 |
---|---|---|
committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2020-10-23 18:13:27 +0200 |
commit | ccb0db7f350cf97ffdea03f7a77c1c07dd9a801f (patch) | |
tree | 142b3502438c0f1c5e22221c072657ebe6db6d04 | |
parent | 086acf39f1518d5186ad59c492b7d272bb972d6b (diff) | |
download | man-pages-ccb0db7f350cf97ffdea03f7a77c1c07dd9a801f.tar.gz |
circleq.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/circleq.3 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/man3/circleq.3 b/man3/circleq.3 index f24df2e156..33215be77f 100644 --- a/man3/circleq.3 +++ b/man3/circleq.3 @@ -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) |