* tty.cc (tty::make_pipes): Set to_slave pipe mode to nonblocking.
* fhandler_tty.cc (fhandler_pty_master::accept_input): If pipe buffer is full, give slave a chance to read data.
This commit is contained in:
parent
22ae5a5be8
commit
a069f5602e
|
@ -1,3 +1,9 @@
|
||||||
|
2001-04-27 Egor Duda <deo@logos-m.ru>
|
||||||
|
|
||||||
|
* tty.cc (tty::make_pipes): Set to_slave pipe mode to nonblocking.
|
||||||
|
* fhandler_tty.cc (fhandler_pty_master::accept_input): If pipe buffer
|
||||||
|
is full, give slave a chance to read data.
|
||||||
|
|
||||||
2001-04-26 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
|
2001-04-26 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
|
||||||
|
|
||||||
* security.cc (alloc_sd): Add unrelated ACCESS_ALLOWED_ACE behind
|
* security.cc (alloc_sd): Add unrelated ACCESS_ALLOWED_ACE behind
|
||||||
|
|
|
@ -167,18 +167,40 @@ fhandler_pty_master::doecho (const void *str, DWORD len)
|
||||||
int
|
int
|
||||||
fhandler_pty_master::accept_input ()
|
fhandler_pty_master::accept_input ()
|
||||||
{
|
{
|
||||||
DWORD written;
|
DWORD bytes_left, written;
|
||||||
DWORD n;
|
DWORD n;
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
|
char* p;
|
||||||
|
|
||||||
rc = WaitForSingleObject (input_mutex, INFINITE);
|
rc = WaitForSingleObject (input_mutex, INFINITE);
|
||||||
|
|
||||||
n = get_ttyp ()->read_retval = eat_readahead (-1);
|
bytes_left = n = eat_readahead (-1);
|
||||||
|
get_ttyp ()->read_retval = 0;
|
||||||
|
p = rabuf;
|
||||||
|
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
{
|
{
|
||||||
termios_printf ("about to write %d chars to slave", n);
|
while (bytes_left > 0)
|
||||||
rc = WriteFile (get_output_handle (), rabuf, n, &written, NULL);
|
{
|
||||||
|
termios_printf ("about to write %d chars to slave", bytes_left);
|
||||||
|
rc = WriteFile (get_output_handle (), p, bytes_left, &written, NULL);
|
||||||
|
if (!rc)
|
||||||
|
{
|
||||||
|
debug_printf ("error writing to pipe %E");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
get_ttyp ()->read_retval += written;
|
||||||
|
p += written;
|
||||||
|
bytes_left -= written;
|
||||||
|
if (bytes_left > 0)
|
||||||
|
{
|
||||||
|
debug_printf ("to_slave pipe is full");
|
||||||
|
SetEvent (input_available_event);
|
||||||
|
ReleaseMutex (input_mutex);
|
||||||
|
Sleep (10);
|
||||||
|
rc = WaitForSingleObject (input_mutex, INFINITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
termios_printf ("sending EOF to slave");
|
termios_printf ("sending EOF to slave");
|
||||||
|
|
|
@ -367,6 +367,10 @@ tty::make_pipes (fhandler_pty_master *ptym)
|
||||||
ProtectHandle1 (from_slave, from_pty);
|
ProtectHandle1 (from_slave, from_pty);
|
||||||
termios_printf ("tty%d from_slave %p, to_slave %p", ntty, from_slave,
|
termios_printf ("tty%d from_slave %p, to_slave %p", ntty, from_slave,
|
||||||
to_slave);
|
to_slave);
|
||||||
|
|
||||||
|
DWORD pipe_mode = PIPE_NOWAIT;
|
||||||
|
if (!SetNamedPipeHandleState (to_slave, &pipe_mode, NULL, NULL))
|
||||||
|
termios_printf ("can't set to_slave to non-blocking mode");
|
||||||
ptym->set_io_handle (from_slave);
|
ptym->set_io_handle (from_slave);
|
||||||
ptym->set_output_handle (to_slave);
|
ptym->set_output_handle (to_slave);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue