aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.ibm.com>2022-08-11 09:47:46 +0200
committerStefan Liebler <stli@linux.ibm.com>2022-08-11 12:21:05 +0200
commit11f09947f3066f5ff84fd15ef22b72b46eea97a8 (patch)
treecab9aee540ec1ae8af7705a8cd6fbe25c0c0554f
parent61d2066c193472ca324b851e7f9b3668592913f0 (diff)
downloadglibc-11f09947f3066f5ff84fd15ef22b72b46eea97a8.zip
glibc-11f09947f3066f5ff84fd15ef22b72b46eea97a8.tar.gz
glibc-11f09947f3066f5ff84fd15ef22b72b46eea97a8.tar.bz2
tst-process_madvise: Check process_madvise-syscall support.
So far this test checks if pidfd_open-syscall is supported, which was introduced with linux 5.3. The process_madvise-syscall was introduced with linux 5.10. Thus you'll get FAILs if you are running a kernel in between. This patch adds a check if the first process_madvise-syscall returns ENOSYS and in this case will fail with UNSUPPORTED. Reviewed-by: Florian Weimer <fweimer@redhat.com>
-rw-r--r--sysdeps/unix/sysv/linux/tst-process_madvise.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/tst-process_madvise.c b/sysdeps/unix/sysv/linux/tst-process_madvise.c
index a674e80..3b032dd 100644
--- a/sysdeps/unix/sysv/linux/tst-process_madvise.c
+++ b/sysdeps/unix/sysv/linux/tst-process_madvise.c
@@ -101,8 +101,11 @@ do_test (void)
/* We expect this to succeed in the target process because the mapping
is valid. */
- TEST_COMPARE (process_madvise (pidfd, &iv, 1, MADV_COLD, 0),
- 2 * page_size);
+ ssize_t ret = process_madvise (pidfd, &iv, 1, MADV_COLD, 0);
+ if (ret == -1 && errno == ENOSYS)
+ FAIL_UNSUPPORTED ("kernel does not support process_madvise, skipping"
+ "test");
+ TEST_COMPARE (ret, 2 * page_size);
}
{