Fix a selftest build error by switching a mman.h header include from the "sys" version to the "linux" one. Recently a reference to MADV_COLLAPSE was added to guest_memfd_test.c. This works fine if the system libc has this definition, but against older libcs, it leads to build errors like: In file included from include/kvm_util.h:8, from guest_memfd_test.c:21: guest_memfd_test.c: In function ‘test_collapse’: guest_memfd_test.c:219:47: error: ‘MADV_COLLAPSE’ undeclared (first use in this function); did you mean ‘MADV_COLD’? 219 | TEST_ASSERT_EQ(madvise(mem, pmd_size, MADV_COLLAPSE), -1); | ^~~~~~~~~~~~~ include/test_util.h:62:16: note: in definition of macro ‘TEST_ASSERT_EQ’ 62 | typeof(a) __a = (a); \ | ^ guest_memfd_test.c:219:47: note: each undeclared identifier is reported only once for each function it appears in 219 | TEST_ASSERT_EQ(madvise(mem, pmd_size, MADV_COLLAPSE), -1); | ^~~~~~~~~~~~~ include/test_util.h:62:16: note: in definition of macro ‘TEST_ASSERT_EQ’ 62 | typeof(a) __a = (a); \ | ^ The problem is the test is pulling in the libc version of mman.h instead of the Linux one. Switch it to the Linux one so MADV_COLLAPSE will be guaranteed to be present (if the user installs the headers). Fixes: 9830209b4ae8 ("KVM: selftests: Test MADV_COLLAPSE on guest_memfd") Signed-off-by: Rick Edgecombe --- Hi, I'm not sure if there is standard official version of the header to include for the selftests, but the KVM selftests no longer build for me. This fixes it. tools/testing/selftests/kvm/guest_memfd_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c index ec7644aae999..7c113b8c4f75 100644 --- a/tools/testing/selftests/kvm/guest_memfd_test.c +++ b/tools/testing/selftests/kvm/guest_memfd_test.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include -- 2.54.0