Make the tty vmin/vtime timeouts work for hz > 169 on 32 bit machines.
This commit is contained in:
parent
f5d07b2dc9
commit
eca731ac63
@ -97,6 +97,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/poll.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/serial.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/resourcevar.h>
|
||||
@ -1854,14 +1855,13 @@ ttread(struct tty *tp, struct uio *uio, int flag)
|
||||
#undef diff
|
||||
/*
|
||||
* Rounding down may make us wake up just short
|
||||
* of the target, so we round up.
|
||||
* The formula is ceiling(slp * hz/1000000).
|
||||
* 32-bit arithmetic is enough for hz < 169.
|
||||
* XXX see tvtohz() for how to avoid overflow if hz
|
||||
* is large (divide by `tick' and/or arrange to
|
||||
* use tvtohz() if hz is large).
|
||||
* of the target, so we round up. The 32 bit arithmetic is
|
||||
* sufficient for the first calculation for hz < 169.
|
||||
*/
|
||||
slp = (long) (((u_long)slp * hz) + 999999) / 1000000;
|
||||
if (sizeof(u_long) > 4 || slp <= ULONG_MAX / hz)
|
||||
slp = (long) (((u_long)slp * hz) + 999999) / 1000000;
|
||||
else
|
||||
slp = (slp + (tick - 1)) / tick;
|
||||
goto sleep;
|
||||
}
|
||||
if (qp->c_cc <= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user