Re: call user function from kernel module?
From: Jeff Heath (jheath1_at_optonline.net)
Date: 10/18/03
- Next message: Frank Sweetser: "Re: modify filesystem of linux"
- Previous message: Bo Sun: "modify filesystem of linux"
- In reply to: Yanick Poirier: "Re: call user function from kernel module?"
- Next in thread: Kasper Dupont: "Re: call user function from kernel module?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Oct 2003 06:12:16 -0700
Yanick Poirier <y.poirier_NOSPAM_@yanickpoirier.com> wrote in message news:<gC0kb.64080$Lo.1093668@news.chello.at>...
> Jeff Heath wrote:
> > I'm trying to pass incoming packet data (selected contents from struct
> > sk_buffs) from the kernel to user space at *very* high data rates.
> >
> > I'll create a buffer in user space along with functions to allocate
> > and de-allocate. I will also create a fifo in user space along with
> > functions to enqueue an dequeue.
> >
> > What I'd like to do is write a kernel module that does the following:
> > - calls the user space buffer allocate function that returns a memory
> > location to write into
> > - copy data to the user space buffer (fairly certain I can do this
> > using put_user() once I have a memory location to write to).
> > - call the user space fifo enqueue function
> >
> > I tried a "proof of concept" kernel module that called a user function
> > in a "hello world" like user program. When I inserted the module I got
> > an "unresolved symbole message" which is about what I expected.
> >
> > Is there a way to do this?
>
> I'm actually messing with a similar issue and the way I found to do it
> is the following:
>
> In userland:
> 1) Allocate a data buffer
> 2) Use an IOCTL call to the driver using MYSET or MYGET commmand
> 5) If MYGET, deal with the data received.
>
> In the driver (if MYGET):
>
> 3) Call __copy_to_user()
>
> In the driver (if MYSET):
>
> 3) Allocate a memory block using kmalloc() or get_free_pages()
> 4) Call __copy_from_user()
> 5) Deal with the data
>
> Note that I haven't implemented this yet, as I'm only in early
> development, but theorically it should work.
>
> Anyone?
>
> Regards,
>
> YP.
thanks, I'll research it further and give it a try...
- Next message: Frank Sweetser: "Re: modify filesystem of linux"
- Previous message: Bo Sun: "modify filesystem of linux"
- In reply to: Yanick Poirier: "Re: call user function from kernel module?"
- Next in thread: Kasper Dupont: "Re: call user function from kernel module?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|