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

Thomas Stuefe stuefe at openjdk.java.net
Fri Sep 17 12:49:45 UTC 2021


On Thu, 16 Sep 2021 07:20:39 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> 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

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

Cheers, Thomas

src/hotspot/os/posix/os_posix.cpp line 195:

> 193:   }
> 194:   return privileges;
> 195: }

Could be shortened to:

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

-------------

Marked as reviewed by stuefe (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5540


More information about the hotspot-runtime-dev mailing list