420 lines
9.4 KiB
HTML
420 lines
9.4 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SYSFS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SYSFS</H1>
|
|
Section: Linux Programmer's Manual (5)<BR>Updated: 2018-04-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sysfs - a filesystem for exporting kernel objects
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>sysfs</B>
|
|
|
|
filesystem is a pseudo-filesystem which provides an interface to
|
|
kernel data structures.
|
|
(More precisely, the files and directories in
|
|
<B>sysfs</B>
|
|
|
|
provide a view of the
|
|
<I>kobject</I>
|
|
|
|
structures defined internally within the kernel.)
|
|
The files under
|
|
<B>sysfs</B>
|
|
|
|
provide information about devices, kernel modules, filesystems,
|
|
and other kernel components.
|
|
<P>
|
|
|
|
The
|
|
<B>sysfs</B>
|
|
|
|
filesystem is commonly mounted at
|
|
<I>/sys</I>.
|
|
|
|
Typically, it is mounted automatically by the system,
|
|
but it can also be mounted manually using a command such as:
|
|
<P>
|
|
|
|
|
|
|
|
mount -t sysfs sysfs /sys
|
|
|
|
|
|
<P>
|
|
|
|
Many of the files in the
|
|
<B>sysfs</B>
|
|
|
|
filesystem are read-only,
|
|
but some files are writable, allowing kernel variables to be changed.
|
|
To avoid redundancy,
|
|
symbolic links are heavily used to connect entries across the filesystem tree.
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H3>Files and directories</H3>
|
|
|
|
The following list describes some of the files and directories under the
|
|
<I>/sys</I>
|
|
|
|
hierarchy.
|
|
<DL COMPACT>
|
|
<DT id="1"><I>/sys/block</I>
|
|
|
|
<DD>
|
|
This subdirectory contains one symbolic link for each block device
|
|
that has been discovered on the system.
|
|
The symbolic links point to corresponding directories under
|
|
<I>/sys/devices</I>.
|
|
|
|
<DT id="2"><I>/sys/bus</I>
|
|
|
|
<DD>
|
|
This directory contains one subdirectory for each of the bus types
|
|
in the kernel.
|
|
Inside each of these directories are two subdirectories:
|
|
<DL COMPACT><DT id="3"><DD>
|
|
<DL COMPACT>
|
|
<DT id="4"><I>devices</I>
|
|
|
|
<DD>
|
|
This subdirectory contains symbolic links to entries in
|
|
<I>/sys/devices</I>
|
|
|
|
that correspond to the devices discovered on this bus.
|
|
<DT id="5"><I>drivers</I>
|
|
|
|
<DD>
|
|
This subdirectory contains one subdirectory for each device driver
|
|
that is loaded on this bus.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="6"><I>/sys/class</I>
|
|
|
|
<DD>
|
|
This subdirectory contains a single layer of further subdirectories
|
|
for each of the device classes that have been registered on the system
|
|
(e.g., terminals, network devices, block devices, graphics devices,
|
|
sound devices, and so on).
|
|
Inside each of these subdirectories are symbolic links for each of the
|
|
devices in this class.
|
|
These symbolic links refer to entries in the
|
|
<I>/sys/devices</I>
|
|
|
|
directory.
|
|
<DT id="7"><I>/sys/class/net</I>
|
|
|
|
<DD>
|
|
Each of the entries in this directory is a symbolic link
|
|
representing one of the real or virtual networking devices
|
|
that are visible in the network namespace of the process
|
|
that is accessing the directory.
|
|
Each of these symbolic links refers to entries in the
|
|
<I>/sys/devices</I>
|
|
|
|
directory.
|
|
<DT id="8"><I>/sys/dev</I>
|
|
|
|
<DD>
|
|
This directory contains two subdirectories
|
|
<I>block</I>/
|
|
|
|
and
|
|
<I>char/</I>,
|
|
|
|
corresponding, respectively,
|
|
to the block and character devices on the system.
|
|
Inside each of these subdirectories are symbolic links with names of the form
|
|
<I>major-ID</I>:<I>minor-ID</I>,
|
|
|
|
where the ID values correspond to the major and minor ID of a specific device.
|
|
Each symbolic link points to the
|
|
<B>sysfs</B>
|
|
|
|
directory for a device.
|
|
The symbolic links inside
|
|
<I>/sys/dev</I>
|
|
|
|
thus provide an easy way to look up the
|
|
<B>sysfs</B>
|
|
|
|
interface using the device IDs returned by a call to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+stat">stat</A></B>(2)
|
|
|
|
(or similar).
|
|
<DT id="9"><DD>
|
|
The following shell session shows an example from
|
|
<I>/sys/dev</I>:
|
|
|
|
<DT id="10"><DD>
|
|
|
|
|
|
$ <B>stat -c "%t %T" /dev/null</B>
|
|
1 3
|
|
$ <B>readlink /sys/dev/char/1\:3</B>
|
|
../../devices/virtual/mem/null
|
|
$ <B>ls -Fd /sys/devices/virtual/mem/null</B>
|
|
/sys/devices/virtual/mem/null/
|
|
$ <B>ls -d1 /sys/devices/virtual/mem/null/*</B>
|
|
/sys/devices/virtual/mem/null/dev
|
|
/sys/devices/virtual/mem/null/power/
|
|
/sys/devices/virtual/mem/null/subsystem@
|
|
/sys/devices/virtual/mem/null/uevent
|
|
|
|
|
|
<DT id="11"><I>/sys/devices</I>
|
|
|
|
<DD>
|
|
This is a directory that contains a filesystem representation of
|
|
the kernel device tree,
|
|
which is a hierarchy of
|
|
<I>device</I>
|
|
|
|
structures within the kernel.
|
|
<DT id="12"><I>/sys/firmware</I>
|
|
|
|
<DD>
|
|
This subdirectory contains interfaces for viewing and manipulating
|
|
firmware-specific objects and attributes.
|
|
<DT id="13"><I>/sys/fs</I>
|
|
|
|
<DD>
|
|
This directory contains subdirectories for some filesystems.
|
|
A filesystem will have a subdirectory here only if it chose
|
|
to explicitly create the subdirectory.
|
|
<DT id="14"><I>/sys/fs/cgroup</I>
|
|
|
|
<DD>
|
|
This directory conventionally is used as a mount point for a
|
|
<B><A HREF="/cgi-bin/man/man2html?5+tmpfs">tmpfs</A></B>(5)
|
|
|
|
filesystem containing mount points for
|
|
<B><A HREF="/cgi-bin/man/man2html?7+cgroups">cgroups</A></B>(7)
|
|
|
|
filesystems.
|
|
<DT id="15"><I>/sys/fs/smackfs</I>
|
|
|
|
<DD>
|
|
The directory contains configuration files for the SMACK LSM.
|
|
See the kernel source file
|
|
<I>Documentation/admin-guide/LSM/Smack.rst</I>.
|
|
|
|
<DT id="16"><I>/sys/hypervisor</I>
|
|
|
|
<DD>
|
|
[To be documented]
|
|
<DT id="17"><I>/sys/kernel</I>
|
|
|
|
<DD>
|
|
This subdirectory contains various files and subdirectories that provide
|
|
information about the running kernel.
|
|
<DT id="18"><I>/sys/kernel/cgroup/</I>
|
|
|
|
<DD>
|
|
For information about the files in this directory, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+cgroups">cgroups</A></B>(7).
|
|
|
|
<DT id="19"><I>/sys/kernel/debug/tracing</I>
|
|
|
|
<DD>
|
|
Mount point for the
|
|
<I>tracefs</I>
|
|
|
|
filesystem used by the kernel's
|
|
<I>ftrace</I>
|
|
|
|
facility.
|
|
(For information on
|
|
<I>ftrace</I>,
|
|
|
|
see the kernel source file
|
|
<I>Documentation/trace/ftrace.txt</I>.)
|
|
|
|
<DT id="20"><I>/sys/kernel/mm</I>
|
|
|
|
<DD>
|
|
This subdirectory contains various files and subdirectories that provide
|
|
information about the kernel's memory management subsystem.
|
|
<DT id="21"><I>/sys/kernel/mm/hugepages</I>
|
|
|
|
<DD>
|
|
This subdirectory contains one subdirectory for each of the
|
|
huge page sizes that the system supports.
|
|
The subdirectory name indicates the huge page size (e.g.,
|
|
<I>hugepages-2048kB</I>).
|
|
|
|
Within each of these subdirectories is a set of files
|
|
that can be used to view and (in some cases) change settings
|
|
associated with that huge page size.
|
|
For further information, see the kernel source file
|
|
<I>Documentation/admin-guide/mm/hugetlbpage.rst</I>.
|
|
|
|
<DT id="22"><I>/sys/module</I>
|
|
|
|
<DD>
|
|
This subdirectory contains one subdirectory
|
|
for each module that is loaded into the kernel.
|
|
The name of each directory is the name of the module.
|
|
In each of the subdirectories, there may be following files:
|
|
<DL COMPACT><DT id="23"><DD>
|
|
<DL COMPACT>
|
|
<DT id="24"><I>coresize</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
<DT id="25"><I>initsize</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
<DT id="26"><I>initstate</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
<DT id="27"><I>refcnt</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
<DT id="28"><I>srcversion</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
<DT id="29"><I>taint</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
<DT id="30"><I>uevent</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
<DT id="31"><I>version</I>
|
|
|
|
<DD>
|
|
[to be documented]
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="32"><DD>
|
|
In each of the subdirectories, there may be following subdirectories:
|
|
<DL COMPACT><DT id="33"><DD>
|
|
<DL COMPACT>
|
|
<DT id="34"><I>drivers</I>
|
|
|
|
<DD>
|
|
[To be documented]
|
|
<DT id="35"><I>holders</I>
|
|
|
|
<DD>
|
|
[To be documented]
|
|
<DT id="36"><I>notes</I>
|
|
|
|
<DD>
|
|
[To be documented]
|
|
<DT id="37"><I>parameters</I>
|
|
|
|
<DD>
|
|
This directory contains one file for each module parameter,
|
|
with each file containing the value of the corresponding parameter.
|
|
Some of these files are writable, allowing the
|
|
<DT id="38"><I>sections</I>
|
|
|
|
<DD>
|
|
This subdirectories contains files with information about module sections.
|
|
This information is mainly used for debugging.
|
|
<DT id="39"><I>[To be documented]</I>
|
|
|
|
<DD>
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="40"><I>/sys/power</I>
|
|
|
|
<DD>
|
|
[To be documented]
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
The
|
|
<B>sysfs</B>
|
|
|
|
filesystem first appeared in Linux 2.6.0.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
The
|
|
<B>sysfs</B>
|
|
|
|
filesystem is Linux-specific.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
This manual page is incomplete, possibly inaccurate, and is the kind
|
|
of thing that needs to be updated very often.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+proc">proc</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+udev">udev</A></B>(7)
|
|
|
|
<P>
|
|
|
|
P. Mochel. (2005).
|
|
<I>The sysfs filesystem</I>.
|
|
|
|
Proceedings of the 2005 Ottawa Linux Symposium.
|
|
|
|
<P>
|
|
|
|
The kernel source file
|
|
<I>Documentation/filesystems/sysfs.txt</I>
|
|
|
|
and various other files in
|
|
<I>Documentation/ABI</I>
|
|
|
|
and
|
|
<I>Documentation/*/sysfs.txt</I>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="41"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="42"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="43"><A HREF="#lbAD">Files and directories</A><DD>
|
|
</DL>
|
|
<DT id="44"><A HREF="#lbAE">VERSIONS</A><DD>
|
|
<DT id="45"><A HREF="#lbAF">CONFORMING TO</A><DD>
|
|
<DT id="46"><A HREF="#lbAG">NOTES</A><DD>
|
|
<DT id="47"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="48"><A HREF="#lbAI">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:06 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|