Skip to content
Permalink
Browse files
8273229: Update OS detection code to recognize Windows Server 2022
Reviewed-by: alanb, dholmes
  • Loading branch information
MBaesken committed Sep 2, 2021
1 parent 0c1b16b commit c2e015c3c1a2274112bb8e6671a85bc7fb624fde
Showing 2 changed files with 14 additions and 5 deletions.
@@ -1866,9 +1866,13 @@ void os::win32::print_windows_version(outputStream* st) {
if (is_workstation) {
st->print("10");
} else {
// distinguish Windows Server 2016 and 2019 by build number
// Windows server 2019 GA 10/2018 build number is 17763
if (build_number > 17762) {
// distinguish Windows Server by build number
// - 2016 GA 10/2016 build: 14393
// - 2019 GA 11/2018 build: 17763
// - 2022 GA 08/2021 build: 20348
if (build_number > 20347) {
st->print("Server 2022");
} else if (build_number > 17762) {
st->print("Server 2019");
} else {
st->print("Server 2016");
@@ -389,7 +389,7 @@ GetJavaProperties(JNIEnv* env)
GetVersionEx((OSVERSIONINFO *) &ver);
majorVersion = ver.dwMajorVersion;
minorVersion = ver.dwMinorVersion;
/* distinguish Windows Server 2016 and 2019 by build number */
/* distinguish Windows Server 2016+ by build number */
buildNumber = ver.dwBuildNumber;
is_workstation = (ver.wProductType == VER_NT_WORKSTATION);
platformId = ver.dwPlatformId;
@@ -474,6 +474,8 @@ GetJavaProperties(JNIEnv* env)
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
* Windows Server 2019 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 17762)
* Windows Server 2022 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 20347)
*
* This mapping will presumably be augmented as new Windows
* versions are released.
@@ -549,7 +551,10 @@ GetJavaProperties(JNIEnv* env)
switch (minorVersion) {
case 0:
/* Windows server 2019 GA 10/2018 build number is 17763 */
if (buildNumber > 17762) {
/* Windows server 2022 build number is 20348 */
if (buildNumber > 20347) {
sprops.os_name = "Windows Server 2022";
} else if (buildNumber > 17676) {
sprops.os_name = "Windows Server 2019";
} else {
sprops.os_name = "Windows Server 2016";

5 comments on commit c2e015c

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on c2e015c Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr
Copy link
Contributor

@TheRealMDoerr TheRealMDoerr commented on c2e015c Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on c2e015c Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-c2e015c3 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit c2e015c3 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 2 Sep 2021 and was reviewed by Alan Bateman and David Holmes.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-c2e015c3:TheRealMDoerr-backport-c2e015c3
$ git checkout TheRealMDoerr-backport-c2e015c3
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-c2e015c3

@RealCLanger
Copy link
Contributor

@RealCLanger RealCLanger commented on c2e015c Oct 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u

@openjdk
Copy link

@openjdk openjdk bot commented on c2e015c Oct 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealCLanger the backport was successfully created on the branch RealCLanger-backport-c2e015c3 in my personal fork of openjdk/jdk17u. To create a pull request with this backport targeting openjdk/jdk17u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit c2e015c3 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 2 Sep 2021 and was reviewed by Alan Bateman and David Holmes.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u:

$ git fetch https://github.com/openjdk-bots/jdk17u RealCLanger-backport-c2e015c3:RealCLanger-backport-c2e015c3
$ git checkout RealCLanger-backport-c2e015c3
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u RealCLanger-backport-c2e015c3

Please sign in to comment.