]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man5/sysfs.5
getrlimit.2: Correct information about large limits on 32-bit architectures
[thirdparty/man-pages.git] / man5 / sysfs.5
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 .\"
25 .TH SYSFS 5 2018-04-30 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 sysfs \- a filesystem for exporting kernel objects
28 .SH DESCRIPTION
29 The
30 .B sysfs
31 filesystem is a pseudo-filesystem which provides an interface to
32 kernel data structures.
33 (More precisely, the files and directories in
34 .B sysfs
35 provide a view of the
36 .IR kobject
37 structures defined internally within the kernel.)
38 The files under
39 .B sysfs
40 provide information about devices, kernel modules, filesystems,
41 and other kernel components.
42 .PP
43 The
44 .B sysfs
45 filesystem is commonly mounted at
46 .IR /sys .
47 Typically, it is mounted automatically by the system,
48 but it can also be mounted manually using a command such as:
49 .PP
50 .in +4n
51 .EX
52 mount \-t sysfs sysfs /sys
53 .EE
54 .in
55 .PP
56 Many of the files in the
57 .B sysfs
58 filesystem are read-only,
59 but some files are writable, allowing kernel variables to be changed.
60 To avoid redundancy,
61 symbolic links are heavily used to connect entries across the filesystem tree.
62 .\"
63 .SS Files and directories
64 The following list describes some of the files and directories under the
65 .I /sys
66 hierarchy.
67 .TP
68 .IR /sys/block
69 This subdirectory contains one symbolic link for each block device
70 that has been discovered on the system.
71 The symbolic links point to corresponding directories under
72 .IR /sys/devices .
73 .TP
74 .IR /sys/bus
75 This directory contains one subdirectory for each of the bus types
76 in the kernel.
77 Inside each of these directories are two subdirectories:
78 .RS
79 .TP
80 .IR devices
81 This subdirectory contains symbolic links to entries in
82 .IR /sys/devices
83 that correspond to the devices discovered on this bus.
84 .TP
85 .IR drivers
86 This subdirectory contains one subdirectory for each device driver
87 that is loaded on this bus.
88 .RE
89 .TP
90 .IR /sys/class
91 This subdirectory contains a single layer of further subdirectories
92 for each of the device classes that have been registered on the system
93 (e.g., terminals, network devices, block devices, graphics devices,
94 sound devices, and so on).
95 Inside each of these subdirectories are symbolic links for each of the
96 devices in this class.
97 These symbolic links refer to entries in the
98 .IR /sys/devices
99 directory.
100 .TP
101 .IR /sys/class/net
102 Each of the entries in this directory is a symbolic link
103 representing one of the real or virtual networking devices
104 that are visible in the network namespace of the process
105 that is accessing the directory.
106 Each of these symbolic links refers to entries in the
107 .IR /sys/devices
108 directory.
109 .TP
110 .IR /sys/dev
111 This directory contains two subdirectories
112 .IR block /
113 and
114 .IR char/ ,
115 corresponding, respectively,
116 to the block and character devices on the system.
117 Inside each of these subdirectories are symbolic links with names of the form
118 .IR major-ID : minor-ID ,
119 where the ID values correspond to the major and minor ID of a specific device.
120 Each symbolic link points to the
121 .B sysfs
122 directory for a device.
123 The symbolic links inside
124 .IR /sys/dev
125 thus provide an easy way to look up the
126 .B sysfs
127 interface using the device IDs returned by a call to
128 .BR stat (2)
129 (or similar).
130 .IP
131 The 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
137 1 3
138 $ \fBreadlink /sys/dev/char/1\\:3\fP
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
149 .TP
150 .IR /sys/devices
151 This is a directory that contains a filesystem representation of
152 the kernel device tree,
153 which is a hierarchy of
154 .I device
155 structures within the kernel.
156 .TP
157 .IR /sys/firmware
158 This subdirectory contains interfaces for viewing and manipulating
159 firmware-specific objects and attributes.
160 .TP
161 .IR /sys/fs
162 This directory contains subdirectories for some filesystems.
163 A filesystem will have a subdirectory here only if it chose
164 to explicitly create the subdirectory.
165 .TP
166 .IR /sys/fs/cgroup
167 This directory conventionally is used as a mount point for a
168 .BR tmpfs (5)
169 filesystem containing mount points for
170 .BR cgroups (7)
171 filesystems.
172 .TP
173 .IR /sys/fs/smackfs
174 The directory contains configuration files for the SMACK LSM.
175 See the kernel source file
176 .IR Documentation/admin-guide/LSM/Smack.rst .
177 .TP
178 .IR /sys/hypervisor
179 [To be documented]
180 .TP
181 .IR /sys/kernel
182 This subdirectory contains various files and subdirectories that provide
183 information about the running kernel.
184 .TP
185 .IR /sys/kernel/cgroup/
186 For information about the files in this directory, see
187 .BR cgroups (7).
188 .TP
189 .IR /sys/kernel/debug/tracing
190 Mount point for the
191 .I tracefs
192 filesystem used by the kernel's
193 .I ftrace
194 facility.
195 (For information on
196 .IR ftrace ,
197 see the kernel source file
198 .IR Documentation/trace/ftrace.txt .)
199 .TP
200 .IR /sys/kernel/mm
201 This subdirectory contains various files and subdirectories that provide
202 information about the kernel's memory management subsystem.
203 .TP
204 .IR /sys/kernel/mm/hugepages
205 This subdirectory contains one subdirectory for each of the
206 huge page sizes that the system supports.
207 The subdirectory name indicates the huge page size (e.g.,
208 .IR hugepages-2048kB ).
209 Within each of these subdirectories is a set of files
210 that can be used to view and (in some cases) change settings
211 associated with that huge page size.
212 For further information, see the kernel source file
213 .IR Documentation/admin-guide/mm/hugetlbpage.rst .
214 .TP
215 .IR /sys/module
216 This subdirectory contains one subdirectory
217 for each module that is loaded into the kernel.
218 The name of each directory is the name of the module.
219 In 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
247 In 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
260 This directory contains one file for each module parameter,
261 with each file containing the value of the corresponding parameter.
262 Some of these files are writable, allowing the
263 .TP
264 .I sections
265 This subdirectories contains files with information about module sections.
266 This information is mainly used for debugging.
267 .TP
268 .I
269 [To be documented]
270 .RE
271 .TP
272 .IR /sys/power
273 [To be documented]
274 .SH VERSIONS
275 The
276 .B sysfs
277 filesystem first appeared in Linux 2.6.0.
278 .SH CONFORMING TO
279 The
280 .B sysfs
281 filesystem is Linux-specific.
282 .SH NOTES
283 This manual page is incomplete, possibly inaccurate, and is the kind
284 of thing that needs to be updated very often.
285 .SH SEE ALSO
286 .BR proc (5),
287 .BR udev (7)
288 .PP
289 P. Mochel. (2005).
290 .IR "The sysfs filesystem" .
291 Proceedings of the 2005 Ottawa Linux Symposium.
292 .\" https://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf
293 .PP
294 The kernel source file
295 .I Documentation/filesystems/sysfs.txt
296 and various other files in
297 .IR Documentation/ABI
298 and
299 .IR Documentation/*/sysfs.txt