summaryrefslogtreecommitdiffstats
path: root/sys/net/bpfdesc.h
diff options
context:
space:
mode:
authorjmg <jmg@FreeBSD.org>2003-08-05 07:12:49 +0000
committerjmg <jmg@FreeBSD.org>2003-08-05 07:12:49 +0000
commited1d8121c2d1b33f2c886c475109ef3f556b90c6 (patch)
tree258f37b0d41286f68a5be4b2d848607075e81ff0 /sys/net/bpfdesc.h
parentd0c4c329b1946b004bffc0036516aaf3bcd1d928 (diff)
downloadFreeBSD-src-ed1d8121c2d1b33f2c886c475109ef3f556b90c6.zip
FreeBSD-src-ed1d8121c2d1b33f2c886c475109ef3f556b90c6.tar.gz
add support for using kqueue to watch bpf sockets.
Submitted by: Brian Buchanan of nCircle, Inc. Tested on: i386 and sparc64
Diffstat (limited to 'sys/net/bpfdesc.h')
-rw-r--r--sys/net/bpfdesc.h6
1 files changed, 6 insertions, 0 deletions
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.
*/
OpenPOWER on IntegriCloud