summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.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/syscalls.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/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc23
1 files changed, 2 insertions, 21 deletions
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);