From patchwork Thu Feb 21 20:30:36 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: 158962 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp920337jaa; Thu, 21 Feb 2019 12:30:48 -0800 (PST) X-Google-Smtp-Source: AHgI3Iag3UX4/6cABR91lfTkT8aXxn/xkCBLggbpXNg5vdFi3C6kT8tHnPxGEoSiOQG9xyLUgD+4 X-Received: by 2002:adf:e48a:: with SMTP id i10mr241035wrm.257.1550781048291; Thu, 21 Feb 2019 12:30:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550781048; cv=none; d=google.com; s=arc-20160816; b=MY+aaOxL9jjnVuRw032jg1IAVlWthSedt4BDrwQ93Ol3rTiDH+mju28w3ziwqibkQn zzlYzmzIyfZHiv/13EySIRgurlxd5WgtrpifVxqL0QdgFHGV9YCYBuyo5YCBxQpAI0wY G3ODJgk3JVJ56JhmlDDAQsBiaziiX5bWE8iP6iwZ8LFtumHUpVGFD0aeMn9sJLmmU3vh RDZEGsZBSeG6jZn78malVAjT3TXpTKvQakNmWhrwEUJiPRlHGF+aXCoa2opLbG6Z2lTO AP/xNsIB1Gm/m0ZBQ7JfZ86G2uhFmZdXgjNCj6LQQOaQV6DqF1P907yoIehoUmzlGgWn l0kA== 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=mkKMtL4XLDRTeJ0q/A5mBID9PLAZ2FaPY6DICQgXwIw5lAip/MG6Jyi9lLnO05ataV KFZG1zmo9mlI6/ORqhW4hhb59/nbGcQs65L2EjJ2juLGtV8MKC5bCrQcPsBhJlN8di5R yd9jnpb2LJhlg36ls4XrXVpmBbmw2MZj7QoBlWmnC54VT4KIeA6QdWis8L89om1qN034 qdumNUr2/2omL7285VHCYhUSgTmOOMch8jNOty+dbgGULT3Ww0ceQzD3oKdqVvvuTyxG 0aGcXQLFHlY+oR71JQvDQCoICH2n5q/27Fgh7tcvciTtEeZaJlbteoBJN2zfB708/aak xJfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VwuMnze1; 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 h8si5876122wmh.77.2019.02.21.12.30.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 12:30:48 -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=VwuMnze1; 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 CC97F294AF4 for ; Thu, 21 Feb 2019 21:30:47 +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 [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 7A0623EA092 for ; Thu, 21 Feb 2019 21:30:43 +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-5.smtp.seeweb.it (Postfix) with ESMTPS id AF4F9600B9D for ; Thu, 21 Feb 2019 21:30:43 +0100 (CET) Received: by mail-qt1-x844.google.com with SMTP id a48so33123151qtb.4 for ; Thu, 21 Feb 2019 12:30:42 -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=VwuMnze14K2FEXQjvZa7u3gCXHZUlVBMhr9pqHnDGcY28vknpumoyu7gn8n2JHk/s+ 5wN+evBZQevU9N+8mxgiA7jpQIDGQYsn8CHAeoiCM38Z2gPvvJ8WoxorQDlOyCWkARKq UUUBIxlqGyajABjC6ms3ycKgIdfkZLkQufzMhvG5jbqdsTt3GVleU7hepR2ryCWgopon A1eqYFnLZ6DLbapc04NMR/KyEs9eZJ/9MfsmJpCH6yMoLPXKgt9OEdOBubH0xZ8bHxw/ tjshrqeG7HgVP0rgGb97q9OzB5DYVaDznnLktifxsyiCOMQg1IaDGI0P7HrOBqfbpejD QL8w== 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=OBR+f9TlE8QlhIogRnjMyz6YBSbwuRgQOtaLRjci99SrKi3ALxH15WuWuk3b+ZbjZv PkzvafPJJYqT+0KipEpS7rBOvMcHXllYgbYj+eAlOqZQHKImC69Ghnuv9H5JwcLV3cs4 lH++lZV+bkZi8VMXjdKd58O2qAmvZzYYPc/t+v1RULuJvYBkAcrHXIjC7q2IDzndYCGN LQRjXKaMgkpumr5BPvg+hPDL2sFDBjXLB0oCfroIgrKOf9BI3wzvAKh1jr+UZ1aqtVx3 ZMKXF5VpM/e8tukRF8I+mbMsoxdOPyGOi4A0yfGcEbWBbRBVHu2ckL8eDYbw9SltguKs eo8w== X-Gm-Message-State: AHQUAuaiGcgtx+54RpQL6RdmE/SY4DFHzktCkfdxEGKwC8LDWM9GiRcw QGHEFzdLGAu1aL/X2HgHfhFXADKyfLMVuA== X-Received: by 2002:ac8:1413:: with SMTP id k19mr263794qtj.134.1550781041232; Thu, 21 Feb 2019 12:30:41 -0800 (PST) Received: from workstation.celeiro.br. ([2804:14c:8782:8061:32b5:c2ff:fe04:ac0]) by smtp.gmail.com with ESMTPSA id h58sm10652963qtb.89.2019.02.21.12.30.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 12:30:40 -0800 (PST) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Thu, 21 Feb 2019 17:30:36 -0300 Message-Id: <20190221203037.21826-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221200547.7277-2-rafael.tinoco@linaro.org> References: <20190221200547.7277-2-rafael.tinoco@linaro.org> 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 v2 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))