* 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:
parent
0fbf39cc9f
commit
f4c1f003e3
@ -1,3 +1,33 @@
|
||||
2011-04-17 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* 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.
|
||||
|
||||
2011-04-15 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
|
||||
|
||||
* thread.cc (pthread_setschedprio): New function.
|
||||
|
@ -293,7 +293,7 @@ struct init_cygheap: public mini_cygheap
|
||||
#endif
|
||||
struct sigaction *sigs;
|
||||
|
||||
fhandler_tty_slave *ctty; /* Current tty */
|
||||
fhandler_termios *ctty; /* Current tty */
|
||||
#ifdef NEWVFORK
|
||||
fhandler_tty_slave *ctty_on_hold;
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* dtable.cc: file descriptor support.
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
|
||||
2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -147,7 +147,6 @@ dtable::get_debugger_info ()
|
||||
void
|
||||
dtable::stdio_init ()
|
||||
{
|
||||
extern void set_console_ctty ();
|
||||
/* Set these before trying to output anything from strace.
|
||||
Also, always set them even if we're to pick up our parent's fds
|
||||
in case they're missed. */
|
||||
@ -189,11 +188,6 @@ dtable::stdio_init ()
|
||||
|
||||
init_std_file_from_handle (1, out);
|
||||
init_std_file_from_handle (2, err);
|
||||
|
||||
/* Assign the console as the controlling tty for this process if we actually
|
||||
have a console and no other controlling tty has been assigned. */
|
||||
if (!fhandler_console::need_invisible () && myself->ctty < 0)
|
||||
set_console_ctty ();
|
||||
}
|
||||
|
||||
const int dtable::initial_archetype_size;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* exceptions.cc
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
|
||||
2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -712,12 +712,6 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void
|
||||
int __stdcall
|
||||
handle_sigsuspend (sigset_t tempmask)
|
||||
{
|
||||
if (&_my_tls != _main_tls)
|
||||
{
|
||||
cancelable_wait (signal_arrived, INFINITE, cw_cancel_self);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sigset_t oldmask = _my_tls.sigmask; // Remember for restoration
|
||||
|
||||
set_signal_mask (tempmask, _my_tls.sigmask);
|
||||
@ -1174,6 +1168,19 @@ sigpacket::process ()
|
||||
sig_clear (SIGTTOU);
|
||||
}
|
||||
|
||||
switch (si.si_signo)
|
||||
{
|
||||
case SIGINT:
|
||||
case SIGQUIT:
|
||||
case SIGSTOP:
|
||||
case SIGTSTP:
|
||||
if (cygheap->ctty)
|
||||
cygheap->ctty->sigflush ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int rc = 1;
|
||||
|
||||
sigproc_printf ("signal %d processing", si.si_signo);
|
||||
|
@ -912,6 +912,8 @@ class fhandler_termios: public fhandler_base
|
||||
void set_output_handle (HANDLE h) { output_handle = h; }
|
||||
void tcinit (tty_min *this_tc, bool force);
|
||||
bool is_tty () const { return true; }
|
||||
tty *get_ttyp () { return (tty *) tc; }
|
||||
void sigflush ();
|
||||
int tcgetpgrp ();
|
||||
int tcsetpgrp (int pid);
|
||||
bg_check_types bg_check (int sig);
|
||||
@ -1083,7 +1085,7 @@ class fhandler_console: public fhandler_termios
|
||||
void set_close_on_exec (bool val);
|
||||
void set_input_state ();
|
||||
void send_winch_maybe ();
|
||||
static tty_min *get_tty_stuff (int);
|
||||
tty_min *get_tty_stuff (int);
|
||||
bool is_slow () {return true;}
|
||||
static bool need_invisible ();
|
||||
static bool has_a () {return !invisible_console;}
|
||||
@ -1111,8 +1113,6 @@ class fhandler_tty_common: public fhandler_termios
|
||||
DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms);
|
||||
void __release_output_mutex (const char *fn, int ln);
|
||||
|
||||
tty *get_ttyp () { return (tty *) tc; }
|
||||
|
||||
int close ();
|
||||
_off64_t lseek (_off64_t, int);
|
||||
void set_close_on_exec (bool val);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -367,3 +367,10 @@ fhandler_termios::lseek (_off64_t, int)
|
||||
set_errno (ESPIPE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
fhandler_termios::sigflush ()
|
||||
{
|
||||
if (!(get_ttyp ()->ti.c_lflag & NOFLSH))
|
||||
tcflush (TCIFLUSH);
|
||||
}
|
||||
|
@ -1606,7 +1606,7 @@ fhandler_tty_master::init_console ()
|
||||
if (console == NULL)
|
||||
return -1;
|
||||
|
||||
console->init (INVALID_HANDLE_VALUE, GENERIC_READ | GENERIC_WRITE, O_BINARY);
|
||||
console->init (NULL, GENERIC_READ | GENERIC_WRITE, O_BINARY);
|
||||
cygheap->manage_console_count ("fhandler_tty_master::init_console", -1, true);
|
||||
console->uninterruptible_io (true);
|
||||
return 0;
|
||||
|
@ -371,7 +371,7 @@ _pinfo::_ctty (char *buf)
|
||||
}
|
||||
|
||||
void
|
||||
_pinfo::set_ctty (tty_min *tc, int flags, fhandler_tty_slave *arch)
|
||||
_pinfo::set_ctty (tty_min *tc, int flags, fhandler_termios *arch)
|
||||
{
|
||||
debug_printf ("old %s", __ctty ());
|
||||
if ((ctty < 0 || ctty == tc->ntty) && !(flags & O_NOCTTY))
|
||||
@ -420,6 +420,7 @@ _pinfo::set_ctty (tty_min *tc, int flags, fhandler_tty_slave *arch)
|
||||
}
|
||||
}
|
||||
}
|
||||
debug_printf ("cygheap->ctty now %p, arch %p", cygheap->ctty, arch);
|
||||
}
|
||||
|
||||
/* Test to determine if a process really exists and is processing signals.
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
char *root (size_t &);
|
||||
char *cwd (size_t &);
|
||||
char *cmdline (size_t &);
|
||||
void set_ctty (class tty_min *, int, class fhandler_tty_slave *);
|
||||
void set_ctty (class tty_min *, int, class fhandler_termios *);
|
||||
HANDLE dup_proc_pipe (HANDLE) __attribute__ ((regparm(2)));
|
||||
void sync_proc_pipe ();
|
||||
bool alert_parent (char);
|
||||
|
Loading…
x
Reference in New Issue
Block a user