According to the kernel documentation net.un开发者_如何学编程ix.max_dgram_qlen sysctl controls the maximum length of a datagram socket receive queue (for AF_UNIX/AF_LOCAL sockets that is). I can always send 1 more than this value before send calls to that receiver start blocking. Anyone know why?
Also, does anyone know if this was ever implemented as a socket option. (Kind of like SO_SNDBUF corresponds to wmem_default and wmem_max). This thread mentions that possibility but I can't find where anyone ever did it.
1., That's how it is checked:
static inline int unix_recvq_full(struct sock const *sk)
{
return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog;
}
That's why you can initiate one more connection than the value you had set.
2., The backlog parameter you pass to listen() is also used as max_ack_backlog. No other way exists to influence it, though.
精彩评论