From 970f8a17c9c86eff390252e13bb9a08a3fb5a098 Mon Sep 17 00:00:00 2001 From: Brahmajit Das Date: Tue, 1 Jul 2025 02:02:48 +0530 Subject: [PATCH] samples/landlock: Fix building on musl libc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Building with make allyesconfig on musl results in the following In file included from samples/landlock/sandboxer.c:22: /usr/include/sys/prctl.h:88:8: error: redefinition of 'struct prctl_mm_map' 88 | struct prctl_mm_map { | ^~~~~~~~~~~~ In file included from samples/landlock/sandboxer.c:16: usr/include/linux/prctl.h:134:8: note: originally defined here 134 | struct prctl_mm_map { | ^~~~~~~~~~~~ This is mainly due to difference in the sys/prctl.h between glibc and musl. The struct prctl_mm_map is defined in sys/prctl.h in musl. Signed-off-by: Brahmajit Das [mic: Move down the if/include/endif block] Link: https://lore.kernel.org/r/20250630203248.16273-1-listout@listout.xyz Signed-off-by: Mickaël Salaün --- samples/landlock/sandboxer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/samples/landlock/sandboxer.c b/samples/landlock/sandboxer.c index 4e2854c6f9a3e..e7af02f98208b 100644 --- a/samples/landlock/sandboxer.c +++ b/samples/landlock/sandboxer.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -25,6 +24,10 @@ #include #include +#if defined(__GLIBC__) +#include +#endif + #ifndef landlock_create_ruleset static inline int landlock_create_ruleset(const struct landlock_ruleset_attr *const attr, -- 2.47.2