diff mbox series

[3/5] dump: Recognize "fd:" protocols on Windows hosts

Message ID 20231030133712.2822276-4-armbru@redhat.com
State New
Headers show
Series dump: Minor fixes & improvements | expand

Commit Message

Markus Armbruster Oct. 30, 2023, 1:37 p.m. UTC
A few QMP command can work with named file descriptors.

The only way to create a named file descriptor used to be QMP command
getfd, which only works on POSIX hosts.  Thus, named file descriptors
were actually usable only there.

They became usable on Windows hosts when we added QMP command
get-win32-socket (commit 4cda177c601 "qmp: add 'get-win32-socket'").

Except in dump-guest-memory, because qmp_dump_guest_memory() compiles
its named file descriptor code only #if !defined(WIN32).

Compile it unconditionally, like we do for the other commands
supporting them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 dump/dump.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Marc-André Lureau Oct. 31, 2023, 6:55 a.m. UTC | #1
On Mon, Oct 30, 2023 at 5:37 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> A few QMP command can work with named file descriptors.
>
> The only way to create a named file descriptor used to be QMP command
> getfd, which only works on POSIX hosts.  Thus, named file descriptors
> were actually usable only there.
>
> They became usable on Windows hosts when we added QMP command
> get-win32-socket (commit 4cda177c601 "qmp: add 'get-win32-socket'").
>
> Except in dump-guest-memory, because qmp_dump_guest_memory() compiles
> its named file descriptor code only #if !defined(WIN32).
>
> Compile it unconditionally, like we do for the other commands
> supporting them.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  dump/dump.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/dump/dump.c b/dump/dump.c
> index d8ea364af2..a5e9a06ef1 100644
> --- a/dump/dump.c
> +++ b/dump/dump.c
> @@ -2130,14 +2130,12 @@ void qmp_dump_guest_memory(bool paging, const char *protocol,
>          return;
>      }
>
> -#if !defined(WIN32)
>      if (strstart(protocol, "fd:", &p)) {
>          fd = monitor_get_fd(monitor_cur(), p, errp);
>          if (fd == -1) {
>              return;
>          }
>      }
> -#endif
>
>      if  (strstart(protocol, "file:", &p)) {
>          fd = qemu_open_old(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);
> --
> 2.41.0
>
diff mbox series

Patch

diff --git a/dump/dump.c b/dump/dump.c
index d8ea364af2..a5e9a06ef1 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -2130,14 +2130,12 @@  void qmp_dump_guest_memory(bool paging, const char *protocol,
         return;
     }
 
-#if !defined(WIN32)
     if (strstart(protocol, "fd:", &p)) {
         fd = monitor_get_fd(monitor_cur(), p, errp);
         if (fd == -1) {
             return;
         }
     }
-#endif
 
     if  (strstart(protocol, "file:", &p)) {
         fd = qemu_open_old(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);