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