From patchwork Thu Feb 21 20:05:46 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: 158959 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp895877jaa; Thu, 21 Feb 2019 12:05:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IYYU68xE0xdUUCX/qSUBu2mwC9U1w57HiONt9ZyX5VIHSyStBMckjimPiO3E3nTEwTJtf7G X-Received: by 2002:adf:f4c8:: with SMTP id h8mr232366wrp.6.1550779557299; Thu, 21 Feb 2019 12:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550779557; cv=none; d=google.com; s=arc-20160816; b=OnSk1tJb4pf2KW2t7UaOxb6m5BycOw3a4dSXJZz51uhBL0dh3sKr8CG0nQS58/I1NL 3Isjtk4oyXpDd+aqYxNEjel67xQLkUkgrG5vihX6+/7es7taSkzx40+VC11mS7p5z8r1 A0AzCC3mXiYtLwxtNqo+7AMJq7q99Y5lw6tW53P2A/lwupbuFRZn/EwIMes0kU201QPE LXX3lf5NRT1EAmIs8SMqOHBA8Ny8enHf+lV4c+iNRFsi/GQO3Fd9KaxLrIqz799BiBVJ 07f+bhfmhEvNRnVOZ6P36rKfsCENH91SzYb+8Yi6DDyhPi8nyZg/2zYjcw6MT7xbX5fg O+Gg== 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:message-id:date:to:from:dkim-signature:delivered-to; bh=DB7GU3a+csi1R4uJYPpbz+wNuaf1Vzld24mPwJvitts=; b=z3qbefP1KsJdXXPxvdXQVkr7whxPvpymWS4Z90rgTvEMWgT5ULpV7dKnG5LYEtO1Ls kmCztoJxmSTTGVnbEkkUmFeCnS+yk69x0z7/kf6udBsbpOC+HSNJF+vfeaSmKCXsNGHp L4wDUqF4er7AlXS8arhC3ExBrUaHLUCGmgAsCpHG7vGBZfdY+nFdCE399y57Di9PGkvr SpVLIhbhVzNeZ0rnRcf7mo5kqS5hpf8aR2EFc8LsJDyLeFMu0TNY42I4zIpT+JRPkDBo uwggQspdgdPskqvzYT7OtACBJzZiGmNd/voJZx+F+RiIBtiLN8e15EggXN2Ue8QEY7q5 aQOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Hnyi/VZ4"; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 213.254.12.146 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. [213.254.12.146]) by mx.google.com with ESMTPS id b85si6017863wmd.179.2019.02.21.12.05.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 12:05:57 -0800 (PST) Received-SPF: pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 213.254.12.146 as permitted sender) client-ip=213.254.12.146; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Hnyi/VZ4"; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 213.254.12.146 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 D230F294AE9 for ; Thu, 21 Feb 2019 21:05:56 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id 02199294AB6 for ; Thu, 21 Feb 2019 21:05:52 +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-5.smtp.seeweb.it (Postfix) with ESMTPS id 588916013CE for ; Thu, 21 Feb 2019 21:05:53 +0100 (CET) Received: by mail-qk1-x744.google.com with SMTP id x9so5066533qkf.0 for ; Thu, 21 Feb 2019 12:05:52 -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:mime-version :content-transfer-encoding; bh=DhjB5EoiWbSSGfe6T3AqIhUKkM9IVletss0cHzBFZCo=; b=Hnyi/VZ4U6vkuD0MSCZ0D7HzpQhDp6Q1riCKngUWnwy9FQk8OPMHbUmfpTmjiIgV4J qlDNNsUnDISui6LFE1IY3WIyWN0zYIZkjfNzbnW1Ovtyw2BnGYWE9H7bZiv1KMoWrPel rRrwmA2HO9yI/ZzEa5wO1yqiaTh4Cc09PW2G75flFrEi/D7JhXOqwUeE6cbgh1siUsU1 BghjPQBcf06IWh8qO0L7QTV4T21xUCpQvz4s5oBEAMdSemrwfCpLwMlIhWoXTeVfb68l uxUpV16d+DY9hcn0YA7LYNZZsiNodOtaLIUFj/uWSXAharCvE8ffIY599ZWCCm4WS8KX iHUA== 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=DhjB5EoiWbSSGfe6T3AqIhUKkM9IVletss0cHzBFZCo=; b=WFvyApW1FMh1erjSIhadp5eqmbAn2A4LftMKKQ+4l2DTyB6EvJOOiCBFaJZ5KQHegp P5oqXxifTScaBMQ9D3xQfpMA0kX7e7wOTIosJdfhVRz6MCi2c8xQkqnqI9liEzsd94J7 O3lzWJfr/qyM2rLO73u73l/0Ch4/IDXK4vyLxrr27xYy7Yu1tpzZ8XgNU2S1SoeoQjoZ EdODKlAnMLHlko94nehs9V+bLc78TgrOg7tUvFEaWD2RIHflNVRZa0gWTniVko+b4c6L 37JP9eQj8+cpJhI9wTuDyCE9ZOwZ8AbX/571O7XlKYDqitezYtXyF3XAxCu4pw2OqmSI DYFg== X-Gm-Message-State: AHQUAuayuIMWlp4aemOXecaAiNbi+fxoBAmG+Ki2Tbz0v5onxBak1yG/ 5MhgTMo5OQDlXl0SE9bas0VOgIkvaX3jZw== X-Received: by 2002:a37:b581:: with SMTP id e123mr212081qkf.183.1550779550870; Thu, 21 Feb 2019 12:05:50 -0800 (PST) Received: from workstation.celeiro.br. ([2804:14c:8782:8061:32b5:c2ff:fe04:ac0]) by smtp.gmail.com with ESMTPSA id o21sm14257962qto.18.2019.02.21.12.05.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 12:05:50 -0800 (PST) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Thu, 21 Feb 2019 17:05:46 -0300 Message-Id: <20190221200547.7277-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.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-5.smtp.seeweb.it Subject: [LTP] [PATCH 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))