[Spice-devel] [PATCH spice-server 30/33] Disable recording filtering for Windows

Marc-André Lureau marcandre.lureau at gmail.com
Sat Dec 22 10:18:52 UTC 2018


On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio <fziglio at redhat.com> wrote:
>
> Although this feature can be ported to Windows doing so would
> require the usage of g_spawn_async_with_fds, which is only available
> in GLib 2.58 or some specific Win32 code.
>

Easy to wrap though:

https://github.com/elmarco/qemu/commit/57010952c7a1d075bb0763d8c32bf7a63de0c964


> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-record-qxl.c    | 8 ++++++--
>  server/tests/test-record.c | 7 +++++--
>  2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
> index 30a3b0da..c9e84bfb 100644
> --- a/server/red-record-qxl.c
> +++ b/server/red-record-qxl.c
> @@ -817,6 +817,7 @@ void red_record_qxl_command(RedRecord *record, RedMemSlotInfo *slots,
>      pthread_mutex_unlock(&record->lock);
>  }
>
> +#ifndef _WIN32
>  /**
>   * Redirects child output to the file specified
>   */
> @@ -829,12 +830,12 @@ static void child_output_setup(gpointer user_data)
>      }
>      close(fd);
>  }
> +#endif
>
>  RedRecord *red_record_new(const char *filename)
>  {
>      static const char header[] = "SPICE_REPLAY 1\n";
>
> -    const char *filter;
>      FILE *f;
>      RedRecord *record;
>
> @@ -843,7 +844,9 @@ RedRecord *red_record_new(const char *filename)
>          spice_error("failed to open recording file %s", filename);
>      }
>
> -    filter = getenv("SPICE_WORKER_RECORD_FILTER");
> +    // TODO
> +#ifndef _WIN32
> +    const char *filter = getenv("SPICE_WORKER_RECORD_FILTER");
>      if (filter) {
>          gint argc;
>          gchar **argv = NULL;
> @@ -871,6 +874,7 @@ RedRecord *red_record_new(const char *filename)
>          close(fd_in);
>          g_spawn_close_pid(child_pid);
>      }
> +#endif
>
>      if (fwrite(header, sizeof(header)-1, 1, f) != 1) {
>          spice_error("failed to write replay header");
> diff --git a/server/tests/test-record.c b/server/tests/test-record.c
> index de3c6f5b..8ee36ceb 100644
> --- a/server/tests/test-record.c
> +++ b/server/tests/test-record.c
> @@ -35,9 +35,9 @@ test_record(bool compress)
>      RedRecord *rec;
>      const char *fn = OUTPUT_FILENAME;
>
> -    unsetenv("SPICE_WORKER_RECORD_FILTER");
> +    g_unsetenv("SPICE_WORKER_RECORD_FILTER");
>      if (compress) {
> -        setenv("SPICE_WORKER_RECORD_FILTER", "gzip", 1);
> +        g_setenv("SPICE_WORKER_RECORD_FILTER", "gzip", 1);
>      }
>
>      // delete possible stale test output
> @@ -95,6 +95,9 @@ int
>  main(void)
>  {
>      test_record(false);
> +    // TODO implement on Windows
> +#ifndef _WIN32
>      test_record(true);
> +#endif
>      return 0;
>  }
> --
> 2.17.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



--
Marc-André Lureau


More information about the Spice-devel mailing list