270 lines · 11.9 KB · Text
RawDownload
.. _admin_devices: Linux allocated devices (4.x+ version)====================================== This list is the Linux Device List, the official registry of allocateddevice numbers and ``/dev`` directory nodes for the Linux operatingsystem. The version of this document at lanana.org is no longer maintained.  Thisversion in the mainline Linux kernel is the master document.  Updatesshall be sent as patches to the kernel maintainers (see the:ref:`Documentation/process/submitting-patches.rst <submittingpatches>` document).Specifically explore the sections titled "CHAR and MISC DRIVERS", and"BLOCK LAYER" in the MAINTAINERS file to find the right maintainersto involve for character and block devices. This document is included by reference into the Filesystem HierarchyStandard (FHS).	 The FHS is available from https://www.pathname.com/fhs/. Allocations marked (68k/Amiga) apply to Linux/68k on the Amigaplatform only.	Allocations marked (68k/Atari) apply to Linux/68k onthe Atari platform only. This document is in the public domain.	The authors requests, however,that semantically altered versions are not distributed withoutpermission of the authors, assuming the authors can be contacted withoutan unreasonable effort.  .. attention::   DEVICE DRIVERS AUTHORS PLEASE READ THIS   Linux now has extensive support for dynamic allocation of device numbering  and can use ``sysfs`` and ``udev`` (``systemd``) to handle the naming needs.  There are still some exceptions in the serial and boot device area. Before  asking   for a device number make sure you actually need one.   To have a major number allocated, or a minor number in situations  where that applies (e.g. busmice), please submit a patch and send to  the authors as indicated above.   Keep the description of the device *in the same format  as this list*. The reason for this is that it is the only way we have  found to ensure we have all the requisite information to publish your  device and avoid conflicts.   Finally, sometimes we have to play "namespace police."  Please don't be  offended.  We often get submissions for ``/dev`` names that would be bound  to cause conflicts down the road.  We are trying to avoid getting in a  situation where we would have to suffer an incompatible forward  change.  Therefore, please consult with us **before** you make your  device names and numbers in any way public, at least to the point  where it would be at all difficult to get them changed.   Your cooperation is appreciated. .. include:: devices.txt   :literal: Additional ``/dev/`` directory entries-------------------------------------- This section details additional entries that should or may exist inthe /dev directory.  It is preferred that symbolic links use the sameform (absolute or relative) as is indicated here.  Links areclassified as "hard" or "symbolic" depending on the preferred type oflink; if possible, the indicated type of link should be used. Compulsory links++++++++++++++++ These links should exist on all systems: =============== =============== =============== ===============================/dev/fd		/proc/self/fd	symbolic	File descriptors/dev/stdin	fd/0		symbolic	stdin file descriptor/dev/stdout	fd/1		symbolic	stdout file descriptor/dev/stderr	fd/2		symbolic	stderr file descriptor/dev/nfsd	socksys		symbolic	Required by iBCS-2/dev/X0R	null		symbolic	Required by iBCS-2=============== =============== =============== =============================== Note: ``/dev/X0R`` is <letter X>-<digit 0>-<letter R>. Recommended links+++++++++++++++++ It is recommended that these links exist on all systems:  =============== =============== =============== ===============================/dev/core	/proc/kcore	symbolic	Backward compatibility/dev/ramdisk	ram0		symbolic	Backward compatibility/dev/ftape	qft0		symbolic	Backward compatibility/dev/bttv0	video0		symbolic	Backward compatibility/dev/radio	radio0		symbolic	Backward compatibility/dev/i2o*	/dev/i2o/*	symbolic	Backward compatibility=============== =============== =============== =============================== Suggested earlier ``/dev/scd?`` alternative names for ``/dev/sr?``CD-ROM and other optical drives (using SCSI commands) were removedin ``udev`` version 174 that was released in 2011. Locally defined links+++++++++++++++++++++ The following links may be established locally to conform to theconfiguration of the system.  This is merely a tabulation of existingpractice, and does not constitute a recommendation.  However, if theyexist, they should have the following uses. =============== =============== =============== ===============================/dev/mouse	mouse port	symbolic	Current mouse device/dev/tape	tape device	symbolic	Current tape device/dev/cdrom	CD-ROM device	symbolic	Current CD-ROM device/dev/scanner	scanner		symbolic	Current scanner device/dev/modem	modem port	symbolic	Current dialout device/dev/root	root device	symbolic	Current root filesystem/dev/swap	swap device	symbolic	Current swap device=============== =============== =============== =============================== ``/dev/modem`` should not be used for a modem which supports dialin aswell as dialout, as it tends to cause lock file problems.  If itexists, ``/dev/modem`` should point to the appropriate primary TTY device(the use of the alternate callout devices is deprecated). For SCSI devices, ``/dev/tape`` and ``/dev/cdrom`` should point to the*cooked* devices (``/dev/st*`` and ``/dev/sr*``, respectively), whereas``/dev/scanner`` should point to the appropriate genericSCSI device (``/dev/sg*``). ``/dev/mouse`` may point to a primary serial TTY device, a hardware mousedevice, or a socket for a mouse driver program (e.g. ``/dev/gpmdata``). Sockets and pipes+++++++++++++++++ Non-transient sockets and named pipes may exist in /dev.  Common entries are: =============== =============== ===============================================/dev/printer	socket		lpd local socket/dev/log	socket		syslog local socket/dev/gpmdata	socket		gpm mouse multiplexer=============== =============== =============================================== Mount points++++++++++++ The following names are reserved for mounting special filesystemsunder /dev.  These special filesystems provide kernel interfaces thatcannot be provided with standard device nodes. =============== =============== ===============================================/dev/pts	devpts		PTY slave filesystem/dev/shm	tmpfs		POSIX shared memory maintenance access=============== =============== =============================================== Terminal devices---------------- Terminal, or TTY devices are a special class of character devices.  Aterminal device is any device that could act as a controlling terminalfor a session; this includes virtual consoles, serial ports, andpseudoterminals (PTYs). All terminal devices share a common set of capabilities known as linedisciplines; these include the common terminal line discipline as wellas SLIP and PPP modes. All terminal devices are named similarly; this section explains thenaming and use of the various types of TTYs.  Note that the namingconventions include several historical warts; some of these areLinux-specific, some were inherited from other systems, and somereflect Linux outgrowing a borrowed convention. A hash mark (``#``) in a device name is used here to indicate a decimalnumber without leading zeroes. Virtual consoles and the console device+++++++++++++++++++++++++++++++++++++++ Virtual consoles are full-screen terminal displays on the system videomonitor.  Virtual consoles are named ``/dev/tty#``, with numberingstarting at ``/dev/tty1``; ``/dev/tty0`` is the current virtual console.``/dev/tty0`` is the device that should be used to access the system videocard on those architectures for which the frame buffer devices(``/dev/fb*``) are not applicable. Do not use ``/dev/console``for this purpose. The console device, ``/dev/console``, is the device to which systemmessages should be sent, and on which logins should be permitted insingle-user mode.  Starting with Linux 2.1.71, ``/dev/console`` is managedby the kernel; for previous versions it should be a symbolic link toeither ``/dev/tty0``, a specific virtual console such as ``/dev/tty1``, or toa serial port primary (``tty*``, not ``cu*``) device, depending on theconfiguration of the system. Serial ports++++++++++++ Serial ports are RS-232 serial ports and any device which simulatesone, either in hardware (such as internal modems) or in software (suchas the ISDN driver.)  Under Linux, each serial ports has two devicenames, the primary or callin device and the alternate or callout one.Each kind of device is indicated by a different letter.	 For anyletter X, the names of the devices are ``/dev/ttyX#`` and ``/dev/cux#``,respectively; for historical reasons, ``/dev/ttyS#`` and ``/dev/ttyC#``correspond to ``/dev/cua#`` and ``/dev/cub#``. In the future, it should beexpected that multiple letters will be used; all letters will be uppercase for the "tty" device (e.g. ``/dev/ttyDP#``) and lower case for the"cu" device (e.g. ``/dev/cudp#``). The names ``/dev/ttyQ#`` and ``/dev/cuq#`` are reserved for local use. The alternate devices provide for kernel-based exclusion and somewhatdifferent defaults than the primary devices.  Their main purpose is toallow the use of serial ports with programs with no inherent or brokensupport for serial ports.  Their use is deprecated, and they may beremoved from a future version of Linux. Arbitration of serial ports is provided by the use of lock files withthe names ``/var/lock/LCK..ttyX#``. The contents of the lock file shouldbe the PID of the locking process as an ASCII number. It is common practice to install links such as /dev/modemwhich point to serial ports.  In order to ensure proper locking in thepresence of these links, it is recommended that software chasesymlinks and lock all possible names; additionally, it is recommendedthat a lock file be installed with the corresponding alternatedevice.	 In order to avoid deadlocks, it is recommended that the locksare acquired in the following order, and released in the reverse: 	1. The symbolic link name, if any (``/var/lock/LCK..modem``)	2. The "tty" name (``/var/lock/LCK..ttyS2``)	3. The alternate device name (``/var/lock/LCK..cua2``) In the case of nested symbolic links, the lock files should beinstalled in the order the symlinks are resolved. Under no circumstances should an application hold a lock while waitingfor another to be released.  In addition, applications which attemptto create lock files for the corresponding alternate device namesshould take into account the possibility of being used on a non-serialport TTY, for which no alternate device would exist. Pseudoterminals (PTYs)++++++++++++++++++++++ Pseudoterminals, or PTYs, are used to create login sessions or provideother capabilities requiring a TTY line discipline (including SLIP orPPP capability) to arbitrary data-generation processes.	 Each PTY hasa master side, named ``/dev/pty[p-za-e][0-9a-f]``, and a slave side, named``/dev/tty[p-za-e][0-9a-f]``.  The kernel arbitrates the use of PTYs byallowing each master side to be opened only once. Once the master side has been opened, the corresponding slave devicecan be used in the same manner as any TTY device.  The master andslave devices are connected by the kernel, generating the equivalentof a bidirectional pipe with TTY capabilities. Recent versions of the Linux kernels and GNU libc contain support forthe System V/Unix98 naming scheme for PTYs, which assigns a commondevice, ``/dev/ptmx``, to all the masters (opening it will automaticallygive you a previously unassigned PTY) and a subdirectory, ``/dev/pts``,for the slaves; the slaves are named with decimal integers (``/dev/pts/#``in our notation).  This removes the problem of exhausting thenamespace and enables the kernel to automatically create the devicenodes for the slaves on demand using the "devpts" filesystem.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t