sys/kern/kern_time.c / ppsratecheck() off by one?

From: Peter Wood <peter_at_alastria.net>
Date: Thu, 31 Jan 2008 21:57:45 +0000
Hey,

I'm currently doing some work on implementing sampling in BPF, for one 
of the methods I've decided to make use of ppsratecheck(). After doing 
some testing, I found an unexpected result.

Having run ppsratecheck() through on paper, I believe that it'll always 
be off by one if the actual pps is equal or above the maximum you require.

8.0-CURRENT integrated last night, in sys/kern/kern_time.c in 
ppsratecheck() the last return of the function is follows:

853                 return (maxpps < 0 || *curpps < maxpps);

Should this not be

853                 return (maxpps < 0 || *curpps <= maxpps);

As without it ppsratecheck() will never permit maxpps, only maxpps - 1.

I could be talking twoddle, but I wanted to check.

Pete.
Received on Thu Jan 31 2008 - 20:58:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:26 UTC