From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1962) id 8F5AC3858429; Thu, 11 Aug 2022 10:23:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F5AC3858429 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Stefan Liebler To: glibc-cvs@sourceware.org Subject: [glibc] tst-process_madvise: Check process_madvise-syscall support. X-Act-Checkin: glibc X-Git-Author: Stefan Liebler X-Git-Refname: refs/heads/master X-Git-Oldrev: 61d2066c193472ca324b851e7f9b3668592913f0 X-Git-Newrev: 11f09947f3066f5ff84fd15ef22b72b46eea97a8 Message-Id: <20220811102317.8F5AC3858429@sourceware.org> Date: Thu, 11 Aug 2022 10:23:17 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2022 10:23:17 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11f09947f3066f5ff84fd15ef22b72b46eea97a8 commit 11f09947f3066f5ff84fd15ef22b72b46eea97a8 Author: Stefan Liebler Date: Thu Aug 11 09:47:46 2022 +0200 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 Diff: --- sysdeps/unix/sysv/linux/tst-process_madvise.c | 7 +++++-- 1 file 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 a674e80b76..3b032ddefc 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); } {