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
40 .Nd pseudo-terminal driver
44 driver provides support for a device-pair termed a
46 A pseudo-terminal is a pair of character devices, a
51 The slave device provides to a process an interface identical
54 However, whereas all other devices which provide the
55 interface described in
57 have a hardware device of some sort behind them, the slave
58 device has, instead, another process manipulating
59 it through the master half of the pseudo-terminal.
60 That is, anything written on the master device is
61 given to the slave device as input and anything written
62 on the slave device is presented as input on the master
67 calls apply only to pseudo-terminals:
68 .Bl -tag -width TIOCPTMASTER
73 Packet mode is enabled by specifying (by reference)
74 a nonzero parameter and disabled by specifying (by reference)
76 When applied to the master side of a pseudo-terminal, each subsequent
78 from the terminal will return data written on the slave part of
79 the pseudo-terminal preceded by a zero byte (symbolically
82 or a single byte reflecting control
84 In the latter case, the byte is an inclusive-or
85 of zero or more of the bits:
86 .Bl -tag -width TIOCPKT_FLUSHWRITE
87 .It Dv TIOCPKT_FLUSHREAD
88 whenever the read queue for the terminal is flushed.
89 .It Dv TIOCPKT_FLUSHWRITE
90 whenever the write queue for the terminal is flushed.
92 whenever output to the terminal is stopped a la
95 whenever output to the terminal is restarted.
105 .It Dv TIOCPKT_NOSTOP
106 whenever the start and stop characters are not
110 While this mode is in use, the presence of control status information
111 to be read from the master side may be detected by a
113 for exceptional conditions.
119 to implement a remote-echoed, locally
122 remote login with proper back-flushing of output; it can be
123 used by other similar programs.
125 Obtain device unit number, which can be used to generate the filename of
126 the pseudo-terminal slave device. This
128 should not be used directly. Instead, the
130 function should be used.
132 Determine whether the file descriptor is pointing to a pseudo-terminal
136 should not be used directly. It is used to implement routines like
140 The maximum number of pseudo-terminals is limited to 1000.
141 It is not possible to use more than 1000 pseudo-terminals, as all software
144 will not be able to handle pseudo-terminals with number superior to 999.
146 The files used by this
147 pseudo-terminals implementation are:
149 .Bl -tag -width ".Pa /dev/pts/[num]"
151 Control device, returns a file descriptor to a new master pseudo-terminal
152 when opened. This device should not be opened directly. It's only
153 available for binary compatibility. New devices should only be created
156 .It Pa /dev/pts/[num]
157 Pseudo-terminal slave devices.
169 pseudo-terminal driver appeared in
173 it was replaced with the