From patchwork Fri Mar 22 18:25:23 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: 160951 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1113073jan; Fri, 22 Mar 2019 11:25:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK2G9TdNDWG/6N7J+6esePqMUZv7AdVA3LBPjgJZrvDB+NVkFTF+eqVE0f07YCt73NQm1u X-Received: by 2002:a1c:dfc5:: with SMTP id w188mr3827605wmg.79.1553279138454; Fri, 22 Mar 2019 11:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553279138; cv=none; d=google.com; s=arc-20160816; b=JXMzD5XNYoF988PtM6k2YJnmv9ckdZSPedkWP6NDfjWdCQ555gNnpYbB1YkWoSwHlf jCMbCYGSkClRagBgEt1neSk4NGJHfpkVJ/dtYPcBHwBXi4/6mfgscdAqIVKTwkPCa01w X9cnR8IWfl4Q1HIJ0Y09kERcvGxHVAyo/aBBdwexWhl2bHkqdIf0Vl78OrrL7y/Cup7b 6EcevXYPdACPA5FnXkHamMp/y+4DptQrpXY235CK8L2Uaa9ccSx7BO8IF7T/1QjkTEy3 wqFt9AO5UR0G9uGHf08mChIqMaqxQvpmTOnh/sML5zKCj54DKWjoL4JateIgNoVj5RHJ 3flg== 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=YHJq98Rf+U1KLcAeMHQ+rJP21wOb4yLIUwNgFnsYM2X5J9wKfSM92rR1WAibvrR8+K qGymv7oWicF/Yx1YCZJp1HgyUamFwu8g4h0JRtIa7GZYcWyevawwL+lQhZl3eYBH6Yc1 zhD1+E11P6/1YqijcgosXuT6sTM3D74RzBa/rASXvpBkRMxDKwwLR9eHOtfNa2UG/QUH 4hnSWWGkJswXuiLbeEdZ0hNTJxWdJfSMeKAnP43PjkZmzLJZ8H3X6HFkwMwUqLtTYQmC JwX7yIbp18UY/z/kTLhMVhDb1BVAu/xSGCjkkFGdJV/RPYJbRQv5lVGFsi6Xev088k4c jTBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WJZJ0Vqz; 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 d3si2824516wrj.85.2019.03.22.11.25.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 11:25:38 -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=WJZJ0Vqz; 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 E7D2A3EB01D for ; Fri, 22 Mar 2019 19:25:37 +0100 (CET) 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 F06453EA04F for ; Fri, 22 Mar 2019 19:25:33 +0100 (CET) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (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 883D51000C75 for ; Fri, 22 Mar 2019 19:25:31 +0100 (CET) Received: by mail-qt1-x841.google.com with SMTP id w5so3563476qtb.11 for ; Fri, 22 Mar 2019 11:25:33 -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=WJZJ0Vqz0mb5RpukHY9k617O4Z4aX3DZwpFh0x4HbkpPqStnZx5AAb2l7mGXbW2oFj iVVVcbAigqYIH/MXT7KyHe6BLuMJXCl0pImu6h3lJTGKZj2OdGL/GLBYzh0OnsLp+fT9 zHp5cCKwfvOo3u3LgjQVgfznOM41kXDXi5und1Ivydx3R7/1U2W+KNJhTF4eqzMhW7ym lb7l6eJEO7/dlLMAoHTar+BA78Nm3aLJ54DS+JD2Byk1wSeZamyDf0W+6xYGqbN3j0IR O4XbEvWkc7VCuXpKMV2STScpTt0BrOZrUMfTvT6ULZZ0wlu72KTCYoNian7LS1s7RHcU idzA== 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=ojfqfDT5EnvVqpJ9UzD4hLrDEYaM3E2TB5JmIIlSZ2YCcuflQemg/hO14BqtKWcUig W4Onynhg9hO7GI54w411a3tLGzESi+3zRvj8dIl+QUNjT9O1pgk9Vvft6EL8tsj3mrye AMl8zxlo1Dzuwo/Z1uPyyympzTM6lnZClpb1CPBXgkvr+JG8YmK0CSYU/WlTokcKsCc7 7oLy6JX3womk4jrsyNzgHP1hwECxX9asMoCXa6nMDJsBgl0YTtOmXZTuntaTd70U4TA/ z1CSDyntL1vG+sg0Vdzqr1EnmHQJTSph6XS8SKab1pfT8/eKg8DxNhpUzkJQRC5CR0Ae 39+A== X-Gm-Message-State: APjAAAXGUzV5vaDKrbp3WQFEFJ9m4jH4lF6d65xZ+Fejh6k9St/TJMTk rL/iurxU7r5bbz+QG5VDjap/89aB2p9eWfM1 X-Received: by 2002:a0c:88e9:: with SMTP id 38mr9323835qvo.241.1553279131714; Fri, 22 Mar 2019 11:25:31 -0700 (PDT) Received: from workstation.celeiro.br ([191.177.184.97]) by smtp.gmail.com with ESMTPSA id h24sm7056241qte.50.2019.03.22.11.25.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 11:25:30 -0700 (PDT) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Fri, 22 Mar 2019 15:25:23 -0300 Message-Id: <20190322182526.10353-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190322133425.GB20408@rei.lan> References: <20190322133425.GB20408@rei.lan> 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,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 Cc: rafael.tinoco@linaro.org Subject: [LTP] [PATCH v4 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))