* 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.
This commit is contained in:
Christopher Faylor
2003-03-02 18:37:17 +00:00
parent 3efc65f7df
commit 8b19b43d00
8 changed files with 30 additions and 48 deletions

View File

@@ -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);