[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 08/10] qmp: add 'get-win32-socket'
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH 08/10] qmp: add 'get-win32-socket' |
Date: |
Mon, 9 Jan 2023 12:20:48 +0000 |
User-agent: |
Mutt/2.2.7 (2022-08-07) |
On Tue, Jan 03, 2023 at 03:08:12PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> A process with enough capabilities can duplicate a socket to QEMU. Add a
> QMP command to import it and add it to the monitor fd list, so it can be
> later used by other commands.
>
> Note that we actually store the SOCKET in the FD list, appropriate care
> must now be taken to use the correct socket functions (similar approach
> is taken by our io/ code and in glib, this is internal and shouldn't
> affect the QEMU/QMP users)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> qapi/misc.json | 32 ++++++++++++++++++++++
> monitor/misc.c | 74 ++++++++++++++++++++++++++++++++++++++++----------
> 2 files changed, 91 insertions(+), 15 deletions(-)
>
> diff --git a/qapi/misc.json b/qapi/misc.json
> index 27ef5a2b20..a19dd78fab 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -272,6 +272,38 @@
> ##
> { 'command': 'getfd', 'data': {'fdname': 'str'} }
>
> +##
> +# @get-win32-socket:
> +#
> +# Add a socket that was duplicated to QEMU process with WSADuplicateSocketW()
> +# via WSASocket() & WSAPROTOCOL_INFOW structure and assign it a name. A
> SOCKET
> +# is considered as a kind of "file descriptor" by QMP clients, for historical
> +# reasons and simplicity, although QEMU takes care to use socket functions
> +# appropriately.
> +#
> +# @info: the WSAPROTOCOL_INFOW structure (encoded in base64)
> +#
> +# @fdname: file descriptor name
> +#
> +# Returns: Nothing on success
> +#
> +# Since: 8.0
> +#
> +# Notes: If @fdname already exists, the file descriptor assigned to
> +# it will be closed and replaced by the received file
> +# descriptor.
> +#
> +# The 'closefd' command can be used to explicitly close the
> +# file descriptor when it is no longer needed.
> +#
> +# Example:
> +#
> +# -> { "execute": "get-win32-socket", "arguments": { "info": "abcd123..",
> fdname": "skclient" } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'},
> 'if': 'CONFIG_WIN32' }
IIUC, this is needed because 'getfd' doesn't work on Windows ?
Can't we just implement getfd on Windows, using this WSAPROTOCOL_INFOW
structure passing, or are you anticipating that future Windows make get
normal 'getfd' support ?
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: [PATCH 01/10] ccid-card-emulated: fix cast warning/error, (continued)
- [PATCH 04/10] tests/docker: fix a win32 error due to portability, marcandre . lureau, 2023/01/03
- [PATCH 05/10] tests/readconfig: spice doesn't support unix socket on windows yet, marcandre . lureau, 2023/01/03
- [PATCH 06/10] osdep: implement qemu_socketpair() for win32, marcandre . lureau, 2023/01/03
- [PATCH 07/10] qmp: 'add_client' actually expects sockets, marcandre . lureau, 2023/01/03
- [PATCH 08/10] qmp: add 'get-win32-socket', marcandre . lureau, 2023/01/03
- Re: [PATCH 08/10] qmp: add 'get-win32-socket',
Daniel P . Berrangé <=
- [PATCH 09/10] libqtest: make qtest_qmp_add_client work on win32, marcandre . lureau, 2023/01/03
- [PATCH 10/10] qtest: enable vnc-display test on win32, marcandre . lureau, 2023/01/03
- Re: [PATCH 00/10] Various win32 fixes & new 'get-win32-socket' QMP command, Philippe Mathieu-Daudé, 2023/01/03