public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Kernel / Userspace Data Transfer
@ 2004-03-29  4:57 Ross Dickson
  0 siblings, 0 replies; 7+ messages in thread
From: Ross Dickson @ 2004-03-29  4:57 UTC (permalink / raw)
  To: lml; +Cc: linux-kernel

lml@beonline.com.au wrote: 
 > I have a set of counters in a Kernel module that i want to export to a 
 > userspace application. I originally decided to use a /proc entry and parse 
 > the output whenever the userspace application needed this data, however, 
 > i need more than the 4096 that is allowed in /proc and i'm not too keen 
 > on parsing large chunks of text anyway. 
 > 
 > What i would like to do is copy these slabs of text from the kernel to my 
 > userspace application (whenever the application requests it). I've seen the 
 > 'copy_to_user' function and it looks usefull, but have no idea where to start 
 > or how to use it :-/ 
 > 
 > Can someone provide and example or point me in the right direction? Or is there 
 > a better place to ask this question? 
 
Here is a good starter on-line reference
http://www.faqs.org/docs/kernel/
Relevant page
http://www.faqs.org/docs/kernel/x848.html
or as pdf
http://www.tldp.org/LDP/lkmpg/lkmpg.pdf

There is also mbuff that maps shared memory between kernel and user space.
It is pretty easy to use.
http://sourceforge.net/projects/mbuff/

Regards
Ross.

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Kernel / Userspace Data Transfer
@ 2004-03-29  9:50 tigran
  0 siblings, 0 replies; 7+ messages in thread
From: tigran @ 2004-03-29  9:50 UTC (permalink / raw)
  To: lml; +Cc: linux-kernel

Hello,

One possible solution is to use seq_file API for a /proc file.
I have written a process/system monitor using this method which is about 100
times faster than reading various bits and pieces from /proc by a user application,
so a kernel module is well worth having in this respect. Unfortunately, this software
is not under GPL, but if you do want more information I can send you (or upload
somewhere) a stripped down version which just shows how to use the API
most efficiently and safely.

Kind regards
Tigran
Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a month 
www.freeserve.com/anytime

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Kernel / Userspace Data Transfer
@ 2004-03-29  2:47 lml
  2004-03-29  3:37 ` Karim Yaghmour
  0 siblings, 1 reply; 7+ messages in thread
From: lml @ 2004-03-29  2:47 UTC (permalink / raw)
  To: linux-kernel

Hello,

I have a set of counters in a Kernel module that i want to export to a
userspace application. I originally decided to use a /proc entry and parse
the output whenever the userspace application needed this data, however,
i need more than the 4096 that is allowed in /proc and i'm not too keen
on parsing large chunks of text anyway.

What i would like to do is copy these slabs of text from the kernel to my
userspace application (whenever the application requests it). I've seen the
'copy_to_user' function and it looks usefull, but have no idea where to start
or how to use it :-/

Can someone provide and example or point me in the right direction? Or is there
a better place to ask this question?

Regards
-J

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-03-29 14:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-29  4:57 Kernel / Userspace Data Transfer Ross Dickson
  -- strict thread matches above, loose matches on Subject: below --
2004-03-29  9:50 tigran
2004-03-29  2:47 lml
2004-03-29  3:37 ` Karim Yaghmour
2004-03-29  9:45   ` Pavel Mironchik
2004-03-29  9:09     ` Emmanuel Fleury
2004-03-29 14:29     ` Karim Yaghmour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox