aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-10-23 16:57:33 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-10-23 18:13:16 +0200
commit0d1891f3b6c9305b2efcf33a2c40a9293ba37ea7 (patch)
treeadde825d64e7015599be8e50185b41fff0f75e9a
parent68ed526e29b4e2be3852f7a5fbc11daf43bf5699 (diff)
downloadman-pages-0d1891f3b6c9305b2efcf33a2c40a9293ba37ea7.tar.gz
circleq.3: Copy and adapt code from queue.3
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.322
1 files changed, 20 insertions, 2 deletions
diff --git a/man3/circleq.3 b/man3/circleq.3
index 2d683b441b..491e1ec913 100644
--- a/man3/circleq.3
+++ b/man3/circleq.3
@@ -50,6 +50,8 @@
.Nm CIRCLEQ_PREV ,
.Nm CIRCLEQ_REMOVE
.SH SYNOPSIS
+.In sys/queue.h
+.\"
.Fn CIRCLEQ_EMPTY "CIRCLEQ_HEAD *head"
.Fn CIRCLEQ_ENTRY "TYPE"
.Fn CIRCLEQ_FIRST "CIRCLEQ_HEAD *head"
@@ -69,6 +71,18 @@
.Fn CIRCLEQ_PREV "TYPE *elm" "CIRCLEQ_ENTRY NAME"
.Fn CIRCLEQ_REMOVE "CIRCLEQ_HEAD *head" "TYPE *elm" "CIRCLEQ_ENTRY NAME"
.SH DESCRIPTION
+In the macro definitions,
+.Fa TYPE
+is the name of a user-defined structure,
+that must contain a field of type
+.Li CIRCLEQ_ENTRY ,
+named
+.Fa NAME .
+The argument
+.Fa HEADNAME
+is the name of a user-defined structure that must be declared
+using the macro
+.Li CIRCLEQ_HEAD .
.Ss Circular queues
A circular queue is headed by a structure defined by the
.Nm CIRCLEQ_HEAD
@@ -208,6 +222,10 @@ removes the element
from the circular queue.
.SH RETURN VALUE
.SH CONFORMING TO
+Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
+Present on the BSDs
+(CIRCLEQ macros first appeared in
+.Bx 4.4 ).
.SH BUGS
.SH EXAMPLES
.Ss Circular queue example
@@ -227,9 +245,9 @@ CIRCLEQ_HEAD(circlehead, entry);
int
main(void)
{
- struct entry *n1, *n2, *n3, *np;
+ struct entry *n1, *n2, *n3, *np;
struct circlehead head; /* Queue head. */
- int i;
+ int i;
CIRCLEQ_INIT(&head); /* Initialize the queue. */