[Spice-devel] [PATCH spice-server v6 17/19] Disable recording filtering for Windows

Frediano Ziglio fziglio at redhat.com
Tue Apr 30 12:24:17 UTC 2019


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.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-record-qxl.c    | 7 +++++++
 server/tests/test-record.c | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index f6a627fd..6ae5f213 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -815,6 +815,7 @@ void red_record_qxl_command(RedRecord *record, RedMemSlotInfo *slots,
     pthread_mutex_unlock(&record->lock);
 }
 
+#ifndef _WIN32
 /**
  * Redirects child output to the file specified
  */
@@ -827,6 +828,7 @@ static void child_output_setup(gpointer user_data)
     }
     close(fd);
 }
+#endif
 
 RedRecord *red_record_new(const char *filename)
 {
@@ -843,6 +845,7 @@ RedRecord *red_record_new(const char *filename)
 
     filter = getenv("SPICE_WORKER_RECORD_FILTER");
     if (filter) {
+#ifndef _WIN32
         gint argc;
         gchar **argv = NULL;
         GError *error = NULL;
@@ -868,6 +871,10 @@ RedRecord *red_record_new(const char *filename)
         }
         close(fd_in);
         g_spawn_close_pid(child_pid);
+#else
+        // TODO
+        spice_warning("recorder filter not supported under Windows");
+#endif
     }
 
     if (fwrite(header, sizeof(header)-1, 1, f) != 1) {
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.20.1



More information about the Spice-devel mailing list