* cygheap.h (init_cygheap::ctty): Use base class so that console can join in

the fun.
* dtable.cc (dtable::stdio_init): Remove special-case call to set_console_ctty
().
* exceptions.cc (sigpacket::process): Conditionally flush terminal input on
certain signals.
* fhandler.h (fhandler_console::get_tty_stuff): Make non-static.
(fhandler_termios::get_ttyp): Move here.
(fhandler_termios::sigflush): Declare.
(fhandler_tty_common::get_ttyp): Delete.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Pass this as "arch"
argument.
(set_console_ctty): Delete.
(tty_list::get_tty): Just return pointer to shared console region, delaying
get_tty_stuff until open().
(fhandler_console::init): Treat NULL handle as signifying that console should
be opened with O_NOCTTY flag.  Rename handle argument to the more common 'h'.
* fhandler_termios.cc (fhandler_termios::sigflush): Define.
* fhandler_tty.cc (handler_tty_master::init_console): Pass NULL as first
argument to fhandler_console::init.
* pinfo.cc (_pinfo::set_ctty): Change third parameter to fhandler_termios *.
Add extra debugging.
* pinfo.h (_pinfo::set_ctty): Change third parameter to fhandler_termios *.
* sigproc.cc (handle_sigsuspend): Don't special-case non-main threads.
This commit is contained in:
Christopher Faylor
2011-04-17 19:56:25 +00:00
parent 0fbf39cc9f
commit f4c1f003e3
10 changed files with 67 additions and 34 deletions

View File

@@ -94,7 +94,7 @@ fhandler_console::get_tty_stuff (int flags = 0)
{
shared_console_info->tty_min_state.setntty (TTY_CONSOLE);
shared_console_info->tty_min_state.setsid (myself->sid);
myself->set_ctty (&shared_console_info->tty_min_state, flags, NULL);
myself->set_ctty (&shared_console_info->tty_min_state, flags, this);
dev_state->scroll_region.Bottom = -1;
dev_state->dwLastCursorPosition.X = -1;
@@ -125,12 +125,6 @@ fhandler_console::get_tty_stuff (int flags = 0)
return &shared_console_info->tty_min_state;
}
void
set_console_ctty ()
{
fhandler_console::get_tty_stuff ();
}
/* Return the tty structure associated with a given tty number. If the
tty number is < 0, just return a dummy record. */
tty_min *
@@ -138,7 +132,7 @@ tty_list::get_tty (int n)
{
static tty_min nada;
if (n == TTY_CONSOLE)
return fhandler_console::get_tty_stuff ();
return &shared_console_info->tty_min_state;
else if (n >= 0)
return &cygwin_shared->tty.ttys[n];
else
@@ -2076,9 +2070,9 @@ get_nonascii_key (INPUT_RECORD& input_rec, char *tmp)
}
int
fhandler_console::init (HANDLE f, DWORD a, mode_t bin)
fhandler_console::init (HANDLE h, DWORD a, mode_t bin)
{
// this->fhandler_termios::init (f, mode, bin);
// this->fhandler_termios::init (h, mode, bin);
/* Ensure both input and output console handles are open */
int flags = 0;
@@ -2089,9 +2083,9 @@ fhandler_console::init (HANDLE f, DWORD a, mode_t bin)
flags = O_WRONLY;
if (a == (GENERIC_READ | GENERIC_WRITE))
flags = O_RDWR;
open (flags | O_BINARY);
if (f != INVALID_HANDLE_VALUE)
CloseHandle (f); /* Reopened by open */
open (flags | O_BINARY | (h ? 0 : O_NOCTTY));
if (h && h != INVALID_HANDLE_VALUE)
CloseHandle (h); /* Reopened by open */
return !tcsetattr (0, &tc->ti);
}