Merge
This commit is contained in:
commit
d55d5e2440
@ -84,7 +84,11 @@ public class SAGetopt {
|
||||
}
|
||||
else {
|
||||
// Mixed style options --file name
|
||||
extractOptarg(ca[0]);
|
||||
try {
|
||||
extractOptarg(ca[0]);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new RuntimeException("Argument is expected for '" + ca[0] + "'");
|
||||
}
|
||||
}
|
||||
|
||||
return ca[0];
|
||||
|
@ -111,18 +111,53 @@ public class SALauncher {
|
||||
return launcherHelp();
|
||||
}
|
||||
|
||||
private static void buildAttachArgs(ArrayList<String> newArgs,
|
||||
String pid, String exe, String core) {
|
||||
if ((pid == null) && (exe == null)) {
|
||||
throw new IllegalArgumentException(
|
||||
"You have to set --pid or --exe.");
|
||||
}
|
||||
|
||||
if (pid != null) { // Attach to live process
|
||||
if (exe != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unnecessary argument: --exe");
|
||||
} else if (core != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unnecessary argument: --core");
|
||||
} else if (!pid.matches("^\\d+$")) {
|
||||
throw new IllegalArgumentException("Invalid pid: " + pid);
|
||||
}
|
||||
|
||||
newArgs.add(pid);
|
||||
} else {
|
||||
if (exe.length() == 0) {
|
||||
throw new IllegalArgumentException("You have to set --exe.");
|
||||
}
|
||||
|
||||
newArgs.add(exe);
|
||||
|
||||
if ((core == null) || (core.length() == 0)) {
|
||||
throw new IllegalArgumentException("You have to set --core.");
|
||||
}
|
||||
|
||||
newArgs.add(core);
|
||||
}
|
||||
}
|
||||
|
||||
private static void runCLHSDB(String[] oldArgs) {
|
||||
SAGetopt sg = new SAGetopt(oldArgs);
|
||||
String[] longOpts = {"exe=", "core=", "pid="};
|
||||
|
||||
ArrayList<String> newArgs = new ArrayList();
|
||||
String exeORpid = null;
|
||||
String pid = null;
|
||||
String exe = null;
|
||||
String core = null;
|
||||
String s = null;
|
||||
|
||||
while((s = sg.next(null, longOpts)) != null) {
|
||||
if (s.equals("exe")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
exe = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("core")) {
|
||||
@ -130,17 +165,12 @@ public class SALauncher {
|
||||
continue;
|
||||
}
|
||||
if (s.equals("pid")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
pid = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (exeORpid != null) {
|
||||
newArgs.add(exeORpid);
|
||||
if (core != null) {
|
||||
newArgs.add(core);
|
||||
}
|
||||
}
|
||||
buildAttachArgs(newArgs, pid, exe, core);
|
||||
CLHSDB.main(newArgs.toArray(new String[newArgs.size()]));
|
||||
}
|
||||
|
||||
@ -149,13 +179,14 @@ public class SALauncher {
|
||||
String[] longOpts = {"exe=", "core=", "pid="};
|
||||
|
||||
ArrayList<String> newArgs = new ArrayList();
|
||||
String exeORpid = null;
|
||||
String pid = null;
|
||||
String exe = null;
|
||||
String core = null;
|
||||
String s = null;
|
||||
|
||||
while((s = sg.next(null, longOpts)) != null) {
|
||||
if (s.equals("exe")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
exe = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("core")) {
|
||||
@ -163,17 +194,12 @@ public class SALauncher {
|
||||
continue;
|
||||
}
|
||||
if (s.equals("pid")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
pid = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (exeORpid != null) {
|
||||
newArgs.add(exeORpid);
|
||||
if (core != null) {
|
||||
newArgs.add(core);
|
||||
}
|
||||
}
|
||||
buildAttachArgs(newArgs, pid, exe, core);
|
||||
HSDB.main(newArgs.toArray(new String[newArgs.size()]));
|
||||
}
|
||||
|
||||
@ -183,13 +209,14 @@ public class SALauncher {
|
||||
"mixed", "locks"};
|
||||
|
||||
ArrayList<String> newArgs = new ArrayList();
|
||||
String exeORpid = null;
|
||||
String pid = null;
|
||||
String exe = null;
|
||||
String core = null;
|
||||
String s = null;
|
||||
|
||||
while((s = sg.next(null, longOpts)) != null) {
|
||||
if (s.equals("exe")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
exe = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("core")) {
|
||||
@ -197,7 +224,7 @@ public class SALauncher {
|
||||
continue;
|
||||
}
|
||||
if (s.equals("pid")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
pid = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("mixed")) {
|
||||
@ -210,13 +237,7 @@ public class SALauncher {
|
||||
}
|
||||
}
|
||||
|
||||
if (exeORpid != null) {
|
||||
newArgs.add(exeORpid);
|
||||
if (core != null) {
|
||||
newArgs.add(core);
|
||||
}
|
||||
}
|
||||
|
||||
buildAttachArgs(newArgs, pid, exe, core);
|
||||
JStack.main(newArgs.toArray(new String[newArgs.size()]));
|
||||
}
|
||||
|
||||
@ -226,13 +247,14 @@ public class SALauncher {
|
||||
"heap", "binaryheap", "histo", "clstats", "finalizerinfo"};
|
||||
|
||||
ArrayList<String> newArgs = new ArrayList();
|
||||
String exeORpid = null;
|
||||
String pid = null;
|
||||
String exe = null;
|
||||
String core = null;
|
||||
String s = null;
|
||||
|
||||
while((s = sg.next(null, longOpts)) != null) {
|
||||
if (s.equals("exe")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
exe = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("core")) {
|
||||
@ -240,7 +262,7 @@ public class SALauncher {
|
||||
continue;
|
||||
}
|
||||
if (s.equals("pid")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
pid = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("heap")) {
|
||||
@ -265,13 +287,7 @@ public class SALauncher {
|
||||
}
|
||||
}
|
||||
|
||||
if (exeORpid != null) {
|
||||
newArgs.add(exeORpid);
|
||||
if (core != null) {
|
||||
newArgs.add(core);
|
||||
}
|
||||
}
|
||||
|
||||
buildAttachArgs(newArgs, pid, exe, core);
|
||||
JMap.main(newArgs.toArray(new String[newArgs.size()]));
|
||||
}
|
||||
|
||||
@ -281,13 +297,14 @@ public class SALauncher {
|
||||
"flags", "sysprops"};
|
||||
|
||||
ArrayList<String> newArgs = new ArrayList();
|
||||
String exeORpid = null;
|
||||
String exe = null;
|
||||
String pid = null;
|
||||
String core = null;
|
||||
String s = null;
|
||||
|
||||
while((s = sg.next(null, longOpts)) != null) {
|
||||
if (s.equals("exe")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
exe = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("core")) {
|
||||
@ -295,7 +312,7 @@ public class SALauncher {
|
||||
continue;
|
||||
}
|
||||
if (s.equals("pid")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
pid = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("flags")) {
|
||||
@ -308,13 +325,7 @@ public class SALauncher {
|
||||
}
|
||||
}
|
||||
|
||||
if (exeORpid != null) {
|
||||
newArgs.add(exeORpid);
|
||||
if (core != null) {
|
||||
newArgs.add(core);
|
||||
}
|
||||
}
|
||||
|
||||
buildAttachArgs(newArgs, pid, exe, core);
|
||||
JInfo.main(newArgs.toArray(new String[newArgs.size()]));
|
||||
}
|
||||
|
||||
@ -323,13 +334,14 @@ public class SALauncher {
|
||||
String[] longOpts = {"exe=", "core=", "pid="};
|
||||
|
||||
ArrayList<String> newArgs = new ArrayList();
|
||||
String exeORpid = null;
|
||||
String exe = null;
|
||||
String pid = null;
|
||||
String core = null;
|
||||
String s = null;
|
||||
|
||||
while((s = sg.next(null, longOpts)) != null) {
|
||||
if (s.equals("exe")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
exe = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
if (s.equals("core")) {
|
||||
@ -337,18 +349,12 @@ public class SALauncher {
|
||||
continue;
|
||||
}
|
||||
if (s.equals("pid")) {
|
||||
exeORpid = sg.getOptarg();
|
||||
pid = sg.getOptarg();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (exeORpid != null) {
|
||||
newArgs.add(exeORpid);
|
||||
if (core != null) {
|
||||
newArgs.add(core);
|
||||
}
|
||||
}
|
||||
|
||||
buildAttachArgs(newArgs, pid, exe, core);
|
||||
JSnap.main(newArgs.toArray(new String[newArgs.size()]));
|
||||
}
|
||||
|
||||
@ -373,36 +379,43 @@ public class SALauncher {
|
||||
|
||||
String[] oldArgs = Arrays.copyOfRange(args, 1, args.length);
|
||||
|
||||
// Run SA interactive mode
|
||||
if (args[0].equals("clhsdb")) {
|
||||
runCLHSDB(oldArgs);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Run SA interactive mode
|
||||
if (args[0].equals("clhsdb")) {
|
||||
runCLHSDB(oldArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equals("hsdb")) {
|
||||
runHSDB(oldArgs);
|
||||
return;
|
||||
}
|
||||
if (args[0].equals("hsdb")) {
|
||||
runHSDB(oldArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
// Run SA tmtools mode
|
||||
if (args[0].equals("jstack")) {
|
||||
runJSTACK(oldArgs);
|
||||
return;
|
||||
}
|
||||
// Run SA tmtools mode
|
||||
if (args[0].equals("jstack")) {
|
||||
runJSTACK(oldArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equals("jmap")) {
|
||||
runJMAP(oldArgs);
|
||||
return;
|
||||
}
|
||||
if (args[0].equals("jmap")) {
|
||||
runJMAP(oldArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equals("jinfo")) {
|
||||
runJINFO(oldArgs);
|
||||
return;
|
||||
}
|
||||
if (args[0].equals("jinfo")) {
|
||||
runJINFO(oldArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equals("jsnap")) {
|
||||
runJSNAP(oldArgs);
|
||||
return;
|
||||
if (args[0].equals("jsnap")) {
|
||||
runJSNAP(oldArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Unknown tool: " + args[0]);
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
toolHelp(args[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public enum GCCause {
|
||||
_gc_locker ("GCLocker Initiated GC"),
|
||||
_heap_inspection ("Heap Inspection Initiated GC"),
|
||||
_heap_dump ("Heap Dump Initiated GC"),
|
||||
_wb_young_gc ("WhiteBox Initiated Young GC"),
|
||||
_wb_conc_mark ("WhiteBox Initiated Concurrent Mark"),
|
||||
_update_allocation_context_stats_inc ("Update Allocation Context Stats"),
|
||||
_update_allocation_context_stats_full ("Update Allocation Context Stats"),
|
||||
|
||||
_no_gc ("No GC"),
|
||||
_no_cause_specified ("Unknown GCCause"),
|
||||
@ -56,6 +60,9 @@ public enum GCCause {
|
||||
_g1_humongous_allocation ("G1 Humongous Allocation"),
|
||||
|
||||
_last_ditch_collection ("Last ditch collection"),
|
||||
|
||||
_dcmd_gc_run ("Diagnostic Command"),
|
||||
|
||||
_last_gc_cause ("ILLEGAL VALUE - last gc cause - ILLEGAL VALUE");
|
||||
|
||||
private final String value;
|
||||
|
@ -910,8 +910,8 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
|
||||
log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
|
||||
(uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
} else {
|
||||
log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
|
||||
strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
log_warning(os, thread)("Failed to start thread - pthread_create failed (%d=%s) for attributes: %s.",
|
||||
ret, os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
@ -1178,7 +1178,7 @@ void os::die() {
|
||||
size_t os::lasterror(char *buf, size_t len) {
|
||||
if (errno == 0) return 0;
|
||||
|
||||
const char *s = ::strerror(errno);
|
||||
const char *s = os::strerror(errno);
|
||||
size_t n = ::strlen(s);
|
||||
if (n >= len) {
|
||||
n = len - 1;
|
||||
@ -1714,14 +1714,14 @@ static void local_sem_post() {
|
||||
if (os::Aix::on_aix()) {
|
||||
int rc = ::sem_post(&sig_sem);
|
||||
if (rc == -1 && !warn_only_once) {
|
||||
trcVerbose("sem_post failed (errno = %d, %s)", errno, strerror(errno));
|
||||
trcVerbose("sem_post failed (errno = %d, %s)", errno, os::errno_name(errno));
|
||||
warn_only_once = true;
|
||||
}
|
||||
} else {
|
||||
guarantee0(p_sig_msem != NULL);
|
||||
int rc = ::msem_unlock(p_sig_msem, 0);
|
||||
if (rc == -1 && !warn_only_once) {
|
||||
trcVerbose("msem_unlock failed (errno = %d, %s)", errno, strerror(errno));
|
||||
trcVerbose("msem_unlock failed (errno = %d, %s)", errno, os::errno_name(errno));
|
||||
warn_only_once = true;
|
||||
}
|
||||
}
|
||||
@ -1732,14 +1732,14 @@ static void local_sem_wait() {
|
||||
if (os::Aix::on_aix()) {
|
||||
int rc = ::sem_wait(&sig_sem);
|
||||
if (rc == -1 && !warn_only_once) {
|
||||
trcVerbose("sem_wait failed (errno = %d, %s)", errno, strerror(errno));
|
||||
trcVerbose("sem_wait failed (errno = %d, %s)", errno, os::errno_name(errno));
|
||||
warn_only_once = true;
|
||||
}
|
||||
} else {
|
||||
guarantee0(p_sig_msem != NULL); // must init before use
|
||||
int rc = ::msem_lock(p_sig_msem, 0);
|
||||
if (rc == -1 && !warn_only_once) {
|
||||
trcVerbose("msem_lock failed (errno = %d, %s)", errno, strerror(errno));
|
||||
trcVerbose("msem_lock failed (errno = %d, %s)", errno, os::errno_name(errno));
|
||||
warn_only_once = true;
|
||||
}
|
||||
}
|
||||
@ -2203,7 +2203,7 @@ static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
|
||||
int err) {
|
||||
warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
|
||||
", %d) failed; error='%s' (errno=%d)", addr, size, exec,
|
||||
strerror(err), err);
|
||||
os::errno_name(err), err);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2412,7 +2412,7 @@ static bool checked_mprotect(char* addr, size_t size, int prot) {
|
||||
bool rc = ::mprotect(addr, size, prot) == 0 ? true : false;
|
||||
|
||||
if (!rc) {
|
||||
const char* const s_errno = strerror(errno);
|
||||
const char* const s_errno = os::errno_name(errno);
|
||||
warning("mprotect(" PTR_FORMAT "-" PTR_FORMAT ", 0x%X) failed (%s).", addr, addr + size, prot, s_errno);
|
||||
return false;
|
||||
}
|
||||
@ -2634,7 +2634,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
|
||||
|
||||
if (ret != 0) {
|
||||
trcVerbose("Could not change priority for thread %d to %d (error %d, %s)",
|
||||
(int)thr, newpri, ret, strerror(ret));
|
||||
(int)thr, newpri, ret, os::errno_name(ret));
|
||||
}
|
||||
return (ret == 0) ? OS_OK : OS_ERR;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "os_aix.inline.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/perfMemory.hpp"
|
||||
#include "services/memTracker.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
@ -101,7 +102,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not create Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
} else {
|
||||
int fd = result;
|
||||
@ -112,7 +113,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not write Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -124,7 +125,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
result = ::close(fd);
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result == OS_ERR) {
|
||||
warning("Could not close %s: %s\n", destfile, strerror(errno));
|
||||
warning("Could not close %s: %s\n", destfile, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -397,7 +398,7 @@ static DIR *open_directory_secure(const char* dirname) {
|
||||
if (errno == ELOOP) {
|
||||
warning("directory %s is a symlink and is not secure\n", dirname);
|
||||
} else {
|
||||
warning("could not open directory %s: %s\n", dirname, strerror(errno));
|
||||
warning("could not open directory %s: %s\n", dirname, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
return dirp;
|
||||
@ -507,7 +508,7 @@ static bool is_file_secure(int fd, const char *filename) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed on %s: %s\n", filename, strerror(errno));
|
||||
warning("fstat failed on %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -543,7 +544,7 @@ static char* get_user_name(uid_t uid) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result != 0) {
|
||||
warning("Could not retrieve passwd entry: %s\n",
|
||||
strerror(result));
|
||||
os::strerror(result));
|
||||
}
|
||||
else if (p == NULL) {
|
||||
// this check is added to protect against an observed problem
|
||||
@ -557,7 +558,7 @@ static char* get_user_name(uid_t uid) {
|
||||
// Bug Id 89052 was opened with RedHat.
|
||||
//
|
||||
warning("Could not retrieve passwd entry: %s\n",
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
else {
|
||||
warning("Could not determine user name: %s\n",
|
||||
@ -593,7 +594,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
|
||||
"Process not found");
|
||||
}
|
||||
else /* EPERM */ {
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno));
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -746,7 +747,7 @@ static void remove_file(const char* path) {
|
||||
if (PrintMiscellaneous && Verbose && result == OS_ERR) {
|
||||
if (errno != ENOENT) {
|
||||
warning("Could not unlink shared memory backing"
|
||||
" store file %s : %s\n", path, strerror(errno));
|
||||
" store file %s : %s\n", path, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -849,7 +850,7 @@ static bool make_user_tmp_dir(const char* dirname) {
|
||||
//
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not create directory %s: %s\n",
|
||||
dirname, strerror(errno));
|
||||
dirname, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -900,7 +901,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
if (errno == ELOOP) {
|
||||
warning("file %s is a symlink and is not secure\n", filename);
|
||||
} else {
|
||||
warning("could not create file %s: %s\n", filename, strerror(errno));
|
||||
warning("could not create file %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
// Close the directory and reset the current working directory.
|
||||
@ -924,7 +925,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)0), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not truncate shared memory file: %s\n", strerror(errno));
|
||||
warning("could not truncate shared memory file: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -933,7 +934,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)size), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not set shared memory file size: %s\n", strerror(errno));
|
||||
warning("could not set shared memory file size: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -968,7 +969,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
|
||||
"Permission denied");
|
||||
}
|
||||
else {
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno));
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno));
|
||||
}
|
||||
}
|
||||
int fd = result;
|
||||
@ -1041,7 +1042,7 @@ static char* mmap_create_shared(size_t size) {
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed - %s\n", strerror(errno));
|
||||
warning("mmap failed - %s\n", os::strerror(errno));
|
||||
}
|
||||
remove_file(filename);
|
||||
FREE_C_HEAP_ARRAY(char, filename);
|
||||
@ -1109,7 +1110,7 @@ static size_t sharedmem_filesize(int fd, TRAPS) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed: %s\n", strerror(errno));
|
||||
warning("fstat failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(),
|
||||
"Could not determine PerfMemory size");
|
||||
@ -1231,7 +1232,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed: %s\n", strerror(errno));
|
||||
warning("mmap failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
|
||||
"Could not map PerfMemory");
|
||||
|
@ -789,7 +789,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
|
||||
(uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
} else {
|
||||
log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
|
||||
strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
@ -1122,7 +1122,7 @@ void os::die() {
|
||||
size_t os::lasterror(char *buf, size_t len) {
|
||||
if (errno == 0) return 0;
|
||||
|
||||
const char *s = ::strerror(errno);
|
||||
const char *s = os::strerror(errno);
|
||||
size_t n = ::strlen(s);
|
||||
if (n >= len) {
|
||||
n = len - 1;
|
||||
@ -2141,7 +2141,7 @@ static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
|
||||
int err) {
|
||||
warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
|
||||
", %d) failed; error='%s' (errno=%d)", addr, size, exec,
|
||||
strerror(err), err);
|
||||
os::errno_name(err), err);
|
||||
}
|
||||
|
||||
// NOTE: Bsd kernel does not really reserve the pages for us.
|
||||
@ -3422,7 +3422,7 @@ void os::init(void) {
|
||||
|
||||
Bsd::set_page_size(getpagesize());
|
||||
if (Bsd::page_size() == -1) {
|
||||
fatal("os_bsd.cpp: os::init: sysconf failed (%s)", strerror(errno));
|
||||
fatal("os_bsd.cpp: os::init: sysconf failed (%s)", os::strerror(errno));
|
||||
}
|
||||
init_page_sizes((size_t) Bsd::page_size());
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,7 @@
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "os_bsd.inline.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/perfMemory.hpp"
|
||||
#include "services/memTracker.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
@ -100,7 +101,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not create Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
} else {
|
||||
int fd = result;
|
||||
@ -111,7 +112,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not write Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -123,7 +124,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
result = ::close(fd);
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result == OS_ERR) {
|
||||
warning("Could not close %s: %s\n", destfile, strerror(errno));
|
||||
warning("Could not close %s: %s\n", destfile, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -309,7 +310,7 @@ static DIR *open_directory_secure(const char* dirname) {
|
||||
if (errno == ELOOP) {
|
||||
warning("directory %s is a symlink and is not secure\n", dirname);
|
||||
} else {
|
||||
warning("could not open directory %s: %s\n", dirname, strerror(errno));
|
||||
warning("could not open directory %s: %s\n", dirname, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
return dirp;
|
||||
@ -420,7 +421,7 @@ static bool is_file_secure(int fd, const char *filename) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed on %s: %s\n", filename, strerror(errno));
|
||||
warning("fstat failed on %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -459,7 +460,7 @@ static char* get_user_name(uid_t uid) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result != 0) {
|
||||
warning("Could not retrieve passwd entry: %s\n",
|
||||
strerror(result));
|
||||
os::strerror(result));
|
||||
}
|
||||
else if (p == NULL) {
|
||||
// this check is added to protect against an observed problem
|
||||
@ -473,7 +474,7 @@ static char* get_user_name(uid_t uid) {
|
||||
// Bug Id 89052 was opened with RedHat.
|
||||
//
|
||||
warning("Could not retrieve passwd entry: %s\n",
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
else {
|
||||
warning("Could not determine user name: %s\n",
|
||||
@ -509,7 +510,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
|
||||
"Process not found");
|
||||
}
|
||||
else /* EPERM */ {
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno));
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -652,7 +653,7 @@ static void remove_file(const char* path) {
|
||||
if (PrintMiscellaneous && Verbose && result == OS_ERR) {
|
||||
if (errno != ENOENT) {
|
||||
warning("Could not unlink shared memory backing"
|
||||
" store file %s : %s\n", path, strerror(errno));
|
||||
" store file %s : %s\n", path, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -762,7 +763,7 @@ static bool make_user_tmp_dir(const char* dirname) {
|
||||
//
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not create directory %s: %s\n",
|
||||
dirname, strerror(errno));
|
||||
dirname, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -804,7 +805,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
if (errno == ELOOP) {
|
||||
warning("file %s is a symlink and is not secure\n", filename);
|
||||
} else {
|
||||
warning("could not create file %s: %s\n", filename, strerror(errno));
|
||||
warning("could not create file %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
// close the directory and reset the current working directory
|
||||
@ -828,7 +829,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)0), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not truncate shared memory file: %s\n", strerror(errno));
|
||||
warning("could not truncate shared memory file: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -837,7 +838,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)size), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not set shared memory file size: %s\n", strerror(errno));
|
||||
warning("could not set shared memory file size: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -887,7 +888,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
|
||||
"Permission denied", OS_ERR);
|
||||
}
|
||||
else {
|
||||
THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
|
||||
THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
|
||||
}
|
||||
}
|
||||
int fd = result;
|
||||
@ -961,7 +962,7 @@ static char* mmap_create_shared(size_t size) {
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed - %s\n", strerror(errno));
|
||||
warning("mmap failed - %s\n", os::strerror(errno));
|
||||
}
|
||||
remove_file(filename);
|
||||
FREE_C_HEAP_ARRAY(char, filename);
|
||||
@ -1025,7 +1026,7 @@ static size_t sharedmem_filesize(int fd, TRAPS) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed: %s\n", strerror(errno));
|
||||
warning("fstat failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(),
|
||||
"Could not determine PerfMemory size");
|
||||
@ -1136,7 +1137,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed: %s\n", strerror(errno));
|
||||
warning("mmap failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
|
||||
"Could not map PerfMemory");
|
||||
|
@ -760,7 +760,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||
(uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
} else {
|
||||
log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
|
||||
strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
@ -881,6 +881,13 @@ void os::free_thread(OSThread* osthread) {
|
||||
assert(osthread != NULL, "osthread not set");
|
||||
|
||||
if (Thread::current()->osthread() == osthread) {
|
||||
#ifdef ASSERT
|
||||
sigset_t current;
|
||||
sigemptyset(¤t);
|
||||
pthread_sigmask(SIG_SETMASK, NULL, ¤t);
|
||||
assert(!sigismember(¤t, SR_signum), "SR signal should not be blocked!");
|
||||
#endif
|
||||
|
||||
// Restore caller's signal mask
|
||||
sigset_t sigmask = osthread->caller_sigmask();
|
||||
pthread_sigmask(SIG_SETMASK, &sigmask, NULL);
|
||||
@ -1386,7 +1393,7 @@ void os::die() {
|
||||
size_t os::lasterror(char *buf, size_t len) {
|
||||
if (errno == 0) return 0;
|
||||
|
||||
const char *s = ::strerror(errno);
|
||||
const char *s = os::strerror(errno);
|
||||
size_t n = ::strlen(s);
|
||||
if (n >= len) {
|
||||
n = len - 1;
|
||||
@ -2592,7 +2599,7 @@ static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
|
||||
int err) {
|
||||
warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
|
||||
", %d) failed; error='%s' (errno=%d)", p2i(addr), size, exec,
|
||||
strerror(err), err);
|
||||
os::strerror(err), err);
|
||||
}
|
||||
|
||||
static void warn_fail_commit_memory(char* addr, size_t size,
|
||||
@ -2600,7 +2607,7 @@ static void warn_fail_commit_memory(char* addr, size_t size,
|
||||
int err) {
|
||||
warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
|
||||
", " SIZE_FORMAT ", %d) failed; error='%s' (errno=%d)", p2i(addr), size,
|
||||
alignment_hint, exec, strerror(err), err);
|
||||
alignment_hint, exec, os::strerror(err), err);
|
||||
}
|
||||
|
||||
// NOTE: Linux kernel does not really reserve the pages for us.
|
||||
@ -3903,7 +3910,8 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
||||
// after sigsuspend.
|
||||
int old_errno = errno;
|
||||
|
||||
Thread* thread = Thread::current();
|
||||
Thread* thread = Thread::current_or_null_safe();
|
||||
assert(thread != NULL, "Missing current thread in SR_handler");
|
||||
OSThread* osthread = thread->osthread();
|
||||
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
|
||||
|
||||
@ -3915,7 +3923,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
||||
os::SuspendResume::State state = osthread->sr.suspended();
|
||||
if (state == os::SuspendResume::SR_SUSPENDED) {
|
||||
sigset_t suspend_set; // signals for sigsuspend()
|
||||
|
||||
sigemptyset(&suspend_set);
|
||||
// get current set of blocked signals and unblock resume signal
|
||||
pthread_sigmask(SIG_BLOCK, NULL, &suspend_set);
|
||||
sigdelset(&suspend_set, SR_signum);
|
||||
@ -4169,6 +4177,7 @@ static bool call_chained_handler(struct sigaction *actp, int sig,
|
||||
|
||||
// try to honor the signal mask
|
||||
sigset_t oset;
|
||||
sigemptyset(&oset);
|
||||
pthread_sigmask(SIG_SETMASK, &(actp->sa_mask), &oset);
|
||||
|
||||
// call into the chained handler
|
||||
@ -4179,7 +4188,7 @@ static bool call_chained_handler(struct sigaction *actp, int sig,
|
||||
}
|
||||
|
||||
// restore the signal mask
|
||||
pthread_sigmask(SIG_SETMASK, &oset, 0);
|
||||
pthread_sigmask(SIG_SETMASK, &oset, NULL);
|
||||
}
|
||||
// Tell jvm's signal handler the signal is taken care of.
|
||||
return true;
|
||||
@ -4564,7 +4573,7 @@ void os::init(void) {
|
||||
Linux::set_page_size(sysconf(_SC_PAGESIZE));
|
||||
if (Linux::page_size() == -1) {
|
||||
fatal("os_linux.cpp: os::init: sysconf failed (%s)",
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
init_page_sizes((size_t) Linux::page_size());
|
||||
|
||||
@ -4580,7 +4589,7 @@ void os::init(void) {
|
||||
int status;
|
||||
pthread_condattr_t* _condattr = os::Linux::condAttr();
|
||||
if ((status = pthread_condattr_init(_condattr)) != 0) {
|
||||
fatal("pthread_condattr_init: %s", strerror(status));
|
||||
fatal("pthread_condattr_init: %s", os::strerror(status));
|
||||
}
|
||||
// Only set the clock if CLOCK_MONOTONIC is available
|
||||
if (os::supports_monotonic_clock()) {
|
||||
@ -4589,7 +4598,7 @@ void os::init(void) {
|
||||
warning("Unable to use monotonic clock with relative timed-waits" \
|
||||
" - changes to the time-of-day clock may have adverse affects");
|
||||
} else {
|
||||
fatal("pthread_condattr_setclock: %s", strerror(status));
|
||||
fatal("pthread_condattr_setclock: %s", os::strerror(status));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4835,7 +4844,7 @@ int os::active_processor_count() {
|
||||
log_trace(os)("active_processor_count: "
|
||||
"CPU_ALLOC failed (%s) - using "
|
||||
"online processor count: %d",
|
||||
strerror(errno), online_cpus);
|
||||
os::strerror(errno), online_cpus);
|
||||
return online_cpus;
|
||||
}
|
||||
}
|
||||
@ -4865,7 +4874,7 @@ int os::active_processor_count() {
|
||||
else {
|
||||
cpu_count = ::sysconf(_SC_NPROCESSORS_ONLN);
|
||||
warning("sched_getaffinity failed (%s)- using online processor count (%d) "
|
||||
"which may exceed available processors", strerror(errno), cpu_count);
|
||||
"which may exceed available processors", os::strerror(errno), cpu_count);
|
||||
}
|
||||
|
||||
if (cpus_p != &cpus) { // can only be true when CPU_ALLOC used
|
||||
@ -5716,6 +5725,7 @@ void Parker::park(bool isAbsolute, jlong time) {
|
||||
// Don't catch signals while blocked; let the running threads have the signals.
|
||||
// (This allows a debugger to break into the running thread.)
|
||||
sigset_t oldsigs;
|
||||
sigemptyset(&oldsigs);
|
||||
sigset_t* allowdebug_blocked = os::Linux::allowdebug_blocked_signals();
|
||||
pthread_sigmask(SIG_BLOCK, allowdebug_blocked, &oldsigs);
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,7 @@
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "os_linux.inline.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/perfMemory.hpp"
|
||||
#include "services/memTracker.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
@ -100,7 +101,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not create Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
} else {
|
||||
int fd = result;
|
||||
@ -111,7 +112,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not write Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -123,7 +124,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
result = ::close(fd);
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result == OS_ERR) {
|
||||
warning("Could not close %s: %s\n", destfile, strerror(errno));
|
||||
warning("Could not close %s: %s\n", destfile, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -308,7 +309,7 @@ static DIR *open_directory_secure(const char* dirname) {
|
||||
if (errno == ELOOP) {
|
||||
warning("directory %s is a symlink and is not secure\n", dirname);
|
||||
} else {
|
||||
warning("could not open directory %s: %s\n", dirname, strerror(errno));
|
||||
warning("could not open directory %s: %s\n", dirname, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
return dirp;
|
||||
@ -419,7 +420,7 @@ static bool is_file_secure(int fd, const char *filename) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed on %s: %s\n", filename, strerror(errno));
|
||||
warning("fstat failed on %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -459,7 +460,7 @@ static char* get_user_name(uid_t uid) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result != 0) {
|
||||
warning("Could not retrieve passwd entry: %s\n",
|
||||
strerror(result));
|
||||
os::strerror(result));
|
||||
}
|
||||
else if (p == NULL) {
|
||||
// this check is added to protect against an observed problem
|
||||
@ -473,7 +474,7 @@ static char* get_user_name(uid_t uid) {
|
||||
// Bug Id 89052 was opened with RedHat.
|
||||
//
|
||||
warning("Could not retrieve passwd entry: %s\n",
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
else {
|
||||
warning("Could not determine user name: %s\n",
|
||||
@ -509,7 +510,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
|
||||
"Process not found");
|
||||
}
|
||||
else /* EPERM */ {
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno));
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,7 +665,7 @@ static void remove_file(const char* path) {
|
||||
if (PrintMiscellaneous && Verbose && result == OS_ERR) {
|
||||
if (errno != ENOENT) {
|
||||
warning("Could not unlink shared memory backing"
|
||||
" store file %s : %s\n", path, strerror(errno));
|
||||
" store file %s : %s\n", path, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -772,7 +773,7 @@ static bool make_user_tmp_dir(const char* dirname) {
|
||||
//
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not create directory %s: %s\n",
|
||||
dirname, strerror(errno));
|
||||
dirname, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -814,7 +815,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
if (errno == ELOOP) {
|
||||
warning("file %s is a symlink and is not secure\n", filename);
|
||||
} else {
|
||||
warning("could not create file %s: %s\n", filename, strerror(errno));
|
||||
warning("could not create file %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
// close the directory and reset the current working directory
|
||||
@ -838,7 +839,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)0), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not truncate shared memory file: %s\n", strerror(errno));
|
||||
warning("could not truncate shared memory file: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -847,7 +848,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)size), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not set shared memory file size: %s\n", strerror(errno));
|
||||
warning("could not set shared memory file size: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -897,7 +898,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
|
||||
"Permission denied", OS_ERR);
|
||||
}
|
||||
else {
|
||||
THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
|
||||
THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
|
||||
}
|
||||
}
|
||||
int fd = result;
|
||||
@ -970,7 +971,7 @@ static char* mmap_create_shared(size_t size) {
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed - %s\n", strerror(errno));
|
||||
warning("mmap failed - %s\n", os::strerror(errno));
|
||||
}
|
||||
remove_file(filename);
|
||||
FREE_C_HEAP_ARRAY(char, filename);
|
||||
@ -1034,7 +1035,7 @@ static size_t sharedmem_filesize(int fd, TRAPS) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed: %s\n", strerror(errno));
|
||||
warning("fstat failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(),
|
||||
"Could not determine PerfMemory size");
|
||||
@ -1151,7 +1152,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed: %s\n", strerror(errno));
|
||||
warning("mmap failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
|
||||
"Could not map PerfMemory");
|
||||
|
@ -1144,7 +1144,8 @@ void os::WatcherThreadCrashProtection::check_crash_protection(int sig,
|
||||
#define check_with_errno(check_type, cond, msg) \
|
||||
do { \
|
||||
int err = errno; \
|
||||
check_type(cond, "%s; error='%s' (errno=%d)", msg, strerror(err), err); \
|
||||
check_type(cond, "%s; error='%s' (errno=%s)", msg, os::strerror(err), \
|
||||
os::errno_name(err)); \
|
||||
} while (false)
|
||||
|
||||
#define assert_with_errno(cond, msg) check_with_errno(assert, cond, msg)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -461,7 +461,7 @@ SolarisAttachOperation* SolarisAttachListener::dequeue() {
|
||||
while ((res = ::sema_wait(wakeup())) == EINTR)
|
||||
;
|
||||
if (res) {
|
||||
warning("sema_wait failed: %s", strerror(res));
|
||||
warning("sema_wait failed: %s", os::strerror(res));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||
(uintx) tid, describe_thr_create_attributes(buf, sizeof(buf), stack_size, flags));
|
||||
} else {
|
||||
log_warning(os, thread)("Failed to start thread - thr_create failed (%s) for attributes: %s.",
|
||||
strerror(status), describe_thr_create_attributes(buf, sizeof(buf), stack_size, flags));
|
||||
os::errno_name(status), describe_thr_create_attributes(buf, sizeof(buf), stack_size, flags));
|
||||
}
|
||||
|
||||
if (status != 0) {
|
||||
@ -1354,7 +1354,7 @@ jlong getTimeMillis() {
|
||||
jlong os::javaTimeMillis() {
|
||||
timeval t;
|
||||
if (gettimeofday(&t, NULL) == -1) {
|
||||
fatal("os::javaTimeMillis: gettimeofday (%s)", strerror(errno));
|
||||
fatal("os::javaTimeMillis: gettimeofday (%s)", os::strerror(errno));
|
||||
}
|
||||
return jlong(t.tv_sec) * 1000 + jlong(t.tv_usec) / 1000;
|
||||
}
|
||||
@ -1362,7 +1362,7 @@ jlong os::javaTimeMillis() {
|
||||
void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
|
||||
timeval t;
|
||||
if (gettimeofday(&t, NULL) == -1) {
|
||||
fatal("os::javaTimeSystemUTC: gettimeofday (%s)", strerror(errno));
|
||||
fatal("os::javaTimeSystemUTC: gettimeofday (%s)", os::strerror(errno));
|
||||
}
|
||||
seconds = jlong(t.tv_sec);
|
||||
nanos = jlong(t.tv_usec) * 1000;
|
||||
@ -2160,7 +2160,7 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
|
||||
size_t os::lasterror(char *buf, size_t len) {
|
||||
if (errno == 0) return 0;
|
||||
|
||||
const char *s = ::strerror(errno);
|
||||
const char *s = os::strerror(errno);
|
||||
size_t n = ::strlen(s);
|
||||
if (n >= len) {
|
||||
n = len - 1;
|
||||
@ -2369,7 +2369,7 @@ static void warn_fail_commit_memory(char* addr, size_t bytes, bool exec,
|
||||
int err) {
|
||||
warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
|
||||
", %d) failed; error='%s' (errno=%d)", addr, bytes, exec,
|
||||
strerror(err), err);
|
||||
os::strerror(err), err);
|
||||
}
|
||||
|
||||
static void warn_fail_commit_memory(char* addr, size_t bytes,
|
||||
@ -2377,7 +2377,7 @@ static void warn_fail_commit_memory(char* addr, size_t bytes,
|
||||
int err) {
|
||||
warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
|
||||
", " SIZE_FORMAT ", %d) failed; error='%s' (errno=%d)", addr, bytes,
|
||||
alignment_hint, exec, strerror(err), err);
|
||||
alignment_hint, exec, os::strerror(err), err);
|
||||
}
|
||||
|
||||
int os::Solaris::commit_memory_impl(char* addr, size_t bytes, bool exec) {
|
||||
@ -2758,7 +2758,7 @@ char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
|
||||
char buf[256];
|
||||
buf[0] = '\0';
|
||||
if (addr == NULL) {
|
||||
jio_snprintf(buf, sizeof(buf), ": %s", strerror(err));
|
||||
jio_snprintf(buf, sizeof(buf), ": %s", os::strerror(err));
|
||||
}
|
||||
warning("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at "
|
||||
PTR_FORMAT ": reserve_memory_helper returned " PTR_FORMAT
|
||||
@ -4372,7 +4372,7 @@ void os::init(void) {
|
||||
|
||||
page_size = sysconf(_SC_PAGESIZE);
|
||||
if (page_size == -1) {
|
||||
fatal("os_solaris.cpp: os::init: sysconf failed (%s)", strerror(errno));
|
||||
fatal("os_solaris.cpp: os::init: sysconf failed (%s)", os::strerror(errno));
|
||||
}
|
||||
init_page_sizes((size_t) page_size);
|
||||
|
||||
@ -4384,7 +4384,7 @@ void os::init(void) {
|
||||
|
||||
int fd = ::open("/dev/zero", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fatal("os::init: cannot open /dev/zero (%s)", strerror(errno));
|
||||
fatal("os::init: cannot open /dev/zero (%s)", os::strerror(errno));
|
||||
} else {
|
||||
Solaris::set_dev_zero_fd(fd);
|
||||
|
||||
@ -5625,7 +5625,7 @@ int os::fork_and_exec(char* cmd) {
|
||||
|
||||
if (pid < 0) {
|
||||
// fork failed
|
||||
warning("fork failed: %s", strerror(errno));
|
||||
warning("fork failed: %s", os::strerror(errno));
|
||||
return -1;
|
||||
|
||||
} else if (pid == 0) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -102,7 +102,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not create Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -114,7 +114,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not write Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -125,7 +125,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
result = ::close(fd);
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result == OS_ERR) {
|
||||
warning("Could not close %s: %s\n", destfile, strerror(errno));
|
||||
warning("Could not close %s: %s\n", destfile, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ static DIR *open_directory_secure(const char* dirname) {
|
||||
if (errno == ELOOP) {
|
||||
warning("directory %s is a symlink and is not secure\n", dirname);
|
||||
} else {
|
||||
warning("could not open directory %s: %s\n", dirname, strerror(errno));
|
||||
warning("could not open directory %s: %s\n", dirname, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
return dirp;
|
||||
@ -422,7 +422,7 @@ static bool is_file_secure(int fd, const char *filename) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed on %s: %s\n", filename, strerror(errno));
|
||||
warning("fstat failed on %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -464,7 +464,7 @@ static char* get_user_name(uid_t uid) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (p == NULL) {
|
||||
warning("Could not retrieve passwd entry: %s\n",
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
else {
|
||||
warning("Could not determine user name: %s\n",
|
||||
@ -500,7 +500,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
|
||||
"Process not found");
|
||||
}
|
||||
else /* EPERM */ {
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno));
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -657,7 +657,7 @@ static char* get_user_name(int vmid, TRAPS) {
|
||||
// In this case, the psinfo file for the process id existed,
|
||||
// but we didn't have permission to access it.
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
|
||||
// at this point, we don't know if the process id itself doesn't
|
||||
@ -703,7 +703,7 @@ static void remove_file(const char* path) {
|
||||
if (PrintMiscellaneous && Verbose && result == OS_ERR) {
|
||||
if (errno != ENOENT) {
|
||||
warning("Could not unlink shared memory backing"
|
||||
" store file %s : %s\n", path, strerror(errno));
|
||||
" store file %s : %s\n", path, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -813,7 +813,7 @@ static bool make_user_tmp_dir(const char* dirname) {
|
||||
//
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not create directory %s: %s\n",
|
||||
dirname, strerror(errno));
|
||||
dirname, os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -855,7 +855,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
if (errno == ELOOP) {
|
||||
warning("file %s is a symlink and is not secure\n", filename);
|
||||
} else {
|
||||
warning("could not create file %s: %s\n", filename, strerror(errno));
|
||||
warning("could not create file %s: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
// close the directory and reset the current working directory
|
||||
@ -879,7 +879,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)0), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not truncate shared memory file: %s\n", strerror(errno));
|
||||
warning("could not truncate shared memory file: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -888,7 +888,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
||||
RESTARTABLE(::ftruncate(fd, (off_t)size), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("could not set shared memory file size: %s\n", strerror(errno));
|
||||
warning("could not set shared memory file size: %s\n", os::strerror(errno));
|
||||
}
|
||||
::close(fd);
|
||||
return -1;
|
||||
@ -916,7 +916,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
|
||||
"Permission denied", OS_ERR);
|
||||
}
|
||||
else {
|
||||
THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
|
||||
THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
|
||||
}
|
||||
}
|
||||
int fd = result;
|
||||
@ -990,7 +990,7 @@ static char* mmap_create_shared(size_t size) {
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed - %s\n", strerror(errno));
|
||||
warning("mmap failed - %s\n", os::strerror(errno));
|
||||
}
|
||||
remove_file(filename);
|
||||
FREE_C_HEAP_ARRAY(char, filename);
|
||||
@ -1055,7 +1055,7 @@ static size_t sharedmem_filesize(int fd, TRAPS) {
|
||||
RESTARTABLE(::fstat(fd, &statbuf), result);
|
||||
if (result == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("fstat failed: %s\n", strerror(errno));
|
||||
warning("fstat failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(),
|
||||
"Could not determine PerfMemory size");
|
||||
@ -1172,7 +1172,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
|
||||
|
||||
if (mapAddress == MAP_FAILED) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("mmap failed: %s\n", strerror(errno));
|
||||
warning("mmap failed: %s\n", os::strerror(errno));
|
||||
}
|
||||
THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
|
||||
"Could not map PerfMemory");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "runtime/threadCritical.hpp"
|
||||
|
||||
@ -49,7 +50,7 @@ ThreadCritical::ThreadCritical() {
|
||||
if (global_mut_owner != owner) {
|
||||
if (os::Solaris::mutex_lock(&global_mut))
|
||||
fatal("ThreadCritical::ThreadCritical: mutex_lock failed (%s)",
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
assert(global_mut_count == 0, "must have clean count");
|
||||
assert(global_mut_owner == -1, "must have clean owner");
|
||||
}
|
||||
@ -68,7 +69,7 @@ ThreadCritical::~ThreadCritical() {
|
||||
if (global_mut_count == 0) {
|
||||
global_mut_owner = -1;
|
||||
if (os::Solaris::mutex_unlock(&global_mut))
|
||||
fatal("ThreadCritical::~ThreadCritical: mutex_unlock failed (%s)", strerror(errno));
|
||||
fatal("ThreadCritical::~ThreadCritical: mutex_unlock failed (%s)", os::strerror(errno));
|
||||
}
|
||||
} else {
|
||||
assert (Threads::number_of_threads() == 0, "valid only during initialization");
|
||||
|
@ -642,7 +642,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||
thread_id, describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
|
||||
} else {
|
||||
log_warning(os, thread)("Failed to start thread - _beginthreadex failed (%s) for attributes: %s.",
|
||||
strerror(errno), describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
|
||||
os::errno_name(errno), describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
|
||||
}
|
||||
|
||||
if (thread_handle == NULL) {
|
||||
@ -1898,7 +1898,7 @@ size_t os::lasterror(char* buf, size_t len) {
|
||||
|
||||
if (errno != 0) {
|
||||
// C runtime error that has no corresponding DOS error code
|
||||
const char* s = strerror(errno);
|
||||
const char* s = os::strerror(errno);
|
||||
size_t n = strlen(s);
|
||||
if (n >= len) n = len - 1;
|
||||
strncpy(buf, s, n);
|
||||
@ -2441,7 +2441,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
|
||||
jio_snprintf(buf, sizeof(buf), "Execution protection violation "
|
||||
"at " INTPTR_FORMAT
|
||||
", unguarding " INTPTR_FORMAT ": %s", addr,
|
||||
page_start, (res ? "success" : strerror(errno)));
|
||||
page_start, (res ? "success" : os::strerror(errno)));
|
||||
tty->print_raw_cr(buf);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -96,7 +96,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (fd == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not create Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
} else {
|
||||
for (size_t remaining = size; remaining > 0;) {
|
||||
@ -105,7 +105,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
if (nbytes == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not write Perfdata save file: %s: %s\n",
|
||||
destfile, strerror(errno));
|
||||
destfile, os::strerror(errno));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -117,7 +117,7 @@ static void save_memory_to_file(char* addr, size_t size) {
|
||||
int result = ::_close(fd);
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (result == OS_ERR) {
|
||||
warning("Could not close %s: %s\n", destfile, strerror(errno));
|
||||
warning("Could not close %s: %s\n", destfile, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -497,7 +497,7 @@ static void remove_file(const char* dirname, const char* filename) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
if (errno != ENOENT) {
|
||||
warning("Could not unlink shared memory backing"
|
||||
" store file %s : %s\n", path, strerror(errno));
|
||||
" store file %s : %s\n", path, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1358,7 +1358,7 @@ static HANDLE create_sharedmem_resources(const char* dirname, const char* filena
|
||||
if (ret_code == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("Could not get status information from file %s: %s\n",
|
||||
filename, strerror(errno));
|
||||
filename, os::strerror(errno));
|
||||
}
|
||||
CloseHandle(fmh);
|
||||
CloseHandle(fh);
|
||||
@ -1553,7 +1553,7 @@ static size_t sharedmem_filesize(const char* filename, TRAPS) {
|
||||
//
|
||||
if (::stat(filename, &statbuf) == OS_ERR) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("stat %s failed: %s\n", filename, strerror(errno));
|
||||
warning("stat %s failed: %s\n", filename, os::strerror(errno));
|
||||
}
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(),
|
||||
"Could not determine PerfMemory size");
|
||||
|
@ -110,46 +110,6 @@ DirtyCardQueue::~DirtyCardQueue() {
|
||||
}
|
||||
}
|
||||
|
||||
bool DirtyCardQueue::apply_closure(CardTableEntryClosure* cl,
|
||||
bool consume,
|
||||
uint worker_i) {
|
||||
bool res = true;
|
||||
if (_buf != NULL) {
|
||||
BufferNode* node = BufferNode::make_node_from_buffer(_buf, _index);
|
||||
res = apply_closure_to_buffer(cl, node, _sz, consume, worker_i);
|
||||
if (res && consume) {
|
||||
_index = _sz;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool DirtyCardQueue::apply_closure_to_buffer(CardTableEntryClosure* cl,
|
||||
BufferNode* node,
|
||||
size_t buffer_size,
|
||||
bool consume,
|
||||
uint worker_i) {
|
||||
if (cl == NULL) return true;
|
||||
void** buf = BufferNode::make_buffer_from_node(node);
|
||||
size_t limit = byte_index_to_index(buffer_size);
|
||||
for (size_t i = byte_index_to_index(node->index()); i < limit; ++i) {
|
||||
jbyte* card_ptr = static_cast<jbyte*>(buf[i]);
|
||||
assert(card_ptr != NULL, "invariant");
|
||||
if (!cl->do_card_ptr(card_ptr, worker_i)) {
|
||||
if (consume) {
|
||||
size_t new_index = index_to_byte_index(i + 1);
|
||||
assert(new_index <= buffer_size, "invariant");
|
||||
node->set_index(new_index);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (consume) {
|
||||
node->set_index(buffer_size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) :
|
||||
PtrQueueSet(notify_when_complete),
|
||||
_mut_process_closure(NULL),
|
||||
@ -190,15 +150,39 @@ void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) {
|
||||
t->dirty_card_queue().handle_zero_index();
|
||||
}
|
||||
|
||||
bool DirtyCardQueueSet::apply_closure_to_buffer(CardTableEntryClosure* cl,
|
||||
BufferNode* node,
|
||||
bool consume,
|
||||
uint worker_i) {
|
||||
if (cl == NULL) return true;
|
||||
void** buf = BufferNode::make_buffer_from_node(node);
|
||||
size_t limit = DirtyCardQueue::byte_index_to_index(buffer_size());
|
||||
size_t start = DirtyCardQueue::byte_index_to_index(node->index());
|
||||
for (size_t i = start; i < limit; ++i) {
|
||||
jbyte* card_ptr = static_cast<jbyte*>(buf[i]);
|
||||
assert(card_ptr != NULL, "invariant");
|
||||
if (!cl->do_card_ptr(card_ptr, worker_i)) {
|
||||
if (consume) {
|
||||
size_t new_index = DirtyCardQueue::index_to_byte_index(i + 1);
|
||||
assert(new_index <= buffer_size(), "invariant");
|
||||
node->set_index(new_index);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (consume) {
|
||||
node->set_index(buffer_size());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DirtyCardQueueSet::mut_process_buffer(BufferNode* node) {
|
||||
guarantee(_free_ids != NULL, "must be");
|
||||
|
||||
// claim a par id
|
||||
uint worker_i = _free_ids->claim_par_id();
|
||||
|
||||
bool b = DirtyCardQueue::apply_closure_to_buffer(_mut_process_closure,
|
||||
node, _sz,
|
||||
true, worker_i);
|
||||
bool b = apply_closure_to_buffer(_mut_process_closure, node, true, worker_i);
|
||||
if (b) {
|
||||
Atomic::inc(&_processed_buffers_mut);
|
||||
}
|
||||
@ -242,7 +226,7 @@ bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure*
|
||||
if (nd == NULL) {
|
||||
return false;
|
||||
} else {
|
||||
if (DirtyCardQueue::apply_closure_to_buffer(cl, nd, _sz, true, worker_i)) {
|
||||
if (apply_closure_to_buffer(cl, nd, true, worker_i)) {
|
||||
// Done with fully processed buffer.
|
||||
deallocate_buffer(nd);
|
||||
Atomic::inc(&_processed_buffers_rs_thread);
|
||||
@ -261,7 +245,7 @@ void DirtyCardQueueSet::par_apply_closure_to_all_completed_buffers(CardTableEntr
|
||||
BufferNode* next = nd->next();
|
||||
void* actual = Atomic::cmpxchg_ptr(next, &_cur_par_buffer_node, nd);
|
||||
if (actual == nd) {
|
||||
bool b = DirtyCardQueue::apply_closure_to_buffer(cl, nd, _sz, false);
|
||||
bool b = apply_closure_to_buffer(cl, nd, false);
|
||||
guarantee(b, "Should not stop early.");
|
||||
nd = next;
|
||||
} else {
|
||||
|
@ -37,7 +37,7 @@ class CardTableEntryClosure: public CHeapObj<mtGC> {
|
||||
public:
|
||||
// Process the card whose card table entry is "card_ptr". If returns
|
||||
// "false", terminate the iteration early.
|
||||
virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i = 0) = 0;
|
||||
virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i) = 0;
|
||||
};
|
||||
|
||||
// A ptrQueue whose elements are "oops", pointers to object heads.
|
||||
@ -52,26 +52,6 @@ public:
|
||||
// Process queue entries and release resources.
|
||||
void flush() { flush_impl(); }
|
||||
|
||||
// Apply the closure to the elements from _index to _sz. If all
|
||||
// closure applications return true, then returns true. Stops
|
||||
// processing after the first closure application that returns
|
||||
// false, and returns false from this function. If "consume" is
|
||||
// true, _index is updated to follow the last processed element.
|
||||
bool apply_closure(CardTableEntryClosure* cl,
|
||||
bool consume = true,
|
||||
uint worker_i = 0);
|
||||
|
||||
// Apply the closure to the elements of "node" from it's index to
|
||||
// buffer_size. If all closure applications return true, then
|
||||
// returns true. Stops processing after the first closure
|
||||
// application that returns false, and returns false from this
|
||||
// function. If "consume" is true, the node's index is updated to
|
||||
// follow the last processed element.
|
||||
static bool apply_closure_to_buffer(CardTableEntryClosure* cl,
|
||||
BufferNode* node,
|
||||
size_t buffer_size,
|
||||
bool consume = true,
|
||||
uint worker_i = 0);
|
||||
void **get_buf() { return _buf;}
|
||||
size_t get_index() { return _index;}
|
||||
void reinitialize() { _buf = 0; _sz = 0; _index = 0;}
|
||||
@ -97,6 +77,17 @@ class DirtyCardQueueSet: public PtrQueueSet {
|
||||
|
||||
DirtyCardQueue _shared_dirty_card_queue;
|
||||
|
||||
// Apply the closure to the elements of "node" from it's index to
|
||||
// buffer_size. If all closure applications return true, then
|
||||
// returns true. Stops processing after the first closure
|
||||
// application that returns false, and returns false from this
|
||||
// function. If "consume" is true, the node's index is updated to
|
||||
// follow the last processed element.
|
||||
bool apply_closure_to_buffer(CardTableEntryClosure* cl,
|
||||
BufferNode* node,
|
||||
bool consume,
|
||||
uint worker_i = 0);
|
||||
|
||||
bool mut_process_buffer(BufferNode* node);
|
||||
|
||||
// Protected by the _cbl_mon.
|
||||
|
@ -82,8 +82,8 @@ public:
|
||||
void G1HeapTransition::print() {
|
||||
Data after(_g1_heap);
|
||||
|
||||
size_t eden_capacity_bytes_after_gc = _g1_heap->g1_policy()->young_list_target_length() - after._survivor_length;
|
||||
size_t survivor_capacity_bytes_after_gc = _g1_heap->g1_policy()->max_survivor_regions();
|
||||
size_t eden_capacity_length_after_gc = _g1_heap->g1_policy()->young_list_target_length() - after._survivor_length;
|
||||
size_t survivor_capacity_length_after_gc = _g1_heap->g1_policy()->max_survivor_regions();
|
||||
|
||||
DetailedUsage usage;
|
||||
if (log_is_enabled(Trace, gc, heap)) {
|
||||
@ -100,11 +100,11 @@ void G1HeapTransition::print() {
|
||||
}
|
||||
|
||||
log_info(gc, heap)("Eden regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")",
|
||||
_before._eden_length, after._eden_length, eden_capacity_bytes_after_gc);
|
||||
_before._eden_length, after._eden_length, eden_capacity_length_after_gc);
|
||||
log_trace(gc, heap)(" Used: 0K, Waste: 0K");
|
||||
|
||||
log_info(gc, heap)("Survivor regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")",
|
||||
_before._survivor_length, after._survivor_length, survivor_capacity_bytes_after_gc);
|
||||
_before._survivor_length, after._survivor_length, survivor_capacity_length_after_gc);
|
||||
log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
|
||||
usage._survivor_used / K, ((after._survivor_length * HeapRegion::GrainBytes) - usage._survivor_used) / K);
|
||||
|
||||
|
@ -220,12 +220,6 @@ class G1AdjustPointersClosure: public HeapRegionClosure {
|
||||
}
|
||||
};
|
||||
|
||||
class G1AlwaysTrueClosure: public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop p) { return true; }
|
||||
};
|
||||
static G1AlwaysTrueClosure always_true;
|
||||
|
||||
void G1MarkSweep::mark_sweep_phase3() {
|
||||
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
||||
|
||||
@ -248,7 +242,7 @@ void G1MarkSweep::mark_sweep_phase3() {
|
||||
|
||||
// Now adjust pointers in remaining weak roots. (All of which should
|
||||
// have been cleared if they pointed to non-surviving objects.)
|
||||
JNIHandles::weak_oops_do(&always_true, &GenMarkSweep::adjust_pointer_closure);
|
||||
JNIHandles::weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
|
||||
|
||||
if (G1StringDedup::is_enabled()) {
|
||||
G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure);
|
||||
|
@ -570,13 +570,6 @@ void PSMarkSweep::mark_sweep_phase2() {
|
||||
old_gen->precompact();
|
||||
}
|
||||
|
||||
// This should be moved to the shared markSweep code!
|
||||
class PSAlwaysTrueClosure: public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop p) { return true; }
|
||||
};
|
||||
static PSAlwaysTrueClosure always_true;
|
||||
|
||||
void PSMarkSweep::mark_sweep_phase3() {
|
||||
// Adjust the pointers to reflect the new locations
|
||||
GCTraceTime(Trace, gc) tm("Phase 3: Adjust pointers", _gc_timer);
|
||||
@ -603,7 +596,7 @@ void PSMarkSweep::mark_sweep_phase3() {
|
||||
// Now adjust pointers in remaining weak roots. (All of which should
|
||||
// have been cleared if they pointed to non-surviving objects.)
|
||||
// Global (weak) JNI handles
|
||||
JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure());
|
||||
JNIHandles::weak_oops_do(adjust_pointer_closure());
|
||||
|
||||
CodeBlobToOopClosure adjust_from_blobs(adjust_pointer_closure(), CodeBlobToOopClosure::FixRelocations);
|
||||
CodeCache::blobs_do(&adjust_from_blobs);
|
||||
|
@ -2125,13 +2125,6 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm,
|
||||
_gc_tracer.report_object_count_after_gc(is_alive_closure());
|
||||
}
|
||||
|
||||
// This should be moved to the shared markSweep code!
|
||||
class PSAlwaysTrueClosure: public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop p) { return true; }
|
||||
};
|
||||
static PSAlwaysTrueClosure always_true;
|
||||
|
||||
void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
|
||||
// Adjust the pointers to reflect the new locations
|
||||
GCTraceTime(Trace, gc, phases) tm("Adjust Roots", &_gc_timer);
|
||||
@ -2157,7 +2150,7 @@ void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
|
||||
// Now adjust pointers in remaining weak roots. (All of which should
|
||||
// have been cleared if they pointed to non-surviving objects.)
|
||||
// Global (weak) JNI handles
|
||||
JNIHandles::weak_oops_do(&always_true, &oop_closure);
|
||||
JNIHandles::weak_oops_do(&oop_closure);
|
||||
|
||||
CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
|
||||
CodeCache::blobs_do(&adjust_from_blobs);
|
||||
|
@ -33,6 +33,9 @@
|
||||
// use of this class grows, we should split it into public
|
||||
// and implementation-private "causes".
|
||||
//
|
||||
// The definitions in the SA code should be kept in sync
|
||||
// with the definitions here.
|
||||
//
|
||||
|
||||
class GCCause : public AllStatic {
|
||||
public:
|
||||
|
@ -684,15 +684,8 @@ void GenCollectedHeap::gen_process_roots(StrongRootsScope* scope,
|
||||
_process_strong_tasks->all_tasks_completed(scope->n_threads());
|
||||
}
|
||||
|
||||
|
||||
class AlwaysTrueClosure: public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop p) { return true; }
|
||||
};
|
||||
static AlwaysTrueClosure always_true;
|
||||
|
||||
void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
|
||||
JNIHandles::weak_oops_do(&always_true, root_closure);
|
||||
JNIHandles::weak_oops_do(root_closure);
|
||||
_young_gen->ref_processor()->weak_oops_do(root_closure);
|
||||
_old_gen->ref_processor()->weak_oops_do(root_closure);
|
||||
}
|
||||
|
@ -266,11 +266,6 @@ ReferenceProcessorStats ReferenceProcessor::process_discovered_references(
|
||||
#ifndef PRODUCT
|
||||
// Calculate the number of jni handles.
|
||||
size_t ReferenceProcessor::count_jni_refs() {
|
||||
class AlwaysAliveClosure: public BoolObjectClosure {
|
||||
public:
|
||||
virtual bool do_object_b(oop obj) { return true; }
|
||||
};
|
||||
|
||||
class CountHandleClosure: public OopClosure {
|
||||
private:
|
||||
size_t _count;
|
||||
@ -281,8 +276,7 @@ size_t ReferenceProcessor::count_jni_refs() {
|
||||
size_t count() { return _count; }
|
||||
};
|
||||
CountHandleClosure global_handle_count;
|
||||
AlwaysAliveClosure always_alive;
|
||||
JNIHandles::weak_oops_do(&always_alive, &global_handle_count);
|
||||
JNIHandles::weak_oops_do(&global_handle_count);
|
||||
return global_handle_count.count();
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -136,4 +136,27 @@ void Test_configure_stdout() {
|
||||
LogConfiguration::parse_log_arguments("stdout", saved_config, NULL, NULL, log.error_stream());
|
||||
os::free(saved_config);
|
||||
}
|
||||
|
||||
static int Test_logconfiguration_subscribe_triggered = 0;
|
||||
|
||||
static void Test_logconfiguration_subscribe_helper() {
|
||||
Test_logconfiguration_subscribe_triggered++;
|
||||
}
|
||||
|
||||
void Test_logconfiguration_subscribe() {
|
||||
ResourceMark rm;
|
||||
LogHandle(logging) log;
|
||||
|
||||
LogConfiguration::register_update_listener(&Test_logconfiguration_subscribe_helper);
|
||||
|
||||
LogConfiguration::parse_log_arguments("stdout", "logging=trace", NULL, NULL, log.error_stream());
|
||||
assert(Test_logconfiguration_subscribe_triggered == 1, "subscription not triggered (1)");
|
||||
|
||||
LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(gc));
|
||||
assert(Test_logconfiguration_subscribe_triggered == 2, "subscription not triggered (2)");
|
||||
|
||||
LogConfiguration::disable_logging();
|
||||
assert(Test_logconfiguration_subscribe_triggered == 3, "subscription not triggered (3)");
|
||||
}
|
||||
|
||||
#endif // PRODUCT
|
||||
|
@ -40,6 +40,9 @@
|
||||
LogOutput** LogConfiguration::_outputs = NULL;
|
||||
size_t LogConfiguration::_n_outputs = 0;
|
||||
|
||||
LogConfiguration::UpdateListenerFunction* LogConfiguration::_listener_callbacks = NULL;
|
||||
size_t LogConfiguration::_n_listener_callbacks = 0;
|
||||
|
||||
// Stack object to take the lock for configuring the logging.
|
||||
// Should only be held during the critical parts of the configuration
|
||||
// (when calling configure_output or reading/modifying the outputs array).
|
||||
@ -254,6 +257,7 @@ void LogConfiguration::disable_logging() {
|
||||
for (size_t i = 0; i < _n_outputs; i++) {
|
||||
disable_output(i);
|
||||
}
|
||||
notify_update_listeners();
|
||||
}
|
||||
|
||||
void LogConfiguration::configure_stdout(LogLevelType level, bool exact_match, ...) {
|
||||
@ -282,6 +286,7 @@ void LogConfiguration::configure_stdout(LogLevelType level, bool exact_match, ..
|
||||
// Apply configuration to stdout (output #0), with the same decorators as before.
|
||||
ConfigurationLock cl;
|
||||
configure_output(0, expr, LogOutput::Stdout->decorators());
|
||||
notify_update_listeners();
|
||||
}
|
||||
|
||||
bool LogConfiguration::parse_command_line_arguments(const char* opts) {
|
||||
@ -373,6 +378,7 @@ bool LogConfiguration::parse_log_arguments(const char* outputstr,
|
||||
}
|
||||
}
|
||||
configure_output(idx, expr, decorators);
|
||||
notify_update_listeners();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -471,3 +477,20 @@ void LogConfiguration::rotate_all_outputs() {
|
||||
}
|
||||
}
|
||||
|
||||
void LogConfiguration::register_update_listener(UpdateListenerFunction cb) {
|
||||
assert(cb != NULL, "Should not register NULL as listener");
|
||||
ConfigurationLock cl;
|
||||
size_t idx = _n_listener_callbacks++;
|
||||
_listener_callbacks = REALLOC_C_HEAP_ARRAY(UpdateListenerFunction,
|
||||
_listener_callbacks,
|
||||
_n_listener_callbacks,
|
||||
mtLogging);
|
||||
_listener_callbacks[idx] = cb;
|
||||
}
|
||||
|
||||
void LogConfiguration::notify_update_listeners() {
|
||||
assert(ConfigurationLock::current_thread_has_lock(), "notify_update_listeners must be called in ConfigurationLock scope (lock held)");
|
||||
for (size_t i = 0; i < _n_listener_callbacks; i++) {
|
||||
_listener_callbacks[i]();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,10 +37,26 @@ class LogTagLevelExpression;
|
||||
// kept implicitly in the LogTagSets and their LogOutputLists. During configuration the tagsets
|
||||
// are iterated over and updated accordingly.
|
||||
class LogConfiguration : public AllStatic {
|
||||
public:
|
||||
// Function for listeners
|
||||
typedef void (*UpdateListenerFunction)(void);
|
||||
|
||||
// Register callback for config change.
|
||||
// The callback is always called with ConfigurationLock held,
|
||||
// hence doing log reconfiguration from the callback will deadlock.
|
||||
// The main Java thread may call this callback if there is an early registration
|
||||
// else the attach listener JavaThread, started via diagnostic command, will be executing thread.
|
||||
// The main purpose of this callback is to see if a loglevel have been changed.
|
||||
// There is no way to unregister.
|
||||
static void register_update_listener(UpdateListenerFunction cb);
|
||||
|
||||
private:
|
||||
static LogOutput** _outputs;
|
||||
static size_t _n_outputs;
|
||||
|
||||
static UpdateListenerFunction* _listener_callbacks;
|
||||
static size_t _n_listener_callbacks;
|
||||
|
||||
// Create a new output. Returns NULL if failed.
|
||||
static LogOutput* new_output(char* name, const char* options, outputStream* errstream);
|
||||
|
||||
@ -60,6 +76,9 @@ class LogConfiguration : public AllStatic {
|
||||
// Configure output (add or update existing configuration) to log on tag-level combination using specified decorators.
|
||||
static void configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators);
|
||||
|
||||
// This should be called after any configuration change while still holding ConfigurationLock
|
||||
static void notify_update_listeners();
|
||||
|
||||
public:
|
||||
// Initialization and finalization of log configuration, to be run at vm startup and shutdown respectively.
|
||||
static void initialize(jlong vm_start_time);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,7 +64,7 @@ LogFileOutput::~LogFileOutput() {
|
||||
}
|
||||
if (fclose(_stream) != 0) {
|
||||
jio_fprintf(defaultStream::error_stream(), "Could not close log file '%s' (%s).\n",
|
||||
_file_name, strerror(errno));
|
||||
_file_name, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
os::free(_archive_name);
|
||||
@ -139,7 +139,7 @@ bool LogFileOutput::initialize(const char* options) {
|
||||
}
|
||||
_stream = fopen(_file_name, FileOpenMode);
|
||||
if (_stream == NULL) {
|
||||
log_error(logging)("Could not open log file '%s' (%s).\n", _file_name, strerror(errno));
|
||||
log_error(logging)("Could not open log file '%s' (%s).\n", _file_name, os::strerror(errno));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -176,7 +176,7 @@ void LogFileOutput::archive() {
|
||||
// Rename the file from ex hotspot.log to hotspot.log.2
|
||||
if (rename(_file_name, _archive_name) == -1) {
|
||||
jio_fprintf(defaultStream::error_stream(), "Could not rename log file '%s' to '%s' (%s).\n",
|
||||
_file_name, _archive_name, strerror(errno));
|
||||
_file_name, _archive_name, os::strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ void LogFileOutput::rotate() {
|
||||
|
||||
if (fclose(_stream)) {
|
||||
jio_fprintf(defaultStream::error_stream(), "Error closing file '%s' during log rotation (%s).\n",
|
||||
_file_name, strerror(errno));
|
||||
_file_name, os::strerror(errno));
|
||||
}
|
||||
|
||||
// Archive the current log file
|
||||
@ -204,7 +204,7 @@ void LogFileOutput::rotate() {
|
||||
_stream = fopen(_file_name, FileOpenMode);
|
||||
if (_stream == NULL) {
|
||||
jio_fprintf(defaultStream::error_stream(), "Could not reopen file '%s' during log rotation (%s).\n",
|
||||
_file_name, strerror(errno));
|
||||
_file_name, os::strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ bool FileMapInfo::open_for_read() {
|
||||
fail_continue("Specified shared archive not found.");
|
||||
} else {
|
||||
fail_continue("Failed to open shared archive file (%s).",
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -393,7 +393,7 @@ void FileMapInfo::open_for_write() {
|
||||
int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444);
|
||||
if (fd < 0) {
|
||||
fail_stop("Unable to create shared archive file %s: (%s).", _full_path,
|
||||
strerror(errno));
|
||||
os::strerror(errno));
|
||||
}
|
||||
_fd = fd;
|
||||
_file_offset = 0;
|
||||
|
@ -213,6 +213,16 @@ class BoolObjectClosure : public Closure {
|
||||
virtual bool do_object_b(oop obj) = 0;
|
||||
};
|
||||
|
||||
class AlwaysTrueClosure: public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop p) { return true; }
|
||||
};
|
||||
|
||||
class AlwaysFalseClosure : public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop p) { return false; }
|
||||
};
|
||||
|
||||
// Applies an oop closure to all ref fields in objects iterated over in an
|
||||
// object iteration.
|
||||
class ObjectToOopClosure: public ObjectClosure {
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "jvmtifiles/jvmtiEnv.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
#include "memory/metaspaceShared.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "oops/constantPool.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
@ -711,11 +712,6 @@ WB_ENTRY(jint, WB_MatchesMethod(JNIEnv* env, jobject o, jobject method, jstring
|
||||
return result;
|
||||
WB_END
|
||||
|
||||
class AlwaysFalseClosure : public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop p) { return false; }
|
||||
};
|
||||
|
||||
static AlwaysFalseClosure always_false;
|
||||
|
||||
WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
|
||||
|
@ -1466,9 +1466,6 @@ public:
|
||||
develop(bool, TraceCompiledIC, false, \
|
||||
"Trace changes of compiled IC") \
|
||||
\
|
||||
develop(bool, TraceClearedExceptions, false, \
|
||||
"Print when an exception is forcibly cleared") \
|
||||
\
|
||||
/* gc */ \
|
||||
\
|
||||
product(bool, UseSerialGC, false, \
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "runtime/jniHandles.hpp"
|
||||
@ -128,6 +129,12 @@ void JNIHandles::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
|
||||
}
|
||||
|
||||
|
||||
void JNIHandles::weak_oops_do(OopClosure* f) {
|
||||
AlwaysTrueClosure always_true;
|
||||
weak_oops_do(&always_true, f);
|
||||
}
|
||||
|
||||
|
||||
void JNIHandles::initialize() {
|
||||
_global_handles = JNIHandleBlock::allocate_block();
|
||||
_weak_global_handles = JNIHandleBlock::allocate_block();
|
||||
@ -185,11 +192,6 @@ long JNIHandles::weak_global_handle_memory_usage() {
|
||||
}
|
||||
|
||||
|
||||
class AlwaysAliveClosure: public BoolObjectClosure {
|
||||
public:
|
||||
bool do_object_b(oop obj) { return true; }
|
||||
};
|
||||
|
||||
class CountHandleClosure: public OopClosure {
|
||||
private:
|
||||
int _count;
|
||||
@ -211,9 +213,8 @@ void JNIHandles::print_on(outputStream* st) {
|
||||
"JNIHandles not initialized");
|
||||
|
||||
CountHandleClosure global_handle_count;
|
||||
AlwaysAliveClosure always_alive;
|
||||
oops_do(&global_handle_count);
|
||||
weak_oops_do(&always_alive, &global_handle_count);
|
||||
weak_oops_do(&global_handle_count);
|
||||
|
||||
st->print_cr("JNI global references: %d", global_handle_count.count());
|
||||
st->cr();
|
||||
@ -230,10 +231,9 @@ public:
|
||||
|
||||
void JNIHandles::verify() {
|
||||
VerifyHandleClosure verify_handle;
|
||||
AlwaysAliveClosure always_alive;
|
||||
|
||||
oops_do(&verify_handle);
|
||||
weak_oops_do(&always_alive, &verify_handle);
|
||||
weak_oops_do(&verify_handle);
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,6 +86,8 @@ class JNIHandles : AllStatic {
|
||||
static void oops_do(OopClosure* f);
|
||||
// Traversal of weak global handles. Unreachable oops are cleared.
|
||||
static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
|
||||
// Traversal of weak global handles.
|
||||
static void weak_oops_do(OopClosure* f);
|
||||
};
|
||||
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "utilities/events.hpp"
|
||||
|
||||
# include <signal.h>
|
||||
# include <errno.h>
|
||||
|
||||
OSThread* os::_starting_thread = NULL;
|
||||
address os::_polling_page = NULL;
|
||||
@ -1427,6 +1428,131 @@ size_t os::page_size_for_region_unaligned(size_t region_size, size_t min_pages)
|
||||
return page_size_for_region(region_size, min_pages, false);
|
||||
}
|
||||
|
||||
static const char* errno_to_string (int e, bool short_text) {
|
||||
#define ALL_SHARED_ENUMS(X) \
|
||||
X(E2BIG, "Argument list too long") \
|
||||
X(EACCES, "Permission denied") \
|
||||
X(EADDRINUSE, "Address in use") \
|
||||
X(EADDRNOTAVAIL, "Address not available") \
|
||||
X(EAFNOSUPPORT, "Address family not supported") \
|
||||
X(EAGAIN, "Resource unavailable, try again") \
|
||||
X(EALREADY, "Connection already in progress") \
|
||||
X(EBADF, "Bad file descriptor") \
|
||||
X(EBADMSG, "Bad message") \
|
||||
X(EBUSY, "Device or resource busy") \
|
||||
X(ECANCELED, "Operation canceled") \
|
||||
X(ECHILD, "No child processes") \
|
||||
X(ECONNABORTED, "Connection aborted") \
|
||||
X(ECONNREFUSED, "Connection refused") \
|
||||
X(ECONNRESET, "Connection reset") \
|
||||
X(EDEADLK, "Resource deadlock would occur") \
|
||||
X(EDESTADDRREQ, "Destination address required") \
|
||||
X(EDOM, "Mathematics argument out of domain of function") \
|
||||
X(EEXIST, "File exists") \
|
||||
X(EFAULT, "Bad address") \
|
||||
X(EFBIG, "File too large") \
|
||||
X(EHOSTUNREACH, "Host is unreachable") \
|
||||
X(EIDRM, "Identifier removed") \
|
||||
X(EILSEQ, "Illegal byte sequence") \
|
||||
X(EINPROGRESS, "Operation in progress") \
|
||||
X(EINTR, "Interrupted function") \
|
||||
X(EINVAL, "Invalid argument") \
|
||||
X(EIO, "I/O error") \
|
||||
X(EISCONN, "Socket is connected") \
|
||||
X(EISDIR, "Is a directory") \
|
||||
X(ELOOP, "Too many levels of symbolic links") \
|
||||
X(EMFILE, "Too many open files") \
|
||||
X(EMLINK, "Too many links") \
|
||||
X(EMSGSIZE, "Message too large") \
|
||||
X(ENAMETOOLONG, "Filename too long") \
|
||||
X(ENETDOWN, "Network is down") \
|
||||
X(ENETRESET, "Connection aborted by network") \
|
||||
X(ENETUNREACH, "Network unreachable") \
|
||||
X(ENFILE, "Too many files open in system") \
|
||||
X(ENOBUFS, "No buffer space available") \
|
||||
X(ENODATA, "No message is available on the STREAM head read queue") \
|
||||
X(ENODEV, "No such device") \
|
||||
X(ENOENT, "No such file or directory") \
|
||||
X(ENOEXEC, "Executable file format error") \
|
||||
X(ENOLCK, "No locks available") \
|
||||
X(ENOLINK, "Reserved") \
|
||||
X(ENOMEM, "Not enough space") \
|
||||
X(ENOMSG, "No message of the desired type") \
|
||||
X(ENOPROTOOPT, "Protocol not available") \
|
||||
X(ENOSPC, "No space left on device") \
|
||||
X(ENOSR, "No STREAM resources") \
|
||||
X(ENOSTR, "Not a STREAM") \
|
||||
X(ENOSYS, "Function not supported") \
|
||||
X(ENOTCONN, "The socket is not connected") \
|
||||
X(ENOTDIR, "Not a directory") \
|
||||
X(ENOTEMPTY, "Directory not empty") \
|
||||
X(ENOTSOCK, "Not a socket") \
|
||||
X(ENOTSUP, "Not supported") \
|
||||
X(ENOTTY, "Inappropriate I/O control operation") \
|
||||
X(ENXIO, "No such device or address") \
|
||||
X(EOPNOTSUPP, "Operation not supported on socket") \
|
||||
X(EOVERFLOW, "Value too large to be stored in data type") \
|
||||
X(EPERM, "Operation not permitted") \
|
||||
X(EPIPE, "Broken pipe") \
|
||||
X(EPROTO, "Protocol error") \
|
||||
X(EPROTONOSUPPORT, "Protocol not supported") \
|
||||
X(EPROTOTYPE, "Protocol wrong type for socket") \
|
||||
X(ERANGE, "Result too large") \
|
||||
X(EROFS, "Read-only file system") \
|
||||
X(ESPIPE, "Invalid seek") \
|
||||
X(ESRCH, "No such process") \
|
||||
X(ETIME, "Stream ioctl() timeout") \
|
||||
X(ETIMEDOUT, "Connection timed out") \
|
||||
X(ETXTBSY, "Text file busy") \
|
||||
X(EWOULDBLOCK, "Operation would block") \
|
||||
X(EXDEV, "Cross-device link")
|
||||
|
||||
#define DEFINE_ENTRY(e, text) { e, #e, text },
|
||||
|
||||
static const struct {
|
||||
int v;
|
||||
const char* short_text;
|
||||
const char* long_text;
|
||||
} table [] = {
|
||||
|
||||
ALL_SHARED_ENUMS(DEFINE_ENTRY)
|
||||
|
||||
// The following enums are not defined on all platforms.
|
||||
#ifdef ESTALE
|
||||
DEFINE_ENTRY(ESTALE, "Reserved")
|
||||
#endif
|
||||
#ifdef EDQUOT
|
||||
DEFINE_ENTRY(EDQUOT, "Reserved")
|
||||
#endif
|
||||
#ifdef EMULTIHOP
|
||||
DEFINE_ENTRY(EMULTIHOP, "Reserved")
|
||||
#endif
|
||||
|
||||
// End marker.
|
||||
{ -1, "Unknown errno", "Unknown error" }
|
||||
|
||||
};
|
||||
|
||||
#undef DEFINE_ENTRY
|
||||
#undef ALL_FLAGS
|
||||
|
||||
int i = 0;
|
||||
while (table[i].v != -1 && table[i].v != e) {
|
||||
i ++;
|
||||
}
|
||||
|
||||
return short_text ? table[i].short_text : table[i].long_text;
|
||||
|
||||
}
|
||||
|
||||
const char* os::strerror(int e) {
|
||||
return errno_to_string(e, false);
|
||||
}
|
||||
|
||||
const char* os::errno_name(int e) {
|
||||
return errno_to_string(e, true);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void os::trace_page_sizes(const char* str, const size_t* page_sizes, int count)
|
||||
{
|
||||
|
@ -617,6 +617,22 @@ class os: AllStatic {
|
||||
static size_t lasterror(char *buf, size_t len);
|
||||
static int get_last_error();
|
||||
|
||||
// Replacement for strerror().
|
||||
// Will return the english description of the error (e.g. "File not found", as
|
||||
// suggested in the POSIX standard.
|
||||
// Will return "Unknown error" for an unknown errno value.
|
||||
// Will not attempt to localize the returned string.
|
||||
// Will always return a valid string which is a static constant.
|
||||
// Will not change the value of errno.
|
||||
static const char* strerror(int e);
|
||||
|
||||
// Will return the literalized version of the given errno (e.g. "EINVAL"
|
||||
// for EINVAL).
|
||||
// Will return "Unknown error" for an unknown errno value.
|
||||
// Will always return a valid string which is a static constant.
|
||||
// Will not change the value of errno.
|
||||
static const char* errno_name(int e);
|
||||
|
||||
// Determines whether the calling process is being debugged by a user-mode debugger.
|
||||
static bool is_debugger_attached();
|
||||
|
||||
|
@ -459,7 +459,7 @@ DumpWriter::DumpWriter(const char* path) {
|
||||
|
||||
// if the open failed we record the error
|
||||
if (_fd < 0) {
|
||||
_error = (char*)os::strdup(strerror(errno));
|
||||
_error = (char*)os::strdup(os::strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ void DumpWriter::write_internal(void* s, size_t len) {
|
||||
|
||||
if (n < 0) {
|
||||
// EINTR cannot happen here, os::write will take care of that
|
||||
set_error(strerror(errno));
|
||||
set_error(os::strerror(errno));
|
||||
os::close(file_descriptor());
|
||||
set_file_descriptor(-1);
|
||||
return;
|
||||
|
@ -224,6 +224,11 @@ void report_vm_error(const char* file, int line, const char* error_msg, const ch
|
||||
va_end(detail_args);
|
||||
}
|
||||
|
||||
void report_vm_status_error(const char* file, int line, const char* error_msg,
|
||||
int status, const char* detail) {
|
||||
report_vm_error(file, line, error_msg, "error %s(%d), %s", os::errno_name(status), status, detail);
|
||||
}
|
||||
|
||||
void report_fatal(const char* file, int line, const char* detail_fmt, ...)
|
||||
{
|
||||
if (Debugging || error_is_suppressed(file, line)) return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -137,7 +137,13 @@ do { \
|
||||
// an extra arg and use strerror to convert it to a meaningful string
|
||||
// like "Invalid argument", "out of memory" etc
|
||||
#define vmassert_status(p, status, msg) \
|
||||
vmassert(p, "error %s(%d), %s", strerror(status), status, msg)
|
||||
do { \
|
||||
if (!(p)) { \
|
||||
report_vm_status_error(__FILE__, __LINE__, "assert(" #p ") failed", \
|
||||
status, msg); \
|
||||
BREAKPOINT; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// For backward compatibility.
|
||||
#define assert_status(p, status, msg) vmassert_status(p, status, msg)
|
||||
@ -209,6 +215,8 @@ void report_vm_error(const char* file, int line, const char* error_msg,
|
||||
void report_vm_error(const char* file, int line, const char* error_msg,
|
||||
const char* detail_fmt, ...);
|
||||
#endif
|
||||
void report_vm_status_error(const char* file, int line, const char* error_msg,
|
||||
int status, const char* detail);
|
||||
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
|
||||
void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
|
||||
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
|
||||
|
@ -52,11 +52,11 @@ void ThreadShadow::set_pending_exception(oop exception, const char* file, int li
|
||||
}
|
||||
|
||||
void ThreadShadow::clear_pending_exception() {
|
||||
if (TraceClearedExceptions) {
|
||||
if (_pending_exception != NULL) {
|
||||
tty->print_cr("Thread::clear_pending_exception: cleared exception:");
|
||||
_pending_exception->print();
|
||||
}
|
||||
if (_pending_exception != NULL && log_is_enabled(Debug, exceptions)) {
|
||||
ResourceMark rm;
|
||||
outputStream* logst = LogHandle(exceptions)::debug_stream();
|
||||
logst->print("Thread::clear_pending_exception: cleared exception:");
|
||||
_pending_exception->print_on(logst);
|
||||
}
|
||||
_pending_exception = NULL;
|
||||
_exception_file = NULL;
|
||||
|
@ -69,6 +69,7 @@ void InternalVMTests::run() {
|
||||
run_unit_test(JSON_test);
|
||||
run_unit_test(Test_log_length);
|
||||
run_unit_test(Test_configure_stdout);
|
||||
run_unit_test(Test_logconfiguration_subscribe);
|
||||
run_unit_test(DirectivesParser_test);
|
||||
run_unit_test(Test_TempNewSymbol);
|
||||
#if INCLUDE_VM_STRUCTS
|
||||
|
@ -504,7 +504,7 @@ fileStream::fileStream(const char* file_name) {
|
||||
if (_file != NULL) {
|
||||
_need_close = true;
|
||||
} else {
|
||||
warning("Cannot open file %s due to %s\n", file_name, strerror(errno));
|
||||
warning("Cannot open file %s due to %s\n", file_name, os::strerror(errno));
|
||||
_need_close = false;
|
||||
}
|
||||
}
|
||||
@ -514,7 +514,7 @@ fileStream::fileStream(const char* file_name, const char* opentype) {
|
||||
if (_file != NULL) {
|
||||
_need_close = true;
|
||||
} else {
|
||||
warning("Cannot open file %s due to %s\n", file_name, strerror(errno));
|
||||
warning("Cannot open file %s due to %s\n", file_name, os::strerror(errno));
|
||||
_need_close = false;
|
||||
}
|
||||
}
|
||||
|
@ -1260,8 +1260,9 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
|
||||
out.print_raw("#\n# Compiler replay data is saved as:\n# ");
|
||||
out.print_raw_cr(buffer);
|
||||
} else {
|
||||
int e = errno;
|
||||
out.print_raw("#\n# Can't open file to dump replay data. Error: ");
|
||||
out.print_raw_cr(strerror(os::get_last_error()));
|
||||
out.print_raw_cr(os::strerror(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1301,7 +1302,8 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
|
||||
out.print_raw_cr("\" ...");
|
||||
|
||||
if (os::fork_and_exec(cmd) < 0) {
|
||||
out.print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
|
||||
out.print_cr("os::fork_and_exec failed: %s (%s=%d)",
|
||||
os::strerror(errno), os::errno_name(errno), errno);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1359,7 +1361,8 @@ void VM_ReportJavaOutOfMemory::doit() {
|
||||
tty->print_cr("\"%s\"...", cmd);
|
||||
|
||||
if (os::fork_and_exec(cmd) < 0) {
|
||||
tty->print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
|
||||
tty->print_cr("os::fork_and_exec failed: %s (%s=%d)",
|
||||
os::strerror(errno), os::errno_name(errno), errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,9 +27,9 @@
|
||||
* @bug 8068582
|
||||
* @key gc
|
||||
* @library /testlibrary
|
||||
* @requires vm.gc=="null"
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @ignore 8148239
|
||||
* @run driver TestSelectDefaultGC
|
||||
*/
|
||||
|
||||
@ -41,24 +41,40 @@ public class TestSelectDefaultGC {
|
||||
output.shouldMatch(" " + option + " .*=.* " + value + " ");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
public static void testDefaultGC(boolean actAsServer) throws Exception {
|
||||
String[] args = new String[] {
|
||||
"-XX:" + (actAsServer ? "+" : "-") + "AlwaysActAsServerClassMachine",
|
||||
"-XX:" + (actAsServer ? "-" : "+") + "NeverActAsServerClassMachine",
|
||||
"-XX:+PrintFlagsFinal",
|
||||
"-version"
|
||||
};
|
||||
|
||||
// Start VM without specifying GC
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintFlagsFinal", "-version");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
boolean isServerVM = Platform.isServer();
|
||||
boolean isEmbeddedVM = Platform.isEmbedded();
|
||||
final boolean isServer = actAsServer;
|
||||
final boolean isEmbedded = Platform.isEmbedded();
|
||||
|
||||
// Verify GC selection
|
||||
// G1 is default for non-embedded server VMs
|
||||
assertVMOption(output, "UseG1GC", isServerVM && !isEmbeddedVM);
|
||||
// Parallel is default for embedded server VMs
|
||||
assertVMOption(output, "UseParallelGC", isServerVM && isEmbeddedVM);
|
||||
assertVMOption(output, "UseParallelOldGC", isServerVM && isEmbeddedVM);
|
||||
// Serial is default for non-server VMs
|
||||
assertVMOption(output, "UseSerialGC", !isServerVM);
|
||||
// G1 is default for non-embedded server class machines
|
||||
assertVMOption(output, "UseG1GC", isServer && !isEmbedded);
|
||||
// Parallel is default for embedded server class machines
|
||||
assertVMOption(output, "UseParallelGC", isServer && isEmbedded);
|
||||
assertVMOption(output, "UseParallelOldGC", isServer && isEmbedded);
|
||||
// Serial is default for non-server class machines
|
||||
assertVMOption(output, "UseSerialGC", !isServer);
|
||||
// CMS is never default
|
||||
assertVMOption(output, "UseConcMarkSweepGC", false);
|
||||
assertVMOption(output, "UseParNewGC", false);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// Test server class machine
|
||||
testDefaultGC(false);
|
||||
|
||||
// Test non-server class machine
|
||||
testDefaultGC(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user