From owner-freebsd-net Wed Nov 6 8:20:22 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7488637B401 for ; Wed, 6 Nov 2002 08:20:21 -0800 (PST) Received: from tp.databus.com (p70-227.acedsl.com [66.114.70.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD33B43E42 for ; Wed, 6 Nov 2002 08:20:20 -0800 (PST) (envelope-from barney@tp.databus.com) Received: from tp.databus.com (localhost.databus.com [127.0.0.1]) by tp.databus.com (8.12.6/8.12.6) with ESMTP id gA6GKD5s060568; Wed, 6 Nov 2002 11:20:13 -0500 (EST) (envelope-from barney@tp.databus.com) Received: (from barney@localhost) by tp.databus.com (8.12.6/8.12.6/Submit) id gA6GKD23060567; Wed, 6 Nov 2002 11:20:13 -0500 (EST) Date: Wed, 6 Nov 2002 11:20:13 -0500 From: Barney Wolff To: Petri Helenius Cc: Barney Wolff , freebsd-net@FreeBSD.ORG Subject: Re: bpf Message-ID: <20021106162013.GA60489@tp.databus.com> References: <03fe01c28386$186fed80$862a40c1@PHE> <20021103225402.GA28812@tp.databus.com> <05af01c2856a$f103c960$862a40c1@PHE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <05af01c2856a$f103c960$862a40c1@PHE> User-Agent: Mutt/1.4i X-Scanned-By: MIMEDefang 2.24 (www . roaringpenguin . com / mimedefang) Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, Nov 06, 2002 at 10:03:06AM +0200, Petri Helenius wrote: > > The specific problem with bpf is that one might have a half-full buffer > of captured data when the select timeout hits. In that case the select > returns with no FDs ready while I think it really should return with > the bpf fd. (and if you look at the code on sys/net/bpf.c, there is > timeout handling towards that goal) but I?ve yet to figure out where it goes > wrong. > > IMO, at timeout the code should check if bd_slen > 0 and if yes, > do ROTATE_BUFFERS and bpf_wakeup() The bpf timeout has nothing to do with the select timeout. Two separate facilities. > The functionality I?m looking for is to get all the packets accumulated, say > in 1 second in single read regardless of if I got a buffer?s full of data. Then do a select with no FDs just to get a periodic wakeup. Then at wakeup do the bpf read, having set nonblocking and immediate mode so you don't get stuck in the read. -- Barney Wolff http://www.databus.com/bwresume.pdf I'm available by contract or FT, in the NYC metro area or via the 'Net. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message