提交 1f926854 编写于 作者: C coleenp

7009828: Fix for 6938627 breaks visualvm monitoring when -Djava.io.tmpdir is defined

Summary: Change get_temp_directory() back to /tmp and %TEMP% like it always was and where the tools expect it to be.
Reviewed-by: phh, dcubed, kamg, alanb
上级 5ec82f18
...@@ -1610,10 +1610,9 @@ int os::current_process_id() { ...@@ -1610,10 +1610,9 @@ int os::current_process_id() {
const char* os::dll_file_extension() { return ".so"; } const char* os::dll_file_extension() { return ".so"; }
const char* os::get_temp_directory() { // This must be hard coded because it's the system's temporary
const char *prop = Arguments::get_property("java.io.tmpdir"); // directory not the java application's temp directory, ala java.io.tmpdir.
return prop == NULL ? "/tmp" : prop; const char* os::get_temp_directory() { return "/tmp"; }
}
static bool file_exists(const char* filename) { static bool file_exists(const char* filename) {
struct stat statbuf; struct stat statbuf;
......
...@@ -1884,10 +1884,9 @@ void os::set_error_file(const char *logfile) {} ...@@ -1884,10 +1884,9 @@ void os::set_error_file(const char *logfile) {}
const char* os::dll_file_extension() { return ".so"; } const char* os::dll_file_extension() { return ".so"; }
const char* os::get_temp_directory() { // This must be hard coded because it's the system's temporary
const char *prop = Arguments::get_property("java.io.tmpdir"); // directory not the java application's temp directory, ala java.io.tmpdir.
return prop == NULL ? "/tmp" : prop; const char* os::get_temp_directory() { return "/tmp"; }
}
static bool file_exists(const char* filename) { static bool file_exists(const char* filename) {
struct stat statbuf; struct stat statbuf;
......
...@@ -1044,9 +1044,9 @@ os::closedir(DIR *dirp) ...@@ -1044,9 +1044,9 @@ os::closedir(DIR *dirp)
return 0; return 0;
} }
// This must be hard coded because it's the system's temporary
// directory not the java application's temp directory, ala java.io.tmpdir.
const char* os::get_temp_directory() { const char* os::get_temp_directory() {
const char *prop = Arguments::get_property("java.io.tmpdir");
if (prop != 0) return prop;
static char path_buf[MAX_PATH]; static char path_buf[MAX_PATH];
if (GetTempPath(MAX_PATH, path_buf)>0) if (GetTempPath(MAX_PATH, path_buf)>0)
return path_buf; return path_buf;
......
...@@ -874,11 +874,13 @@ void VMError::report_and_die() { ...@@ -874,11 +874,13 @@ void VMError::report_and_die() {
} }
if (fd == -1) { if (fd == -1) {
// try temp directory
const char * tmpdir = os::get_temp_directory(); const char * tmpdir = os::get_temp_directory();
jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log", // try temp directory if it exists.
tmpdir, os::file_separator(), os::current_process_id()); if (tmpdir != NULL && tmpdir[0] != '\0') {
fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666); jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
tmpdir, os::file_separator(), os::current_process_id());
fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666);
}
} }
if (fd != -1) { if (fd != -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册