SNP(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… SNP(4) β€” tty snoop interface πŸ’…

okay so bestie, welcome to SNP(4) from the Kernel Interfaces Manual β€” manual name right there, no cap. this page is all about snp, the tty snoop interface, and it is lowkey iconic. πŸŽ€

🌸 NAME 🌸

snp β€” tty snoop interface

✨ SYNOPSIS ✨

here's the exact synopsis vibe, bestie:

#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. literally the main character of terminal observation. πŸ‘‘

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. that's the whole attach/detach ritual, bestie. 🫢

The SNPGTTY ioctl returns information about the current tty attached to the open snp device. yes, it's giving β€œwho am I attached to?” energy. πŸ’…

The FIONREAD ioctl returns a positive value equal to the number of characters in a read buffer. Special values defined are:

  • SNP_TTYCLOSE β€” tty not attached.
  • SNP_DETACH β€” snp device has been detached by user or tty device has been closed and detached.

πŸ’– SEE ALSO πŸ’–

🌈 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. glow-up behavior, honestly. ✨

πŸ‘‘ 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>. we stan both. 🫢


πŸ’– so that's the whole SNP(4) moment: source/version Debian, date September 24, 2022, signing off with a little sparkle. mwah! πŸ’–

πŸ“¦ where this page comes from