Skip to content

Commit dc7f452

Browse files
committed
8273815: move have_special_privileges to os_posix for POSIX platforms
Reviewed-by: mdoerr, stuefe, dholmes
1 parent 7c9868c commit dc7f452

File tree

4 files changed

+6
-39
lines changed

4 files changed

+6
-39
lines changed

src/hotspot/os/aix/os_aix.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,6 @@ julong os::physical_memory() {
267267
return Aix::physical_memory();
268268
}
269269

270-
// Return true if user is running as root.
271-
272-
bool os::have_special_privileges() {
273-
static bool init = false;
274-
static bool privileges = false;
275-
if (!init) {
276-
privileges = (getuid() != geteuid()) || (getgid() != getegid());
277-
init = true;
278-
}
279-
return privileges;
280-
}
281-
282270
// Helper function, emulates disclaim64 using multiple 32bit disclaims
283271
// because we cannot use disclaim64() on AS/400 and old AIX releases.
284272
static bool my_disclaim64(char* addr, size_t size) {

src/hotspot/os/bsd/os_bsd.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,6 @@ julong os::physical_memory() {
179179
return Bsd::physical_memory();
180180
}
181181

182-
// Return true if user is running as root.
183-
184-
bool os::have_special_privileges() {
185-
static bool init = false;
186-
static bool privileges = false;
187-
if (!init) {
188-
privileges = (getuid() != geteuid()) || (getgid() != getegid());
189-
init = true;
190-
}
191-
return privileges;
192-
}
193-
194-
195-
196182
// Cpu architecture string
197183
#if defined(ZERO)
198184
static char cpu_arch[] = ZERO_LIBARCH;

src/hotspot/os/linux/os_linux.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -308,19 +308,6 @@ bool os::Linux::get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu
308308
return true;
309309
}
310310

311-
// Return true if user is running as root.
312-
313-
bool os::have_special_privileges() {
314-
static bool init = false;
315-
static bool privileges = false;
316-
if (!init) {
317-
privileges = (getuid() != geteuid()) || (getgid() != getegid());
318-
init = true;
319-
}
320-
return privileges;
321-
}
322-
323-
324311
#ifndef SYS_gettid
325312
// i386: 224, ia64: 1105, amd64: 186, sparc: 143
326313
#ifdef __ia64__

src/hotspot/os/posix/os_posix.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ size_t os::lasterror(char *buf, size_t len) {
177177
return n;
178178
}
179179

180+
// Return true if user is running as root.
181+
bool os::have_special_privileges() {
182+
static bool privileges = (getuid() != geteuid()) || (getgid() != getegid());
183+
return privileges;
184+
}
185+
180186
void os::wait_for_keypress_at_exit(void) {
181187
// don't do anything on posix platforms
182188
return;

0 commit comments

Comments
 (0)