On Fri, Jul 05, 2019 at 04:14:44PM -0500, Scott Cheloha wrote: > This looks incorrect. If the watchdog period is odd you're truncating > the timeout by one second. It is, but I (carelessly) looked over this detail.
> If you convert to milliseconds it's fine to divide by 2, so I suggest > you do that. This is much better, thanks. > Of course, there's still an overflow problem here that we ought to > check for at sysctl(2) time. But that was here before and I only just > noticed it, so, one issue at a time. Yes, there are various issues with sysctl passing invalid input. Another story. OK? Index: kern_watchdog.c =================================================================== RCS file: /cvs/src/sys/kern/kern_watchdog.c,v retrieving revision 1.13 diff -u -p -r1.13 kern_watchdog.c --- kern_watchdog.c 9 Jan 2017 17:58:44 -0000 1.13 +++ kern_watchdog.c 5 Jul 2019 21:48:29 -0000 @@ -54,7 +54,7 @@ wdog_tickle(void *arg) if (wdog_ctl_cb == NULL) return; (void) (*wdog_ctl_cb)(wdog_ctl_cb_arg, wdog_period); - timeout_add(&wdog_timeout, wdog_period * hz / 2); + timeout_add_msec(&wdog_timeout, wdog_period * 1000 / 2); } void @@ -100,7 +100,7 @@ sysctl_wdog(int *name, u_int namelen, vo if (wdog_auto && wdog_period > 0) { (void) (*wdog_ctl_cb)(wdog_ctl_cb_arg, wdog_period); - timeout_add(&wdog_timeout, wdog_period * hz / 2); + timeout_add_msec(&wdog_timeout, wdog_period * 1000 / 2); } else timeout_del(&wdog_timeout);