Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Nov 2008 17:06:37 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Ivo Vachkov <ivo.vachkov@gmail.com>
Cc:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: BPF question
Message-ID:  <alpine.BSF.1.10.0811061705150.19388@fledge.watson.org>
In-Reply-To: <f85d6aa70811060750x7809288dvdb0cf683a50dcfd2@mail.gmail.com>
References:  <f85d6aa70811060750x7809288dvdb0cf683a50dcfd2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, 6 Nov 2008, Ivo Vachkov wrote:

> I am using simple write() calls to send packets over BPF file descriptor. 
> The BPF file descriptor is in buffered read mode (I assume this is the 
> default and I do not set it explicitly). From what I see my write() calls 
> are somewhat buffered. Since timing is relatively important for my project 
> I'd like to ask if there is a way "flush" the write buffer. Setting O_DIRECT 
> flag on the file descriptor doesn't seem to have any effect.

The write(2) system call does no buffering in userspace (unlike, say, 
fwrite(3)), and when you write to a BPF device it essentially goes straight 
into the network interface output queue, so there should be no need for a 
flush mechanism.  Could you describe the buffering effect you're seeing a bit 
more?

Robert N M Watson
Computer Laboratory
University of Cambridge



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.1.10.0811061705150.19388>