Re: [PATCH v2 02/43] eal: add BSD version of queue.h

fengchengwen
2025-08-25T10:54:06Z

On 8/25/2025 11:38 AM, Stephen Hemminger wrote:
> The version of sys/queue.h on Linux from glibc was derived
> from an older version of BSD and is missing several key macros
> such as LIST_FOREACH_SAFE. This leads to drivers re-implementing
> the macros (sometimes badly) and other bugs.
> Introduce a version of queue.h derived from the current FreeBSD.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

...

>
> diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst
> index 243a3c2959..097042dd22 100644
> --- a/doc/guides/contributing/coding_style.rst
> +++ b/doc/guides/contributing/coding_style.rst
> @@ -324,12 +324,12 @@ Structure Declarations
> Queues
> ~~~~~~
>
> -Use queue(3) macros rather than rolling your own lists, whenever possible.
> +Use queue(3) macros defined in <rte_queue.h> rather than rolling your own lists.

rte_queue.h -> rte_bsd_queue.h

> Thus, the previous example would be better written:
>
> .. code-block:: c
>
> - #include <sys/queue.h>
> + #include <rte_queue.h>

rte_queue.h -> rte_bsd_queue.h

>
> struct foo {
> LIST_ENTRY(foo) link; /* Use queue macros for foo lists. */
> diff --git a/doc/guides/rel_notes/release_25_11.rst b/doc/guides/rel_notes/release_25_11.rst
> index ccad6d89ff..586a3cff28 100644
> --- a/doc/guides/rel_notes/release_25_11.rst
> +++ b/doc/guides/rel_notes/release_25_11.rst
> @@ -55,6 +55,9 @@ New Features
> Also, make sure to start the actual text at the margin.
> =======================================================
>
> +* Added ``rte_queue.h`` which is clone of BSD queue.h header that is
> + portable across all OS's.

rte_queue.h -> rte_bsd_queue.h

...