]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
tst-process_madvise: Check process_madvise-syscall support.
authorStefan Liebler <stli@linux.ibm.com>
Thu, 11 Aug 2022 07:47:46 +0000 (09:47 +0200)
committerStefan Liebler <stli@linux.ibm.com>
Thu, 11 Aug 2022 10:21:05 +0000 (12:21 +0200)
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>
sysdeps/unix/sysv/linux/tst-process_madvise.c

index a674e80b7697a64823754b5fb304cffa46bc748d..3b032ddefc66e75d44570f2b90903148b413761e 100644 (file)
@@ -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);
   }
 
   {