162306a36Sopenharmony_ci.. _admin_devices: 262306a36Sopenharmony_ci 362306a36Sopenharmony_ciLinux allocated devices (4.x+ version) 462306a36Sopenharmony_ci====================================== 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciThis list is the Linux Device List, the official registry of allocated 762306a36Sopenharmony_cidevice numbers and ``/dev`` directory nodes for the Linux operating 862306a36Sopenharmony_cisystem. 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciThe version of this document at lanana.org is no longer maintained. This 1162306a36Sopenharmony_civersion in the mainline Linux kernel is the master document. Updates 1262306a36Sopenharmony_cishall be sent as patches to the kernel maintainers (see the 1362306a36Sopenharmony_ci:ref:`Documentation/process/submitting-patches.rst <submittingpatches>` document). 1462306a36Sopenharmony_ciSpecifically explore the sections titled "CHAR and MISC DRIVERS", and 1562306a36Sopenharmony_ci"BLOCK LAYER" in the MAINTAINERS file to find the right maintainers 1662306a36Sopenharmony_cito involve for character and block devices. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciThis document is included by reference into the Filesystem Hierarchy 1962306a36Sopenharmony_ciStandard (FHS). The FHS is available from https://www.pathname.com/fhs/. 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ciAllocations marked (68k/Amiga) apply to Linux/68k on the Amiga 2262306a36Sopenharmony_ciplatform only. Allocations marked (68k/Atari) apply to Linux/68k on 2362306a36Sopenharmony_cithe Atari platform only. 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciThis document is in the public domain. The authors requests, however, 2662306a36Sopenharmony_cithat semantically altered versions are not distributed without 2762306a36Sopenharmony_cipermission of the authors, assuming the authors can be contacted without 2862306a36Sopenharmony_cian unreasonable effort. 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci.. attention:: 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci DEVICE DRIVERS AUTHORS PLEASE READ THIS 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci Linux now has extensive support for dynamic allocation of device numbering 3662306a36Sopenharmony_ci and can use ``sysfs`` and ``udev`` (``systemd``) to handle the naming needs. 3762306a36Sopenharmony_ci There are still some exceptions in the serial and boot device area. Before 3862306a36Sopenharmony_ci asking for a device number make sure you actually need one. 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci To have a major number allocated, or a minor number in situations 4162306a36Sopenharmony_ci where that applies (e.g. busmice), please submit a patch and send to 4262306a36Sopenharmony_ci the authors as indicated above. 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci Keep the description of the device *in the same format 4562306a36Sopenharmony_ci as this list*. The reason for this is that it is the only way we have 4662306a36Sopenharmony_ci found to ensure we have all the requisite information to publish your 4762306a36Sopenharmony_ci device and avoid conflicts. 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci Finally, sometimes we have to play "namespace police." Please don't be 5062306a36Sopenharmony_ci offended. We often get submissions for ``/dev`` names that would be bound 5162306a36Sopenharmony_ci to cause conflicts down the road. We are trying to avoid getting in a 5262306a36Sopenharmony_ci situation where we would have to suffer an incompatible forward 5362306a36Sopenharmony_ci change. Therefore, please consult with us **before** you make your 5462306a36Sopenharmony_ci device names and numbers in any way public, at least to the point 5562306a36Sopenharmony_ci where it would be at all difficult to get them changed. 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci Your cooperation is appreciated. 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci.. include:: devices.txt 6062306a36Sopenharmony_ci :literal: 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ciAdditional ``/dev/`` directory entries 6362306a36Sopenharmony_ci-------------------------------------- 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ciThis section details additional entries that should or may exist in 6662306a36Sopenharmony_cithe /dev directory. It is preferred that symbolic links use the same 6762306a36Sopenharmony_ciform (absolute or relative) as is indicated here. Links are 6862306a36Sopenharmony_ciclassified as "hard" or "symbolic" depending on the preferred type of 6962306a36Sopenharmony_cilink; if possible, the indicated type of link should be used. 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ciCompulsory links 7262306a36Sopenharmony_ci++++++++++++++++ 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ciThese links should exist on all systems: 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci=============== =============== =============== =============================== 7762306a36Sopenharmony_ci/dev/fd /proc/self/fd symbolic File descriptors 7862306a36Sopenharmony_ci/dev/stdin fd/0 symbolic stdin file descriptor 7962306a36Sopenharmony_ci/dev/stdout fd/1 symbolic stdout file descriptor 8062306a36Sopenharmony_ci/dev/stderr fd/2 symbolic stderr file descriptor 8162306a36Sopenharmony_ci/dev/nfsd socksys symbolic Required by iBCS-2 8262306a36Sopenharmony_ci/dev/X0R null symbolic Required by iBCS-2 8362306a36Sopenharmony_ci=============== =============== =============== =============================== 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ciNote: ``/dev/X0R`` is <letter X>-<digit 0>-<letter R>. 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ciRecommended links 8862306a36Sopenharmony_ci+++++++++++++++++ 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ciIt is recommended that these links exist on all systems: 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci=============== =============== =============== =============================== 9462306a36Sopenharmony_ci/dev/core /proc/kcore symbolic Backward compatibility 9562306a36Sopenharmony_ci/dev/ramdisk ram0 symbolic Backward compatibility 9662306a36Sopenharmony_ci/dev/ftape qft0 symbolic Backward compatibility 9762306a36Sopenharmony_ci/dev/bttv0 video0 symbolic Backward compatibility 9862306a36Sopenharmony_ci/dev/radio radio0 symbolic Backward compatibility 9962306a36Sopenharmony_ci/dev/i2o* /dev/i2o/* symbolic Backward compatibility 10062306a36Sopenharmony_ci/dev/scd? sr? hard Alternate SCSI CD-ROM name 10162306a36Sopenharmony_ci=============== =============== =============== =============================== 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ciLocally defined links 10462306a36Sopenharmony_ci+++++++++++++++++++++ 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ciThe following links may be established locally to conform to the 10762306a36Sopenharmony_ciconfiguration of the system. This is merely a tabulation of existing 10862306a36Sopenharmony_cipractice, and does not constitute a recommendation. However, if they 10962306a36Sopenharmony_ciexist, they should have the following uses. 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci=============== =============== =============== =============================== 11262306a36Sopenharmony_ci/dev/mouse mouse port symbolic Current mouse device 11362306a36Sopenharmony_ci/dev/tape tape device symbolic Current tape device 11462306a36Sopenharmony_ci/dev/cdrom CD-ROM device symbolic Current CD-ROM device 11562306a36Sopenharmony_ci/dev/cdwriter CD-writer symbolic Current CD-writer device 11662306a36Sopenharmony_ci/dev/scanner scanner symbolic Current scanner device 11762306a36Sopenharmony_ci/dev/modem modem port symbolic Current dialout device 11862306a36Sopenharmony_ci/dev/root root device symbolic Current root filesystem 11962306a36Sopenharmony_ci/dev/swap swap device symbolic Current swap device 12062306a36Sopenharmony_ci=============== =============== =============== =============================== 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci``/dev/modem`` should not be used for a modem which supports dialin as 12362306a36Sopenharmony_ciwell as dialout, as it tends to cause lock file problems. If it 12462306a36Sopenharmony_ciexists, ``/dev/modem`` should point to the appropriate primary TTY device 12562306a36Sopenharmony_ci(the use of the alternate callout devices is deprecated). 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ciFor SCSI devices, ``/dev/tape`` and ``/dev/cdrom`` should point to the 12862306a36Sopenharmony_ci*cooked* devices (``/dev/st*`` and ``/dev/sr*``, respectively), whereas 12962306a36Sopenharmony_ci``/dev/cdwriter`` and /dev/scanner should point to the appropriate generic 13062306a36Sopenharmony_ciSCSI devices (/dev/sg*). 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci``/dev/mouse`` may point to a primary serial TTY device, a hardware mouse 13362306a36Sopenharmony_cidevice, or a socket for a mouse driver program (e.g. ``/dev/gpmdata``). 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ciSockets and pipes 13662306a36Sopenharmony_ci+++++++++++++++++ 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ciNon-transient sockets and named pipes may exist in /dev. Common entries are: 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci=============== =============== =============================================== 14162306a36Sopenharmony_ci/dev/printer socket lpd local socket 14262306a36Sopenharmony_ci/dev/log socket syslog local socket 14362306a36Sopenharmony_ci/dev/gpmdata socket gpm mouse multiplexer 14462306a36Sopenharmony_ci=============== =============== =============================================== 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ciMount points 14762306a36Sopenharmony_ci++++++++++++ 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ciThe following names are reserved for mounting special filesystems 15062306a36Sopenharmony_ciunder /dev. These special filesystems provide kernel interfaces that 15162306a36Sopenharmony_cicannot be provided with standard device nodes. 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci=============== =============== =============================================== 15462306a36Sopenharmony_ci/dev/pts devpts PTY slave filesystem 15562306a36Sopenharmony_ci/dev/shm tmpfs POSIX shared memory maintenance access 15662306a36Sopenharmony_ci=============== =============== =============================================== 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ciTerminal devices 15962306a36Sopenharmony_ci---------------- 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ciTerminal, or TTY devices are a special class of character devices. A 16262306a36Sopenharmony_citerminal device is any device that could act as a controlling terminal 16362306a36Sopenharmony_cifor a session; this includes virtual consoles, serial ports, and 16462306a36Sopenharmony_cipseudoterminals (PTYs). 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ciAll terminal devices share a common set of capabilities known as line 16762306a36Sopenharmony_cidisciplines; these include the common terminal line discipline as well 16862306a36Sopenharmony_cias SLIP and PPP modes. 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ciAll terminal devices are named similarly; this section explains the 17162306a36Sopenharmony_cinaming and use of the various types of TTYs. Note that the naming 17262306a36Sopenharmony_ciconventions include several historical warts; some of these are 17362306a36Sopenharmony_ciLinux-specific, some were inherited from other systems, and some 17462306a36Sopenharmony_cireflect Linux outgrowing a borrowed convention. 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ciA hash mark (``#``) in a device name is used here to indicate a decimal 17762306a36Sopenharmony_cinumber without leading zeroes. 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ciVirtual consoles and the console device 18062306a36Sopenharmony_ci+++++++++++++++++++++++++++++++++++++++ 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ciVirtual consoles are full-screen terminal displays on the system video 18362306a36Sopenharmony_cimonitor. Virtual consoles are named ``/dev/tty#``, with numbering 18462306a36Sopenharmony_cistarting at ``/dev/tty1``; ``/dev/tty0`` is the current virtual console. 18562306a36Sopenharmony_ci``/dev/tty0`` is the device that should be used to access the system video 18662306a36Sopenharmony_cicard on those architectures for which the frame buffer devices 18762306a36Sopenharmony_ci(``/dev/fb*``) are not applicable. Do not use ``/dev/console`` 18862306a36Sopenharmony_cifor this purpose. 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ciThe console device, ``/dev/console``, is the device to which system 19162306a36Sopenharmony_cimessages should be sent, and on which logins should be permitted in 19262306a36Sopenharmony_cisingle-user mode. Starting with Linux 2.1.71, ``/dev/console`` is managed 19362306a36Sopenharmony_ciby the kernel; for previous versions it should be a symbolic link to 19462306a36Sopenharmony_cieither ``/dev/tty0``, a specific virtual console such as ``/dev/tty1``, or to 19562306a36Sopenharmony_cia serial port primary (``tty*``, not ``cu*``) device, depending on the 19662306a36Sopenharmony_ciconfiguration of the system. 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_ciSerial ports 19962306a36Sopenharmony_ci++++++++++++ 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ciSerial ports are RS-232 serial ports and any device which simulates 20262306a36Sopenharmony_cione, either in hardware (such as internal modems) or in software (such 20362306a36Sopenharmony_cias the ISDN driver.) Under Linux, each serial ports has two device 20462306a36Sopenharmony_cinames, the primary or callin device and the alternate or callout one. 20562306a36Sopenharmony_ciEach kind of device is indicated by a different letter. For any 20662306a36Sopenharmony_ciletter X, the names of the devices are ``/dev/ttyX#`` and ``/dev/cux#``, 20762306a36Sopenharmony_cirespectively; for historical reasons, ``/dev/ttyS#`` and ``/dev/ttyC#`` 20862306a36Sopenharmony_cicorrespond to ``/dev/cua#`` and ``/dev/cub#``. In the future, it should be 20962306a36Sopenharmony_ciexpected that multiple letters will be used; all letters will be upper 21062306a36Sopenharmony_cicase for the "tty" device (e.g. ``/dev/ttyDP#``) and lower case for the 21162306a36Sopenharmony_ci"cu" device (e.g. ``/dev/cudp#``). 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ciThe names ``/dev/ttyQ#`` and ``/dev/cuq#`` are reserved for local use. 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ciThe alternate devices provide for kernel-based exclusion and somewhat 21662306a36Sopenharmony_cidifferent defaults than the primary devices. Their main purpose is to 21762306a36Sopenharmony_ciallow the use of serial ports with programs with no inherent or broken 21862306a36Sopenharmony_cisupport for serial ports. Their use is deprecated, and they may be 21962306a36Sopenharmony_ciremoved from a future version of Linux. 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ciArbitration of serial ports is provided by the use of lock files with 22262306a36Sopenharmony_cithe names ``/var/lock/LCK..ttyX#``. The contents of the lock file should 22362306a36Sopenharmony_cibe the PID of the locking process as an ASCII number. 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ciIt is common practice to install links such as /dev/modem 22662306a36Sopenharmony_ciwhich point to serial ports. In order to ensure proper locking in the 22762306a36Sopenharmony_cipresence of these links, it is recommended that software chase 22862306a36Sopenharmony_cisymlinks and lock all possible names; additionally, it is recommended 22962306a36Sopenharmony_cithat a lock file be installed with the corresponding alternate 23062306a36Sopenharmony_cidevice. In order to avoid deadlocks, it is recommended that the locks 23162306a36Sopenharmony_ciare acquired in the following order, and released in the reverse: 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ci 1. The symbolic link name, if any (``/var/lock/LCK..modem``) 23462306a36Sopenharmony_ci 2. The "tty" name (``/var/lock/LCK..ttyS2``) 23562306a36Sopenharmony_ci 3. The alternate device name (``/var/lock/LCK..cua2``) 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ciIn the case of nested symbolic links, the lock files should be 23862306a36Sopenharmony_ciinstalled in the order the symlinks are resolved. 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ciUnder no circumstances should an application hold a lock while waiting 24162306a36Sopenharmony_cifor another to be released. In addition, applications which attempt 24262306a36Sopenharmony_cito create lock files for the corresponding alternate device names 24362306a36Sopenharmony_cishould take into account the possibility of being used on a non-serial 24462306a36Sopenharmony_ciport TTY, for which no alternate device would exist. 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ciPseudoterminals (PTYs) 24762306a36Sopenharmony_ci++++++++++++++++++++++ 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ciPseudoterminals, or PTYs, are used to create login sessions or provide 25062306a36Sopenharmony_ciother capabilities requiring a TTY line discipline (including SLIP or 25162306a36Sopenharmony_ciPPP capability) to arbitrary data-generation processes. Each PTY has 25262306a36Sopenharmony_cia master side, named ``/dev/pty[p-za-e][0-9a-f]``, and a slave side, named 25362306a36Sopenharmony_ci``/dev/tty[p-za-e][0-9a-f]``. The kernel arbitrates the use of PTYs by 25462306a36Sopenharmony_ciallowing each master side to be opened only once. 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ciOnce the master side has been opened, the corresponding slave device 25762306a36Sopenharmony_cican be used in the same manner as any TTY device. The master and 25862306a36Sopenharmony_cislave devices are connected by the kernel, generating the equivalent 25962306a36Sopenharmony_ciof a bidirectional pipe with TTY capabilities. 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ciRecent versions of the Linux kernels and GNU libc contain support for 26262306a36Sopenharmony_cithe System V/Unix98 naming scheme for PTYs, which assigns a common 26362306a36Sopenharmony_cidevice, ``/dev/ptmx``, to all the masters (opening it will automatically 26462306a36Sopenharmony_cigive you a previously unassigned PTY) and a subdirectory, ``/dev/pts``, 26562306a36Sopenharmony_cifor the slaves; the slaves are named with decimal integers (``/dev/pts/#`` 26662306a36Sopenharmony_ciin our notation). This removes the problem of exhausting the 26762306a36Sopenharmony_cinamespace and enables the kernel to automatically create the device 26862306a36Sopenharmony_cinodes for the slaves on demand using the "devpts" filesystem. 269