2009-07-27 09:42:57     Read or write in into procfs from kernel

Document created by Aaronwu Employee on Aug 16, 2013
Version 1Show Document
  • View in full screen mode

2009-07-27 09:42:57     Read or write in into procfs from kernel

Sheik ibrahim (KUWAIT)

Message: 78089   

 

Hi,

 

how can we read and write the data in to procfs filesystem from kernel?

 

is there any APIs available?

 

please give your suggestions.

 

 

 

-Ibrahim

QuoteReplyEditDelete

 

 

2009-07-27 10:39:12     Re: Read or write in into procfs from kernel

Robin Getz (UNITED STATES)

Message: 78095   

 

Ibrahim:

 

If you are trying to do that - it is unlikely that is the correct way to do what you are trying to do.

 

What are you trying to do?

 

-Robin

QuoteReplyEditDelete

 

 

2009-07-27 11:11:25     Re: Read or write in into procfs from kernel

Sheik ibrahim (KUWAIT)

Message: 78096   

 

Hi Robin,

 

Actually i need to write the data from kernel into procfs file and read the same from the userspace..

QuoteReplyEditDelete

 

 

2009-07-27 11:16:11     Re: Read or write in into procfs from kernel

Robin Getz (UNITED STATES)

Message: 78097   

 

Ibrahim:

 

You are writing a driver, and want to provide data to userspace?

QuoteReplyEditDelete

 

 

2009-07-27 23:48:32     Re: Read or write in into procfs from kernel

Sheik ibrahim (KUWAIT)

Message: 78106   

 

Hi Robin,

 

yes..i need to send data to userspace from my driver...

QuoteReplyEditDelete

 

 

2009-07-28 00:37:29     Re: Read or write in into procfs from kernel

Mike Frysinger (UNITED STATES)

Message: 78108   

 

then use a char driver like normal and implement read()/write() functions

QuoteReplyEditDelete

 

 

2009-07-28 01:07:12     Re: Read or write in into procfs from kernel

Sheik ibrahim (KUWAIT)

Message: 78109   

 

Hi Mike,

 

In my application the user is waiting for kernel data..but in char driver userspace has to read the data from kernel..instead of that kernel has to send the data to user.

 

please suggest which communication protocal we can use ?

 

 

 

-ibrahim

QuoteReplyEditDelete

 

 

2009-07-28 07:07:00     Re: Read or write in into procfs from kernel

Robin Getz (UNITED STATES)

Message: 78113   

 

Ibrahim:

 

Like Mike said - use a char driver read/write function. They are the standard way of doing what you want. You can make your char driver be blocking or non-blocking - whatever you want.

 

-Robin

QuoteReplyEditDelete

 

 

2009-07-28 12:16:12     Re: Read or write in into procfs from kernel

Sheik ibrahim (KUWAIT)

Message: 78119   

 

Hi Robin,

 

Thank you for your suggestion..

 

can we make it as blocking by while loop or any other way?

 

please provide your suggestions.

 

 

 

-Ibrahim

QuoteReplyEditDelete

 

 

2009-07-28 14:54:51     Re: Read or write in into procfs from kernel

Robin Getz (UNITED STATES)

Message: 78121   

 

ibrahim:

 

You want to have userspace do a x = read(dev, buf, 1024); and not return until the kernel actually passes the correct amount of data? or something else?

QuoteReplyEditDelete

 

 

2009-07-29 09:14:50     Re: Read or write in into procfs from kernel

Sheik ibrahim (KUWAIT)

Message: 78163   

 

Hi Robin,

 

Yes..It should not return until the correct amount of data received..

 

 

 

-Ibrahim

QuoteReplyEditDelete

 

 

2009-07-29 13:03:20     Re: Read or write in into procfs from kernel

Robin Getz (UNITED STATES)

Message: 78172   

 

Ibrahim:

 

Then - like Mike said - just use a standard char driver interface - that is the way it works.

 

-Robin

QuoteReplyEditDelete

 

 

2009-08-12 01:06:43     Re: Read or write in into procfs from kernel

Mike Frysinger (UNITED STATES)

Message: 78703   

 

it's much simpler to make a blocking device driver

 

if you need info, try the LDD book -- it covers this stuff completely and is free

 

  docs.blackfin.uclinux.org/doku.php?id=references_and_pointers

Attachments

    Outcomes