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

Martin Doerr mdoerr at openjdk.java.net
Fri Sep 17 15:24:43 UTC 2021


On Fri, 17 Sep 2021 14:57:37 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> 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;
>> }
>
> Hi Thomas, thanks for the hint - I adjusted the coding.
> Best regards, Matthias

A static bool which gets evaluated on every call makes no sense!

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

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


More information about the hotspot-runtime-dev mailing list