From ed1d8121c2d1b33f2c886c475109ef3f556b90c6 Mon Sep 17 00:00:00 2001 From: jmg Date: Tue, 5 Aug 2003 07:12:49 +0000 Subject: add support for using kqueue to watch bpf sockets. Submitted by: Brian Buchanan of nCircle, Inc. Tested on: i386 and sparc64 --- sys/net/bpfdesc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/net/bpfdesc.h') diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index fe059cd..73dcc90 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -104,6 +104,12 @@ struct bpf_d { #define BPFD_LOCK(bd) mtx_lock(&(bd)->bd_mtx) #define BPFD_UNLOCK(bd) mtx_unlock(&(bd)->bd_mtx) +/* Test whether a BPF is ready for read(). */ +#define bpf_ready(bd) \ + ((bd)->bd_hlen != 0 || \ + (((bd)->bd_immediate || (bd)->bd_state == BPF_TIMED_OUT) && \ + (bd)->bd_slen != 0)) + /* * Descriptor associated with each attached hardware interface. */ -- cgit v1.1