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