Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

snp(4) [linux man page]

SNP(4)                                                     BSD Kernel Interfaces Manual                                                     SNP(4)

NAME
snp -- tty snoop interface SYNOPSIS
#include <sys/snoop.h> int ioctl(fd, SNPSTTY, &dev); int ioctl(fd, SNPGTTY, &dev); int ioctl(fd, FIONREAD, &result); DESCRIPTION
/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 snp module must be loaded, for these devices to be available. To associate a given snp device with a tty to be observed, open the snp device and a tty device, and then issue the SNPSTTY ioctl on snp device. The argument passed to the ioctl(2) is the address of a variable of type int, holding the file descriptor of a tty device. To detach the snp 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 snp 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 snp device has been detached by user or tty device has been closed and detached. SEE ALSO
pty(4), sio(4), kldload(8), watch(8) HISTORY
The snp device first appeared in FreeBSD 2.1. In FreeBSD 8.0 the snp driver was rewritten to work with the replaced TTY subsystem. AUTHORS
The author of the current implementation is Ed Schouten <ed@FreeBSD.org>. Previous versions of snp were based on code written by Ugen J.S. Antsilevich <ugen@NetVision.net.il>. BUGS
This version of snp does not return proper error codes when calling FIONREAD. It also does not allow SNPSTTY to detach itself from the TTY. BSD November 5, 2008 BSD

Check Out this Related Man Page

PTS(4)							   BSD Kernel Interfaces Manual 						    PTS(4)

NAME
pts -- pseudo-terminal driver DESCRIPTION
The pts driver provides support for a device-pair termed a pseudo-terminal. A pseudo-terminal is a pair of character devices, a master device and a slave device. The slave device provides to a process an interface identical to that described in tty(4). However, whereas all other devices which provide the interface described in tty(4) have a hardware device of some sort behind them, the slave device has, instead, another process manipulating it through the master half of the pseudo-terminal. That is, anything written on the master device is given to the slave device as input and anything written on the slave device is presented as input on the master device. The following ioctl(2) calls apply only to pseudo-terminals: TIOCPKT Enable/disable packet mode. Packet mode is enabled by specifying (by reference) a nonzero parameter and disabled by specifying (by reference) a zero parameter. When applied to the master side of a pseudo-terminal, each subsequent read(2) from the termi- nal will return data written on the slave part of the pseudo-terminal preceded by a zero byte (symbolically defined as TIOCPKT_DATA), or a single byte reflecting control status information. In the latter case, the byte is an inclusive-or of zero or more of the bits: TIOCPKT_FLUSHREAD whenever the read queue for the terminal is flushed. TIOCPKT_FLUSHWRITE whenever the write queue for the terminal is flushed. TIOCPKT_STOP whenever output to the terminal is stopped a la '^S'. TIOCPKT_START whenever output to the terminal is restarted. TIOCPKT_DOSTOP whenever VSTOP is '^S' and VSTART is '^Q'. TIOCPKT_NOSTOP whenever the start and stop characters are not '^S/^Q'. While this mode is in use, the presence of control status information to be read from the master side may be detected by a select(2) for exceptional conditions. This mode is used by rlogin(1) and rlogind(8) to implement a remote-echoed, locally '^S/^Q' flow-controlled remote login with proper back-flushing of output; it can be used by other similar programs. TIOCGPTN Obtain device unit number, which can be used to generate the filename of the pseudo-terminal slave device. This ioctl(2) should not be used directly. Instead, the ptsname(3) function should be used. TIOCPTMASTER Determine whether the file descriptor is pointing to a pseudo-terminal master device. This ioctl(2) should not be used directly. It is used to implement routines like grantpt(3). FILES
The files used by this pseudo-terminals implementation are: /dev/pts/[num] Pseudo-terminal slave devices. DIAGNOSTICS
None. SEE ALSO
posix_openpt(2), grantpt(3), ptsname(3), pty(4), tty(4) HISTORY
A pseudo-terminal driver appeared in 4.2BSD. In FreeBSD 8.0, it was replaced with the pts driver. BSD
August 20, 2008 BSD
Man Page