From patchwork Wed Dec 12 20:37:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael David Tinoco X-Patchwork-Id: 153593 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp26522ljp; Wed, 12 Dec 2018 12:37:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/U4svxmXGb3pLs5i3HFh20jE/j3Nx1V0zrrAG6+atBVsItzxt8PJW+rx53WCJPwOMzoHubh X-Received: by 2002:a50:ab82:: with SMTP id u2mr20384762edc.111.1544647068857; Wed, 12 Dec 2018 12:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544647068; cv=none; d=google.com; s=arc-20160816; b=CXddT7bcBri2Lcs6Ye1DaQ+DPvW5pgjqhwRQTTX7YURmvR6HjBT+4XvvQRRmbevKkl NntnP5pJgVwEa2ByGdQ7HuktMFSYLD6NUQVkVRLqpNYFZCH+CzMOUsJ9i0TAFLKUxqNk SOqqykyEOCGFK6E0zJfA55VPydWEbwMKtU1Wljk8zVrHy9WTE5Xjn0VzX4WdMIp4llDR dLO73ChW+XYUFfcjjrbQYgXXGmKskz1XFLw51dDJRZjmfB5KbFv5l6o2r5mmwuCgS1+S 1gm86rC8sTOueKWkcbu35peYVGNcU+dulYRDXRfvD9vMERndY8o3rBDFUr/uIfGfF9AG HWiA== 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=p5iF/3YYqlJa7D1b78SYlKGLaaUghUYtMgASo8uVEz8=; b=Zjkyjuf0CPULKEuyHjdrx6q3zca/ubZt8gQ3opl0nKcoEKEI1xwOYEqWmFC9me23pT lnQ+2oR+PGmxjsmm5wJnaCZRctP6CzHB7sUHgyluc3X5aXmM5K1xvKptnL0mebScWGhC nAHbRjFjpT02ljK7wqWSH4l8/rcRXAhrmKhskpOSxjdBQJNFBFLL2YkBseiq5CgAadHi QuRNSQj9/q/FssHkwyqXf/N44jP8T8DdQPXpWAOkagzgBIKlefDW7Q0CyuYGGZm0ANsC O77A64pp9jsgglJrTPMhz1rwHdwUmdsTYMl4eoVfQwi+gMtp+1k/6yIKL895DwpIO31U VVUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Wpa/gbwF"; 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 l16-v6si41981ejq.174.2018.12.12.12.37.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 12:37:48 -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="Wpa/gbwF"; 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 7A2533E7000 for ; Wed, 12 Dec 2018 21:37:48 +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 442C63E6FC0 for ; Wed, 12 Dec 2018 21:37:34 +0100 (CET) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (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 A1979600C2D for ; Wed, 12 Dec 2018 21:37:33 +0100 (CET) Received: by mail-qk1-x743.google.com with SMTP id a132so11648081qkg.1 for ; Wed, 12 Dec 2018 12:37:33 -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=QmOwmPfwYhp1VQZnUjmetdUEO/kYDndpH+IGSJ8Uu+8=; b=Wpa/gbwFDtxt3GkKk5cb3UCvD5xsKYTT21dy6LmxshKlqZcUluqi10xZYDNKGoYUTK HFRgdmX7ij4KjBJNl9z4S+/eMrovWF45E2b678GfYKbDEK1lyW3jzAJq2WevFwEHWQ2Z uVx+YIxE39F76xsxGXZCXbdrnnaDc2GZ5acfU= 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=QmOwmPfwYhp1VQZnUjmetdUEO/kYDndpH+IGSJ8Uu+8=; b=m2tEtNB043xehyQvcumh8pPJ0tVRr3DpCzti0/Je9f5kmn9mPeOG71VUZQWG3hCQrP BazSZDGD83njqRFDwRgEH7o5Lwg6mS6wCLUHo5g4eeWObpySmte9KhmVXlxc3+CKPyRI ED2oKV0hy+FnMwItxqI82sLtcCexltX86fFwsNdJH1oT64WxwdyZzLIpWNI18U6Ps0jp H36Y4YFwTBvvmR88+6Ll5fb0Pnc4EwTFvskcTrqMoSKHNwSiwMPTM0JwWBSXw+F1AlPs eTTKozd+Egz/eJVPjgLR7hABDpA4vJTgW1BnDW+BSJiOSjYT65cMkrFg28XvCETDHfgp FjkQ== X-Gm-Message-State: AA+aEWZj1cHl+EFT7uXaoMKrAhdpsTu2HpMNT/42i3cso9cFvu+mBVV8 r4rReAJdVyAGz9ho6bhZyV+bNAShFjfWHw== X-Received: by 2002:a37:be02:: with SMTP id o2mr19808441qkf.133.1544647052309; Wed, 12 Dec 2018 12:37:32 -0800 (PST) Received: from workstation.celeiro.br ([138.204.25.7]) by smtp.gmail.com with ESMTPSA id n3sm11846872qtc.81.2018.12.12.12.37.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 12:37:31 -0800 (PST) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Wed, 12 Dec 2018 18:37:20 -0200 Message-Id: <20181212203723.18810-3-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181212203723.18810-1-rafael.tinoco@linaro.org> References: <20181211142750.GA27159@rei> <20181212203723.18810-1-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 v3 3/6] lib: include SAFE_CLOCK_SETTIME() 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_SETTIME() macro to tst_safe_clocks.h. Signed-off-by: Rafael David Tinoco --- include/tst_safe_clocks.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h index 1b4d48543..553f8464a 100644 --- a/include/tst_safe_clocks.h +++ b/include/tst_safe_clocks.h @@ -30,9 +30,23 @@ static inline void safe_clock_gettime(const char *file, const int lineno, "%s:%d clock_gettime() failed", file, lineno); } + +static inline void safe_clock_settime(const char *file, const int lineno, + clockid_t clk_id, struct timespec *tp) +{ + int rval; + + rval = clock_settime(clk_id, tp); + if (rval != 0) + tst_brk(TBROK | TERRNO, + "%s:%d clock_gettime() failed", file, lineno); +} + #define SAFE_CLOCK_GETRES(clk_id, res)\ safe_clock_getres(__FILE__, __LINE__, (clk_id), (res)) #define SAFE_CLOCK_GETTIME(clk_id, tp)\ safe_clock_gettime(__FILE__, __LINE__, (clk_id), (tp)) +#define SAFE_CLOCK_SETTIME(clk_id, tp)\ + safe_clock_settime(__FILE__, __LINE__, (clk_id), (tp))