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. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)pty.4 8.2 (Berkeley) 11/30/93
29 .\" $FreeBSD: src/share/man/man4/pty.4,v 1.8.2.3 2001/08/17 13:08:39 ru Exp $
36 .Nd pseudo terminal driver
38 .Cd "pseudo-device pty"
42 driver provides support for a device-pair termed a
44 A pseudo terminal is a pair of character devices, a
48 device. The slave device provides to a process
49 an interface identical
52 However, whereas all other devices which provide the
53 interface described in
55 have a hardware device of some sort behind them, the slave
56 device has, instead, another process manipulating
57 it through the master half of the pseudo terminal.
58 That is, anything written on the master device is
59 given to the slave device as input and anything written
60 on the slave device is presented as input on the master
65 calls apply only to pseudo terminals:
66 .Bl -tag -width ".Dv TIOCREMOTE"
68 Stops output to a terminal (e.g. like typing
73 Restarts output (stopped by
81 mode. Packet mode is enabled by specifying (by reference)
82 a nonzero parameter and disabled by specifying (by reference)
83 a zero parameter. When applied to the master side of a pseudo
84 terminal, each subsequent
86 from the terminal will return data written on the slave part of
87 the pseudo terminal preceded by a zero byte (symbolically
90 or a single byte reflecting control
91 status information. In the latter case, the byte is an inclusive-or
92 of zero or more of the bits:
93 .Bl -tag -width TIOCPKT_FLUSHWRITE
94 .It Dv TIOCPKT_FLUSHREAD
95 whenever the read queue for the terminal is flushed.
96 .It Dv TIOCPKT_FLUSHWRITE
97 whenever the write queue for the terminal is flushed.
99 whenever output to the terminal is stopped a la
102 whenever output to the terminal is restarted.
103 .It Dv TIOCPKT_DOSTOP
112 .It Dv TIOCPKT_NOSTOP
113 whenever the start and stop characters are not
116 While this mode is in use, the presence of control status information
117 to be read from the master side may be detected by a
119 for exceptional conditions.
122 .Xr rlogin 1 Pq Pa net/bsdrcmds
124 .Xr rlogind 8 Pq Pa net/bsdrcmds
125 to implement a remote-echoed, locally
128 remote login with proper back-flushing of output; it can be
129 used by other similar programs.
132 Enable/disable a mode that allows a small number of simple user
134 commands to be passed through the pseudo-terminal,
135 using a protocol similar to that of
141 modes are mutually exclusive.
142 This mode is enabled from the master side of a pseudo terminal
143 by specifying (by reference)
144 a nonzero parameter and disabled by specifying (by reference)
148 from the master side will return data written on the slave part of
149 the pseudo terminal preceded by a zero byte,
150 or a single byte reflecting a user control operation on the slave side.
151 A user control command consists of a special
153 operation with no data; the command is given as
157 is a number in the range 1-255.
160 will be received as a single byte on the next
162 from the master side.
166 is a no-op that may be used to probe for
167 the existence of this facility.
170 mode, command operations may be detected with a
172 for exceptional conditions.
174 A mode for the master half of a pseudo terminal, independent
177 This mode causes input to the pseudo terminal
178 to be flow controlled and not input edited (regardless of the
179 terminal mode). Each write to the control terminal produces
180 a record boundary for the process reading the terminal. In
181 normal usage, a write of data is like the data typed as a line
182 on the terminal; a write of 0 bytes is like typing an end-of-file
185 can be used when doing remote line
186 editing in a window manager, or whenever flow controlled input
190 .Bl -tag -width /dev/tty[p-sP-S][0-9a-v]x -compact
191 .It Pa /dev/pty[p-sP-S][0-9a-v]
192 master pseudo terminals
193 .It Pa /dev/tty[p-sP-S][0-9a-v]
194 slave pseudo terminals