if you configure a read timeout, but then use kqs to wait for stuff
to happen, it doesnt happen. you end up waiting for the buffer to
fill, which might not be timely...

this fixes it by starting the read timer when the kq is set up.
works for me. i can provide some example code if anyone wants a
test.

ok?

Index: bpf.c
===================================================================
RCS file: /cvs/src/sys/net/bpf.c,v
retrieving revision 1.104
diff -u -p -r1.104 bpf.c
--- bpf.c       19 Sep 2014 02:52:55 -0000      1.104
+++ bpf.c       21 Sep 2014 11:41:27 -0000
@@ -1067,6 +1067,8 @@ bpfkqfilter(dev_t dev, struct knote *kn)
        s = splnet();
        D_GET(d);
        SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       if (d->bd_rtout != -1 && d->bd_rdStart == 0)
+               d->bd_rdStart = ticks;
        splx(s);
 
        return (0);

Reply via email to