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