Commit | Line | Data |
---|---|---|
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 | .\" | |
16a51b60 | 5 | .\" @(#)pty.4 6.2 (Berkeley) %G% |
16b5b9ce | 6 | .\" |
260e89d5 | 7 | .TH PTY 4 "" |
16b5b9ce KM |
8 | .UC 5 |
9 | .SH NAME | |
10 | pty \- pseudo terminal driver | |
11 | .SH SYNOPSIS | |
16a51b60 | 12 | .B pseudo-device pty [ count ] |
16b5b9ce KM |
13 | .SH DESCRIPTION |
14 | The | |
15 | .I pty | |
16 | driver provides support for a device-pair termed a | |
17 | .IR "pseudo terminal" . | |
18 | A pseudo terminal is a pair of character devices, a | |
19 | .I master | |
20 | device and a | |
21 | .I slave | |
22 | device. The slave device provides processes | |
23 | an interface identical | |
24 | to that described in | |
25 | .IR tty (4). | |
26 | However, whereas all other devices which provide the | |
27 | interface described in | |
28 | .IR tty (4) | |
29 | have a hardware device of some sort behind them, the slave | |
30 | device has, instead, another process manipulating | |
31 | it through the master half of the pseudo terminal. | |
32 | That is, anything written on the master device is | |
33 | given to the slave device as input and anything written | |
34 | on the slave device is presented as input on the master | |
35 | device. | |
36 | .PP | |
16a51b60 MK |
37 | In configuring, if an optional ``count'' is given in |
38 | the specification, that number of pseudo terminal pairs are configured; | |
39 | the default count is 32. | |
16b5b9ce KM |
40 | .PP |
41 | The following | |
42 | .I ioctl | |
43 | calls apply only to pseudo terminals: | |
44 | .TP | |
45 | TIOCSTOP | |
46 | Stops output to a terminal (e.g. like typing ^S). Takes | |
47 | no parameter. | |
48 | .TP | |
49 | TIOCSTART | |
50 | Restarts output (stopped by TIOCSTOP or by typing ^S). | |
51 | Takes no parameter. | |
52 | .TP | |
53 | TIOCPKT | |
54 | Enable/disable | |
55 | .I packet | |
56 | mode. Packet mode is enabled by specifying (by reference) | |
57 | a nonzero parameter and disabled by specifying (by reference) | |
58 | a zero parameter. When applied to the master side of a pseudo | |
59 | terminal, each subsequent | |
60 | .I read | |
61 | from the terminal will return data written on the slave part of | |
62 | the pseudo terminal preceded by a zero byte (symbolically | |
63 | defined as TIOCPKT_DATA), or a single byte reflecting control | |
64 | status information. In the latter case, the byte is an inclusive-or | |
65 | of zero or more of the bits: | |
66 | .RS | |
67 | .TP | |
68 | TIOCPKT_FLUSHREAD | |
69 | whenever the read queue for the terminal is flushed. | |
70 | .TP | |
71 | TIOCPKT_FLUSHWRITE | |
72 | whenever the write queue for the terminal is flushed. | |
73 | .TP | |
74 | TIOCPKT_STOP | |
75 | whenever output to the terminal is stopped a la ^S. | |
76 | .TP | |
77 | TIOCPKT_START | |
78 | whenever output to the terminal is restarted. | |
79 | .TP | |
80 | TIOCPKT_DOSTOP | |
81 | whenever | |
82 | .I t_stopc | |
83 | is ^S | |
84 | and | |
85 | .I t_startc | |
86 | is ^Q. | |
87 | .TP | |
88 | TIOCPKT_NOSTOP | |
89 | whenever the start and stop characters are not ^S/^Q. | |
90 | .RE | |
91 | .IP | |
16a51b60 MK |
92 | While this mode is in use, the presence of control status information |
93 | to be read from the master side may be detected by a | |
94 | .I select | |
95 | for exceptional conditions. | |
96 | .IP | |
16b5b9ce KM |
97 | This mode is used by |
98 | .IR rlogin (1C) | |
99 | and | |
100 | .IR rlogind (8C) | |
101 | to implement a remote-echoed, locally ^S/^Q flow-controlled | |
102 | remote login with proper back-flushing of output; it can be | |
103 | used by other similar programs. | |
104 | .TP | |
16a51b60 MK |
105 | TIOCUCNTL |
106 | Enable/disable a mode that allows a small number of simple user | |
107 | .I ioctl | |
108 | commands to be passed through the pseudo-terminal, | |
109 | using a protocol similar to that of TIOCPKT. | |
110 | The TIOCUCNTL and TIOCPKT modes are mutually exclusive. | |
111 | This mode is enabled from the master side of a pseudo terminal | |
112 | by specifying (by reference) | |
113 | a nonzero parameter and disabled by specifying (by reference) | |
114 | a zero parameter. | |
115 | Each subsequent | |
116 | .I read | |
117 | from the master side will return data written on the slave part of | |
118 | the pseudo terminal preceded by a zero byte, | |
119 | or a single byte reflecting a user control operation on the slave side. | |
120 | A user control command consists of a special | |
121 | .I ioctl | |
122 | operation with no data; the command is given as UIOCCMD(\fIn\fP), | |
123 | where \fIn\fP is a number in the range 1-255. | |
124 | The operation value \fIn\fP will be received as a single byte on the next | |
125 | .I read | |
126 | from the master side. | |
127 | The \fIioctl\fP UIOCCMD(0) is a no-op that may be used to probe for | |
128 | the existence of this facility. | |
129 | As with TIOCPKT mode, command operations may be detected with a | |
130 | .I select | |
131 | for exceptional conditions. | |
132 | .TP | |
16b5b9ce KM |
133 | TIOCREMOTE |
134 | A mode for the master half of a pseudo terminal, independent | |
135 | of TIOCPKT. This mode causes input to the pseudo terminal | |
136 | to be flow controlled and not input edited (regardless of the | |
137 | terminal mode). Each write to the control terminal produces | |
138 | a record boundary for the process reading the terminal. In | |
139 | normal usage, a write of data is like the data typed as a line | |
140 | on the terminal; a write of 0 bytes is like typing an end-of-file | |
141 | character. TIOCREMOTE can be used when doing remote line | |
142 | editing in a window manager, or whenever flow controlled input | |
143 | is required. | |
144 | .SH FILES | |
145 | .DT | |
146 | /dev/pty[p-r][0-9a-f] master pseudo terminals | |
147 | .br | |
148 | /dev/tty[p-r][0-9a-f] slave pseudo terminals | |
149 | .SH DIAGNOSTICS | |
150 | None. |