From: Filip Hejsek <filip.hejsek@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Amit Shah" <amit@kernel.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Maximilian Immanuel Brandtner" <maxbr@linux.ibm.com>,
"Szymon Lukasz" <noh4hss@gmail.com>,
"Filip Hejsek" <filip.hejsek@gmail.com>
Subject: [PATCH RFC v5 02/12] chardev: add CHR_EVENT_RESIZE
Date: Sun, 21 Sep 2025 01:45:32 +0200 [thread overview]
Message-ID: <20250921-console-resize-v5-2-89e3c6727060@gmail.com> (raw)
In-Reply-To: <20250921-console-resize-v5-0-89e3c6727060@gmail.com>
From: Szymon Lukasz <noh4hss@gmail.com>
Add a new chardev event, CHR_EVENT_RESIZE, which a backend should
trigger if it detects the size of the connected terminal changed.
Signed-off-by: Szymon Lukasz <noh4hss@gmail.com>
Signed-off-by: Filip Hejsek <filip.hejsek@gmail.com>
---
backends/cryptodev-vhost-user.c | 1 +
chardev/char.c | 1 +
hw/block/vhost-user-blk.c | 1 +
hw/char/terminal3270.c | 1 +
hw/char/virtio-console.c | 1 +
hw/ipmi/ipmi_bmc_extern.c | 1 +
hw/scsi/vhost-user-scsi.c | 1 +
hw/usb/ccid-card-passthru.c | 1 +
hw/usb/dev-serial.c | 1 +
hw/usb/redirect.c | 1 +
hw/virtio/vhost-user-base.c | 1 +
hw/virtio/vhost-user-scmi.c | 1 +
include/chardev/char.h | 4 ++++
monitor/hmp.c | 1 +
monitor/qmp.c | 1 +
net/passt.c | 1 +
net/vhost-user.c | 1 +
17 files changed, 20 insertions(+)
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index cb04e68b022abcc4d794df741dfc25181db660bc..9daca4b0f91e802f67cf3c7af1f8f26479026e1e 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -173,6 +173,7 @@ static void cryptodev_vhost_user_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/chardev/char.c b/chardev/char.c
index bbebd246c3a46c848847effc775f6390b5078e14..635d19fea4fd4bd0c7f171f055fe940f9f5ebed5 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -75,6 +75,7 @@ void qemu_chr_be_event(Chardev *s, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index c0cc5f6942815aa5e8d972553b3c76a623523ba4..942bc46171824017c98774d6fe793059082385b6 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -412,6 +412,7 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
index d950c172921f91e41fad2b86a8d2a3791f6b0330..2fdf823e3bab3187fa6a4d2214ecd991bac5f473 100644
--- a/hw/char/terminal3270.c
+++ b/hw/char/terminal3270.c
@@ -172,6 +172,7 @@ static void chr_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index 0932a3572b78eda866cd7680a32866f2077a91dd..881c862ce9d12027f392031bdea7dbe280ec5493 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -168,6 +168,7 @@ static void chr_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 9f1ba7b2f8715daf3558fedde358c625c74da20e..b1f28c5b7db71d2cbd828227f176a484629a14f7 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -436,6 +436,7 @@ static void chr_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
index 25f2d894e7c827744a41302473712e7b34672536..a8d40046b714e5899262af7382a02611cb7f9a81 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ b/hw/scsi/vhost-user-scsi.c
@@ -226,6 +226,7 @@ static void vhost_user_scsi_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 1eea21a7337747667e9b1db97900c67b061f3729..08fec48dbe00cebef7e73053f2be76932175fb47 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -323,6 +323,7 @@ static void ccid_card_vscard_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
case CHR_EVENT_CLOSED:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 1c116d8b0fef7b23dd076aa6e7e81e52bb51cdbb..dd70db7705def9b93bd69cf176ff0ed7d8cb2cad 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -576,6 +576,7 @@ static void usb_serial_event(void *opaque, QEMUChrEvent event)
break;
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index f516ff42a114d014033ab9f2fce93d1ca48983a6..68c9b48f7a07558441c6d6cd3deccb98e833910b 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1390,6 +1390,7 @@ static void usbredir_chardev_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c
index ff67a020b471b2edfacc6d238ffc50b3ba36afc4..57ff26e775df46135b84449f22929fadd33c684a 100644
--- a/hw/virtio/vhost-user-base.c
+++ b/hw/virtio/vhost-user-base.c
@@ -267,6 +267,7 @@ static void vub_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/hw/virtio/vhost-user-scmi.c b/hw/virtio/vhost-user-scmi.c
index f9264c4374e87cb78f8937fda852089487b477e8..180787ec6d94793d4915a26389ae2bece231064e 100644
--- a/hw/virtio/vhost-user-scmi.c
+++ b/hw/virtio/vhost-user-scmi.c
@@ -214,6 +214,7 @@ static void vu_scmi_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 336b2e68d099e70a9abe71ef842b160bf12ea932..45cb6349756ac8072dffab9354108caf90cd3565 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -22,6 +22,10 @@ typedef enum {
CHR_EVENT_OPENED, /* new connection established */
CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */
CHR_EVENT_MUX_OUT, /* mux-focus will move on */
+ CHR_EVENT_RESIZE, /*
+ * the size of the terminal connected to
+ * the chardev changed
+ */
CHR_EVENT_CLOSED /* connection closed. NOTE: currently this event
* is only bound to the read port of the chardev.
* Normally the read port and write port of a
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 34e2b8f748b425e1e4446e8e64aa25b1433d1162..be623a0ef0d0ebdf091d87e4d620175ad60d1566 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1444,6 +1444,7 @@ static void monitor_event(void *opaque, QEMUChrEvent event)
break;
case CHR_EVENT_BREAK:
+ case CHR_EVENT_RESIZE:
/* Ignored */
break;
}
diff --git a/monitor/qmp.c b/monitor/qmp.c
index cb99a12d94175b395033569e8ead908d9453e759..ff7548422bc60c64e47fc4f24adf092fc81c70b5 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -484,6 +484,7 @@ static void monitor_qmp_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/net/passt.c b/net/passt.c
index 32ecffb763b48af4e17b20b98537a4ffb3a6d3ea..2308e3b4d44aa410c374eb1b47e5081c2bef5cec 100644
--- a/net/passt.c
+++ b/net/passt.c
@@ -421,6 +421,7 @@ static void passt_vhost_user_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 8b96157145a7ab719b15b1b70aadac1e88ebfd5f..1c7fdf8267d8c214dcb6ae92e0521747a9f59a6f 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -367,6 +367,7 @@ static void net_vhost_user_event(void *opaque, QEMUChrEvent event)
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_RESIZE:
/* Ignore */
break;
}
--
2.51.0
next prev parent reply other threads:[~2025-09-20 23:47 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 23:45 [PATCH RFC v5 00/12] virtio-console: notify about the terminal size Filip Hejsek
2025-09-20 23:45 ` [PATCH RFC v5 01/12] chardev: add cols, rows fields Filip Hejsek
2025-09-22 8:13 ` Daniel P. Berrangé
2025-10-13 5:09 ` Dominique Martinet
2025-09-20 23:45 ` Filip Hejsek [this message]
2025-09-22 8:16 ` [PATCH RFC v5 02/12] chardev: add CHR_EVENT_RESIZE Daniel P. Berrangé
2025-10-13 5:11 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 03/12] chardev: add qemu_chr_resize() Filip Hejsek
2025-09-22 8:19 ` Daniel P. Berrangé
2025-10-13 5:12 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 04/12] char-mux: add support for the terminal size Filip Hejsek
2025-09-22 8:21 ` Daniel P. Berrangé
2025-10-13 5:13 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 05/12] main-loop: change the handling of SIGWINCH Filip Hejsek
2025-09-22 8:29 ` Daniel P. Berrangé
2025-10-13 5:13 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 06/12] char-stdio: add support for the terminal size Filip Hejsek
2025-09-22 8:33 ` Daniel P. Berrangé
2025-10-13 5:14 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 07/12] qmp: add chardev-window-size-changed command Filip Hejsek
2025-09-22 6:45 ` Markus Armbruster
2025-09-22 8:52 ` Filip Hejsek
2025-09-22 9:38 ` Markus Armbruster
2025-09-22 8:35 ` Daniel P. Berrangé
2025-10-13 5:18 ` Dominique Martinet
2025-10-13 5:23 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 08/12] virtio-serial-bus: add terminal resize messages Filip Hejsek
2025-09-22 8:53 ` Daniel P. Berrangé
2025-10-13 5:19 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 09/12] virtio-console: notify the guest about terminal resizes Filip Hejsek
2025-09-22 8:45 ` Daniel P. Berrangé
2025-10-13 5:28 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 10/12] char-win-stdio: add support for terminal size Filip Hejsek
2025-09-22 8:38 ` Daniel P. Berrangé
2025-10-13 5:29 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 11/12] ui/console-vc: forward text console size to vc chardev Filip Hejsek
2025-09-22 8:41 ` Daniel P. Berrangé
2025-10-13 5:29 ` Dominique Martinet
2025-09-20 23:45 ` [PATCH RFC v5 12/12] ui/gtk: forward gtk " Filip Hejsek
2025-09-22 8:41 ` Daniel P. Berrangé
2025-10-13 5:44 ` Dominique Martinet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250921-console-resize-v5-2-89e3c6727060@gmail.com \
--to=filip.hejsek@gmail.com \
--cc=amit@kernel.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=maxbr@linux.ibm.com \
--cc=mst@redhat.com \
--cc=noh4hss@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).