mirror of https://github.com/mkerrisk/man-pages
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>
This commit is contained in:
parent
ace2899780
commit
ec99c74df3
37
man3/tailq.3
37
man3/tailq.3
|
@ -55,6 +55,7 @@ TAILQ_NEXT,
|
||||||
TAILQ_PREV,
|
TAILQ_PREV,
|
||||||
TAILQ_REMOVE
|
TAILQ_REMOVE
|
||||||
.\"TAILQ_SWAP
|
.\"TAILQ_SWAP
|
||||||
|
\- implementation of a doubly-linked tail queue
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B #include sys/queue.h
|
.B #include sys/queue.h
|
||||||
|
@ -110,6 +111,7 @@ TAILQ_REMOVE
|
||||||
.\" .PP
|
.\" .PP
|
||||||
.\" .BI "void TAILQ_SWAP(TAILQ_HEAD *" head1 ", TAILQ_HEAD *" head2 ", TYPE, TAILQ_ENTRY " NAME ");"
|
.\" .BI "void TAILQ_SWAP(TAILQ_HEAD *" head1 ", TAILQ_HEAD *" head2 ", TYPE, TAILQ_ENTRY " NAME ");"
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
These macros define and operate on doubly-linked tail queues.
|
||||||
.PP
|
.PP
|
||||||
In the macro definitions,
|
In the macro definitions,
|
||||||
.I TYPE
|
.I TYPE
|
||||||
|
@ -336,11 +338,44 @@ from the tail queue.
|
||||||
.\" and
|
.\" and
|
||||||
.\" .IR head2 .
|
.\" .IR head2 .
|
||||||
.SH RETURN VALUE
|
.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
|
.SH CONFORMING TO
|
||||||
Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
|
Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
|
||||||
Present on the BSDs.
|
Present on the BSDs.
|
||||||
(TAILQ functions first appeared in 4.4BSD).
|
(TAILQ functions first appeared in 4.4BSD).
|
||||||
.SH BUGS
|
.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
|
.SH EXAMPLES
|
||||||
.EX
|
.EX
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
@ -398,3 +433,5 @@ main(void)
|
||||||
}
|
}
|
||||||
.EE
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
.BR insque (3),
|
||||||
|
.BR queue (3)
|
||||||
|
|
Loading…
Reference in New Issue