CVSROOT:        /cvs
Module name:    src
Changes by:     d...@cvs.openbsd.org    2025/05/23 18:11:08

Modified files:
        sys/kern       : kern_timeout.c 

Log message:
have timeout_add_nsec/usec/msec wait at least their specified time.

timeouts run off kernel clock ticks which are longer than
nsec/usec/msec intervals, so simply dividing these values by how
long a tick is will truncate the desired times. to mitigate this,
round up the value before the divide.

rounding up can lead to integer overflow, so detect this and clamp
the value to the max sleep time.

while here get timeout_add_sec to check for a negative time like
timeout_add does to the specified tick interval.

discussed with many
help with the int overflow stuff from djm@
ok sashan@

Reply via email to