+cc golang-dev
+bcc golang-nuts
Hello,
I would like to propose a change in the net package in the
{Read,Write}Msg* methods (they are to be new in Go1.1), so that they
allow flags to be passed in. As far as I know, the only way to read a
socket's error queue in Linux is to use recvmsg with MSG_ERRQUEUE flag
set. The {Read,Write}Msg methods don't allow flags to be passed in and
set them always to 0.
I propose that both ReadMsg* and WriteMsg* take an additional argument
for flags. This obviously exports system-specific flags out of the net
package, but we already do that in the other direction in these same
methods. ReadMsg should filter out MSG_WAITALL (because it seems
nonsensical or poorly defined for nonblocking operations); all other
flags from POSIX and Linux-specific ones seem not to interfere with
the assumptions related to the poll server or nonblocking behaviour. I
also propose that ReadMsgUnix set MSG_CMSG_CLOEXEC, for similar
reasons we set O_CLOEXEC in open() (although I'm not sure if that
shouldn't be the domain of someone who actually uses SCM_RIGHTS). For
WriteMsg* I didn't find any flags that would seem to interfere with
assumptions related to the poll server and nonblocking behaviour.
I will send a CL upon request; I didn't do it first because the
contributing guidelines strongly advise against that. This is a change
that, as far as I understand the backwards compatibility guarantees,
should be made before Go1.1 or not at all in the foreseeable future.
Robert