On September 18, 2025 9:53:27 AM GMT+02:00, Maximilian Immanuel Brandtner 
<[email protected]> wrote:
> On Wed, 2025-09-17 at 14:31 +0100, Daniel P. Berrangé wrote:
> > On Wed, Sep 17, 2025 at 03:09:50PM +0200, Filip Hejsek wrote:
> > > 
> > > 
> > > On September 17, 2025 11:39:55 AM GMT+02:00, Maximilian Immanuel
> > > Brandtner <[email protected]> wrote:
> > > > On Tue, 2025-09-16 at 00:02 +0200, Filip Hejsek wrote:
> > > > > On Mon, 2025-09-15 at 18:34 +0200, Maximilian Immanuel
> > > > > Brandtner
> > > > > wrote:
> > > > > > Update the terminal size upon SIGWINCH delivery.
> > > > > > 
> > > > > > Signed-off-by: Maximilian Immanuel Brandtner
> > > > > > <[email protected]>
> > > > > 
> > > > > I don't think this will work, because SIGWINCH is only
> > > > > delivered for
> > > > > the process' controling terminal. Unfortunately I don't think
> > > > > there
> > > > > is
> > > > > any way to get size notifications for arbitrary terminal.
> > > > 
> > > > In that case there are two solutions:
> > > > 1. make qemu the controlling process of the pty (this has the
> > > > disadvantage of QEMU being quit when the pty is closed)
> > > 
> > > A bigger disadvantage is that a process can only have one
> > > controlling terminal, and a terminal can only be the controlling
> > > terminal for a single session (and only sends signals to the
> > > foreground process group of that session). It would require forking
> > > a process for each pty, and I don't even know if the master end can
> > > have its own session.
> > > 
> > > > 2. create a timer polling every eg 100ms to check if the winsize
> > > > has
> > > > changed
> > > > 
> > > > I would go with the second approach then
> > > 
> > > Me too, the timer is a bit unfortunate, but it's probably the less
> > > bad option.
> > 
> > I don't think we want a timer polling for an situation that will very
> > rarely arise.  We already add the 'chardev_resize' QMP command, which
> > is
> > a good enough way to kick QEMU to re-read the size.
> > 
> > With regards,
> > Daniel
> 
> This approach would only work with libvirt and not generic pty
> applications though. Perhaps a bool poll_resize could be added to the
> struct Chardev which is disabled, as soon as the chardev_resize QMP
> command is used to avoid race conditions.

Well, terminal emulators that set the pty size typically create their own pty
and control it from the master side. I don't know what pty applications you
have in mind—changing the window size from the slave side is somewhat
atypical. Applications designed for a real serial port probably don't set the 
size at all.

Regards,
Filip

Reply via email to