From patchwork Fri Jul 26 18:25:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 1137594 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AgL1Qmqh"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45wHZn5y31z9s8m for ; Sat, 27 Jul 2019 04:25:51 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DBB9E3C1D23 for ; Fri, 26 Jul 2019 20:25:45 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id 28D453C1CFA for ; Fri, 26 Jul 2019 20:25:44 +0200 (CEST) Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 460091001D9A for ; Fri, 26 Jul 2019 20:25:30 +0200 (CEST) Received: by mail-pg1-x543.google.com with SMTP id n9so18928783pgc.1 for ; Fri, 26 Jul 2019 11:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=I4UqvoT3BDRIJytOvEcEzKDm/K6lrdEYKKvH6s5dgMM=; b=AgL1Qmqhg2omfMVRYhny0k0IuVSm9bQHquLN3zg1TAtvIZCIrAA0gaZtITh1D2NkK1 yFQ/JioD1xBugJd5eTKtUq082EjPPnLMysH2CVLxP8V7QbklMcO4xZkiRw/mrXhA4OIt J02njlCcJaNUzuhZGzL5p2VnrM3A9wDT5CLvjQrJr/1KtOEME9YpLvaLMP2nNXLhJkrx PjdmYtkQWnYS4K9ME8U5SIKobBOdA5yJNdcIlAyHa2W5lplK4FFZ+og7yvRSZQhp21Bi 39U95o3uplWupSNqgcg5vQ23NRFr+S5Lj8LD0jVxLLi/DQJVPVVRFBFqnJO2GAT1nkH6 FS4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=I4UqvoT3BDRIJytOvEcEzKDm/K6lrdEYKKvH6s5dgMM=; b=cKfqyhNufr9OotpsN1xD7zstrcSQT6XLcIXxsPggQnjivWy1T9cjmcWAwIlL9wWPDE kyiI1OKXdBqS6zJC/Xt73/uTbq77fkQpeWJXnJhXyiZ6/8P7EGw3+J81tTgUisCpTFO8 /tiRLDpXxXmTLslNvgYb6b6t/e+l0hoQdKirVO8pfWJHyS96Bi1dl2Yx9ZX0iC8eENjN SMN0+8aEns5dFC4Qn9d8XBNukNFhsmFfzY4ONVEj4E49NIo7asH7s/RYT+C1iSCa5lQU xdNcLet2YHdtz6MS8PHz8v0zkCeGAkbBK4qVuldfCtmne0I/zFtXrcbbz4kxSSPnbq2W MiLQ== X-Gm-Message-State: APjAAAUotl9xi65jYng+lpExK1FjhnLYRMgFcCb1Pk+NbY8ABumKpqKK /JYuhOTw2z3XXIEA6ygGtec9b0Sy+bQ= X-Google-Smtp-Source: APXvYqyZm1Ji8E3w94aF4pSPy+9G1f2vDzwxbWLpd4WCi6LYMqYkT+CCK7UTFMi3qU6uAwODxzhR5w== X-Received: by 2002:a17:90a:2244:: with SMTP id c62mr101733256pje.29.1564165533476; Fri, 26 Jul 2019 11:25:33 -0700 (PDT) Received: from apollo.hsd1.ca.comcast.net (c-73-71-176-3.hsd1.ca.comcast.net. [73.71.176.3]) by smtp.gmail.com with ESMTPSA id j20sm51230978pfr.113.2019.07.26.11.25.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 11:25:32 -0700 (PDT) From: Khem Raj To: ltp@lists.linux.it Date: Fri, 26 Jul 2019 11:25:23 -0700 Message-Id: <20190726182524.43149-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 1/2] Add configure time check for getdents/getdents64 APIs X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" glibc 2.30 has added wrapper for getdents64 this will help in detecting right condition to use fallback Check for getdents API as well while here Signed-off-by: Khem Raj --- configure.ac | 2 ++ testcases/kernel/syscalls/getdents/getdents.h | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,8 @@ AC_CHECK_FUNCS([ \ fallocate \ fchownat \ fstatat \ + getdents \ + getdents64 \ kcmp \ mkdirat \ mknodat \ --- a/testcases/kernel/syscalls/getdents/getdents.h +++ b/testcases/kernel/syscalls/getdents/getdents.h @@ -23,7 +23,7 @@ #include #include "test.h" #include "lapi/syscalls.h" - +#include "config.h" /* * See fs/compat.c struct compat_linux_dirent */ @@ -34,12 +34,17 @@ struct linux_dirent { char d_name[]; }; +#if HAVE_GETDENTS +#include +#else static inline int getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size) { return ltp_syscall(__NR_getdents, fd, dirp, size); } +#endif /* HAVE_GETDENTS */ + struct linux_dirent64 { uint64_t d_ino; int64_t d_off; @@ -48,10 +53,13 @@ struct linux_dirent64 { char d_name[]; }; +#if HAVE_GETDENTS64 +#include +#else static inline int getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size) { return ltp_syscall(__NR_getdents64, fd, dirp64, size); } - +#endif /* HAVE_GETDENTS64 */ #endif /* GETDENTS_H */ From patchwork Fri Jul 26 18:25:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 1137595 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lmaOCJ3u"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45wHb24QhHz9s8m for ; Sat, 27 Jul 2019 04:26:05 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D694B3C1D1B for ; Fri, 26 Jul 2019 20:25:53 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) by picard.linux.it (Postfix) with ESMTP id 805093C1CFA for ; Fri, 26 Jul 2019 20:25:44 +0200 (CEST) Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id E9AB21401B54 for ; Fri, 26 Jul 2019 20:25:35 +0200 (CEST) Received: by mail-pg1-x543.google.com with SMTP id s1so18844767pgr.2 for ; Fri, 26 Jul 2019 11:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u7lt3e9ymEPMzU7/ZOCE+yjkZp0KTJKWEjIqLPlumwo=; b=lmaOCJ3u72MBrCXDKxYZAEMj91PvZ/CMq3Fnjs8P9pOeH9wzpdplb/oM/jOfiWnqkG ZAbV88sAqbw2RX6yaH8dvNpCJ7HHN2l6+Vy+3+wMjLB5OYL89jflay3GCzKqGUW7qV67 74KmyAnLGEz/ytSYKmqhQuBrWEMsBv/Zeappo/8RiS0t+3MJs9x4pUaytGb6RLwRWXGO l8v8v+kmgX8KjLz9F/g670YKxmHpqpYB049qXJDV2km3tvKOZYq+0AQnIjWsT8M3icNu OKLiWUzOD2Qyas6LowkKSPGe5Bcj3xShNMpCJu7GmNgUID1FLlOcNJOUWiXsOAYH3IdX jRRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u7lt3e9ymEPMzU7/ZOCE+yjkZp0KTJKWEjIqLPlumwo=; b=fVAGYNYi9SEsQnpiRiqQkZ9GE1J474CRWEtTbtu1Kf+RPV/m/bIyyv/KvY/OI2ZutG fzdu4LXHUbReZiI7/c9KN3nuYEFlAakudb/wfbN7it83zVeMGIbpZuangCVEjRAbFLZB KwJIgpn3vHu2KJQ402iMdaysE5gmaSKDFizFGFVkTc9kR436l3xe0qvcDXzO0DgaQTG3 UDgcOkyGV/KBQJSXhO1rGeal/3m0pvPfJsTN0jP6SmgcE50SW6XO3n+zsdaM40GMapG5 AmFh7yHrNv3NTwO4xsc2VWP9YcBXj2n5VU3L7hYPaMlrAXmDhAEDmzISTywfoNP+19+S YddQ== X-Gm-Message-State: APjAAAUHO2wJLs2hBgxSh5VYfE2wHmkGGxP5bKJu6G1WZmM3XZhDT7km CBlDCxLvu/Kld/X6ulm4hlFY11AzOVs= X-Google-Smtp-Source: APXvYqypDpz2KakRUzU+FOP/mVh8QZJoO6kC50Xxr951SG7oSmemp9gwa/3i3ErucK+R6YpdejZkFQ== X-Received: by 2002:a17:90a:d998:: with SMTP id d24mr72031007pjv.89.1564165534105; Fri, 26 Jul 2019 11:25:34 -0700 (PDT) Received: from apollo.hsd1.ca.comcast.net (c-73-71-176-3.hsd1.ca.comcast.net. [73.71.176.3]) by smtp.gmail.com with ESMTPSA id j20sm51230978pfr.113.2019.07.26.11.25.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 11:25:33 -0700 (PDT) From: Khem Raj To: ltp@lists.linux.it Date: Fri, 26 Jul 2019 11:25:24 -0700 Message-Id: <20190726182524.43149-2-raj.khem@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190726182524.43149-1-raj.khem@gmail.com> References: <20190726182524.43149-1-raj.khem@gmail.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 2/2] check for RES_USE_INET6 during configure X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" glibc 2.30 has remove RES_USE_INET6 define which has been on its way out since 2.26 release, this check ensures that we detect it before using it Signed-off-by: Khem Raj --- configure.ac | 13 +++++++++++++ testcases/network/multicast/mc_gethost/mc_gethost.c | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index 2255b5c181..ed7acccb01 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,19 @@ AC_CHECK_FUNCS([ \ vmsplice \ ]) +#check defines +AC_MSG_CHECKING([for RES_USE_INET6]) +AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], + [[char dummy[RES_USE_INET6];]])], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED([HAVE_RES_USE_INET6], 1, [Define to 1 if you have the RES_USE_INET6 macro.]) + ], + [ + AC_MSG_RESULT([no]) + AC_DEFINE_UNQUOTED([HAVE_RES_USE_INET6], 0, [Define to 1 if you have the RES_USE_INET6 macro.]) + ] +) # Tools knobs # Expect diff --git a/testcases/network/multicast/mc_gethost/mc_gethost.c b/testcases/network/multicast/mc_gethost/mc_gethost.c index 9cc15d086b..d1cae5441a 100644 --- a/testcases/network/multicast/mc_gethost/mc_gethost.c +++ b/testcases/network/multicast/mc_gethost/mc_gethost.c @@ -17,6 +17,8 @@ #include #include +#include "config.h" + #ifndef LOG_PERROR #define LOG_PERROR 0 #endif @@ -50,8 +52,12 @@ usage: argv++, argc--; } if (argc >= 1 && !strcmp(*argv, "-6")) { +#if HAVE_RES_USE_INET6 af = AF_INET6, size = IN6ADDRSZ; _res.options |= RES_USE_INET6; +#else + af = AF_INET, size = INADDRSZ; +#endif argv++, argc--; } if (argc >= 1 && !strcmp(*argv, "-f")) {