Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8273815: move have_special_privileges to os_posix for POSIX platforms #5540

Closed
wants to merge 2 commits into from

Conversation

MBaesken
Copy link
Member

@MBaesken MBaesken commented Sep 16, 2021

We have identical have_special_privileges() for Linux/AIX/BSD so the function is a good candidate to be moved to os_posix.

Thanks, Matthias


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8273815: move have_special_privileges to os_posix for POSIX platforms

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5540/head:pull/5540
$ git checkout pull/5540

Update a local copy of the PR:
$ git checkout pull/5540
$ git pull https://git.openjdk.java.net/jdk pull/5540/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5540

View PR using the GUI difftool:
$ git pr show -t 5540

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5540.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 16, 2021

👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Sep 16, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 16, 2021

@MBaesken The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-runtime label Sep 16, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 16, 2021

Webrevs

@openjdk
Copy link

@openjdk openjdk bot commented Sep 17, 2021

@MBaesken This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8273815: move have_special_privileges to os_posix for POSIX platforms

Reviewed-by: mdoerr, stuefe, dholmes

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 33 new commits pushed to the master branch:

  • 7c9868c: 8273454: C2: Transform (-a)(-b) into ab
  • bb9d142: 8273958: gtest/MetaspaceGtests executes unnecessary tests in debug builds
  • 2a2e919: 8273685: Remove jtreg tag manual=yesno for java/awt/Graphics/LCDTextAndGraphicsState.java & show test instruction
  • 8302061: 8273774: CDSPluginTest should only expect classes_nocoops.jsa exists on supported 64-bit platforms
  • 2f8c221: 8273681: Add Vector API vs Arrays.mismatch intrinsic benchmark
  • 17f7a45: 8273913: Problem list some headful client jtreg tests that fail on macOS 12
  • 27d747a: 8273877: os::unsetenv unused
  • 35f6f1d: 8273808: Cleanup AddFontsToX11FontPath
  • 1890d85: 8273872: ZGC: Explicitly use 2M large pages
  • 54b4567: 8273880: Zero: Print warnings when unsupported intrinsics are enabled
  • ... and 23 more: https://git.openjdk.java.net/jdk/compare/a3ca770227065aecc2df9f9c711687fd8ec5d34e...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Sep 17, 2021
@MBaesken
Copy link
Member Author

@MBaesken MBaesken commented Sep 17, 2021

Hi Martin, thanks for the approval !
Best regards, Matthias

Copy link
Member

@tstuefe tstuefe left a comment

Looks good. Proposal for shorter code inline (if you take it, I need no re-review).

Cheers, Thomas

init = true;
}
return privileges;
}
Copy link
Member

@tstuefe tstuefe Sep 17, 2021

Choose a reason for hiding this comment

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

Could be shortened to:

bool os::have_special_privileges() {
  static bool privileges = (getuid() != geteuid()) || (getgid() != getegid());
  return privileges;
}

Copy link
Member Author

@MBaesken MBaesken Sep 17, 2021

Choose a reason for hiding this comment

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

Hi Thomas, thanks for the hint - I adjusted the coding.
Best regards, Matthias

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr Sep 17, 2021

Choose a reason for hiding this comment

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

A static bool which gets evaluated on every call makes no sense! Oh, wait! I think it's ok. I was only wondering why privileges should get initialized when have_special_privileges() is called for the first time and not during static initialization of the class. But it's at least equivalent to what we had before.

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Forget my comment. Still good.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

As an equivalent refactoring this is fine.

We could also do the initialization is os::init() but it makes little, if any difference.

Thanks,
David

@MBaesken
Copy link
Member Author

@MBaesken MBaesken commented Sep 20, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Sep 20, 2021

Going to push as commit dc7f452.
Since your change was applied there have been 33 commits pushed to the master branch:

  • 7c9868c: 8273454: C2: Transform (-a)(-b) into ab
  • bb9d142: 8273958: gtest/MetaspaceGtests executes unnecessary tests in debug builds
  • 2a2e919: 8273685: Remove jtreg tag manual=yesno for java/awt/Graphics/LCDTextAndGraphicsState.java & show test instruction
  • 8302061: 8273774: CDSPluginTest should only expect classes_nocoops.jsa exists on supported 64-bit platforms
  • 2f8c221: 8273681: Add Vector API vs Arrays.mismatch intrinsic benchmark
  • 17f7a45: 8273913: Problem list some headful client jtreg tests that fail on macOS 12
  • 27d747a: 8273877: os::unsetenv unused
  • 35f6f1d: 8273808: Cleanup AddFontsToX11FontPath
  • 1890d85: 8273872: ZGC: Explicitly use 2M large pages
  • 54b4567: 8273880: Zero: Print warnings when unsupported intrinsics are enabled
  • ... and 23 more: https://git.openjdk.java.net/jdk/compare/a3ca770227065aecc2df9f9c711687fd8ec5d34e...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 20, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 20, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 20, 2021

@MBaesken Pushed as commit dc7f452.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime integrated
4 participants