From nobody Mon Feb 9 12:11:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1567543533; cv=none; d=zoho.com; s=zohoarc; b=XoeQh0a/vVY5Up8N6Zy/jOtbJZbLJcquAt3Fi/Mj2zGj6E4TLMasWYheeLROU/6GaEH1tKaCCgJVS4nxLk3ghjqK9rCcKIECIpPsCxHnXSG5aVD7BCDxszXUVIwv5y53eYeJXN3AFGQVhsco6NRIIfrb/fKCaX5W3jJ9tFAiF/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567543533; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=5K/RtrZChD37454LN52XWbHOA/tbKWaTIL7EHZSXi34=; b=hamnZ4ZptnR9vRo2N09kJ+/SlVO/k+Z8kW8lvPdW4GSfVTrcRroDVNU4Jy918klxDuuJOIesvO4lnHoyl1g29bFLFSo7VFT4pyPvAPFOmIz0trVPSNPNXvYny+22rBBuIJqP/dKe2lJGrvgNibJzGvcMv8lxRz8abMTRBiN6ET8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567543533056298.47611430533766; Tue, 3 Sep 2019 13:45:33 -0700 (PDT) Received: from localhost ([::1]:51178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5FgB-0004Qw-4o for importer@patchew.org; Tue, 03 Sep 2019 16:45:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53244) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5FZn-0007IQ-Oc for qemu-devel@nongnu.org; Tue, 03 Sep 2019 16:38:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5FZm-0000Hr-Im for qemu-devel@nongnu.org; Tue, 03 Sep 2019 16:38:55 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:59818) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5FZm-0000Fu-B3 for qemu-devel@nongnu.org; Tue, 03 Sep 2019 16:38:54 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x83KXsxh062445; Tue, 3 Sep 2019 20:38:49 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2usy66r2e1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Sep 2019 20:38:49 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x83Kc9ed025344; Tue, 3 Sep 2019 20:38:48 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2us5pha074-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Sep 2019 20:38:48 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x83Kck5C017469; Tue, 3 Sep 2019 20:38:46 GMT Received: from jaraman-bur-1.us.oracle.com (/10.152.33.39) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Sep 2019 13:38:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2019-08-05; bh=5K/RtrZChD37454LN52XWbHOA/tbKWaTIL7EHZSXi34=; b=GLLcD3fpuYmrHz94K4Fg7U6bzlHsfn0XWvy3dxmdNsJnW//lVptWbnAkrR40Y8iNtAJB VmwMzECbsYLeMmzouCPtqpUQkWRxpT8dHS2LQzaSHuZDOTdrkqO9Pn83/Rg/ZpWy2dqT 1CBphyibGakDJC1LAwWxojUbPYe21zFBrE35fApzGloP8KcKsnLr520HoqTKYZcSOToF uCQM2J5dtm1pUB4fbhTb/jgojrZYJ/F600ThTK3IK6Qnb0KPUblKcmdPlsrrvDPImOET UiFlrQTDp9cQVvf+Jt419EBy0qBj1ZYtHRaXu/xYf7MofTNyAdmtTgq0+5w5Re+uOGNs mw== From: Jagannathan Raman To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 16:37:41 -0400 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9369 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909030207 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9369 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1906280000 definitions=main-1909030206 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [RFC v3 PATCH 15/45] multi-process: add support of device id to communication channel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: elena.ufimtseva@oracle.com, fam@euphon.net, john.g.johnson@oracle.com, kraxel@redhat.com, jag.raman@oracle.com, quintela@redhat.com, mst@redhat.com, armbru@redhat.com, kanth.ghatraju@oracle.com, thuth@redhat.com, ehabkost@redhat.com, konrad.wilk@oracle.com, dgilbert@redhat.com, liran.alon@oracle.com, stefanha@redhat.com, rth@twiddle.net, kwolf@redhat.com, berrange@redhat.com, mreitz@redhat.com, ross.lagerwall@citrix.com, marcandre.lureau@gmail.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Elena Ufimtseva Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John G Johnson --- New patch in v3 include/io/proxy-link.h | 3 +++ io/proxy-link.c | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/include/io/proxy-link.h b/include/io/proxy-link.h index 159c787..0785394 100644 --- a/include/io/proxy-link.h +++ b/include/io/proxy-link.h @@ -88,6 +88,7 @@ typedef struct { proc_cmd_t cmd; int bytestream; size_t size; + size_t size_id; =20 union { uint64_t u64; @@ -98,6 +99,8 @@ typedef struct { int num_fds; =20 uint8_t *data2; + uint8_t *id; + } ProcMsg; =20 struct conf_data_msg { diff --git a/io/proxy-link.c b/io/proxy-link.c index 381a38e..6f60117 100644 --- a/io/proxy-link.c +++ b/io/proxy-link.c @@ -81,7 +81,7 @@ void proxy_link_finalize(ProxyLinkState *s) void proxy_proc_send(ProxyLinkState *s, ProcMsg *msg, ProcChannel *chan) { int rc; - uint8_t *data; + uint8_t *data, *buf =3D NULL; union { char control[CMSG_SPACE(REMOTE_MAX_FDS * sizeof(int))]; struct cmsghdr align; @@ -140,10 +140,19 @@ void proxy_proc_send(ProxyLinkState *s, ProcMsg *msg,= ProcChannel *chan) data =3D (uint8_t *)msg + PROC_HDR_SIZE; } =20 + if (msg->size_id > 0) { + buf =3D calloc(1, msg->size + msg->size_id); + assert(buf); + memcpy(buf, data, msg->size); + memcpy(buf + msg->size, msg->id, msg->size_id); + data =3D buf; + } do { - rc =3D write(sock, data, msg->size); + rc =3D write(sock, data, msg->size + msg->size_id); } while (rc < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); =20 + free(buf); + qemu_mutex_unlock(lock); } =20 @@ -151,7 +160,7 @@ void proxy_proc_send(ProxyLinkState *s, ProcMsg *msg, P= rocChannel *chan) int proxy_proc_recv(ProxyLinkState *s, ProcMsg *msg, ProcChannel *chan) { int rc; - uint8_t *data; + uint8_t *data, *buf =3D NULL; union { char control[CMSG_SPACE(REMOTE_MAX_FDS * sizeof(int))]; struct cmsghdr align; @@ -207,10 +216,28 @@ int proxy_proc_recv(ProxyLinkState *s, ProcMsg *msg, = ProcChannel *chan) data =3D (uint8_t *)&msg->data1; } =20 - if (msg->size) { + if (msg->size) { + if (msg->size_id > 0) { + buf =3D calloc(1, msg->size + msg->size_id); + data =3D buf; + } do { - rc =3D read(sock, data, msg->size); + rc =3D read(sock, data, msg->size + msg->size_id); } while (rc < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); + if (rc < 0) { + fprintf(stderr, "Read sock is an error!\n"); + return rc; + } + } + if (msg->size && msg->bytestream) { + memcpy(msg->data2, data, msg->size); + } else { + memcpy((uint8_t *)&msg->data1, data, msg->size); + } + + if (msg->size_id > 0) { + msg->id =3D calloc(1, msg->size_id); + memcpy(msg->id, data + msg->size, msg->size_id); } =20 qemu_mutex_unlock(lock); --=20 1.8.3.1