Move socket_set_errno_einval to portable/socket.h

This is more generally useful outside of util/network.c, so move it
into the generic portability layer.  (Julien ÉLIE requested it for
INN, for example.)