On Thu, 6 Oct 2022 at 17:20, Bin Meng <bmeng...@gmail.com> wrote: > > From: Xuzhou Cheng <xuzhou.ch...@windriver.com> > > Socket communication in the libqtest and libqmp codes uses read() > and write() which work on any file descriptor on *nix, and sockets > in *nix are an example of a file descriptor. > > However sockets on Windows do not use *nix-style file descriptors, > so read() and write() cannot be used on sockets on Windows. > Switch over to use send() and recv() instead which work on both > Windows and *nix. > > Signed-off-by: Xuzhou Cheng <xuzhou.ch...@windriver.com> > Signed-off-by: Bin Meng <bin.m...@windriver.com> > Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > > (no changes since v2) > > Changes in v2: > - Introduce qemu_send_full() and use it > > include/qemu/sockets.h | 2 ++ > tests/qtest/libqmp.c | 5 +++-- > tests/qtest/libqtest.c | 4 ++-- > util/osdep.c | 33 +++++++++++++++++++++++++++++++++ > 4 files changed, 40 insertions(+), 4 deletions(-) > > diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h > index 036745e586..adf2b21bd9 100644 > --- a/include/qemu/sockets.h > +++ b/include/qemu/sockets.h > @@ -33,6 +33,8 @@ int qemu_socketpair(int domain, int type, int protocol, int > sv[2]); > #endif > > int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); > +ssize_t qemu_send_full(int s, const void *buf, size_t count) > + G_GNUC_WARN_UNUSED_RESULT;
New global function prototypes in headers need documentation comments, please. thanks -- PMM