Check out my first novel, midnight's simulacra!

Sysfs: Difference between revisions

From dankwiki
No edit summary
No edit summary
 
Line 1: Line 1:
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 <tt>kobject</tt>s (and sometimes writable controls). According to kernel documentation, "sysfs is always mounted at <tt>/sys</tt>...other mount points are a system configuration bug" (and <tt>/sys/devices</tt> 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 <tt>stat(2)</tt> system call) to be 4,096 bytes, no matter their actual length. Their true length can be determined only by performing a <tt>read(2)</tt>.
==See Also==
==See Also==
* The kernel documentation's [http://www.mjmwired.net/kernel/Documentation/sysfs-rules.txt "sysfs rules"] doc
* The kernel documentation's [http://www.mjmwired.net/kernel/Documentation/sysfs-rules.txt "sysfs rules"] doc
** Suggests one shouldn't use libsysfs!
** Suggests one shouldn't use libsysfs!
* The [[procfs]] page
* The [[procfs]] page

Latest revision as of 23:30, 19 February 2021

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