Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-01-22 01:54:05 +0300
committerCorinna Vinschen <corinna@vinschen.de>2007-01-22 01:54:05 +0300
commitbff438913761968193960dc32b1db372ebe509ee (patch)
treeea2cb2770237834082201c46df2fdd9108b0562b /winsup/cygwin/wincap.cc
parentf89533c1ffb2ff780ad8e678a1cd9c7e6035725f (diff)
* autoload.cc (WSAIoctl): Define.
(SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
Diffstat (limited to 'winsup/cygwin/wincap.cc')
-rw-r--r--winsup/cygwin/wincap.cc42
1 files changed, 18 insertions, 24 deletions
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index d9aa59093..7e9f71069 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -722,7 +722,7 @@ static NO_COPY wincaps wincap_xp = {
needs_logon_sid_in_sid_list:false,
needs_count_in_si_lpres2:false,
has_recycle_dot_bin:false,
- has_gaa_prefixes:false,
+ has_gaa_prefixes:true,
has_gaa_on_link_prefix:false,
};
@@ -862,15 +862,21 @@ void
wincapc::init ()
{
const char *os;
- bool has_osversioninfoex = false;
+ bool has_osversioninfoex = true;
if (caps)
return; // already initialized
memset (&version, 0, sizeof version);
- /* Request simple version info first. */
- version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&version));
+ /* Request versionex info first, which is available on all systems since
+ NT4 SP6 anyway. If that fails, call the simple version. */
+ version.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
+ if (!GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&version)))
+ {
+ has_osversioninfoex = false;
+ version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+ GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&version));
+ }
switch (version.dwPlatformId)
{
@@ -883,18 +889,14 @@ wincapc::init ()
break;
case 4:
os = "NT";
- if (strcmp (version.szCSDVersion, "Service Pack 4") < 0)
+ if (!has_osversioninfoex
+ && strcmp (version.szCSDVersion, "Service Pack 4") < 0)
caps = &wincap_nt4;
else
- {
- caps = &wincap_nt4sp4;
- if (strcmp (version.szCSDVersion, "Service Pack 6") >= 0)
- has_osversioninfoex = true;
- }
+ caps = &wincap_nt4sp4;
break;
case 5:
os = "NT";
- has_osversioninfoex = true;
switch (version.dwMinorVersion)
{
case 0:
@@ -903,8 +905,8 @@ wincapc::init ()
case 1:
caps = &wincap_xp;
- if (strcmp (version.szCSDVersion, "Service Pack 1") >= 0)
- ((wincaps *)this->caps)->has_gaa_prefixes = true;
+ if (version.wServicePackMajor < 1)
+ ((wincaps *)this->caps)->has_gaa_prefixes = false;
break;
default:
@@ -913,7 +915,6 @@ wincapc::init ()
break;
case 6:
os = "NT";
- has_osversioninfoex = true;
caps = &wincap_vista;
break;
default:
@@ -955,15 +956,8 @@ wincapc::init ()
break;
}
- if (has_osversioninfoex)
- {
- /* Request extended version to get server info.
- Available since NT4 SP6. */
- version.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
- GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&version));
- if (version.wProductType != VER_NT_WORKSTATION)
- ((wincaps *)this->caps)->is_server = true;
- }
+ if (has_osversioninfoex && version.wProductType != VER_NT_WORKSTATION)
+ ((wincaps *)this->caps)->is_server = true;
BOOL is_wow64_proc = FALSE;
if (IsWow64Process (GetCurrentProcess (), &is_wow64_proc))