Patchwork [3/4] char: add gio watch fn for tcp backends

login
register
mail settings
Submitter Amit Shah
Date Feb. 4, 2013, 12:50 p.m.
Message ID <63ccc7b11dbeec95ba77e4eb4b64a478a90221ed.1359982059.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/217902/
State New
Headers show

Comments

Amit Shah - Feb. 4, 2013, 12:50 p.m.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 qemu-char.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch

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;