how to add file to /proc
hatem gamal elzanaty
hatem at softpro.bz
Mon Jun 6 01:15:29 MDT 2011
Byron Clark wrote:
> On 06/05/11 at 08:35am, hatem gamal elzanaty wrote:
>> Byron Clark wrote:
>>> On 06/05/11 at 04:41am, hatem gamal elzanaty wrote:
>>>> i have a problem to add a file to /proc does there is a simple
>>>> way or even a how to program syntax to do so the system reject
>>>> to enter the file i need to enter into the /proc file can any
>>>> one tell me how to do it or direct me to a how to a free method
>>>> that is simple and accurate
>>> Creating a file in /proc is going to require a kernel module or a
>>> patched kernel. Chapter four of _Linux Device Drivers_ describes
>>> how to create a file in /proc.
>>> That said, it's no longer considered good form to add anything to /proc.
>>> The new home for this information is the /sys filesystem or debugfs.
>>> LWN has a quick guide for using debugfs.
>>>  https://lwn.net/images/pdf/LDD3/ch04.pdf
>>>  https://lwn.net/Kernel/LDD3/
>>>  https://lwn.net/Articles/334546/
>> thanks for your reply but i have no straight forward how to in steps
>> or in how to compile or run that is why i'm warring of carshing the
>> in the link below
>> i get those errors and i don't konw what is the cause here is how i compile
>> export srcf="/data/hatem/work/c/project/learning/source/010"
>> export objf="/data/hatem/work/c/project/learning/object/010"
>> cd $srcf
>> gcc -g -o proc.bin proc.c
>> mv -f ./proc.bin $objf
>> cd $objf
>> am i suppose to change the header files for that to work can you
>> help in that thanks in advance
>> the error message is attached
> I would suggest looking at chapter 2
> (http://tldp.org/LDP/lkmpg/2.6/html/c119.html) from the document where you found
> that example. That chapter contains a simple example that shows you how
> to build a kernel module.
it worked thanks so much but i have another related question
does compiling object .o .ko ... equal compiling with gcc or not please
thanks in advance
More information about the PLUG