Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp967680imm; Wed, 26 Sep 2018 09:29:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV62vx0KBhjpEpCHGUKdSMCGpeezbOHMNXCS+4Eb4Sf/TsaATOlPBoo7h3FK+B1ti3lQsLK6m X-Received: by 2002:a63:7c1d:: with SMTP id x29-v6mr6378857pgc.273.1537979392519; Wed, 26 Sep 2018 09:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537979392; cv=none; d=google.com; s=arc-20160816; b=jGvf+TielXPf2q5xPEnRC1yMVKEWMW8VFTxCC1kCQtEsdadCtwea/nPLXMfbkxea4a rMMVrXKiKmjEwJm8ERFtXWDfMgjqamVzAzYbWWVzw750LugP5tY+o39H2LJGEnkBJ6n4 CshigmRokAeoynVxYuaB32s0l+ai17rWJ0PdNKcUnKwhE4g5VGRoH20RoBMWvOnIaBl1 AKwShaEbNkv/SF4ffWKd2S9OaLLFuGCy73pj3MvoEPvCbIHrxgjOGNDoiHx7I6QLdnvO MEJPv7R9jBWKBi1CDhBhNkmgrlR+xYBgiRZaeqpiaehUnzvdg/l1nYe9lMU5iOdifOOp AYNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=E9QBwuHFMsueStbCzMgQ82a3F6x6+lr1msdJdhW2TzE=; b=lgN4Tg7TvFyivo/XBJ5Ez8OALAmKfM/ePx99Qp8QHaCl1dZ8UoCwtit8/Tk/CjypqF Tp4FPWzMaKOIZyal7UsFy25ossZ4VSe7ZEo+DCODjQfSnqC8jRXw/Ido+VMGE6mprcYG h0oyZxIN6JkJXDzKj7BXyrrwfT3TOtL/3Ltqrd+G8pQ/SwpPVKsB1qvgkwaUyPtpRTGP 24xSLFPuENs3VcTXassGGNqD9O0TargwN633yuNVMuodQU5OEQe0bBvaHA4Fcz5SLU1Z tZ9MSnfxxbteweD8WLunwVaKszom+281fqLsIRHGykd75wUVRRN0TldQ7sa6f1mWPJ+n 3rRg== 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 33-v6si1608585pgv.588.2018.09.26.09.29.36; Wed, 26 Sep 2018 09:29:52 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728412AbeIZWnF (ORCPT + 99 others); Wed, 26 Sep 2018 18:43:05 -0400 Received: from g4t3426.houston.hpe.com ([15.241.140.75]:41590 "EHLO g4t3426.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727285AbeIZWnF (ORCPT ); Wed, 26 Sep 2018 18:43:05 -0400 X-Greylist: delayed 162181 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 Sep 2018 18:43:05 EDT Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3426.houston.hpe.com (Postfix) with ESMTP id 40B8760; Wed, 26 Sep 2018 16:29:21 +0000 (UTC) Received: from anatevka.americas.hpqcorp.net (anatevka.americas.hpqcorp.net [10.34.81.6]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id A969946; Wed, 26 Sep 2018 16:29:20 +0000 (UTC) Date: Wed, 26 Sep 2018 10:29:20 -0600 From: Jerry Hoemann To: Shuah Khan Cc: erosca@de.adit-jv.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [V2 PATCH] selftests: watchdog: Add gettimeout and get|set pretimeout Message-ID: <20180926162920.GB3948@anatevka.americas.hpqcorp.net> Reply-To: Jerry.Hoemann@hpe.com References: <1537817767-78918-1-git-send-email-jerry.hoemann@hpe.com> <1537817767-78918-2-git-send-email-jerry.hoemann@hpe.com> <16941ebb-85ca-ad4c-de7b-c26f193ca611@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16941ebb-85ca-ad4c-de7b-c26f193ca611@kernel.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 02:51:15PM -0600, Shuah Khan wrote: > Hi Jerry, > > On 09/24/2018 01:36 PM, Jerry Hoemann wrote: > > {"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); ?? Example shows how to set/query the timers to make sure value set was what was intended. Note: "oneshot" is a bit of a misnomer as it causes clean exit before going into the keep alive loop, but one can still specify multiple options. > > 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 -- ----------------------------------------------------------------------------- Jerry Hoemann Software Engineer Hewlett Packard Enterprise -----------------------------------------------------------------------------