The limit comes from the sysctl_wmem_default
variable. It is available for viewing in the proc file system: /proc/sys/net/core/wmem_max
In this case, different versions of Linux may have different implementations. But there is code for UNIX domain sockets:
sk->sk_sndbuf = sysctl_wmem_default;
and
err = -EMSGSIZE; if (len > sk->sk_sndbuf - 32) goto out;
So the actual limit is: / proc / sys / net / core / wmem _max minus 32 . I do not know how much this magic number varies between versions. The value of / proc / sys / net / core / wmem _max seems to depend on the available ram pages.
In my linux field, the value is 105472. And the maximum size of the datagram (when using AF_UNIX and SOCK_DGRAM) is 105440. If I try to send a message of size 105441, it will fail with EMSGSIZE.
source share