diff --git a/man3/tailq.3 b/man3/tailq.3 index e38cc7e86..cac4a9c3f 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 @@ -398,3 +433,5 @@ main(void) } .EE .SH SEE ALSO +.BR insque (3), +.BR queue (3)