|
|
1.1 root 1: .\" Copyright (c) 1983 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)2.4.t 6.2 (Berkeley) 5/12/86
6: .\"
7: .sh "Terminals and Devices
8: .NH 3
9: Terminals
10: .PP
11: Terminals support \fIread\fP and \fIwrite\fP I/O operations,
12: as well as a collection of terminal specific \fIioctl\fP operations,
13: to control input character interpretation and editing,
14: and output format and delays.
15: .NH 4
16: Terminal input
17: .PP
18: Terminals are handled according to the underlying communication
19: characteristics such as baud rate and required delays,
20: and a set of software parameters.
21: .NH 5
22: Input modes
23: .PP
24: A terminal is in one of three possible modes: \fIraw\fP, \fIcbreak\fP,
25: or \fIcooked\fP.
26: In raw mode all input is passed through to the
27: reading process immediately and without interpretation.
28: In cbreak mode, the handler interprets input only by looking
29: for characters that cause interrupts or output flow control;
30: all other characters are made available as in raw mode.
31: In cooked mode, input
32: is processed to provide standard line-oriented local editing functions,
33: and input is presented on a line-by-line basis.
34: .NH 5
35: Interrupt characters
36: .PP
37: Interrupt characters are interpreted by the terminal handler only in
38: cbreak and cooked modes, and
39: cause a software interrupt to be sent to all processes in the process
40: group associated with the terminal. Interrupt characters exist
41: to send SIGINT
42: and SIGQUIT signals,
43: and to stop a process group
44: with the SIGTSTP signal either immediately, or when
45: all input up to the stop character has been read.
46: .NH 5
47: Line editing
48: .PP
49: When the terminal is in cooked mode, editing of an input line
50: is performed. Editing facilities allow deletion of the previous
51: character or word, or deletion of the current input line.
52: In addition, a special character may be used to reprint the current
53: input line after some number of editing operations have been applied.
54: .PP
55: Certain other characters are interpreted specially when a process is
56: in cooked mode. The \fIend of line\fP character determines
57: the end of an input record. The \fIend of file\fP character simulates
58: an end of file occurrence on terminal input. Flow control is provided
59: by \fIstop output\fP and \fIstart output\fP control characters. Output
60: may be flushed with the \fIflush output\fP character; and a \fIliteral
61: character\fP may be used to force literal input of the immediately
62: following character in the input line.
63: .PP
64: Input characters may be echoed to the terminal as they are received.
65: Non-graphic ASCII input characters may be echoed as a two-character
66: printable representation, ``^character.''
67: .NH 4
68: Terminal output
69: .PP
70: On output, the terminal handler provides some simple formatting services.
71: These include converting the carriage return character to the
72: two character return-linefeed sequence,
73: inserting delays after certain standard control characters,
74: expanding tabs, and providing translations
75: for upper-case only terminals.
76: .NH 4
77: Terminal control operations
78: .PP
79: When a terminal is first opened it is initialized to a standard
80: state and configured with a set of standard control, editing,
81: and interrupt characters. A process
82: may alter this configuration with certain
83: control operations, specifying parameters in a standard structure:\(dg
84: .FS
85: \(dg The control interface described here is an internal interface only
86: in 4.3BSD. Future releases will probably use a modified interface
87: based on currently-proposed standards.
88: .FE
89: .DS
90: ._f
91: struct ttymode {
92: short tt_ispeed; /* input speed */
93: int tt_iflags; /* input flags */
94: short tt_ospeed; /* output speed */
95: int tt_oflags; /* output flags */
96: };
97: .DE
98: and ``special characters'' are specified with the
99: \fIttychars\fP structure,
100: .DS
101: ._f
102: struct ttychars {
103: char tc_erasec; /* erase char */
104: char tc_killc; /* erase line */
105: char tc_intrc; /* interrupt */
106: char tc_quitc; /* quit */
107: char tc_startc; /* start output */
108: char tc_stopc; /* stop output */
109: char tc_eofc; /* end-of-file */
110: char tc_brkc; /* input delimiter (like nl) */
111: char tc_suspc; /* stop process signal */
112: char tc_dsuspc; /* delayed stop process signal */
113: char tc_rprntc; /* reprint line */
114: char tc_flushc; /* flush output (toggles) */
115: char tc_werasc; /* word erase */
116: char tc_lnextc; /* literal next character */
117: };
118: .DE
119: .NH 4
120: Terminal hardware support
121: .PP
122: The terminal handler allows a user to access basic
123: hardware related functions; e.g. line speed,
124: modem control, parity, and stop bits. A special signal,
125: SIGHUP, is automatically
126: sent to processes in a terminal's process
127: group when a carrier transition is detected. This is
128: normally associated with a user hanging up on a modem
129: controlled terminal line.
130: .NH 3
131: Structured devices
132: .PP
133: Structures devices are typified by disks and magnetic
134: tapes, but may represent any random-access device.
135: The system performs read-modify-write type buffering actions on block
136: devices to allow them to be read and written in a totally random
137: access fashion like ordinary files.
138: File systems are normally created in block devices.
139: .NH 3
140: Unstructured devices
141: .PP
142: Unstructured devices are those devices which
143: do not support block structure. Familiar unstructured devices
144: are raw communications lines (with
145: no terminal handler), raster plotters, magnetic tape and disks unfettered
146: by buffering and permitting large block input/output and positioning
147: and formatting commands.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.