unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alejandro Colomar via Libc-alpha <libc-alpha@sourceware.org>
To: "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Cc: linux-man <linux-man@vger.kernel.org>,
	"Michael Kerrisk \(man-pages\)" <mtk.manpages@gmail.com>
Subject: sys/queue.h: Add macros present on BSDs
Date: Fri, 23 Oct 2020 11:50:14 +0200	[thread overview]
Message-ID: <75e66480-ccbf-d2f0-7787-5a1b2573d622@gmail.com> (raw)
In-Reply-To: <d9b8f226-2972-d238-ff7a-0298104e07e9@gmail.com>



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);

      reply	other threads:[~2020-10-23  9:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 15:29 queue.3 overhaul Alejandro Colomar via Libc-alpha
2020-10-20  4:08 ` Michael Kerrisk (man-pages) via Libc-alpha
2020-10-20 10:36   ` Alejandro Colomar via Libc-alpha
2020-10-20 11:22     ` Hans Petter Selasky
2020-10-20 11:42       ` Alejandro Colomar via Libc-alpha
2020-10-21  4:53         ` Michael Kerrisk (man-pages) via Libc-alpha
2020-10-23  9:50           ` Alejandro Colomar via Libc-alpha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75e66480-ccbf-d2f0-7787-5a1b2573d622@gmail.com \
    --to=libc-alpha@sourceware.org \
    --cc=colomar.6.4.3@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).