From patchwork Tue Mar 10 01:00:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 184341 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp113426ile; Mon, 9 Mar 2020 18:01:06 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuRshKrSdhjdVEL7LqBVMRRXJ4uLcD3jiweY53eGrl80ssAo65bXl1n+2KbRZIZGEBJBzil X-Received: by 2002:a17:90a:c687:: with SMTP id n7mr1016522pjt.159.1583802066580; Mon, 09 Mar 2020 18:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583802066; cv=none; d=google.com; s=arc-20160816; b=ZsIHZau5i0U3R6YZ3hez3j9x3q0xgLELOdb0i0TuqrSPTYw8tb9Jgk8CdSZyNl449s 6A/0c9MWu6l/5EwKTCSialCebZaLLwdlHUgQHNntscMv1Wf5eWQHnBeqmWl4N+T2JJog Ckomt5smqOIjrtXf7Jer0OpvBFNkfFIZOpAoNodUvA2rblG0+kNjXvgUCnaMbOjQ0LTy +hn2fxu8Yau8/CaGdmYfk/v355Y/Z2n7vL5GJ3Wz4+1C9sWhUmRKOrUblLpdb0UthOWU MMVisT+DpLfCCoKyQoZVgdKClbkcZEiUTY4R6kjESBHAGrsEO4N8fqr7ua5jidi7PjcQ n/8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature :dkim-signature; bh=Iz0xGBQP/pVzdOy7yvVz5GT9bcfx2uK02mlXwYwT1Ks=; b=iQVnPtoZNJDDjC8X/4bdNZnGQSapuQBzxyxtXNl/lNO1jpIU8Q8MYXKsQzN3/CVpV0 BJjW4O834EWfyyrYLOtrUu5sh7gL4rut3pa/jRCd4/akBtlyyX0sYk3ua0XulLjD0Lud N/tXSuI6DOXklk/pU3HxxZDCszNPj7p3mheNOztmP36CSR23kvQy797mQCk6gFI2CTGY XBcUSS+bw0VZeeNtJ1QGfWpSqwAihbYYaMU3DiqouO/rQ8DWcTnj/HCoVSAQUySottSP gOoj7mkex/V8teBN8ZA0RhJDqy/Hmz8Kd0pc5NkrwBkPJQAvcuvrFb7PCERSFo/H60Rc f1zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="N/tPA5Qw"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=XccujbWQ; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=cHj4U6Yj; spf=pass (google.com: domain of valgrind-developers-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=valgrind-developers-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id d29si14509990pgn.138.2020.03.09.18.01.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Mar 2020 18:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of valgrind-developers-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="N/tPA5Qw"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=XccujbWQ; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=cHj4U6Yj; spf=pass (google.com: domain of valgrind-developers-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=valgrind-developers-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1jBTGL-0006Q3-Q3; Tue, 10 Mar 2020 01:00:49 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jBTGI-0006Po-Ke for valgrind-developers@lists.sourceforge.net; Tue, 10 Mar 2020 01:00:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZMPZ671KzfESavfa//Nvh/mDN484LhiCQhrDVfYvEXk=; b=N/tPA5Qwf7tRCSuaKBr+yyYgI2 kCb9SueSJ2FOZv6GVSZBUxA1skyOeNU+w1qxZN+i1ifrqvcT30xkORnuHSX5CYNQXLMPHRf6XfaA3 WKfLWli3hlqwQgl35W+gHEZKXAKFyQtey/7g6nbWjYhBC9Bnms+w5WXNFIc4dbBc/JrI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=ZMPZ671KzfESavfa//Nvh/mDN484LhiCQhrDVfYvEXk=; b=X ccujbWQd/sdkPU/Vo+etWDhnyhDXGEJkyG9Q6muX5Q8SEILamWJdHbegbt8hAfZ1DZN18N36o3t7l s7tFEQ4+jEOr81kpCVd5r19jFUIip6sbPtI4iO7xP82/fPLEFx+zxgojvNVXu+qKFi4MDVSTEeQKv QhSej5wupPPcupmU=; Received: from mail-pf1-f195.google.com ([209.85.210.195]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1jBTGE-00E7bO-MR for valgrind-developers@lists.sourceforge.net; Tue, 10 Mar 2020 01:00:46 +0000 Received: by mail-pf1-f195.google.com with SMTP id w65so5102315pfb.6 for ; Mon, 09 Mar 2020 18:00:42 -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=ZMPZ671KzfESavfa//Nvh/mDN484LhiCQhrDVfYvEXk=; b=cHj4U6Yj14aksVISs3DcWnj8WGn7mGLI20ZUMupfnlBTrcGs268LJn704353wtD6Mr zVQB0rO3aWEXHChbG3qw4w3UiPMxryVJxU2QXTCwuAylmZuDNOadAUO0CCVpgkG6KBnP F3KAXwj+9jBdjYVoOGfqFIjEtUCYCAXakNw0PZfHVAHk9937e5nOZRunczrpW9QGOa5D IRPs7N3ACUEKU/JW9FjdmM1L+DLDmv8lPqHA2mFbyUDN/dhNcCQ01Xx9zIdl9CfhXZdR YYoDU9/Ek5jPHMU4L+mOFmb1Cuwe6HnG1CiHD6AmgVPRtM8RWFbybxP93DVog+cvfcQF r7FA== 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=ZMPZ671KzfESavfa//Nvh/mDN484LhiCQhrDVfYvEXk=; b=WqusZ+pTfkCVCh0Ui8+HOYabUsrs++5mUFNwW02TbunaplZFDn3AOAQQmdPoqIxTw9 SgZkuGKO727l0KOtZ+Ut2b6DY8+B9BpnuzohB9BIXBHraMUFnbofYEyHKylMKYBc8u5R HZBrNgZKmnXaMFNIvqAw3oXHSAe2VG756ACfAS98MS0VRZX8LAexaTbcv6Y5eZCfIhAd FDwwx6WT45bLo7Dbmo8hTjEr10Mnn/RtBch4ixNx1CDv0nknjL/iOgKWO1ShBJsvRoCJ KD4VEkIlh+ROwpCQpwxmqVveYAf8VCgj3JNsiqloBIy/xyynaR7l212Gjf9MpJGXxPrN oQZw== X-Gm-Message-State: ANhLgQ2ZNfiWFzyY2kBG9mODiAE2IzLJ2NEzyMpQWi+5izYpR2y5cIJK 8gU65+3grsClDwutS0J0jQ31LmQwqLQ= X-Received: by 2002:a63:a601:: with SMTP id t1mr18847393pge.23.1583802035857; Mon, 09 Mar 2020 18:00:35 -0700 (PDT) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:4e0::1c34]) by smtp.gmail.com with ESMTPSA id x18sm34804830pfo.148.2020.03.09.18.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 18:00:34 -0700 (PDT) From: Khem Raj To: valgrind-developers@lists.sourceforge.net Date: Mon, 9 Mar 2020 18:00:46 -0700 Message-Id: <20200310010046.3014392-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Score: -0.3 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (raj.khem[at]gmail.com) 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: configure.ac] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.210.195 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.210.195 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1jBTGE-00E7bO-MR Subject: [Valgrind-developers] [PATCH V2] memcheck/tests: Fix timerfd syscall test X-BeenThere: valgrind-developers@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: Technical discussion for valgrind developers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: valgrind-developers-bounces@lists.sourceforge.net modern libc provides these functions, moreover this also ensures that we are 64bit time_t safe. Fallback to existing definitions if libc does not have the implementation or syscall is not defined Signed-off-by: Khem Raj --- v2: Check for sys/timerfd.h header instead of funcitons configure.ac | 1 + memcheck/tests/linux/timerfd-syscall.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) -- 2.25.1 _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers diff --git a/configure.ac b/configure.ac index 3336329e9..4c607fb8b 100755 --- a/configure.ac +++ b/configure.ac @@ -4206,6 +4206,7 @@ AC_CHECK_HEADERS([ \ sys/syscall.h \ sys/sysnvl.h \ sys/time.h \ + sys/timerfd.h \ sys/types.h \ ]) diff --git a/memcheck/tests/linux/timerfd-syscall.c b/memcheck/tests/linux/timerfd-syscall.c index 4af622cc4..9bb697475 100644 --- a/memcheck/tests/linux/timerfd-syscall.c +++ b/memcheck/tests/linux/timerfd-syscall.c @@ -44,6 +44,9 @@ #if defined(HAVE_SYS_TIME_H) #include #endif +#if defined(HAVE_SYS_TIMERFD_H) +#include +#endif #if defined(HAVE_SYS_TYPES_H) #include #endif @@ -53,7 +56,8 @@ * timerfd_* system call numbers introduced in 2.6.23. These constants are * not yet in the glibc 2.7 headers, that is why they are defined here. */ -#ifndef __NR_timerfd_create +#if !defined(HAVE_SYS_TIMERFD_H) +#if !defined(__NR_timerfd_create) #if defined(__x86_64__) #define __NR_timerfd_create 283 #elif defined(__i386__) @@ -66,8 +70,10 @@ #error Cannot detect your architecture! #endif #endif +#endif -#ifndef __NR_timerfd_settime +#if !defined(HAVE_SYS_TIMERFD_H) +#if !defined(__NR_timerfd_settime) #if defined(__x86_64__) #define __NR_timerfd_settime 286 #define __NR_timerfd_gettime 287 @@ -84,7 +90,7 @@ #error Cannot detect your architecture! #endif #endif - +#endif /* Definitions from include/linux/timerfd.h */ @@ -126,6 +132,7 @@ void set_timespec(struct timespec *tmr, unsigned long long ustime) tmr->tv_nsec = (long) (1000ULL * (ustime % 1000000ULL)); } +#if !defined(HAVE_SYS_TIMERFD_H) int timerfd_create(int clockid, int flags) { return syscall(__NR_timerfd_create, clockid, flags); @@ -141,6 +148,7 @@ int timerfd_gettime(int ufc, struct itimerspec *otmr) { return syscall(__NR_timerfd_gettime, ufc, otmr); } +#endif long waittmr(int tfd, int timeo) {