Re: recvmsg, fd passing and soreceive

2014-05-19 Thread Jérémie Courrèges-Anglas
Claudio Jeker cje...@diehard.n-r-g.com writes: [...] I wonder what other systems do with regard to fd passing with empty messages. I always had the feeling that this is not allowed but I never looked deeper into the standards defining this. I don't which standard does actually define this.

Re: recvmsg, fd passing and soreceive

2014-05-15 Thread Claudio Jeker
On Wed, May 14, 2014 at 10:03:35PM -0700, Philip Guenther wrote: On Wed, May 14, 2014 at 10:02 PM, Philip Guenther guent...@gmail.comwrote: On Wed, May 14, 2014 at 4:58 AM, Jérémie Courrèges-Anglas j...@wxcvbn.orgwrote: ... So here's the diff I came up with: - set MSG_TRUNC for

recvmsg, fd passing and soreceive

2014-05-14 Thread Jérémie Courrèges-Anglas
Hi, Initially, I just wanted to try the examples in CMSG_DATA(3). They are a bit incomplete, so I had to guess a few things. This is the result of my tests: #include sys/types.h #include sys/socket.h #include sys/uio.h #include sys/wait.h #include err.h #include errno.h #include limits.h

Re: recvmsg, fd passing and soreceive

2014-05-14 Thread Matthew Dempsky
On Wed, May 14, 2014 at 4:58 AM, Jérémie Courrèges-Anglas j...@wxcvbn.org wrote: if (cmsg-cmsg_len == CMSG_LEN(sizeof(int)) cmsg-cmsg_level == SOL_SOCKET cmsg-cmsg_type == SCM_RIGHTS) {

Re: recvmsg, fd passing and soreceive

2014-05-14 Thread Jérémie Courrèges-Anglas
Matthew Dempsky matt...@dempsky.org writes: On Wed, May 14, 2014 at 4:58 AM, Jérémie Courrèges-Anglas j...@wxcvbn.org wrote: if (cmsg-cmsg_len == CMSG_LEN(sizeof(int)) cmsg-cmsg_level == SOL_SOCKET

Re: recvmsg, fd passing and soreceive

2014-05-14 Thread Philip Guenther
On Wed, May 14, 2014 at 4:58 AM, Jérémie Courrèges-Anglas j...@wxcvbn.orgwrote: ... So here's the diff I came up with: - set MSG_TRUNC for atomic protocols only if there is actually a data loss - drop the remaining mbuf(s) if the protocol is atomic *or* it is an empty message I'm

Re: recvmsg, fd passing and soreceive

2014-05-14 Thread Philip Guenther
On Wed, May 14, 2014 at 10:02 PM, Philip Guenther guent...@gmail.comwrote: On Wed, May 14, 2014 at 4:58 AM, Jérémie Courrèges-Anglas j...@wxcvbn.orgwrote: ... So here's the diff I came up with: - set MSG_TRUNC for atomic protocols only if there is actually a data loss - drop the