Re: [PATCH net-next v3 2/3] vsock: support SO_INQ on stream sockets

From: Stefano Garzarella

Date: Wed Oct 21 2026 - 05:47:42 EST


On Fri, Oct 16, 2026 at 02:27:15PM +0100, David Carlier wrote:
SO_INQ makes recvmsg() return the bytes left in the receive queue in an
SCM_INQ cmsg, saving a SIOCINQ call per receive. AF_UNIX stream sockets
support it, AF_VSOCK fails with ENOPROTOOPT.

Add it for SOCK_STREAM, reusing the hint already computed for io_uring.
As with TCP_INQ, 1 is reported once the stream is finished so the caller
reads again and sees EOF, and accepted sockets inherit the setting from
the listener. No cmsg is sent when the transport cannot report the queue
length.

SOCK_SEQPACKET is refused, as on AF_UNIX: its transport callback counts
messages, not bytes.

Signed-off-by: David Carlier <devnexen@xxxxxxxxx>
---
include/net/af_vsock.h | 1 +
net/vmw_vsock/af_vsock.c | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 33 insertions(+), 3 deletions(-)

Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>