Sysfs
在 linux 里,sysfs 和 procfs 都是没有存储介质的虚拟文件系统,用于内核与用户态的交互。以下是摘自《Professional Linux Kernel Architecture》的一段话,对两者在概念上的区别进行了描述。
Sysfs is one particularly important example of another virtual filesystem that serves a similar purpose to procfs on the one hand, but is rather different on the other hand. Sysfs is, per convention, always mounted at /sys, but there is nothing that would prevent including it in other places. It was designed to export information from the kernel into userland at a highly structured level. In contrast to procfs, it was not designed for direct human use because the information is deeply and hierarchically nested. Additionally, the files do not always contain information in ASCII text form, but may well use unreadable binary strings. The filesystem is, however, very useful for tools that want to gather detailed information about the hardware present in a system and the topological connection between the devices.
简单来说就是: