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
|
<table class="head">
<tr>
<td class="head-ltitle">SNP(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">SNP(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">snp</code> — <span class="Nd">tty snoop
interface</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/snoop.h</a>></code></p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">ioctl</code>(<var class="Fa" style="white-space: nowrap;">fd</var>,
<var class="Fa" style="white-space: nowrap;">SNPSTTY</var>,
<var class="Fa" style="white-space: nowrap;">&dev</var>);</p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">ioctl</code>(<var class="Fa" style="white-space: nowrap;">fd</var>,
<var class="Fa" style="white-space: nowrap;">SNPGTTY</var>,
<var class="Fa" style="white-space: nowrap;">&dev</var>);</p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">ioctl</code>(<var class="Fa" style="white-space: nowrap;">fd</var>,
<var class="Fa" style="white-space: nowrap;">FIONREAD</var>,
<var class="Fa" style="white-space: nowrap;">&result</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp"><span class="Pa">/dev/snp</span> is a snoop device which allows
users to attach to any tty and watch activities on it. The kernel must be
compiled with <code class="Cd">device snp</code>, or the
<code class="Nm">snp</code> module must be loaded, for these devices to be
available.</p>
<p class="Pp">To associate a given <code class="Nm">snp</code> device with a tty
to be observed, open the <code class="Nm">snp</code> device and a tty
device, and then issue the <code class="Dv">SNPSTTY</code> ioctl on
<code class="Nm">snp</code> device. The argument passed to the
<a class="Xr">ioctl(2)</a> is the address of a variable of type
<var class="Vt">int</var>, holding the file descriptor of a tty device. To
detach the <code class="Nm">snp</code> device from a tty use a pointer to a
value of -1.</p>
<p class="Pp">The <code class="Dv">SNPGTTY</code> ioctl returns information
about the current tty attached to the open <code class="Nm">snp</code>
device.</p>
<p class="Pp">The <code class="Dv">FIONREAD</code> ioctl returns a positive
value equal to the number of characters in a read buffer. Special values
defined are:</p>
<dl class="Bl-tag">
<dt id="SNP_TTYCLOSE"><a class="permalink" href="#SNP_TTYCLOSE"><code class="Dv">SNP_TTYCLOSE</code></a></dt>
<dd>tty not attached.</dd>
<dt id="SNP_DETACH"><a class="permalink" href="#SNP_DETACH"><code class="Dv">SNP_DETACH</code></a></dt>
<dd><code class="Nm">snp</code> device has been detached by user or tty device
has been closed and detached.</dd>
</dl>
</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">pty(4)</a>, <a class="Xr">kldload(8)</a>,
<a class="Xr">watch(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">snp</code> device first appeared in
<span class="Ux">FreeBSD 2.1</span>. In <span class="Ux">FreeBSD 8.0</span>
the <code class="Nm">snp</code> driver was rewritten to work with the
replaced TTY subsystem.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">The author of the current implementation is <span class="An">Ed
Schouten</span>
<<a class="Mt" href="mailto:ed@FreeBSD.org">ed@FreeBSD.org</a>>.
Previous versions of <code class="Nm">snp</code> were based on code written
by <span class="An">Ugen J.S. Antsilevich</span>
<<a class="Mt" href="mailto:ugen@NetVision.net.il">ugen@NetVision.net.il</a>>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">September 24, 2022</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|