Passing data from kernel mode to user mode

Passing data from kernel mode to user mode

Post by Luca » Thu, 23 Jan 2003 19:11:02



Hi all,

I have a kernel module that receive IP datagram, using netfilter that
pass the datagram to my module.
The kernel module execute some operation and I have the necessity to
pass the results (a string of char essentially) to an application
(user-mode).
How I can make? There is someone that has an example of such type of
passage of data?

I have realized the contrary passage (from user-mode to kernel)
registering a sys_call to a function that is implementes in my kernel
module.
There are other mechanisms that make both passages?

 
 
 

Passing data from kernel mode to user mode

Post by Burton Samogra » Fri, 24 Jan 2003 03:01:46


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Quote:> Hi all,

> I have a kernel module that receive IP datagram, using netfilter that
> pass the datagram to my module.
> The kernel module execute some operation and I have the necessity to
> pass the results (a string of char essentially) to an application
> (user-mode).

Try looking at the raw driver, which implements a zero copy device
which you can use to pass data to user mode.

- --
burton samograd

http://kruhftwerk.dydns.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+Ls6zLq/0KC7fYbURAinDAJ4/U+U/RrReZxM8BVN5HmBjLBrv5gCgkb/u
vEAfGK76euvKno5neOfqbW8=
=+f6X
-----END PGP SIGNATURE-----

 
 
 

Passing data from kernel mode to user mode

Post by Lew Pitche » Sat, 25 Jan 2003 13:17:14



> Hi all,

> I have a kernel module that receive IP datagram, using netfilter that
> pass the datagram to my module.
> The kernel module execute some operation and I have the necessity to
> pass the results (a string of char essentially) to an application
> (user-mode).
> How I can make? There is someone that has an example of such type of
> passage of data?

The usual paradyme for kernel-to-user space data movement is the user-space
initiated open(2) / read(2) sequence.

Quote:> I have realized the contrary passage (from user-mode to kernel)
> registering a sys_call to a function that is implementes in my kernel
> module.

Why? Isn't open(2) / write(2) good enough?

Quote:> There are other mechanisms that make both passages?

Yes. open(2) / read(2) / write(2) / close(2)

--
Lew Pitcher

Master Codewright and JOAT-in-training
Registered (Slackware) Linux User #112576 (http://counter.li.org/)

 
 
 

Passing data from kernel mode to user mode

Post by Burton Samogra » Sun, 26 Jan 2003 04:02:24


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Quote:>> I have realized the contrary passage (from user-mode to kernel)
>> registering a sys_call to a function that is implementes in my kernel
>> module.

> Why? Isn't open(2) / write(2) good enough?

Maybe he wants zero copy data transfer.

- --
burton samograd

http://kruhftwerk.dydns.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+MYNrLq/0KC7fYbURAqDYAKCWLuU3lGc9xLvG7KXpkcs6EVLXsgCfWJdl
0hedqIERpqbcAa0+I7mdvoo=
=unRs
-----END PGP SIGNATURE-----

 
 
 

1. kernel mode to user mode overhead

Does anyone have real world measure mentregarding the cost of making user to
kernel
mode transition? I am evaluating the possibility of porting some of the
fucntion into an FPGA
and would like to assess the performance of speed up from the hardware
implemenation.

Are there any reference out there?

Thanks,

Jimmy

2. Why Initial telnet process to linux host run very slow???

3. kernel mode and user mode comunication

4. Why difference between du and df commands

5. Kernel mode vs user mode

6. Runtime Issue

7. Kernel mode to User Mode

8. Samba : Which version am I using???

9. Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

10. Kernel -> user mode data tranfer ????

11. Raw mode data stream pass the /dev/ttyS0 corrupt

12. User login hangs in graphical mode, not text mode

13. Can't boot into single user mode OR multiuser mode!