aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qapi-schema.json8
-rw-r--r--qemu-char.c1
-rw-r--r--qmp-commands.hx19
3 files changed, 22 insertions, 6 deletions
diff --git a/qapi-schema.json b/qapi-schema.json
index c68a17f4d8..2284f0f12a 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -214,12 +214,18 @@
#
# @filename: the filename of the character device
#
+# @frontend-open: shows whether the frontend device attached to this backend
+# (eg. with the chardev=... option) is in open or closed state
+# (since 2.1)
+#
# Notes: @filename is encoded using the QEMU command line character device
# encoding. See the QEMU man page for details.
#
# Since: 0.14.0
##
-{ 'type': 'ChardevInfo', 'data': {'label': 'str', 'filename': 'str'} }
+{ 'type': 'ChardevInfo', 'data': {'label': 'str',
+ 'filename': 'str',
+ 'frontend-open': 'bool'} }
##
# @query-chardev:
diff --git a/qemu-char.c b/qemu-char.c
index cbd6b9a025..51917de462 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3705,6 +3705,7 @@ ChardevInfoList *qmp_query_chardev(Error **errp)
info->value = g_malloc0(sizeof(*info->value));
info->value->label = g_strdup(chr->label);
info->value->filename = g_strdup(chr->filename);
+ info->value->frontend_open = chr->fe_open;
info->next = chr_list;
chr_list = info;
diff --git a/qmp-commands.hx b/qmp-commands.hx
index e4a1c80434..35f51466fb 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1921,19 +1921,28 @@ Each json-object contain the following:
- "label": device's label (json-string)
- "filename": device's file (json-string)
+- "frontend-open": open/closed state of the frontend device attached to this
+ backend (json-bool)
Example:
-> { "execute": "query-chardev" }
<- {
- "return":[
+ "return": [
+ {
+ "label": "charchannel0",
+ "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
+ "frontend-open": false
+ },
{
- "label":"monitor",
- "filename":"stdio"
+ "label": "charmonitor",
+ "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
+ "frontend-open": true
},
{
- "label":"serial0",
- "filename":"vc"
+ "label": "charserial0",
+ "filename": "pty:/dev/pts/2",
+ "frontend-open": true
}
]
}