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