BPF question
Robert Watson
rwatson at FreeBSD.org
Thu Nov 6 09:06:38 PST 2008
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
More information about the freebsd-net
mailing list