[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
- [PATCH v5 05/18] block/vvfat: Unify the mkdir() call, (continued)
- [PATCH v5 05/18] block/vvfat: Unify the mkdir() call, Bin Meng, 2022/10/06
- [PATCH v5 07/18] hw/usb: dev-mtp: Use g_mkdir(), Bin Meng, 2022/10/06
- [PATCH v5 06/18] fsdev/virtfs-proxy-helper: Use g_mkdir(), Bin Meng, 2022/10/06
- [PATCH v5 08/18] accel/qtest: Support qtest accelerator for Windows, Bin Meng, 2022/10/06
- [PATCH v5 09/18] tests/qtest: Use send/recv for socket communication, Bin Meng, 2022/10/06
- [PATCH v5 10/18] tests/qtest: libqtest: Install signal handler via signal(), Bin Meng, 2022/10/06
- [PATCH v5 12/18] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled, Bin Meng, 2022/10/06
- [PATCH v5 14/18] io/channel-watch: Drop a superfluous '#ifdef WIN32', Bin Meng, 2022/10/06
- [PATCH v5 17/18] .gitlab-ci.d/windows.yml: Increase the timeout to 90 minutes, Bin Meng, 2022/10/06