summaryrefslogtreecommitdiff
path: root/chardev/char.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-12-13 13:41:44 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-12-13 13:41:44 +0000
commitc3ec0fa1a8e815ecfec9eabb9c20ee206c313e07 (patch)
tree8de8111f4fffb7c3bc3e5b12ad72105c7206cd1c /chardev/char.c
parent6145a6d84b3bf0f25935b88543febe076c61b0f4 (diff)
parentc55f070b7195cee4e06998c10f57f13c7df98dbd (diff)
downloadqemu-c3ec0fa1a8e815ecfec9eabb9c20ee206c313e07.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2018-12-12' into staging
Monitor patches for 2018-12-12 # gpg: Signature made Wed 12 Dec 2018 10:08:15 GMT # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-monitor-2018-12-12: tests: add oob functional test for test-qmp-cmds Revert "tests: Add parameter to qtest_init_without_qmp_handshake" monitor: Remove "x-oob", offer capability "oob" unconditionally monitor: Suspend monitor instead dropping commands monitor: avoid potential dead-lock when cleaning up monitor: prevent inserting new monitors after cleanup colo: check chardev can switch context monitor: check if chardev can switch gcontext for OOB char: add a QEMU_CHAR_FEATURE_GCONTEXT flag monitor: accept chardev input from iothread monitor: inline ambiguous helper functions Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'chardev/char.c')
-rw-r--r--chardev/char.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/chardev/char.c b/chardev/char.c
index 152dde5327..ccba36bafb 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -193,6 +193,8 @@ void qemu_chr_be_update_read_handlers(Chardev *s,
{
ChardevClass *cc = CHARDEV_GET_CLASS(s);
+ assert(qemu_chr_has_feature(s, QEMU_CHAR_FEATURE_GCONTEXT)
+ || !context);
s->gcontext = context;
if (cc->chr_update_read_handler) {
cc->chr_update_read_handler(s);
@@ -240,6 +242,15 @@ static void char_init(Object *obj)
chr->logfd = -1;
qemu_mutex_init(&chr->chr_write_lock);
+
+ /*
+ * Assume if chr_update_read_handler is implemented it will
+ * take the updated gcontext into account.
+ */
+ if (CHARDEV_GET_CLASS(chr)->chr_update_read_handler) {
+ qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_GCONTEXT);
+ }
+
}
static int null_chr_write(Chardev *chr, const uint8_t *buf, int len)