[RFC 03/47] eal: use bsd_queue.h

Stephen Hemminger
2025-08-18T23:32:58Z

Replace use of sys/queue.h with bsd_queue.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/common/eal_common_bus.c | 2 +-
lib/eal/common/eal_common_class.c | 2 +-
lib/eal/common/eal_common_dev.c | 2 +-
lib/eal/common/eal_common_tailqs.c | 2 +-
lib/eal/common/eal_common_trace.c | 2 +-
lib/eal/common/eal_private.h | 2 +-
lib/eal/common/malloc_elem.c | 2 +-
lib/eal/common/malloc_heap.c | 2 +-
lib/eal/common/malloc_heap.h | 2 +-
lib/eal/common/rte_malloc.c | 2 +-
lib/eal/freebsd/eal.c | 2 +-
lib/eal/freebsd/eal_interrupts.c | 2 +-
lib/eal/freebsd/eal_thread.c | 2 +-
lib/eal/freebsd/include/rte_os.h | 6 ++++--
lib/eal/linux/eal_alarm.c | 2 +-
lib/eal/linux/eal_interrupts.c | 2 +-
lib/eal/linux/include/rte_os.h | 3 ++-
lib/eal/windows/eal_alarm.c | 2 +-
18 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 0a2311a342..29b69a1bd8 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -4,8 +4,8 @@

#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <bus_driver.h>
#include <rte_debug.h>
#include <rte_string_fns.h>
diff --git a/lib/eal/common/eal_common_class.c b/lib/eal/common/eal_common_class.c
index 0f10c6894b..1f10eca5b5 100644
--- a/lib/eal/common/eal_common_class.c
+++ b/lib/eal/common/eal_common_class.c
@@ -4,8 +4,8 @@

#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <rte_class.h>
#include <rte_debug.h>

diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 7185de0cb9..9bd7d5082d 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -6,8 +6,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <bus_driver.h>
#include <rte_class.h>
#include <dev_driver.h>
diff --git a/lib/eal/common/eal_common_tailqs.c b/lib/eal/common/eal_common_tailqs.c
index 47080d75ac..1d4eda8517 100644
--- a/lib/eal/common/eal_common_tailqs.c
+++ b/lib/eal/common/eal_common_tailqs.c
@@ -2,10 +2,10 @@
* Copyright(c) 2010-2014 Intel Corporation
*/

-#include <sys/queue.h>
#include <stdio.h>
#include <string.h>

+#include <bsd_queue.h>
#include <rte_eal.h>
#include <rte_eal_memconfig.h>
#include <rte_log.h>
diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
index be1f78a68d..2ec2a6532d 100644
--- a/lib/eal/common/eal_common_trace.c
+++ b/lib/eal/common/eal_common_trace.c
@@ -5,9 +5,9 @@
#include <stdlib.h>
#include <fnmatch.h>
#include <pthread.h>
-#include <sys/queue.h>
#include <regex.h>

+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_errno.h>
#include <rte_lcore.h>
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 5846917cc5..d7557ea4a8 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -8,8 +8,8 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <dev_driver.h>
#include <rte_lcore.h>
#include <rte_log.h>
diff --git a/lib/eal/common/malloc_elem.c b/lib/eal/common/malloc_elem.c
index 452b119c20..cf78395eba 100644
--- a/lib/eal/common/malloc_elem.c
+++ b/lib/eal/common/malloc_elem.c
@@ -6,8 +6,8 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <rte_memory.h>
#include <rte_eal.h>
#include <rte_common.h>
diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c
index 13a56e490e..9f319cc040 100644
--- a/lib/eal/common/malloc_heap.c
+++ b/lib/eal/common/malloc_heap.c
@@ -6,8 +6,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <rte_memory.h>
#include <rte_errno.h>
#include <rte_eal.h>
diff --git a/lib/eal/common/malloc_heap.h b/lib/eal/common/malloc_heap.h
index dfc56d4ae3..5c7e6cfad8 100644
--- a/lib/eal/common/malloc_heap.h
+++ b/lib/eal/common/malloc_heap.h
@@ -6,8 +6,8 @@
#define MALLOC_HEAP_H_

#include <stdbool.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <rte_malloc.h>
#include <rte_spinlock.h>

diff --git a/lib/eal/common/rte_malloc.c b/lib/eal/common/rte_malloc.c
index 3a86c19490..f30b66fc10 100644
--- a/lib/eal/common/rte_malloc.c
+++ b/lib/eal/common/rte_malloc.c
@@ -6,8 +6,8 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <rte_errno.h>
#include <rte_memcpy.h>
#include <rte_memory.h>
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index c1ab8d86d2..64e9922775 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -17,9 +17,9 @@
#include <errno.h>
#include <limits.h>
#include <sys/mman.h>
-#include <sys/queue.h>
#include <sys/stat.h>

+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_memory.h>
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 5c3ab6699e..0e3069af8a 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -5,9 +5,9 @@
#include <string.h>
#include <sys/types.h>
#include <sys/event.h>
-#include <sys/queue.h>
#include <unistd.h>

+#include <bsd_queue.h>
#include <eal_export.h>
#include <eal_trace_internal.h>
#include <rte_errno.h>
diff --git a/lib/eal/freebsd/eal_thread.c b/lib/eal/freebsd/eal_thread.c
index 7ed76ed796..28335282e7 100644
--- a/lib/eal/freebsd/eal_thread.c
+++ b/lib/eal/freebsd/eal_thread.c
@@ -9,9 +9,9 @@
#include <unistd.h>
#include <sched.h>
#include <pthread_np.h>
-#include <sys/queue.h>
#include <sys/thr.h>

+#include <bsd_queue.h>
#include <rte_debug.h>
#include <rte_atomic.h>
#include <rte_launch.h>
diff --git a/lib/eal/freebsd/include/rte_os.h b/lib/eal/freebsd/include/rte_os.h
index 94b9275beb..874fdd7f03 100644
--- a/lib/eal/freebsd/include/rte_os.h
+++ b/lib/eal/freebsd/include/rte_os.h
@@ -12,9 +12,11 @@

#include <pthread_np.h>
#include <stdlib.h> /* Declares alloca() */
-#include <sys/queue.h>

-/* These macros are compatible with system's sys/queue.h. */
+/* Alternative to system's sys/queue.h which is missing some macros. */
+#include <bsd_queue.h>
+
+/* These macros are compatible with bsd_queue.h. */
#define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type)
#define RTE_TAILQ_ENTRY(type) TAILQ_ENTRY(type)
#define RTE_TAILQ_FOREACH(var, head, field) TAILQ_FOREACH(var, head, field)
diff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c
index eb6a21d4f0..150e502437 100644
--- a/lib/eal/linux/eal_alarm.c
+++ b/lib/eal/linux/eal_alarm.c
@@ -6,10 +6,10 @@
#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
-#include <sys/queue.h>
#include <sys/time.h>
#include <sys/timerfd.h>

+#include <bsd_queue.h>
#include <eal_export.h>
#include <eal_trace_internal.h>
#include <rte_interrupts.h>
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index 4ec78de82c..0d26cd9ce0 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-#include <sys/queue.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -15,6 +14,7 @@
#include <assert.h>
#include <stdbool.h>

+#include <bsd_queue.h>
#include <eal_export.h>
#include <eal_trace_internal.h>
#include <rte_common.h>
diff --git a/lib/eal/linux/include/rte_os.h b/lib/eal/linux/include/rte_os.h
index 20eff0409a..bfb9447586 100644
--- a/lib/eal/linux/include/rte_os.h
+++ b/lib/eal/linux/include/rte_os.h
@@ -12,7 +12,8 @@

#include <alloca.h>
#include <sched.h>
-#include <sys/queue.h>
+
+#include <bsd_queue.h>

/* These macros are compatible with system's sys/queue.h. */
#define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type)
diff --git a/lib/eal/windows/eal_alarm.c b/lib/eal/windows/eal_alarm.c
index 0b11d331dc..757d4efc4f 100644
--- a/lib/eal/windows/eal_alarm.c
+++ b/lib/eal/windows/eal_alarm.c
@@ -4,8 +4,8 @@

#include <stdatomic.h>
#include <stdbool.h>
-#include <sys/queue.h>

+#include <bsd_queue.h>
#include <eal_export.h>
#include <rte_alarm.h>
#include <rte_spinlock.h>
--
2.47.2