manual page first distributed with 4.2BSD
[unix-history] / usr / src / share / man / man4 / pty.4
CommitLineData
16b5b9ce
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
260e89d5 5.\" @(#)pty.4 6.1 (Berkeley) %G%
16b5b9ce 6.\"
260e89d5 7.TH PTY 4 ""
16b5b9ce
KM
8.UC 5
9.SH NAME
10pty \- pseudo terminal driver
11.SH SYNOPSIS
12.B pseudo-device pty
13.SH DESCRIPTION
14The
15.I pty
16driver provides support for a device-pair termed a
17.IR "pseudo terminal" .
18A pseudo terminal is a pair of character devices, a
19.I master
20device and a
21.I slave
22device. The slave device provides processes
23an interface identical
24to that described in
25.IR tty (4).
26However, whereas all other devices which provide the
27interface described in
28.IR tty (4)
29have a hardware device of some sort behind them, the slave
30device has, instead, another process manipulating
31it through the master half of the pseudo terminal.
32That is, anything written on the master device is
33given to the slave device as input and anything written
34on the slave device is presented as input on the master
35device.
36.PP
37In configuring, if no optional ``count'' is given in
38the specification, 16 pseudo terminal pairs are configured.
39.PP
40The following
41.I ioctl
42calls apply only to pseudo terminals:
43.TP
44TIOCSTOP
45Stops output to a terminal (e.g. like typing ^S). Takes
46no parameter.
47.TP
48TIOCSTART
49Restarts output (stopped by TIOCSTOP or by typing ^S).
50Takes no parameter.
51.TP
52TIOCPKT
53Enable/disable
54.I packet
55mode. Packet mode is enabled by specifying (by reference)
56a nonzero parameter and disabled by specifying (by reference)
57a zero parameter. When applied to the master side of a pseudo
58terminal, each subsequent
59.I read
60from the terminal will return data written on the slave part of
61the pseudo terminal preceded by a zero byte (symbolically
62defined as TIOCPKT_DATA), or a single byte reflecting control
63status information. In the latter case, the byte is an inclusive-or
64of zero or more of the bits:
65.RS
66.TP
67TIOCPKT_FLUSHREAD
68whenever the read queue for the terminal is flushed.
69.TP
70TIOCPKT_FLUSHWRITE
71whenever the write queue for the terminal is flushed.
72.TP
73TIOCPKT_STOP
74whenever output to the terminal is stopped a la ^S.
75.TP
76TIOCPKT_START
77whenever output to the terminal is restarted.
78.TP
79TIOCPKT_DOSTOP
80whenever
81.I t_stopc
82is ^S
83and
84.I t_startc
85is ^Q.
86.TP
87TIOCPKT_NOSTOP
88whenever the start and stop characters are not ^S/^Q.
89.RE
90.IP
91This mode is used by
92.IR rlogin (1C)
93and
94.IR rlogind (8C)
95to implement a remote-echoed, locally ^S/^Q flow-controlled
96remote login with proper back-flushing of output; it can be
97used by other similar programs.
98.TP
99TIOCREMOTE
100A mode for the master half of a pseudo terminal, independent
101of TIOCPKT. This mode causes input to the pseudo terminal
102to be flow controlled and not input edited (regardless of the
103terminal mode). Each write to the control terminal produces
104a record boundary for the process reading the terminal. In
105normal usage, a write of data is like the data typed as a line
106on the terminal; a write of 0 bytes is like typing an end-of-file
107character. TIOCREMOTE can be used when doing remote line
108editing in a window manager, or whenever flow controlled input
109is required.
110.SH FILES
111.DT
112/dev/pty[p-r][0-9a-f] master pseudo terminals
113.br
114/dev/tty[p-r][0-9a-f] slave pseudo terminals
115.SH DIAGNOSTICS
116None.
117.SH BUGS
118It is not possible to send an EOT.