SNP(4)
πΈ NAME πΈ
okay bestie, welcome to the manual page for snp β the tty snoop interface π
(and yes, this is from the Kernel Interfaces Manual, section 4, so you know it's the real deal β¨)
π¦ 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, and its whole vibe is: you attach it to any tty and just... watch. π Watch all the activity happening on it. But β and this is important β the kernel has to be compiled with device snp, OR the snp module has to be loaded, for these devices to even exist. no module, no snooping, fr fr π
So here's how you get it set up, step by step π«Ά
- Open the
snpdevice. - Open the tty device you wanna observe.
- Issue the
SNPSTTYioctlon thesnpdevice.
The argument you pass to ioctl(2) is the address of a variable of type int, and that variable holds the file descriptor of a tty device. π
Wanna detach the snp device from a tty? Pass a pointer to a value of -1. That's it. goodbye π
The SNPGTTY ioctl gives you info about the current tty attached to the open snp device. like, "who am I currently stalking rn" energy π΅οΈβοΈ
The FIONREAD ioctl returns a positive value equal to the number of characters in a read buffer. and there are some special values defined, so let's get into them π
SNP_OFLOWβ device overflow occurred, device detached. πSNP_TTYCLOSEβ tty not attached. πSNP_DETACHβ snp device has been detached by user, OR the tty device has been closed and detached. π
π₯ SEE ALSO π₯
go read those too, bestie, they're the friend group π
π HISTORY π
The snp device first appeared in FreeBSD 2.1. π Then in FreeBSD 8.0 the snp driver was rewritten to work with the replaced TTY subsystem. glow-up era, 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>. π«Ά
π BUGS π
This version ofsnpdoes not return proper error codes when callingFIONREAD. It also does not allowSNPSTTYto detach itself from the TTY.
so yeah. it's giving "we know, we know" π not me warning you about it though β that's literally what the manpage says, no cap.
and that's the whole page, babes π§ from the Debian folks, dated November 5, 2008, filed under SNP(4) β mwah π β¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms