On Thu, Jul 17, 2014 at 07:33:03PM +0000, Alin Serdean wrote:
> Add defines needed to compile netlink-socket.c and netlink.c.
> 
> Add wrappers for the functions sendmsg and recvmsg. They can also be added to
> another file instead of defining them inlined.
> 
> Add a wrapper and the functionality behind it for syconf.
> 
> Add the newly created files to the noinst_HEADERS in windows/automake.mk
> 
> Signed-off-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com>

include/windows/linux/rtnetlink.h in this file is an edited version of
include/linux/rtnetlink.h from the Linux source tree, so it should
include a GPLv2 license notice.  As is, it only has a Cloudbase
copyright and Apache license, which makes it look as if Cloudbase were
the original author.  It's fine to apply a Cloudbase copyright to it,
but it should be in addition to the existing copyright, not (at first
glance) instead of it.

The recvmsg() emulation is not complete because it only uses the first
iovec in the buffer.  I don't see a good way to use multiple iovecs on
Windows--maybe ReadFileGather but that is always asynchronous so it
might be expensive--so we might have to read into a large on-stack
buffer and then copy.

The recvmsg() emulation has really weird error behavior.  It always
sets errno to EAGAIN, whether the operation succeeds or fails.

It is odd to use a function _set_errno() to set errno, because the
ANSI C standard (even C89) says that errno is modifiable through a
normal assignment, e.g. "errno = EAGAIN".  Doesn't that work on
Windows?

sendmsg() is supposed to return the number of bytes sent.

recvmsg() and sendmsg() should return ssize_t (a signed type), not
unsigned int.

I am not sure that it is adequate in general for sendmsg() to send in
several segments, because that could split a single datagram into two
datagrams.  However, I see that the current use of sendmsg() in the
tree uses it in a way such that that doesn't cause problems.  I wonder
whether we should avoid sendmsg() on windows entirely, even in
emulation.

I think that we should avoid using AF_NETLINK, MSG_DONTWAIT, and
SO_RCVBUFFORCE on Windows, since it doesn't have any of them, rather
than defining them.  In fact it looks like the code does avoid using
them already.

Thanks,

Ben.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to