On 2020-10-21 06:53, Michael Kerrisk (man-pages) wrote:
On 10/20/20 1:42 PM, Alejandro Colomar wrote:
On 2020-10-20 13:22, Hans Petter Selasky wrote:
Hi,
You may want to import new queue macros from FreeBSD, especially for C++
use.
https://svnweb.freebsd.org/base/head/sys/sys/queue.h
https://svnweb.freebsd.org/base?view=revision&revision=284915
--HPS
Hi Hans,
Thanks for the suggestion.
I'll add the documentation to the manual pages commented out
(as with other queue.h macros that aren't present on glibc),
and if glibc adds them in the future,
it can then be uncommented.
Thanks for that, Alex. (And thanks for the heads-up, Hans.)
Cheers,
Michael
After Hans' suggestion,
I decided to find all <sys/queue.h> macros
available on BSDs and not on glibc.
You may want to add them to glibc.
I'll write them when I have some time.
Here's the list of what I could find:
* OpenBSD:
struct TYPE *
SLIST_END(SLIST_HEAD *head);
SLIST_FOREACH_SAFE(VARNAME, SLIST_HEAD *head, FIELDNAME, TEMP_VARNAME);
void
SLIST_REMOVE_AFTER(struct TYPE *elm, FIELDNAME);
struct TYPE *
LIST_END(LIST_HEAD *head);
LIST_FOREACH_SAFE(VARNAME, LIST_HEAD *head, FIELDNAME, TEMP_VARNAME);
void
LIST_REPLACE(struct TYPE *elm, struct TYPE *elm2, FIELDNAME);
struct TYPE *
SIMPLEQ_END(SIMPLEQ_HEAD *head);
SIMPLEQ_FOREACH_SAFE(VARNAME, SIMPLEQ_HEAD *head, FIELDNAME, TEMP_VARNAME);
void
SIMPLEQ_REMOVE_AFTER(SIMPLEQ_HEAD *head, struct TYPE *elm, FIELDNAME);
struct TYPE *
TAILQ_END(TAILQ_HEAD *head);
TAILQ_FOREACH_SAFE(VARNAME, TAILQ_HEAD *head, FIELDNAME, TEMP_VARNAME);
TAILQ_FOREACH_REVERSE_SAFE(VARNAME, TAILQ_HEAD *head, HEADNAME,
FIELDNAME, TEMP_VARNAME);
void
TAILQ_REPLACE(TAILQ_HEAD *head, struct TYPE *elm, struct TYPE *elm2,
FIELDNAME);
struct TYPE *
CIRCLEQ_END(CIRCLEQ_HEAD *head);
CIRCLEQ_FOREACH_SAFE(VARNAME, CIRCLEQ_HEAD *head, FIELDNAME, TEMP_VARNAME);
CIRCLEQ_FOREACH_REVERSE_SAFE(VARNAME, CIRCLEQ_HEAD *head, FIELDNAME,
TEMP_VARNAME);
void
CIRCLEQ_REPLACE(CIRCLEQ_HEAD *head, struct TYPE *elm, struct TYPE *elm2,
FIELDNAME);
* FreeBSD:
SLIST_CLASS_ENTRY(CLASSTYPE);
SLIST_CLASS_HEAD(HEADNAME, CLASSTYPE);
STAILQ_CLASS_ENTRY(CLASSTYPE);
STAILQ_CLASS_HEAD(HEADNAME, CLASSTYPE);
LIST_CLASS_ENTRY(CLASSTYPE);
LIST_CLASS_HEAD(HEADNAME, CLASSTYPE);
TAILQ_CLASS_ENTRY(CLASSTYPE);
TAILQ_CLASS_HEAD(HEADNAME, CLASSTYPE);
* Interesting, but not present on BSDs (at list on the ones I checked):
SIMPLEQ_CLASS_ENTRY(CLASSTYPE);
SIMPLEQ_CLASS_HEAD(HEADNAME, CLASSTYPE);
CIRCLEQ_CLASS_ENTRY(CLASSTYPE);
CIRCLEQ_CLASS_HEAD(HEADNAME, CLASSTYPE);