Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4022667imu; Fri, 30 Nov 2018 09:38:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/VOPyWxstHN5dV1bWMpYnnQ1v6pGraZKZzjkhBBbgyjEyKQ0Y6bEv7xkqQODpLS4kIqD00T X-Received: by 2002:a17:902:24a2:: with SMTP id w31mr6452020pla.216.1543599504536; Fri, 30 Nov 2018 09:38:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543599504; cv=none; d=google.com; s=arc-20160816; b=Z5W1xODFDcr8sIzxzQGeWgcRKI1b09G5xPnbRtOszshIMpjVOwADoL3ycMcDSPjdLU Zo/3aIGC/8FwclsAwwd977Xc+H5c08GmAgQwaMN8830+LwVcp868LUpPMMVEV+/zNr7r V7Lq0DtBQPnUyW10KseVlRUh2WsPNaHOFZ8EyHpuwwSghhhsrOqVMX9Vdi/il8CuRMyK J1C/5agk6QG/Uy7QmVy9pn9m1SAq5JyogGrl4lvccmo7npLkIc303veeBYdafGebfrxJ 4Zl6ONuYSQDVmntbwdX76Yrosal9volTfeSwZ39bh+8R0RwMHzPXnEhXMGRBPaPpWMZH 7cIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Si2CavwILHfDzEAqS28R7Rzkou/3NGk2UGQYNwDRIAY=; b=hjXhpxiu65K5S4Khh2tkuc5P01s04Pzn3zphh2GRA6THlqEE4dA1X2tnLAUyS9imA5 c0Wq+TmpMgDK8VFPLf9SD2m9hpspMpkaN+Si/5BW1ZZiYLYcvUFokDuOgCPVsGvEYKGJ eSrmYv/1X4UENrkYiHwq7aSEvCB2cBbqObPUcEzS6mUMUm+CRqBVHkS3MCwGQiRYsY0P zK2aX0j0d0aMbF7TsR01Mu27J/c8Qix1eRnD5HT82YvuhJo3Hnw43XJA3bGjQDnrmVop sZJqB+6x7xpC5O0Lb/6HSn4AbFjex1vJglLJqM6YvS3siz7gdr7bm3B0EDuSUit957Ye hNrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7si5339988pgg.357.2018.11.30.09.38.08; Fri, 30 Nov 2018 09:38:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbeLAEpt (ORCPT + 99 others); Fri, 30 Nov 2018 23:45:49 -0500 Received: from g9t1613g.houston.hpe.com ([15.241.32.99]:32932 "EHLO g9t1613g.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726292AbeLAEpt (ORCPT ); Fri, 30 Nov 2018 23:45:49 -0500 Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by g9t1613g.houston.hpe.com (Postfix) with ESMTPS id 7047E602A3; Fri, 30 Nov 2018 17:35:48 +0000 (UTC) Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id F2CAA51; Fri, 30 Nov 2018 17:35:45 +0000 (UTC) Received: from lxbuild.ftc.rdlabs.hpecorp.net (lxbuild.ftc.rdlabs.hpecorp.net [16.78.34.175]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id A33834C; Fri, 30 Nov 2018 17:35:45 +0000 (UTC) From: Jerry Hoemann To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Jerry Hoemann Subject: [PATCH 1/1] selftests: watchdog: Add gettimeleft command line arg Date: Fri, 30 Nov 2018 10:35:41 -0700 Message-Id: <1543599341-29615-1-git-send-email-jerry.hoemann@hpe.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add command line argument to call and display the results of ioctl WDIOC_GETTIMELEFT. Signed-off-by: Jerry Hoemann --- tools/testing/selftests/watchdog/watchdog-test.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c index c6bd9a6..dac907a 100644 --- a/tools/testing/selftests/watchdog/watchdog-test.c +++ b/tools/testing/selftests/watchdog/watchdog-test.c @@ -19,7 +19,7 @@ int fd; const char v = 'V'; -static const char sopts[] = "bdehp:t:Tn:N"; +static const char sopts[] = "bdehp:t:Tn:NL"; static const struct option lopts[] = { {"bootstatus", no_argument, NULL, 'b'}, {"disable", no_argument, NULL, 'd'}, @@ -30,6 +30,7 @@ {"gettimeout", no_argument, NULL, 'T'}, {"pretimeout", required_argument, NULL, 'n'}, {"getpretimeout", no_argument, NULL, 'N'}, + {"gettimeleft", no_argument, NULL, 'L'}, {NULL, no_argument, NULL, 0x0} }; @@ -77,6 +78,7 @@ static void usage(char *progname) printf(" -T, --gettimeout Get the timeout\n"); printf(" -n, --pretimeout=T Set the pretimeout to T seconds\n"); printf(" -N, --getpretimeout Get the pretimeout\n"); + printf(" -L, --gettimeleft Get the time left until timer experies\n"); printf("\n"); printf("Parameters are parsed left-to-right in real-time.\n"); printf("Example: %s -d -t 10 -p 5 -e\n", progname); @@ -180,6 +182,15 @@ int main(int argc, char *argv[]) else printf("WDIOC_GETPRETIMEOUT error '%s'\n", strerror(errno)); break; + case 'L': + oneshot = 1; + ret = ioctl(fd, WDIOC_GETTIMELEFT, &flags); + if (!ret) + printf("WDIOC_GETTIMELEFT returns %u seconds.\n", flags); + else + printf("WDIOC_GETTIMELEFT error '%s'\n", strerror(errno)); + break; + default: usage(argv[0]); goto end; -- 1.8.3.1