From patchwork Mon Feb 4 12:50:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 217902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A3A422C02A7 for ; Mon, 4 Feb 2013 23:51:58 +1100 (EST) Received: from localhost ([::1]:60127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2LWe-0006Yv-JX for incoming@patchwork.ozlabs.org; Mon, 04 Feb 2013 07:51:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2LWL-0006Nf-0C for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:51:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U2LWG-0003Kr-9i for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:51:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2LWG-0003Kn-2H for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:51:32 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r14CpUqw024790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Feb 2013 07:51:30 -0500 Received: from localhost ([10.3.113.7]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r14CpQH1029189; Mon, 4 Feb 2013 07:51:28 -0500 From: Amit Shah To: Anthony Liguori Date: Mon, 4 Feb 2013 18:20:49 +0530 Message-Id: <63ccc7b11dbeec95ba77e4eb4b64a478a90221ed.1359982059.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Amit Shah , qemu list Subject: [Qemu-devel] [PATCH 3/4] char: add gio watch fn for tcp backends X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Amit Shah --- qemu-char.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index 7fa9372..01b0190 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2484,6 +2484,12 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len) } #endif +static GSource *tcp_chr_add_watch(CharDriverState *chr, GIOCondition cond) +{ + PtyCharDriver *s = chr->opaque; + return g_io_create_watch(s->fd, cond); +} + static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) { CharDriverState *chr = opaque; @@ -2698,6 +2704,7 @@ static CharDriverState *qemu_chr_open_socket_fd(int fd, bool do_nodelay, chr->chr_close = tcp_chr_close; chr->get_msgfd = tcp_get_msgfd; chr->chr_add_client = tcp_chr_add_client; + chr->chr_add_watch = tcp_chr_add_watch; if (is_listen) { s->listen_fd = fd;