selftests: coredump: Fix compilation issue
PATCH 1/1 selftests: coredump: Fix compilation issue
Building coredump selftests fails on x86 due to following issues:
1./usr/include/x86_64-linux-gnu/sys/mount.h:35:3: error: expected identifier before numeric constant
35 | MS_RDONLY = 1, /* Mount read-only. */
|
<linux/fs.h> pulls in kernel-internal headers that conflict with
glibc's <sys/mount.h>, causing this error.
2.stackdump_test.c:25:1: note: ‘offsetof’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
Missing <stddef.h> causes unresolved use of offsetof().
Fix this by:
- dropping <linux/fs.h> and including <sys/mount.h>
- including <stddef.h> for offsetof()
Signed-off-by Sahil Chandna <[email protected]>
--- tools/testing/selftests/coredump/stackdump_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/coredump/stackdump_test.c +2 -1
@@ -6,7 +6,7 @@#include <libgen.h> #include <limits.h> #include <linux/coredump.h> -#include <linux/fs.h> +#include <sys/mount.h> #include <linux/limits.h> #include <pthread.h> #include <string.h>
@@ -18,6 +18,7 @@#include <sys/socket.h> #include <sys/un.h> #include <unistd.h> +#include <stddef.h> #include "../kselftest_harness.h" #include "../filesystems/wrappers.h"
Signature · 1 line
2.34.1