xref: /freebsd/share/man/man4/pts.4 (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1.\" Copyright (c) 1983, 1991, 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. 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.
15.\"
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
26.\" SUCH DAMAGE.
27.\"
28.Dd August 20, 2008
29.Dt PTS 4
30.Os
31.Sh NAME
32.Nm pts
33.Nd pseudo-terminal driver
34.Sh DESCRIPTION
35The
36.Nm
37driver provides support for a device-pair termed a
38.Em pseudo-terminal .
39A pseudo-terminal is a pair of character devices, a
40.Em master
41device and a
42.Em slave
43device.
44The slave device provides to a process an interface identical
45to that described in
46.Xr tty 4 .
47However, whereas all other devices which provide the
48interface described in
49.Xr tty 4
50have a hardware device of some sort behind them, the slave
51device has, instead, another process manipulating
52it through the master half of the pseudo-terminal.
53That is, anything written on the master device is
54given to the slave device as input and anything written
55on the slave device is presented as input on the master
56device.
57.Pp
58The following
59.Xr ioctl 2
60calls apply only to pseudo-terminals:
61.Bl -tag -width TIOCPTMASTER
62.It Dv TIOCPKT
63Enable/disable
64.Em packet
65mode.
66Packet mode is enabled by specifying (by reference)
67a nonzero parameter and disabled by specifying (by reference)
68a zero parameter.
69When applied to the master side of a pseudo-terminal, each subsequent
70.Xr read 2
71from the terminal will return data written on the slave part of
72the pseudo-terminal preceded by a zero byte (symbolically
73defined as
74.Dv TIOCPKT_DATA ) ,
75or a single byte reflecting control
76status information.
77In the latter case, the byte is an inclusive-or
78of zero or more of the bits:
79.Bl -tag -width TIOCPKT_FLUSHWRITE
80.It Dv TIOCPKT_FLUSHREAD
81whenever the read queue for the terminal is flushed.
82.It Dv TIOCPKT_FLUSHWRITE
83whenever the write queue for the terminal is flushed.
84.It Dv TIOCPKT_STOP
85whenever output to the terminal is stopped a la
86.Ql ^S .
87.It Dv TIOCPKT_START
88whenever output to the terminal is restarted.
89.It Dv TIOCPKT_DOSTOP
90whenever
91.Dv VSTOP
92is
93.Ql ^S
94and
95.Dv VSTART
96is
97.Ql ^Q .
98.It Dv TIOCPKT_NOSTOP
99whenever the start and stop characters are not
100.Ql ^S/^Q .
101.El
102.Pp
103While this mode is in use, the presence of control status information
104to be read from the master side may be detected by a
105.Xr select 2
106for exceptional conditions.
107.Pp
108This mode is used by
109.Xr rlogin 1
110and
111.Xr rlogind 8
112to implement a remote-echoed, locally
113.Ql ^S/^Q
114flow-controlled
115remote login with proper back-flushing of output; it can be
116used by other similar programs.
117.It Dv TIOCGPTN
118Obtain device unit number, which can be used to generate the filename of
119the pseudo-terminal slave device.
120This
121.Xr ioctl 2
122should not be used directly.
123Instead, the
124.Xr ptsname 3
125function should be used.
126.It Dv TIOCPTMASTER
127Determine whether the file descriptor is pointing to a pseudo-terminal
128master device.
129This
130.Xr ioctl 2
131should not be used directly.
132It is used to implement routines like
133.Xr grantpt 3 .
134.El
135.Sh FILES
136The files used by this
137pseudo-terminals implementation are:
138.Bl -tag -width ".Pa /dev/pts/[num]"
139.It Pa /dev/pts/[num]
140Pseudo-terminal slave devices.
141.El
142.Sh DIAGNOSTICS
143None.
144.Sh SEE ALSO
145.Xr posix_openpt 2 ,
146.Xr grantpt 3 ,
147.Xr ptsname 3 ,
148.Xr pty 4 ,
149.Xr tty 4
150.Sh HISTORY
151A
152pseudo-terminal driver appeared in
153.Bx 4.2 .
154In
155.Fx 8.0 ,
156it was replaced with the
157.Nm
158driver.
159