Communicate between kernel and user space
Hello Everyone,
I am newbie in Linux and also with c language, but i am working on a project. so i have to do it :( I am unknown of making communication between kernel module and user space.. I have got a kernel module, and implemented some of my scenarios. * If any network card fails then i get the notification (This is working for kernel module) Here is a snapshot for kernel module where i am able to get the process id: Quote:
Now i have to do some tasks and i have no idea about this: 1. I need to transfer that information (for which i got the process id) to Userspace 2. After receiving the information on userspace i will transmit that information on to the user space of the other NODE via TCP/IP or UDP/IP. Any suggestions or any example resembling to this scenario will be very much help full for me.. Thank you for your time in advance.. Sindhu |
So you are not familiar with linux, with c and with kernel.
Just a hint: the kernel cannot communicate itself with the userspace, but a userspace program can ask the kernel to provide some information. So you need to write a c program which will use this kernel module to get info. |
Thank you pan64.. Not so much familiar with that kind of programming, can you please provide me some example?
|
i guess kill_proc() is the function which can share the pid
Quote:
---------- Post added 05-06-12 at 06:19 PM ---------- Any example will be really a good help if you can share.. |
here is an example: http://www.ibm.com/developerworks/li...-system-calls/
You have your own kernel module, you just need to look at the part related to syscall |
Thank you pan6. It seems helpful.. :)
|
Quote:
"copy_to_user" provided in the "kernel API documentation". |
Quote:
I actually developed further a userspace daemon also. Here is my another post about that, with lots of confusion to communicate betweeen userspace and kernel using signals: http://www.linuxquestions.org/questi...kernel-943991/ I am not a good programmer of C and also not so much familiar with Linux programming. everything there is new for me, i have just assigned a task by my professor which i am trying to complete. Make me correct if i am creating wrong code also try to make it complete or give me some related example: Quote:
Quote:
May be my all discussion is not so much technical, or there you can find many mistakes in code. But pardon me I am not a technical person with this kind of stuff.. If any sample code or suggestions you have then I will be happy to hear that.. |
the signal handler is part of the user space code. The kernel only sends the signal to the process, but it is handled by the process itself.
kill_proc will send a signal and you need to implement a signal handler to catch it. see here: http://www.gnu.org/software/libc/man...-Handling.html (and defining handlers) |
All times are GMT -5. The time now is 02:35 PM. |