aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/watchdogd
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2016-10-28 14:49:54 +0000
committerAndriy Gapon <avg@FreeBSD.org>2016-10-28 14:49:54 +0000
commit9cb44c5d21db996025a30cfd088559ddad844882 (patch)
treee8b74e1d4e5da6b6ead681e6c34ed1350e69ffec /usr.sbin/watchdogd
parent211029ce84f018ee836ee4713df6b9540db45682 (diff)
downloadsrc-9cb44c5d21db996025a30cfd088559ddad844882.tar.gz
src-9cb44c5d21db996025a30cfd088559ddad844882.zip
nap time between pats is forced to be at most half of the timeout
Previously, if the timeout was less than 10 seconds, for example, about 8 seconds, then the watchdog timer would be let to expire before patting the watchdog. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=308040
Diffstat (limited to 'usr.sbin/watchdogd')
-rw-r--r--usr.sbin/watchdogd/watchdogd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c
index 55210d612df6..9ed9de31683d 100644
--- a/usr.sbin/watchdogd/watchdogd.c
+++ b/usr.sbin/watchdogd/watchdogd.c
@@ -80,7 +80,8 @@ static u_int timeout = WD_TO_128SEC;
static u_int exit_timeout = WD_TO_NEVER;
static u_int pretimeout = 0;
static u_int timeout_sec;
-static u_int passive = 0;
+static u_int nap = 10;
+static int passive = 0;
static int is_daemon = 0;
static int is_dry_run = 0; /* do not arm the watchdog, only
report on timing of the watch
@@ -88,7 +89,6 @@ static int is_dry_run = 0; /* do not arm the watchdog, only
static int do_timedog = 0;
static int do_syslog = 1;
static int fd = -1;
-static int nap = 10;
static int carp_thresh_seconds = -1;
static char *test_cmd = NULL;
@@ -771,6 +771,9 @@ parseargs(int argc, char *argv[])
}
}
+ if (nap > timeout_sec / 2)
+ nap = timeout_sec / 2;
+
if (carp_thresh_seconds == -1)
carp_thresh_seconds = nap;