Re: [PATCH 0/5] SIGWINCH problem with terminal apps still alive

From: Adam TlaÅka
Date: Thu Oct 16 2008 - 07:43:41 EST

Thu, 16 Oct 2008 11:52:02 +0100 - Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>:

> > Now if xterm resizes itself then a program on slave gets its signal
> > but if this program sets terminal sizes by ioctl then only xterm
> > gets the SIGWINCH signal and could read desired sizes by ioctl and
> > then resize itself and set valid sizes on slave side by another
> > ioctl() call. If it not supports this method then there will be no
> > changes on slave side. I think that it is more proper so on the
> > slave side we will see always actual values and if terminal resizes
> > we will get SIGWINCH.
> The current and historic behaviour is I believe correct and matches
> other Unixes.

I don't know what it means ,,correct'' here. stty(,TIOCSWINSZ,) on pty
slave in its correct behaviour is unusable and leads to application
confuse and sometimes crash.

> Your patch doesn't really seem to make a lot of sense either. You add
> pty special cases in places they are not needed and you pass various
> extra arguments to functions that don't need them.

I do not agree. Adding real_tty arg to tiocgwinsz() is for purpose
of using always the same mutex but read winsize depending on call
side (master or slave). So master could get what it should set and
slave reads always actual terminal values corresponding to real
terminal sizes.

> I did actually have a glance at the pty signalling question a couple
> of days ago while further tidying up the default resize logic - see
> the ttydev tree. I'm cautious about changing the signal behaviour
> however without having a hard look to see whether any other Unixen
> has that behaviour currently as we may risk breaking stuff.

Other Unixes seem to have the ,,correct'' not quite usable behaviour ;).
If we want to stick to this my previous patch - [PATCH 0/4] seems to be
It only corrects situaction with mutex usage and sending signal to the
master side in case of ioctl(,TIOCSWINS,) done on the slave side.
So a teminal emulator can get signal too and react. But 1. an app can
get its signal before terminal emulator while it is not really resized
yet; 2. a terminal emulator does not support SIGWINCH so we have no
resize but variable is updated and signal generated. So it is not usable
anymore till terminal emulator resizes by itself - but if it changes
sizes to values retuned by ioctl(,TIOCGWINSZ,) there will be no
SIGWINCH send to the app. So you have to manually force it to repaint
its screen so it looks correctly.


Adam TlaÅka mailto:atlka@xxxxxxxxx ^v^ ^v^ ^v^
System & Network Administration Group - - - ~~~~~~
Computer Center, GdaÅsk University of Technology, Poland
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at