* fhandler.h (class fhandler_socket): Remove prot_info_ptr.

(fhandler_socket::fixup_before_fork_exec): Remove.
	(fhandler_socket::fixup_after_exec): Remove.
	(fhandler_socket::need_fixup_before): Remove.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Drop
	initializing prot_info_ptr.  Remove unused code.
	(fhandler_socket::~fhandler_socket): Drop free'ing prot_info_ptr.
	(struct wsa_event): Rename connect_errorcode to errorcode.
	(fhandler_socket::evaluate_events): Handle FD_CLOSE error condition
	as FD_CONNECT error condition, except, never reset an FD_CLOSE error
	condition.  Always set FD_WRITE after successfully recorded FD_CONNECT.
	(fhandler_socket::fixup_before_fork_exec): Remove.
	(fhandler_socket::fixup_after_fork): Revert to using handle duplication.
	(fhandler_socket::fixup_after_exec): Remove.
	(fhandler_socket::dup): Revert to using handle duplication.
	(fhandler_socket::send_internal): Only call wait_for_events in case
	of WSAEWOULDBLOCK condition.
	(fhandler_socket::set_close_on_exec): Call
	fhandler_base::set_close_on_exec.
	* net.cc (fdsock): Just set socket to inheritable on non-NT.  Don't
	call inc_need_fixup_before.
	* select.cc (peek_socket): Don't set except_ready on every FD_CLOSE,
	just on error.
This commit is contained in:
Corinna Vinschen
2006-07-27 09:11:38 +00:00
parent 40f67ea198
commit 9869e006f3
5 changed files with 58 additions and 128 deletions

View File

@@ -501,14 +501,16 @@ cygwin_getprotobynumber (int number)
bool
fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
{
if (wincap.has_set_handle_information ())
/* NT systems apparently set sockets to inheritable by default */
if (!wincap.has_set_handle_information ()
&& !DuplicateHandle (hMainProc, (HANDLE) soc,
hMainProc, (HANDLE *) &soc,
0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
{
/* NT systems apparently set sockets to inheritable by default */
SetHandleInformation ((HANDLE) soc, HANDLE_FLAG_INHERIT, 0);
debug_printf ("reset socket inheritance");
debug_printf ("set socket inheritance failed, %E");
return false;
}
else
debug_printf ("not setting socket inheritance");
fd = build_fh_dev (*dev);
if (!fd.isopen ())
return false;
@@ -517,7 +519,6 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
return false;
fd->set_flags (O_RDWR | O_BINARY);
fd->uninterruptible_io (true);
cygheap->fdtab.inc_need_fixup_before ();
debug_printf ("fd %d, name '%s', soc %p", (int) fd, dev->name, soc);
#if 0
/* Same default buffer sizes as on Linux (instead of WinSock default 8K).