tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

AF_UNIX socketpair dgram queue sizes



Hello,

I'm trying to wrap my head around the buffer sizes
relevant to AF_UNIX/PF_LOCAL dgram socketpairs.

On a NetBSD/amd64 9.2 system, creating a socketpair
and simply writing a single byte in a loop to the
write end without reading the data in non-blocking
mode, I can write

net.local.dgram.recvspace / 512 datagrams with a
single byte

e.g.,

16384 recvspace => 32 1-byte writes

Likewise, I can perform 32 writes of up to 400 bytes,
but if I try to write 401 byte-sized chunks, I can
only perform 22 such writes.

This is similarly observed for any variation of
recvspace (32K => 64 writes of 1 - 400 bytes, but 43
writes if the payload is 401 bytes etc.).

This 400-byte cutoff does not appear to be related to
either the recvspace nor SO_SNDBUF -- which, for a
dgram, should be the max datagram size.  And indeed I
cannot write any chunks of > 2560 bytes, but can write
(6 * 2560 + 1 * 1010) = 16370 bytes (which, at 2 bytes
overhead per socketpair dgram, apparently, adds up to
exactly 16K recvspace).

Does anybody know where the 400 byte number comes
from, or what I'm getting confused here?

-Jan


Home | Main Index | Thread Index | Old Index