From bb8216a1140d53534247949ee29c48bc158f3d13 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 2 Apr 2011 11:30:27 +0000 Subject: [PATCH] * autoload.cc (GetExtendedTcpTable): Remove. (GetTcpTable): Remove. (CharNextExA): Remove. (FindWindowA): Remove. (ShowWindowAsync): Remove. * dcrt0.cc (disable_dep): Remove unused function. (dll_crt0_0): Drop comment babbling about TS & DEP. * fhandler_socket.cc (address_in_use): Remove unused function. * wincap.cc: Throughout, drop ts_has_dep_problem from wincaps. (wincapc::init): Drop code setting ts_has_dep_problem flag. * wincap.h (struct wincaps): Drop ts_has_dep_problem flags and method. --- winsup/cygwin/ChangeLog | 14 +++++++ winsup/cygwin/autoload.cc | 5 --- winsup/cygwin/dcrt0.cc | 53 ------------------------- winsup/cygwin/fhandler_socket.cc | 68 -------------------------------- winsup/cygwin/wincap.cc | 18 +-------- winsup/cygwin/wincap.h | 2 - 6 files changed, 15 insertions(+), 145 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 09aeb6529..32a569829 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,17 @@ +2011-04-02 Corinna Vinschen + + * autoload.cc (GetExtendedTcpTable): Remove. + (GetTcpTable): Remove. + (CharNextExA): Remove. + (FindWindowA): Remove. + (ShowWindowAsync): Remove. + * dcrt0.cc (disable_dep): Remove unused function. + (dll_crt0_0): Drop comment babbling about TS & DEP. + * fhandler_socket.cc (address_in_use): Remove unused function. + * wincap.cc: Throughout, drop ts_has_dep_problem from wincaps. + (wincapc::init): Drop code setting ts_has_dep_problem flag. + * wincap.h (struct wincaps): Drop ts_has_dep_problem flags and method. + 2011-04-01 Yaakov Selkowitz Implement /proc/sysvipc/* diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index d683cd8ed..b57079d7f 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -388,12 +388,10 @@ LoadDLLfuncEx (DnsRecordListFree, 8, dnsapi, 1) // 50 = ERROR_NOT_SUPPORTED. Returned if OS doesn't support iphlpapi funcs LoadDLLfuncEx2 (GetAdaptersAddresses, 20, iphlpapi, 1, 50) -LoadDLLfuncEx2 (GetExtendedTcpTable, 24, iphlpapi, 1, 50) LoadDLLfunc (GetIfEntry, 4, iphlpapi) LoadDLLfunc (GetIpAddrTable, 12, iphlpapi) LoadDLLfunc (GetIpForwardTable, 12, iphlpapi) LoadDLLfunc (GetNetworkParams, 8, iphlpapi) -LoadDLLfunc (GetTcpTable, 12, iphlpapi) LoadDLLfunc (GetUdpTable, 12, iphlpapi) LoadDLLfuncEx (AttachConsole, 4, kernel32, 1) @@ -448,7 +446,6 @@ LoadDLLfuncEx2 (LsaRegisterLogonProcess, 12, secur32, 1, 127) LoadDLLfunc (SHGetDesktopFolder, 4, shell32) -LoadDLLfunc (CharNextExA, 12, user32) LoadDLLfunc (CloseClipboard, 0, user32) LoadDLLfunc (CloseDesktop, 4, user32) LoadDLLfunc (CloseWindowStation, 4, user32) @@ -458,7 +455,6 @@ LoadDLLfunc (CreateWindowStationW, 16, user32) LoadDLLfunc (DefWindowProcA, 16, user32) LoadDLLfunc (DispatchMessageA, 4, user32) LoadDLLfunc (EmptyClipboard, 0, user32) -LoadDLLfunc (FindWindowA, 8, user32) LoadDLLfunc (GetClipboardData, 4, user32) LoadDLLfunc (GetForegroundWindow, 0, user32) LoadDLLfunc (GetKeyboardLayout, 4, user32) @@ -482,7 +478,6 @@ LoadDLLfunc (SetClipboardData, 8, user32) LoadDLLfunc (SetParent, 8, user32) LoadDLLfunc (SetProcessWindowStation, 4, user32) LoadDLLfunc (SetThreadDesktop, 4, user32) -LoadDLLfunc (ShowWindowAsync, 8, user32) LoadDLLfuncEx3 (waveInAddBuffer, 12, winmm, 1, 0, 1) LoadDLLfuncEx3 (waveInClose, 4, winmm, 1, 0, 1) diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index ad6b62b8f..827441c33 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -650,36 +650,6 @@ child_info_spawn::handle_spawn () fixup_lockf_after_exec (); } -#if 0 -/* Setting the TS-aware flag in the application's PE header is sufficient. - Just keep this in as a reminder. */ - -static DEP_SYSTEM_POLICY_TYPE dep_system_policy = (DEP_SYSTEM_POLICY_TYPE) -1; - -static void -disable_dep () -{ - DWORD ppolicy; - BOOL perm; - - if (dep_system_policy < 0) - { - dep_system_policy = GetSystemDEPPolicy (); - debug_printf ("DEP System Policy: %d", (int) dep_system_policy); - } - if (dep_system_policy < OptIn) - return; - if (!GetProcessDEPPolicy (GetCurrentProcess (), &ppolicy, &perm)) - { - debug_printf ("GetProcessDEPPolicy: %E"); - return; - } - debug_printf ("DEP Process Policy: %d (permanent = %d)", ppolicy, perm); - if (ppolicy > 0 && !perm && !SetProcessDEPPolicy (0)) - debug_printf ("SetProcessDEPPolicy: %E"); -} -#endif - /* Retrieve and store system directory for later use. Note that the directory is stored with a trailing backslash! */ static void @@ -748,29 +718,6 @@ dll_crt0_0 () events_init (); tty_list::init_session (); -#if 0 - /* Setting the TS-aware flag in the application's PE header is sufficient. - Just keep this in as a reminder. */ - - /* The disable_dep function disables DEP for all Cygwin processes if - the process runs on a Windows Server 2008 with Terminal Services - installed. This combination (TS+DEP) breaks *some* Cygwin - applications. The Terminal Service specific DLL tsappcmp.dll - changes the page protection of some pages in the application's text - segment from PAGE_EXECUTE_WRITECOPY to PAGE_WRITECOPY for no - apparent reason. This occurs before any Cygwin or applicaton code - had a chance to run. MS has no explanation for this so far, but is - rather busy trying to avoid giving support for this problem (as of - 2008-11-11). - - Unfortunately disabling DEP seems to have a not negligible - performance hit. In the long run, either MS has to fix their - problem, or we have to find a better workaround, if any exists. - Idle idea: Adding EXECUTE protection to all text segment pages? */ - if (wincap.ts_has_dep_problem ()) - disable_dep (); -#endif - _main_tls = &_my_tls; /* Initialize signal processing here, early, in the hopes that the creation diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index b5eab051d..0a7c5ddf4 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -872,74 +872,6 @@ fhandler_socket::link (const char *newpath) return fhandler_base::link (newpath); } -#if 0 -/* This function doesn't work correctly. It has been called in bind to check - if a local address is still in use, but it disables to bind in the - SO_REUSEADDR case even if only an accepted socket is still using the - local address, and even if said accepted socket is already in CLOSE_WAIT. - I keep this function in the code for later reference only. */ -static inline bool -address_in_use (const struct sockaddr *addr) -{ - switch (addr->sa_family) - { - case AF_INET: - { - PMIB_TCPTABLE tab; - PMIB_TCPROW entry; - DWORD size = 0, i; - struct sockaddr_in *in = (struct sockaddr_in *) addr; - - if (GetTcpTable (NULL, &size, FALSE) == ERROR_INSUFFICIENT_BUFFER) - { - tab = (PMIB_TCPTABLE) alloca (size += 16 * sizeof (PMIB_TCPROW)); - if (!GetTcpTable (tab, &size, FALSE)) - for (i = tab->dwNumEntries, entry = tab->table; i > 0; - --i, ++entry) - if (entry->dwLocalAddr == in->sin_addr.s_addr - && entry->dwLocalPort == in->sin_port - && entry->dwState >= MIB_TCP_STATE_LISTEN - && entry->dwState <= MIB_TCP_STATE_LAST_ACK) - return true; - } - } - break; - case AF_INET6: - { - /* This test works on XP SP2 and above which should cover almost - all IPv6 users... */ - PMIB_TCP6TABLE_OWNER_PID tab; - PMIB_TCP6ROW_OWNER_PID entry; - DWORD size = 0, i; - struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) addr; - - if (GetExtendedTcpTable (NULL, &size, FALSE, AF_INET6, - TCP_TABLE_OWNER_PID_ALL, 0) - == ERROR_INSUFFICIENT_BUFFER) - { - tab = (PMIB_TCP6TABLE_OWNER_PID) - alloca (size += 16 * sizeof (PMIB_TCP6ROW_OWNER_PID)); - if (!GetExtendedTcpTable (tab, &size, FALSE, AF_INET6, - TCP_TABLE_OWNER_PID_ALL, 0)) - for (i = tab->dwNumEntries, entry = tab->table; i > 0; - --i, ++entry) - if (IN6_ARE_ADDR_EQUAL (entry->ucLocalAddr, - in6->sin6_addr.s6_addr) - /* FIXME: Is testing for the scope required. too?!? */ - && entry->dwLocalPort == in6->sin6_port - && entry->dwState >= MIB_TCP_STATE_LISTEN - && entry->dwState <= MIB_TCP_STATE_LAST_ACK) - return true; - } - } - break; - default: - break; - } - return false; -} -#endif - int fhandler_socket::bind (const struct sockaddr *name, int namelen) { diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index cc9cb0258..ed15214a6 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -49,7 +49,6 @@ wincaps wincap_nt4sp4 __attribute__((section (".cygwin_dll_common"), shared)) = supports_all_posix_ai_flags:false, has_restricted_stack_args:false, has_transactions:false, - ts_has_dep_problem:false, has_recvmsg:false, has_sendmsg:false, has_broken_udf:false, @@ -92,7 +91,6 @@ wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = { supports_all_posix_ai_flags:false, has_restricted_stack_args:false, has_transactions:false, - ts_has_dep_problem:false, has_recvmsg:false, has_sendmsg:false, has_broken_udf:true, @@ -135,7 +133,6 @@ wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) = supports_all_posix_ai_flags:false, has_restricted_stack_args:false, has_transactions:false, - ts_has_dep_problem:false, has_recvmsg:false, has_sendmsg:false, has_broken_udf:true, @@ -178,7 +175,6 @@ wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = { supports_all_posix_ai_flags:false, has_restricted_stack_args:false, has_transactions:false, - ts_has_dep_problem:false, has_recvmsg:true, has_sendmsg:false, has_broken_udf:true, @@ -221,7 +217,6 @@ wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = { supports_all_posix_ai_flags:false, has_restricted_stack_args:false, has_transactions:false, - ts_has_dep_problem:false, has_recvmsg:true, has_sendmsg:false, has_broken_udf:true, @@ -264,7 +259,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = { supports_all_posix_ai_flags:false, has_restricted_stack_args:false, has_transactions:false, - ts_has_dep_problem:false, has_recvmsg:true, has_sendmsg:false, has_broken_udf:true, @@ -307,7 +301,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { supports_all_posix_ai_flags:false, has_restricted_stack_args:true, has_transactions:false, - ts_has_dep_problem:false, has_recvmsg:true, has_sendmsg:false, has_broken_udf:true, @@ -350,7 +343,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { supports_all_posix_ai_flags:true, has_restricted_stack_args:false, has_transactions:true, - ts_has_dep_problem:false, has_recvmsg:true, has_sendmsg:true, has_broken_udf:false, @@ -393,7 +385,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { supports_all_posix_ai_flags:true, has_restricted_stack_args:false, has_transactions:true, - ts_has_dep_problem:false, has_recvmsg:true, has_sendmsg:true, has_broken_udf:false, @@ -494,14 +485,7 @@ wincapc::init () } if (has_osversioninfoex && version.wProductType != VER_NT_WORKSTATION) - { - ((wincaps *)caps)->is_server = true; - if (version.dwMajorVersion >= 6 - && (version.wSuiteMask - & (VER_SUITE_TERMINAL | VER_SUITE_SINGLEUSERTS)) - == VER_SUITE_TERMINAL) - ((wincaps *)caps)->ts_has_dep_problem = true; - } + ((wincaps *)caps)->is_server = true; if (NT_SUCCESS (NtQueryInformationProcess (NtCurrentProcess (), ProcessWow64Information, &wow64, sizeof wow64, NULL)) diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index af86b1020..2144032b1 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -39,7 +39,6 @@ struct wincaps unsigned supports_all_posix_ai_flags : 1; unsigned has_restricted_stack_args : 1; unsigned has_transactions : 1; - unsigned ts_has_dep_problem : 1; unsigned has_recvmsg : 1; unsigned has_sendmsg : 1; unsigned has_broken_udf : 1; @@ -98,7 +97,6 @@ public: bool IMPLEMENT (supports_all_posix_ai_flags) bool IMPLEMENT (has_restricted_stack_args) bool IMPLEMENT (has_transactions) - bool IMPLEMENT (ts_has_dep_problem) bool IMPLEMENT (has_recvmsg) bool IMPLEMENT (has_sendmsg) bool IMPLEMENT (has_broken_udf)