Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2008 21:57:45 +0000
From:      Peter Wood <peter@alastria.net>
To:        current@freebsd.org
Subject:   sys/kern/kern_time.c / ppsratecheck() off by one?
Message-ID:  <47A24459.4050009@alastria.net>

next in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47A24459.4050009>