226 lines
12 KiB
HTML
226 lines
12 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>dev(4)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>dev(4)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
dev - device files in /dev
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
Device files are the eyes and ears of the system. Through the device
|
|
files one has access to the disks, terminals and other parts of the
|
|
machine. Single bytes or disk blocks may be transferred to or from a
|
|
device with ordinary <STRONG><A HREF="../man2/read.2.html">read(2)</A></STRONG> or <STRONG><A HREF="../man2/write.2.html">write(2)</A></STRONG> calls, byte positions set with
|
|
<STRONG><A HREF="../man2/lseek.2.html">lseek(2)</A></STRONG>, or more complicated control functions performed with <STRONG>ioctl(2).</STRONG>
|
|
|
|
Device files as found in <STRONG>/dev</STRONG> have several attributes that must be
|
|
considered. Here are two examples as <STRONG>ls</STRONG> <STRONG>-l</STRONG> shows them:
|
|
|
|
brw-rw-rw- 1 root operator 2, 1 Jun 10 1995 fd1
|
|
crw--w---- 1 kjb tty 4, 0 May 11 09:41 console
|
|
|
|
Most attributes are the same as for a regular file and have the same
|
|
function. The file type and the major and minor device numbers are
|
|
special to devices.
|
|
|
|
Character devices are marked with a <STRONG>c</STRONG> as a file type letter. Any I/O on
|
|
a character device is sent down to the device driver without any
|
|
interpretation. This means that a process doing the I/O must know the
|
|
characteristics of the device and deal with them appropriately.
|
|
|
|
Block devices provoke the file system server into buffering the data on
|
|
those devices. Data read or written by processes is passed through the
|
|
file system block cache. Unaligned bytes read or written are extracted
|
|
or reassembled by the file server from or to whole blocks in the cache.
|
|
The file server transfers data to or from the device driver as blocks to
|
|
positions at block size boundaries. These blocks are Minix blocks of
|
|
1024 bytes, disk devices usually have a 512 byte block size. Only block
|
|
devices can be mounted as part of the file system tree if they contain a
|
|
Minix file system.
|
|
|
|
The major device number (2 for <STRONG>fd1</STRONG> and 4 for <STRONG>console</STRONG>) are used by FS to
|
|
find the device driver that manages a device. The minor device number (1
|
|
for <STRONG>fd1</STRONG> and 0 for <STRONG>console</STRONG>) is passed to the driver to select a device
|
|
among a number of related devices that are all managed by that driver.
|
|
The device drivers are usually kernel tasks under Minix, small processes
|
|
that are contained within the address space of the kernel. The following
|
|
tasks and associated devices exist:
|
|
|
|
<STRONG>Memory</STRONG> <STRONG>(major</STRONG> <STRONG>1)</STRONG>
|
|
The <STRONG>ram</STRONG>, <STRONG>mem</STRONG>, <STRONG>kmem</STRONG>, and <STRONG>null</STRONG> devices are managed by the memory task. The
|
|
<STRONG>ram</STRONG> device is a block device for a chunk of memory that is the RAM disk.
|
|
Any byte read from or written to the <STRONG>ram</STRONG> device is copied from or to that
|
|
memory chunk. The <STRONG>mem</STRONG> device is a character device for the entire
|
|
address space of the system, but <STRONG>kmem</STRONG> only for the kernel data area.
|
|
These two devices allow programs like <STRONG><A HREF="../man1/ps.1.html">ps(1)</A></STRONG> to hunt around the system
|
|
looking for interesting bits. The <STRONG>null</STRONG> device is a data sink. It
|
|
happily swallows any bytes written to it, and returns nothing on a read.
|
|
|
|
<STRONG>Floppy</STRONG> <STRONG>disk</STRONG> <STRONG>(major</STRONG> <STRONG>2)</STRONG>
|
|
The <STRONG>fd0</STRONG>, <STRONG>fd0a</STRONG>, <STRONG>fd0b</STRONG>, <STRONG>fd0c</STRONG>, and <STRONG>fd0d</STRONG> block devices are the first floppy
|
|
disk and the four partitions that may exist on a that floppy disk.
|
|
Likewise are <STRONG>fd1</STRONG> and <STRONG>fd1[a-d]</STRONG> the device and partitions for the second
|
|
floppy disk. The floppy disk devices are described in detail in <STRONG><A HREF="../man4/fd.4.html">fd(4)</A></STRONG>.
|
|
Partitioning in general is explained in <STRONG><A HREF="../man4/hd.4.html">hd(4)</A></STRONG>.
|
|
|
|
<STRONG>Hard</STRONG> <STRONG>disk</STRONG> <STRONG>(major</STRONG> <STRONG>3)</STRONG>
|
|
The first hard disk can be accessed by block device <STRONG>hd0</STRONG>. This device
|
|
addresses the entire hard disk from the first to the last sector. A hard
|
|
disk is normally partitioned in up to four primary partitions, <STRONG>hd1</STRONG>, <STRONG>hd2</STRONG>,
|
|
<STRONG>hd3</STRONG>, and <STRONG>hd4</STRONG>. Each of these devices accesses a range of sectors on the
|
|
<STRONG>hd0</STRONG> device. It is customary to give each operating system on a disk a
|
|
primary partition. So the MS-DOS C: "drive" can be on <STRONG>hd1</STRONG>, and Minix can
|
|
be on <STRONG>hd2</STRONG>. Minix wants to have several partitions on its own, so <STRONG>hd2</STRONG> can
|
|
be further subdivided into the subpartitions <STRONG>hd2a</STRONG>, <STRONG>hd2b</STRONG>, <STRONG>hd2c</STRONG>, and <STRONG>hd2d</STRONG>.
|
|
<STRONG>/dev</STRONG> contains devices for the first and second hard disk (<STRONG>hd0</STRONG> and <STRONG>hd5</STRONG>)
|
|
their primary partitions (<STRONG>hd[1-46-9]</STRONG>) and subpartitions thereof
|
|
(<STRONG>hd[1-46-9][a-d]</STRONG>). More detail can be found in <STRONG><A HREF="../man4/hd.4.html">hd(4)</A></STRONG>.
|
|
|
|
<STRONG>Terminals</STRONG> <STRONG>(minor</STRONG> <STRONG>4)</STRONG>
|
|
The TTY driver manages the system console device, aptly named <STRONG>console</STRONG>,
|
|
the serial lines, <STRONG>tty00</STRONG> and <STRONG>tty01</STRONG>, and the pseudo ttys. Through the
|
|
console device one can display characters on a screen attached to a
|
|
monochrome, Hercules, color, or VGA adapter. The <STRONG>ttyc1</STRONG>, <STRONG>ttyc2</STRONG>, etc.
|
|
devices are the so-called "virtual consoles" that share the one console
|
|
display. One can select which virtual console is to be visible on the
|
|
screen and take input from the keyboard. To allow remote login the
|
|
devices with minor numbers of 128 or higher offer virtual terminals.
|
|
These pseudo ttys come in tty, pty pairs that form a pipe between
|
|
processes running under the tty, and a controlling process attached to
|
|
the pty side. See also <STRONG><A HREF="../man4/console.4.html">console(4)</A></STRONG>, and <STRONG><A HREF="../man4/tty.4.html">tty(4)</A></STRONG>.
|
|
|
|
<STRONG>Anonymous</STRONG> <STRONG>TTY</STRONG> <STRONG>(major</STRONG> <STRONG>5)</STRONG>
|
|
This is just one device named <STRONG>tty</STRONG> that is a synonym for the controlling
|
|
tty of a process. This device is not managed by any device driver, but
|
|
is handled by FS itself. A process can get access to the terminal it is
|
|
running under by using <STRONG>/dev/tty</STRONG>.
|
|
|
|
<STRONG>Line</STRONG> <STRONG>printer</STRONG> <STRONG>(major</STRONG> <STRONG>6)</STRONG>
|
|
The <STRONG>lp</STRONG> device sends any bytes written to it to the printer.
|
|
|
|
<STRONG>TCP/IP</STRONG> <STRONG>(major</STRONG> <STRONG>7)</STRONG>
|
|
The TCP/IP task is not a kernel task, but a server like MM and FS. It
|
|
sits between FS and the DP8390 task that manages the ethernet boards.
|
|
Together they implement the TCP/IP protocol. See also <STRONG><A HREF="../man4/ip.4.html">ip(4)</A></STRONG>.
|
|
|
|
<STRONG>CD</STRONG>-<STRONG>ROM</STRONG> <STRONG>(major</STRONG> <STRONG>8)</STRONG>
|
|
This is the CD-ROM driver for the Mitsumi proprietary CD-ROM interface.
|
|
The <STRONG>cd0</STRONG> device addresses the whole CD, with extra <STRONG>cd[1-4]</STRONG> and
|
|
<STRONG>cd[1-4][a-d]</STRONG> devices for if the CD also contains partitions with Minix
|
|
file systems.
|
|
|
|
<STRONG>SCSI</STRONG> <STRONG>disks</STRONG> <STRONG>and</STRONG> <STRONG>tapes</STRONG> <STRONG>(major</STRONG> <STRONG>10)</STRONG>
|
|
The <STRONG>sd*</STRONG> devices are disks in the same way as the <STRONG>hd*</STRONG> devices. Except
|
|
that these disks are SCSI disks attached to an Adaptec 1540 controller or
|
|
compatible. The driver also manages the <STRONG>rst*</STRONG> and <STRONG>nrst*</STRONG> tape devices
|
|
(rewinding or non-rewinding). See <STRONG><A HREF="../man4/sd.4.html">sd(4)</A></STRONG>.
|
|
|
|
<STRONG>Audio</STRONG> <STRONG>(major</STRONG> <STRONG>13)</STRONG>
|
|
The <STRONG>audio</STRONG> device can be used to produce or record air vibrations using a
|
|
Soundblaster 16 type audio card. See <STRONG><A HREF="../man4/audio.4.html">audio(4)</A></STRONG>.
|
|
|
|
<STRONG>Mixer</STRONG> <STRONG>(major</STRONG> <STRONG>14)</STRONG>
|
|
The <STRONG>mixer</STRONG> device is used to control the audio driver.
|
|
|
|
|
|
</PRE>
|
|
<H2>FILES</H2><PRE>
|
|
|
|
<STRONG>/dev/*</STRONG> All Minix devices
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man2/read.2.html">read(2)</A></STRONG>, <STRONG><A HREF="../man2/write.2.html">write(2)</A></STRONG>, <STRONG><A HREF="../man2/lseek.2.html">lseek(2)</A></STRONG>, <STRONG><A HREF="../man2/ioctl.2.html">ioctl(2)</A></STRONG>, <STRONG><A HREF="../man4/console.4.html">console(4)</A></STRONG>, <STRONG><A HREF="../man4/fd.4.html">fd(4)</A></STRONG>, <STRONG><A HREF="../man4/hd.4.html">hd(4)</A></STRONG>, <STRONG><A HREF="../man4/ip.4.html">ip(4)</A></STRONG>,
|
|
<STRONG><A HREF="../man4/sd.4.html">sd(4)</A></STRONG>, <STRONG><A HREF="../man4/tty.4.html">tty(4)</A></STRONG>, <STRONG><A HREF="../man8/MAKEDEV.8.html">MAKEDEV(8)</A></STRONG>.
|
|
|
|
|
|
</PRE>
|
|
<H2>DIAGNOSTICS</H2><PRE>
|
|
There are five prominent errors that processes accessing device files may
|
|
provoke:
|
|
|
|
ENODEV - No such device
|
|
There is no driver managing the device class this device belongs to.
|
|
Either the driver is configured out, or it is not loaded (inet).
|
|
|
|
ENXIO - No such device or address
|
|
This device is not available. Either the driver does not support it
|
|
at all, or the hardware isn't available, i.e. accessing the second
|
|
disk on a system with only one disk.
|
|
|
|
EACCES - Permission denied
|
|
This error may cause a lot of head scratching if <STRONG>ls</STRONG> <STRONG>-l</STRONG> shows a
|
|
device file to be writable. The media you are trying to access is
|
|
simply physically write protected!
|
|
|
|
EINVAL - Invalid argument
|
|
Devices may not like reads or writes that are not block multiples,
|
|
or very big transfers, etc. The device manual page should list the
|
|
limits.
|
|
|
|
EIO - I/O error
|
|
This may be a real I/O error, i.e. a read or write on the device
|
|
failing due to a media error. But it may also be the result of an
|
|
operation that a device can't do, or an empty tape drive, etc.
|
|
|
|
|
|
</PRE>
|
|
<H2>NOTES</H2><PRE>
|
|
Some devices are not present by default. The <STRONG>MAKEDEV</STRONG> script knows how to
|
|
make them.
|
|
|
|
<STRONG>MS</STRONG>-<STRONG>DOS</STRONG> <STRONG>equivalents</STRONG>
|
|
The names of MS-DOS devices map to Minix devices as follows:
|
|
|
|
A: fd0
|
|
B: fd1
|
|
C: hd1, sd1 (usually the first partition)
|
|
D: hd6, sd1, sd6 (or an extended partition)
|
|
CON console
|
|
COM1 tty00 (UNIX counts from 0)
|
|
LPT1 lp
|
|
|
|
|
|
</PRE>
|
|
<H2>AUTHOR</H2><PRE>
|
|
Kees J. Bot (kjb@cs.vu.nl)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|