Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4238635imm; Tue, 25 Sep 2018 13:53:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Yk0GB4eJn0wOrEsHiZQeZboJpOJMxh8tRp1t7PuRcK5j+GCntHL7sXeKuu4OALEe6PpKH X-Received: by 2002:a17:902:650f:: with SMTP id b15-v6mr2820424plk.2.1537908786108; Tue, 25 Sep 2018 13:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537908786; cv=none; d=google.com; s=arc-20160816; b=apxr7dN16unpFr7p3kWs1PT7GtEMw+vLjQeOIM+JoLrK2efn5UIhLHNH68EBPGb/6E UUTNPlS9zW7EenzckesuJI1T4qnBpCFsuqKbkNur9Zt1pN1XZrVaP1mylHz4zpeYdMuJ MVJHtQ6Th04wLkjVqprGLWbB4ORvu2x3Huqp3LwRpEYMV2sbtEcQ1etP+ETcwDtD2GDd nQkGVOFxII+qynqTHdT0zJOrMIzAO8gTMCF4QJr/Vcg0rx3ZogAO9/Djg1IuGVWZcKb/ FGmniwUTcYnJAJelgv7kKudlG+VYWJaoWaNEkO1N7z9qtiP8pY6rvjc9zU8Li/gnXsVT XMmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=gGcOM9Kmpp0yI14byCBA8p7ryU2M55jy689266TdEnk=; b=WzrB7kNZygMSgIqMpNH0f6z14epGtg8N8vyvySQKd7vDxLgS7AH7JBqIZ6NnXGGxri grtFas/Mug5OzQU1yaOMlwrGh6H8bBDryHxDmpEbhW4A21+PXZzkN7ZPecvT86Nx9bXu mTeVlItoZ1rk7IEIYbkP7JBBnPMam/eE8WfcQTLF1lsXjduwz3xRLvA6WkoVPIIipez1 xl3gKCq//T9X1/PMfAWl6utZeUx091OtZCIUuib83rD32moSJJDX0xHarN0rmHJ0aaic 0wyzEu+Mf1cI372gXGBktwv84Hg+3W3NMqi+IvvTdiAXxjrulBVTREfMcYhGEX3sDc7G gWnw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id go1si3268542plb.266.2018.09.25.13.52.49; Tue, 25 Sep 2018 13:53:06 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726385AbeIZDAq (ORCPT + 99 others); Tue, 25 Sep 2018 23:00:46 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:52919 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbeIZDAq (ORCPT ); Tue, 25 Sep 2018 23:00:46 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 0B18222101; Tue, 25 Sep 2018 20:51:22 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo02-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A21DjoFP08AY; Tue, 25 Sep 2018 20:51:22 +0000 (UTC) Received: from [192.168.1.87] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 408EE2209A; Tue, 25 Sep 2018 20:51:15 +0000 (UTC) Subject: Re: [V2 PATCH] selftests: watchdog: Add gettimeout and get|set pretimeout To: Jerry Hoemann , erosca@de.adit-jv.com Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <1537817767-78918-1-git-send-email-jerry.hoemann@hpe.com> <1537817767-78918-2-git-send-email-jerry.hoemann@hpe.com> From: Shuah Khan Message-ID: <16941ebb-85ca-ad4c-de7b-c26f193ca611@kernel.org> Date: Tue, 25 Sep 2018 14:51:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1537817767-78918-2-git-send-email-jerry.hoemann@hpe.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jerry, On 09/24/2018 01:36 PM, Jerry Hoemann wrote: > Add command line arguments to call ioctl WDIOC_GETTIMEOUT, > WDIOC_GETPRETIMEOUT and WDIOC_SETPRETIMEOUT. > > Signed-off-by: Jerry Hoemann > --- > tools/testing/selftests/watchdog/watchdog-test.c | 33 +++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c > index 6e29087..3e8e393 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:"; > +static const char sopts[] = "bdehp:t:Tn:N"; > static const struct option lopts[] = { > {"bootstatus", no_argument, NULL, 'b'}, > {"disable", no_argument, NULL, 'd'}, > @@ -27,6 +27,9 @@ > {"help", no_argument, NULL, 'h'}, > {"pingrate", required_argument, NULL, 'p'}, > {"timeout", required_argument, NULL, 't'}, > + {"gettimeout", no_argument, NULL, 'T'}, > + {"pretimeout", required_argument, NULL, 'n'}, > + {"getpretimeout", no_argument, NULL, 'N'}, > {NULL, no_argument, NULL, 0x0} > }; > > @@ -71,9 +74,13 @@ static void usage(char *progname) > printf(" -h, --help Print the help message\n"); > printf(" -p, --pingrate=P Set ping rate to P seconds (default %d)\n", DEFAULT_PING_RATE); > printf(" -t, --timeout=T Set timeout to T seconds\n"); > + 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("\n"); > printf("Parameters are parsed left-to-right in real-time.\n"); > printf("Example: %s -d -t 10 -p 5 -e\n", progname); > + printf("Example: %s -t 12 -T -n 7 -N\n", progname); Would this work the way you want it though, since -N now is oneshot? Should this be just "printf("Example: %s -t 12 -T -n 7\n", progname); ?? The rest looks good to me. > } > > int main(int argc, char *argv[]) > @@ -135,6 +142,30 @@ int main(int argc, char *argv[]) > else > printf("WDIOC_SETTIMEOUT errno '%s'\n", strerror(errno)); > break; > + case 'T': > + oneshot = 1; > + ret = ioctl(fd, WDIOC_GETTIMEOUT, &flags); > + if (!ret) > + printf("WDIOC_GETTIMEOUT returns %u seconds.\n", flags); > + else > + printf("WDIOC_GETTIMEOUT errno '%s'\n", strerror(errno)); > + break; > + case 'n': > + flags = strtoul(optarg, NULL, 0); > + ret = ioctl(fd, WDIOC_SETPRETIMEOUT, &flags); > + if (!ret) > + printf("Watchdog pretimeout set to %u seconds.\n", flags); > + else > + printf("WDIOC_SETPRETIMEOUT errno '%s'\n", strerror(errno)); > + break; > + case 'N': > + oneshot = 1; > + ret = ioctl(fd, WDIOC_GETPRETIMEOUT, &flags); > + if (!ret) > + printf("WDIOC_GETPRETIMEOUT returns %u seconds.\n", flags); > + else > + printf("WDIOC_GETPRETIMEOUT errno '%s'\n", strerror(errno)); > + break; > default: > usage(argv[0]); > goto end; > thanks, -- Shuah