From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Thomas Monjalon <thomas@monjalon.net>
Subject: [PATCH 6/6] devtools: forbid direct use of sys/queue.h
Date: Thu, 17 Sep 2026 10:19:44 -0700 [thread overview]
Message-ID: <20260917172116.660120-7-stephen@networkplumber.org> (raw)
In-Reply-To: <20260917172116.660120-1-stephen@networkplumber.org>
The set of list macros provided by <sys/queue.h> differs per platform:
glibc lacks the _FOREACH_SAFE variants, and musl and Windows have no such
header. DPDK now provides rte_queue.h with the complete set.
Both headers use the same multiple inclusion guard, so a single direct
include of <sys/queue.h> anywhere in a translation unit disables
rte_queue.h for all of it. Reject new occurrences.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
devtools/checkpatches.sh | 9 +++++++++
doc/guides/contributing/coding_style.rst | 5 ++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 18bd825372..a8ff4bfe82 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -105,6 +105,15 @@ check_forbidden_additions() { # <patch>
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
"$1" || res=1
+ # include rte_queue.h, the system header has fewer macros
+ awk -v FOLDERS="lib drivers app examples" \
+ -v SKIP_FILES='lib/eal/include/rte_queue.h' \
+ -v EXPRESSIONS='include.*<sys/queue.h>' \
+ -v RET_ON_FAIL=1 \
+ -v MESSAGE='Using <sys/queue.h>, prefer <rte_queue.h>' \
+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+ "$1" || res=1
+
# check %l or %ll format specifier
awk -v FOLDERS='lib drivers app examples' \
-v EXPRESSIONS='%ll*[xud]' \
diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst
index 11de3bb39a..f2c2cd8503 100644
--- a/doc/guides/contributing/coding_style.rst
+++ b/doc/guides/contributing/coding_style.rst
@@ -317,11 +317,14 @@ Queues
~~~~~~
Use queue(3) macros rather than rolling your own lists, whenever possible.
+Include ``<rte_queue.h>`` rather than ``<sys/queue.h>``:
+the set of macros provided by the system header differs per platform,
+and the DPDK one provides the same complete set everywhere.
Thus, the previous example would be better written:
.. code-block:: c
- #include <sys/queue.h>
+ #include <rte_queue.h>
struct foo {
LIST_ENTRY(foo) link; /* Use queue macros for foo lists. */
--
2.53.0
next prev parent reply other threads:[~2026-09-17 17:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 17:19 [PATCH 0/6] provide a complete set of BSD list macros Stephen Hemminger
2026-09-17 17:19 ` [PATCH 1/6] net/bnxt: fix use after free when freeing filters Stephen Hemminger
2026-09-17 17:19 ` [PATCH 2/6] eal: add rte_queue.h with full set of list macros Stephen Hemminger
2026-09-17 17:19 ` [PATCH 3/6] build: use rte_queue.h instead of sys/queue.h Stephen Hemminger
2026-09-17 17:19 ` [PATCH 4/6] build: remove private FOREACH_SAFE definitions Stephen Hemminger
2026-09-17 17:19 ` [PATCH 5/6] eal: deprecate RTE_TAILQ and RTE_STAILQ macro wrappers Stephen Hemminger
2026-09-17 17:19 ` Stephen Hemminger [this message]
2026-09-18 11:34 ` [PATCH 0/6] provide a complete set of BSD list macros Marat Khalili
2026-09-18 11:50 ` Bruce Richardson
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260917172116.660120-7-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/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