8211106: [windows] Update OS detection code to recognize Windows Server 2019
Reviewed-by: alanb, clanger, bobv
This commit is contained in:
parent
1b34ea35c9
commit
e552242db6
@ -1688,7 +1688,13 @@ void os::win32::print_windows_version(outputStream* st) {
|
|||||||
if (is_workstation) {
|
if (is_workstation) {
|
||||||
st->print("10");
|
st->print("10");
|
||||||
} else {
|
} else {
|
||||||
st->print("Server 2016");
|
// distinguish Windows Server 2016 and 2019 by build number
|
||||||
|
// Windows server 2019 GA 10/2018 build number is 17763
|
||||||
|
if (build_number > 17762) {
|
||||||
|
st->print("Server 2019");
|
||||||
|
} else {
|
||||||
|
st->print("Server 2016");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -359,6 +359,7 @@ GetJavaProperties(JNIEnv* env)
|
|||||||
static java_props_t sprops = {0};
|
static java_props_t sprops = {0};
|
||||||
int majorVersion;
|
int majorVersion;
|
||||||
int minorVersion;
|
int minorVersion;
|
||||||
|
int buildNumber = 0;
|
||||||
|
|
||||||
if (sprops.line_separator) {
|
if (sprops.line_separator) {
|
||||||
return &sprops;
|
return &sprops;
|
||||||
@ -398,6 +399,8 @@ GetJavaProperties(JNIEnv* env)
|
|||||||
GetVersionEx((OSVERSIONINFO *) &ver);
|
GetVersionEx((OSVERSIONINFO *) &ver);
|
||||||
majorVersion = ver.dwMajorVersion;
|
majorVersion = ver.dwMajorVersion;
|
||||||
minorVersion = ver.dwMinorVersion;
|
minorVersion = ver.dwMinorVersion;
|
||||||
|
/* distinguish Windows Server 2016 and 2019 by build number */
|
||||||
|
buildNumber = ver.dwBuildNumber;
|
||||||
is_workstation = (ver.wProductType == VER_NT_WORKSTATION);
|
is_workstation = (ver.wProductType == VER_NT_WORKSTATION);
|
||||||
platformId = ver.dwPlatformId;
|
platformId = ver.dwPlatformId;
|
||||||
sprops.patch_level = _strdup(ver.szCSDVersion);
|
sprops.patch_level = _strdup(ver.szCSDVersion);
|
||||||
@ -448,6 +451,7 @@ GetJavaProperties(JNIEnv* env)
|
|||||||
}
|
}
|
||||||
majorVersion = HIWORD(file_info->dwProductVersionMS);
|
majorVersion = HIWORD(file_info->dwProductVersionMS);
|
||||||
minorVersion = LOWORD(file_info->dwProductVersionMS);
|
minorVersion = LOWORD(file_info->dwProductVersionMS);
|
||||||
|
buildNumber = HIWORD(file_info->dwProductVersionLS);
|
||||||
free(version_info);
|
free(version_info);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
@ -478,6 +482,8 @@ GetJavaProperties(JNIEnv* env)
|
|||||||
* Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION)
|
* Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION)
|
||||||
* Windows 10 10 0 (VER_NT_WORKSTATION)
|
* Windows 10 10 0 (VER_NT_WORKSTATION)
|
||||||
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
|
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
|
||||||
|
* Windows Server 2019 10 0 (!VER_NT_WORKSTATION)
|
||||||
|
* where (buildNumber > 17762)
|
||||||
*
|
*
|
||||||
* This mapping will presumably be augmented as new Windows
|
* This mapping will presumably be augmented as new Windows
|
||||||
* versions are released.
|
* versions are released.
|
||||||
@ -551,7 +557,14 @@ GetJavaProperties(JNIEnv* env)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (minorVersion) {
|
switch (minorVersion) {
|
||||||
case 0: sprops.os_name = "Windows Server 2016"; break;
|
case 0:
|
||||||
|
/* Windows server 2019 GA 10/2018 build number is 17763 */
|
||||||
|
if (buildNumber > 17762) {
|
||||||
|
sprops.os_name = "Windows Server 2019";
|
||||||
|
} else {
|
||||||
|
sprops.os_name = "Windows Server 2016";
|
||||||
|
}
|
||||||
|
break;
|
||||||
default: sprops.os_name = "Windows NT (unknown)";
|
default: sprops.os_name = "Windows NT (unknown)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user