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