diff mbox

[ovs-dev] socket-util: Avoid using sendmsg on Windows

Message ID 20170713205348.6736-1-aserdean@cloudbasesolutions.com
State Accepted
Headers show

Commit Message

Alin Serdean July 13, 2017, 8:54 p.m. UTC
Sendmsg is not used under Windows.

While it does have a sort of equivalent called `WSASendMsg`
(https://msdn.microsoft.com/en-us/library/windows/desktop/ms741692(v=vs.85).aspx)
it uses a different structure `WSAMSG` instead of the normal msghdr which
in turn will have to be mapped properly (this goes further to iovec/wsabuf in the
structure itself).

Fixes broken build on Windows.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
 lib/socket-util.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ben Pfaff July 13, 2017, 10:31 p.m. UTC | #1
On Thu, Jul 13, 2017 at 08:54:08PM +0000, Alin Serdean wrote:
> Sendmsg is not used under Windows.
> 
> While it does have a sort of equivalent called `WSASendMsg`
> (https://msdn.microsoft.com/en-us/library/windows/desktop/ms741692(v=vs.85).aspx)
> it uses a different structure `WSAMSG` instead of the normal msghdr which
> in turn will have to be mapped properly (this goes further to iovec/wsabuf in the
> structure itself).
> 
> Fixes broken build on Windows.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>

Oops.

I pushed this.

(If we need it badly enough, we can deal with this too, but it's not a
big deal yet.)
Alin Serdean July 14, 2017, 3:57 p.m. UTC | #2
> -----Original Message-----
> From: Ben Pfaff [mailto:blp@ovn.org]
> Sent: Friday, July 14, 2017 1:32 AM
> To: Alin Serdean <aserdean@cloudbasesolutions.com>
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] socket-util: Avoid using sendmsg on Windows
> 
> On Thu, Jul 13, 2017 at 08:54:08PM +0000, Alin Serdean wrote:
> > Sendmsg is not used under Windows.
> >
> > While it does have a sort of equivalent called `WSASendMsg`
> > (https://msdn.microsoft.com/en-
> us/library/windows/desktop/ms741692(v=v
> > s.85).aspx) it uses a different structure `WSAMSG` instead of the
> > normal msghdr which in turn will have to be mapped properly (this goes
> > further to iovec/wsabuf in the structure itself).
> >
> > Fixes broken build on Windows.
> >
> > Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
> 
> Oops.
[Alin Serdean] No worries, we should have documented it better.
> 
> I pushed this.
[Alin Serdean] Thanks!
> 
> (If we need it badly enough, we can deal with this too, but it's not a big deal
> yet.)
[Alin Serdean] I can try to tackle it if needed.
diff mbox

Patch

diff --git a/lib/socket-util.c b/lib/socket-util.c
index 7148ae3..de7df67 100644
--- a/lib/socket-util.c
+++ b/lib/socket-util.c
@@ -1021,6 +1021,7 @@  sock_strerror(int error)
 #endif
 }
 
+#ifndef _WIN32 //Avoid using sendmsg on Windows entirely
 static int
 emulate_sendmmsg(int fd, struct mmsghdr *msgs, unsigned int n,
                  unsigned int flags)
@@ -1058,3 +1059,4 @@  wrap_sendmmsg(int fd, struct mmsghdr *msgs, unsigned int n, unsigned int flags)
     return emulate_sendmmsg(fd, msgs, n, flags);
 }
 #endif
+#endif