From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFk36-0003Z0-Nd for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFk32-0004jf-N1 for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:26:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFk32-0004jZ-Gv for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:26:36 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BA023F724 for ; Wed, 22 Jun 2016 15:26:36 +0000 (UTC) Received: from wei-thinkpad.nay.redhat.com (vpn1-6-208.pek2.redhat.com [10.72.6.208]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5MFQYCF024144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Jun 2016 11:26:35 -0400 References: <1464712247-11655-3-git-send-email-wexu@redhat.com> From: Wei Xu Message-ID: <576AAE29.8050802@redhat.com> Date: Wed, 22 Jun 2016 23:26:33 +0800 MIME-Version: 1.0 In-Reply-To: <1464712247-11655-3-git-send-email-wexu@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC Patch 2/3] chardev: save the passed in 'fd' parameter during parsing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org There has been comments on this patch, but i forgot adding this patch to the list, just forward it again. Save the 'fd' paramter as unix socket 'sockfd' member. Signed-off-by: Wei Xu --- qemu-char.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index ea9c02e..8d20494 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3664,6 +3664,7 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, bool is_telnet = qemu_opt_get_bool(opts, "telnet", false); bool do_nodelay = !qemu_opt_get_bool(opts, "delay", true); int64_t reconnect = qemu_opt_get_number(opts, "reconnect", 0); + const int32_t fd = (int32_t)qemu_opt_get_number(opts, "sockfd", 0); const char *path = qemu_opt_get(opts, "path"); const char *host = qemu_opt_get(opts, "host"); const char *port = qemu_opt_get(opts, "port"); @@ -3708,6 +3709,12 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, addr->type = SOCKET_ADDRESS_KIND_UNIX; q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); q_unix->path = g_strdup(path); + + if (fd) { + q_unix->sockfd = fd; + } else { + q_unix->sockfd = 0; + } } else { addr->type = SOCKET_ADDRESS_KIND_INET; addr->u.inet.data = g_new(InetSocketAddress, 1); -- 2.7.1