Callback function from kernel module

SaNtosh kuLkarni santosh.yesoptus at gmail.com
Thu Nov 8 01:03:46 EST 2012


I think you are looking for Upcall Functionality

upcall functionality allows a kernel module to invoke a function in user
space. It is possible to start a program in user space, and give it some
command line arguments, as well as setting environment variables.


**
int call_usermodehelper  (char * *path*, char ** *argv*, char ** *envp*,
int *wait*);

Runs a user-space application. The application is started asynchronously if
wait is not set, and runs as a child of keventd. (ie. it runs with full
root capabilities).

Must be called from process context. Returns a negative error code if
program was not execed successfully, or 0.

**man pages

Regards

Santosh



On Wed, Nov 7, 2012 at 8:30 PM, Bernd Petrovitsch <bernd at petrovitsch.priv.at
> wrote:

> Hi!
>
> On Sam, 2012-11-03 at 19:14 +0530, Jeshwanth Kumar N K Jeshu wrote:
> [...]
> > Can I call userspace function from kernel module ? Actually I need to
> > process some data in user space for every event occured in kernel module.
>
> The usual way to implement this with a character device. The userspace
> application opens the character device. It then read()s the events from
> it, handles it and write()s results back (if needed).
> The kernel part handles to IRQs, puts that into a buffer where it waits
> for the read() from user space.
>
> You can use netlink sockets for this which may save some code though or
> implement a character device directly.
>
> Kind regards,
>         Bernd
> --
> Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
>                      LUGA : http://www.luga.at
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
*Regards,
Santosh*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121108/7dcae3d4/attachment.html 


More information about the Kernelnewbies mailing list