diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-10-04 15:22:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-10-04 15:22:00 +0000 |
commit | 7037769d9792cac8471eb65d038e24ae892d56e0 (patch) | |
tree | e373b703b6a34f3e17aff12a09bbcbe08bba6366 /sys/kern | |
parent | dc12fe5cab2ff57a5e25f35435e33fd11117fc72 (diff) |
At clock initialization, if we discover that tickadj is 0 (due to very
high HZ) set it to 1, to avoid various divide-by-zero errors later
Based on discussion in PR 5511
ok miod
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_clock.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index f1227743ac1..718cdb9d6e9 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clock.c,v 1.66 2008/03/15 21:21:09 miod Exp $ */ +/* $OpenBSD: kern_clock.c,v 1.67 2008/10/04 15:21:59 deraadt Exp $ */ /* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */ /*- @@ -166,6 +166,11 @@ initclocks(void) if (profhz == 0) profhz = i; psratio = profhz / i; + + /* For very large HZ, ensure that division by 0 does not occur later */ + if (tickadj == 0) + tickadj = 1; + #ifdef __HAVE_TIMECOUNTER inittimecounter(); #endif |