Check out my first novel, midnight's simulacra!

Sysfs

From dankwiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

sysfs was introduced during the Linux 2.5 development cycle as part of a general overhaul of the device model. It provides a view into kernel kobjects (and sometimes writable controls). According to kernel documentation, "sysfs is always mounted at /sys...other mount points are a system configuration bug" (and /sys/devices is the only hierarchy userspace programs ought use). In general, a kernel object is a sysfs directory, an object attribute is a sysfs file, and a relationship between two objects is a symbolic link.

A sysfs file cannot be larger than the page size. It is worth noting that all sysfs leaves report their size (to the stat(2) system call) to be 4,096 bytes, no matter their actual length. Their true length can be determined only by performing a read(2).

See Also

  • The kernel documentation's "sysfs rules" doc
    • Suggests one shouldn't use libsysfs!
  • The procfs page