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
|
<table class="head">
<tr>
<td class="head-ltitle">NG_TTY(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">NG_TTY(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">ng_tty</code> — <span class="Nd">netgraph
node type that is also a TTY hook</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/types.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/ttycom.h</a>></code>
<br/>
<code class="In">#include
<<a class="In">netgraph/ng_tty.h</a>></code></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">tty</code> node type is both a netgraph node
type and a TTY hook.</p>
<p class="Pp">The node has a single hook called <code class="Dv">hook</code>.
Incoming bytes received on the tty device are sent out on this hook, and
frames received on <code class="Dv">hook</code> are transmitted out on the
tty device. No modification to the data is performed in either direction.
While the hook is installed on a tty, the normal read and write operations
are unavailable, returning <code class="Er">EIO</code>.</p>
<p class="Pp">Incoming data is delivered directly to ng_tty via the tty bypass
hook as a buffer pointer and length, this is converted to a mbuf and passed
to the peer.</p>
<p class="Pp">The node supports an optional “hot character”. If
the driver can not deliver data directly to the tty bypass hook then each
character is input one at a time. If set to non-zero and bypass mode is
unavailable, incoming data from the tty device is queued until this
character is seen. This avoids sending lots of mbufs containing a small
number of bytes, but introduces potentially infinite latency. The default
hot character is 0x7e, consistent with <code class="Dv">hook</code> being
connected to a <a class="Xr">ng_async(4)</a> type node. The hot character
has no effect on the transmission of data.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="HOOKS"><a class="permalink" href="#HOOKS">HOOKS</a></h1>
<p class="Pp">This node type supports the following hooks:</p>
<dl class="Bl-tag">
<dt id="hook"><var class="Va">hook</var></dt>
<dd><a class="Xr">tty(4)</a> serial data contained in
<code class="Dv">mbuf</code> structures, with arbitrary inter-frame
boundaries.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="CONTROL_MESSAGES"><a class="permalink" href="#CONTROL_MESSAGES">CONTROL
MESSAGES</a></h1>
<p class="Pp">This node type supports the generic control messages, plus the
following:</p>
<dl class="Bl-tag">
<dt id="NGM_TTY_SET_HOTCHAR"><a class="permalink" href="#NGM_TTY_SET_HOTCHAR"><code class="Dv">NGM_TTY_SET_HOTCHAR</code></a></dt>
<dd>This command takes an integer argument and sets the hot character from the
lower 8 bits. A hot character of zero disables queueing, so that all
received data is forwarded immediately.</dd>
<dt id="NGM_TTY_GET_HOTCHAR"><a class="permalink" href="#NGM_TTY_GET_HOTCHAR"><code class="Dv">NGM_TTY_GET_HOTCHAR</code></a></dt>
<dd>Returns an integer containing the current hot character in the lower eight
bits.</dd>
<dt id="NGM_TTY_SET_TTY"><a class="permalink" href="#NGM_TTY_SET_TTY"><code class="Dv">NGM_TTY_SET_TTY</code></a></dt>
<dd>This command takes integer process ID and file descriptor of open tty and
registers the tty hooks.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SHUTDOWN"><a class="permalink" href="#SHUTDOWN">SHUTDOWN</a></h1>
<p class="Pp">This node shuts down when the corresponding device is closed.</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">ioctl(2)</a>, <a class="Xr">netgraph(4)</a>,
<a class="Xr">ng_async(4)</a>, <a class="Xr">tty(4)</a>,
<a class="Xr">ngctl(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">ng_tty</code> node type was implemented in
<span class="Ux">FreeBSD 4.0</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp"><span class="An">Archie Cobbs</span>
<<a class="Mt" href="mailto:archie@FreeBSD.org">archie@FreeBSD.org</a>>
<br/>
<span class="An">Andrew Thompson</span>
<<a class="Mt" href="mailto:thompsa@FreeBSD.org">thompsa@FreeBSD.org</a>></p>
</section>
<section class="Sh">
<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
<p class="Pp">The serial driver code also has a notion of a “hot
character”. Unfortunately, this value is statically defined in terms
of the line discipline and cannot be changed. Therefore, if a hot character
other than 0x7e (the default) is set for the <code class="Nm">ng_tty</code>
node, the node has no way to convey this information to the serial driver,
and sub-optimal performance may result.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">December 25, 2008</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|