Hello,

I have found a bug in RTAI fifos (newfifos).
The return result from rtf_put() indicates that the entire buffer
has been written even when only a portion of the buffer has been written.
The following patch fixes this problem.

Also, from the user side, one cannot successfully select() on a /dev/rtf
handle unless there is _already_ data in the fifo.  A workaround is to
poll by calling select with 0 timeout, but that is lame.

RTL appears not to have these bugs.  Also RTL allows me to create a
fifo with a large (16MB) buffer whereas RTAI can only create fifos
with 64KB buffers.

My application is one that runs at a very high frequency and sends a
large amount of data back to user-space.

Unfortunately, the RTL/pthreads approach seems to be much more costly
(in cpu cycles) than in RTAI, so I cannot run at as high of a frequency.

Does anyone know if using the version 1 API of RTL instead of pthreads
would cut the fat and allow tighter timing?

-Truxton

--- rtai_fifos.c~       Tue Jan 18 02:14:51 2000
+++ rtai_fifos.c        Sun Aug 20 16:08:39 2000
@@ -472,16 +472,20 @@
 static inline int mbx_send_wp(MBX *mbx, void *msg, int msg_size, int lnx)
 {
        unsigned long flags;
+       int send_size ;

        flags = rtf_save_flags_and_cli();
        if (mbx->sndsem.free && mbx->frbs) {
                mbx->sndsem.free = 0;
                rtf_restore_flags(flags);
-               mbx_put(mbx, (char **)(&msg), 
-                      msg_size > mbx->frbs ? mbx->frbs : msg_size, lnx);
+               if(msg_size > mbx->frbs)
+                 send_size=mbx->frbs ;
+               else
+                 send_size=msg_size ;
+               mbx_put(mbx, (char **)(&msg), send_size, lnx);
                mbx_signal(mbx);
                mbx_sem_signal(&(mbx->sndsem), (FIFO *)mbx);
-               return 0;
+               return (msg_size-send_size);
        }
        rtf_restore_flags(flags);
        return msg_size;


-- [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/

Reply via email to