From owner-freebsd-current@FreeBSD.ORG Thu Jan 31 21:58:02 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F022716A418 for ; Thu, 31 Jan 2008 21:58:02 +0000 (UTC) (envelope-from peter@alastria.net) Received: from nebula.thdo.uk.alastria.net (unknown [IPv6:2001:ba8:0:1f0::5]) by mx1.freebsd.org (Postfix) with ESMTP id A53B613C447 for ; Thu, 31 Jan 2008 21:58:02 +0000 (UTC) (envelope-from peter@alastria.net) Received: from caesium.alastria.lan (dragon.lancs.uk.alastria.net [88.96.139.34]) (authenticated bits=0) by nebula.thdo.uk.alastria.net (8.13.3/8.13.3) with ESMTP id m0VLw9nP011181 for ; Thu, 31 Jan 2008 21:58:15 GMT (envelope-from peter@alastria.net) Message-ID: <47A24459.4050009@alastria.net> Date: Thu, 31 Jan 2008 21:57:45 +0000 From: Peter Wood User-Agent: Thunderbird 2.0.0.9 (X11/20080124) MIME-Version: 1.0 To: current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Flag: NO X-Virus-Status: No X-Spam-Score: 0.187 () FORGED_RCVD_HELO,RCVD_IN_SORBS_DUL X-Spam-Ultra-Flag: NO X-Spam-Low-Flag: NO X-Spam-Flag: NO X-Spam-High-Flag: NO X-Scanned-By: MIMEDefang 2.51 on 212.13.198.8 Cc: Subject: sys/kern/kern_time.c / ppsratecheck() off by one? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 21:58:03 -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.