qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 09/18] tests/qtest: Use send/recv for socket communication


From: Peter Maydell
Subject: Re: [PATCH v5 09/18] tests/qtest: Use send/recv for socket communication
Date: Tue, 18 Oct 2022 18:09:28 +0100

On Thu, 6 Oct 2022 at 17:20, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> From: Xuzhou Cheng <xuzhou.cheng@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.cheng@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]