diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-08-04 11:04:56 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-08-04 11:04:56 +0000 |
commit | 250bb437b0fc21f3f3115bd820a7c849373d09b4 (patch) | |
tree | 049ecf5ae59f8361711b45c161d6e13561e9edeb | |
parent | 85a4b7c8f8d9cd75eb3f135175fb4444aacca6d4 (diff) |
Add a '-q' option to suppress warning messages.
-rw-r--r-- | usr.sbin/watchdogd/watchdogd.8 | 8 | ||||
-rw-r--r-- | usr.sbin/watchdogd/watchdogd.c | 13 |
2 files changed, 14 insertions, 7 deletions
diff --git a/usr.sbin/watchdogd/watchdogd.8 b/usr.sbin/watchdogd/watchdogd.8 index d7ea607eeda..ecd2fb3660f 100644 --- a/usr.sbin/watchdogd/watchdogd.8 +++ b/usr.sbin/watchdogd/watchdogd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: watchdogd.8,v 1.7 2006/01/17 14:27:04 jmc Exp $ +.\" $OpenBSD: watchdogd.8,v 1.8 2006/08/04 11:04:55 mbalmer Exp $ .\" .\" Copyright (c) 2005 Marc Balmer <mbalmer@openbsd.org> .\" @@ -22,7 +22,7 @@ .Nd watchdog timer retrigger daemon .Sh SYNOPSIS .Nm watchdogd -.Op Fl d +.Op Fl dq .Op Fl i Ar interval .Op Fl p Ar period .Sh DESCRIPTION @@ -69,6 +69,10 @@ Set the hardware timer to expire in .Ar period seconds. The default is 30 seconds. +.It Fl q +Be quiet. +With this option specified, watchdogd will not output a warning message if the +underlying hardware adjusted the timeout period. .El .Sh SEE ALSO .Xr watchdog 4 , diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c index e0d60620503..5d364e339ba 100644 --- a/usr.sbin/watchdogd/watchdogd.c +++ b/usr.sbin/watchdogd/watchdogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: watchdogd.c,v 1.7 2006/06/26 06:16:09 mbalmer Exp $ */ +/* $OpenBSD: watchdogd.c,v 1.8 2006/08/04 11:04:55 mbalmer Exp $ */ /* * Copyright (c) 2005 Marc Balmer <mbalmer@openbsd.org> @@ -37,7 +37,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-d] [-i interval] [-p period]\n", + fprintf(stderr, "usage: %s [-dq] [-i interval] [-p period]\n", __progname); exit(1); } @@ -56,10 +56,10 @@ main(int argc, char *argv[]) size_t len; u_int interval = 0, period = 30, nperiod; int ch, trigauto, sauto, speriod; - int daemonize = 1, retval = 1; + int quiet = 0, daemonize = 1, retval = 1; int mib[3]; - while ((ch = getopt(argc, argv, "di:p:")) != -1) { + while ((ch = getopt(argc, argv, "di:p:q")) != -1) { switch (ch) { case 'd': daemonize = 0; @@ -75,6 +75,9 @@ main(int argc, char *argv[]) if (errstr) errx(1, "period is %s: %s", errstr, optarg); break; + case 'q': + quiet = 1; + break; default: usage(); } @@ -115,7 +118,7 @@ main(int argc, char *argv[]) goto restore; } - if (nperiod != period) + if (nperiod != period && !quiet) warnx("period adjusted to %d by device", nperiod); if (nperiod <= interval) { |