Hello Santosh and Anand,
Thanks for the reply and very good suggestions.
As Anand Moon suggested http://people.ee.ethz.ch/~arkeller/linux/multi/kernel_user_space_howto-3.html
link in http://lists.kernelnewbies.org/pipermail/kernelnewbies/2012-November/006489.html previous thread,
I read all the kernel to user space communication mechanism ( Except Upcall , ll read it). As of now for my application,
the signals passing from kernel to user space is enough. I was trying the sample code provided in signals section of above link.
1. In the code he used find_task_by_pid_type, but find_task_by_pid_type not available in sched.h. So I have changed it to
find_task_by_vpid(pid), is this right way ?
2. I tried to install the module but it is not finding the symbol, but the symbol is present in /proc/kallsyms.
Anything I am missing while compiling ? as I am getting warning.
I think you are looking for Upcall Functionalityupcall 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@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
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
Regards,
Santosh
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies