How to choose between sys and proc files in linux kernel

As far as I know,

The Linux file system uses two types of virtual file systems to exchange information between user space and kernel space.

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 the linux kernel code, I see that some subsystem used the file procto perform such an exchange in the user space - kernelspace, and on some system the sysfs files were the same.

So, I just want to know if I am going to write a new module or Linux kernel driver, then how to choose virtual files? when should i use sysfsand when should i use a file proc?

Please let me know if I do not understand something.

+4
source share
2 answers

After reading, I understood below

1) Proc - . PAGE , (, / proc , . Proc.. {read it LDD:)}). SYS, .

0

, / procfs, - . /proc/sys/vm/(, - , , ..). , , procfs, sysfs.

+1

Source: https://habr.com/ru/post/1618883/


All Articles