---
name: "snp"
section: "4"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/snp"
---

# snp(4)

tty snoop interface

## 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?* are snoop devices which allow 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)](/ioctl/2.md) 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)](/pty/4.md), [sio(4)](/sio/4.md), [kldload(8)](/kldload/8.md), [watch(8)](/watch/8.md)

## HISTORY

The **snp** device first appeared in FreeBSD 2.1.

## AUTHORS

Ugen J.S. Antsilevich ⟨ugen@NetVision.net.il⟩

## BUGS

Caveat emptor! This manual page is horribly stale and wildly inaccurate in some places.

While in line mode, user input cannot be seen. No signals may be sent to the observed tty.
