Added man pages.
This commit is contained in:
@@ -0,0 +1,268 @@
|
||||
.TH CONSOLE 4
|
||||
.SH NAME
|
||||
console, keyboard, log \- system console
|
||||
.SH DESCRIPTION
|
||||
The TTY device driver manages two devices related to the main user
|
||||
interface, the system screen and the keyboard. These two together are
|
||||
named "the Console".
|
||||
.SS "The Screen"
|
||||
The screen of a PC can be managed by a Monochrome Display Adapter, a
|
||||
Hercules card, a Color Graphics Adapter, an Enhanced Graphics Adapter,
|
||||
or a Video Graphics Array. To the console driver these devices are
|
||||
seen as a block of video memory into which characters can be written to
|
||||
be displayed, an I/O register that sets the video memory origin to the
|
||||
character that is to be displayed on the top-left position of the
|
||||
screen, and an I/O register that sets the position of the hardware
|
||||
cursor. Each character within video memory is a two-byte word. The low
|
||||
byte is the character code, and the high byte is the "attribute byte",
|
||||
a set of bits that controls the way the character is displayed,
|
||||
character and background colours for a colour card, or
|
||||
intensity/underline/reverse video for monochrome.
|
||||
.PP
|
||||
These are the characteristics of the adapters in text mode:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.ta +15n +15n
|
||||
Adapter Usable memory Mono/Colour
|
||||
.ta +1n +15n +15n
|
||||
MDA 4K M
|
||||
Hercules 4K M
|
||||
CGA 16K C
|
||||
EGA 32K M or C
|
||||
VGA 32K M or C
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
MDA and Hercules are the same to the console driver, because the graphics
|
||||
mode of the Hercules is of no use to Minix. EGA and VGA are also mostly
|
||||
seen as the same in text mode. An EGA adapter is either a monochrome or a
|
||||
colour device depending on the screen attached to it. A VGA adapter can run
|
||||
in either monochrome or colour (grayscale) mode depending on how the Boot
|
||||
Monitor has initialized it.
|
||||
.PP
|
||||
The driver uses the video origin to avoid copying the screen contents when
|
||||
scrolling up or down. Instead the origin is simply moved one line. This is
|
||||
named "hardware scrolling", as opposed to copying memory: "software
|
||||
scrolling".
|
||||
.PP
|
||||
The video origin is also used to implement several virtual consoles inside
|
||||
the video memory of the adapter. Each virtual console gets a segment of
|
||||
video memory. The driver chooses which console to display by moving the
|
||||
video origin. Note that an MDA or Hercules adapter can only support one
|
||||
console. CGA can support up to four 80x25 consoles, and EGA and VGA can
|
||||
have eight. It is best to configure one less console to leave some video
|
||||
memory free so that hardware scrolling has some space to work in.
|
||||
.PP
|
||||
Character codes are used as indices into a display font that is stored in the
|
||||
adapter. The default font is the IBM character set, which is an ASCII
|
||||
character set in the low 128 codes, and a number of mathematical, greek,
|
||||
silly graphics, and accented characters in the upper 128 codes. This font
|
||||
is fixed in the MDA, Hercules and CGA adapters, but can be replaced by a
|
||||
user selected font for the EGA and VGA adapters.
|
||||
.PP
|
||||
A number of control characters and escape sequences are implemented by the
|
||||
driver. The result is upward compatible with the ANSI standard terminal.
|
||||
The
|
||||
.BR termcap (5)
|
||||
type is
|
||||
.BR minix .
|
||||
Normal characters written to the console are displayed at the cursor
|
||||
position and the cursor is advanced one column to the right. If an entire
|
||||
line is filled then the cursor wraps to the first column of the next line
|
||||
when the next character must be displayed. The screen is scrolled up if
|
||||
needed to start a new line. Some characters have special effects when sent
|
||||
to the console. Some even have arguments in the form of comma separated
|
||||
decimal numbers. These numbers default to the lowest possible value when
|
||||
omitted. The top-left character is at position (1, 1). The following
|
||||
control characters and escape sequences are implemented by the console:
|
||||
.PP
|
||||
.ta +10n +20n
|
||||
Sequence Name Function
|
||||
.in +31n
|
||||
.ti -30n
|
||||
^@ Null Ignored (padding character)
|
||||
.ti -30n
|
||||
^G Bell Produce a short tone from the speaker
|
||||
.ti -30n
|
||||
^H Backspace Move the cursor back one column, wrapping from the
|
||||
left edge up one line to the right edge
|
||||
.ti -30n
|
||||
^I Horizontal Tab Move to the next tab stop, with each tab stop at
|
||||
columns 1, 9, 25, etc. Wrap to the next line if necessary.
|
||||
.ti -30n
|
||||
^J Line Feed Move one line down, scrolling the screen up if
|
||||
necessary
|
||||
.ti -30n
|
||||
^K Vertical Tab Same as LF
|
||||
.ti -30n
|
||||
^L Form Feed Same as LF
|
||||
.ti -30n
|
||||
^M Carriage Return Move to column 1
|
||||
.ti -30n
|
||||
^[ Escape Start of an escape sequence
|
||||
.ti -30n
|
||||
^[M Reverse Index Move one line up, scrolling the screen down if
|
||||
necessary
|
||||
.ti -30n
|
||||
^[[\fIn\fPA Cursor Up Move the cursor up \fIn\fP lines
|
||||
.ti -30n
|
||||
^[[\fIn\fPB Cursor Down Move the cursor down \fIn\fP lines
|
||||
.ti -30n
|
||||
^[[\fIn\fPC Cursor Forward Move the cursor right \fIn\fP columns
|
||||
.ti -30n
|
||||
^[[\fIn\fPD Cursor Backward Move the cursor left \fIn\fP columns
|
||||
.ti -30n
|
||||
^[[\fIm\fP;\fIn\fPH Cursor Position Move the cursor to line \fIm\fP,
|
||||
column \fIn\fP
|
||||
.ti -30n
|
||||
^[[\fIs\fPJ Erase in Display Clear characters as follows:
|
||||
.br
|
||||
\fIs\fP = 0: From cursor to end of screen
|
||||
.br
|
||||
\fIs\fP = 1: From start of screen to cursor
|
||||
.br
|
||||
\fIs\fP = 2: Entire screen
|
||||
.ti -30n
|
||||
^[[\fIs\fPK Erase in Line Clear characters as follows:
|
||||
.br
|
||||
\fIs\fP = 0: From cursor to end of line
|
||||
.br
|
||||
\fIs\fP = 1: From start of line to cursor
|
||||
.br
|
||||
\fIs\fP = 2: Entire line
|
||||
.ti -30n
|
||||
^[[\fIn\fPL Insert Lines Insert \fIn\fP blank lines
|
||||
.ti -30n
|
||||
^[[\fIn\fPM Delete Lines Delete \fIn\fP lines
|
||||
.ti -30n
|
||||
^[[\fIn\fP@ Insert Characters Insert \fIn\fP blank characters
|
||||
.ti -30n
|
||||
^[[\fIn\fPP Delete Characters Delete \fIn\fP characters
|
||||
.ti -30n
|
||||
^[[\fIn\fPm Character Attribute Set character attribute as follows:
|
||||
.br
|
||||
\fIn\fP = 0: Normal (default) attribute
|
||||
.br
|
||||
\fIn\fP = 1: Bold (high intensity fg colour)
|
||||
.br
|
||||
\fIn\fP = 4: Underline (mono) / Cyan (colour)
|
||||
.br
|
||||
\fIn\fP = 5: Blinking
|
||||
.br
|
||||
\fIn\fP = 7: Reverse Video
|
||||
.br
|
||||
\fIn\fP = 30: Black foreground colour
|
||||
.br
|
||||
\fIn\fP = 31: Red
|
||||
.br
|
||||
\fIn\fP = 32: Green
|
||||
.br
|
||||
\fIn\fP = 33: Brown
|
||||
.br
|
||||
\fIn\fP = 34: Blue
|
||||
.br
|
||||
\fIn\fP = 35: Magenta
|
||||
.br
|
||||
\fIn\fP = 36: Cyan
|
||||
.br
|
||||
\fIn\fP = 37: Light Gray
|
||||
.br
|
||||
\fIn\fP = 39: Default fg colour (lt gray)
|
||||
.br
|
||||
\fIn\fP = 40\-47: Same for background colour
|
||||
.br
|
||||
\fIn\fP = 49: Default bg colour (black)
|
||||
.br
|
||||
Note: The "bold" versions of black, brown and lt gray become dark gray,
|
||||
yellow and white.
|
||||
.in -31n
|
||||
.PP
|
||||
The console device implements the following ioctl to copy a font into
|
||||
font memory on EGA and VGA adapters:
|
||||
.PP
|
||||
.RS
|
||||
.BI "ioctl(" fd ", TIOCSFON, u8_t " font "[256][32]);"
|
||||
.RE
|
||||
.PP
|
||||
Font memory consists of 256 character definitions of 32 lines per character
|
||||
and 8 pixels per line. The first line is the topmost line of the character.
|
||||
The leftmost pixel is lit if the most significant bit of a line is set, etc.
|
||||
How many lines are used depends on the current video mode. The 80x25 video
|
||||
mode used by Minix has an 8x16 character cell, 80x28 has 8x14 characters,
|
||||
and 132x43 or 132x50 has 8x8 characters. The boot variable
|
||||
.B console
|
||||
is used by both the Boot Monitor and the console driver to set the video
|
||||
mode, software scrolling on/off, and VGA screen blank timeout. See
|
||||
.BR boot (8).
|
||||
.SS "The Keyboard"
|
||||
The keyboard produces key codes for each key that is pressed. These keys
|
||||
are transformed into character codes or sequences according to the current
|
||||
keyboard translation table. The format of this table is described in
|
||||
.BR keymap (5).
|
||||
The character codes can be read from the console device unless they map to
|
||||
special hotkeys. The hotkeys are as follows:
|
||||
.PP
|
||||
.ta +17n
|
||||
Name Key Function
|
||||
.in +18n
|
||||
.ti -17n
|
||||
CTRL\-ALT\-DEL Send an abort signal to process 1 (init). Init then
|
||||
halts the system
|
||||
.ti -17n
|
||||
CTRL\-ALT\-KP-. Likewise for keypad period
|
||||
.ti -17n
|
||||
F1 Process table dump
|
||||
.ti -17n
|
||||
F2 Show memory map
|
||||
.ti -17n
|
||||
F3 Toggle software/hardware scrolling
|
||||
.ti -17n
|
||||
F5 Show network statistics
|
||||
.ti -17n
|
||||
CTRL\-F7 Send a quit signal to all processes connected to the console
|
||||
.ti -17n
|
||||
CTRL\-F8 Send an interrupt signal
|
||||
.ti -17n
|
||||
CTRL\-F9 Send a kill signal. If CTRL\-F8 or CTRL\-F7 don't get 'em,
|
||||
then this surely will. These keys are for disaster recovery. You would
|
||||
normally use DEL and CTRL\-\e to send interrupt and quit signals.
|
||||
.\" .ig VC
|
||||
.ti -17n
|
||||
ALT\-F1 Select virtual console 0 (/dev/console)
|
||||
.ti -17n
|
||||
ALT\-F2 Select virtual console 1 (/dev/ttyc1)
|
||||
.ti -17n
|
||||
ALT\-F(\fIn\fP+1) Select virtual console \fIn\fP
|
||||
(/dev/ttyc\fIn\fP)
|
||||
.ti -17n
|
||||
ALT\-Left Select previous virtual console
|
||||
.ti -17n
|
||||
ALT\-Right Select next virtual console
|
||||
.\" ..
|
||||
.in -18n
|
||||
.PP
|
||||
.\"XXX
|
||||
The keyboard map is set with the
|
||||
.B KIOCSMAP
|
||||
ioctl whose precise details are currently hidden in the
|
||||
.B loadkeys
|
||||
utility.
|
||||
.SS "Log device"
|
||||
The
|
||||
.B log
|
||||
device can be used by processes to print debug messages onto the console.
|
||||
The console is a terminal type device, so it is taken from processes when a
|
||||
session leader exits. This does not happen with the log device.
|
||||
.SH "SEE ALSO"
|
||||
.BR tty (4),
|
||||
.BR loadkeys (1),
|
||||
.BR keymap (5),
|
||||
.BR boot (8).
|
||||
.SH NOTES
|
||||
Output processing turns Line Feeds into CR LF sequences. Don't let this
|
||||
surprise you. Either turn off output processing or use one of the synonyms
|
||||
for LF.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
.\" minor editing of man page by asw 07.08.96
|
||||
@@ -0,0 +1,387 @@
|
||||
.TH CONTROLLER 4
|
||||
.SH NAME
|
||||
controller, disk, tape, at, bios, esdi, aha1540, ncr810, dosfile, fatfile \- controllers, disks and tapes
|
||||
.SH DESCRIPTION
|
||||
.de SP
|
||||
.if t .sp 0.4
|
||||
.if n .sp
|
||||
..
|
||||
The
|
||||
.BI c n *
|
||||
family of devices refer to drivers that control disks, disk like devices,
|
||||
and tapes. Minix contains a number of drivers for several different
|
||||
controllers. These controllers can have disks, cdroms and tapes attached to
|
||||
them. Boot Monitor variables specify which drivers are activated using
|
||||
the variables
|
||||
.BR c0 ,
|
||||
.BR c1 ,
|
||||
etc. The names of the devices in
|
||||
.BR /dev
|
||||
that correspond with the driver for controller 0 are all named beginning
|
||||
with
|
||||
.BR c0 .
|
||||
.PP
|
||||
For each controller, the minor device numbers are organized as follows:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.ta +\w'122-127nnmm'u +\w'd0p0s0nnmm'u +\w'disk 0, part 0, subpart 0nnmm'u
|
||||
.ft B
|
||||
minor device what? obsolete
|
||||
.ft P
|
||||
0 d0 disk 0 hd0
|
||||
1 d0p0 disk 0, partition 0 hd1
|
||||
2 d0p1 disk 0, partition 1 hd2
|
||||
3 d0p2 disk 0, partition 2 hd3
|
||||
4 d0p3 disk 0, partition 3 hd4
|
||||
5 d1 disk 1 hd5
|
||||
6 d1p0 disk 1, partition 0 hd6
|
||||
7 d1p1 disk 1, partition 1 hd7
|
||||
8 d1p2 disk 1, partition 2 hd8
|
||||
9 d1p3 disk 1, partition 3 hd9
|
||||
\&... ...
|
||||
39 d7p3 disk 7, partition 3 hd39
|
||||
.SP
|
||||
64 t0n tape 0, non-rewinding
|
||||
65 t0 tape 0, rewind on close
|
||||
66 t1n tape 1, non-rewinding
|
||||
67 t1 tape 1, rewind on close
|
||||
\&... ...
|
||||
78 t7n tape 7, non-rewinding
|
||||
79 t7 tape 7, rewind on close
|
||||
.SP
|
||||
120 r0 raw access device 0
|
||||
121 r1 raw access device 1
|
||||
\&... ...
|
||||
127 r7 raw access device 7
|
||||
.SP
|
||||
128 d0p0s0 disk 0, part 0, subpart 0 hd1a
|
||||
129 d0p0s1 disk 0, part 0, subpart 1 hd1b
|
||||
130 d0p0s2 disk 0, part 0, subpart 2 hd1c
|
||||
131 d0p0s3 disk 0, part 0, subpart 3 hd1d
|
||||
132 d0p1s0 disk 0, part 1, subpart 0 hd2a
|
||||
\&... ...
|
||||
144 d1p0s0 disk 1, part 0, subpart 0 hd6a
|
||||
\&... ...
|
||||
255 d7p3s3 disk 7, part 3, subpart 3 hd39d
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The device names in
|
||||
.B /dev
|
||||
also name the controller, of course, so the usual place for the Minix
|
||||
root device, the first subpartition of the second partition of disk 0 on
|
||||
controller 0 is
|
||||
.BR /dev/c0d0p1s0 .
|
||||
Note that everything is numbered from 0! The first controller is controller
|
||||
0, the first disk is disk 0, etc. So the second partition is
|
||||
.BR p1 .
|
||||
.PP
|
||||
The fourth column in the table above shows the disk devices names that were
|
||||
used by previous versions of Minix for what is now controller 0. These
|
||||
devices are no longer present in
|
||||
.BR /dev .
|
||||
.SS Disks
|
||||
Most disks are arrays of 512 byte sectors. The disk devices are normally
|
||||
block devices, which means they are block buffered by the Minix file system
|
||||
cache using 1024 byte blocks. The FS cache allows I/O at any byte offset,
|
||||
and takes care of cutting and pasting incomplete blocks together. If one
|
||||
creates a character device for a disk device, then I/O must be in multiples
|
||||
of the disk block size.
|
||||
.PP
|
||||
For each disk there is a device that covers the entire disk, these are named
|
||||
.BR c0d0 ,
|
||||
.BR c0d1 ,
|
||||
etc, up to
|
||||
.B c0d7
|
||||
for controller 0. If a partition table is placed in the first sector of the
|
||||
disk, then the disk is subdivided into regions named partitions. Up to four
|
||||
partitions may be defined, named
|
||||
.BR c0d0p0
|
||||
to
|
||||
.BR c0d0p3
|
||||
for disk 0 on controller 0. To make things interesting you can also place a
|
||||
partition table in the first sector of a Minix partition, which divides the
|
||||
partition into up to four subpartitions. Normally Minix is installed into a
|
||||
single partition, with the root, swap and /usr file systems in subpartitions.
|
||||
.PP
|
||||
If a partition is an extended partition then it contains a linked list of
|
||||
partition tables each of which may specify a logical partition. Up to four
|
||||
of these logical partitions are presented by the driver as subpartitions of
|
||||
the extended partition.
|
||||
.PP
|
||||
A sector containing a partition table starts with 446 bytes of boot code,
|
||||
followed by four partition table entries of 16 bytes each, and ends with
|
||||
the magic number 0xAA55 (little endian, so first 0x55 then 0xAA.) Partition
|
||||
table information is defined in <ibm/partition.h>:
|
||||
.PP
|
||||
.nf
|
||||
.ta +2n +29n +37n
|
||||
/* Description of entry in the partition table. */
|
||||
|
||||
struct part_entry {
|
||||
unsigned char bootind; /* boot indicator 0/ACTIVE_FLAG */
|
||||
unsigned char start_head; /* head value for first sector */
|
||||
unsigned char start_sec; /* sector value + high 2 cyl bits */
|
||||
unsigned char start_cyl; /* low 8 cylinder bits */
|
||||
unsigned char sysind; /* system indicator */
|
||||
unsigned char last_head; /* h/s/c for the last sector */
|
||||
unsigned char last_sec;
|
||||
unsigned char last_cyl;
|
||||
unsigned long lowsec; /* logical first sector */
|
||||
unsigned long size; /* size of partition in sectors */
|
||||
};
|
||||
|
||||
.ta +24n +7n +37n
|
||||
#define ACTIVE_FLAG 0x80 /* value for active in bootind field */
|
||||
#define NR_PARTITIONS 4 /* number of entries in table */
|
||||
#define PART_TABLE_OFF 0x1BE /* offset of table in boot sector */
|
||||
|
||||
/* Partition types (sysind). */
|
||||
#define NO_PART 0x00 /* unused entry */
|
||||
#define MINIX_PART 0x81 /* Minix partition type */
|
||||
.fi
|
||||
.PP
|
||||
The cylinder numbers are encoded in a very strange way, bits 8 and 9 are
|
||||
in the high two bits of the sector number. The sector numbers count from 1,
|
||||
not 0! More useful are the lowsec and size fields however, they simply give
|
||||
the location of the partition as an absolute sector offset and length within
|
||||
the drive.
|
||||
.PP
|
||||
The partition table entry defined above is specific to IBM type disks. The
|
||||
device drivers use another partition entry structure to pass information on
|
||||
a partition. This is what <minix/partition.h> looks like:
|
||||
.sp
|
||||
.nf
|
||||
.ta +2n +25n
|
||||
struct partition {
|
||||
u64_t base; /* byte offset to the partition start */
|
||||
u64_t size; /* number of bytes in the partition */
|
||||
unsigned cylinders; /* disk geometry for partitioning */
|
||||
unsigned heads;
|
||||
unsigned sectors;
|
||||
};
|
||||
.fi
|
||||
.PP
|
||||
The base and size fields are the byte offset and length of a partition.
|
||||
The geometry of the disk is also given for the benefit of
|
||||
partition table editors. This information can be obtained from an open disk
|
||||
device with the call:
|
||||
.sp
|
||||
.RS
|
||||
.ft B
|
||||
ioctl(\fIfd\fP, DIOCGETP, &\fIentry\fP);
|
||||
.ft R
|
||||
.RE
|
||||
.sp
|
||||
One can change the placement of the device to the lowsec and size fields of
|
||||
.I entry
|
||||
by using the
|
||||
.B DIOCSETP
|
||||
call instead. Only the base and size fields are used for
|
||||
.BR DIOCSETP .
|
||||
.PP
|
||||
The partition tables when read from disk by the driver are checked and
|
||||
truncated to fit within the primary partition or drive. The first sector
|
||||
is normally left free for the partition table.
|
||||
.PP
|
||||
The partition tables are read when the in-use count (opens and mounts)
|
||||
changes from 0 to 1. So an idle disk is automatically repartitioned on the
|
||||
next access. This means that DIOCSETP only has effect if the disk is in
|
||||
use.
|
||||
.SS "Disk-like devices"
|
||||
Devices like a CD-ROM are treated as read-only disks, and can be accessed
|
||||
using disk devices. A CD-ROM usually has a block size of 2048 bytes, but
|
||||
the driver knows this, and allows one to read at any byte offset by reading
|
||||
what isn't needed into a scratch buffer.
|
||||
.SS Tapes
|
||||
There are two kinds of tape devices: Non-rewinding, and rewind-on-close.
|
||||
The non-rewinding devices treat the tape as a series of files. The
|
||||
rewind-on-close devices look at the tape as a single file, and when you close
|
||||
such a device the tape is told to rewind.
|
||||
See
|
||||
.BR mt (1),
|
||||
and
|
||||
.BR mtio (4)
|
||||
for a description of the commands that may be sent to the tape, either from
|
||||
the command prompt or from a program.
|
||||
.PP
|
||||
There are two kinds of tape drives: Fixed and variable block size tape
|
||||
drives. Examples of the first kind are cartridge
|
||||
tapes, with a fixed 512 bytes block size. An Exabyte tape drive has a
|
||||
variable block size, with a minimum of 1 byte and a maximum of 245760 bytes
|
||||
(see the documentation of such devices.)
|
||||
The maximum is truncated to 32767 bytes for Minix-86 and 61440 bytes for
|
||||
Minix-vmd, because the driver can't move more bytes in a single request.
|
||||
.PP
|
||||
A read or write to a fixed block size tape must be a precise multiple of the
|
||||
block size, any other count gives results in an I/O error. A read from a
|
||||
variable block sized tape must be large enough to accept the block that is
|
||||
read, otherwise an I/O error will be returned. A write can be any size
|
||||
above the minimum, creating a block of that size. If the write count is
|
||||
larger than the maximum block size then more blocks are written until the
|
||||
count becomes zero. The last block must be larger than the minimum of
|
||||
course. (This minimum is often as small as 1 byte, as for the Exabyte.)
|
||||
.PP
|
||||
The
|
||||
.B mt blksize
|
||||
command may be used to select a fixed block size for a variable block sized
|
||||
tape. This will speed up I/O considerably for small block sizes. (Some
|
||||
systems can only use fixed mode and will write an Exabyte tape with 1024
|
||||
byte blocks, which read very slow in variable mode.)
|
||||
.PP
|
||||
A tape is a sequence of blocks and filemarks. A tape may be opened and
|
||||
blocks may be read from it upto a filemark, after that all further reads
|
||||
return 0. After the tape is closed and reopened one can read the blocks
|
||||
following the filemark if using a non-rewinding device. This makes the tape
|
||||
look like a sequence of files.
|
||||
.PP
|
||||
If a tape has been written to or opened in write-only mode, then a filemark
|
||||
is written if the tape is closed or if a space command is issued. No extra
|
||||
filemark is written if the drive is instructed to write filemarks.
|
||||
.SS "Raw Access Devices"
|
||||
Under Minix-vmd one can use the raw access devices to program a SCSI
|
||||
device entirely from user mode. The disk and tape devices probe for devices
|
||||
when opened, start disks and load tapes, but the raw access devices do
|
||||
nothing at all. Given an open file descriptor to any SCSI character device
|
||||
(not just the raw access devices) one can use the following ioctl:
|
||||
.PP
|
||||
.RS
|
||||
ioctl(fd, SCIOCCMD, &scsicmd)
|
||||
.RE
|
||||
.PP
|
||||
The structure whose address is passed as the third argument is defined
|
||||
in <sys/scsi.h> as follows:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
struct scsicmd {
|
||||
void *cmd;
|
||||
size_t cmdlen;
|
||||
void *buf;
|
||||
size_t buflen;
|
||||
void *sense;
|
||||
size_t senselen;
|
||||
int dir;
|
||||
};
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
.B Cmd
|
||||
and
|
||||
.B cmdlen
|
||||
hold the address and length of an object holding a Group 0 or Group 1
|
||||
SCSI command. The next two fields describe a buffer of at most 8 kilobytes
|
||||
used in the data in or out phase.
|
||||
.B Dir
|
||||
is 0 if data is to be read from the device, 1 if data is written to the
|
||||
device. If the ioctl succeeds then 0 is returned, otherwise -1 with
|
||||
.B errno
|
||||
set to
|
||||
.B EIO
|
||||
and the request sense info returned in the buffer described by the sense and
|
||||
senselen fields. If the sense key is zero on error then a host adapter
|
||||
error occurred, this means that the device is most likely turned off or not
|
||||
present.
|
||||
.SH DRIVERS
|
||||
By setting the Boot variables
|
||||
.BR c0
|
||||
to
|
||||
.BR c3
|
||||
under Minix, or
|
||||
.BR c0
|
||||
to
|
||||
.BR c4
|
||||
under Minix-vmd one attaches a set of disk and tape devices to a driver.
|
||||
See
|
||||
.BR boot (8)
|
||||
for a list of boot variables that configure each of these drivers.
|
||||
The following drivers are available:
|
||||
.SS at
|
||||
The standard IBM/AT disk driver that also supports IDE disks. This is the
|
||||
default driver for controller 0 on AT class machines. (Most PCs are in that
|
||||
class.)
|
||||
.SS bios
|
||||
A disk driver that uses BIOS calls to do disk I/O. This is the default
|
||||
driver on anything but an AT. (Old XTs and PS/2s.) On an XT this is the
|
||||
best driver you can use, but on any other machine this driver may be
|
||||
somewhat slow, because the system has to switch out of protected mode to
|
||||
make a BIOS call. On a fast enough machine with a high enough setting of
|
||||
DMA_SECTORS (see
|
||||
.BR config (8))
|
||||
it works well enough.
|
||||
.SS esdi
|
||||
A hard disk driver for use on some PS/2 models.
|
||||
.SS "xt \fR(Minix only)"
|
||||
A hard disk driver for IBM/XT type hard disks. Useful for old 286 based
|
||||
machines that have such a disk. On XTs you are better off with the
|
||||
.B bios
|
||||
driver.
|
||||
.SS aha1540
|
||||
A SCSI driver for the Adaptec 1540 host adapter family, which includes the
|
||||
1540, 1540A, 1540B, 1540C, 1540CF, 1640, and 1740. Also supported is the
|
||||
compatible BusLogic 545.
|
||||
.SS ncr810
|
||||
This will eventually become a Symbios 810 SCSI driver. (Formerly owned by
|
||||
NCR.) KJB has read the docs on this card three times, but has still done
|
||||
nothing, the lazy bum.
|
||||
.SS dosfile
|
||||
The "DOS file as disk" driver that is used when Minix is running
|
||||
under DOS. It treats a large DOS file as a Minix disk. Only primary
|
||||
partitions are supported, there are no subpartitions. This is the default
|
||||
driver when Minix is started under DOS.
|
||||
.SS fatfile
|
||||
Uses a large file on a FAT file system as a disk. It needs one of the other
|
||||
disk drivers to do the actual I/O. This driver only knows how to interpret
|
||||
a FAT file system to find the file to use. With a fast native disk driver
|
||||
this driver is much faster than the
|
||||
.B dosfile
|
||||
driver.
|
||||
.SH FILES
|
||||
.TP 25
|
||||
/dev/c*d*
|
||||
Disks devices.
|
||||
.TP
|
||||
/dev/c*d*p*
|
||||
Partitions.
|
||||
.TP
|
||||
/dev/c*d*p*s*
|
||||
Subpartitions.
|
||||
.TP
|
||||
/dev/c*t*n, /dev/c*t*
|
||||
Tapes.
|
||||
.TP
|
||||
/dev/c*r*
|
||||
Raw access devices.
|
||||
.SH "SEE ALSO"
|
||||
.BR dd (1),
|
||||
.BR mt (1),
|
||||
.BR eject (1),
|
||||
.BR ioctl (2),
|
||||
.BR int64 (3),
|
||||
.BR mtio (4),
|
||||
.BR boot (8),
|
||||
.BR config (8),
|
||||
.BR monitor (8),
|
||||
.BR part (8),
|
||||
.BR repartition (8).
|
||||
.SH BUGS
|
||||
The subpartitioning is incompatible with the MS-DOS method of extended
|
||||
partitions. The latter does not map well to the sparse minor device number
|
||||
space.
|
||||
.PP
|
||||
The primary partition table is sorted by lowsec like MS-DOS does, subpartition
|
||||
tables are not. Just think about what happens when you delete a partition in
|
||||
the MS-DOS scheme.
|
||||
.PP
|
||||
Don't move a partition that is mounted or kept open by some process. The
|
||||
file system may write cached blocks to the new location.
|
||||
.PP
|
||||
The BIOS driver is not slow at all on a buffered disk.
|
||||
.PP
|
||||
Some IDE disks send an interrupt when they spin down under hardware power
|
||||
management. The driver acknowledges the interrupt as it is supposed to do by
|
||||
reading the status register. The disk then spins up again... You have to
|
||||
disable the spin down in the computer setup to fix the problem.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
+261
@@ -0,0 +1,261 @@
|
||||
.TH DEV 4
|
||||
.SH NAME
|
||||
dev \- device files in /dev
|
||||
.SH DESCRIPTION
|
||||
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
|
||||
.BR read (2)
|
||||
or
|
||||
.BR write (2)
|
||||
calls, byte positions set with
|
||||
.BR lseek (2),
|
||||
or more complicated control functions performed with
|
||||
.BR ioctl(2).
|
||||
.PP
|
||||
Device files as found in
|
||||
.B /dev
|
||||
have several attributes that must be considered. Here are two examples as
|
||||
.B "ls \-l"
|
||||
shows them:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.if t .ft C
|
||||
brw-rw-rw- 1 root operator 2, 1 Jun 10 1995 fd1
|
||||
crw--w---- 1 kjb tty 4, 0 May 11 09:41 console
|
||||
.if t .ft P
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
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.
|
||||
.PP
|
||||
Character devices are marked with a
|
||||
.B c
|
||||
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.
|
||||
.PP
|
||||
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.
|
||||
.PP
|
||||
The major device number (2 for
|
||||
.B fd1
|
||||
and 4 for
|
||||
.BR console )
|
||||
are used by FS to find the device driver that manages a device. The minor
|
||||
device number (1 for
|
||||
.B fd1
|
||||
and 0 for
|
||||
.BR console )
|
||||
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:
|
||||
.SS "Memory (major 1)"
|
||||
The
|
||||
.BR ram ,
|
||||
.BR mem ,
|
||||
.BR kmem ,
|
||||
and
|
||||
.BR null
|
||||
devices are managed by the memory task.
|
||||
The
|
||||
.B ram
|
||||
device is a block device for a chunk of memory that is the RAM disk. Any
|
||||
byte read from or written to the
|
||||
.B ram
|
||||
device is copied from or to that memory chunk.
|
||||
The
|
||||
.B mem
|
||||
device is a character device for the entire address space of the system, but
|
||||
.B kmem
|
||||
only for the kernel data area. These two devices allow programs like
|
||||
.BR ps (1)
|
||||
to hunt around the system looking for interesting bits.
|
||||
The
|
||||
.B null
|
||||
device is a data sink. It happily swallows any bytes written to it, and
|
||||
returns nothing on a read.
|
||||
.SS "Floppy disk (major 2)"
|
||||
The
|
||||
.BR fd0 ,
|
||||
.BR fd0p0 ,
|
||||
.BR fd0p1 ,
|
||||
.BR fd0p2 ,
|
||||
and
|
||||
.BR fd0p3
|
||||
block devices are the first floppy disk and the four partitions that may
|
||||
exist on a that floppy disk. Likewise are
|
||||
.BR fd1
|
||||
and
|
||||
.BR fd1p[0\-3]
|
||||
the device and partitions for the second floppy disk. The floppy disk
|
||||
devices are described in detail in
|
||||
.BR fd (4).
|
||||
Partitioning in general is explained in
|
||||
.BR controller (4).
|
||||
.SS "Controller 0 (major 3)"
|
||||
The first hard disk on controller 0 can be accessed by block device
|
||||
.BR c0d0 .
|
||||
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,
|
||||
.BR c0d0p0 ,
|
||||
.BR c0d0p1 ,
|
||||
.BR c0d0p2 ,
|
||||
and
|
||||
.BR c0d0p3 .
|
||||
Each of these devices accesses a range of sectors on the
|
||||
.B c0d0
|
||||
device. It is customary to give each operating system on a disk a primary
|
||||
partition. So the Windows C: "drive" can be on
|
||||
.BR c0d0p0 ,
|
||||
and Minix can be on
|
||||
.BR c0d0p1 .
|
||||
Minix wants to have several partitions on its own, so
|
||||
.B c0d0p1
|
||||
can be further subdivided into the subpartitions
|
||||
.BR c0d0p1s0 ,
|
||||
.BR c0d0p1s1 ,
|
||||
.BR c0d0p1s2 ,
|
||||
and
|
||||
.BR c0d0p1s3 .
|
||||
.B /dev
|
||||
contains devices for the first and second hard disk
|
||||
.RB ( c0d0
|
||||
and
|
||||
.BR c0d1 ),
|
||||
their primary partitions
|
||||
.RB ( c0d[01]p[0\-3] )
|
||||
and subpartitions thereof
|
||||
.RB ( c0d[01]p[0\-3]s[0\-3] ).
|
||||
More detail can be found in
|
||||
.BR controller (4).
|
||||
.SS "Terminals (minor 4)"
|
||||
The TTY driver manages the system console device, aptly named
|
||||
.BR console ,
|
||||
the serial lines,
|
||||
.BR tty00
|
||||
and
|
||||
.BR tty01 ,
|
||||
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
|
||||
.BR ttyc1 ,
|
||||
.BR ttyc2 ,
|
||||
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
|
||||
.BR console (4),
|
||||
and
|
||||
.BR tty (4).
|
||||
.SS "Anonymous TTY (major 5)"
|
||||
This is just one device named
|
||||
.BR tty
|
||||
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
|
||||
.BR /dev/tty .
|
||||
.SS "Line printer (major 6)"
|
||||
The
|
||||
.B lp
|
||||
device sends any bytes written to it to the printer.
|
||||
.SS "TCP/IP (major 7)"
|
||||
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
|
||||
.BR ip (4).
|
||||
.SS "Controller 1 (major 8)"
|
||||
Like controller 0 (major 3), but managing a second controller with devices
|
||||
.BR /dev/c1* .
|
||||
.SS "Controller 2 (major 10)"
|
||||
Like controller 0.
|
||||
.SS "Controller 3 (major 12)"
|
||||
Like controller 0.
|
||||
.SS "Audio (major 13)"
|
||||
The
|
||||
.B audio
|
||||
device can be used to produce or record air vibrations using a Soundblaster
|
||||
16 type audio card. See
|
||||
.BR audio (4).
|
||||
.SS "Mixer (major 14)"
|
||||
The
|
||||
.B mixer
|
||||
device is used to control the audio driver.
|
||||
.SH FILES
|
||||
.TP 10
|
||||
.B /dev/*
|
||||
All Minix devices
|
||||
.SH "SEE ALSO"
|
||||
.BR read (2),
|
||||
.BR write (2),
|
||||
.BR lseek (2),
|
||||
.BR ioctl (2),
|
||||
.BR console (4),
|
||||
.BR fd (4),
|
||||
.BR controller (4),
|
||||
.BR ip (4),
|
||||
.BR tty (4),
|
||||
.BR MAKEDEV (8).
|
||||
.SH DIAGNOSTICS
|
||||
There are five prominent errors that processes accessing device files may
|
||||
provoke:
|
||||
.IP "ENODEV \- No such device" 5
|
||||
There is no driver managing the device class this device belongs to. Either
|
||||
the driver is configured out, or it is not loaded (inet).
|
||||
.IP "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.
|
||||
.IP "EACCES \- Permission denied"
|
||||
This error may cause a lot of head scratching if
|
||||
.B ls \-l
|
||||
shows a device file to be writable. The media you are trying to access is
|
||||
simply physically write protected!
|
||||
.IP "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.
|
||||
.IP "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.
|
||||
.SH NOTES
|
||||
Some devices are not present by default. The
|
||||
.BR MAKEDEV
|
||||
script knows how to make them.
|
||||
.SS "MS-DOS/Windows equivalents"
|
||||
The names of MS-DOS/Windows devices probably map to Minix devices as follows:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.ta +\w'COM1mmm'u +\w'c0d1, c0d2, c0d3mmm'u
|
||||
A: fd0
|
||||
B: fd1
|
||||
C: c0d0p0 (usually the first partition)
|
||||
D: c0d1p0, c0d2p0 (if it's another disk)
|
||||
D: c0d0p1s0 (if it's an extended partition)
|
||||
D: c0d1, c0d2, c0d3 (if it's a CD-ROM)
|
||||
CON console
|
||||
COM1 tty00 (UNIX counts from 0)
|
||||
LPT1 lp
|
||||
.fi
|
||||
.RE
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
@@ -0,0 +1,88 @@
|
||||
.TH FD 4
|
||||
.SH NAME
|
||||
fd \- floppy disk
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B fd*
|
||||
devices refer to the Floppy disk driver using the NEC PD765 floppy disk
|
||||
controller. These diskettes are arrays of 512 byte sectors, although Minix
|
||||
always works with two sectors at a time due to its 1024 byte block size. You
|
||||
can read or write any number of bytes however, Minix takes care of cutting
|
||||
and pasting incomplete blocks together.
|
||||
.PP
|
||||
The driver is normally configured for two floppy disk devices
|
||||
.B fd0
|
||||
and
|
||||
.BR fd1 .
|
||||
It can handle two more, but it is unlikely that the average PC can.
|
||||
.PP
|
||||
On the first access to an
|
||||
.B fd
|
||||
device (by
|
||||
.BR open (2)
|
||||
or
|
||||
.BR mount (2)),
|
||||
the driver will execute a series of read tests to determine the floppy type.
|
||||
This works ok for all floppy types except the true 360k type, because it
|
||||
is indistinguishable from the 720k type. This only means that the size of
|
||||
the floppy is not estimated right.
|
||||
.PP
|
||||
Bits 2\-6 of the minor device number may be set to the floppy disk type
|
||||
to make it known to the driver what type of diskette it is reading or
|
||||
writing. The non-auto devices should be used for formatting, or when one wants to
|
||||
be absolutely sure that the device is accessed right. These devices exist for
|
||||
drive 0:
|
||||
.sp
|
||||
.nf
|
||||
.ta +4n +7n +9n +8n
|
||||
type device minor media
|
||||
.ta +5n +7n +9n +7n
|
||||
0 fd0 0 autodetect
|
||||
1 pc0 4 360k, 5.25"
|
||||
2 at0 8 1.2M, 5.25"
|
||||
3 qd0 12 360k in a 720k, 5.25" drive
|
||||
4 ps0 16 720k, 3.5"
|
||||
5 pat0 20 360k in a 1.2M, 5.25" drive
|
||||
6 qh0 24 720k in a 1.2M, 5.25" drive
|
||||
7 PS0 28 1.44M, 3.5"
|
||||
.fi
|
||||
.DT
|
||||
.PP
|
||||
Type 4 may also be used for the rarely seen 720k, 5.25" floppies (type 2 made
|
||||
them obsolete fast.) Note that these "types" only describe the floppies from
|
||||
a software point of view, type 1 and 4 drives use the same parameters.
|
||||
.PP
|
||||
If the format bit (bit 7) is set, then the driver interprets write commands
|
||||
as track formatting requests. This is used by the
|
||||
.BR format (1)
|
||||
command.
|
||||
.PP
|
||||
If the type bits are set to 28, 29, 30, or 31, then the driver uses a
|
||||
partition table found in sector 0 to partition the floppy. The partitions
|
||||
of
|
||||
.B fd0
|
||||
may be accessed as
|
||||
.B fd0p0
|
||||
through
|
||||
.BR fd0p3 .
|
||||
See
|
||||
.BR controller (4)
|
||||
for a description of the partition table, and associated ioctl commands.
|
||||
.SH FILES
|
||||
/dev/fd[0\-3], /dev/pc[0\-3], /dev/at[0\-3], /dev/qd[0\-3], /dev/ps[0\-3],
|
||||
/dev/pat[0\-3], /dev/qh[0\-3], /dev/PS[0\-3], /dev/fd[0\-3]p[0\-3]
|
||||
.SH "SEE ALSO"
|
||||
.BR format (1),
|
||||
.BR controller (4),
|
||||
.BR part (8).
|
||||
.SH BUGS
|
||||
The driver does not know the size of a 360k diskette in a 360k 5.25"
|
||||
drive, because it uses the 720k parameters for it. So it will happily try
|
||||
to read past the end making all kinds of interesting noises. It's a good
|
||||
thing these drives are practically obsolete.
|
||||
.PP
|
||||
The partition table is only read when the drive motor is off and only for
|
||||
an auto or partition device. The driver assumes that a floppy in a drive
|
||||
with a running motor can't have been replaced all of a sudden.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
+1466
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
.TH LP 4
|
||||
.SH NAME
|
||||
lp \- line printer
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B lp
|
||||
device refers to the line printer attached to the parallel port. Any byte
|
||||
written to this device is printed. Only one process may have the device
|
||||
open.
|
||||
.PP
|
||||
The
|
||||
.B write (2)
|
||||
call may return with a smaller count then the number of bytes requested to
|
||||
write. The next write call is then likely to fail with the error code
|
||||
.B EAGAIN
|
||||
if the printer is out of paper, or
|
||||
.B EIO
|
||||
if the printer is turned off.
|
||||
.SH FILES
|
||||
.TP 10
|
||||
/dev/lp
|
||||
Parallel port device.
|
||||
.SH "SEE ALSO"
|
||||
.BR lp (1).
|
||||
.SH BUGS
|
||||
Only one parallel port is supported.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
@@ -0,0 +1,98 @@
|
||||
.TH MTIO 4
|
||||
.SH NAME
|
||||
mtio \- magnetic tape commands
|
||||
.SH SYNOPSIS
|
||||
.B "#include <sys/types.h>"
|
||||
.br
|
||||
.B "#include <sys/mtio.h>"
|
||||
.br
|
||||
.B "#include <sys/ioctl.h>"
|
||||
.SH DESCRIPTION
|
||||
.de SP
|
||||
.if t .sp 0.4
|
||||
.if n .sp
|
||||
..
|
||||
The magnetic tape devices described in
|
||||
.BR sd (4)
|
||||
may be sent commands or queried for their status using the following ioctl
|
||||
calls:
|
||||
.PP
|
||||
.RS
|
||||
.BR ioctl ( \fIfd ,
|
||||
.BR MTIOCTOP ,
|
||||
.RB & "struct mtop" )
|
||||
.br
|
||||
.BR ioctl ( \fIfd ,
|
||||
.BR MTIOCGET ,
|
||||
.RB & "struct mtget" )
|
||||
.RE
|
||||
.PP
|
||||
The struct mtop, struct mtget and associated definitions are defined in
|
||||
<sys/mtio.h> as follows:
|
||||
.PP
|
||||
.nf
|
||||
|
||||
/* Tape operations: ioctl(fd, MTIOCTOP, &struct mtop) */
|
||||
|
||||
.ta +4n +7n +15n
|
||||
struct mtop {
|
||||
short mt_op; /* Operation (MTWEOF, etc.) */
|
||||
int mt_count; /* Repeat count. */
|
||||
};
|
||||
|
||||
.ta +17n +5n
|
||||
#define MTWEOF 0 /* Write End-Of-File Marker */
|
||||
#define MTFSF 1 /* Forward Space File mark */
|
||||
#define MTBSF 2 /* Backward Space File mark */
|
||||
#define MTFSR 3 /* Forward Space Record */
|
||||
#define MTBSR 4 /* Backward Space Record */
|
||||
#define MTREW 5 /* Rewind tape */
|
||||
#define MTOFFL 6 /* Rewind and take Offline */
|
||||
#define MTNOP 7 /* No-Operation, set status only */
|
||||
#define MTRETEN 8 /* Retension (completely wind and rewind) */
|
||||
#define MTERASE 9 /* Erase the tape and rewind */
|
||||
#define MTEOM 10 /* Position at End-Of-Media */
|
||||
#define MTMODE 11 /* Select tape density */
|
||||
#define MTBLKZ 12 /* Select tape block size */
|
||||
|
||||
/* Tape status: ioctl(fd, MTIOCGET, &struct mtget) */
|
||||
|
||||
.ta +4n +7n +15n
|
||||
struct mtget {
|
||||
short mt_type; /* Type of tape device. */
|
||||
|
||||
/* Device dependent "registers". */
|
||||
short mt_dsreg; /* Drive status register. */
|
||||
short mt_erreg; /* Error register. */
|
||||
|
||||
/* Misc info. */
|
||||
off_t mt_resid; /* Residual count. */
|
||||
off_t mt_fileno; /* Current File Number. */
|
||||
off_t mt_blkno; /* Current Block Number within file. */
|
||||
off_t mt_blksize; /* Current block size. */
|
||||
};
|
||||
|
||||
.fi
|
||||
.PP
|
||||
See
|
||||
.BR mt (1)
|
||||
for a detailed description on what each operation does. The mt_type field
|
||||
is always zero, there is no use for it yet. Mt_dsreg is 0 (OK), 1 (Error),
|
||||
or 2 (EOF encountered.) Mt_erreg holds the SCSI sense key of the last
|
||||
operation. Mt_blksize is the current tape block size in bytes, zero if the
|
||||
block size is variable.
|
||||
.PP
|
||||
Note that one can issue these commands on a file descriptor that is in use
|
||||
to read or write data, something that
|
||||
.B mt
|
||||
can't do. So you can add eof markers in the middle of an output stream,
|
||||
or get the status of a device before a rewind-on-close tape rewinds.
|
||||
.PP
|
||||
The driver will automatically add an end of file marker to a tape that is
|
||||
written to if you execute a space command. If you write eof markers
|
||||
yourself then the driver will not add one extra on close.
|
||||
.SH "SEE ALSO"
|
||||
.BR mt (1),
|
||||
.BR sd (4).
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
+736
@@ -0,0 +1,736 @@
|
||||
.TH TTY 4
|
||||
.SH NAME
|
||||
tty, termios \- terminals
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B tty
|
||||
driver family takes care of all user input and output. It governs the
|
||||
keyboard, the console, the serial lines, and pseudo ttys. Input on any of
|
||||
these devices undergoes "input processing", and output undergoes "output
|
||||
processing" according to the standard termios terminal interface.
|
||||
.SS "Input processing"
|
||||
Each terminal device has an input queue. This queue is used to store
|
||||
preprocessed input characters, and to perform the backspacing and erase
|
||||
functions. Some special characters like a newline make the contents of the
|
||||
queue available to a process reading from the terminal. Characters up to
|
||||
and including the newline, or another so-called "line break", may be read by
|
||||
a process. The process need not read all characters at once. An input line
|
||||
may be read byte by byte if one wants to. A line break just makes
|
||||
characters available for reading, thats all.
|
||||
.PP
|
||||
When data is made available depends on whether the tty is in canonical mode
|
||||
or not. In canonical mode the terminal processes input line by line. A
|
||||
line ends with a newline
|
||||
.RB ( NL ),
|
||||
end-of-file
|
||||
.RB ( EOF ),
|
||||
or end-of-line
|
||||
.RB ( EOL ).
|
||||
Characters that have not been delimited by such a line break may be erased
|
||||
one by one with the
|
||||
.B ERASE
|
||||
character or all at once with the
|
||||
.B KILL
|
||||
character. Once a line break is typed the characters become available to a
|
||||
reading process and can no longer be erased. Once read they are removed
|
||||
from the input queue. Several lines may be gathered in the input queue if
|
||||
no reader is present to read them, but a new reader will only receive one
|
||||
line. Two line breaks are never returned in one read call. The input queue
|
||||
has a maximum length of
|
||||
.B MAX_CANON
|
||||
characters. Any more characters are discarded. One must use
|
||||
.B ERASE
|
||||
or
|
||||
.B KILL
|
||||
to make the terminal functioning again if the input queue fills up. If
|
||||
nonblocking I/O is set then \-1 is returned with
|
||||
.B errno
|
||||
set to
|
||||
.B EAGAIN
|
||||
if the reader would otherwise be blocked.
|
||||
.PP
|
||||
In non-canonical mode (raw mode for short) all characters are immediately
|
||||
available to the reader in principle. One may however tune the terminal to
|
||||
bursty input with the
|
||||
.B MIN
|
||||
and
|
||||
.B TIME
|
||||
parameters, see the raw I/O parameters section below. In raw mode no
|
||||
characters are discarded if the input queue threatens to overflow if the
|
||||
device supports flow control.
|
||||
.SS "Output processing"
|
||||
Characters written to a terminal device may undergo output processing, which
|
||||
is usually just inserting a carriage returns before newlines. A writer
|
||||
may return before all characters are output if the characters can be stored
|
||||
in the output buffers. If not then the writer may be blocked until space is
|
||||
available. If non-blocking I/O is set then only the count of the number of
|
||||
bytes that can be processed immediately is returned. If no characters can
|
||||
be written at all then \-1 is returned with
|
||||
.B errno
|
||||
set to
|
||||
.BR EAGAIN .
|
||||
.SS "Special characters"
|
||||
Some characters have special functions in some of the terminal modes. These
|
||||
characters are as follows, with the Minix defaults shown in parentheses:
|
||||
.TP 5
|
||||
.BR INTR " (^?)"
|
||||
Special input character that is recognized if
|
||||
.B ISIG
|
||||
is set. (For
|
||||
.B ISIG
|
||||
and other flags see the various modes sections below.) It causes a
|
||||
.B SIGINT
|
||||
signal to be sent to all processes in the terminal process group. (See the
|
||||
section on session leaders below.)
|
||||
.TP
|
||||
.BR QUIT " (^\e)"
|
||||
Special input character if
|
||||
.B ISIG
|
||||
is set. Causes a
|
||||
.B SIGQUIT
|
||||
signal to be sent to the terminal process group.
|
||||
.TP
|
||||
.BR ERASE " (^H)"
|
||||
Special input character if
|
||||
.B ICANON
|
||||
is set. Erases the last character in the current line.
|
||||
.TP
|
||||
.BR KILL " (^U)"
|
||||
Special input character if
|
||||
.B ICANON
|
||||
is set. Erases the entire line.
|
||||
.TP
|
||||
.BR EOF " (^D)"
|
||||
Special input character if
|
||||
.B ICANON
|
||||
is set. It is a line break character that is not itself returned to a
|
||||
reader. If EOF is typed with no input present then the read returns zero,
|
||||
which normally causes the reader to assume that end-of-file is reached.
|
||||
.TP
|
||||
.BR CR " (^M)"
|
||||
Special input character if
|
||||
.B IGNCR
|
||||
or
|
||||
.B ICRNL
|
||||
is set. It is a carriage return ('\er'). If
|
||||
.B IGNCR
|
||||
is set then
|
||||
.B CR
|
||||
is discarded. If
|
||||
.B ICRNL
|
||||
is set and
|
||||
.B IGNCR
|
||||
is not set then
|
||||
.B CR
|
||||
is changed into an
|
||||
.B NL
|
||||
and has the same function as
|
||||
.BR NL.
|
||||
.TP
|
||||
.BR NL " (^J)"
|
||||
Special input character if
|
||||
.B ICANON
|
||||
is set. It is both a newline ('\en') and a line break.
|
||||
.br
|
||||
Special output character if
|
||||
.B OPOST
|
||||
and
|
||||
.B ONLCR
|
||||
are set. A
|
||||
.B CR NL
|
||||
sequence is output instead of just
|
||||
.BR NL .
|
||||
(Minix specific, but almost mandatory on any UNIX-like system.)
|
||||
.TP
|
||||
.BR TAB " (^I)"
|
||||
Special character on output if
|
||||
.B OPOST
|
||||
and
|
||||
.B XTABS
|
||||
are set. It is transformed into the number of spaces necessary to reach a
|
||||
column position that is a multiple of eight. (Only needed for terminals
|
||||
without hardware tabs.)
|
||||
.TP
|
||||
.BR EOL " (undefined)"
|
||||
Special input character if
|
||||
.B ICANON
|
||||
is set. It is an additional line break.
|
||||
.TP
|
||||
.BR SUSP " (^Z)"
|
||||
Special input character if job control is implemented and
|
||||
.B ISIG
|
||||
is set. It causes a
|
||||
.B SIGTSTP
|
||||
signal to be send to the terminal process group. (Minix does not have job
|
||||
control.)
|
||||
.TP
|
||||
.BR STOP " (^S)"
|
||||
Special input character if
|
||||
.B IXON
|
||||
is set. It suspends terminal output and is then discarded.
|
||||
.TP
|
||||
.BR START " (^Q)"
|
||||
Special output character if
|
||||
.B IXON
|
||||
is set. It starts terminal output if suspended and is then discarded. If
|
||||
.B IXANY
|
||||
is also set then any other character also starts terminal output, but they
|
||||
are not discarded.
|
||||
.TP
|
||||
.BR REPRINT " (^R)"
|
||||
Special input character if
|
||||
.B IEXTEN
|
||||
and
|
||||
.B ECHO
|
||||
are set. Reprints the input queue from the last line break onwards. A
|
||||
reprint also happens automatically if the echoed input has been messed up by
|
||||
other output and
|
||||
.B ERASE
|
||||
is typed.
|
||||
.TP
|
||||
.BR LNEXT " (^V)"
|
||||
Special input character if
|
||||
.B IEXTEN
|
||||
is set. It is the "literal next" character that causes the next character
|
||||
to be input without any special processing.
|
||||
.TP
|
||||
.BR DISCARD " (^O)"
|
||||
Special input character if
|
||||
.B IEXTEN
|
||||
is set. Causes output to be discarded until it is typed again. (Implemented
|
||||
only under Minix-vmd.)
|
||||
.PP
|
||||
All of these characters except
|
||||
.BR CR ,
|
||||
.B NL
|
||||
and
|
||||
.B TAB
|
||||
may be changed or disabled under Minix. (Changes to
|
||||
.B START
|
||||
and
|
||||
.B STOP
|
||||
may be ignored under other termios implementations.) The
|
||||
.B REPRINT
|
||||
and
|
||||
.B LNEXT
|
||||
characters are Minix extensions that are commonly present in other
|
||||
implementations. \s-2POSIX\s+2 is unclear on whether
|
||||
.BR IEXTEN,
|
||||
.BR IGNCR
|
||||
and
|
||||
.BR ICRNL
|
||||
should be active in non-canonical mode, but under Minix they are.
|
||||
.SS "Terminal attributes"
|
||||
The attributes of a terminal, such as whether the mode should be canonical or
|
||||
non-canonical, are controlled by routines that use the
|
||||
.B termios
|
||||
structure as defined in
|
||||
.BR <termios.h> :
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.ta +4n +10n +15n
|
||||
struct termios {
|
||||
tcflag_t c_iflag; /* input modes */
|
||||
tcflag_t c_oflag; /* output modes */
|
||||
tcflag_t c_cflag; /* control modes */
|
||||
tcflag_t c_lflag; /* local modes */
|
||||
speed_t c_ispeed; /* input speed */
|
||||
speed_t c_ospeed; /* output speed */
|
||||
cc_t c_cc[NCCS]; /* control characters */
|
||||
};
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The types
|
||||
.BR tcflag ,
|
||||
.B speed_t
|
||||
and
|
||||
.B cc_t
|
||||
are defined in
|
||||
.B <termios.h>
|
||||
as unsigned integral types.
|
||||
.SS "Input Modes"
|
||||
The
|
||||
.B c_iflag
|
||||
field contains the following single bit flags that control input processing:
|
||||
.TP 5
|
||||
.B ICRNL
|
||||
Map
|
||||
.B CR
|
||||
to
|
||||
.B NL
|
||||
on input.
|
||||
.TP
|
||||
.B IGNCR
|
||||
Ignore
|
||||
.B CR
|
||||
on input. This flag overrides
|
||||
.BR ICRNL .
|
||||
.TP
|
||||
.B INLCR
|
||||
Map
|
||||
.B NL
|
||||
to
|
||||
.B CR
|
||||
on input. This is done after the
|
||||
.B IGNCR
|
||||
check.
|
||||
.TP
|
||||
.B IXON
|
||||
Enable start/stop output control.
|
||||
.TP
|
||||
.B IXOFF
|
||||
Enable start/stop input control. (Not implemented.)
|
||||
.TP
|
||||
.B IXANY
|
||||
Allow any character to restart output. (Minix specific.)
|
||||
.TP
|
||||
.B ISTRIP
|
||||
Strip characters to seven bits.
|
||||
.TP
|
||||
.B IGNPAR
|
||||
Ignore characters with parity errors. (Not implemented.)
|
||||
.TP
|
||||
.B INPCK
|
||||
Enable input parity checking. (Not implemented.)
|
||||
.TP
|
||||
.B PARMRK
|
||||
Mark parity errors by preceding the faulty character with '\e377', '\e0'.
|
||||
The character '\e377' is preceded by another '\e377' to avoid ambiguity.
|
||||
(Not implemented.)
|
||||
.TP
|
||||
.B BRKINT
|
||||
Send the signal
|
||||
.B SIGINT
|
||||
to the terminal process group when receiving a break condition. (Not
|
||||
implemented.)
|
||||
.TP
|
||||
.B IGNBRK
|
||||
Ignore break condition. If neither
|
||||
.B BRKINT
|
||||
or
|
||||
.B IGNBRK
|
||||
is set a break is input as a single '\e0', or if
|
||||
.B PARMRK
|
||||
is set as '\e377', '\e0', '\e0'.
|
||||
(Breaks are always ignored.)
|
||||
.SS "Output Modes"
|
||||
The
|
||||
.B c_oflag
|
||||
field contains the following single bit flags that control output processing:
|
||||
.TP
|
||||
.B OPOST
|
||||
Perform output processing. This flag is the "main switch" on output
|
||||
processing. All other flags are Minix specific.
|
||||
.TP
|
||||
.B ONLCR
|
||||
Transform an
|
||||
.B NL
|
||||
to a
|
||||
.B CR NL
|
||||
sequence on output. Note that a key labeled "RETURN" or "ENTER" usually
|
||||
sends a
|
||||
.BR CR .
|
||||
In line oriented mode this is normally transformed into
|
||||
.B NL
|
||||
by
|
||||
.BR ICRNL .
|
||||
.B NL
|
||||
is the normal UNIX line delimiter ('\en'). On output an
|
||||
.B NL
|
||||
is transformed into the
|
||||
.B CR NL
|
||||
sequence that is necessary to reach the first column of the next line.
|
||||
(This is a common output processing function for UNIX-like systems, but not
|
||||
always separately switchable by an
|
||||
.B ONLCR
|
||||
flag.)
|
||||
.TP
|
||||
.B XTABS
|
||||
Transform a
|
||||
.B TAB
|
||||
into the number of spaces necessary to reach a column position that is a
|
||||
multiple of eight.
|
||||
.TP
|
||||
.B ONOEOT
|
||||
Discard
|
||||
.B EOT
|
||||
(^D) characters. (Minix-vmd only.)
|
||||
.SS "Control Modes"
|
||||
The
|
||||
.B c_cflag
|
||||
field contains the following single bit flags and bit field for basic
|
||||
hardware control:
|
||||
.TP
|
||||
.B CLOCAL
|
||||
Ignore modem status lines.
|
||||
.TP
|
||||
.B CREAD
|
||||
Enable receiver. (The receiver is always enabled.)
|
||||
.TP
|
||||
.B CSIZE
|
||||
Number of bits per byte.
|
||||
.B CSIZE
|
||||
masks off the values
|
||||
.BR CS5 ,
|
||||
.BR CS6 ,
|
||||
.BR CS7
|
||||
and
|
||||
.BR CS8
|
||||
that indicate that 5, 6, 7 or 8 bits are used.
|
||||
.TP
|
||||
.B CSTOPB
|
||||
Send two stop bits instead of one. Two stop bits are normally used at 110
|
||||
baud or less.
|
||||
.TP
|
||||
.B PARENB
|
||||
Enable parity generation.
|
||||
.TP
|
||||
.B PARODD
|
||||
Generate odd parity if parity is generated, otherwise even parity.
|
||||
.TP
|
||||
.B HUPCL
|
||||
Drop the modem control lines on the last close of the terminal line. (Not
|
||||
implemented.)
|
||||
.SS "Local Modes"
|
||||
The
|
||||
.B c_lflag
|
||||
field contains the following single bit flags that control various functions:
|
||||
.TP
|
||||
.B ECHO
|
||||
Enable echoing of input characters. Most input characters are echoed as
|
||||
they are. Control characters are echoed as
|
||||
.BI "^" X
|
||||
where
|
||||
.I X
|
||||
is the letter used to say that the control character is
|
||||
.BI CTRL\- X\fR.
|
||||
The
|
||||
.BR CR ,
|
||||
.BR NL
|
||||
and
|
||||
.BR TAB
|
||||
characters are echoed with their normal effect unless they are escaped by
|
||||
.BR LNEXT .
|
||||
.TP
|
||||
.B ECHOE
|
||||
If
|
||||
.B ICANON
|
||||
and
|
||||
.B ECHO
|
||||
are set then echo
|
||||
.B ERASE
|
||||
and
|
||||
.B KILL
|
||||
as one or more backspace-space-backspace sequences to wipe out the last
|
||||
character or the entire line, otherwise they are echoed as they are.
|
||||
.TP
|
||||
.B ECHOK
|
||||
If
|
||||
.B ICANON
|
||||
and
|
||||
.B ECHO
|
||||
are set and
|
||||
.B ECHOE
|
||||
is not set then output an
|
||||
.B NL
|
||||
after the
|
||||
.B KILL
|
||||
character. (For hardcopy terminals it is best to unset
|
||||
.B ECHOE
|
||||
and to set
|
||||
.BR ECHOK .)
|
||||
.TP
|
||||
.B ECHONL
|
||||
Echo
|
||||
.B NL
|
||||
even if
|
||||
.B ECHO
|
||||
is not set, but
|
||||
.B ICANON
|
||||
is set.
|
||||
.TP
|
||||
.B ICANON
|
||||
Canonical input. This enables line oriented input and erase and kill
|
||||
processing.
|
||||
.TP
|
||||
.B IEXTEN
|
||||
Enable implementation defined input extensions.
|
||||
.TP
|
||||
.B ISIG
|
||||
Enable the signal characters
|
||||
.BR INTR ,
|
||||
.BR QUIT
|
||||
and
|
||||
.BR SUSP .
|
||||
.TP
|
||||
.B NOFLSH
|
||||
Disable the flushing of the input and output queues that is normally done if
|
||||
a signal is sent.
|
||||
.TP
|
||||
.B TOSTOP
|
||||
Send a
|
||||
.B SIGTTOU
|
||||
signal if job control is implemented and a background process tries to
|
||||
write. (Minix has no job control.)
|
||||
.SS "Input and output speed"
|
||||
The input and output speed are encoded into the
|
||||
.B c_ispeed
|
||||
and
|
||||
.B c_ospeed
|
||||
fields.
|
||||
.B <termios.h>
|
||||
defines the symbols
|
||||
.BR B0 ,
|
||||
.BR B50 ,
|
||||
.BR B75 ,
|
||||
.BR B110 ,
|
||||
.BR B134 ,
|
||||
.BR B150 ,
|
||||
.BR B200 ,
|
||||
.BR B300 ,
|
||||
.BR B600 ,
|
||||
.BR B1200 ,
|
||||
.BR B1800 ,
|
||||
.BR B2400 ,
|
||||
.BR B4800 ,
|
||||
.BR B9600 ,
|
||||
.BR B19200 ,
|
||||
.BR B38400 ,
|
||||
.BR B57600
|
||||
and
|
||||
.BR B115200
|
||||
as values used to indicate the given baud rates. The zero baud rate,
|
||||
.BR B0 ,
|
||||
if used for the input speed causes the input speed to be equal to the
|
||||
output speed. Setting the output speed to zero hangs up the line. One
|
||||
should use the functions
|
||||
.BR cfgetispeed() ,
|
||||
.BR cfgetospeed() ,
|
||||
.BR cfsetispeed()
|
||||
and
|
||||
.BR cfsetospeed()
|
||||
to get or set a speed, because the
|
||||
.B c_ispeed
|
||||
and
|
||||
.B c_ospeed
|
||||
fields may not be visible under other implementations. (The
|
||||
.B c_ispeed
|
||||
and
|
||||
.B c_ospeed
|
||||
fields and the
|
||||
.B B57600
|
||||
and
|
||||
.B B115200
|
||||
symbols are Minix specific.)
|
||||
.SS "Special characters"
|
||||
The
|
||||
.B c_cc
|
||||
array contains the special characters that can be modified. The array has
|
||||
length
|
||||
.B NCCS
|
||||
and is subscripted by the symbols
|
||||
.BR VEOF ,
|
||||
.BR VEOL ,
|
||||
.BR VERASE ,
|
||||
.BR VINTR ,
|
||||
.BR VKILL ,
|
||||
.BR VMIN ,
|
||||
.BR VQUIT ,
|
||||
.BR VTIME ,
|
||||
.BR VSUSP ,
|
||||
.BR VSTART ,
|
||||
.BR VSTOP ,
|
||||
.BR VREPRINT ,
|
||||
.BR VLNEXT
|
||||
and
|
||||
.BR VDISCARD .
|
||||
All these symbols are defined in
|
||||
.BR <termios.h> .
|
||||
Some implementations may give the same values to the
|
||||
.B VMIN
|
||||
and
|
||||
.B VTIME
|
||||
subscripts and the
|
||||
.B VEOF
|
||||
and
|
||||
.B VEOL
|
||||
subscripts respectively, and may ignore changes to
|
||||
.B START
|
||||
and
|
||||
.BR STOP .
|
||||
(Under Minix all special characters have their own
|
||||
.I c_cc
|
||||
slot and can all be modified.)
|
||||
.SS "Raw I/O Parameters"
|
||||
The
|
||||
.B MIN
|
||||
and
|
||||
.B TIME
|
||||
parameters can be used to adjust a raw connection to bursty input.
|
||||
.B MIN
|
||||
represents a minimum number of bytes that must be received before a read
|
||||
call returns.
|
||||
.B TIME
|
||||
is a timer of 0.1 second granularity that can be used to time out a read.
|
||||
Setting either of these parameters to zero has special meaning, which leads
|
||||
to the following four possibilities:
|
||||
.TP 5
|
||||
.B "MIN > 0, TIME > 0"
|
||||
.B TIME
|
||||
is an inter-byte timer that is started (and restarted) when a byte is
|
||||
received. A read succeeds when either the minimum number of characters
|
||||
is received or the timer expires. Note that the timer starts
|
||||
.B after
|
||||
the first character, so the read returns at least one byte.
|
||||
.TP
|
||||
.B "MIN > 0, TIME = 0"
|
||||
Now the timer is disabled, and a reader blocks indefinitely until at least
|
||||
.B MIN
|
||||
characters are received.
|
||||
.TP
|
||||
.B "MIN = 0, TIME > 0"
|
||||
.B TIME
|
||||
is now a read timer that is started when a read is executed. The read will
|
||||
return if the read timer expires or if at least one byte is input. (Note
|
||||
that a value of zero may be returned to the reader.)
|
||||
.TP
|
||||
.B "MIN = 0, TIME = 0"
|
||||
The bytes currently available are returned. Zero is returned if no bytes
|
||||
are available.
|
||||
.SS "User Level Functions"
|
||||
Termios attributes are set or examined, and special functions can be
|
||||
performed by using the functions described in
|
||||
.BR termios (3).
|
||||
.SS "Session Leaders and Process Groups"
|
||||
With the use of the
|
||||
.B setsid()
|
||||
function can a process become a session leader. A session leader forms a
|
||||
process group with a process group id equal to the process id of the session
|
||||
leader. If a session leader opens a terminal device file then this terminal
|
||||
becomes the controlling tty of the session leader. Unless the terminal is
|
||||
already the controlling tty of another process, or unless the
|
||||
.B O_NOCTTY
|
||||
flag is used to prevent the allocation of a controlling tty. The process
|
||||
group of the session leader is now remembered as the terminal process group
|
||||
for signals sent by the terminal driver. All the children and grandchildren
|
||||
of the session leader inherit the controlling terminal and process group
|
||||
until they themselves use
|
||||
.BR setsid() .
|
||||
.PP
|
||||
The controlling tty becomes inaccessible to the children of the session
|
||||
leader when the session leader exits, and a hangup signal is sent to all
|
||||
the members of the process group. The input and output queues are flushed
|
||||
on the last close of a terminal and all attributes are reset to the default
|
||||
state.
|
||||
.PP
|
||||
A special device
|
||||
.B /dev/tty
|
||||
is a synonym for the controlling tty of a process. It allows a process to
|
||||
reach the terminal even when standard input, output and error are
|
||||
redirected. Opening this device can also be used as a test to see if a
|
||||
process has a controlling tty or not.
|
||||
.PP
|
||||
For Minix a special write-only device
|
||||
.B /dev/log
|
||||
exists for processes that want to write messages to the system console.
|
||||
Unlike the console this device is still accessible when a session leader
|
||||
exits.
|
||||
.PP
|
||||
Minix-vmd also has a
|
||||
.B /dev/log
|
||||
device, but this device is read-write. All messages written to the log
|
||||
device or to the console when X11 is active can be read from
|
||||
.BR /dev/log .
|
||||
The system tries to preserve the log buffer over a reboot so that panic
|
||||
messages reappear in the log if the system happens to crash.
|
||||
.SS "Pseudo Terminals"
|
||||
Pseudo ttys allow a process such as a remote login daemon to set up a
|
||||
terminal for a remote login session. The login session uses a device like
|
||||
.B /dev/ttyp0
|
||||
for input and output, and the remote login daemon uses the device
|
||||
.B /dev/ptyp0
|
||||
to supply input to or take output from the login session and transfer this
|
||||
to or from the originating system. So the character flow may be: Local
|
||||
user input sent to the remote system is written to
|
||||
.B /dev/ptyp0
|
||||
by the remote login daemon, undergoes input processing and appears on
|
||||
.B /dev/ttyp0
|
||||
as input to the login session. Output from the login session to
|
||||
.B /dev/ttyp0
|
||||
undergoes output processing, is read from
|
||||
.B /dev/ptyp0
|
||||
by the remote login daemon and is send over to the local system to be
|
||||
displayed for the user. (So there are only four data streams to worry about
|
||||
in a pseudo terminal.)
|
||||
.PP
|
||||
A pseudo terminal can be allocated by trying to open all the controlling
|
||||
devices
|
||||
.BI /dev/pty nn
|
||||
one by one until it succeeds. Further opens will fail once a pty is open.
|
||||
The process should now fork, the child should become session leader, open
|
||||
the tty side of the pty and start a login session.
|
||||
.PP
|
||||
If the tty side is eventually closed down then reads from the pty side will
|
||||
return zero and writes return \-1 with
|
||||
.B errno
|
||||
set to
|
||||
.BR EIO .
|
||||
If the pty side is closed first then a
|
||||
.B SIGHUP
|
||||
signal is sent to the session leader and further reads from the tty side
|
||||
return zero and writes return \-1 with
|
||||
.B errno
|
||||
set to
|
||||
.BR EIO .
|
||||
(Special note: A line erase may cause up to three times the size of the
|
||||
tty input queue to be sent to the pty reader as backspace overstrikes. Some
|
||||
of this output may get lost if the pty reader cannot accept it all at once
|
||||
in a single read call.)
|
||||
.SS "Backwards compatibility"
|
||||
The
|
||||
.BR TIOCGETP ,
|
||||
.BR TIOCSETP ,
|
||||
.BR TIOCGETC
|
||||
and
|
||||
.BR TIOCSETC
|
||||
ioctl functions that are used by the old
|
||||
.B sgtty
|
||||
terminal interface are still supported by the terminal driver by emulation.
|
||||
Note that these old functions cannot control all termios attributes, so the
|
||||
terminal must be in a relatively sane state to avoid problems.
|
||||
.SH FILES
|
||||
The list below shows all devices that Minix and Minix-vmd have. Not all of
|
||||
these devices are configured in by default, as indicated by the numbers
|
||||
(i/j/k, l/m/n) that tell the minimum, default and maximum possible number of
|
||||
these devices for Minix (i/j/k) and Minix-vmd (l/m/n).
|
||||
.TP 20
|
||||
.B /dev/console
|
||||
System console.
|
||||
.TP
|
||||
.B /dev/ttyc[1-7]
|
||||
Virtual consoles. (0/1/7, 0/1/7)
|
||||
.TP
|
||||
.BR /dev/log
|
||||
Console log device.
|
||||
.TP
|
||||
.B /dev/tty0[0-3]
|
||||
Serial lines. (0/2/2, 4/4/4)
|
||||
.TP
|
||||
.B /dev/tty[p-w][0-f]
|
||||
Pseudo ttys. (0/0/64, 1/32/128)
|
||||
.TP
|
||||
.B /dev/pty[p-w][0-f]
|
||||
Associated pseudo tty controllers.
|
||||
.SH "SEE ALSO"
|
||||
.BR stty (1),
|
||||
.BR termios (3),
|
||||
.BR setsid (2),
|
||||
.BR read (2),
|
||||
.BR write (2).
|
||||
.SH BUGS
|
||||
A fair number of flags are not implemented under Minix (yet). Luckily they
|
||||
are very limited utility and only apply to RS-232, not to the user interface.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
Reference in New Issue
Block a user