* fhandler.cc (fhandler_base::fixup_after_exec): Declare here.
* fhandler.h (fhandler_base::fixup_after_exec): Make non-inline. (fhandler_termios::fixup_after_fork): Delete declaration. (fhandler_termios::fixup_after_exec): Ditto. (fhandler_tty_common::inuse): Remove. (fhandler_tty_common::dup): Delete declaration. (fhandler_tty_common::fixup_after_fork): Ditto. (fhandler_tty_slave::fixup_after_exec): Declare new function. (fhandler_pty_master::dwProcessId): New variable. (fhandler_pty_master::from_master): Ditto. (fhandler_pty_master::to_master): Ditto. (fhandler_pty_master::setup): New function. (fhandler_pty_master::fixup_after_fork): Ditto. (fhandler_pty_master::fixup_after_exec): Ditto. * fhandler_termios.cc (fhandler_termios::fixup_after_exec): Delete definition. (fhandler_termios::fixup_after_fork): Ditto. * fhandler_tty.cc (fhandler_tty_master::init): Use fhandler_pty_master setup function rather than obsolete tty::common_init. Delete obsolete inuse setting. (fhandler_tty_slave::fhandler_tty_slave): Set inuse to NULL here. (fhandler_tty_slave::open): Change debugging output for clarity. Check for different things when doing a sanity check on the tty. Reflect the fact that master_pid now is the cygwin pid rather than the windows pid. Use "arch" rather than "archetype" for consistency. (fhandler_tty_slave::close): Close inuse here. (fhandler_tty_slave::dup): Remove old if 0'ed code. (fhandler_pty_master::dup): New function. Handles pty master archetype. (fhandler_pty_master::fhandler_pty_master): Zero pty_master specific fields. (fhandler_pty_master::open): Implement using archetypes, similar to slave. Use fhandler_pty_master setup function rather than obsolete tty::common_init. Don't set inuse. (fhandler_tty_common::close): Don't deal with inuse. Delete old if 0'ed code. (fhandler_pty_master::close): Implement using archetypes. Close from_master and to_master. (fhandler_tty_common::set_close_on_exec): Just set close_on_exec flag here since everything uses archetypes now. (fhandler_tty_common::fixup_after_fork): Delete definition. (fhandler_tty_slave::fixup_after_exec): Define new function. (fhandler_pty_master::setup): New function, derived from tty::common_init. (fhandler_pty_master::fixup_after_fork): New function. (shared_info.h): Reset SHARED_INFO_CB to reflect new tty size. * tty.cc (tty_list::terminate): Close individual handles from tty_master. (tty::master_alive): Delete. (tty::make_pipes): Ditto. (tty::common_init): Ditto. * tty.h (tty::from_slave): Delete. (tty::to_slave): Ditto. (tty::common_init): Delete declaration. (tty::make_pipes): Ditto. (tty::master_pid): Define as pid_t since it is now a cygwin pid.
This commit is contained in:
@@ -208,7 +208,7 @@ class fhandler_base
|
||||
|
||||
virtual void fixup_before_fork_exec (DWORD) {}
|
||||
virtual void fixup_after_fork (HANDLE);
|
||||
virtual void fixup_after_exec () {}
|
||||
virtual void fixup_after_exec ();
|
||||
void create_read_state (LONG n)
|
||||
{
|
||||
read_state = CreateSemaphore (&sec_none_nih, 0, n, NULL);
|
||||
@@ -785,8 +785,6 @@ class fhandler_termios: public fhandler_base
|
||||
bg_check_types bg_check (int sig);
|
||||
virtual DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms) {return 1;}
|
||||
virtual void __release_output_mutex (const char *fn, int ln) {}
|
||||
void fixup_after_fork (HANDLE);
|
||||
void fixup_after_exec ();
|
||||
void echo_erase (int force = 0);
|
||||
virtual _off64_t lseek (_off64_t, int);
|
||||
};
|
||||
@@ -938,7 +936,7 @@ class fhandler_tty_common: public fhandler_termios
|
||||
fhandler_tty_common ()
|
||||
: fhandler_termios (), output_done_event (NULL),
|
||||
ioctl_request_event (NULL), ioctl_done_event (NULL), output_mutex (NULL),
|
||||
input_mutex (NULL), input_available_event (NULL), inuse (NULL)
|
||||
input_mutex (NULL), input_available_event (NULL)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
@@ -950,19 +948,15 @@ class fhandler_tty_common: public fhandler_termios
|
||||
// Ioctl() status in tty::ioctl_retval.
|
||||
HANDLE output_mutex, input_mutex;
|
||||
HANDLE input_available_event;
|
||||
HANDLE inuse; // used to indicate that a tty is in use
|
||||
|
||||
DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms);
|
||||
void __release_output_mutex (const char *fn, int ln);
|
||||
|
||||
virtual int dup (fhandler_base *child);
|
||||
|
||||
tty *get_ttyp () { return (tty *) tc; }
|
||||
|
||||
int close ();
|
||||
_off64_t lseek (_off64_t, int);
|
||||
void set_close_on_exec (bool val);
|
||||
void fixup_after_fork (HANDLE parent);
|
||||
select_record *select_read (select_record *s);
|
||||
select_record *select_write (select_record *s);
|
||||
select_record *select_except (select_record *s);
|
||||
@@ -971,6 +965,7 @@ class fhandler_tty_common: public fhandler_termios
|
||||
|
||||
class fhandler_tty_slave: public fhandler_tty_common
|
||||
{
|
||||
HANDLE inuse; // used to indicate that a tty is in use
|
||||
public:
|
||||
/* Constructor */
|
||||
fhandler_tty_slave ();
|
||||
@@ -987,6 +982,7 @@ class fhandler_tty_slave: public fhandler_tty_common
|
||||
int close ();
|
||||
int dup (fhandler_base *child);
|
||||
void fixup_after_fork (HANDLE parent);
|
||||
void fixup_after_exec ();
|
||||
|
||||
select_record *select_read (select_record *s);
|
||||
int cygserver_attach_tty (HANDLE*, HANDLE*);
|
||||
@@ -1001,6 +997,7 @@ protected:
|
||||
device slave; // device type of slave
|
||||
public:
|
||||
int need_nl; // Next read should start with \n
|
||||
DWORD dwProcessId; // Owner of master handles
|
||||
|
||||
/* Constructor */
|
||||
fhandler_pty_master ();
|
||||
@@ -1020,9 +1017,13 @@ public:
|
||||
|
||||
char *ptsname ();
|
||||
|
||||
void set_close_on_exec (bool val);
|
||||
HANDLE from_master, to_master;
|
||||
bool hit_eof ();
|
||||
int get_unit () const { return slave.minor; }
|
||||
bool setup (tty&);
|
||||
int dup (fhandler_base *);
|
||||
void fixup_after_fork (HANDLE parent);
|
||||
void fixup_after_exec ();
|
||||
};
|
||||
|
||||
class fhandler_tty_master: public fhandler_pty_master
|
||||
|
Reference in New Issue
Block a user