Kernel module/IPC with userland: create and write to FIFO

Hannes Mayer debiandude at gmail.com
Fri Jun 17 14:17:58 GMT 2005


G'Day Daniel!

On 6/17/05, Daniel O'Connor <doconnor at gsoft.com.au> wrote:
> On Fri, 17 Jun 2005 21:36, Hannes Mayer wrote:
> > To cut a long story short, how can I open a FIFO in kernel space and
> > write to it, so I can open and read from it in userspace ?
> 
> Why don't you create a device node?
> 
> If you read and write to it, it acts like a FIFO.

Thanks for your reply! :-)

Well, the reason why I want to use a true FIFO is, that data is
sampled i.e. every second and I want to write it to disk in userspace
only every minute or so. So if I add a ".d_ioctl" to "struct cdevsw"
for the device node, I have to make a function in the kernel module
for handling the userspace read request and I have to cache the
sampled data in the kernel module. I want the module to be flexible,
so if I don't sample at a fixed frequency (i.e. event counting) I
don't know how much data is coming in in a certain time interval and
with a FIFO  I don't have to care about the data-cache size.

Thanks again & best regards,
Hannes.


More information about the freebsd-stable mailing list