i am new to linux.
and i recently studied some system analysis tools, such as top and "SYSSTAT" tool set.
i found the main things these things do are open and read files in /proc folder, and grab some numerical data and manipulate them.
so here comes a question, how those files in /proc folder are generated?
for example, let's say "cpuinfo", how these file actually generated??
and in kernel code, which source file actually does the job?
thanks
Check the Linux device driver book
Check page 86 of the Linux device drivers book
thanks. i am studying
thanks. i am studying it.
www.vislab.cn
yes, i have studies it. and
yes, i have studies it. and i believe i get at least a rough understanding of proc file system.
but i just want to know which files of kernel actually generate files such as /proc/cpuinfo and /proc/meminfo for instance.
i hope someone can help me in this.
i try to go through some kernel code. which located around /blabla/linux-2.6.x/fs/proc i believe it is where proc file system are generated. but i did not see any cpuinfo.c or meminfo.c
as per say. each file in proc "ties a function which generates the content of the file on fly". so where can i find this "function" for... such as ... cpuinfo and meminfo
please give guidance for this.
=====
www.vislab.cn
/proc/cpuinfo and /proc/meminfo
For /proc/cpuinfo, the function is show_cpuinfo():
http://lxr.linux.no/source/arch/i386/kernel/cpu/proc.c#L11
For /proc/meminfo, the function is meminfo_read_proc():
http://lxr.linux.no/source/fs/proc/proc_misc.c#L119
thank you.but for these two
thank you.
but for these two function u gave, they only do some print jobs. actually my intention is to get to know, how actually kernel can get to know, for example, the CPU properties, or memory properties of particular system....
thanks.
i hope someone can further enlighten me.
as i read a bit the kernel code. i assume kernel actually applied some assembly code, am i correct?
thank you
==============
www.vislab.cn