* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise SIGPIPE
when writing. * fhandler.h: Include "tty.h". (fhandler_termios::_tc): Rename from tc. (fhandler_termios::tc): New method. (fhandler_termios::tcinit): Remove an argument. (fhandler_termios::get_ttyp): Use method to retrieve value. (fhandler_console::console_state): Move here. (fhandler_console::dev_state): Delete. (fhandler_console::shared_console_info): Define. (fhandler_console::open_shared_console): Move this function under fhandler_console umbrella. (fhandler_console::tc): Define. Return static value. (fhandler_console::focus_aware): Accommodate deletion of dev_state. (fhandler_console): Add tty_list::get_cttyp as a friend. * fhandler_console.cc (dev_state): Redefine as a pointer within shared_console_info and change dev-> to dev. throughout. (fhandler_console::shared_console_info): Move into fhandler_console. (fhandler_console::open_shared_console): Move into fhandler_console change argument to simple bool. (enum_windows): Accommodate changes to console_state and open_shared_console. (console_unit::console_unit): Ditto. (fhandler_console::get_tty_stuff): Accommodate change to dev_state. (tty_list::get_cttyp): Accommodate change to handler_console::shared_console_info. (fhandler_console::read): Accommodate change from tc to tc (). (fhandler_console::set_input_state): Ditto. (fhandler_console::open): Accommodate tcinit argument change and change from tc to tc(). (fhandler_console::input_tcsetattr): Accomodate change from tc to tc(). (fhandler_console::input_tcsetattr): Ditto. (fhandler_console::write_normal): Ditto. (fhandler_console::init): Ditto. (fhandler_console::igncr_enabled): Ditto. * fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument. Expect tc() to have been set up first. Use tc() rather than tc. (fhandler_termios::tcsetpgrp): Accomodate change from tc to tc(). (fhandler_termios::tcgetpgrp): Ditto. (fhandler_termios::bg_check): Ditto. (fhandler_termios::line_edit: Ditto. (fhandler_tty_master::set_winsize): Ditto. (fhandler_tty_slave::open): Ditto. (fhandler_tty_slave::init): Ditto. (fhandler_pty_master::write): Ditto. (fhandler_pty_master::setup): Ditto. Accommodate change in arguments to tcinit. (fhandler_tty_slave::fch_open_handles): Set _tc directly. (tty_min::is_orphaned_process_group): Don't assume that parent pid exists. * pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were started by a non-Cygwin process but the tty exists. * shared_info.h (console_state): Delete from here. * tty.h: Make multiple inclusion safe.
This commit is contained in:
parent
0e36228bfb
commit
32bf308231
|
@ -1,3 +1,61 @@
|
|||
2011-06-03 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise
|
||||
SIGPIPE when writing.
|
||||
|
||||
* fhandler.h: Include "tty.h".
|
||||
(fhandler_termios::_tc): Rename from tc.
|
||||
(fhandler_termios::tc): New method.
|
||||
(fhandler_termios::tcinit): Remove an argument.
|
||||
(fhandler_termios::get_ttyp): Use method to retrieve value.
|
||||
(fhandler_console::console_state): Move here.
|
||||
(fhandler_console::dev_state): Delete.
|
||||
(fhandler_console::shared_console_info): Define.
|
||||
(fhandler_console::open_shared_console): Move this function under
|
||||
fhandler_console umbrella.
|
||||
(fhandler_console::tc): Define. Return static value.
|
||||
(fhandler_console::focus_aware): Accommodate deletion of dev_state.
|
||||
(fhandler_console): Add tty_list::get_cttyp as a friend.
|
||||
* fhandler_console.cc (dev_state): Redefine as a pointer within
|
||||
shared_console_info and change dev-> to dev. throughout.
|
||||
(fhandler_console::shared_console_info): Move into fhandler_console.
|
||||
(fhandler_console::open_shared_console): Move into fhandler_console
|
||||
change argument to simple bool.
|
||||
(enum_windows): Accommodate changes to console_state and
|
||||
open_shared_console.
|
||||
(console_unit::console_unit): Ditto.
|
||||
(fhandler_console::get_tty_stuff): Accommodate change to dev_state.
|
||||
(tty_list::get_cttyp): Accommodate change to
|
||||
handler_console::shared_console_info.
|
||||
(fhandler_console::read): Accommodate change from tc to tc ().
|
||||
(fhandler_console::set_input_state): Ditto.
|
||||
(fhandler_console::open): Accommodate tcinit argument change and change
|
||||
from tc to tc().
|
||||
(fhandler_console::input_tcsetattr): Accomodate change from tc to tc().
|
||||
(fhandler_console::input_tcsetattr): Ditto.
|
||||
(fhandler_console::write_normal): Ditto.
|
||||
(fhandler_console::init): Ditto.
|
||||
(fhandler_console::igncr_enabled): Ditto.
|
||||
* fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument.
|
||||
Expect tc() to have been set up first. Use tc() rather than tc.
|
||||
(fhandler_termios::tcsetpgrp): Accomodate change from tc to tc().
|
||||
(fhandler_termios::tcgetpgrp): Ditto.
|
||||
(fhandler_termios::bg_check): Ditto.
|
||||
(fhandler_termios::line_edit: Ditto.
|
||||
(fhandler_tty_master::set_winsize): Ditto.
|
||||
(fhandler_tty_slave::open): Ditto.
|
||||
(fhandler_tty_slave::init): Ditto.
|
||||
(fhandler_pty_master::write): Ditto.
|
||||
(fhandler_pty_master::setup): Ditto. Accommodate change in arguments
|
||||
to tcinit.
|
||||
(fhandler_tty_slave::fch_open_handles): Set _tc directly.
|
||||
(tty_min::is_orphaned_process_group): Don't assume that parent pid
|
||||
exists.
|
||||
* pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were
|
||||
started by a non-Cygwin process but the tty exists.
|
||||
* shared_info.h (console_state): Delete from here.
|
||||
* tty.h: Make multiple inclusion safe.
|
||||
|
||||
2011-05-31 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* exceptions.cc (ctrl_c_handler): Simplify test for no parent tty.
|
||||
|
|
|
@ -1883,13 +1883,15 @@ fhandler_base_overlapped::wait_overlapped (bool inres, bool writing, DWORD *byte
|
|||
debug_printf ("EOF");
|
||||
*bytes = 0;
|
||||
res = overlapped_success;
|
||||
if (writing && err == ERROR_BROKEN_PIPE)
|
||||
raise (SIGPIPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_printf ("res %u, err %u", (unsigned) res, err);
|
||||
*bytes = (DWORD) -1;
|
||||
__seterrno_from_win_error (err);
|
||||
if (writing && (err == ERROR_NO_DATA || err == ERROR_BROKEN_PIPE))
|
||||
if (writing && err == ERROR_NO_DATA)
|
||||
raise (SIGPIPE);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ details. */
|
|||
#ifndef _FHANDLER_H_
|
||||
#define _FHANDLER_H_
|
||||
|
||||
#include "tty.h"
|
||||
/* fcntl flags used only internaly. */
|
||||
#define O_NOSYMLINK 0x080000
|
||||
#define O_DIROPEN 0x100000
|
||||
|
@ -925,7 +926,8 @@ class fhandler_termios: public fhandler_base
|
|||
virtual void doecho (const void *, DWORD) {};
|
||||
virtual int accept_input () {return 1;};
|
||||
public:
|
||||
tty_min *tc;
|
||||
tty_min *_tc;
|
||||
virtual tty_min *tc () const {return _tc; }
|
||||
fhandler_termios () :
|
||||
fhandler_base ()
|
||||
{
|
||||
|
@ -934,9 +936,9 @@ class fhandler_termios: public fhandler_base
|
|||
HANDLE& get_output_handle () { return output_handle; }
|
||||
line_edit_status line_edit (const char *rptr, int nread, termios&);
|
||||
void set_output_handle (HANDLE h) { output_handle = h; }
|
||||
void tcinit (tty_min *this_tc, bool force);
|
||||
void tcinit (bool force);
|
||||
bool is_tty () const { return true; }
|
||||
tty *get_ttyp () { return (tty *) tc; }
|
||||
tty *get_ttyp () { return (tty *) tc (); }
|
||||
void sigflush ();
|
||||
int tcgetpgrp ();
|
||||
int tcsetpgrp (int pid);
|
||||
|
@ -1041,9 +1043,15 @@ class dev_console
|
|||
/* This is a input and output console handle */
|
||||
class fhandler_console: public fhandler_termios
|
||||
{
|
||||
private:
|
||||
public:
|
||||
struct console_state
|
||||
{
|
||||
tty_min tty_min_state;
|
||||
dev_console dev_state;
|
||||
};
|
||||
private:
|
||||
static const unsigned MAX_WRITE_CHARS;
|
||||
static dev_console *dev_state;
|
||||
static console_state *shared_console_info;
|
||||
static bool invisible_console;
|
||||
|
||||
/* Used when we encounter a truncated multi-byte sequence. The
|
||||
|
@ -1075,9 +1083,16 @@ class fhandler_console: public fhandler_termios
|
|||
void set_cursor_maybe ();
|
||||
static bool create_invisible_console (HWINSTA);
|
||||
static bool create_invisible_console_workaround ();
|
||||
static console_state *open_shared_console (HWND, HANDLE&, bool&);
|
||||
tty_min *tc () const {return &(shared_console_info->tty_min_state);}
|
||||
|
||||
public:
|
||||
fhandler_console ();
|
||||
static console_state *open_shared_console (HWND hw, HANDLE& h)
|
||||
{
|
||||
bool createit = false;
|
||||
return open_shared_console (hw, h, createit);
|
||||
}
|
||||
|
||||
fhandler_console* is_console () { return this; }
|
||||
|
||||
|
@ -1098,7 +1113,7 @@ class fhandler_console: public fhandler_termios
|
|||
int ioctl (unsigned int cmd, void *);
|
||||
int init (HANDLE, DWORD, mode_t);
|
||||
bool mouse_aware (MOUSE_EVENT_RECORD& mouse_event);
|
||||
bool focus_aware () {return dev_state->use_focus;}
|
||||
bool focus_aware () {return shared_console_info->dev_state.use_focus;}
|
||||
|
||||
select_record *select_read (select_stuff *);
|
||||
select_record *select_write (select_stuff *);
|
||||
|
@ -1114,6 +1129,7 @@ class fhandler_console: public fhandler_termios
|
|||
static bool need_invisible ();
|
||||
static bool has_a () {return !invisible_console;}
|
||||
size_t size () const { return sizeof (*this);}
|
||||
friend tty_min * tty_list::get_cttyp ();
|
||||
};
|
||||
|
||||
class fhandler_tty_common: public fhandler_termios
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,49 +24,47 @@ details. */
|
|||
/* Common functions shared by tty/console */
|
||||
|
||||
void
|
||||
fhandler_termios::tcinit (tty_min *this_tc, bool is_pty_master)
|
||||
fhandler_termios::tcinit (bool is_pty_master)
|
||||
{
|
||||
/* Initial termios values */
|
||||
|
||||
tc = this_tc;
|
||||
|
||||
if (is_pty_master || !tc->initialized ())
|
||||
if (is_pty_master || !tc ()->initialized ())
|
||||
{
|
||||
tc->ti.c_iflag = BRKINT | ICRNL | IXON;
|
||||
tc->ti.c_oflag = OPOST | ONLCR;
|
||||
tc->ti.c_cflag = B38400 | CS8 | CREAD;
|
||||
tc->ti.c_lflag = ISIG | ICANON | ECHO | IEXTEN;
|
||||
tc ()->ti.c_iflag = BRKINT | ICRNL | IXON;
|
||||
tc ()->ti.c_oflag = OPOST | ONLCR;
|
||||
tc ()->ti.c_cflag = B38400 | CS8 | CREAD;
|
||||
tc ()->ti.c_lflag = ISIG | ICANON | ECHO | IEXTEN;
|
||||
|
||||
tc->ti.c_cc[VDISCARD] = CFLUSH;
|
||||
tc->ti.c_cc[VEOL] = CEOL;
|
||||
tc->ti.c_cc[VEOL2] = CEOL2;
|
||||
tc->ti.c_cc[VEOF] = CEOF;
|
||||
tc->ti.c_cc[VERASE] = CERASE;
|
||||
tc->ti.c_cc[VINTR] = CINTR;
|
||||
tc->ti.c_cc[VKILL] = CKILL;
|
||||
tc->ti.c_cc[VLNEXT] = CLNEXT;
|
||||
tc->ti.c_cc[VMIN] = 1;
|
||||
tc->ti.c_cc[VQUIT] = CQUIT;
|
||||
tc->ti.c_cc[VREPRINT] = CRPRNT;
|
||||
tc->ti.c_cc[VSTART] = CSTART;
|
||||
tc->ti.c_cc[VSTOP] = CSTOP;
|
||||
tc->ti.c_cc[VSUSP] = CSUSP;
|
||||
tc->ti.c_cc[VSWTC] = CSWTCH;
|
||||
tc->ti.c_cc[VTIME] = 0;
|
||||
tc->ti.c_cc[VWERASE] = CWERASE;
|
||||
tc ()->ti.c_cc[VDISCARD] = CFLUSH;
|
||||
tc ()->ti.c_cc[VEOL] = CEOL;
|
||||
tc ()->ti.c_cc[VEOL2] = CEOL2;
|
||||
tc ()->ti.c_cc[VEOF] = CEOF;
|
||||
tc ()->ti.c_cc[VERASE] = CERASE;
|
||||
tc ()->ti.c_cc[VINTR] = CINTR;
|
||||
tc ()->ti.c_cc[VKILL] = CKILL;
|
||||
tc ()->ti.c_cc[VLNEXT] = CLNEXT;
|
||||
tc ()->ti.c_cc[VMIN] = 1;
|
||||
tc ()->ti.c_cc[VQUIT] = CQUIT;
|
||||
tc ()->ti.c_cc[VREPRINT] = CRPRNT;
|
||||
tc ()->ti.c_cc[VSTART] = CSTART;
|
||||
tc ()->ti.c_cc[VSTOP] = CSTOP;
|
||||
tc ()->ti.c_cc[VSUSP] = CSUSP;
|
||||
tc ()->ti.c_cc[VSWTC] = CSWTCH;
|
||||
tc ()->ti.c_cc[VTIME] = 0;
|
||||
tc ()->ti.c_cc[VWERASE] = CWERASE;
|
||||
|
||||
tc->ti.c_ispeed = tc->ti.c_ospeed = B38400;
|
||||
tc->pgid = is_pty_master ? 0 : myself->pgid;
|
||||
tc->initialized (true);
|
||||
tc ()->ti.c_ispeed = tc ()->ti.c_ospeed = B38400;
|
||||
tc ()->pgid = is_pty_master ? 0 : myself->pgid;
|
||||
tc ()->initialized (true);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
fhandler_termios::tcsetpgrp (const pid_t pgid)
|
||||
{
|
||||
termios_printf ("tty %d pgid %d, sid %d, tsid %d", tc->ntty, pgid,
|
||||
myself->sid, tc->getsid ());
|
||||
if (myself->sid != tc->getsid ())
|
||||
termios_printf ("tty %d pgid %d, sid %d, tsid %d", tc ()->ntty, pgid,
|
||||
myself->sid, tc ()->getsid ());
|
||||
if (myself->sid != tc ()->getsid ())
|
||||
{
|
||||
set_errno (EPERM);
|
||||
return -1;
|
||||
|
@ -79,8 +77,8 @@ fhandler_termios::tcsetpgrp (const pid_t pgid)
|
|||
switch (res)
|
||||
{
|
||||
case bg_ok:
|
||||
tc->setpgid (pgid);
|
||||
init_console_handler (tc->gethwnd ());
|
||||
tc ()->setpgid (pgid);
|
||||
init_console_handler (tc ()->gethwnd ());
|
||||
res = 0;
|
||||
break;
|
||||
case bg_signalled:
|
||||
|
@ -100,8 +98,8 @@ fhandler_termios::tcsetpgrp (const pid_t pgid)
|
|||
int
|
||||
fhandler_termios::tcgetpgrp ()
|
||||
{
|
||||
if (myself->ctty != -1 && myself->ctty == tc->ntty)
|
||||
return tc->pgid;
|
||||
if (myself->ctty != -1 && myself->ctty == tc ()->ntty)
|
||||
return tc ()->pgid;
|
||||
set_errno (ENOTTY);
|
||||
return -1;
|
||||
}
|
||||
|
@ -109,27 +107,7 @@ fhandler_termios::tcgetpgrp ()
|
|||
int
|
||||
fhandler_pty_master::tcgetpgrp ()
|
||||
{
|
||||
return tc->pgid;
|
||||
}
|
||||
|
||||
int
|
||||
tty_min::is_orphaned_process_group (int pgid)
|
||||
{
|
||||
/* An orphaned process group is a process group in which the parent
|
||||
of every member is either itself a member of the group or is not
|
||||
a member of the group's session. */
|
||||
winpids pids ((DWORD) PID_MAP_RW);
|
||||
for (unsigned i = 0; i < pids.npids; i++)
|
||||
{
|
||||
_pinfo *p = pids[i];
|
||||
if (!p->exists () || p->pgid != pgid)
|
||||
continue;
|
||||
pinfo ppid (p->ppid);
|
||||
if (ppid->pgid != pgid &&
|
||||
ppid->sid == myself->sid)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return tc ()->pgid;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -154,21 +132,45 @@ tty_min::kill_pgrp (int sig)
|
|||
sig_send (myself, si);
|
||||
}
|
||||
|
||||
int
|
||||
tty_min::is_orphaned_process_group (int pgid)
|
||||
{
|
||||
/* An orphaned process group is a process group in which the parent
|
||||
of every member is either itself a member of the group or is not
|
||||
a member of the group's session. */
|
||||
termios_printf ("checking pgid %d, my sid %d, my parent %d", pgid, myself->sid, myself->ppid);
|
||||
winpids pids ((DWORD) 0);
|
||||
for (unsigned i = 0; i < pids.npids; i++)
|
||||
{
|
||||
_pinfo *p = pids[i];
|
||||
termios_printf ("checking pid %d - has pgid %d\n", p->pid, p->pgid);
|
||||
if (!p || !p->exists () || p->pgid != pgid)
|
||||
continue;
|
||||
pinfo ppid (p->ppid);
|
||||
if (!ppid)
|
||||
continue;
|
||||
termios_printf ("ppid->pgid %d, ppid->sid %d", ppid->pgid, ppid->sid);
|
||||
if (ppid->pgid != pgid && ppid->sid == myself->sid)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
bg_check_types
|
||||
fhandler_termios::bg_check (int sig)
|
||||
{
|
||||
if (!myself->pgid || tc->getpgid () == myself->pgid ||
|
||||
myself->ctty != tc->ntty ||
|
||||
((sig == SIGTTOU) && !(tc->ti.c_lflag & TOSTOP)))
|
||||
if (!myself->pgid || tc ()->getpgid () == myself->pgid ||
|
||||
myself->ctty != tc ()->ntty ||
|
||||
((sig == SIGTTOU) && !(tc ()->ti.c_lflag & TOSTOP)))
|
||||
return bg_ok;
|
||||
|
||||
if (sig < 0)
|
||||
sig = -sig;
|
||||
|
||||
termios_printf ("bg I/O pgid %d, tpgid %d, %s, ntty %s", myself->pgid, tc->getpgid (),
|
||||
myctty (), tc->ttyname ());
|
||||
termios_printf ("bg I/O pgid %d, tpgid %d, %s, ntty %s", myself->pgid, tc ()->getpgid (),
|
||||
myctty (), tc ()->ttyname ());
|
||||
|
||||
if (tc->getsid () == 0)
|
||||
if (tc ()->getsid () == 0)
|
||||
{
|
||||
/* The pty has been closed by the master. Return an EOF
|
||||
indication. FIXME: There is nothing to stop somebody
|
||||
|
@ -188,7 +190,7 @@ fhandler_termios::bg_check (int sig)
|
|||
process is orphaned, in which case we return EIO). */
|
||||
if (sigs_ignored)
|
||||
return bg_ok; /* Just allow the IO */
|
||||
else if ( tc->is_orphaned_process_group (myself->pgid) )
|
||||
else if (tc ()->is_orphaned_process_group (myself->pgid))
|
||||
{
|
||||
termios_printf ("process group is orphaned");
|
||||
set_errno (EIO); /* This is an IO error */
|
||||
|
@ -214,7 +216,7 @@ fhandler_termios::bg_check (int sig)
|
|||
inline void
|
||||
fhandler_termios::echo_erase (int force)
|
||||
{
|
||||
if (force || tc->ti.c_lflag & ECHO)
|
||||
if (force || tc ()->ti.c_lflag & ECHO)
|
||||
doecho ("\b \b", 3);
|
||||
}
|
||||
|
||||
|
@ -269,7 +271,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, termios& ti)
|
|||
|
||||
termios_printf ("got interrupt %d, sending signal %d", c, sig);
|
||||
eat_readahead (-1);
|
||||
tc->kill_pgrp (sig);
|
||||
tc ()->kill_pgrp (sig);
|
||||
ti.c_lflag &= ~FLUSHO;
|
||||
sawsig = true;
|
||||
goto restart_output;
|
||||
|
@ -279,9 +281,9 @@ fhandler_termios::line_edit (const char *rptr, int nread, termios& ti)
|
|||
{
|
||||
if (CCEQ (ti.c_cc[VSTOP], c))
|
||||
{
|
||||
if (!tc->output_stopped)
|
||||
if (!tc ()->output_stopped)
|
||||
{
|
||||
tc->output_stopped = 1;
|
||||
tc ()->output_stopped = 1;
|
||||
acquire_output_mutex (INFINITE);
|
||||
}
|
||||
continue;
|
||||
|
@ -289,11 +291,11 @@ fhandler_termios::line_edit (const char *rptr, int nread, termios& ti)
|
|||
else if (CCEQ (ti.c_cc[VSTART], c))
|
||||
{
|
||||
restart_output:
|
||||
tc->output_stopped = 0;
|
||||
tc ()->output_stopped = 0;
|
||||
release_output_mutex ();
|
||||
continue;
|
||||
}
|
||||
else if ((ti.c_iflag & IXANY) && tc->output_stopped)
|
||||
else if ((ti.c_iflag & IXANY) && tc ()->output_stopped)
|
||||
goto restart_output;
|
||||
}
|
||||
if (iscanon && ti.c_lflag & IEXTEN && CCEQ (ti.c_cc[VDISCARD], c))
|
||||
|
|
|
@ -68,7 +68,7 @@ fhandler_tty_master::set_winsize (bool sendSIGWINCH)
|
|||
console->ioctl (TIOCGWINSZ, &w);
|
||||
get_ttyp ()->winsize = w;
|
||||
if (sendSIGWINCH)
|
||||
tc->kill_pgrp (SIGWINCH);
|
||||
tc ()->kill_pgrp (SIGWINCH);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -493,7 +493,9 @@ fhandler_tty_slave::open (int flags, mode_t)
|
|||
for (HANDLE **h = handles; *h; h++)
|
||||
**h = NULL;
|
||||
|
||||
tcinit (cygwin_shared->tty[get_unit ()], false);
|
||||
_tc = cygwin_shared->tty[get_unit ()];
|
||||
|
||||
tcinit (false);
|
||||
|
||||
cygwin_shared->tty.attach (get_unit ());
|
||||
|
||||
|
@ -716,7 +718,7 @@ fhandler_tty_slave::init (HANDLE h, DWORD a, mode_t)
|
|||
tty process group leader.
|
||||
TODO: Investigate how SIGTTIN should be handled with pure-windows
|
||||
programs. */
|
||||
pinfo p (tc->getpgid ());
|
||||
pinfo p (tc ()->getpgid ());
|
||||
/* We should only grab this when the process group owner for this
|
||||
tty is a non-cygwin process or we've been started directly
|
||||
from a non-Cygwin process with no Cygwin ancestry. */
|
||||
|
@ -724,7 +726,7 @@ fhandler_tty_slave::init (HANDLE h, DWORD a, mode_t)
|
|||
{
|
||||
termios_printf ("Setting process group leader to %d since %W(%d) is not a cygwin process",
|
||||
myself->pgid, p->progname, p->pid);
|
||||
tc->setpgid (myself->pgid);
|
||||
tc ()->setpgid (myself->pgid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1248,7 +1250,7 @@ fhandler_tty_slave::fch_open_handles ()
|
|||
{
|
||||
char buf[MAX_PATH];
|
||||
|
||||
tc = cygwin_shared->tty[get_unit ()];
|
||||
_tc = cygwin_shared->tty[get_unit ()];
|
||||
shared_name (buf, INPUT_AVAILABLE_EVENT, get_unit ());
|
||||
input_available_event = OpenEvent (READ_CONTROL | WRITE_DAC | WRITE_OWNER,
|
||||
TRUE, buf);
|
||||
|
@ -1496,7 +1498,7 @@ fhandler_pty_master::write (const void *ptr, size_t len)
|
|||
{
|
||||
int i;
|
||||
char *p = (char *) ptr;
|
||||
termios ti = tc->ti;
|
||||
termios ti = tc ()->ti;
|
||||
|
||||
bg_check_types bg = bg_check (SIGTTOU);
|
||||
if (bg <= bg_eof)
|
||||
|
@ -1796,8 +1798,9 @@ fhandler_pty_master::setup (bool ispty)
|
|||
SECURITY_ATTRIBUTES sa = { sizeof (SECURITY_ATTRIBUTES), NULL, TRUE };
|
||||
|
||||
tty& t = *cygwin_shared->tty[get_unit ()];
|
||||
_tc = (tty_min *)&t;
|
||||
|
||||
tcinit (&t, true); /* Set termios information. Force initialization. */
|
||||
tcinit (true); /* Set termios information. Force initialization. */
|
||||
|
||||
const char *errstr = NULL;
|
||||
DWORD pipe_mode = PIPE_NOWAIT;
|
||||
|
|
|
@ -403,6 +403,12 @@ _pinfo::set_ctty (tty_min *tc, int flags, fhandler_termios *fh)
|
|||
lock_ttys here;
|
||||
syscall_printf ("attaching %s sid %d, pid %d, pgid %d, tty->pgid %d, tty->sid %d",
|
||||
__ctty (), sid, pid, pgid, tc->getpgid (), tc->getsid ());
|
||||
if (!cygwin_finished_initializing && !myself->cygstarted
|
||||
&& myself->pgid == myself->pid)
|
||||
{
|
||||
myself->pgid = tc->getpgid ();
|
||||
myself->sid = tc->getsid ();
|
||||
}
|
||||
|
||||
pinfo p (tc->getsid ());
|
||||
if (sid == pid && (!p || p->pid == pid || !p->exists ()))
|
||||
|
|
|
@ -79,14 +79,6 @@ void __stdcall shared_destroy ();
|
|||
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
|
||||
system_info.dwAllocationGranularity)))
|
||||
|
||||
#ifdef _FHANDLER_H_
|
||||
struct console_state
|
||||
{
|
||||
tty_min tty_min_state;
|
||||
dev_console dev_state;
|
||||
};
|
||||
#endif
|
||||
|
||||
HANDLE get_shared_parent_dir ();
|
||||
HANDLE get_session_parent_dir ();
|
||||
char *__stdcall shared_name (char *, const char *, int);
|
||||
|
|
|
@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
|
|||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef _TTY_H
|
||||
#define _TTY_H
|
||||
/* tty tables */
|
||||
|
||||
#define INP_BUFFER_SIZE 256
|
||||
|
@ -148,3 +150,4 @@ public:
|
|||
};
|
||||
|
||||
extern "C" int ttyslot (void);
|
||||
#endif /*_TTY_H*/
|
||||
|
|
Loading…
Reference in New Issue