1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
<table class="head">
<tr>
<td class="head-ltitle">PTS(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">PTS(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">pts</code> —
<span class="Nd">pseudo-terminal driver</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">pts</code> driver provides support for a
device-pair termed a
<a class="permalink" href="#pseudo-terminal"><i class="Em" id="pseudo-terminal">pseudo-terminal</i></a>.
A pseudo-terminal is a pair of character devices, a
<a class="permalink" href="#master"><i class="Em" id="master">master</i></a>
device and a
<a class="permalink" href="#slave"><i class="Em" id="slave">slave</i></a>
device. The slave device provides to a process an interface identical to
that described in <a class="Xr">tty(4)</a>. However, whereas all other
devices which provide the interface described in <a class="Xr">tty(4)</a>
have a hardware device of some sort behind them, the slave device has,
instead, another process manipulating it through the master half of the
pseudo-terminal. That is, anything written on the master device is given to
the slave device as input and anything written on the slave device is
presented as input on the master device.</p>
<p class="Pp">The following <a class="Xr">ioctl(2)</a> calls apply only to
pseudo-terminals:</p>
<dl class="Bl-tag">
<dt id="TIOCPKT"><a class="permalink" href="#TIOCPKT"><code class="Dv">TIOCPKT</code></a></dt>
<dd>Enable/disable
<a class="permalink" href="#packet"><i class="Em" id="packet">packet</i></a>
mode. Packet mode is enabled by specifying (by reference) a nonzero
parameter and disabled by specifying (by reference) a zero parameter. When
applied to the master side of a pseudo-terminal, each subsequent
<a class="Xr">read(2)</a> from the terminal will return data written on
the slave part of the pseudo-terminal preceded by a zero byte
(symbolically defined as <code class="Dv">TIOCPKT_DATA</code>), or a
single byte reflecting control status information. In the latter case, the
byte is an inclusive-or of zero or more of the bits:
<dl class="Bl-tag">
<dt id="TIOCPKT_FLUSHREAD"><a class="permalink" href="#TIOCPKT_FLUSHREAD"><code class="Dv">TIOCPKT_FLUSHREAD</code></a></dt>
<dd>whenever the read queue for the terminal is flushed.</dd>
<dt id="TIOCPKT_FLUSHWRITE"><a class="permalink" href="#TIOCPKT_FLUSHWRITE"><code class="Dv">TIOCPKT_FLUSHWRITE</code></a></dt>
<dd>whenever the write queue for the terminal is flushed.</dd>
<dt id="TIOCPKT_STOP"><a class="permalink" href="#TIOCPKT_STOP"><code class="Dv">TIOCPKT_STOP</code></a></dt>
<dd>whenever output to the terminal is stopped a la
‘<code class="Li">^S</code>’.</dd>
<dt id="TIOCPKT_START"><a class="permalink" href="#TIOCPKT_START"><code class="Dv">TIOCPKT_START</code></a></dt>
<dd>whenever output to the terminal is restarted.</dd>
<dt id="TIOCPKT_DOSTOP"><a class="permalink" href="#TIOCPKT_DOSTOP"><code class="Dv">TIOCPKT_DOSTOP</code></a></dt>
<dd>whenever <code class="Dv">VSTOP</code> is
‘<code class="Li">^S</code>’ and
<code class="Dv">VSTART</code> is
‘<code class="Li">^Q</code>’.</dd>
<dt id="TIOCPKT_NOSTOP"><a class="permalink" href="#TIOCPKT_NOSTOP"><code class="Dv">TIOCPKT_NOSTOP</code></a></dt>
<dd>whenever the start and stop characters are not
‘<code class="Li">^S/^Q</code>’.</dd>
</dl>
<p class="Pp">While this mode is in use, the presence of control status
information to be read from the master side may be detected by a
<a class="Xr">select(2)</a> for exceptional conditions.</p>
<p class="Pp">This mode is used by <a class="Xr">rlogin(1)</a> and
<a class="Xr">rlogind(8)</a> to implement a remote-echoed, locally
‘<code class="Li">^S/^Q</code>’ flow-controlled remote
login with proper back-flushing of output; it can be used by other
similar programs.</p>
</dd>
<dt id="TIOCGPTN"><a class="permalink" href="#TIOCGPTN"><code class="Dv">TIOCGPTN</code></a></dt>
<dd>Obtain device unit number, which can be used to generate the filename of
the pseudo-terminal slave device. This <a class="Xr">ioctl(2)</a> should
not be used directly. Instead, the <a class="Xr">ptsname(3)</a> function
should be used.</dd>
<dt id="TIOCPTMASTER"><a class="permalink" href="#TIOCPTMASTER"><code class="Dv">TIOCPTMASTER</code></a></dt>
<dd>Determine whether the file descriptor is pointing to a pseudo-terminal
master device. This <a class="Xr">ioctl(2)</a> should not be used
directly. It is used to implement routines like
<a class="Xr">grantpt(3)</a>.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
<p class="Pp">The files used by this pseudo-terminals implementation are:</p>
<dl class="Bl-tag">
<dt><span class="Pa">/dev/pts/[num]</span></dt>
<dd>Pseudo-terminal slave devices.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="DIAGNOSTICS"><a class="permalink" href="#DIAGNOSTICS">DIAGNOSTICS</a></h1>
<p class="Pp">None.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">posix_openpt(2)</a>, <a class="Xr">grantpt(3)</a>,
<a class="Xr">ptsname(3)</a>, <a class="Xr">pty(4)</a>,
<a class="Xr">tty(4)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">A pseudo-terminal driver appeared in
<span class="Ux">4.2BSD</span>. In <span class="Ux">FreeBSD 8.0</span>, it
was replaced with the <code class="Nm">pts</code> driver.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">August 20, 2008</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|