From patchwork Tue Feb 26 16:08:03 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: 159224 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3383741jad; Tue, 26 Feb 2019 08:08:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IY737ssEiZt4HY8lw4Ti8IYmqnyRNBS/tO2I0eqVAwz5gOdmqCoFz2ZY9ZIK2WMZ4f1xS1D X-Received: by 2002:adf:dd12:: with SMTP id a18mr15963570wrm.4.1551197295855; Tue, 26 Feb 2019 08:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551197295; cv=none; d=google.com; s=arc-20160816; b=088sIu35K/C3l/BDXngccgaGEKxcKVUt2olWkQMv8GyCmUCp8OoKRTkJuhD2LRVHD4 h1lqO+g2X8/FWOiCrksGUlRWDsWzU1GqR1pdinaNinPxeMw7MLZkhp3mK8M4Md24y0xm FB3Iz9wJ/I0fdNylQBSVvmHKuD0XlrrdnPYuYLVXQsgy/ZxFNCn1wDB4rvFtSoMzRKfa loPv2VwPpb3ljG6dVi5lPFfKQRlx1GglhSVAr1SRTHXt4IG/r+wflGWe9GZ5XeZDQeAE SQVPsa0nxlIzUeUYu0PGM7gMN9c1XW39h+fnlH9mmaStTvT4tyOIf8ha60bVBU5RkV+x Sf5g== 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 :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:delivered-to; bh=DB7GU3a+csi1R4uJYPpbz+wNuaf1Vzld24mPwJvitts=; b=f0/2L1eill8kKtvsIuNebDK8q63UwfxgfgdX0zWABwEDqIjhzzNeqKLNo7LnkNnORX VpX1E0z5IoJI1l5yfNUe0jV/I3Q8/C3Rh3h2BxrHcjSrL7wcjphKoHpHg5veIWcx4jXN ZHRgYqXyPGmIK+uy3HMOFK5MluYKdaoO/cmMvZlr7bUULIdv8BOpdXpsiuf8dlPnT7hr 2bEiuf5H05Ow7ESgjTILoEGjOyXdkj4UKpwfSC0jsJaOZ9UVKHUmJVKsySHTyQEiG6Re KkkTAa6ZmcDU/yXEO9noJsuE51fwzFzVRHzzTWYK/lnoTDFwEDG4Iv/LODs1G6twQYW6 iNUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=uAGKlVD3; 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" Return-Path: Received: from picard.linux.it (picard.linux.it. [2001:1418:10:5::2]) by mx.google.com with ESMTPS id t16si6641617wrn.364.2019.02.26.08.08.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 08:08:15 -0800 (PST) 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=uAGKlVD3; 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" Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 63EC13EAEC6 for ; Tue, 26 Feb 2019 17:08:15 +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 [217.194.8.7]) by picard.linux.it (Postfix) with ESMTP id 2D8F63EAE5A for ; Tue, 26 Feb 2019 17:08:11 +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-7.smtp.seeweb.it (Postfix) with ESMTPS id 7B06A20127D for ; Tue, 26 Feb 2019 17:08:10 +0100 (CET) Received: by mail-qt1-x841.google.com with SMTP id w4so15507883qtc.1 for ; Tue, 26 Feb 2019 08:08:10 -0800 (PST) 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=DhjB5EoiWbSSGfe6T3AqIhUKkM9IVletss0cHzBFZCo=; b=uAGKlVD3F/duZxj9Ds7lfVVcwfJxe1M8n1wm+uk+mCVZO22NmS4Mocppq/FLHkVVzZ DX4P6b6BPzLSKAgHvYoYiWJqT5751MwBBPVk1k3rf3NyTS9Wrvnn3S/UTn1Urpv3Wm8I O1bbq3N4Dk26rl5HzcR1AtE4XR+0giFPzJHHGA++sEGxjTPPVc4/PPTrnSmmLO1LlxG3 LMTF9CwrqGwmb2UYpeFjR5NosT0ewxuixc0xKaSsBX9R4qgWT9+IGkNC6F+mspAFpCT3 VyxSXfrCp1xCGaVb9SJy8vN5A6HQaeOJqJhqmalDM4Ex73gLuX/cWI9XwviI2HWudxiQ Jtgw== 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=DhjB5EoiWbSSGfe6T3AqIhUKkM9IVletss0cHzBFZCo=; b=HNOws5p0Ks6VROLcpilEPeOUogwXZSLjbjrcaftrILhe5EztC6JwDeaMKdHHtngXXG rOLkyDhzkaXEUQF79Xnzy9A4FszSA9tK1vyAxIcO8zJKrY0jasxyHyWpgudhctjPpeg2 UnrWOgM5c6d7sn+H3CAyV8TsDp+K+rbTIHpMTA9r8VJEheaUqydUt8TAFwA0P4+mLJ3j XKuA3VIJu4lQG+3N46368z2K75/0DZ4PyMtdCkI6O2q9s8dBozhbvx/CO72vYCX3RBqZ OzdTwSFa4SZ4BTNE8iZXxnnIuA3rBvf2/Vum4r5fWKb6FkybH4iojjOGwPtPLlX3HSQA 0xgQ== X-Gm-Message-State: AHQUAuZgwtAGXr0C/4HuPFWbCkY/1eMmmmxCpe6RzhL0vGkfLbjneN1U 7XL5pVt2lF7jjlKpVPjVWWaNve1mYWE= X-Received: by 2002:aed:2a56:: with SMTP id k22mr18792529qtf.85.1551197288972; Tue, 26 Feb 2019 08:08:08 -0800 (PST) Received: from workstation.celeiro.br ([191.177.185.157]) by smtp.gmail.com with ESMTPSA id d63sm10276635qka.22.2019.02.26.08.08.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 08:08:08 -0800 (PST) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Tue, 26 Feb 2019 13:08:03 -0300 Message-Id: <20190226160804.16596-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226001716.GA12569@dell5510> References: <20190226001716.GA12569@dell5510> 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 Subject: [LTP] [PATCH v3 1/2] 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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h index 553f8464a..304207f6b 100644 --- a/include/tst_safe_clocks.h +++ b/include/tst_safe_clocks.h @@ -6,6 +6,8 @@ #include #include "tst_test.h" +#include +#include "lapi/syscalls.h" static inline void safe_clock_getres(const char *file, const int lineno, clockid_t clk_id, struct timespec *res) @@ -42,6 +44,17 @@ static inline void safe_clock_settime(const char *file, const int lineno, "%s:%d clock_gettime() failed", file, lineno); } +static inline void 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", file, lineno); +} #define SAFE_CLOCK_GETRES(clk_id, res)\ safe_clock_getres(__FILE__, __LINE__, (clk_id), (res)) @@ -50,3 +63,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))