devices.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. Linux allocated devices (4.x+ version)
  2. ======================================
  3. This list is the Linux Device List, the official registry of allocated
  4. device numbers and ``/dev`` directory nodes for the Linux operating
  5. system.
  6. The LaTeX version of this document is no longer maintained, nor is
  7. the document that used to reside at lanana.org. This version in the
  8. mainline Linux kernel is the master document. Updates shall be sent
  9. as patches to the kernel maintainers (see the
  10. :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` document).
  11. Specifically explore the sections titled "CHAR and MISC DRIVERS", and
  12. "BLOCK LAYER" in the MAINTAINERS file to find the right maintainers
  13. to involve for character and block devices.
  14. This document is included by reference into the Filesystem Hierarchy
  15. Standard (FHS). The FHS is available from http://www.pathname.com/fhs/.
  16. Allocations marked (68k/Amiga) apply to Linux/68k on the Amiga
  17. platform only. Allocations marked (68k/Atari) apply to Linux/68k on
  18. the Atari platform only.
  19. This document is in the public domain. The authors requests, however,
  20. that semantically altered versions are not distributed without
  21. permission of the authors, assuming the authors can be contacted without
  22. an unreasonable effort.
  23. .. attention::
  24. DEVICE DRIVERS AUTHORS PLEASE READ THIS
  25. Linux now has extensive support for dynamic allocation of device numbering
  26. and can use ``sysfs`` and ``udev`` (``systemd``) to handle the naming needs.
  27. There are still some exceptions in the serial and boot device area. Before
  28. asking for a device number make sure you actually need one.
  29. To have a major number allocated, or a minor number in situations
  30. where that applies (e.g. busmice), please submit a patch and send to
  31. the authors as indicated above.
  32. Keep the description of the device *in the same format
  33. as this list*. The reason for this is that it is the only way we have
  34. found to ensure we have all the requisite information to publish your
  35. device and avoid conflicts.
  36. Finally, sometimes we have to play "namespace police." Please don't be
  37. offended. We often get submissions for ``/dev`` names that would be bound
  38. to cause conflicts down the road. We are trying to avoid getting in a
  39. situation where we would have to suffer an incompatible forward
  40. change. Therefore, please consult with us **before** you make your
  41. device names and numbers in any way public, at least to the point
  42. where it would be at all difficult to get them changed.
  43. Your cooperation is appreciated.
  44. .. include:: devices.txt
  45. :literal:
  46. Additional ``/dev/`` directory entries
  47. --------------------------------------
  48. This section details additional entries that should or may exist in
  49. the /dev directory. It is preferred that symbolic links use the same
  50. form (absolute or relative) as is indicated here. Links are
  51. classified as "hard" or "symbolic" depending on the preferred type of
  52. link; if possible, the indicated type of link should be used.
  53. Compulsory links
  54. ++++++++++++++++
  55. These links should exist on all systems:
  56. =============== =============== =============== ===============================
  57. /dev/fd /proc/self/fd symbolic File descriptors
  58. /dev/stdin fd/0 symbolic stdin file descriptor
  59. /dev/stdout fd/1 symbolic stdout file descriptor
  60. /dev/stderr fd/2 symbolic stderr file descriptor
  61. /dev/nfsd socksys symbolic Required by iBCS-2
  62. /dev/X0R null symbolic Required by iBCS-2
  63. =============== =============== =============== ===============================
  64. Note: ``/dev/X0R`` is <letter X>-<digit 0>-<letter R>.
  65. Recommended links
  66. +++++++++++++++++
  67. It is recommended that these links exist on all systems:
  68. =============== =============== =============== ===============================
  69. /dev/core /proc/kcore symbolic Backward compatibility
  70. /dev/ramdisk ram0 symbolic Backward compatibility
  71. /dev/ftape qft0 symbolic Backward compatibility
  72. /dev/bttv0 video0 symbolic Backward compatibility
  73. /dev/radio radio0 symbolic Backward compatibility
  74. /dev/i2o* /dev/i2o/* symbolic Backward compatibility
  75. /dev/scd? sr? hard Alternate SCSI CD-ROM name
  76. =============== =============== =============== ===============================
  77. Locally defined links
  78. +++++++++++++++++++++
  79. The following links may be established locally to conform to the
  80. configuration of the system. This is merely a tabulation of existing
  81. practice, and does not constitute a recommendation. However, if they
  82. exist, they should have the following uses.
  83. =============== =============== =============== ===============================
  84. /dev/mouse mouse port symbolic Current mouse device
  85. /dev/tape tape device symbolic Current tape device
  86. /dev/cdrom CD-ROM device symbolic Current CD-ROM device
  87. /dev/cdwriter CD-writer symbolic Current CD-writer device
  88. /dev/scanner scanner symbolic Current scanner device
  89. /dev/modem modem port symbolic Current dialout device
  90. /dev/root root device symbolic Current root filesystem
  91. /dev/swap swap device symbolic Current swap device
  92. =============== =============== =============== ===============================
  93. ``/dev/modem`` should not be used for a modem which supports dialin as
  94. well as dialout, as it tends to cause lock file problems. If it
  95. exists, ``/dev/modem`` should point to the appropriate primary TTY device
  96. (the use of the alternate callout devices is deprecated).
  97. For SCSI devices, ``/dev/tape`` and ``/dev/cdrom`` should point to the
  98. *cooked* devices (``/dev/st*`` and ``/dev/sr*``, respectively), whereas
  99. ``/dev/cdwriter`` and /dev/scanner should point to the appropriate generic
  100. SCSI devices (/dev/sg*).
  101. ``/dev/mouse`` may point to a primary serial TTY device, a hardware mouse
  102. device, or a socket for a mouse driver program (e.g. ``/dev/gpmdata``).
  103. Sockets and pipes
  104. +++++++++++++++++
  105. Non-transient sockets and named pipes may exist in /dev. Common entries are:
  106. =============== =============== ===============================================
  107. /dev/printer socket lpd local socket
  108. /dev/log socket syslog local socket
  109. /dev/gpmdata socket gpm mouse multiplexer
  110. =============== =============== ===============================================
  111. Mount points
  112. ++++++++++++
  113. The following names are reserved for mounting special filesystems
  114. under /dev. These special filesystems provide kernel interfaces that
  115. cannot be provided with standard device nodes.
  116. =============== =============== ===============================================
  117. /dev/pts devpts PTY slave filesystem
  118. /dev/shm tmpfs POSIX shared memory maintenance access
  119. =============== =============== ===============================================
  120. Terminal devices
  121. ----------------
  122. Terminal, or TTY devices are a special class of character devices. A
  123. terminal device is any device that could act as a controlling terminal
  124. for a session; this includes virtual consoles, serial ports, and
  125. pseudoterminals (PTYs).
  126. All terminal devices share a common set of capabilities known as line
  127. disciplines; these include the common terminal line discipline as well
  128. as SLIP and PPP modes.
  129. All terminal devices are named similarly; this section explains the
  130. naming and use of the various types of TTYs. Note that the naming
  131. conventions include several historical warts; some of these are
  132. Linux-specific, some were inherited from other systems, and some
  133. reflect Linux outgrowing a borrowed convention.
  134. A hash mark (``#``) in a device name is used here to indicate a decimal
  135. number without leading zeroes.
  136. Virtual consoles and the console device
  137. +++++++++++++++++++++++++++++++++++++++
  138. Virtual consoles are full-screen terminal displays on the system video
  139. monitor. Virtual consoles are named ``/dev/tty#``, with numbering
  140. starting at ``/dev/tty1``; ``/dev/tty0`` is the current virtual console.
  141. ``/dev/tty0`` is the device that should be used to access the system video
  142. card on those architectures for which the frame buffer devices
  143. (``/dev/fb*``) are not applicable. Do not use ``/dev/console``
  144. for this purpose.
  145. The console device, ``/dev/console``, is the device to which system
  146. messages should be sent, and on which logins should be permitted in
  147. single-user mode. Starting with Linux 2.1.71, ``/dev/console`` is managed
  148. by the kernel; for previous versions it should be a symbolic link to
  149. either ``/dev/tty0``, a specific virtual console such as ``/dev/tty1``, or to
  150. a serial port primary (``tty*``, not ``cu*``) device, depending on the
  151. configuration of the system.
  152. Serial ports
  153. ++++++++++++
  154. Serial ports are RS-232 serial ports and any device which simulates
  155. one, either in hardware (such as internal modems) or in software (such
  156. as the ISDN driver.) Under Linux, each serial ports has two device
  157. names, the primary or callin device and the alternate or callout one.
  158. Each kind of device is indicated by a different letter. For any
  159. letter X, the names of the devices are ``/dev/ttyX#`` and ``/dev/cux#``,
  160. respectively; for historical reasons, ``/dev/ttyS#`` and ``/dev/ttyC#``
  161. correspond to ``/dev/cua#`` and ``/dev/cub#``. In the future, it should be
  162. expected that multiple letters will be used; all letters will be upper
  163. case for the "tty" device (e.g. ``/dev/ttyDP#``) and lower case for the
  164. "cu" device (e.g. ``/dev/cudp#``).
  165. The names ``/dev/ttyQ#`` and ``/dev/cuq#`` are reserved for local use.
  166. The alternate devices provide for kernel-based exclusion and somewhat
  167. different defaults than the primary devices. Their main purpose is to
  168. allow the use of serial ports with programs with no inherent or broken
  169. support for serial ports. Their use is deprecated, and they may be
  170. removed from a future version of Linux.
  171. Arbitration of serial ports is provided by the use of lock files with
  172. the names ``/var/lock/LCK..ttyX#``. The contents of the lock file should
  173. be the PID of the locking process as an ASCII number.
  174. It is common practice to install links such as /dev/modem
  175. which point to serial ports. In order to ensure proper locking in the
  176. presence of these links, it is recommended that software chase
  177. symlinks and lock all possible names; additionally, it is recommended
  178. that a lock file be installed with the corresponding alternate
  179. device. In order to avoid deadlocks, it is recommended that the locks
  180. are acquired in the following order, and released in the reverse:
  181. 1. The symbolic link name, if any (``/var/lock/LCK..modem``)
  182. 2. The "tty" name (``/var/lock/LCK..ttyS2``)
  183. 3. The alternate device name (``/var/lock/LCK..cua2``)
  184. In the case of nested symbolic links, the lock files should be
  185. installed in the order the symlinks are resolved.
  186. Under no circumstances should an application hold a lock while waiting
  187. for another to be released. In addition, applications which attempt
  188. to create lock files for the corresponding alternate device names
  189. should take into account the possibility of being used on a non-serial
  190. port TTY, for which no alternate device would exist.
  191. Pseudoterminals (PTYs)
  192. ++++++++++++++++++++++
  193. Pseudoterminals, or PTYs, are used to create login sessions or provide
  194. other capabilities requiring a TTY line discipline (including SLIP or
  195. PPP capability) to arbitrary data-generation processes. Each PTY has
  196. a master side, named ``/dev/pty[p-za-e][0-9a-f]``, and a slave side, named
  197. ``/dev/tty[p-za-e][0-9a-f]``. The kernel arbitrates the use of PTYs by
  198. allowing each master side to be opened only once.
  199. Once the master side has been opened, the corresponding slave device
  200. can be used in the same manner as any TTY device. The master and
  201. slave devices are connected by the kernel, generating the equivalent
  202. of a bidirectional pipe with TTY capabilities.
  203. Recent versions of the Linux kernels and GNU libc contain support for
  204. the System V/Unix98 naming scheme for PTYs, which assigns a common
  205. device, ``/dev/ptmx``, to all the masters (opening it will automatically
  206. give you a previously unassigned PTY) and a subdirectory, ``/dev/pts``,
  207. for the slaves; the slaves are named with decimal integers (``/dev/pts/#``
  208. in our notation). This removes the problem of exhausting the
  209. namespace and enables the kernel to automatically create the device
  210. nodes for the slaves on demand using the "devpts" filesystem.