[linux-dvb] [PATCH] proposal - ioctl giving number of bytes available in DVR device.

Johannes Stezenbach js at linuxtv.org
Tue Jun 28 23:37:33 CEST 2005


Hi,

On Tue, Jun 21, 2005 at 02:23:54PM +0200, Perceval Anichini wrote:
> This patch provides a new IOCTL (DMX_FIONREAD) which
> allows to figure out how many bytes are stored in a DVR buffer.
> (just like the FIONREAD ioctl for sockets).
> 
> It (should) applies on CVS sources and kernel-2.6.12.
> 
> I wrote this patch because of the behavior of the DVR
> read () call waits its buffer to be filled with
> at least the number of bytes requested before returning,
> which can be problematic. 
> For example, my application which dynamically add/remove PES
> filters. If i remove every filters, and data still avaiable
> in the dvr buffer, the read () call will block forever. (as i
> try to read as much data as possible to reduce the number
> of system calls).
> 
> Could you give me your feedback on this patch, and if it
> interests other people commit it on CVS ???

Hm, your patch didn't seem to spark much interest...
Additionally, your implementation of FIONREAD is strange
(it blocks waiting for data).

You can also solve your problem by using non-blocking reads.
If you don't want to generally use O_NONBLOCK you can
set it with fnctl(fd, F_SETFL, O_NONBLOCK) after you removed
the last filter to read the remaining data.

HTH,
Johannes




More information about the linux-dvb mailing list