aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-12-20 14:39:13 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-01-16 06:58:54 +0100
commit0a1a7fabda7f0fa05ef09051be29e92e81f929ad (patch)
tree25ec7df376c7f5b8a451c13be426f17e7d30efb8 /qemu-char.c
parentf6bd5d6ec514939c421fcd411d1a39bc7dad0948 (diff)
chardev: add pty chardev support to chardev-add (qmp)
The ptsname is returned directly, so there is no need to use query-chardev to figure the pty device path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 36d7e29953..9ba0573c6a 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3204,6 +3204,19 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
case CHARDEV_BACKEND_KIND_SOCKET:
chr = qmp_chardev_open_socket(backend->socket, errp);
break;
+#ifdef HAVE_CHARDEV_TTY
+ case CHARDEV_BACKEND_KIND_PTY:
+ {
+ /* qemu_chr_open_pty sets "path" in opts */
+ QemuOpts *opts;
+ opts = qemu_opts_create_nofail(qemu_find_opts("chardev"));
+ chr = qemu_chr_open_pty(opts);
+ ret->pty = g_strdup(qemu_opt_get(opts, "path"));
+ ret->has_pty = true;
+ qemu_opts_del(opts);
+ break;
+ }
+#endif
case CHARDEV_BACKEND_KIND_NULL:
chr = qemu_chr_open_null(NULL);
break;