From patchwork Thu Mar 21 20:27:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael David Tinoco X-Patchwork-Id: 160820 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp8399jan; Thu, 21 Mar 2019 13:27:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcBL0DLCm4hR1Muj3mB2fZ3QXQznVwyHmybExg9bs8v1KWqXSQ82owe3ufYuZ9jLYfULJw X-Received: by 2002:aa7:dd0e:: with SMTP id i14mr3814677edv.172.1553200064085; Thu, 21 Mar 2019 13:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553200064; cv=none; d=google.com; s=arc-20160816; b=ndf5IjF1vbSs0mMg00TPCakJeqO1qtsR16rOql//a0t3AAVIbYys3rYJKQeHuWjLYc 7tnOBHnydHdBhAl+ruPuEkUgDEenYZ4ja4oJFGvYYKMIzeRi30XtEZFfdi75H2giGovf 1iZRibRvtDjS225g1CctSDbAeDH+2ZpxEB6Vyl2KcRsXLHERgu5+Ur9WqhRx9IgjMH8b RTpsKGImekxu4TTlS9jNtg5uZHArrqA47hPsGWMzwsN+mnh67wTZG/7iukbUGEUbYT77 T8qXYLw5+cZWbts1wszaKixgPJaHynACPcKP3nsT5ppZsNwLXa0lM1ypiPqd+hYOw4eG WFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:delivered-to; bh=J4iDY3YyQWHimJT7P5e4Rwg5AXvpY7gEQDS2OgAq/bo=; b=lj3VVdSAfCD16LYduui/IqvwWvwJB2UstfggUxDHkzzhsF7DEyK2IQU7GwLynFpWHd MLu1KP6B3xF9B+qU+j5BBXrFDKk/pYfL8zTe8cffbEH1mgkKgIxA+gepl+j5ZusnAtBa tfX2EFdD5vz0r3SvemOD+HDrAuNFhxBnevimD+OakUk3p8il3t1VKw27bjEHUCZ24O39 sOJZJcGyyLrj94AnR/u7iA71dcA7lBvdaFuCEJWwsErdHZZXfb6atB29UkNRwkgAle72 GFntOPosLU9OjfxgQdODKX+LFpAujFmvy/ZNFbSpS3JyJuEFXXzKtJUw6u8aYeAoH/Ct mZxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OdsCIc08; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 as permitted sender) smtp.mailfrom="ltp-bounces+patch=linaro.org@lists.linux.it"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from picard.linux.it (picard.linux.it. [2001:1418:10:5::2]) by mx.google.com with ESMTPS id i21si696151edg.95.2019.03.21.13.27.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Mar 2019 13:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 as permitted sender) client-ip=2001:1418:10:5::2; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OdsCIc08; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 as permitted sender) smtp.mailfrom="ltp-bounces+patch=linaro.org@lists.linux.it"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A88473EA5BF for ; Thu, 21 Mar 2019 21:27:43 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) by picard.linux.it (Postfix) with ESMTP id BF1B63EA1D7 for ; Thu, 21 Mar 2019 21:27:39 +0100 (CET) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 140B42009B2 for ; Thu, 21 Mar 2019 21:27:39 +0100 (CET) Received: by mail-qk1-x744.google.com with SMTP id b74so17158746qkg.9 for ; Thu, 21 Mar 2019 13:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TdXXiGaRpeHTu5okHncaoNQzoyb/0cRHr1KE56BSNJ4=; b=OdsCIc08xYBmtgTU7lRJMl6HdG2Hs9uUALgfgbr6HFbCuL8BqU5p611F2LY6T2zj0Z dgWWpFy3pM3VZDicY7h7ye57zu71qFctlEDWHCqD4RRUdDvWNRrj+kw3Ts2kT2g4Ge3y wwGg62gTlgKYRnBGTDAX/e0hebgxFO0zj6dDB8GuwEN4YcyWy633rd3p99/p3tdQvJFs Ou28u6syWogpQyu/5oSTPGn79z5V8mLcp4UZ1SUwurnkoV/q5dtOs0nvGXPmDcK+euE6 H4+fF7aozSvLT+jqCWW0TmGxc84IlZD05kTI25Xq8yFPr/FxrU3NLlLNimtnot9MjnlX tDWw== 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=TdXXiGaRpeHTu5okHncaoNQzoyb/0cRHr1KE56BSNJ4=; b=WW/0n5+mLWJNPdISeP9V1YZlbliMnR3H/YowY9DBTCvMxZ0b5pV+QGgMgWeKC9Cs6e A9AYd5xU9b9SoCJeWGSU+UIrwKfg8Ncco0MCm4pLgtqyEaww7VzjWdXr4wDtkigkTVeE OEl/KPHvOpl2AnifHrRibMm7fdTH22XXtKa0yKwTF+kTEGsk28ou+gXszt+TQ8yX4I23 wSQZVTmxinOLn91svZaA+8JFS5l/2N4b5s7hPIioURlNlKkLIMeU2TGIzmJo7Sl74b+N rR4UwegQB8Tc4Wm2cy4bs/7a6lp7OB038bJtgdziqMGfPUcng9eAW5B6ypO2hszFEq/Y zXPg== X-Gm-Message-State: APjAAAUnYOrlt2CEsf2u29+dEdf7SdoQKLO5Xv7XyvK8xiKxyWL8IZj3 rhEE9VY5Z/2JapQ6eWexueiN/W1bp+H+XfeF X-Received: by 2002:a37:2fc1:: with SMTP id v184mr4499559qkh.71.1553200057615; Thu, 21 Mar 2019 13:27:37 -0700 (PDT) Received: from workstation.celeiro.br ([191.177.184.97]) by smtp.gmail.com with ESMTPSA id n5sm107446qkk.4.2019.03.21.13.27.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Mar 2019 13:27:36 -0700 (PDT) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Thu, 21 Mar 2019 17:27:29 -0300 Message-Id: <20190321202732.3331-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190321141015.GG1252@rei> References: <20190321141015.GG1252@rei> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-7.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,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Cc: rafael.tinoco@linaro.org Subject: [LTP] [PATCH v3 1/4] lib: include SAFE_CLOCK_ADJTIME() macro X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+patch=linaro.org@lists.linux.it Sender: "ltp" Adds SAFE_CLOCK_ADJTIME() macro to tst_safe_clocks.h. Signed-off-by: Rafael David Tinoco --- include/tst_safe_clocks.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h index d5cd83394..596db4099 100644 --- a/include/tst_safe_clocks.h +++ b/include/tst_safe_clocks.h @@ -6,7 +6,9 @@ */ #include +#include #include "tst_test.h" +#include "lapi/syscalls.h" #include "lapi/posix_clocks.h" static inline void safe_clock_getres(const char *file, const int lineno, @@ -44,6 +46,19 @@ static inline void safe_clock_settime(const char *file, const int lineno, "%s:%d clock_gettime() failed", file, lineno); } +static inline int safe_clock_adjtime(const char *file, const int lineno, + clockid_t clk_id, struct timex *txc) +{ + int rval; + + rval = tst_syscall(__NR_clock_adjtime, clk_id, txc); + if (rval < 0) + tst_brk(TBROK | TERRNO, + "%s:%d clock_adjtime() failed %i", file, lineno, rval); + + return rval; +} + #define SAFE_CLOCK_GETRES(clk_id, res)\ safe_clock_getres(__FILE__, __LINE__, (clk_id), (res)) @@ -52,3 +67,6 @@ static inline void safe_clock_settime(const char *file, const int lineno, #define SAFE_CLOCK_SETTIME(clk_id, tp)\ safe_clock_settime(__FILE__, __LINE__, (clk_id), (tp)) + +#define SAFE_CLOCK_ADJTIME(clk_id, txc)\ + safe_clock_adjtime(__FILE__, __LINE__, (clk_id), (txc))