Hello!...
I'm having the exact same problem. I installed a handler that
should start upon an read atempt from the user space but never starts! To
solve this I used a workaround that consists in a write to a rt fifo that
starts a handler that writes the info to another rt fifo so the user
process can read it on demand. This is not a simple read perform from the
user space. In my task it is imperative than when a read atempt from the
user space is made the rt task responds imediately writing to that fifo.
If it is a bug I would be quite glad if someone fixed it.
Sergio
On Fri, 2 Mar 2001, Olaf Petzold wrote:
> Am Fre, 02 Mär 2001 schrieben Sie:
> > *Never* called? Or just not called when the FIFO is empty and you
> > do a read from it? This is a known problem that I had a quick "fix" for,
> never called imo:
>
> int rtfHandler(size_t fifo)
> {
> size_t sz;
> const char *msg = "Hallo World\n";
> sz = strlen(msg);
> rtf_put(number(), &sz, sizeof(sz));
> rtf_put(number(), (void*)msg, sz);
> return 0;
> }
>
> The first read op from user space should call the handler above. It puts at
> first the stringlength and then the string self. On each call the rtf buffer is
> filled with the same string. I'm on a wrong way ?
>
> > but was never put in to any releases of RTLinux. I say "fix" because I am not
> > sure if it would be compliant with POSIX to act this way (in other words, it
> > may be correct by POSIX standards to not call the handler on reads when the
> > FIFO is empty). This does seem to severely limit the usefulness of FIFOs,
>
> This make sense, since the buffer is empty. But, I see it like the linux proc
> fs - I can call the handler if I want asynchronous to read - only reading info
> (which is eq. to my case)! I order infos - nevertheless on empty or not empty
> buffers.
>
> The other way would be write a cmd the the kernel task that I wish to have some
> infos - the user write handler fills the buffer and than I can read from user
> space the info. For that I don't need a handler really since the buffer is
> filled and I can read from user space even if no user read handler is installed.
>
> > though. My suggestion is to do sort of an ack an response scheme in your
> > handler where the userspace program sends a request via another FIFO, then
> > the handler that gets called for that FIFO writes to the FIFO that the user
> > space program is reading from. That, or just have a real-time task write
> > data to the FIFO whenever it has some to write, until the FIFO is full, and
> > have the user space program poll on that FIFO.
>
> Is it really neccessary ? man page says:
>
> rtf_create_handler installs a handler which is executed when data is written
> to or read from a real-time fifo (RT-FIFO). fifo is an RT-FIFO that must
> have previously been created with a call to rtf_create. handler is
> then called whenever a Linux process accesses that fifo.
>
> .....
>
> Thanks
> Olaf
> -- [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/
>
>
-- [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/