[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: [rtl] RT FIFOs and FIFO handlers]



Ken,

It should be possible with this patch to fifos/rtl_fifo.c.
The handler installed via rtf_create_handler is now called
at the beginning of the Linux read call. I think this behaviour
makes more sense.

Michael.

--- rtl_fifo.c.ori	Thu Jun 21 14:21:27 2001
+++ rtl_fifo.c	Thu Jun 21 14:23:14 2001
@@ -509,6 +509,9 @@
 
 	minor = minor + RTF_BI(minor);
 
+	if ((result = (*RTF_HANDLER(minor)) (minor)) < 0) {
+		return result;
+	}
 	if (filp->f_flags & O_NONBLOCK) {
 		/*      if (RTF_LOCK(minor))
 		   return -EAGAIN;
@@ -542,15 +545,11 @@
 		rtl_spin_unlock_irqrestore(&RTF_SPIN(minor), interrupt_state);
 		buf += chars;
 	}
-/*      RTF_LOCK(minor)--; */
 	if (read) {
 		inode->i_atime = CURRENT_TIME;
-		if ((result = (*RTF_HANDLER(minor)) (minor)) < 0) {
-			return result;
-		}
-		return read;
 	}
-	return 0;
+/*      RTF_LOCK(minor)--; */
+	return read;
 }
 
 
> Reading the document more closely, however, reveals an explanation that says this facility is used in conjunction with rtf_get() to read data from the FIFO, after it is put there
> with a write().  My problem is the opposite.  I want to put data into the FIFO, _from the rt side_ only when the Linux process is ready to read it.  In other words... when it
> executes a read().
> 
> It appears that what I am trying to do is not supported by RTLinux.  If anyone can either confirm that or show me the error of my ways and explain how it _can_ be done, I'd
> appreciate it.
> 
> Thanks.
> 
> Ken
>