Received: from eggs.gnu.org ([2001:4830:134:3::10]:47198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxiCG-00058G-Qc for qemu-devel@nongnu.org; Thu, 19 Jun 2014 15:40:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxiCA-0007vm-Gh for qemu-devel@nongnu.org; Thu, 19 Jun 2014 15:40:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxiCA-0007vh-9R for qemu-devel@nongnu.org; Thu, 19 Jun 2014 15:40:26 -0400 From: Luiz Capitulino Date: Thu, 19 Jun 2014 15:39:49 -0400 Message-Id: <1403206792-15387-38-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1403206792-15387-1-git-send-email-lcapitulino@redhat.com> References: <1403206792-15387-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 37/40] qemu-char: move pty_chr_update_read_handler around List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws From: Paolo Bonzini Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini Signed-off-by: Luiz Capitulino --- qemu-char.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 26994aa..9470ea2 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1055,6 +1055,22 @@ static void pty_chr_rearm_timer(CharDriverState *chr, int ms) } } +static void pty_chr_update_read_handler(CharDriverState *chr) +{ + PtyCharDriver *s = chr->opaque; + GPollFD pfd; + + pfd.fd = g_io_channel_unix_get_fd(s->fd); + pfd.events = G_IO_OUT; + pfd.revents = 0; + g_poll(&pfd, 1, 0); + if (pfd.revents & G_IO_HUP) { + pty_chr_state(chr, 0); + } else { + pty_chr_state(chr, 1); + } +} + static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { PtyCharDriver *s = chr->opaque; @@ -1107,22 +1123,6 @@ static gboolean pty_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) return TRUE; } -static void pty_chr_update_read_handler(CharDriverState *chr) -{ - PtyCharDriver *s = chr->opaque; - GPollFD pfd; - - pfd.fd = g_io_channel_unix_get_fd(s->fd); - pfd.events = G_IO_OUT; - pfd.revents = 0; - g_poll(&pfd, 1, 0); - if (pfd.revents & G_IO_HUP) { - pty_chr_state(chr, 0); - } else { - pty_chr_state(chr, 1); - } -} - static void pty_chr_state(CharDriverState *chr, int connected) { PtyCharDriver *s = chr->opaque; -- 1.9.3