LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sending data from kernel to user space (https://www.linuxquestions.org/questions/linux-newbie-8/sending-data-from-kernel-to-user-space-4175456384/)

ratbat 04-01-2013 10:31 AM

Sending data from kernel to user space
 
What is the simplest way to send data from kernel to user-space?
Is it possible to use the read system call in the user space program?
If yes, please explain how to do so.

Thanks!!

PrinceCruise 04-01-2013 11:57 AM

Hi,
What are you exactly trying to achieve? May be these system calls are what you looking for:-

Quote:

copy_to_user() and copy_from_user()
You'll get a ton load of information on this in web.

Regards.

ratbat 04-02-2013 01:51 AM

Hi,
Thanks for your help!

I want the user to read data only when something is written by the kernel module. Is it possible to achieve this kind of synchronisation between the user-space program and the kernel module?

PrinceCruise 04-02-2013 02:33 AM

Well, that's possible and that's exactly where I'd use the above mentioned system calls. In the kernel module, in the reader part, use the call copy_to_user() and in the writer, use copy_from_user().

Regards.


All times are GMT -5. The time now is 09:10 PM.