8273815: move have_special_privileges to os_posix for POSIX platforms

Reviewed-by: mdoerr, stuefe, dholmes
This commit is contained in:
Matthias Baesken 2021-09-20 08:29:12 +00:00
parent 7c9868c0b3
commit dc7f452acb
4 changed files with 6 additions and 39 deletions

View File

@ -267,18 +267,6 @@ julong os::physical_memory() {
return Aix::physical_memory();
}
// Return true if user is running as root.
bool os::have_special_privileges() {
static bool init = false;
static bool privileges = false;
if (!init) {
privileges = (getuid() != geteuid()) || (getgid() != getegid());
init = true;
}
return privileges;
}
// Helper function, emulates disclaim64 using multiple 32bit disclaims
// because we cannot use disclaim64() on AS/400 and old AIX releases.
static bool my_disclaim64(char* addr, size_t size) {

View File

@ -179,20 +179,6 @@ julong os::physical_memory() {
return Bsd::physical_memory();
}
// Return true if user is running as root.
bool os::have_special_privileges() {
static bool init = false;
static bool privileges = false;
if (!init) {
privileges = (getuid() != geteuid()) || (getgid() != getegid());
init = true;
}
return privileges;
}
// Cpu architecture string
#if defined(ZERO)
static char cpu_arch[] = ZERO_LIBARCH;

View File

@ -308,19 +308,6 @@ bool os::Linux::get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu
return true;
}
// Return true if user is running as root.
bool os::have_special_privileges() {
static bool init = false;
static bool privileges = false;
if (!init) {
privileges = (getuid() != geteuid()) || (getgid() != getegid());
init = true;
}
return privileges;
}
#ifndef SYS_gettid
// i386: 224, ia64: 1105, amd64: 186, sparc: 143
#ifdef __ia64__

View File

@ -177,6 +177,12 @@ size_t os::lasterror(char *buf, size_t len) {
return n;
}
// Return true if user is running as root.
bool os::have_special_privileges() {
static bool privileges = (getuid() != geteuid()) || (getgid() != getegid());
return privileges;
}
void os::wait_for_keypress_at_exit(void) {
// don't do anything on posix platforms
return;