diff mbox series

[multiprocess,RFC,24/37] multi-process: pass proxy link socket fd to remote process

Message ID 20190307072224.9316-1-elena.ufimtseva@oracle.com (mailing list archive)
State New, archived
Headers show
Series Initial support of multi-process qemu | expand

Commit Message

Elena Ufimtseva March 7, 2019, 7:22 a.m. UTC
From: Elena Ufimtseva <elena.ufimtseva@oracle.com>

Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
---
 hw/proxy/qemu-proxy.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/hw/proxy/qemu-proxy.c b/hw/proxy/qemu-proxy.c
index d1560d9..f519beb 100644
--- a/hw/proxy/qemu-proxy.c
+++ b/hw/proxy/qemu-proxy.c
@@ -201,7 +201,7 @@  static void setup_irqfd(PCIProxyDev *dev)
 
 static void init_emulation_process(PCIProxyDev *pdev, char *command, Error **errp)
 {
-    char *args[2];
+    char *args[3];
     pid_t rpid;
     int fd[2];
 
@@ -221,16 +221,12 @@  static void init_emulation_process(PCIProxyDev *pdev, char *command, Error **err
     }
 
     if (rpid == 0) {
-        if (dup2(fd[1], STDIN_FILENO) != STDIN_FILENO) {
-            perror("Failed to acquire socket.");
-            exit(1);
-        }
-
         close(fd[0]);
-        close(fd[1]);
 
         args[0] = g_strdup(command);
-        args[1] = NULL;
+        args[1] = g_strdup_printf("%d", fd[1]);
+        args[2] = NULL;
+
         execvp(args[0], (char *const *)args);
         exit(1);
     }