Skip to contentSkip to conversation

slirp: Enable fork_exec support on Windows

PATCH In review Samuel Thibault 4 participants 4 messages Nov 20, 2018 – Nov 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slirp: Enable fork_exec support on Windows

g_spawn_async_with_fds is portable on Windows, so we can now enable fork_exec support there.

Thanks Daniel P. Berrangé for the notice!

---
 slirp/misc.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
slirp/misc.c +2 -12
index 7972b9b05b..59b4e8f31c 100644
@@ -62,17 +62,6 @@ int add_exec(struct ex_list **ex_ptr, void *chardev, const char *cmdline,
 }
 
 
-#ifdef _WIN32
-
-int
-fork_exec(struct socket *so, const char *ex)
-{
-    /* not implemented */
-    return 0;
-}
-
-#else
-
 static int
 slirp_socketpair_with_oob(int sv[2])
 {
@@ -132,7 +121,9 @@ err:
 static void
 fork_exec_child_setup(gpointer data)
 {
+#ifndef _WIN32
     setsid();
+#endif
 }
 
 int
@@ -177,7 +168,6 @@ fork_exec(struct socket *so, const char *ex)
     qemu_set_nonblock(so->s);
     return 1;
 }
-#endif
 
 char *slirp_connection_info(Slirp *slirp)
 {
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw

Hi

Quoted 7 lines · Samuel Thibault

g_spawn_async_with_fds is portable on Windows, so we can now enable fork_exec support there.

Thanks Daniel P. Berrangé for the notice!

Quoted 47 lines
---
 slirp/misc.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
slirp/misc.c +2 -13
index 7972b9b05b..59b4e8f31c 100644
@@ -62,17 +62,6 @@ int add_exec(struct ex_list **ex_ptr, void *chardev, const char *cmdline,
 }
 
 
-#ifdef _WIN32
-
-int
-fork_exec(struct socket *so, const char *ex)
-{
-    /* not implemented */
-    return 0;
-}
-
-#else
-
 static int
 slirp_socketpair_with_oob(int sv[2])
 {
@@ -132,7 +121,9 @@ err:
 static void
 fork_exec_child_setup(gpointer data)
 {
+#ifndef _WIN32
     setsid();
+#endif
 }
 
 int
@@ -177,7 +168,6 @@ fork_exec(struct socket *so, const char *ex)
     qemu_set_nonblock(so->s);
     return 1;
 }
-#endif
 
 char *slirp_connection_info(Slirp *slirp)
 {
--

2.19.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Samuel Thibault
Quoted 9 lines · Samuel Thibault

g_spawn_async_with_fds is portable on Windows, so we can now enable fork_exec support there.

Thanks Daniel P. Berrangé for the notice!

---
 slirp/misc.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: 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 :|
#3 lore raw
In reply to Samuel Thibault

Hi Samuel,

Quoted 4 lines · Samuel Thibault

g_spawn_async_with_fds is portable on Windows, so we can now enable fork_exec support there.

Thanks Daniel P. Berrangé for the notice!

On x86_64 you can build locally using Docker:

$ make docker-test-build@debian-win32-cross
  BUILD   debian-win32-cross
  COPY    RUNNER
    RUN test-build in qemu:debian-win32-cross
Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu
--prefix=/tmp/qemu-test/install --cross-prefix=i686-w64-mingw32.shared-
  CC      qga/commands-win32.o
  CC      qga/channel-win32.o
  CC      qga/service-win32.o
  CC      qga/vss-win32.o
...
Quoted 1 line

From the qemu source repository, you can also run once:

$ docker run --rm -it \
  -v $PWD:$PWD -w $PWD -v /tmp:/tmp \
  -u $UID \
  qemu:debian-win32-cross \
    bash -c 'mkdir build_win32 && cd build_win32 && ../configure
$QEMU_CONFIGURE_OPTS && make -j4'

Then to avoid rebuilding the world everytime, when you applied/modified win32 related patches:

$ docker run --rm -it \
  -v $PWD:$PWD -w $PWD -v /tmp:/tmp \
  -u $UID \
  qemu:debian-win32-cross \
    bash -c 'make -C build_win32 -j4'

You can not 'run' the binary, but at least you can verify compilation/linking steps.

Regards,

Phil.

Quoted 47 lines
---
  slirp/misc.c | 14 ++------------
  1 file changed, 2 insertions(+), 12 deletions(-)
slirp/misc.c +2 -12
index 7972b9b05b..59b4e8f31c 100644
@@ -62,17 +62,6 @@ int add_exec(struct ex_list **ex_ptr, void *chardev, const char *cmdline,
  }
 
 
-#ifdef _WIN32
-
-int
-fork_exec(struct socket *so, const char *ex)
-{
-    /* not implemented */
-    return 0;
-}
-
-#else
-
  static int
  slirp_socketpair_with_oob(int sv[2])
  {
@@ -132,7 +121,9 @@ err:
  static void
  fork_exec_child_setup(gpointer data)
  {
+#ifndef _WIN32
      setsid();
+#endif
  }
 
  int
@@ -177,7 +168,6 @@ fork_exec(struct socket *so, const char *ex)
      qemu_set_nonblock(so->s);
      return 1;
  }
-#endif
 
  char *slirp_connection_info(Slirp *slirp)
  {