"Dresner, Norman A." wrote:
>
> I decided to answer my own question from yesterday about whether the handler
> gets invoked when a user-task tries to read from the fifo (but blocks) or
> when it succeeds, so I wrote a simple module that creates two fifos with one
> common handler. When the handler is invoked with an event on fifo#2 it gets
> data from there and writes it to fifo#1 where a task is blocked reading from
> that fifo.
>
> My original code was:
> n = rtf_get( 2 , buffer , BUFSIZE - 1 );
> if( n <= 0 )
> {
> printk( KERN_ERR "Invoked for fifo2 but no (%d) data
> found\n" , n );
> return( -EFAULT );
> }
> m = rtf_put( 1 , buffer , n );
> if( m != n )
> {
> printk( KERN_ERR "Put-Error got %d!= %d (\"%s\")\n"
> , m , n , buffer);
> return( -EINVAL );
> }
> else
> {
> printk( KERN_INFO "Put \"%s\" to fifo#1\n" , buffer
> );
> }
> But the return value from rtf_put() -- (m) -- is consistently zero. I can
> obviously work around it with:
> if( m != n && m != 0 )
> but that doesn't seem right.
>
> I'm using RH 5.2 with RTL 0.9J (The Zentropix distribution). There are
> three obvious possibilities:
> 1. My copy of rtf_put() is broken,
> or 2. There's a subtle bug in my code that I don't see.,
> or 3. The documentation is wrong about the return value (although a
> peek at the code says otherwise).
>
> So, my question is, which one is it?
>
> Thanks
> Norm
>
> --- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ----
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/~rtlinux/
Hi,
I think that the answer to your question is 1 as there is a bug in this
version of rtl_fifo.c which has been fixed in later releases of RTLv1.
If you change the statement:
return count;
to:
return written;
at the end of function rtf_put in rtl_fifo.c this should fix the
problem.
Best regards,
Steve Papacharalambous
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/