Skip to content
Permalink
Browse files
8273815: move have_special_privileges to os_posix for POSIX platforms
Reviewed-by: mdoerr, stuefe, dholmes
  • Loading branch information
MBaesken committed Sep 20, 2021
1 parent 7c9868c commit dc7f452acbe3afa5aa6e31d316bd5e669c86d6f6
Showing 4 changed files with 6 additions and 39 deletions.
@@ -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) {
@@ -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;
@@ -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__
@@ -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;

1 comment on commit dc7f452

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on dc7f452 Sep 20, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.