提交 f08dfedb 编写于 作者: S sla

7132199: sun/management/jmxremote/bootstrap/JvmstatCountersTest.java failing on all platforms

Summary: Make sure HotSpot and JDK looks for well-known files in the same location
Reviewed-by: dholmes, dsamersoff
上级 0aac167d
...@@ -37,8 +37,12 @@ import java.util.Properties; ...@@ -37,8 +37,12 @@ import java.util.Properties;
* Linux implementation of HotSpotVirtualMachine * Linux implementation of HotSpotVirtualMachine
*/ */
public class LinuxVirtualMachine extends HotSpotVirtualMachine { public class LinuxVirtualMachine extends HotSpotVirtualMachine {
// temp directory for socket file // "/tmp" is used as a global well-known location for the files
private static final String tmpdir = System.getProperty("java.io.tmpdir"); // .java_pid<pid>. and .attach_pid<pid>. It is important that this
// location is the same for all processes, otherwise the tools
// will not be able to find all Hotspot processes.
// Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir = "/tmp";
// Indicates if this machine uses the old LinuxThreads // Indicates if this machine uses the old LinuxThreads
static boolean isLinuxThreads; static boolean isLinuxThreads;
...@@ -261,20 +265,12 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine { ...@@ -261,20 +265,12 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine {
} }
// Return the socket file for the given process. // Return the socket file for the given process.
// Checks working directory of process for .java_pid<pid>. If not
// found it looks in temp directory.
private String findSocketFile(int pid) { private String findSocketFile(int pid) {
// First check for a .java_pid<pid> file in the working directory File f = new File(tmpdir, ".java_pid" + pid);
// of the target process
String fn = ".java_pid" + pid;
String path = "/proc/" + pid + "/cwd/" + fn;
File f = new File(path);
if (!f.exists()) { if (!f.exists()) {
// Not found, so try temp directory return null;
f = new File(tmpdir, fn);
path = f.exists() ? f.getPath() : null;
} }
return path; return f.getPath();
} }
// On Solaris/Linux a simple handshake is used to start the attach mechanism // On Solaris/Linux a simple handshake is used to start the attach mechanism
......
...@@ -38,11 +38,12 @@ import java.util.Properties; ...@@ -38,11 +38,12 @@ import java.util.Properties;
* Solaris implementation of HotSpotVirtualMachine. * Solaris implementation of HotSpotVirtualMachine.
*/ */
public class SolarisVirtualMachine extends HotSpotVirtualMachine { public class SolarisVirtualMachine extends HotSpotVirtualMachine {
// Use /tmp instead of /var/tmp on Solaris as /tmp is the default used by // "/tmp" is used as a global well-known location for the files
// HotSpot when the property is not set on the command line. // .java_pid<pid>. and .attach_pid<pid>. It is important that this
private static final String tmpdir1 = System.getProperty("java.io.tmpdir"); // location is the same for all processes, otherwise the tools
private static final String tmpdir = // will not be able to find all Hotspot processes.
(tmpdir1.equals("/var/tmp") || tmpdir1.equals("/var/tmp/")) ? "/tmp" : tmpdir1; // Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir = "/tmp";
// door descriptor; // door descriptor;
private int fd = -1; private int fd = -1;
...@@ -191,19 +192,10 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine { ...@@ -191,19 +192,10 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine {
} }
} }
// The door is attached to .java_pid<pid> in the target VM's working // The door is attached to .java_pid<pid> in the temporary directory.
// directory or temporary directory.
private int openDoor(int pid) throws IOException { private int openDoor(int pid) throws IOException {
// First check for a .java_pid<pid> file in the working directory String path = tmpdir + "/.java_pid" + pid;;
// of the target process fd = open(path);
String fn = ".java_pid" + pid;
String path = "/proc/" + pid + "/cwd/" + fn;
try {
fd = open(path);
} catch (FileNotFoundException fnf) {
path = tmpdir + "/" + fn;
fd = open(path);
}
// Check that the file owner/permission to avoid attaching to // Check that the file owner/permission to avoid attaching to
// bogus process // bogus process
......
...@@ -284,9 +284,6 @@ sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh generic-all ...@@ -284,9 +284,6 @@ sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh generic-all
# Windows X64, java.lang.IllegalStateException # Windows X64, java.lang.IllegalStateException
javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all
# 7132199
sun/management/jmxremote/bootstrap/JvmstatCountersTest.java generic-all
############################################################################ ############################################################################
# jdk_math # jdk_math
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册