Re: recvmsg() "short receive" after FIONREAD

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Fri, 10 Sep 2021 19:40:23 UTC
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 :)

-- 
Andriy Gapon