]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man5/sysfs.5
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man5 / sysfs.5
CommitLineData
46841ace
MK
1.\" Copyright (c) 2017 by Michael Kerrisk <mtk.manpages@gmail.com>
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
46841ace 4.\"
4c1c5274 5.TH sysfs 5 (date) "Linux man-pages (unreleased)"
46841ace
MK
6.SH NAME
7sysfs \- a filesystem for exporting kernel objects
8.SH DESCRIPTION
9The
10.B sysfs
11filesystem is a pseudo-filesystem which provides an interface to
12kernel data structures.
13(More precisely, the files and directories in
14.B sysfs
15provide a view of the
1ae6b2c7 16.I kobject
46841ace
MK
17structures defined internally within the kernel.)
18The files under
19.B sysfs
20provide information about devices, kernel modules, filesystems,
21and other kernel components.
22.PP
23The
24.B sysfs
25filesystem is commonly mounted at
26.IR /sys .
27Typically, it is mounted automatically by the system,
28but it can also be mounted manually using a command such as:
29.PP
30.in +4n
31.EX
32mount \-t sysfs sysfs /sys
33.EE
34.in
35.PP
36Many of the files in the
37.B sysfs
38filesystem are read-only,
39but some files are writable, allowing kernel variables to be changed.
6df684e0
MK
40To avoid redundancy,
41symbolic links are heavily used to connect entries across the filesystem tree.
46841ace
MK
42.\"
43.SS Files and directories
44The following list describes some of the files and directories under the
45.I /sys
46hierarchy.
47.TP
1ae6b2c7 48.I /sys/block
6df684e0
MK
49This subdirectory contains one symbolic link for each block device
50that has been discovered on the system.
51The symbolic links point to corresponding directories under
52.IR /sys/devices .
46841ace 53.TP
1ae6b2c7 54.I /sys/bus
6df684e0
MK
55This directory contains one subdirectory for each of the bus types
56in the kernel.
57Inside each of these directories are two subdirectories:
58.RS
59.TP
1ae6b2c7 60.I devices
6df684e0 61This subdirectory contains symbolic links to entries in
1ae6b2c7 62.I /sys/devices
6df684e0
MK
63that correspond to the devices discovered on this bus.
64.TP
1ae6b2c7 65.I drivers
6df684e0
MK
66This subdirectory contains one subdirectory for each device driver
67that is loaded on this bus.
68.RE
46841ace 69.TP
1ae6b2c7 70.I /sys/class
6df684e0
MK
71This subdirectory contains a single layer of further subdirectories
72for each of the device classes that have been registered on the system
73(e.g., terminals, network devices, block devices, graphics devices,
74sound devices, and so on).
75Inside each of these subdirectories are symbolic links for each of the
76devices in this class.
77These symbolic links refer to entries in the
1ae6b2c7 78.I /sys/devices
6df684e0 79directory.
46841ace 80.TP
1ae6b2c7 81.I /sys/class/net
85f0310c 82Each of the entries in this directory is a symbolic link
5d9b8ae9 83representing one of the real or virtual networking devices
85f0310c
MK
84that are visible in the network namespace of the process
85that is accessing the directory.
86Each of these symbolic links refers to entries in the
1ae6b2c7 87.I /sys/devices
85f0310c
MK
88directory.
89.TP
1ae6b2c7 90.I /sys/dev
6df684e0 91This directory contains two subdirectories
1ae6b2c7 92.I block/
6df684e0
MK
93and
94.IR char/ ,
95corresponding, respectively,
96to the block and character devices on the system.
97Inside each of these subdirectories are symbolic links with names of the form
e0fe703d 98.IR major-ID : minor-ID ,
6df684e0
MK
99where the ID values correspond to the major and minor ID of a specific device.
100Each symbolic link points to the
101.B sysfs
102directory for a device.
103The symbolic links inside
1ae6b2c7 104.I /sys/dev
6df684e0
MK
105thus provide an easy way to look up the
106.B sysfs
107interface using the device IDs returned by a call to
108.BR stat (2)
109(or similar).
110.IP
111The following shell session shows an example from
112.IR /sys/dev :
113.IP
114.in +4n
115.EX
116$ \fBstat \-c "%t %T" /dev/null\fP
1171 3
d1a71985 118$ \fBreadlink /sys/dev/char/1\e:3\fP
6df684e0
MK
119\&../../devices/virtual/mem/null
120$ \fBls \-Fd /sys/devices/virtual/mem/null\fP
121/sys/devices/virtual/mem/null/
122$ \fBls \-d1 /sys/devices/virtual/mem/null/*\fP
123/sys/devices/virtual/mem/null/dev
124/sys/devices/virtual/mem/null/power/
125/sys/devices/virtual/mem/null/subsystem@
126/sys/devices/virtual/mem/null/uevent
127.EE
128.in
46841ace 129.TP
1ae6b2c7 130.I /sys/devices
6df684e0
MK
131This is a directory that contains a filesystem representation of
132the kernel device tree,
133which is a hierarchy of
134.I device
135structures within the kernel.
46841ace 136.TP
1ae6b2c7 137.I /sys/firmware
6df684e0
MK
138This subdirectory contains interfaces for viewing and manipulating
139firmware-specific objects and attributes.
46841ace 140.TP
1ae6b2c7 141.I /sys/fs
6df684e0
MK
142This directory contains subdirectories for some filesystems.
143A filesystem will have a subdirectory here only if it chose
144to explicitly create the subdirectory.
46841ace 145.TP
1ae6b2c7 146.I /sys/fs/cgroup
46841ace
MK
147This directory conventionally is used as a mount point for a
148.BR tmpfs (5)
149filesystem containing mount points for
150.BR cgroups (7)
151filesystems.
152.TP
1ae6b2c7 153.I /sys/fs/smackfs
8f8b643d
MK
154The directory contains configuration files for the SMACK LSM.
155See the kernel source file
b49c2acb 156.IR Documentation/admin\-guide/LSM/Smack.rst .
8f8b643d 157.TP
1ae6b2c7 158.I /sys/hypervisor
6df684e0 159[To be documented]
46841ace 160.TP
1ae6b2c7 161.I /sys/kernel
59514c56
MK
162This subdirectory contains various files and subdirectories that provide
163information about the running kernel.
46841ace 164.TP
1ae6b2c7 165.I /sys/kernel/cgroup/
475ceab1
MK
166For information about the files in this directory, see
167.BR cgroups (7).
168.TP
1ae6b2c7 169.I /sys/kernel/debug/tracing
d8a21977
MK
170Mount point for the
171.I tracefs
172filesystem used by the kernel's
173.I ftrace
174facility.
175(For information on
176.IR ftrace ,
177see the kernel source file
178.IR Documentation/trace/ftrace.txt .)
179.TP
1ae6b2c7 180.I /sys/kernel/mm
cf4a2cfb
MK
181This subdirectory contains various files and subdirectories that provide
182information about the kernel's memory management subsystem.
183.TP
1ae6b2c7 184.I /sys/kernel/mm/hugepages
db419c96
MK
185This subdirectory contains one subdirectory for each of the
186huge page sizes that the system supports.
187The subdirectory name indicates the huge page size (e.g.,
cd415e73 188.IR hugepages\-2048kB ).
e8b9e9a2 189Within each of these subdirectories is a set of files
db419c96
MK
190that can be used to view and (in some cases) change settings
191associated with that huge page size.
192For further information, see the kernel source file
b49c2acb 193.IR Documentation/admin\-guide/mm/hugetlbpage.rst .
db419c96 194.TP
1ae6b2c7 195.I /sys/module
6df684e0
MK
196This subdirectory contains one subdirectory
197for each module that is loaded into the kernel.
198The name of each directory is the name of the module.
199In each of the subdirectories, there may be following files:
200.RS
201.TP
202.I coresize
203[to be documented]
204.TP
205.I initsize
206[to be documented]
207.TP
208.I initstate
209[to be documented]
210.TP
211.I refcnt
212[to be documented]
213.TP
214.I srcversion
215[to be documented]
216.TP
217.I taint
218[to be documented]
219.TP
220.I uevent
221[to be documented]
222.TP
223.I version
224[to be documented]
225.RE
226.IP
227In each of the subdirectories, there may be following subdirectories:
228.RS
229.TP
230.I drivers
231[To be documented]
232.TP
233.I holders
234[To be documented]
235.TP
236.I notes
237[To be documented]
238.TP
239.I parameters
240This directory contains one file for each module parameter,
241with each file containing the value of the corresponding parameter.
e0fe703d 242Some of these files are writable, allowing the
6df684e0
MK
243.TP
244.I sections
245This subdirectories contains files with information about module sections.
246This information is mainly used for debugging.
247.TP
248.I
249[To be documented]
250.RE
46841ace 251.TP
1ae6b2c7 252.I /sys/power
6df684e0 253[To be documented]
46841ace
MK
254.SH VERSIONS
255The
256.B sysfs
257filesystem first appeared in Linux 2.6.0.
3113c7f3 258.SH STANDARDS
46841ace
MK
259The
260.B sysfs
261filesystem is Linux-specific.
262.SH NOTES
263This manual page is incomplete, possibly inaccurate, and is the kind
264of thing that needs to be updated very often.
265.SH SEE ALSO
266.BR proc (5),
267.BR udev (7)
268.PP
8fb01fde 269P.\& Mochel. (2005).
6df684e0
MK
270.IR "The sysfs filesystem" .
271Proceedings of the 2005 Ottawa Linux Symposium.
272.\" https://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf
273.PP
46841ace
MK
274The kernel source file
275.I Documentation/filesystems/sysfs.txt
276and various other files in
1ae6b2c7 277.I Documentation/ABI
46841ace 278and
1ae6b2c7 279.I Documentation/*/sysfs.txt