Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2022-03-07 12:51:40 +01:00
parent bf6940a413
commit 974163bc18
3 changed files with 9 additions and 63 deletions

View 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);
}

View 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);

View 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)