summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_console.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-03-02 18:37:17 +0000
committerChristopher Faylor <me@cgf.cx>2003-03-02 18:37:17 +0000
commit8b19b43d001f7c842147b366211a25edea7cbf1f (patch)
tree29aa73bb038ceaaacdd99d3175040d50990afa0c /winsup/cygwin/fhandler_console.cc
parent3efc65f7df1be5ce066e2da0d6c21f68aec71dbf (diff)
downloadcygnal-8b19b43d001f7c842147b366211a25edea7cbf1f.tar.gz
cygnal-8b19b43d001f7c842147b366211a25edea7cbf1f.tar.bz2
cygnal-8b19b43d001f7c842147b366211a25edea7cbf1f.zip
* dll_init.cc (dll_list::load_after_fork): Don't revert to LoadLibrary if
LoadLibraryEx fails. * dtable.cc (dtable::dec_console_fds): Eliminate. (dtable::release): Don't treat console specially. (dtable::build_fhandler): Ditto. * dtable.h (console_fds): Eliminate. (dtable::dec_console_fds): Eliminate. (dtable::inc_console_fds): Eliminate. * fhandler.h (fhandler_console::open_fhs): New static element. * fhandler_console.cc (fhandler_console::open): Increment open_fs. (fhandler_console::close): Call FreeConsole if no more open consoles and ctty is not associated with the console. * syscalls.cc (setsid): Simplify check for when to call FreeConsole. (check_pty_fds): Eliminate definition. * winsup.h (check_pty_fds): Eliminate declaration.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 3fb91252c..34c1c0da9 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -89,6 +89,8 @@ static console_state NO_COPY *shared_console_info;
dev_console NO_COPY *fhandler_console::dev_state;
+int NO_COPY fhandler_console::open_fhs;
+
/* Allocate and initialize the shared record for the current console.
Returns a pointer to shared_console_info. */
tty_min *
@@ -630,6 +632,8 @@ fhandler_console::open (path_conv *, int flags, mode_t)
TTYCLEARF (RSTCONS);
set_open_status ();
+ open_fhs++;
+ debug_printf ("incremented open_fhs, now %d", open_fhs);
debug_printf ("opened conin$ %p, conout$ %p",
get_io_handle (), get_output_handle ());
@@ -643,6 +647,9 @@ fhandler_console::close (void)
CloseHandle (get_output_handle ());
set_io_handle (NULL);
set_output_handle (NULL);
+ if (--open_fhs <= 0 && myself->ctty != FH_CONSOLE)
+ FreeConsole ();
+ debug_printf ("decremented open_fhs, now %d", open_fhs);
return 0;
}