From patchwork Tue Jan 29 17:36:53 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: 157002 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4935238jaa; Tue, 29 Jan 2019 09:37:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IYOP96+cgAry+Py5U/4B22WYW3O7UB/oTjvqKMHokStKtpPENEegspsL0GTl/7Oe+CItwo6 X-Received: by 2002:a1c:e10a:: with SMTP id y10mr12554787wmg.73.1548783437092; Tue, 29 Jan 2019 09:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548783437; cv=none; d=google.com; s=arc-20160816; b=ZabtZuQMQWDmuTgU32BYQjsmZL7+lBZLT1eNgmLBVCRBe5vk/EBlqvXpFdpUvD/fhG gHgGFQtvRKp9Q8wbzhM9EWj76QVHhrqjzsRyHbGAATrR837UgLodprOjEEQTaGoBeDo6 Y97uzA78iwUdE8NwPii4RuW74HM6YNZWyZdvQpsa2b7nEWRFCt/T9Iuk4TOQo5mmfE8p 691sReyXSMOmktyLS5gA8VG4kZ+ig9wCgK6qI/eBf4eV71fgL+TCP+bbNPrTA2GJKL1t UECe/YDfBBRRp8YUbGju1rIP9Vs1PIZrV/ss5m7gym2bxg5hdN+EqUTjz3VOP6aCjXDb syrg== 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=CDLLaQZE3VgTZPdFf+OG7fnQ3a4864B4SLYxd+iw484=; b=bxGeUHbS9TrBoc/+0/OZElnj49x5cvmAmpvyiRXaejNCYIw0KSctpCh73AUWErpHmq BofBuJ5fi3e8q9YQnw4DdImGZY4RtfSiHU8hReXuEBsyGZI4R5ZdoR2egE0gdSZrCl31 hyHHR/Qmdmz/SpWJv0B16fVvlbd6JOTrgviLQaS4uHQFM9bgJltfsamiKj4I8Xxltyat mwhoOx0lGBj6FP/EC+EWV+K/Vd+Ysd8V8tKiq/MnoBX+CnWWf+dhdE88F1rlMz6wTfIj JrmOLBIJcZpP38dmpo91hnUQ9TSX6keAdWVclDPXUTsS6l/oiljigdjYcnsnHCfE4Ehn AuWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UKZa1nhu; 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 h19si2461254wme.135.2019.01.29.09.37.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 09:37:17 -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=UKZa1nhu; 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 A13893EAD18 for ; Tue, 29 Jan 2019 18:37:16 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id DE0DD3EA022 for ; Tue, 29 Jan 2019 18:37:06 +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-4.smtp.seeweb.it (Postfix) with ESMTPS id 8FDAA1000150 for ; Tue, 29 Jan 2019 18:37:05 +0100 (CET) Received: by mail-qk1-x744.google.com with SMTP id w204so12028595qka.2 for ; Tue, 29 Jan 2019 09:37:06 -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=nZi5PyMITqgHb+ggA7163PudKqSlxIGTd8pn1MubtZE=; b=UKZa1nhujvjdvTjwxJn+Id9R1DkxKGPHAQbvuURsV0wbkqQT98wkK5HxM7Yrjg3Z0X Is5kh1Sax00S4kCGHlkoJIbJPbOyhRk+YtujXjtiAqedNnSnF6st8s77eYYhb35gKWW5 YzpHOdWgfDHB2UN3I82GgTHsNrv/VlhPTnnn8= 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=nZi5PyMITqgHb+ggA7163PudKqSlxIGTd8pn1MubtZE=; b=jxoyvakm4CCJMZix0+UyDE3uBVCx0yWO6mtCK7/OOfkwqN740B/qD2Sbvsd6rc3bUC qqYMN9He9wnb1EviguCVnma0DnoALV2DobwbXWqdEVSGARMbIz9Sydd9glJWZhFaJlxN JcPSEKzHZjQJgXtJpCMn5aIWwBJkI/noC5VHw3F+QaeiS/QvGhDH6KBSVq0yEg6qkGKD s/shJsfPMBbAcrHvEamXrMcq8nD1Ia+O7lFGtuAJ/eoXRtcDbHrwemhjL9eWaDYRdYX7 Ia9CMifKU0WC7sv29ftxlmlISAOIQiyFBica7TeNVYQeaVNiNWLlMskNATbJv5LodbbL 11sw== X-Gm-Message-State: AJcUukfhvdWZhKTDA1pJ3tACB0gfZ02L4/WkC9vUbG7hpVyqWVsqG0KO a7VaB0j4Fxpn6GYDmxBHocUrqlT7/VA= X-Received: by 2002:a37:7d05:: with SMTP id y5mr23138294qkc.310.1548783424922; Tue, 29 Jan 2019 09:37:04 -0800 (PST) Received: from workstation.celeiro.br. ([168.194.163.64]) by smtp.gmail.com with ESMTPSA id a20sm56890855qkj.28.2019.01.29.09.37.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 09:37:04 -0800 (PST) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Tue, 29 Jan 2019 15:36:53 -0200 Message-Id: <20190129173659.27901-2-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129173659.27901-1-rafael.tinoco@linaro.org> References: <20190124161159.GC16804@rei.lan> <20190129173659.27901-1-rafael.tinoco@linaro.org> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.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-4.smtp.seeweb.it Subject: [LTP] [PATCH v4 2/8] 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))