Sysfs file system

From LQWiki
Jump to navigation Jump to search

Sysfs is a memory based file system for the linux kernel version 2.6 and up. It provides a means of exporting certain attributes and information (internal kernel data structures) to userspace as normal files/symlinks in directories. It is meant to eventually replace the attributes that are in procfs in previous kernel versions. It shows several directory hierarchies showing the available hardware devices and modules/drivers attributes. It uses a 'one attribute per file' policy, which makes the attributes easier to read, parse and optionally alter. For kernel (module) programmers, it provides a cleaner and easier to use interface to create these files.

udev uses sysfs to get the information it needs about the hardware (and hotplug for the initial creation trigger).

There is also a tool set and library, which provides easy access to the information in sysfs for application programmers.