1f77af637SFederico Vaga.. _admin_devices: 29d85025bSMauro Carvalho Chehab 39d85025bSMauro Carvalho ChehabLinux allocated devices (4.x+ version) 49d85025bSMauro Carvalho Chehab====================================== 59d85025bSMauro Carvalho Chehab 69d85025bSMauro Carvalho ChehabThis list is the Linux Device List, the official registry of allocated 79d85025bSMauro Carvalho Chehabdevice numbers and ``/dev`` directory nodes for the Linux operating 89d85025bSMauro Carvalho Chehabsystem. 99d85025bSMauro Carvalho Chehab 10*3cb5e516SLukas BulwahnThe version of this document at lanana.org is no longer maintained. This 11*3cb5e516SLukas Bulwahnversion in the mainline Linux kernel is the master document. Updates 12*3cb5e516SLukas Bulwahnshall be sent as patches to the kernel maintainers (see the 138c27ceffSMauro Carvalho Chehab:ref:`Documentation/process/submitting-patches.rst <submittingpatches>` document). 149d85025bSMauro Carvalho ChehabSpecifically explore the sections titled "CHAR and MISC DRIVERS", and 159d85025bSMauro Carvalho Chehab"BLOCK LAYER" in the MAINTAINERS file to find the right maintainers 169d85025bSMauro Carvalho Chehabto involve for character and block devices. 179d85025bSMauro Carvalho Chehab 189d85025bSMauro Carvalho ChehabThis document is included by reference into the Filesystem Hierarchy 1993431e06SAlexander A. KlimovStandard (FHS). The FHS is available from https://www.pathname.com/fhs/. 209d85025bSMauro Carvalho Chehab 219d85025bSMauro Carvalho ChehabAllocations marked (68k/Amiga) apply to Linux/68k on the Amiga 229d85025bSMauro Carvalho Chehabplatform only. Allocations marked (68k/Atari) apply to Linux/68k on 239d85025bSMauro Carvalho Chehabthe Atari platform only. 249d85025bSMauro Carvalho Chehab 259d85025bSMauro Carvalho ChehabThis document is in the public domain. The authors requests, however, 269d85025bSMauro Carvalho Chehabthat semantically altered versions are not distributed without 279d85025bSMauro Carvalho Chehabpermission of the authors, assuming the authors can be contacted without 289d85025bSMauro Carvalho Chehaban unreasonable effort. 299d85025bSMauro Carvalho Chehab 309d85025bSMauro Carvalho Chehab 319d85025bSMauro Carvalho Chehab.. attention:: 329d85025bSMauro Carvalho Chehab 339d85025bSMauro Carvalho Chehab DEVICE DRIVERS AUTHORS PLEASE READ THIS 349d85025bSMauro Carvalho Chehab 359d85025bSMauro Carvalho Chehab Linux now has extensive support for dynamic allocation of device numbering 369d85025bSMauro Carvalho Chehab and can use ``sysfs`` and ``udev`` (``systemd``) to handle the naming needs. 379d85025bSMauro Carvalho Chehab There are still some exceptions in the serial and boot device area. Before 389d85025bSMauro Carvalho Chehab asking for a device number make sure you actually need one. 399d85025bSMauro Carvalho Chehab 409d85025bSMauro Carvalho Chehab To have a major number allocated, or a minor number in situations 419d85025bSMauro Carvalho Chehab where that applies (e.g. busmice), please submit a patch and send to 429d85025bSMauro Carvalho Chehab the authors as indicated above. 439d85025bSMauro Carvalho Chehab 449d85025bSMauro Carvalho Chehab Keep the description of the device *in the same format 459d85025bSMauro Carvalho Chehab as this list*. The reason for this is that it is the only way we have 469d85025bSMauro Carvalho Chehab found to ensure we have all the requisite information to publish your 479d85025bSMauro Carvalho Chehab device and avoid conflicts. 489d85025bSMauro Carvalho Chehab 499d85025bSMauro Carvalho Chehab Finally, sometimes we have to play "namespace police." Please don't be 509d85025bSMauro Carvalho Chehab offended. We often get submissions for ``/dev`` names that would be bound 519d85025bSMauro Carvalho Chehab to cause conflicts down the road. We are trying to avoid getting in a 529d85025bSMauro Carvalho Chehab situation where we would have to suffer an incompatible forward 539d85025bSMauro Carvalho Chehab change. Therefore, please consult with us **before** you make your 549d85025bSMauro Carvalho Chehab device names and numbers in any way public, at least to the point 559d85025bSMauro Carvalho Chehab where it would be at all difficult to get them changed. 569d85025bSMauro Carvalho Chehab 579d85025bSMauro Carvalho Chehab Your cooperation is appreciated. 589d85025bSMauro Carvalho Chehab 5907c7e30cSJani Nikula.. include:: devices.txt 6007c7e30cSJani Nikula :literal: 619d85025bSMauro Carvalho Chehab 629d85025bSMauro Carvalho ChehabAdditional ``/dev/`` directory entries 639d85025bSMauro Carvalho Chehab-------------------------------------- 649d85025bSMauro Carvalho Chehab 659d85025bSMauro Carvalho ChehabThis section details additional entries that should or may exist in 669d85025bSMauro Carvalho Chehabthe /dev directory. It is preferred that symbolic links use the same 679d85025bSMauro Carvalho Chehabform (absolute or relative) as is indicated here. Links are 689d85025bSMauro Carvalho Chehabclassified as "hard" or "symbolic" depending on the preferred type of 699d85025bSMauro Carvalho Chehablink; if possible, the indicated type of link should be used. 709d85025bSMauro Carvalho Chehab 719d85025bSMauro Carvalho ChehabCompulsory links 729d85025bSMauro Carvalho Chehab++++++++++++++++ 739d85025bSMauro Carvalho Chehab 749d85025bSMauro Carvalho ChehabThese links should exist on all systems: 759d85025bSMauro Carvalho Chehab 769d85025bSMauro Carvalho Chehab=============== =============== =============== =============================== 779d85025bSMauro Carvalho Chehab/dev/fd /proc/self/fd symbolic File descriptors 789d85025bSMauro Carvalho Chehab/dev/stdin fd/0 symbolic stdin file descriptor 799d85025bSMauro Carvalho Chehab/dev/stdout fd/1 symbolic stdout file descriptor 809d85025bSMauro Carvalho Chehab/dev/stderr fd/2 symbolic stderr file descriptor 819d85025bSMauro Carvalho Chehab/dev/nfsd socksys symbolic Required by iBCS-2 829d85025bSMauro Carvalho Chehab/dev/X0R null symbolic Required by iBCS-2 839d85025bSMauro Carvalho Chehab=============== =============== =============== =============================== 849d85025bSMauro Carvalho Chehab 859d85025bSMauro Carvalho ChehabNote: ``/dev/X0R`` is <letter X>-<digit 0>-<letter R>. 869d85025bSMauro Carvalho Chehab 879d85025bSMauro Carvalho ChehabRecommended links 889d85025bSMauro Carvalho Chehab+++++++++++++++++ 899d85025bSMauro Carvalho Chehab 909d85025bSMauro Carvalho ChehabIt is recommended that these links exist on all systems: 919d85025bSMauro Carvalho Chehab 929d85025bSMauro Carvalho Chehab 939d85025bSMauro Carvalho Chehab=============== =============== =============== =============================== 949d85025bSMauro Carvalho Chehab/dev/core /proc/kcore symbolic Backward compatibility 959d85025bSMauro Carvalho Chehab/dev/ramdisk ram0 symbolic Backward compatibility 969d85025bSMauro Carvalho Chehab/dev/ftape qft0 symbolic Backward compatibility 979d85025bSMauro Carvalho Chehab/dev/bttv0 video0 symbolic Backward compatibility 989d85025bSMauro Carvalho Chehab/dev/radio radio0 symbolic Backward compatibility 999d85025bSMauro Carvalho Chehab/dev/i2o* /dev/i2o/* symbolic Backward compatibility 1009d85025bSMauro Carvalho Chehab/dev/scd? sr? hard Alternate SCSI CD-ROM name 1019d85025bSMauro Carvalho Chehab=============== =============== =============== =============================== 1029d85025bSMauro Carvalho Chehab 1039d85025bSMauro Carvalho ChehabLocally defined links 1049d85025bSMauro Carvalho Chehab+++++++++++++++++++++ 1059d85025bSMauro Carvalho Chehab 1069d85025bSMauro Carvalho ChehabThe following links may be established locally to conform to the 1079d85025bSMauro Carvalho Chehabconfiguration of the system. This is merely a tabulation of existing 1089d85025bSMauro Carvalho Chehabpractice, and does not constitute a recommendation. However, if they 1099d85025bSMauro Carvalho Chehabexist, they should have the following uses. 1109d85025bSMauro Carvalho Chehab 1119d85025bSMauro Carvalho Chehab=============== =============== =============== =============================== 1129d85025bSMauro Carvalho Chehab/dev/mouse mouse port symbolic Current mouse device 1139d85025bSMauro Carvalho Chehab/dev/tape tape device symbolic Current tape device 1149d85025bSMauro Carvalho Chehab/dev/cdrom CD-ROM device symbolic Current CD-ROM device 1159d85025bSMauro Carvalho Chehab/dev/cdwriter CD-writer symbolic Current CD-writer device 1169d85025bSMauro Carvalho Chehab/dev/scanner scanner symbolic Current scanner device 1179d85025bSMauro Carvalho Chehab/dev/modem modem port symbolic Current dialout device 1189d85025bSMauro Carvalho Chehab/dev/root root device symbolic Current root filesystem 1199d85025bSMauro Carvalho Chehab/dev/swap swap device symbolic Current swap device 1209d85025bSMauro Carvalho Chehab=============== =============== =============== =============================== 1219d85025bSMauro Carvalho Chehab 1229d85025bSMauro Carvalho Chehab``/dev/modem`` should not be used for a modem which supports dialin as 1239d85025bSMauro Carvalho Chehabwell as dialout, as it tends to cause lock file problems. If it 1249d85025bSMauro Carvalho Chehabexists, ``/dev/modem`` should point to the appropriate primary TTY device 1259d85025bSMauro Carvalho Chehab(the use of the alternate callout devices is deprecated). 1269d85025bSMauro Carvalho Chehab 1279d85025bSMauro Carvalho ChehabFor SCSI devices, ``/dev/tape`` and ``/dev/cdrom`` should point to the 1289d85025bSMauro Carvalho Chehab*cooked* devices (``/dev/st*`` and ``/dev/sr*``, respectively), whereas 1299d85025bSMauro Carvalho Chehab``/dev/cdwriter`` and /dev/scanner should point to the appropriate generic 1309d85025bSMauro Carvalho ChehabSCSI devices (/dev/sg*). 1319d85025bSMauro Carvalho Chehab 1329d85025bSMauro Carvalho Chehab``/dev/mouse`` may point to a primary serial TTY device, a hardware mouse 1339d85025bSMauro Carvalho Chehabdevice, or a socket for a mouse driver program (e.g. ``/dev/gpmdata``). 1349d85025bSMauro Carvalho Chehab 1359d85025bSMauro Carvalho ChehabSockets and pipes 1369d85025bSMauro Carvalho Chehab+++++++++++++++++ 1379d85025bSMauro Carvalho Chehab 1389d85025bSMauro Carvalho ChehabNon-transient sockets and named pipes may exist in /dev. Common entries are: 1399d85025bSMauro Carvalho Chehab 1409d85025bSMauro Carvalho Chehab=============== =============== =============================================== 1419d85025bSMauro Carvalho Chehab/dev/printer socket lpd local socket 1429d85025bSMauro Carvalho Chehab/dev/log socket syslog local socket 1439d85025bSMauro Carvalho Chehab/dev/gpmdata socket gpm mouse multiplexer 1449d85025bSMauro Carvalho Chehab=============== =============== =============================================== 1459d85025bSMauro Carvalho Chehab 1469d85025bSMauro Carvalho ChehabMount points 1479d85025bSMauro Carvalho Chehab++++++++++++ 1489d85025bSMauro Carvalho Chehab 1499d85025bSMauro Carvalho ChehabThe following names are reserved for mounting special filesystems 1509d85025bSMauro Carvalho Chehabunder /dev. These special filesystems provide kernel interfaces that 1519d85025bSMauro Carvalho Chehabcannot be provided with standard device nodes. 1529d85025bSMauro Carvalho Chehab 1539d85025bSMauro Carvalho Chehab=============== =============== =============================================== 1549d85025bSMauro Carvalho Chehab/dev/pts devpts PTY slave filesystem 1559d85025bSMauro Carvalho Chehab/dev/shm tmpfs POSIX shared memory maintenance access 1569d85025bSMauro Carvalho Chehab=============== =============== =============================================== 1579d85025bSMauro Carvalho Chehab 1589d85025bSMauro Carvalho ChehabTerminal devices 1599d85025bSMauro Carvalho Chehab---------------- 1609d85025bSMauro Carvalho Chehab 1619d85025bSMauro Carvalho ChehabTerminal, or TTY devices are a special class of character devices. A 1629d85025bSMauro Carvalho Chehabterminal device is any device that could act as a controlling terminal 1639d85025bSMauro Carvalho Chehabfor a session; this includes virtual consoles, serial ports, and 1649d85025bSMauro Carvalho Chehabpseudoterminals (PTYs). 1659d85025bSMauro Carvalho Chehab 1669d85025bSMauro Carvalho ChehabAll terminal devices share a common set of capabilities known as line 1679d85025bSMauro Carvalho Chehabdisciplines; these include the common terminal line discipline as well 1689d85025bSMauro Carvalho Chehabas SLIP and PPP modes. 1699d85025bSMauro Carvalho Chehab 1709d85025bSMauro Carvalho ChehabAll terminal devices are named similarly; this section explains the 1719d85025bSMauro Carvalho Chehabnaming and use of the various types of TTYs. Note that the naming 1729d85025bSMauro Carvalho Chehabconventions include several historical warts; some of these are 1739d85025bSMauro Carvalho ChehabLinux-specific, some were inherited from other systems, and some 1749d85025bSMauro Carvalho Chehabreflect Linux outgrowing a borrowed convention. 1759d85025bSMauro Carvalho Chehab 1769d85025bSMauro Carvalho ChehabA hash mark (``#``) in a device name is used here to indicate a decimal 1779d85025bSMauro Carvalho Chehabnumber without leading zeroes. 1789d85025bSMauro Carvalho Chehab 1799d85025bSMauro Carvalho ChehabVirtual consoles and the console device 1809d85025bSMauro Carvalho Chehab+++++++++++++++++++++++++++++++++++++++ 1819d85025bSMauro Carvalho Chehab 1829d85025bSMauro Carvalho ChehabVirtual consoles are full-screen terminal displays on the system video 1839d85025bSMauro Carvalho Chehabmonitor. Virtual consoles are named ``/dev/tty#``, with numbering 1849d85025bSMauro Carvalho Chehabstarting at ``/dev/tty1``; ``/dev/tty0`` is the current virtual console. 1859d85025bSMauro Carvalho Chehab``/dev/tty0`` is the device that should be used to access the system video 1869d85025bSMauro Carvalho Chehabcard on those architectures for which the frame buffer devices 1879d85025bSMauro Carvalho Chehab(``/dev/fb*``) are not applicable. Do not use ``/dev/console`` 1889d85025bSMauro Carvalho Chehabfor this purpose. 1899d85025bSMauro Carvalho Chehab 1909d85025bSMauro Carvalho ChehabThe console device, ``/dev/console``, is the device to which system 1919d85025bSMauro Carvalho Chehabmessages should be sent, and on which logins should be permitted in 1929d85025bSMauro Carvalho Chehabsingle-user mode. Starting with Linux 2.1.71, ``/dev/console`` is managed 1939d85025bSMauro Carvalho Chehabby the kernel; for previous versions it should be a symbolic link to 1949d85025bSMauro Carvalho Chehabeither ``/dev/tty0``, a specific virtual console such as ``/dev/tty1``, or to 1959d85025bSMauro Carvalho Chehaba serial port primary (``tty*``, not ``cu*``) device, depending on the 1969d85025bSMauro Carvalho Chehabconfiguration of the system. 1979d85025bSMauro Carvalho Chehab 1989d85025bSMauro Carvalho ChehabSerial ports 1999d85025bSMauro Carvalho Chehab++++++++++++ 2009d85025bSMauro Carvalho Chehab 2019d85025bSMauro Carvalho ChehabSerial ports are RS-232 serial ports and any device which simulates 2029d85025bSMauro Carvalho Chehabone, either in hardware (such as internal modems) or in software (such 2039d85025bSMauro Carvalho Chehabas the ISDN driver.) Under Linux, each serial ports has two device 2049d85025bSMauro Carvalho Chehabnames, the primary or callin device and the alternate or callout one. 2059d85025bSMauro Carvalho ChehabEach kind of device is indicated by a different letter. For any 2069d85025bSMauro Carvalho Chehabletter X, the names of the devices are ``/dev/ttyX#`` and ``/dev/cux#``, 2079d85025bSMauro Carvalho Chehabrespectively; for historical reasons, ``/dev/ttyS#`` and ``/dev/ttyC#`` 2089d85025bSMauro Carvalho Chehabcorrespond to ``/dev/cua#`` and ``/dev/cub#``. In the future, it should be 2099d85025bSMauro Carvalho Chehabexpected that multiple letters will be used; all letters will be upper 2109d85025bSMauro Carvalho Chehabcase for the "tty" device (e.g. ``/dev/ttyDP#``) and lower case for the 2119d85025bSMauro Carvalho Chehab"cu" device (e.g. ``/dev/cudp#``). 2129d85025bSMauro Carvalho Chehab 2139d85025bSMauro Carvalho ChehabThe names ``/dev/ttyQ#`` and ``/dev/cuq#`` are reserved for local use. 2149d85025bSMauro Carvalho Chehab 2159d85025bSMauro Carvalho ChehabThe alternate devices provide for kernel-based exclusion and somewhat 2169d85025bSMauro Carvalho Chehabdifferent defaults than the primary devices. Their main purpose is to 2179d85025bSMauro Carvalho Chehaballow the use of serial ports with programs with no inherent or broken 2189d85025bSMauro Carvalho Chehabsupport for serial ports. Their use is deprecated, and they may be 2199d85025bSMauro Carvalho Chehabremoved from a future version of Linux. 2209d85025bSMauro Carvalho Chehab 2219d85025bSMauro Carvalho ChehabArbitration of serial ports is provided by the use of lock files with 2229d85025bSMauro Carvalho Chehabthe names ``/var/lock/LCK..ttyX#``. The contents of the lock file should 2239d85025bSMauro Carvalho Chehabbe the PID of the locking process as an ASCII number. 2249d85025bSMauro Carvalho Chehab 2259d85025bSMauro Carvalho ChehabIt is common practice to install links such as /dev/modem 2269d85025bSMauro Carvalho Chehabwhich point to serial ports. In order to ensure proper locking in the 2279d85025bSMauro Carvalho Chehabpresence of these links, it is recommended that software chase 2289d85025bSMauro Carvalho Chehabsymlinks and lock all possible names; additionally, it is recommended 2299d85025bSMauro Carvalho Chehabthat a lock file be installed with the corresponding alternate 2309d85025bSMauro Carvalho Chehabdevice. In order to avoid deadlocks, it is recommended that the locks 2319d85025bSMauro Carvalho Chehabare acquired in the following order, and released in the reverse: 2329d85025bSMauro Carvalho Chehab 2339d85025bSMauro Carvalho Chehab 1. The symbolic link name, if any (``/var/lock/LCK..modem``) 2349d85025bSMauro Carvalho Chehab 2. The "tty" name (``/var/lock/LCK..ttyS2``) 2359d85025bSMauro Carvalho Chehab 3. The alternate device name (``/var/lock/LCK..cua2``) 2369d85025bSMauro Carvalho Chehab 2379d85025bSMauro Carvalho ChehabIn the case of nested symbolic links, the lock files should be 2389d85025bSMauro Carvalho Chehabinstalled in the order the symlinks are resolved. 2399d85025bSMauro Carvalho Chehab 2409d85025bSMauro Carvalho ChehabUnder no circumstances should an application hold a lock while waiting 2419d85025bSMauro Carvalho Chehabfor another to be released. In addition, applications which attempt 2429d85025bSMauro Carvalho Chehabto create lock files for the corresponding alternate device names 2439d85025bSMauro Carvalho Chehabshould take into account the possibility of being used on a non-serial 2449d85025bSMauro Carvalho Chehabport TTY, for which no alternate device would exist. 2459d85025bSMauro Carvalho Chehab 2469d85025bSMauro Carvalho ChehabPseudoterminals (PTYs) 2479d85025bSMauro Carvalho Chehab++++++++++++++++++++++ 2489d85025bSMauro Carvalho Chehab 2499d85025bSMauro Carvalho ChehabPseudoterminals, or PTYs, are used to create login sessions or provide 2509d85025bSMauro Carvalho Chehabother capabilities requiring a TTY line discipline (including SLIP or 2519d85025bSMauro Carvalho ChehabPPP capability) to arbitrary data-generation processes. Each PTY has 2529d85025bSMauro Carvalho Chehaba master side, named ``/dev/pty[p-za-e][0-9a-f]``, and a slave side, named 2539d85025bSMauro Carvalho Chehab``/dev/tty[p-za-e][0-9a-f]``. The kernel arbitrates the use of PTYs by 2549d85025bSMauro Carvalho Chehaballowing each master side to be opened only once. 2559d85025bSMauro Carvalho Chehab 2569d85025bSMauro Carvalho ChehabOnce the master side has been opened, the corresponding slave device 2579d85025bSMauro Carvalho Chehabcan be used in the same manner as any TTY device. The master and 2589d85025bSMauro Carvalho Chehabslave devices are connected by the kernel, generating the equivalent 2599d85025bSMauro Carvalho Chehabof a bidirectional pipe with TTY capabilities. 2609d85025bSMauro Carvalho Chehab 2619d85025bSMauro Carvalho ChehabRecent versions of the Linux kernels and GNU libc contain support for 2629d85025bSMauro Carvalho Chehabthe System V/Unix98 naming scheme for PTYs, which assigns a common 2639d85025bSMauro Carvalho Chehabdevice, ``/dev/ptmx``, to all the masters (opening it will automatically 2649d85025bSMauro Carvalho Chehabgive you a previously unassigned PTY) and a subdirectory, ``/dev/pts``, 2659d85025bSMauro Carvalho Chehabfor the slaves; the slaves are named with decimal integers (``/dev/pts/#`` 2669d85025bSMauro Carvalho Chehabin our notation). This removes the problem of exhausting the 2679d85025bSMauro Carvalho Chehabnamespace and enables the kernel to automatically create the device 2689d85025bSMauro Carvalho Chehabnodes for the slaves on demand using the "devpts" filesystem. 269