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: 1012265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Wpa/gbwF"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43FTCK4G80z9s0t for ; Thu, 13 Dec 2018 07:37:49 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id AFFD43E6FEB for ; Wed, 12 Dec 2018 21:37:46 +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-Google-Smtp-Source: AFSGD/WF5mGbK+kzZWF0AtgTTjUwfe789txP8aKBgZ3QRIMHtW6f+agP1ExwEUfMPOK9ipgfYQGmyQ== 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+incoming=patchwork.ozlabs.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))