2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-05 16:55:42 +00:00

socket-util: Emulate recvmmsg() and sendmmsg() on Linux only.

These functions failed to build on OS X because MSG_WAITFORONE is not
defined there.  There are pitfalls for trying to define our own MSG_*
constants, since it's hard to pick a constant that is not used by the
system already.  Because OVS only uses recvmmsg() and sendmmsg() on
Linux, it seems easiest to just emulate them there.

Reported-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Ben Pfaff
2020-01-13 10:03:04 -08:00
parent 67eb811017
commit b9b7b989d1
2 changed files with 13 additions and 15 deletions

View File

@@ -1241,7 +1241,7 @@ sock_strerror(int error)
#endif
}
#ifndef _WIN32 /* Avoid using sendmsg on Windows entirely. */
#ifdef __linux__
static int
emulate_sendmmsg(int fd, struct mmsghdr *msgs, unsigned int n,
unsigned int flags)
@@ -1282,9 +1282,7 @@ wrap_sendmmsg(int fd, struct mmsghdr *msgs, unsigned int n, unsigned int flags)
return emulate_sendmmsg(fd, msgs, n, flags);
}
#endif
#endif
#ifndef _WIN32 /* Avoid using recvmsg on Windows entirely. */
static int
emulate_recvmmsg(int fd, struct mmsghdr *msgs, unsigned int n,
int flags, struct timespec *timeout OVS_UNUSED)
@@ -1338,4 +1336,4 @@ wrap_recvmmsg(int fd, struct mmsghdr *msgs, unsigned int n,
return emulate_recvmmsg(fd, msgs, n, flags, timeout);
}
#endif
#endif
#endif /* __linux__ */