snp.4 revision 6656

@(#)snp.4 1.1 (FreeBSD) 2/17/95

.Dd February 17, 1995 .Dt SNP 4 .Os FreeBSD .Sh NAME .Nm snp .Nd tty snoop interface .Sh SYNOPSIS .Fd #include <sys/ioctl.h> .Fd #include <sys/snoop.h> .Ft int .Fn ioctl fd SNPSTTY &snptty .Ft int .Fn ioctl fd SNPGTTY &snptty .Ft int .Fn ioctl fd FIONREAD 0 .Sh DESCRIPTION /dev/snp? are snoop devices which allow user to attach to any tty and watch activities on it. To associate a given .Nm snp device with a tty to be observed, open the .Nm snp device and then use the SNPSTTY ioctl. The argument passed to the IOCTL is the address of a structure of the following type: d -literal -ffset indent struct snptty { int st_unit; /* number of the tty unit */ int st_type; /* type of the tty to attach */ #define ST_PTY 0 /* regular pty */ #define ST_VTY 1 /* syscons vty */ #define ST_SIO 2 /* serial lines */ } .Ed

p By setting st_type or st_unit to -1, the user may detach the snp device for a tty.

p The SNPGTTY ioctl returns information about the current tty attached to the open .Nm snp device.

p The FIONREAD ioctl returns a positive value equal to the number of characters in a read buffer. Special values defined are: l -tag -width SNP_TTYCLOSE t Dv SNP_OFLOW device overflow occured, device detatched. t Dv SNP_TTYCLOSE tty not attached. t Dv SNP_DETACH .Nm snp device has been detatched by user or tty device has been closed and detatched. .Sh SEE ALSO .Xr watch 8 , .Xr pty 4 , .Xr sio 4 .Sh RESTRICTIONS Only the superuser may access the .Nm snp devices. .Sh BUGS While in line mode, user input can't be seen. .Nm snp is a read-only device, there is no ability to write to attached tty device. .Sh AUTHOR Ugen J.S. Antsilevich <ugen@NetVision.net.il> .Sh HISTORY The .Nm snp device first appeared in FreeBSD 2.1.