]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/snp.4
Import device-tree files from Linux 6.3
[FreeBSD/FreeBSD.git] / share / man / man4 / snp.4
1 .\"
2 .\" $FreeBSD$
3 .\"
4 .Dd September 24, 2022
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
20 is a snoop device which allows users to attach to any tty
21 and watch activities on it.
22 The kernel must be compiled with
23 .Cd "device snp" ,
24 or the
25 .Nm
26 module must be loaded,
27 for these devices to be available.
28 .Pp
29 To associate a given
30 .Nm
31 device with a tty to be observed, open the
32 .Nm
33 device and a tty device, and then issue the
34 .Dv SNPSTTY
35 ioctl on
36 .Nm
37 device.
38 The argument passed to the
39 .Xr ioctl 2
40 is the address of a variable of type
41 .Vt int ,
42 holding the file descriptor of a tty device.
43 To detach the
44 .Nm
45 device from a tty use a pointer to a value of
46 \-1.
47 .Pp
48 The
49 .Dv SNPGTTY
50 ioctl returns information about the current tty attached to
51 the open
52 .Nm
53 device.
54 .Pp
55 The
56 .Dv FIONREAD
57 ioctl returns a positive value equal to the number of characters
58 in a read buffer.
59 Special values defined are:
60 .Bl -tag -width ".Dv SNP_TTYCLOSE"
61 .It Dv SNP_TTYCLOSE
62 tty not attached.
63 .It Dv SNP_DETACH
64 .Nm
65 device has been detached by user or tty device has been closed
66 and detached.
67 .El
68 .Sh SEE ALSO
69 .Xr pty 4 ,
70 .Xr kldload 8 ,
71 .Xr watch 8
72 .Sh HISTORY
73 The
74 .Nm
75 device first appeared in
76 .Fx 2.1 .
77 In
78 .Fx 8.0
79 the
80 .Nm
81 driver was rewritten to work with the replaced TTY subsystem.
82 .Sh AUTHORS
83 .An -nosplit
84 The author of the current implementation is
85 .An \&Ed Schouten Aq Mt ed@FreeBSD.org .
86 Previous versions of
87 .Nm
88 were based on code written by
89 .An Ugen J.S. Antsilevich Aq Mt ugen@NetVision.net.il .