[dpdk-stable] [PATCH v5 05/17] eal/linux: fix build with musl
Thomas Monjalon
thomas at monjalon.net
Thu Feb 25 19:22:38 CET 2021
In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
In case _GNU_SOURCE is undefined, as in eal_common_errno.c,
it was not possible to include rte_os.h which uses cpu_set_t.
This limitation is removed: if _GNU_SOURCE is not defined,
cpu_set_t related definitions are skipped.
Note: such definitions are unneeded in eal_common_errno.c.
A missing include of fcntl.h is also added.
Bugzilla ID: 35
Fixes: 11b57c698005 ("eal: fix error string function")
Fixes: 176bb37ca6f3 ("eal: introduce internal wrappers for file operations")
Cc: stable at dpdk.org
Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
Signed-off-by: Natanael Copa <ncopa at alpinelinux.org>
---
lib/librte_eal/linux/include/rte_os.h | 2 ++
lib/librte_eal/unix/eal_file.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h
index 390b87b3a1..f3f9982f40 100644
--- a/lib/librte_eal/linux/include/rte_os.h
+++ b/lib/librte_eal/linux/include/rte_os.h
@@ -12,6 +12,7 @@
#include <sched.h>
+#ifdef _GNU_SOURCE
typedef cpu_set_t rte_cpuset_t;
#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
@@ -28,5 +29,6 @@ typedef cpu_set_t rte_cpuset_t;
RTE_CPU_FILL(&tmp); \
CPU_XOR(dst, &tmp, src); \
} while (0)
+#endif
#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/unix/eal_file.c b/lib/librte_eal/unix/eal_file.c
index 1b26475ba4..ec554e0096 100644
--- a/lib/librte_eal/unix/eal_file.c
+++ b/lib/librte_eal/unix/eal_file.c
@@ -4,6 +4,7 @@
#include <sys/file.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <unistd.h>
#include <rte_errno.h>
--
2.30.1
More information about the stable
mailing list