Date: Sat, 11 Sep 2021 11:15:12 +0300 From: Andriy Gapon <avg@FreeBSD.org> To: Mark Johnston <markj@freebsd.org> Cc: "net@FreeBSD.org" <net@freebsd.org>, hackers@freebsd.org Subject: Re: recvmsg() "short receive" after FIONREAD Message-ID: <b309f8a5-c550-905b-4340-0b7005ea6fe3@FreeBSD.org> In-Reply-To: <4a2165c5-b97b-8fb7-9ada-0acae3197824@FreeBSD.org> References: <500a2272-c1b3-3f97-0096-9fe8117c4b95@FreeBSD.org> <6f455869-cbdd-ee20-f2f8-f633e22071e9@FreeBSD.org> <YTuznrhho4qGXqu8@nuc> <cdd2328e-e6aa-f0fc-a77a-adae03759f18@FreeBSD.org> <4a2165c5-b97b-8fb7-9ada-0acae3197824@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 10/09/2021 22:40, Andriy Gapon wrote: > On 10/09/2021 22:38, Andriy Gapon wrote: >> On 10/09/2021 22:35, Mark Johnston wrote: >>> Indeed, I suspect that this is the problem. Note that for >>> kevent(EVFILT_READ) we subtract the number of control message bytes from >>> the returned value, see filt_soread(). I wonder if FIONREAD should do >>> the same thing. >> >> Thank you for the suggestion. >> I think that it is a reasonable expectation that FIONREAD returns a number of >> bytes that can be actually read. >> I'll look at filt_soread(). > > kn_data = sbavail(&so->so_rcv) - so->so_rcv.sb_ctl; > Is this it? > Looks simple enough for a quick test :) Works perfectly. Should I just commit it or is a larger discussion needed? -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b309f8a5-c550-905b-4340-0b7005ea6fe3>