As per my knowledge,
In Linux file system, for information communication between user space and kernel space, two kind of virtual file systems are used.
1) Proc file system http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html
2) sysfs file system https://en.wikipedia.org/wiki/Sysfs
In linux kernel code, i see some sub system has used proc
file to perform such userspace-kernelspace communication, and some system has used sysfs files for same concern.
So i just want to know, if i am going to write new linux kernel module or driver then how to choose virtual files ? when should i use sysfs
and when should i use proc
file?
Please let me know if i misunderstood anything here.
The only thing that is coming to my mind regarding adding/modifying entries in procfs is when you play with virtual memory subsystem itself. I'm talking about entries in /proc/sys/vm/ (so if you for some reason modify writeback, overcomit, swap, etc.). If you're writing a driver or a module that is not related to stuff already exported via procfs, you should use sysfs.
After reading much i have below understanding
1) Proc file is the bit of older approaches. It allocates PAGE size memory on each read or write call and this system is over all buggy(Like you are reading/write proc entry of any device and device is removed from system..no handing of this in Proc system..{read it from LDD:) }). So kernel developer community suggest to use SYS file system which is more advance and sophisticated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With