public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code
@ 2022-05-13 12:39 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-05-13 12:39 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=974163bc187ed7dfd0e6054491d967a5acb047db

commit 974163bc187ed7dfd0e6054491d967a5acb047db
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Mar 7 12:51:40 2022 +0100

    Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/net.cc    | 55 ++++++++-----------------------------------------
 winsup/cygwin/wincap.cc | 15 --------------
 winsup/cygwin/wincap.h  |  2 --
 3 files changed, 9 insertions(+), 63 deletions(-)

diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 2209f4bde..36e2923b4 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -1440,26 +1440,20 @@ cygwin_send (int fd, const void *buf, size_t len, int flags)
 
 /* Fill out an ifconf struct. */
 
-struct gaa_wa {
-  ULONG family;
-  PIP_ADAPTER_ADDRESSES *pa_ret;
-};
-
-DWORD WINAPI
-call_gaa (LPVOID param)
+bool
+get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa_ret, ULONG family)
 {
   DWORD ret, size = 0;
-  gaa_wa *p = (gaa_wa *) param;
   PIP_ADAPTER_ADDRESSES pa0 = NULL;
 
-  if (!p->pa_ret)
-    return GetAdaptersAddresses (p->family, GAA_FLAG_INCLUDE_PREFIX
-					    | GAA_FLAG_INCLUDE_ALL_INTERFACES,
+  if (!pa_ret)
+    return GetAdaptersAddresses (family, GAA_FLAG_INCLUDE_PREFIX
+					 | GAA_FLAG_INCLUDE_ALL_INTERFACES,
 				 NULL, NULL, &size);
   do
     {
-      ret = GetAdaptersAddresses (p->family, GAA_FLAG_INCLUDE_PREFIX
-					     | GAA_FLAG_INCLUDE_ALL_INTERFACES,
+      ret = GetAdaptersAddresses (family, GAA_FLAG_INCLUDE_PREFIX
+					  | GAA_FLAG_INCLUDE_ALL_INTERFACES,
 				  NULL, pa0, &size);
       if (ret == ERROR_BUFFER_OVERFLOW
 	  && !(pa0 = (PIP_ADAPTER_ADDRESSES) realloc (pa0, size)))
@@ -1471,42 +1465,11 @@ call_gaa (LPVOID param)
       if (ret != ERROR_SUCCESS)
 	{
 	  free (pa0);
-	  *p->pa_ret = NULL;
+	  *pa_ret = NULL;
 	}
       else
-	*p->pa_ret = pa0;
+	*pa_ret = pa0;
     }
-  return ret;
-}
-
-bool
-get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa_ret, ULONG family)
-{
-  DWORD ret;
-  gaa_wa param = { family, pa_ret };
-
-  if (wincap.has_gaa_largeaddress_bug ()
-      && (uintptr_t) &param >= (uintptr_t) 0x80000000L)
-    {
-      /* In Windows 7 under WOW64, GetAdaptersAddresses fails if it's running
-	 in a thread with a stack located in the large address area.  If we're
-	 running in a pthread with such a stack, we call GetAdaptersAddresses
-	 in a child thread with an OS-allocated stack.  The OS allocates stacks
-	 bottom up, so chances are good that the new stack will be located in
-	 the lower address area. */
-      HANDLE thr = CreateThread (NULL, 0, call_gaa, &param, 0, NULL);
-      SetThreadName (GetThreadId (thr), "__call_gaa");
-      if (!thr)
-	{
-	  debug_printf ("CreateThread: %E");
-	  return false;
-	}
-      WaitForSingleObject (thr, INFINITE);
-      GetExitCodeThread (thr, &ret);
-      CloseHandle (thr);
-    }
-  else
-    ret = call_gaa (&param);
   return ret == ERROR_SUCCESS || (!pa_ret && ret == ERROR_BUFFER_OVERFLOW);
 }
 
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index e67778c2c..835497cfe 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -24,7 +24,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
   {
     is_server:false,
     needs_query_information:true,
-    has_gaa_largeaddress_bug:true,
     has_precise_system_time:false,
     has_microsoft_accounts:false,
     has_new_pebteb_region:false,
@@ -54,7 +53,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
   {
     is_server:false,
     needs_query_information:true,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
@@ -84,7 +82,6 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
@@ -114,7 +111,6 @@ wincaps  wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
@@ -144,7 +140,6 @@ wincaps  wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared))
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:false,
@@ -174,7 +169,6 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
@@ -204,7 +198,6 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
@@ -234,7 +227,6 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
@@ -264,7 +256,6 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
@@ -294,7 +285,6 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
@@ -324,7 +314,6 @@ wincaps wincap_10_2004 __attribute__((section (".cygwin_dll_common"), shared)) =
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
@@ -354,7 +343,6 @@ wincaps wincap_11 __attribute__((section (".cygwin_dll_common"), shared)) = {
   {
     is_server:false,
     needs_query_information:false,
-    has_gaa_largeaddress_bug:false,
     has_precise_system_time:true,
     has_microsoft_accounts:true,
     has_new_pebteb_region:true,
@@ -436,9 +424,6 @@ wincapc::init ()
     }
 
   ((wincaps *)caps)->is_server = (version.wProductType != VER_NT_WORKSTATION);
-    {
-      ((wincaps *)caps)->has_gaa_largeaddress_bug = false;
-    }
 
   __small_sprintf (osnam, "NT-%d.%d", version.dwMajorVersion,
 		   version.dwMinorVersion);
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index 6b5723aa5..8184e7151 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -18,7 +18,6 @@ struct wincaps
   struct  __attribute__ ((aligned (8))) {
     unsigned is_server						: 1;
     unsigned needs_query_information				: 1;
-    unsigned has_gaa_largeaddress_bug				: 1;
     unsigned has_precise_system_time				: 1;
     unsigned has_microsoft_accounts				: 1;
     unsigned has_new_pebteb_region				: 1;
@@ -78,7 +77,6 @@ public:
 #endif
   bool  IMPLEMENT (is_server)
   bool	IMPLEMENT (needs_query_information)
-  bool	IMPLEMENT (has_gaa_largeaddress_bug)
   bool	IMPLEMENT (has_precise_system_time)
   bool	IMPLEMENT (has_microsoft_accounts)
   bool	IMPLEMENT (has_new_pebteb_region)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-13 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 12:39 [newlib-cygwin] Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).