From patchwork Thu Mar 7 07:22:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elena Ufimtseva X-Patchwork-Id: 10842291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4AC61515 for ; Thu, 7 Mar 2019 07:32:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD0B22E84F for ; Thu, 7 Mar 2019 07:32:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C601B2E54A; Thu, 7 Mar 2019 07:32:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B0D62E3A2 for ; Thu, 7 Mar 2019 07:32:44 +0000 (UTC) Received: from localhost ([127.0.0.1]:46712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1nWG-0002j9-5n for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Mar 2019 02:32:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1nMb-0002nK-Ry for qemu-devel@nongnu.org; Thu, 07 Mar 2019 02:22:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1nMa-0005kY-GB for qemu-devel@nongnu.org; Thu, 07 Mar 2019 02:22:45 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:48766) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h1nMY-0005hl-Ea for qemu-devel@nongnu.org; Thu, 07 Mar 2019 02:22:42 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x277JBJX037785; Thu, 7 Mar 2019 07:22:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=gx6ZDudI6fLANm177u5jX7wxcGUptTWcbygJVWipo5g=; b=bhOm2m7aBT83xcIJsfUXLGVfkvBSGc4Y3PgV6/0iCWjPqRx05CMK/00D1+4vUHTOqD6B td9SSanQZLgBIQqwEpMgS2OoCWiue+H/VorPsheSeLOin/5/Rgm2cdJsi3J4wOHnGScB UdsTfe6U6Fowv+a0ZCz3nYaWXizn9pyb4h+xI+B083BGWx4JGPAguvSQvj7kWPS9NoIh /nk0d8mhElwfXj7RqvwYaxfO07lA3BKF/zk17zPlm9FbQjXiq1Ai5hV/iUtVmF+AUpPc Qbf0WtQnYD5chhPidF9LpCSZq0vjbBLJCKY28HtAV5l6kxb8eTWDrKFgdgBAJi8g6C1/ KQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2qyh8ug98n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Mar 2019 07:22:32 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x277MQrx006849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Mar 2019 07:22:27 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x277MQsF024678; Thu, 7 Mar 2019 07:22:26 GMT Received: from heatpipe.hsd1.ca.comcast.net (/73.170.27.202) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 06 Mar 2019 23:22:26 -0800 From: elena.ufimtseva@oracle.com To: qemu-devel@nongnu.org Date: Wed, 6 Mar 2019 23:22:24 -0800 Message-Id: <20190307072224.9316-1-elena.ufimtseva@oracle.com> X-Mailer: git-send-email 2.17.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9187 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903070053 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [multiprocess RFC PATCH 24/37] multi-process: pass proxy link socket fd to remote process X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: elena.ufimtseva@oracle.com, john.g.johnson@oracle.com, sstabellini@kernel.org, jag.raman@oracle.com, konrad.wilk@oracle.com, ross.lagerwall@citrix.com, liran.alon@oracle.com, stefanha@redhat.com, kanth.ghatraju@oracle.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson --- hw/proxy/qemu-proxy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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); }