AF_UNIX socket overhead?

后端 未结 2 951
执笔经年
执笔经年 2020-12-29 06:15

I\'m seeing a couple strange things with a pair of AF_UNIX sockets created by a call such as:

 socketpair(AF_UNIX, SOCK_STREAM, 0, sfd); 

W

相关标签:
2条回答
  • 2020-12-29 06:26

    Have you looked at the value of the net.unix.max_dgram_qlen sysctl?

    The kernel imposes a limit on the maximum number of in-flight AF_UNIX datagrams. On my system the limit is actually very low: only 10.

    0 讨论(0)
  • 2020-12-29 06:29

    Take a look at the socket(7) man page. There is a section that reads:

    SO_SNDBUF Sets or gets the maximum socket send buffer in bytes. The kernel doubles this value (to allow space for bookkeeping overhead) when it is set using setsockopt(2), and this doubled value is returned by getsockopt(2). The default value is set by the /proc/sys/net/core/wmem_default file and the maximum allowed value is set by the /proc/sys/net/core/wmem_max file. The minimum (doubled) value for this option is 2048.

    So it appears that the overhead is simply to hold bookkeeping information for the Kernel.

    0 讨论(0)
提交回复
热议问题