Re: Is snp(4) in working order?

From: Bertrand Petit <freebsd-hackers_at_phoe.frmug.org>
Date: Fri, 20 Aug 2021 10:54:10 +0200
On Thu, Aug 19, 2021 at 08:14:49PM +0300, Konstantin Belousov wrote:
> Did you tried watch(8) first?

	No, I didn't; yes, now I did and observed the same behavior, which is
silence from the device.

	After reading sys/dev/snp/snp.c, I understand that the sighted
nothingness is normal and should be expected because the snp(4) device can
only snoop on egress tty streams. The manual page lacks on this point.

	Since I need access to ingress trafic, I suppose I need to go through
the bpf/usbdump way. (I'm not looking forward to that.)


On Thu, Aug 19, 2021 at 08:33:44PM +0200, Gary Jennejohn wrote:
> C-code.  Pay particuar attention to how FIONREAD is used in main().

	I must mention that FIONREAD on snp(4) devices no longer has special
return status codes. The snp(4) manual page and the watch(8) command are both
way out of sync with the actual implementation of the device driver.
Disappearance, closure and detachement of the snooped device are now signaled
by an EIO return on read() and by an EIO or ENXIO return on write().

	I will issue a PR for this manual page.

-- 
%!PS -- Bertrand Petit
/D{def}def/E{exch}D/G{get}D/I{2 div}D/U{dup}D/L{roll}D/Y{setgray}D/N{newpath}D
/O{N 0 0 moveto}D/P{pop}D/T{translate}D currentpagedevice/PageSize G U 0 G/w E
D 1 G /h E D w I h I T 0 Y 1 setlinewidth 0 1 2 { P 120 rotate 2 4 w U mul h U
mul add sqrt I 50 add {N 50 0 3 2 L 0 360 arc stroke}for}for/s{O true charpath
pathbbox exch 4 -1 L E sub I 3 1 L sub I} D /l(bp)D 0.94 Y /Helvetica findfont
22 scalefont setfont l s P(x)s exch P T O l show showpage
Received on Fri Aug 20 2021 - 08:54:10 UTC

Original text of this message