xref: /freebsd/share/man/man4/pts.4 (revision 97759ccc715c4b365432c16d763c50eecfcb1100)
1bc093719SEd Schouten.\" Copyright (c) 1983, 1991, 1993
2bc093719SEd Schouten.\"	The Regents of the University of California.  All rights reserved.
3bc093719SEd Schouten.\"
4bc093719SEd Schouten.\" Redistribution and use in source and binary forms, with or without
5bc093719SEd Schouten.\" modification, are permitted provided that the following conditions
6bc093719SEd Schouten.\" are met:
7bc093719SEd Schouten.\" 1. Redistributions of source code must retain the above copyright
8bc093719SEd Schouten.\"    notice, this list of conditions and the following disclaimer.
9bc093719SEd Schouten.\" 2. Redistributions in binary form must reproduce the above copyright
10bc093719SEd Schouten.\"    notice, this list of conditions and the following disclaimer in the
11bc093719SEd Schouten.\"    documentation and/or other materials provided with the distribution.
12dda5b397SEitan Adler.\" 3. Neither the name of the University nor the names of its contributors
13bc093719SEd Schouten.\"    may be used to endorse or promote products derived from this software
14bc093719SEd Schouten.\"    without specific prior written permission.
15bc093719SEd Schouten.\"
16bc093719SEd Schouten.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17bc093719SEd Schouten.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18bc093719SEd Schouten.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19bc093719SEd Schouten.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20bc093719SEd Schouten.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21bc093719SEd Schouten.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22bc093719SEd Schouten.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23bc093719SEd Schouten.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24bc093719SEd Schouten.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25bc093719SEd Schouten.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26bc093719SEd Schouten.\" SUCH DAMAGE.
27bc093719SEd Schouten.\"
28bc093719SEd Schouten.Dd August 20, 2008
29bc093719SEd Schouten.Dt PTS 4
30bc093719SEd Schouten.Os
31bc093719SEd Schouten.Sh NAME
32bc093719SEd Schouten.Nm pts
33bc093719SEd Schouten.Nd pseudo-terminal driver
34bc093719SEd Schouten.Sh DESCRIPTION
35bc093719SEd SchoutenThe
36bc093719SEd Schouten.Nm
37bc093719SEd Schoutendriver provides support for a device-pair termed a
38bc093719SEd Schouten.Em pseudo-terminal .
39bc093719SEd SchoutenA pseudo-terminal is a pair of character devices, a
40bc093719SEd Schouten.Em master
41bc093719SEd Schoutendevice and a
42bc093719SEd Schouten.Em slave
43bc093719SEd Schoutendevice.
44bc093719SEd SchoutenThe slave device provides to a process an interface identical
45bc093719SEd Schoutento that described in
46bc093719SEd Schouten.Xr tty 4 .
47bc093719SEd SchoutenHowever, whereas all other devices which provide the
48bc093719SEd Schouteninterface described in
49bc093719SEd Schouten.Xr tty 4
50bc093719SEd Schoutenhave a hardware device of some sort behind them, the slave
51bc093719SEd Schoutendevice has, instead, another process manipulating
52bc093719SEd Schoutenit through the master half of the pseudo-terminal.
53bc093719SEd SchoutenThat is, anything written on the master device is
54bc093719SEd Schoutengiven to the slave device as input and anything written
55bc093719SEd Schoutenon the slave device is presented as input on the master
56bc093719SEd Schoutendevice.
57bc093719SEd Schouten.Pp
58bc093719SEd SchoutenThe following
59bc093719SEd Schouten.Xr ioctl 2
60bc093719SEd Schoutencalls apply only to pseudo-terminals:
61bc093719SEd Schouten.Bl -tag -width TIOCPTMASTER
62bc093719SEd Schouten.It Dv TIOCPKT
63bc093719SEd SchoutenEnable/disable
64bc093719SEd Schouten.Em packet
65bc093719SEd Schoutenmode.
66bc093719SEd SchoutenPacket mode is enabled by specifying (by reference)
67bc093719SEd Schoutena nonzero parameter and disabled by specifying (by reference)
68bc093719SEd Schoutena zero parameter.
69bc093719SEd SchoutenWhen applied to the master side of a pseudo-terminal, each subsequent
70bc093719SEd Schouten.Xr read 2
71bc093719SEd Schoutenfrom the terminal will return data written on the slave part of
72bc093719SEd Schoutenthe pseudo-terminal preceded by a zero byte (symbolically
73bc093719SEd Schoutendefined as
74bc093719SEd Schouten.Dv TIOCPKT_DATA ) ,
75bc093719SEd Schoutenor a single byte reflecting control
76bc093719SEd Schoutenstatus information.
77bc093719SEd SchoutenIn the latter case, the byte is an inclusive-or
78bc093719SEd Schoutenof zero or more of the bits:
79bc093719SEd Schouten.Bl -tag -width TIOCPKT_FLUSHWRITE
80bc093719SEd Schouten.It Dv TIOCPKT_FLUSHREAD
81bc093719SEd Schoutenwhenever the read queue for the terminal is flushed.
82bc093719SEd Schouten.It Dv TIOCPKT_FLUSHWRITE
83bc093719SEd Schoutenwhenever the write queue for the terminal is flushed.
84bc093719SEd Schouten.It Dv TIOCPKT_STOP
85bc093719SEd Schoutenwhenever output to the terminal is stopped a la
86bc093719SEd Schouten.Ql ^S .
87bc093719SEd Schouten.It Dv TIOCPKT_START
88bc093719SEd Schoutenwhenever output to the terminal is restarted.
89bc093719SEd Schouten.It Dv TIOCPKT_DOSTOP
90bc093719SEd Schoutenwhenever
91bc093719SEd Schouten.Dv VSTOP
92bc093719SEd Schoutenis
93bc093719SEd Schouten.Ql ^S
94bc093719SEd Schoutenand
95bc093719SEd Schouten.Dv VSTART
96bc093719SEd Schoutenis
97bc093719SEd Schouten.Ql ^Q .
98bc093719SEd Schouten.It Dv TIOCPKT_NOSTOP
99bc093719SEd Schoutenwhenever the start and stop characters are not
100bc093719SEd Schouten.Ql ^S/^Q .
101bc093719SEd Schouten.El
102bc093719SEd Schouten.Pp
103bc093719SEd SchoutenWhile this mode is in use, the presence of control status information
104bc093719SEd Schoutento be read from the master side may be detected by a
105bc093719SEd Schouten.Xr select 2
106bc093719SEd Schoutenfor exceptional conditions.
107bc093719SEd Schouten.Pp
108bc093719SEd SchoutenThis mode is used by
109bc093719SEd Schouten.Xr rlogin 1
110bc093719SEd Schoutenand
111bc093719SEd Schouten.Xr rlogind 8
112bc093719SEd Schoutento implement a remote-echoed, locally
113bc093719SEd Schouten.Ql ^S/^Q
114bc093719SEd Schoutenflow-controlled
115bc093719SEd Schoutenremote login with proper back-flushing of output; it can be
116bc093719SEd Schoutenused by other similar programs.
117bc093719SEd Schouten.It Dv TIOCGPTN
118bc093719SEd SchoutenObtain device unit number, which can be used to generate the filename of
119*25972509SEdward Tomasz Napieralathe pseudo-terminal slave device.
120*25972509SEdward Tomasz NapieralaThis
121bc093719SEd Schouten.Xr ioctl 2
122*25972509SEdward Tomasz Napieralashould not be used directly.
123*25972509SEdward Tomasz NapieralaInstead, the
124bc093719SEd Schouten.Xr ptsname 3
125bc093719SEd Schoutenfunction should be used.
126bc093719SEd Schouten.It Dv TIOCPTMASTER
127bc093719SEd SchoutenDetermine whether the file descriptor is pointing to a pseudo-terminal
128bc093719SEd Schoutenmaster device.
129bc093719SEd SchoutenThis
130bc093719SEd Schouten.Xr ioctl 2
131*25972509SEdward Tomasz Napieralashould not be used directly.
132*25972509SEdward Tomasz NapieralaIt is used to implement routines like
133bc093719SEd Schouten.Xr grantpt 3 .
134bc093719SEd Schouten.El
135bc093719SEd Schouten.Sh FILES
136bc093719SEd SchoutenThe files used by this
137bc093719SEd Schoutenpseudo-terminals implementation are:
138bc093719SEd Schouten.Bl -tag -width ".Pa /dev/pts/[num]"
139bc093719SEd Schouten.It Pa /dev/pts/[num]
140bc093719SEd SchoutenPseudo-terminal slave devices.
141bc093719SEd Schouten.El
142bc093719SEd Schouten.Sh DIAGNOSTICS
143bc093719SEd SchoutenNone.
144bc093719SEd Schouten.Sh SEE ALSO
145bc093719SEd Schouten.Xr posix_openpt 2 ,
1460b3504fdSChristian Brueffer.Xr grantpt 3 ,
147bc093719SEd Schouten.Xr ptsname 3 ,
148bc093719SEd Schouten.Xr pty 4 ,
149bc093719SEd Schouten.Xr tty 4
150bc093719SEd Schouten.Sh HISTORY
151bc093719SEd SchoutenA
152bc093719SEd Schoutenpseudo-terminal driver appeared in
153bc093719SEd Schouten.Bx 4.2 .
154bc093719SEd SchoutenIn
155bc093719SEd Schouten.Fx 8.0 ,
156bc093719SEd Schoutenit was replaced with the
157bc093719SEd Schouten.Nm
158bc093719SEd Schoutendriver.
159