Read LDD, there are plenty of examples on using proc interface. <br><br><div class="gmail_quote">On Sun, Feb 5, 2012 at 10:14 PM, Surenkumar Nihalani <span dir="ltr"><<a href="mailto:suren@gatech.edu">suren@gatech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey Daniel,<br>
<br>
Thanks for the quick reply.<br>
<br>
The IBM tutorial helps me writing the function for handling user reads and writes to your corresponding proc file. It doesn't help in terms of opening<br>
and writing from the kernel side.<br>
the example you provided just creates a proc entry. It doesn't tell me how to write to it.<br>
<br>
Please help.<br>
<br>
Thanks,<br>
Suren Nihalani.<br>
<div><div></div><div class="h5"><br>
----- Original Message -----<br>
From: "Daniel Baluta" <<a href="mailto:daniel.baluta@gmail.com">daniel.baluta@gmail.com</a>><br>
To: "Surenkumar Nihalani" <<a href="mailto:suren@gatech.edu">suren@gatech.edu</a>><br>
Cc: <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
Sent: Sunday, February 5, 2012 4:20:28 PM<br>
Subject: Re: How to use /proc<br>
<br>
On Sun, Feb 5, 2012 at 11:07 PM, Surenkumar Nihalani <<a href="mailto:suren@gatech.edu">suren@gatech.edu</a>> wrote:<br>
> Hello Guys,<br>
><br>
> I am CS student trying to write a kernel module as a part of my class<br>
> assignment. I wanted to know, from within kernel, how do I read and write<br>
> data to my proc file?<br>
> I need to store state from last call of my function.<br>
<br>
Hello,<br>
<br>
Have you tried searching on the internet? :D [1].<br>
<br>
Another approach is to see how an existing proc<br>
entry is handled. Look for example at /proc/sched_debug [2].<br>
<br>
thanks,<br>
Daniel.<br>
<br>
[1] <a href="http://www.ibm.com/developerworks/linux/library/l-proc/index.html" target="_blank">http://www.ibm.com/developerworks/linux/library/l-proc/index.html</a><br>
[2] <a href="http://lxr.linux.no/linux+v3.2.4/kernel/sched_debug.c#L393" target="_blank">http://lxr.linux.no/linux+v3.2.4/kernel/sched_debug.c#L393</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br>