summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_tty.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-03-04 04:07:34 +0000
committerChristopher Faylor <me@cgf.cx>2003-03-04 04:07:34 +0000
commitc418817ed89c9b3812cdc396f8d51ae285161ce3 (patch)
treec83bdf3f3fbd4895dfa2e5c361412e5371ca35da /winsup/cygwin/fhandler_tty.cc
parentb99f1bf031b874856e9becbc8c86f1bec8fa01ee (diff)
downloadcygnal-c418817ed89c9b3812cdc396f8d51ae285161ce3.tar.gz
cygnal-c418817ed89c9b3812cdc396f8d51ae285161ce3.tar.bz2
cygnal-c418817ed89c9b3812cdc396f8d51ae285161ce3.zip
* fhandler.h (fhandler_tty_slave::close): Declare new function.
(fhandler_tty_slave::dup): Declare new function. (fhandler_tty_slave::fixup_after_function): Declare new function. * fhandler_tty.cc (fhandler_tty_slave_open): Only increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::close): Define new function. Decrement fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::dup): Define new function. Increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::fixup_after_fork): Define new function. Increment fhandler_console::open_fhs when associated with a pty.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc40
1 files changed, 38 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 0aef7afaf..678849a01 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -552,13 +552,28 @@ fhandler_tty_slave::open (path_conv *, int flags, mode_t)
set_output_handle (to_master_local);
set_open_status ();
- fhandler_console::open_fhs++;
+ if (!output_done_event)
+ {
+ fhandler_console::open_fhs++;
+ termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs);
+ }
termios_printf ("tty%d opened", ttynum);
return 1;
}
int
+fhandler_tty_slave::close ()
+{
+ if (!output_done_event)
+ {
+ fhandler_console::open_fhs--;
+ termios_printf ("decremeted open_fhs %d", fhandler_console::open_fhs);
+ }
+ return fhandler_tty_common::close ();
+}
+
+int
fhandler_tty_slave::cygserver_attach_tty (LPHANDLE from_master_ptr,
LPHANDLE to_master_ptr)
{
@@ -815,6 +830,17 @@ fhandler_tty_slave::read (void *ptr, size_t& len)
}
int
+fhandler_tty_slave::dup (fhandler_base *child)
+{
+ if (!output_done_event)
+ {
+ fhandler_console::open_fhs++;
+ termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs);
+ }
+ return fhandler_tty_common::dup (child);
+}
+
+int
fhandler_tty_common::dup (fhandler_base *child)
{
fhandler_tty_slave *fts = (fhandler_tty_slave *) child;
@@ -1058,7 +1084,6 @@ fhandler_tty_common::close ()
termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
inuse = NULL;
- fhandler_console::open_fhs++;
termios_printf ("tty%d <%p,%p> closed", ttynum, get_handle (), get_output_handle ());
return 0;
}
@@ -1203,6 +1228,17 @@ fhandler_tty_common::set_close_on_exec (int val)
}
void
+fhandler_tty_slave::fixup_after_fork (HANDLE parent)
+{
+ if (!output_done_event)
+ {
+ fhandler_console::open_fhs++;
+ termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs);
+ }
+ fhandler_tty_common::fixup_after_fork (parent);
+}
+
+void
fhandler_tty_common::fixup_after_fork (HANDLE parent)
{
fhandler_termios::fixup_after_fork (parent);