[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] reading a file



Hi, Maryam M.

maryam moghaddas wrote:

 Hi
I have a task generator file, which generates a file includeing the information about the tasks, such as arrival times, start times and...
I would like to give the output of the task generator as the input of rt_process.c
My understanding is IO is kernel is different from IO in normal user space.
I started writing my own rt_read and rt_open, but it seems not working + lots of work !
What other ways do you suggest I open and read the input file?
thanx a lot
m
 
The problem is that kernel calls cannot be made from within RT processes (since they can preempt the kernel), thereby making direct access to file systems impossible.

There are some ways around, though. (But since I'm not really sure what you need, my suggestions may be a little off target...)

* Pipe the file to /dev/rtfX. You can hook an RT handler on the fifo, that receives and parses the file.

* Have a application space daemon check for commands from an RT fifo. The daemon could then respond to the commands by for example writing a requested file to another RT fifo (with an RT handler, as in the previous point). This is, I believe, the easiest way to realize a file system interface for use from RT.

* If the file(s) need to be read only once, when the RT module is loaded, I believe there are more direct ways of reading files from within init_module(), but I can't give much help there, since I'm quite new to Linux!

NOTE: If you have a non-RT application that generates output, you may off course pipe it's output to /dev/rtfX directly (in usual UNIX fashion), and use the first method I suggested.

Regards,
David Olofson
  --- [rtl] --- For more information on Real-Time Linux see: http://www.rtlinux.org/