On 08/04/17 08:40, Colin Percival wrote:
Casting to "int" or truncating is the right thing to do in this case.
Signed integer overflow is undefined.  Using 'int' is liable to cause problems
after 2^32  ticks.


Hi,

If you check the code how this function is used, you'll see that the argument passed is computed from:

jiffies + n, where "n" is a relatively small value.

The <= 0 check is basically there to catch cases where the jiffies value has changed between the point where it was set and the point where the relative ticks timeout value "n" was extracted.

Basically the code is doing like this, reading the value of "jiffies" twice.

delay = (jiffies0 + n) - jiffies1;

if (delay <= 0)
delay = 1;

And then "delay" should be "int", because we are usually not dealing with timeouts greater than a few hundred seconds or so.

--HPS
_______________________________________________
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