1995-02-23 01:25:48 +00:00
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1995-02-23 01:25:48 +00:00
|
|
|
.\"
|
2008-11-05 15:04:03 +00:00
|
|
|
.Dd November 5, 2008
|
1995-02-23 01:25:48 +00:00
|
|
|
.Dt SNP 4
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1995-02-17 18:48:36 +00:00
|
|
|
.Sh NAME
|
1995-02-23 01:25:48 +00:00
|
|
|
.Nm snp
|
|
|
|
.Nd tty snoop interface
|
1995-02-17 18:48:36 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/snoop.h
|
1995-02-23 01:25:48 +00:00
|
|
|
.Ft int
|
1995-02-25 20:15:20 +00:00
|
|
|
.Fn ioctl fd SNPSTTY &dev
|
1995-02-23 01:25:48 +00:00
|
|
|
.Ft int
|
1995-02-25 20:15:20 +00:00
|
|
|
.Fn ioctl fd SNPGTTY &dev
|
1995-02-23 01:25:48 +00:00
|
|
|
.Ft int
|
1995-02-25 20:15:20 +00:00
|
|
|
.Fn ioctl fd FIONREAD &result
|
1995-02-17 18:48:36 +00:00
|
|
|
.Sh DESCRIPTION
|
2008-08-15 13:07:07 +00:00
|
|
|
.Pa /dev/snp
|
|
|
|
is a snoop device which allows users to attach to any tty
|
1995-02-23 01:25:48 +00:00
|
|
|
and watch activities on it.
|
2001-11-24 17:02:58 +00:00
|
|
|
The kernel must be compiled with
|
|
|
|
.Cd "device snp" ,
|
|
|
|
or the
|
|
|
|
.Nm
|
2002-08-13 14:12:31 +00:00
|
|
|
module must be loaded,
|
2001-11-24 17:02:58 +00:00
|
|
|
for these devices to be available.
|
2000-12-29 09:18:45 +00:00
|
|
|
.Pp
|
1995-02-23 01:25:48 +00:00
|
|
|
To associate a given
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
2002-07-31 09:32:22 +00:00
|
|
|
device with a tty to be observed, open the
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
2005-09-19 13:48:45 +00:00
|
|
|
device and a tty device, and then issue the
|
2002-08-13 14:12:31 +00:00
|
|
|
.Dv SNPSTTY
|
2005-09-19 13:48:45 +00:00
|
|
|
ioctl on
|
|
|
|
.Nm
|
|
|
|
device.
|
2002-08-13 14:12:31 +00:00
|
|
|
The argument passed to the
|
|
|
|
.Xr ioctl 2
|
|
|
|
is the address of a variable of type
|
2005-09-19 13:48:45 +00:00
|
|
|
.Vt int ,
|
|
|
|
holding the file descriptor of a tty device.
|
2002-08-13 14:12:31 +00:00
|
|
|
To detach the
|
|
|
|
.Nm
|
|
|
|
device from a tty use a pointer to a value of
|
2005-09-19 13:48:45 +00:00
|
|
|
\-1.
|
1995-02-23 01:25:48 +00:00
|
|
|
.Pp
|
2002-08-13 14:12:31 +00:00
|
|
|
The
|
|
|
|
.Dv SNPGTTY
|
|
|
|
ioctl returns information about the current tty attached to
|
1995-02-23 01:25:48 +00:00
|
|
|
the open
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
1995-02-23 01:25:48 +00:00
|
|
|
device.
|
|
|
|
.Pp
|
2002-08-13 14:12:31 +00:00
|
|
|
The
|
|
|
|
.Dv FIONREAD
|
|
|
|
ioctl returns a positive value equal to the number of characters
|
1995-02-23 01:25:48 +00:00
|
|
|
in a read buffer.
|
|
|
|
Special values defined are:
|
2002-08-13 14:12:31 +00:00
|
|
|
.Bl -tag -width ".Dv SNP_TTYCLOSE"
|
1995-02-23 01:25:48 +00:00
|
|
|
.It Dv SNP_OFLOW
|
2002-01-21 12:09:13 +00:00
|
|
|
device overflow occurred, device detached.
|
1995-02-23 01:25:48 +00:00
|
|
|
.It Dv SNP_TTYCLOSE
|
|
|
|
tty not attached.
|
|
|
|
.It Dv SNP_DETACH
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
1996-01-30 13:52:50 +00:00
|
|
|
device has been detached by user or tty device has been closed
|
|
|
|
and detached.
|
2000-12-29 09:18:45 +00:00
|
|
|
.El
|
1995-02-17 18:48:36 +00:00
|
|
|
.Sh SEE ALSO
|
1995-02-23 01:25:48 +00:00
|
|
|
.Xr pty 4 ,
|
1996-12-26 16:16:37 +00:00
|
|
|
.Xr sio 4 ,
|
2001-11-24 17:02:58 +00:00
|
|
|
.Xr kldload 8 ,
|
1996-12-26 16:16:37 +00:00
|
|
|
.Xr watch 8
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
device first appeared in
|
|
|
|
.Fx 2.1 .
|
2008-11-05 15:04:03 +00:00
|
|
|
In
|
|
|
|
.Fx 8.0
|
|
|
|
the
|
|
|
|
.Nm
|
|
|
|
driver was rewritten to work with the replaced TTY subsystem.
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh AUTHORS
|
2008-11-05 15:04:03 +00:00
|
|
|
The author of the current implementation is
|
|
|
|
.An Ed Schouten Aq ed@FreeBSD.org .
|
|
|
|
Previous versions of
|
|
|
|
.Nm
|
|
|
|
were based on code written by
|
|
|
|
.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il .
|
1995-02-17 18:48:36 +00:00
|
|
|
.Sh BUGS
|
2008-11-05 15:04:03 +00:00
|
|
|
This version of
|
|
|
|
.Nm
|
|
|
|
does not return proper error codes when calling
|
|
|
|
.Dv FIONREAD .
|
|
|
|
It also does not allow
|
|
|
|
.Dv SNPSTTY
|
|
|
|
to detach itself from the TTY.
|