From patchwork Wed Mar 20 21:41:33 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: 160736 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp69476jan; Wed, 20 Mar 2019 14:41:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXuS41h/BtZH9Nr+fvWLB9dAJ9ozIP9+vVwwtceXSGFrzIOi+gq9zJ1Ln3zZZCXC4E4bQD X-Received: by 2002:a17:906:905:: with SMTP id i5mr244491ejd.23.1553118107493; Wed, 20 Mar 2019 14:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553118107; cv=none; d=google.com; s=arc-20160816; b=XzM2A3KBJnzLzluo580pj1x0i0I0SecB04YL5mgNlXCK5Y+VFq7nfuvAh1AtBwJ96L p291vQz8E3zByc78WlbHc+dd3P8F3Y/5g44h1wkdKU4PYL5OZY5kNgQD03ofLgcNIop0 VH2bLfcK6Vjt3elrthbTjzev8RciYDJve/MFxgS6oiZYSRCte3D3xg620RUOXJnHHxwF RAZr4QMoNZwzQ7Wqj2cFYi2JN+5pOGJCzDXJ0f+b69O8LBmTm+8fDSrhrsgI0MKMmopw gUiUBxaUHw41BqsAQXwIvBs4vXQZyBv7TFlJJh0SLq7x0ZYMoc/OfTLopCAVpnSLeQOl tCcw== 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=O1K7N7rNdV50fllYr319600JsvM7lz+RVi37VJNJr1c=; b=XzHClj0K/pKCOtGZN/ikW2sUSzb06phhWKZLONLBt0jqteC4SDJCaxaecTGM1NMku6 JBuN7UyiTJn0C+tJW5dtTfKq3MeJZtU1kjnEOttk1SNVVkS1UtHrVFIRGoJ7XEYY/oW3 N+ZhlQ54iggUfbR4o15Us1lHMkL6iAfao3jwkMgpAvJbBLruY7KLetw5y5shFF16nYoT r4CWxJ/RWgxBRQiT2lyy1CKqhY/ncuKSQcFMVCU8mAkIoMHkB6YZx2yxgAWRJA//oIxj Shxs+fXVmHTV79bmcs998HlKn/okEO4Fvzxaalp5wou3v7XEKGRUk841GzxjsC6dhSdY 7TFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="x49/Ogic"; 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 d13si1251952edx.162.2019.03.20.14.41.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 14:41:47 -0700 (PDT) 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="x49/Ogic"; 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 1C6F6294AE4 for ; Wed, 20 Mar 2019 22:41:47 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id 9DF2A3EA8F2 for ; Wed, 20 Mar 2019 22:41:42 +0100 (CET) Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id C45DD140074A for ; Wed, 20 Mar 2019 22:41:41 +0100 (CET) Received: by mail-qt1-x844.google.com with SMTP id t28so4416127qte.6 for ; Wed, 20 Mar 2019 14:41:41 -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=++1fMHmpDkFbngg7rQIasHvye23O4GxQFNunUk07TcU=; b=x49/OgicTau1eMVs/BqsB0bierFTvHtZROgS660jH3qhNod7pZ3EOiri7fUnBp4GXb h34vdw/reyqG4BlCmCalP+AzVJVWfJ7Hq3fieVGS4wHy3EBYI4pmYMO1QaJfyhlcr9Zy D/6khGZCv4MG3uSmdatUsDl2Te1fbuCbgEGO1U0MJwrJRyfHlYywtfMv3XZuTNaMzytb /X/LZSRc+t1j0JicSfSq+cmdH4gRmV+8V8tgz320QHBWPA4LxGskCozDxLl5j1+F7svt RzwsZczyJ8rIql5ZfrzFgYcIv+JMgeDCGcKLeWnaf9ww+xQVhbtahYOm03eaCL7/RqEY v9PA== 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=++1fMHmpDkFbngg7rQIasHvye23O4GxQFNunUk07TcU=; b=lJlCP+L4k8v6sQLVfvnUgq1g9wv01VI6SXjT2iJZP7ko/RD9tc/q1DYgpcwyvbm5KL a7AXCXYUFNA+PO/5BU8EYA+zp7sHGKolQETvipCzqXQ03uQLa4IDa2XADELjVHsPhxE4 IhMWzrAeycCeiESXrDPqq72TJFgW5YxooD8AbhRvzZy+ugmh3MfSKCULCScFbVeUAwJh C1yVd4/cX/2BBlYNkHQKJGdb5LhP20vdOE2SZR1oiSLlntM52w+/wfAc6q+/EWxknXYp Bl9zGCuc8eQX379ZxHIGmZcK4ef+Jv7gotJ7VSbk/V7bKqIzw+gg9ydnbDG6t+avwccK a6eA== X-Gm-Message-State: APjAAAV+F1PGEHB0/YmXmHlmNFG2S8fO1FHjDYbpxKNZPu2j7/R263M7 3BCfxU7PU/1wwTnQOeWv9yzd4CbP7C8Szw== X-Received: by 2002:ac8:263d:: with SMTP id u58mr33654qtu.295.1553118100419; Wed, 20 Mar 2019 14:41:40 -0700 (PDT) Received: from workstation.celeiro.br ([191.177.184.97]) by smtp.gmail.com with ESMTPSA id p6sm2113654qtk.70.2019.03.20.14.41.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 14:41:39 -0700 (PDT) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Wed, 20 Mar 2019 18:41:33 -0300 Message-Id: <20190320214135.7029-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190313163239.GC6171@rei> References: <20190313163239.GC6171@rei> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.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-6.smtp.seeweb.it Cc: rafael.tinoco@linaro.org Subject: [LTP] [PATCH v2 1/3] 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 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h index d5cd83394..a952be4bf 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,18 @@ 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)) @@ -52,3 +66,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))