]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/doc/psd/05.sysman/2.4.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / doc / psd / 05.sysman / 2.4.t
1 .\" Copyright (c) 1983, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)2.4.t       8.1 (Berkeley) 6/8/93
33 .\"
34 .sh "Terminals and Devices
35 .NH 3
36 Terminals
37 .PP
38 Terminals support \fIread\fP and \fIwrite\fP I/O operations,
39 as well as a collection of terminal specific \fIioctl\fP operations,
40 to control input character interpretation and editing,
41 and output format and delays.
42 .NH 4
43 Terminal input
44 .PP
45 Terminals are handled according to the underlying communication
46 characteristics such as baud rate and required delays,
47 and a set of software parameters.
48 .NH 5
49 Input modes
50 .PP
51 A terminal is in one of three possible modes: \fIraw\fP, \fIcbreak\fP,
52 or \fIcooked\fP.
53 In raw mode all input is passed through to the
54 reading process immediately and without interpretation.
55 In cbreak mode, the handler interprets input only by looking
56 for characters that cause interrupts or output flow control;
57 all other characters are made available as in raw mode.
58 In cooked mode, input
59 is processed to provide standard line-oriented local editing functions,
60 and input is presented on a line-by-line basis.
61 .NH 5
62 Interrupt characters
63 .PP
64 Interrupt characters are interpreted by the terminal handler only in
65 cbreak and cooked modes, and
66 cause a software interrupt to be sent to all processes in the process
67 group associated with the terminal.  Interrupt characters exist
68 to send SIGINT
69 and SIGQUIT signals,
70 and to stop a process group
71 with the SIGTSTP signal either immediately, or when
72 all input up to the stop character has been read.
73 .NH 5
74 Line editing
75 .PP
76 When the terminal is in cooked mode, editing of an input line
77 is performed.  Editing facilities allow deletion of the previous
78 character or word, or deletion of the current input line. 
79 In addition, a special character may be used to reprint the current
80 input line after some number of editing operations have been applied.
81 .PP
82 Certain other characters are interpreted specially when a process is
83 in cooked mode.  The \fIend of line\fP character determines
84 the end of an input record.  The \fIend of file\fP character simulates
85 an end of file occurrence on terminal input.  Flow control is provided
86 by \fIstop output\fP and \fIstart output\fP control characters.  Output
87 may be flushed with the \fIflush output\fP character; and a \fIliteral
88 character\fP may be used to force literal input of the immediately
89 following character in the input line.
90 .PP
91 Input characters may be echoed to the terminal as they are received.
92 Non-graphic ASCII input characters may be echoed as a two-character
93 printable representation, ``^character.''
94 .NH 4
95 Terminal output
96 .PP
97 On output, the terminal handler provides some simple formatting services.
98 These include converting the carriage return character to the
99 two character return-linefeed sequence,
100 inserting delays after certain standard control characters,
101 expanding tabs, and providing translations
102 for upper-case only terminals.
103 .NH 4
104 Terminal control operations
105 .PP
106 When a terminal is first opened it is initialized to a standard
107 state and configured with a set of standard control, editing,
108 and interrupt characters.  A process
109 may alter this configuration with certain
110 control operations, specifying parameters in a standard structure:\(dg
111 .FS
112 \(dg The control interface described here is an internal interface only
113 in 4.3BSD.  Future releases will probably use a modified interface
114 based on currently-proposed standards.
115 .FE
116 .DS
117 ._f
118 struct ttymode {
119         short   tt_ispeed;      /* input speed */
120         int     tt_iflags;      /* input flags */
121         short   tt_ospeed;      /* output speed */
122         int     tt_oflags;      /* output flags */
123 };
124 .DE
125 and ``special characters'' are specified with the 
126 \fIttychars\fP structure,
127 .DS
128 ._f
129 struct ttychars {
130         char    tc_erasec;      /* erase char */
131         char    tc_killc;       /* erase line */
132         char    tc_intrc;       /* interrupt */
133         char    tc_quitc;       /* quit */
134         char    tc_startc;      /* start output */
135         char    tc_stopc;       /* stop output */
136         char    tc_eofc;        /* end-of-file */
137         char    tc_brkc;        /* input delimiter (like nl) */
138         char    tc_suspc;       /* stop process signal */
139         char    tc_dsuspc;      /* delayed stop process signal */
140         char    tc_rprntc;      /* reprint line */
141         char    tc_flushc;      /* flush output (toggles) */
142         char    tc_werasc;      /* word erase */
143         char    tc_lnextc;      /* literal next character */
144 };
145 .DE
146 .NH 4
147 Terminal hardware support
148 .PP
149 The terminal handler allows a user to access basic
150 hardware related functions; e.g. line speed,
151 modem control, parity, and stop bits.  A special signal,
152 SIGHUP, is automatically
153 sent to processes in a terminal's process
154 group when a carrier transition is detected.  This is
155 normally associated with a user hanging up on a modem
156 controlled terminal line.
157 .NH 3
158 Structured devices
159 .PP
160 Structures devices are typified by disks and magnetic
161 tapes, but may represent any random-access device.
162 The system performs read-modify-write type buffering actions on block
163 devices to allow them to be read and written in a totally random
164 access fashion like ordinary files.
165 File systems are normally created in block devices.
166 .NH 3
167 Unstructured devices
168 .PP
169 Unstructured devices are those devices which
170 do not support block structure.  Familiar unstructured devices
171 are raw communications lines (with
172 no terminal handler), raster plotters, magnetic tape and disks unfettered
173 by buffering and permitting large block input/output and positioning
174 and formatting commands.