diff mbox series

slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/

Message ID 20190203142225.32268-1-samuel.thibault@ens-lyon.org (mailing list archive)
State New, archived
Headers show
Series slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ | expand

Commit Message

Samuel Thibault Feb. 3, 2019, 2:22 p.m. UTC
Only slirp actually needs it, and will need it along in libslirp.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/glib-compat.h | 57 -------------------------------------------
 slirp/misc.c          | 57 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 57 deletions(-)

Comments

no-reply@patchew.org Feb. 3, 2019, 5:50 p.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20190203142225.32268-1-samuel.thibault@ens-lyon.org/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14
=== TEST SCRIPT END ===


Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/tmp/qemu-test/install --python=/usr/bin/python3 --cross-prefix=x86_64-w64-mingw32- --enable-trace-backends=simple --enable-gnutls --enable-nettle --enable-curl --enable-vnc --enable-bzip2 --enable-guest-agent --with-sdlabi=2.0
ERROR: unknown option --with-sdlabi=2.0
Try '/tmp/qemu-test/src/configure --help' for more information
# QEMU configure log Sun Feb  3 17:50:10 UTC 2019
# Configured with: '/tmp/qemu-test/src/configure' '--enable-werror' '--target-list=x86_64-softmmu,aarch64-softmmu' '--prefix=/tmp/qemu-test/install' '--python=/usr/bin/python3' '--cross-prefix=x86_64-w64-mingw32-' '--enable-trace-backends=simple' '--enable-gnutls' '--enable-nettle' '--enable-curl' '--enable-vnc' '--enable-bzip2' '--enable-guest-agent' '--with-sdlabi=2.0'
---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 617 634 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
config-temp/qemu-conf.c:2:2: error: #error __linux__ not defined
 #error __linux__ not defined
  ^~~~~

---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 617 686 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
config-temp/qemu-conf.c:2:2: error: #error __i386__ not defined
 #error __i386__ not defined
  ^~~~~

---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 617 689 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
config-temp/qemu-conf.c:2:2: error: #error __ILP32__ not defined
 #error __ILP32__ not defined
  ^~~~~

---
lines: 92 128 920 0
x86_64-w64-mingw32-gcc -mthreads -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -g -liberty
/usr/lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -liberty
collect2: error: ld returned 1 exit status
Failed to run 'configure'
Traceback (most recent call last):
  File "./tests/docker/docker.py", line 563, in <module>


The full log is available at
http://patchew.org/logs/20190203142225.32268-1-samuel.thibault@ens-lyon.org/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Marc-André Lureau Feb. 4, 2019, 8:56 a.m. UTC | #2
Hi

On Sun, Feb 3, 2019 at 3:34 PM Samuel Thibault
<samuel.thibault@ens-lyon.org> wrote:
>
> Only slirp actually needs it, and will need it along in libslirp.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

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

> ---
>  include/glib-compat.h | 57 -------------------------------------------
>  slirp/misc.c          | 57 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 57 insertions(+), 57 deletions(-)
>
> diff --git a/include/glib-compat.h b/include/glib-compat.h
> index 8a078c5288..1291628e09 100644
> --- a/include/glib-compat.h
> +++ b/include/glib-compat.h
> @@ -83,63 +83,6 @@ static inline gboolean g_strv_contains_qemu(const gchar *const *strv,
>  }
>  #define g_strv_contains(a, b) g_strv_contains_qemu(a, b)
>
> -#if !GLIB_CHECK_VERSION(2, 58, 0)
> -typedef struct QemuGSpawnFds {
> -    GSpawnChildSetupFunc child_setup;
> -    gpointer user_data;
> -    gint stdin_fd;
> -    gint stdout_fd;
> -    gint stderr_fd;
> -} QemuGSpawnFds;
> -
> -static inline void
> -qemu_gspawn_fds_setup(gpointer user_data)
> -{
> -    QemuGSpawnFds *q = (QemuGSpawnFds *)user_data;
> -
> -    dup2(q->stdin_fd, 0);
> -    dup2(q->stdout_fd, 1);
> -    dup2(q->stderr_fd, 2);
> -    q->child_setup(q->user_data);
> -}
> -#endif
> -
> -static inline gboolean
> -g_spawn_async_with_fds_qemu(const gchar *working_directory,
> -                            gchar **argv,
> -                            gchar **envp,
> -                            GSpawnFlags flags,
> -                            GSpawnChildSetupFunc child_setup,
> -                            gpointer user_data,
> -                            GPid *child_pid,
> -                            gint stdin_fd,
> -                            gint stdout_fd,
> -                            gint stderr_fd,
> -                            GError **error)
> -{
> -#if GLIB_CHECK_VERSION(2, 58, 0)
> -    return g_spawn_async_with_fds(working_directory, argv, envp, flags,
> -                                  child_setup, user_data,
> -                                  child_pid, stdin_fd, stdout_fd, stderr_fd,
> -                                  error);
> -#else
> -    QemuGSpawnFds setup = {
> -        .child_setup = child_setup,
> -        .user_data = user_data,
> -        .stdin_fd = stdin_fd,
> -        .stdout_fd = stdout_fd,
> -        .stderr_fd = stderr_fd,
> -    };
> -
> -    return g_spawn_async(working_directory, argv, envp, flags,
> -                         qemu_gspawn_fds_setup, &setup,
> -                         child_pid, error);
> -#endif
> -}
> -
> -#define g_spawn_async_with_fds(wd, argv, env, f, c, d, p, ifd, ofd, efd, err) \
> -    g_spawn_async_with_fds_qemu(wd, argv, env, f, c, d, p, ifd, ofd, efd, err)
> -
>  #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0)
>  /*
>   * g_poll has a problem on Windows when using
> diff --git a/slirp/misc.c b/slirp/misc.c
> index edb0d187d7..18b25f93ac 100644
> --- a/slirp/misc.c
> +++ b/slirp/misc.c
> @@ -120,6 +120,63 @@ fork_exec_child_setup(gpointer data)
>  #endif
>  }
>
> +#if !GLIB_CHECK_VERSION(2, 58, 0)
> +typedef struct SlirpGSpawnFds {
> +    GSpawnChildSetupFunc child_setup;
> +    gpointer user_data;
> +    gint stdin_fd;
> +    gint stdout_fd;
> +    gint stderr_fd;
> +} SlirpGSpawnFds;
> +
> +static inline void
> +slirp_gspawn_fds_setup(gpointer user_data)
> +{
> +    SlirpGSpawnFds *q = (SlirpGSpawnFds *)user_data;
> +
> +    dup2(q->stdin_fd, 0);
> +    dup2(q->stdout_fd, 1);
> +    dup2(q->stderr_fd, 2);
> +    q->child_setup(q->user_data);
> +}
> +#endif
> +
> +static inline gboolean
> +g_spawn_async_with_fds_slirp(const gchar *working_directory,
> +                            gchar **argv,
> +                            gchar **envp,
> +                            GSpawnFlags flags,
> +                            GSpawnChildSetupFunc child_setup,
> +                            gpointer user_data,
> +                            GPid *child_pid,
> +                            gint stdin_fd,
> +                            gint stdout_fd,
> +                            gint stderr_fd,
> +                            GError **error)
> +{
> +#if GLIB_CHECK_VERSION(2, 58, 0)
> +    return g_spawn_async_with_fds(working_directory, argv, envp, flags,
> +                                  child_setup, user_data,
> +                                  child_pid, stdin_fd, stdout_fd, stderr_fd,
> +                                  error);
> +#else
> +    QemuGSpawnFds setup = {
> +        .child_setup = child_setup,
> +        .user_data = user_data,
> +        .stdin_fd = stdin_fd,
> +        .stdout_fd = stdout_fd,
> +        .stderr_fd = stderr_fd,
> +    };
> +
> +    return g_spawn_async(working_directory, argv, envp, flags,
> +                         slirp_gspawn_fds_setup, &setup,
> +                         child_pid, error);
> +#endif
> +}
> +
> +#define g_spawn_async_with_fds(wd, argv, env, f, c, d, p, ifd, ofd, efd, err) \
> +    g_spawn_async_with_fds_slirp(wd, argv, env, f, c, d, p, ifd, ofd, efd, err)
> +
>  int
>  fork_exec(struct socket *so, const char *ex)
>  {
> --
> 2.20.1
>
>
diff mbox series

Patch

diff --git a/include/glib-compat.h b/include/glib-compat.h
index 8a078c5288..1291628e09 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -83,63 +83,6 @@  static inline gboolean g_strv_contains_qemu(const gchar *const *strv,
 }
 #define g_strv_contains(a, b) g_strv_contains_qemu(a, b)
 
-#if !GLIB_CHECK_VERSION(2, 58, 0)
-typedef struct QemuGSpawnFds {
-    GSpawnChildSetupFunc child_setup;
-    gpointer user_data;
-    gint stdin_fd;
-    gint stdout_fd;
-    gint stderr_fd;
-} QemuGSpawnFds;
-
-static inline void
-qemu_gspawn_fds_setup(gpointer user_data)
-{
-    QemuGSpawnFds *q = (QemuGSpawnFds *)user_data;
-
-    dup2(q->stdin_fd, 0);
-    dup2(q->stdout_fd, 1);
-    dup2(q->stderr_fd, 2);
-    q->child_setup(q->user_data);
-}
-#endif
-
-static inline gboolean
-g_spawn_async_with_fds_qemu(const gchar *working_directory,
-                            gchar **argv,
-                            gchar **envp,
-                            GSpawnFlags flags,
-                            GSpawnChildSetupFunc child_setup,
-                            gpointer user_data,
-                            GPid *child_pid,
-                            gint stdin_fd,
-                            gint stdout_fd,
-                            gint stderr_fd,
-                            GError **error)
-{
-#if GLIB_CHECK_VERSION(2, 58, 0)
-    return g_spawn_async_with_fds(working_directory, argv, envp, flags,
-                                  child_setup, user_data,
-                                  child_pid, stdin_fd, stdout_fd, stderr_fd,
-                                  error);
-#else
-    QemuGSpawnFds setup = {
-        .child_setup = child_setup,
-        .user_data = user_data,
-        .stdin_fd = stdin_fd,
-        .stdout_fd = stdout_fd,
-        .stderr_fd = stderr_fd,
-    };
-
-    return g_spawn_async(working_directory, argv, envp, flags,
-                         qemu_gspawn_fds_setup, &setup,
-                         child_pid, error);
-#endif
-}
-
-#define g_spawn_async_with_fds(wd, argv, env, f, c, d, p, ifd, ofd, efd, err) \
-    g_spawn_async_with_fds_qemu(wd, argv, env, f, c, d, p, ifd, ofd, efd, err)
-
 #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0)
 /*
  * g_poll has a problem on Windows when using
diff --git a/slirp/misc.c b/slirp/misc.c
index edb0d187d7..18b25f93ac 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -120,6 +120,63 @@  fork_exec_child_setup(gpointer data)
 #endif
 }
 
+#if !GLIB_CHECK_VERSION(2, 58, 0)
+typedef struct SlirpGSpawnFds {
+    GSpawnChildSetupFunc child_setup;
+    gpointer user_data;
+    gint stdin_fd;
+    gint stdout_fd;
+    gint stderr_fd;
+} SlirpGSpawnFds;
+
+static inline void
+slirp_gspawn_fds_setup(gpointer user_data)
+{
+    SlirpGSpawnFds *q = (SlirpGSpawnFds *)user_data;
+
+    dup2(q->stdin_fd, 0);
+    dup2(q->stdout_fd, 1);
+    dup2(q->stderr_fd, 2);
+    q->child_setup(q->user_data);
+}
+#endif
+
+static inline gboolean
+g_spawn_async_with_fds_slirp(const gchar *working_directory,
+                            gchar **argv,
+                            gchar **envp,
+                            GSpawnFlags flags,
+                            GSpawnChildSetupFunc child_setup,
+                            gpointer user_data,
+                            GPid *child_pid,
+                            gint stdin_fd,
+                            gint stdout_fd,
+                            gint stderr_fd,
+                            GError **error)
+{
+#if GLIB_CHECK_VERSION(2, 58, 0)
+    return g_spawn_async_with_fds(working_directory, argv, envp, flags,
+                                  child_setup, user_data,
+                                  child_pid, stdin_fd, stdout_fd, stderr_fd,
+                                  error);
+#else
+    QemuGSpawnFds setup = {
+        .child_setup = child_setup,
+        .user_data = user_data,
+        .stdin_fd = stdin_fd,
+        .stdout_fd = stdout_fd,
+        .stderr_fd = stderr_fd,
+    };
+
+    return g_spawn_async(working_directory, argv, envp, flags,
+                         slirp_gspawn_fds_setup, &setup,
+                         child_pid, error);
+#endif
+}
+
+#define g_spawn_async_with_fds(wd, argv, env, f, c, d, p, ifd, ofd, efd, err) \
+    g_spawn_async_with_fds_slirp(wd, argv, env, f, c, d, p, ifd, ofd, efd, err)
+
 int
 fork_exec(struct socket *so, const char *ex)
 {