From 8b19b43d001f7c842147b366211a25edea7cbf1f Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 2 Mar 2003 18:37:17 +0000 Subject: * 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. --- winsup/cygwin/syscalls.cc | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'winsup/cygwin/syscalls.cc') diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8121c89ee..453de8c3e 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -77,23 +77,6 @@ close_all_files (void) cygwin_shared->delqueue.process_queue (); } -BOOL __stdcall -check_pty_fds (void) -{ - int res = FALSE; - SetResourceLock (LOCK_FD_LIST, WRITE_LOCK, "check_pty_fds"); - fhandler_base *fh; - for (int i = 0; i < (int) cygheap->fdtab.size; i++) - if ((fh = cygheap->fdtab[i]) != NULL && - (fh->get_device () == FH_TTYS || fh->get_device () == FH_PTYM)) - { - res = TRUE; - break; - } - ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK, "check_pty_fds"); - return res; -} - int dup (int fd) { @@ -302,11 +285,9 @@ setsid (void) if (myself->pgid != myself->pid) { - if (myself->ctty == TTY_CONSOLE - && !cygheap->fdtab.has_console_fds () - && !check_pty_fds ()) - FreeConsole (); myself->ctty = -1; + if (fhandler_console::open_fhs <= 0) + FreeConsole (); myself->sid = getpid (); myself->pgid = getpid (); syscall_printf ("sid %d, pgid %d, ctty %d", myself->sid, myself->pgid, myself->ctty); -- cgit v1.2.3