public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 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

* Re: Kernel / Userspace Data Transfer
  2004-03-29  2:47 Kernel / Userspace Data Transfer lml
@ 2004-03-29  3:37 ` Karim Yaghmour
  2004-03-29  9:45   ` Pavel Mironchik
  0 siblings, 1 reply; 7+ messages in thread
From: Karim Yaghmour @ 2004-03-29  3:37 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?

relayfs has been designed with this type of requirements in mind:
http://www.opersys.com/relayfs/index.html

Karim
-- 
Author, Speaker, Developer, Consultant
Pushing Embedded and Real-Time Linux Systems Beyond the Limits
http://www.opersys.com || karim@opersys.com || 1-866-677-4546


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

* 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:45   ` Pavel Mironchik
@ 2004-03-29  9:09     ` Emmanuel Fleury
  2004-03-29 14:29     ` Karim Yaghmour
  1 sibling, 0 replies; 7+ messages in thread
From: Emmanuel Fleury @ 2004-03-29  9:09 UTC (permalink / raw)
  To: linux-kernel

On Mon, 2004-03-29 at 11:45, Pavel Mironchik wrote:
> The best Userspace-kernelspace-Userspace transfer thing is soket.
> Unix or TCP/UDP sockets API is avaible from kernel space.
> You should use it...

Do you mean Netlink ?

Regards
-- 
Emmanuel Fleury

Computer Science Department, |  Office: B1-201
Aalborg University,          |  Phone:  +45 96 35 72 23
Fredriks Bajersvej 7E,       |  Fax:    +45 98 15 98 89
9220 Aalborg East, Denmark   |  Email:  fleury@cs.auc.dk


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

* Re: Kernel / Userspace Data Transfer
  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
  0 siblings, 2 replies; 7+ messages in thread
From: Pavel Mironchik @ 2004-03-29  9:45 UTC (permalink / raw)
  To: karim; +Cc: linux-kernel

The best Userspace-kernelspace-Userspace transfer thing is soket.
Unix or TCP/UDP sockets API is avaible from kernel space.
You should use it...

Pavel Mironchik


On Sun, 28 Mar 2004 22:37:23 -0500
Karim Yaghmour <karim@opersys.com> wrote:

> 
> 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?
> 
> relayfs has been designed with this type of requirements in mind:
> http://www.opersys.com/relayfs/index.html
> 
> Karim
> -- 
> Author, Speaker, Developer, Consultant
> Pushing Embedded and Real-Time Linux Systems Beyond the Limits
> http://www.opersys.com || karim@opersys.com || 1-866-677-4546
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ 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

* Re: Kernel / Userspace Data Transfer
  2004-03-29  9:45   ` Pavel Mironchik
  2004-03-29  9:09     ` Emmanuel Fleury
@ 2004-03-29 14:29     ` Karim Yaghmour
  1 sibling, 0 replies; 7+ messages in thread
From: Karim Yaghmour @ 2004-03-29 14:29 UTC (permalink / raw)
  To: Pavel Mironchik; +Cc: linux-kernel


Pavel Mironchik wrote:
> The best Userspace-kernelspace-Userspace transfer thing is soket.
> Unix or TCP/UDP sockets API is avaible from kernel space.
> You should use it...

Sockets suck for the kind of application relayfs is used for. Try
running LTT on sockets, for example, and let me know what type of
performance you get. For simple transfers, maybe, but for real
high-speed, large scale data transfers, sockets just don't cut it.
That's where relayfs is most useful.

Karim
-- 
Author, Speaker, Developer, Consultant
Pushing Embedded and Real-Time Linux Systems Beyond the Limits
http://www.opersys.com || karim@opersys.com || 1-866-677-4546


^ 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  2:47 Kernel / Userspace Data Transfer 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
  -- strict thread matches above, loose matches on Subject: below --
2004-03-29  4:57 Ross Dickson
2004-03-29  9:50 tigran

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