Hi,

if BIOCGRTIMEOUT is set, we should wait for the timeout and not just
set EWOULDBLOCK. From my point of view the whole 'if' is unnecessary.

If the User doesn't set a timeout we have to wait anyway with tsleep()
and loop again. Well, and if the timeout is set, we should tsleep()
for the set timeout.


Index: sys/net//bpf.c
===================================================================
RCS file: /home/cvs/src/sys/net/bpf.c,v
retrieving revision 1.103
diff -u -p -u -r1.103 bpf.c
--- sys/net//bpf.c      12 Jul 2014 18:44:22 -0000      1.103
+++ sys/net//bpf.c      17 Dec 2014 08:10:18 -0000
@@ -434,11 +434,9 @@ bpfread(dev_t dev, struct uio *uio, int 
                        /* User requested non-blocking I/O */
                        error = EWOULDBLOCK;
                } else {
-                       if ((d->bd_rdStart + d->bd_rtout) < ticks) {
-                               error = tsleep((caddr_t)d, PRINET|PCATCH, "bpf",
-                                   d->bd_rtout);
-                       } else
-                               error = EWOULDBLOCK;
+                       /* User requested timeout */
+                       error = tsleep((caddr_t)d, PRINET|PCATCH, "bpf",
+                           d->bd_rtout);
                }
                if (error == EINTR || error == ERESTART) {
                        D_PUT(d);

Reply via email to