LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   How to share data b/w user space and kernel space (http://www.linuxquestions.org/questions/linux-kernel-70/how-to-share-data-b-w-user-space-and-kernel-space-505481/)

nandac 11-28-2006 02:35 AM

How to share data b/w user space and kernel space
 
Hi All,
I am new to kernel programmming.

I have to share some huge data structures b/w user space application and kernel module. What are all options available to be for this.

I would like to avoid the duplication of data in userspace and kernel space.

Can ,by some mean,can I acess data structures defined in user space, in my kernel module.

thanks in advance
nandac

sundialsvcs 11-28-2006 10:15 PM

"Huge?" That's rather an unusual thing to say about kernel memory.

Kernel-level code can access memory in userspace by any one of several mechanisms.

Perhaps if you explained in more detail what it is you are proposing to do?

Probably the most common mechanism is to set up a virtual device, which the user-side application can talk to.

Perhaps the user-side application that actually talks to the kernel device is itself a "root" (or a specific, non-root userid) daemon that is the one that's mainly responsible for providing services to other user-side applications, employing the kernel device as part of its means for doing so.

In your kernel-side code, you definitely want to avoid duplication of data .. and you must be careful not to blindly trust the addresses provided by any user-side code. Usually, the actual programming that's on the kernel side is quite small and specialized: it's on the kernel side only because it cannot be anywhere else.


All times are GMT -5. The time now is 12:00 AM.