[PATCH v3 0/1] Pseudo console support in PTY (v3)

Takashi Yano takashi.yano@nifty.ne.jp
Sat Apr 6 11:13:00 GMT 2019


The major changes from v2 is as follows.

(1) I dig into this problem,
    https://www.cygwin.com/ml/cygwin-developers/2019-04/msg00000.html
    and adoptted another approach. Slave process is left unattached
    by some reason if the executable is a windows GUI binary, such
    as mintty. So the code is added in stdio_init() in dtable.cc,
    which makes slave attach to pseudo console and fix up handles,
    if the slave is on pty but not attached. The previous approach,
    which uses fhandler_console::need_invisible(), has a side effect
    that the mintty looks running on cons*, although it actually has
    no TTY.

(2) The ctrl-C issue reported in
    https://cygwin.com/ml/cygwin-developers/2019-04/msg00012.html
    has been fixed. This seems to be caused by race condition of a
    variable, switch_to_pcon. This variable holds the state for
    switching I/O between pseudo console for native console apps
    and conventional pty for cygwin apps. The handling of this
    variable is refined. I suppose the issue is fixed in v3.

(3) Code page handling is refined a bit. Now, code page 65001 (UTF8)
    and native code page in your region should work without garbled
    characters. This works properly only on terminal which supports
    UTF-8.

(4) Synchronization between real terminal and pseudo console screen
    buffer is improved. For this, screen is cleared on startup of pty
    slave app. Also echo for key input is pushed into pseudo console
    screen buffer.

By (4),
On Sat, 30 Mar 2019 22:08:04 +0900 Takashi Yano wrote:
> Known problems:
> * Sometimes the screen layout would be broken.
is almost resolved.

D=http://tyan0.dip.jp/cygwin
${D}/x86_64/test/cygwin1-20190406.dll.xz
${D}/x86_64/test/cygwin-console-helper.exe.xz
${D}/x86/test/cygwin1-20190406.dll.xz
${D}/x86/test/cygwin-console-helper.exe.xz


Takashi Yano (1):
  Cygwin: pty: add pseudo console support.

 winsup/cygwin/dtable.cc               |  57 +++
 winsup/cygwin/fhandler.h              |  46 +-
 winsup/cygwin/fhandler_console.cc     |  32 ++
 winsup/cygwin/fhandler_tty.cc         | 610 ++++++++++++++++++++++++--
 winsup/cygwin/fork.cc                 |  20 +
 winsup/cygwin/select.cc               |  22 +-
 winsup/cygwin/spawn.cc                |  32 ++
 winsup/cygwin/tty.cc                  |   5 +
 winsup/cygwin/tty.h                   |  21 +-
 winsup/utils/cygwin-console-helper.cc |  14 +-
 10 files changed, 816 insertions(+), 43 deletions(-)

-- 
2.17.0



More information about the Cygwin-developers mailing list