* autoload.cc (load_wsock32): Declare dummy function to force loading of

winsock.
* fhandler.cc (fhandler_base::set_inheritance): Make debugging output more
verbose.
* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Force loading of
winsock32 if winsock2 not available.
* net.cc (set_socket_inheritance): Use DuplicateHandle in all cases to set
inheritance correctly.
(fdsock): Use winsock2_active macro to determine when to set socket
inheritance.  Remove fdtab resource locking since this function should already
be protected.
(cygwin_accept): Simplify logic.  Ensure that fdtab unlock is not called
inappropriately.
(cygwin_rcmd): Use fdtab locking.
(cygwin_rresvport): Ditto.
(cygwin_rexec): Ditto.
* select.cc (peek_socket): Set errno appropriately if winsock select fails.
* winsup.h: Declare check_pty_fds.
* syscalls.cc (check_pty_fds): Rename from check_ttys_fds.  Also check pty
master.
(setsid): Use check_pty_fds.
* dtable.cc (dtable::dec_console_fds): Add check on pty fds.
This commit is contained in:
Christopher Faylor
2001-10-14 04:14:24 +00:00
parent 0476bae576
commit 611d92e24c
9 changed files with 74 additions and 42 deletions

View File

@@ -65,19 +65,20 @@ close_all_files (void)
cygwin_shared->delqueue.process_queue ();
}
static BOOL __stdcall
check_ttys_fds (void)
BOOL __stdcall
check_pty_fds (void)
{
int res = FALSE;
SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "close_all_files");
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)
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 | READ_LOCK, "close_all_files");
ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK, "check_pty_fds");
return res;
}
@@ -270,7 +271,7 @@ setsid (void)
{
if (myself->ctty == TTY_CONSOLE &&
!cygheap->fdtab.has_console_fds () &&
!check_ttys_fds ())
!check_pty_fds ())
FreeConsole ();
myself->ctty = -1;
myself->sid = _getpid ();