This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] tty.cc nonblocking pipe


Hi,
  I've been tracking down why rxvt hangs when a paste
is too big, or if you simply cat a file with control
chars, like rxvt.exe.  What I discovered is that 
Windows will block writing to an anonymous pipe.  The
behavior I was seeing was that the child was pretty
much waiting on writes, which works as long as rxvt
keeps reading, but if rxvt writes as well (and blocks)
then deadlock occurs. 
  So the fix is to make the pipe non-blocking.  In tty.cc
the to_slave part is set to non-blocking, but the to_master
isn't.  Odd.  However, setting to_master to non-blocking
cures the rxvt deadlock.  This fix only works on NT/2K/XP.
Serious modification would be needed to get 98 to work.
-steve

*** tty-orig.cc Thu Sep 12 23:54:32 2002
--- tty.cc      Thu Sep 12 23:54:08 2002
***************
*** 375,380 ****
--- 375,382 ----
    DWORD pipe_mode = PIPE_NOWAIT;
    if (!SetNamedPipeHandleState (to_slave, &pipe_mode, NULL, NULL))
      termios_printf ("can't set to_slave to non-blocking mode");
+   if (!SetNamedPipeHandleState (to_master, &pipe_mode, NULL, NULL))
+     termios_printf ("can't set to_master to non-blocking mode");
    ptym->set_io_handle (from_slave);
    ptym->set_output_handle (to_slave);
    return TRUE;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]