joyent/libuv — pull request #902 by bnoordhuis (2013-08-24 13:25:53+00:00)
Title: linux: fix setsockopt(SO_REUSEPORT) error handling

Linux as of 3.9 has a SO_REUSEPORT option that is similar but not
identical to its BSD counterpart.

On the BSDs, it turns on SO_REUSEADDR _and_ makes it possible to share
the address and port across processes.

On Linux, it "merely" enables fair load distribution - port sharing
still requires that you set SO_REUSEADDR.

Fair distribution is a desirable trait but not an essential one.
We don't know in advance whether the kernel actually supports
SO_REUSEPORT so don't treat EINVAL or ENOPROTOOPT as errors.

As an aside, on the BSDs we now omit the setsockopt(SO_REUSEADDR)
system call because it's implied by SO_REUSEPORT.

Fixes #870.

Suggested reviewer: me. This PR is a CI check.