Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 2021 10:54:10 +0200
From:      Bertrand Petit <freebsd-hackers@phoe.frmug.org>
To:        Konstantin Belousov <kostikbel@gmail.com>, Gary Jennejohn <gljennjohn@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Is snp(4) in working order?
Message-ID:  <20210820085410.GA97799@memo2.memo.frmug.org>
In-Reply-To: <20210819183344.358e1f55@ernst.home> <YR6RiRVXSTkFtIr%2B@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210820085410.GA97799>