Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2016 14:49:55 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308040 - head/usr.sbin/watchdogd
Message-ID:  <201610281449.u9SEntSp080699@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Fri Oct 28 14:49:54 2016
New Revision: 308040
URL: https://svnweb.freebsd.org/changeset/base/308040

Log:
  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

Modified:
  head/usr.sbin/watchdogd/watchdogd.c

Modified: head/usr.sbin/watchdogd/watchdogd.c
==============================================================================
--- head/usr.sbin/watchdogd/watchdogd.c	Fri Oct 28 14:38:01 2016	(r308039)
+++ head/usr.sbin/watchdogd/watchdogd.c	Fri Oct 28 14:49:54 2016	(r308040)
@@ -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 ar
 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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610281449.u9SEntSp080699>