]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code
authorCorinna Vinschen <corinna@vinschen.de>
Mon, 7 Mar 2022 11:51:40 +0000 (12:51 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 12 May 2022 20:00:25 +0000 (22:00 +0200)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/net.cc
winsup/cygwin/wincap.cc
winsup/cygwin/wincap.h

index 2209f4bde469dbefb3afa9a2ef5284d189dac8d1..36e2923b45152fe619d1dd341de7d60fc35243df 100644 (file)
@@ -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);
 }
 
index e67778c2c8bf1e07ac76772507e6521180d5104d..835497cfe99be1bc436495b09efd19c46d3479bf 100644 (file)
@@ -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);
index 6b5723aa5485c52fd971fadb1f3db87120ac3ae4..8184e7151d437fbd62aefd25ea78423ee36fbd9f 100644 (file)
@@ -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)
This page took 0.038554 seconds and 5 git commands to generate.