aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2013-03-05 23:21:25 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2013-03-08 13:57:15 -0600
commitd3cc5bc416cdf25bae0f3f6de58830be8ac5b648 (patch)
treedbfd974ee6fbe074ddd6b36b90f7eb80b0ec369c
parente6a87ed837b52aea903c25693b1e3703824b9ef7 (diff)
char: add gio watch fn for tcp backends
Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: b50e668c4f4146a654c5d4412440eb9e589f2c02.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--qemu-char.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index f1d089ffdd..eb0ac811a3 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2462,6 +2462,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)
+{
+ TCPCharDriver *s = chr->opaque;
+ return g_io_create_watch(s->chan, cond);
+}
+
static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
{
CharDriverState *chr = opaque;
@@ -2670,6 +2676,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;