1SYSFS(5)                   Linux Programmer's Manual                  SYSFS(5)
2
3
4

NAME

6       sysfs - a filesystem for exporting kernel objects
7

DESCRIPTION

9       The sysfs filesystem is a pseudo-filesystem which provides an interface
10       to kernel data structures.  (More precisely, the files and  directories
11       in  sysfs  provide  a view of the kobject structures defined internally
12       within the kernel.)  The files under sysfs  provide  information  about
13       devices, kernel modules, filesystems, and other kernel components.
14
15       The  sysfs  filesystem  is  commonly mounted at /sys.  Typically, it is
16       mounted automatically by the system, but it can also be  mounted  manu‐
17       ally using a command such as:
18
19           mount -t sysfs sysfs /sys
20
21       Many of the files in the sysfs filesystem are read-only, but some files
22       are writable, allowing kernel variables to be changed.  To avoid redun‐
23       dancy,  symbolic  links  are heavily used to connect entries across the
24       filesystem tree.
25
26   Files and directories
27       The following list describes some of the files  and  directories  under
28       the /sys hierarchy.
29
30       /sys/block
31              This  subdirectory  contains  one  symbolic  link for each block
32              device that has been discovered on  the  system.   The  symbolic
33              links point to corresponding directories under /sys/devices.
34
35       /sys/bus
36              This  directory  contains  one  subdirectory for each of the bus
37              types in the kernel.  Inside each of these directories  are  two
38              subdirectories:
39
40              devices
41                     This  subdirectory  contains symbolic links to entries in
42                     /sys/devices that correspond to the devices discovered on
43                     this bus.
44
45              drivers
46                     This  subdirectory  contains  one  subdirectory  for each
47                     device driver that is loaded on this bus.
48
49       /sys/class
50              This subdirectory contains a single layer of further subdirecto‐
51              ries for each of the device classes that have been registered on
52              the system (e.g., terminals,  network  devices,  block  devices,
53              graphics  devices,  sound  devices,  and so on).  Inside each of
54              these subdirectories are symbolic links for each of the  devices
55              in  this  class.   These  symbolic links refer to entries in the
56              /sys/devices directory.
57
58       /sys/class/net
59              Each of the entries in this directory is a symbolic link  repre‐
60              senting  one  of the real or virtual networking devices that are
61              visible in the network namespace of the process that is  access‐
62              ing  the  directory.   Each  of  these  symbolic links refers to
63              entries in the /sys/devices directory.
64
65       /sys/dev
66              This directory contains two  subdirectories  block/  and  char/,
67              corresponding,  respectively, to the block and character devices
68              on the system.  Inside each of these subdirectories are symbolic
69              links  with  names  of  the form major-ID:minor-ID, where the ID
70              values correspond to the  major  and  minor  ID  of  a  specific
71              device.   Each symbolic link points to the sysfs directory for a
72              device.  The symbolic links inside /sys/dev thus provide an easy
73              way to look up the sysfs interface using the device IDs returned
74              by a call to stat(2) (or similar).
75
76              The following shell session shows an example from /sys/dev:
77
78                  $ stat -c "%t %T" /dev/null
79                  1 3
80                  $ readlink /sys/dev/char/1\:3
81                  ../../devices/virtual/mem/null
82                  $ ls -Fd /sys/devices/virtual/mem/null
83                  /sys/devices/virtual/mem/null/
84                  $ ls -d1 /sys/devices/virtual/mem/null/*
85                  /sys/devices/virtual/mem/null/dev
86                  /sys/devices/virtual/mem/null/power/
87                  /sys/devices/virtual/mem/null/subsystem@
88                  /sys/devices/virtual/mem/null/uevent
89
90       /sys/devices
91              This is a directory that contains a filesystem representation of
92              the  kernel  device  tree, which is a hierarchy of device struc‐
93              tures within the kernel.
94
95       /sys/firmware
96              This subdirectory contains interfaces for viewing and manipulat‐
97              ing firmware-specific objects and attributes.
98
99       /sys/fs
100              This  directory contains subdirectories for some filesystems.  A
101              filesystem will have a subdirectory here only  if  it  chose  to
102              explicitly create the subdirectory.
103
104       /sys/fs/cgroup
105              This  directory  conventionally  is  used as a mount point for a
106              tmpfs(5)  filesystem  containing  mount  points  for  cgroups(7)
107              filesystems.
108
109       /sys/hypervisor
110              [To be documented]
111
112       /sys/kernel
113              This subdirectory contains various files and subdirectories that
114              provide information about the running kernel.
115
116       /sys/kernel/cgroup/
117              For  information  about  the  files  in  this   directory,   see
118              cgroups(7).
119
120       /sys/kernel/debug/tracing
121              Mount  point  for  the  tracefs  filesystem used by the kernel's
122              ftrace facility.  (For information on  ftrace,  see  the  kernel
123              source file Documentation/trace/ftrace.txt.)
124
125       /sys/kernel/mm
126              This subdirectory contains various files and subdirectories that
127              provide information about the kernel's memory management subsys‐
128              tem.
129
130       /sys/kernel/mm/hugepages
131              This subdirectory contains one subdirectory for each of the huge
132              page sizes that the  system  supports.   The  subdirectory  name
133              indicates  the  huge page size (e.g., hugepages-2048kB).  Within
134              each of these subdirectories is a set of files that can be  used
135              to view and (in some cases) change settings associated with that
136              huge page size.  For further information, see the kernel  source
137              file Documentation/vm/hugetlbpage.txt.
138
139       /sys/module
140              This subdirectory contains one subdirectory for each module that
141              is loaded into the kernel.  The name of each  directory  is  the
142              name of the module.  In each of the subdirectories, there may be
143              following files:
144
145              coresize
146                     [to be documented]
147
148              initsize
149                     [to be documented]
150
151              initstate
152                     [to be documented]
153
154              refcnt [to be documented]
155
156              srcversion
157                     [to be documented]
158
159              taint  [to be documented]
160
161              uevent [to be documented]
162
163              version
164                     [to be documented]
165
166              In each of the subdirectories, there may be following  subdirec‐
167              tories:
168
169              drivers
170                     [To be documented]
171
172              holders
173                     [To be documented]
174
175              notes  [To be documented]
176
177              parameters
178                     This  directory contains one file for each module parame‐
179                     ter, with each file containing the value  of  the  corre‐
180                     sponding  parameter.   Some  of these files are writable,
181                     allowing the
182
183              sections
184                     This subdirectories contains files with information about
185                     module  sections.   This  information  is mainly used for
186                     debugging.
187
188              [To be documented]
189
190       /sys/power
191              [To be documented]
192

VERSIONS

194       The sysfs filesystem first appeared in Linux 2.6.0.
195

CONFORMING TO

197       The sysfs filesystem is Linux-specific.
198

NOTES

200       This manual page is incomplete, possibly inaccurate, and is the kind of
201       thing that needs to be updated very often.
202

SEE ALSO

204       proc(5), udev(7)
205
206       P.  Mochel.  (2005).   The  sysfs  filesystem.  Proceedings of the 2005
207       Ottawa Linux Symposium.
208
209       The kernel source file Documentation/filesystems/sysfs.txt and  various
210       other files in Documentation/ABI and Documentation/*/sysfs.txt
211

COLOPHON

213       This  page  is  part of release 4.15 of the Linux man-pages project.  A
214       description of the project, information about reporting bugs,  and  the
215       latest     version     of     this    page,    can    be    found    at
216       https://www.kernel.org/doc/man-pages/.
217
218
219
220Linux                             2017-11-26                          SYSFS(5)
Impressum