[v5,05/17] eal/linux: fix build with musl
Checks
Commit Message
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@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
lib/librte_eal/linux/include/rte_os.h | 2 ++
lib/librte_eal/unix/eal_file.c | 1 +
2 files changed, 3 insertions(+)
@@ -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_ */
@@ -4,6 +4,7 @@
#include <sys/file.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <unistd.h>
#include <rte_errno.h>