xref: /freebsd/share/man/man4/snp.4 (revision 9336e0699bda8a301cd2bfa37106b6ec5e32012e)
1.\"
2.\" $FreeBSD$
3.\"
4.Dd September 18, 2005
5.Dt SNP 4
6.Os
7.Sh NAME
8.Nm snp
9.Nd tty snoop interface
10.Sh SYNOPSIS
11.In sys/snoop.h
12.Ft int
13.Fn ioctl fd SNPSTTY &dev
14.Ft int
15.Fn ioctl fd SNPGTTY &dev
16.Ft int
17.Fn ioctl fd FIONREAD &result
18.Sh DESCRIPTION
19.Pa /dev/snp?
20are snoop devices which allow users to attach to any tty
21and watch activities on it.
22The kernel must be compiled with
23.Cd "device snp" ,
24or the
25.Nm
26module must be loaded,
27for these devices to be available.
28.Pp
29To associate a given
30.Nm
31device with a tty to be observed, open the
32.Nm
33device and a tty device, and then issue the
34.Dv SNPSTTY
35ioctl on
36.Nm
37device.
38The argument passed to the
39.Xr ioctl 2
40is the address of a variable of type
41.Vt int ,
42holding the file descriptor of a tty device.
43To detach the
44.Nm
45device from a tty use a pointer to a value of
46\-1.
47.Pp
48The
49.Dv SNPGTTY
50ioctl returns information about the current tty attached to
51the open
52.Nm
53device.
54.Pp
55The
56.Dv FIONREAD
57ioctl returns a positive value equal to the number of characters
58in a read buffer.
59Special values defined are:
60.Bl -tag -width ".Dv SNP_TTYCLOSE"
61.It Dv SNP_OFLOW
62device overflow occurred, device detached.
63.It Dv SNP_TTYCLOSE
64tty not attached.
65.It Dv SNP_DETACH
66.Nm
67device has been detached by user or tty device has been closed
68and detached.
69.El
70.Sh SEE ALSO
71.Xr pty 4 ,
72.Xr sio 4 ,
73.Xr kldload 8 ,
74.Xr watch 8
75.Sh HISTORY
76The
77.Nm
78device first appeared in
79.Fx 2.1 .
80.Sh AUTHORS
81.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il
82.Sh BUGS
83Caveat emptor!
84This manual page is horribly stale and wildly inaccurate in some places.
85.Pp
86While in line mode, user input cannot be seen.
87No signals may be sent to the observed tty.
88