]>
Commit | Line | Data |
---|---|---|
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 | .\" |
45186a5d | 5 | .TH SYSFS 5 2021-03-22 "Linux man-pages (unreleased)" |
46841ace MK |
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 | |
1ae6b2c7 | 16 | .I kobject |
46841ace MK |
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. | |
22 | .PP | |
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: | |
29 | .PP | |
30 | .in +4n | |
31 | .EX | |
32 | mount \-t sysfs sysfs /sys | |
33 | .EE | |
34 | .in | |
35 | .PP | |
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. | |
6df684e0 MK |
40 | To avoid redundancy, |
41 | symbolic links are heavily used to connect entries across the filesystem tree. | |
46841ace MK |
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 | |
1ae6b2c7 | 48 | .I /sys/block |
6df684e0 MK |
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 . | |
46841ace | 53 | .TP |
1ae6b2c7 | 54 | .I /sys/bus |
6df684e0 MK |
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 | |
1ae6b2c7 | 60 | .I devices |
6df684e0 | 61 | This subdirectory contains symbolic links to entries in |
1ae6b2c7 | 62 | .I /sys/devices |
6df684e0 MK |
63 | that correspond to the devices discovered on this bus. |
64 | .TP | |
1ae6b2c7 | 65 | .I drivers |
6df684e0 MK |
66 | This subdirectory contains one subdirectory for each device driver |
67 | that is loaded on this bus. | |
68 | .RE | |
46841ace | 69 | .TP |
1ae6b2c7 | 70 | .I /sys/class |
6df684e0 MK |
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 | |
1ae6b2c7 | 78 | .I /sys/devices |
6df684e0 | 79 | directory. |
46841ace | 80 | .TP |
1ae6b2c7 | 81 | .I /sys/class/net |
85f0310c | 82 | Each of the entries in this directory is a symbolic link |
5d9b8ae9 | 83 | representing one of the real or virtual networking devices |
85f0310c MK |
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 | |
1ae6b2c7 | 87 | .I /sys/devices |
85f0310c MK |
88 | directory. |
89 | .TP | |
1ae6b2c7 | 90 | .I /sys/dev |
6df684e0 | 91 | This directory contains two subdirectories |
1ae6b2c7 | 92 | .I block/ |
6df684e0 MK |
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 | |
e0fe703d | 98 | .IR major-ID : minor-ID , |
6df684e0 MK |
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 | |
1ae6b2c7 | 104 | .I /sys/dev |
6df684e0 MK |
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). | |
110 | .IP | |
111 | The 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 | |
117 | 1 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 |
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. | |
46841ace | 136 | .TP |
1ae6b2c7 | 137 | .I /sys/firmware |
6df684e0 MK |
138 | This subdirectory contains interfaces for viewing and manipulating |
139 | firmware-specific objects and attributes. | |
46841ace | 140 | .TP |
1ae6b2c7 | 141 | .I /sys/fs |
6df684e0 MK |
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. | |
46841ace | 145 | .TP |
1ae6b2c7 | 146 | .I /sys/fs/cgroup |
46841ace MK |
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. | |
152 | .TP | |
1ae6b2c7 | 153 | .I /sys/fs/smackfs |
8f8b643d MK |
154 | The directory contains configuration files for the SMACK LSM. |
155 | See 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 |
162 | This subdirectory contains various files and subdirectories that provide |
163 | information about the running kernel. | |
46841ace | 164 | .TP |
1ae6b2c7 | 165 | .I /sys/kernel/cgroup/ |
475ceab1 MK |
166 | For information about the files in this directory, see |
167 | .BR cgroups (7). | |
168 | .TP | |
1ae6b2c7 | 169 | .I /sys/kernel/debug/tracing |
d8a21977 MK |
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 .) | |
179 | .TP | |
1ae6b2c7 | 180 | .I /sys/kernel/mm |
cf4a2cfb MK |
181 | This subdirectory contains various files and subdirectories that provide |
182 | information about the kernel's memory management subsystem. | |
183 | .TP | |
1ae6b2c7 | 184 | .I /sys/kernel/mm/hugepages |
db419c96 MK |
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., | |
cd415e73 | 188 | .IR hugepages\-2048kB ). |
e8b9e9a2 | 189 | Within each of these subdirectories is a set of files |
db419c96 MK |
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 | |
b49c2acb | 193 | .IR Documentation/admin\-guide/mm/hugetlbpage.rst . |
db419c96 | 194 | .TP |
1ae6b2c7 | 195 | .I /sys/module |
6df684e0 MK |
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: | |
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 | |
227 | In 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 | |
240 | This directory contains one file for each module parameter, | |
241 | with each file containing the value of the corresponding parameter. | |
e0fe703d | 242 | Some of these files are writable, allowing the |
6df684e0 MK |
243 | .TP |
244 | .I sections | |
245 | This subdirectories contains files with information about module sections. | |
246 | This 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 |
255 | The | |
256 | .B sysfs | |
257 | filesystem first appeared in Linux 2.6.0. | |
3113c7f3 | 258 | .SH STANDARDS |
46841ace MK |
259 | The |
260 | .B sysfs | |
261 | filesystem is Linux-specific. | |
262 | .SH NOTES | |
263 | This manual page is incomplete, possibly inaccurate, and is the kind | |
264 | of thing that needs to be updated very often. | |
265 | .SH SEE ALSO | |
266 | .BR proc (5), | |
267 | .BR udev (7) | |
268 | .PP | |
8fb01fde | 269 | P.\& Mochel. (2005). |
6df684e0 MK |
270 | .IR "The sysfs filesystem" . |
271 | Proceedings 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 |
274 | The kernel source file |
275 | .I Documentation/filesystems/sysfs.txt | |
276 | and various other files in | |
1ae6b2c7 | 277 | .I Documentation/ABI |
46841ace | 278 | and |
1ae6b2c7 | 279 | .I Documentation/*/sysfs.txt |