[linux-dvb] dvr device reading hangs - patch
Krzysztof Matula
km at km.apnet.pl
Thu Apr 21 23:35:57 CEST 2005
Krzysztof Matula wrote:
> SkyStar2, kernel: 2.6.10-1.760_FC3
>
> I'm waiting for the dvr fd with select, and then if FD_ISSET I issue a
> read() call to it. Usually it works perfectly well, but sometimes,
> especially when other thread is performing multiple repeated tunings on
> the forntend the read() blocks infinitely until the process is killed...
Attached is a small patch that solves the problem.
KM
-------------- next part --------------
Index: linux/drivers/media/dvb/dvb-core/dmxdev.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dmxdev.c,v
retrieving revision 1.40
diff -u -d -r1.40 dmxdev.c
--- linux/drivers/media/dvb/dvb-core/dmxdev.c 5 Apr 2005 00:54:19 -0000 1.40
+++ linux/drivers/media/dvb/dvb-core/dmxdev.c 21 Apr 2005 21:19:07 -0000
@@ -110,6 +110,12 @@
if (non_blocking && (src->pwrite==src->pread))
return -EWOULDBLOCK;
+ /* We may not block here if there are some bytes available in the
+ buffer - poll() may have informed the client about that!
+ Note that EWOULDBLOCK will never be returned in that case. */
+ if (src->pwrite != src->pread)
+ non_blocking = 1;
+
while (todo>0) {
if (non_blocking && (src->pwrite==src->pread))
return (count-todo) ? (count-todo) : -EWOULDBLOCK;
More information about the linux-dvb
mailing list