From patchwork Fri Jul 27 13:12:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 28647 Received: (qmail 105924 invoked by alias); 27 Jul 2018 13:12:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 105893 invoked by uid 89); 27 Jul 2018 13:12:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=oYsfbDe8EbreNBgpj9GD5F1brqpzdXeODy55iQrc6RI=; b=ZoEt5sO7cINmeg0inmgFNbCKkoJeTfHVLiNxFER4CmvNgbWg1/AC93juukwvR6Gie/ drXZm+Mfue0IILKihxkgLdMWRRdocZB+mk8zQhxi5EiXgjJaPRwX97W6MeRFSMQYtCm3 3hZDBtFaTkR/MJBM6T/xqAnjCuOFb7tM2kC7E= Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] Fix Linux fcntl OFD locks on unsupported kernels Date: Fri, 27 Jul 2018 10:12:18 -0300 Message-Id: <1532697138-8891-1-git-send-email-adhemerval.zanella@linaro.org> This patch make the OFD tests return unsupported if kernel does not support OFD locks (it was added on 3.15). Checked on a ia64-linux-gnu with Linux 3.14. * sysdeps/unix/sysv/linux/tst-ofdlocks.c: Return unsupported if kernel does not support OFD locks. * sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Likewise. Reviewed-by: Carlos O'Donell --- ChangeLog | 6 ++++++ sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c | 7 ++++++- sysdeps/unix/sysv/linux/tst-ofdlocks.c | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c index 03c4abf..8da5a0b 100644 --- a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c +++ b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c @@ -62,7 +62,12 @@ do_test (void) .l_start = (off64_t)INT32_MAX + 1024, .l_len = 1024, }; - TEST_VERIFY_EXIT (fcntl (temp_fd, F_OFD_SETLKW, &lck64) == 0); + int ret = fcntl (temp_fd, F_OFD_SETLKW, &lck64); + if (ret == -1 && errno == EINVAL) + /* OFD locks are only available on Linux 3.15. */ + FAIL_UNSUPPORTED ("fcntl (F_OFD_SETLKW) not supported)"); + + TEST_VERIFY_EXIT (ret == 0); /* Open file description locks placed through the same open file description (either by same file descriptor or a duplicated one created by fork, diff --git a/sysdeps/unix/sysv/linux/tst-ofdlocks.c b/sysdeps/unix/sysv/linux/tst-ofdlocks.c index bd345e9..66c7856 100644 --- a/sysdeps/unix/sysv/linux/tst-ofdlocks.c +++ b/sysdeps/unix/sysv/linux/tst-ofdlocks.c @@ -46,7 +46,12 @@ do_test (void) .l_start = (off64_t)INT32_MAX + 1024, .l_len = 1024, }; - TEST_VERIFY_EXIT (fcntl64 (temp_fd, F_OFD_SETLKW, &lck64) == 0); + int ret = fcntl64 (temp_fd, F_OFD_SETLKW, &lck64); + if (ret == -1 && errno == EINVAL) + /* OFD locks are only available on Linux 3.15. */ + FAIL_UNSUPPORTED ("fcntl (F_OFD_SETLKW) not supported)"); + + TEST_VERIFY_EXIT (ret == 0); /* Open file description locks placed through the same open file description (either by same file descriptor or a duplicated one created by fork,