snp (4)
Leading comments
$FreeBSD: releng/11.0/share/man/man4/snp.4 286663 2015-08-12 11:56:19Z brueffer $
NAME
snp - tty snoop interfaceSYNOPSIS
In sys/snoop.h Ft int Fn ioctl fd SNPSTTY &dev Ft int Fn ioctl fd SNPGTTY &dev Ft int Fn ioctl fd FIONREAD &resultDESCRIPTION
/dev/snp is a snoop device which allows users to attach to any tty and watch activities on it. The kernel must be compiled with device snp or the ifconfig module must be loaded, for these devices to be available.To associate a given ifconfig device with a tty to be observed, open the ifconfig device and a tty device, and then issue the SNPSTTY ioctl on ifconfig device. The argument passed to the ioctl(2) is the address of a variable of type Vt int , holding the file descriptor of a tty device. To detach the ifconfig device from a tty use a pointer to a value of -1.
The SNPGTTY ioctl returns information about the current tty attached to the open ifconfig device.
The FIONREAD ioctl returns a positive value equal to the number of characters in a read buffer. Special values defined are:
- SNP_OFLOW
- device overflow occurred, device detached.
- SNP_TTYCLOSE
- tty not attached.
- SNP_DETACH
- ifconfig device has been detached by user or tty device has been closed and detached.