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

Peter Wood peter at alastria.net
Thu Jan 31 13:58:03 PST 2008


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.



More information about the freebsd-current mailing list