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;
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to