1 .\" Copyright (c) 1983, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
32 .\" @(#)pty.4 8.2 (Berkeley) 11/30/93
33 .\" $FreeBSD: src/share/man/man4/pty.4,v 1.8.2.3 2001/08/17 13:08:39 ru Exp $
34 .\" $DragonFly: src/share/man/man4/pty.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
41 .Nd pseudo terminal driver
43 .Cd "pseudo-device pty"
47 driver provides support for a device-pair termed a
49 A pseudo terminal is a pair of character devices, a
53 device. The slave device provides to a process
54 an interface identical
57 However, whereas all other devices which provide the
58 interface described in
60 have a hardware device of some sort behind them, the slave
61 device has, instead, another process manipulating
62 it through the master half of the pseudo terminal.
63 That is, anything written on the master device is
64 given to the slave device as input and anything written
65 on the slave device is presented as input on the master
70 calls apply only to pseudo terminals:
71 .Bl -tag -width TIOCREMOTE
73 Stops output to a terminal (e.g. like typing
78 Restarts output (stopped by
86 mode. Packet mode is enabled by specifying (by reference)
87 a nonzero parameter and disabled by specifying (by reference)
88 a zero parameter. When applied to the master side of a pseudo
89 terminal, each subsequent
91 from the terminal will return data written on the slave part of
92 the pseudo terminal preceded by a zero byte (symbolically
95 or a single byte reflecting control
96 status information. In the latter case, the byte is an inclusive-or
97 of zero or more of the bits:
98 .Bl -tag -width TIOCPKT_FLUSHWRITE
99 .It Dv TIOCPKT_FLUSHREAD
100 whenever the read queue for the terminal is flushed.
101 .It Dv TIOCPKT_FLUSHWRITE
102 whenever the write queue for the terminal is flushed.
104 whenever output to the terminal is stopped a la
107 whenever output to the terminal is restarted.
108 .It Dv TIOCPKT_DOSTOP
117 .It Dv TIOCPKT_NOSTOP
118 whenever the start and stop characters are not
121 While this mode is in use, the presence of control status information
122 to be read from the master side may be detected by a
124 for exceptional conditions.
130 to implement a remote-echoed, locally
133 remote login with proper back-flushing of output; it can be
134 used by other similar programs.
137 Enable/disable a mode that allows a small number of simple user
139 commands to be passed through the pseudo-terminal,
140 using a protocol similar to that of
146 modes are mutually exclusive.
147 This mode is enabled from the master side of a pseudo terminal
148 by specifying (by reference)
149 a nonzero parameter and disabled by specifying (by reference)
153 from the master side will return data written on the slave part of
154 the pseudo terminal preceded by a zero byte,
155 or a single byte reflecting a user control operation on the slave side.
156 A user control command consists of a special
158 operation with no data; the command is given as
162 is a number in the range 1-255.
165 will be received as a single byte on the next
167 from the master side.
171 is a no-op that may be used to probe for
172 the existence of this facility.
175 mode, command operations may be detected with a
177 for exceptional conditions.
179 A mode for the master half of a pseudo terminal, independent
182 This mode causes input to the pseudo terminal
183 to be flow controlled and not input edited (regardless of the
184 terminal mode). Each write to the control terminal produces
185 a record boundary for the process reading the terminal. In
186 normal usage, a write of data is like the data typed as a line
187 on the terminal; a write of 0 bytes is like typing an end-of-file
190 can be used when doing remote line
191 editing in a window manager, or whenever flow controlled input
195 .Bl -tag -width /dev/tty[p-sP-S][0-9a-v]x -compact
196 .It Pa /dev/pty[p-sP-S][0-9a-v]
197 master pseudo terminals
198 .It Pa /dev/tty[p-sP-S][0-9a-v]
199 slave pseudo terminals