diff --git a/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java b/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java index 632089e2fae3f742151c2801798c1084c16bc21e..4bf55cdf41e3d3a4c0c52a342ccea6b01670f234 100644 --- a/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java +++ b/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java @@ -37,8 +37,12 @@ import java.util.Properties; * Linux implementation of HotSpotVirtualMachine */ public class LinuxVirtualMachine extends HotSpotVirtualMachine { - // temp directory for socket file - private static final String tmpdir = System.getProperty("java.io.tmpdir"); + // "/tmp" is used as a global well-known location for the files + // .java_pid. and .attach_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 static boolean isLinuxThreads; @@ -261,20 +265,12 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine { } // Return the socket file for the given process. - // Checks working directory of process for .java_pid. If not - // found it looks in temp directory. private String findSocketFile(int pid) { - // First check for a .java_pid file in the working directory - // of the target process - String fn = ".java_pid" + pid; - String path = "/proc/" + pid + "/cwd/" + fn; - File f = new File(path); + File f = new File(tmpdir, ".java_pid" + pid); if (!f.exists()) { - // Not found, so try temp directory - f = new File(tmpdir, fn); - path = f.exists() ? f.getPath() : null; + return null; } - return path; + return f.getPath(); } // On Solaris/Linux a simple handshake is used to start the attach mechanism diff --git a/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java b/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java index d40f8a709ab3e4c8cbaefefe8f6aff9d8d547fc8..cb8a3f16a3f6ecb30f5be28853a2e2d4d75a52f0 100644 --- a/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java +++ b/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java @@ -38,11 +38,12 @@ import java.util.Properties; * Solaris implementation of HotSpotVirtualMachine. */ public class SolarisVirtualMachine extends HotSpotVirtualMachine { - // Use /tmp instead of /var/tmp on Solaris as /tmp is the default used by - // HotSpot when the property is not set on the command line. - private static final String tmpdir1 = System.getProperty("java.io.tmpdir"); - private static final String tmpdir = - (tmpdir1.equals("/var/tmp") || tmpdir1.equals("/var/tmp/")) ? "/tmp" : tmpdir1; + // "/tmp" is used as a global well-known location for the files + // .java_pid. and .attach_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"; // door descriptor; private int fd = -1; @@ -191,19 +192,10 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine { } } - // The door is attached to .java_pid in the target VM's working - // directory or temporary directory. + // The door is attached to .java_pid in the temporary directory. private int openDoor(int pid) throws IOException { - // First check for a .java_pid file in the working directory - // of the target process - String fn = ".java_pid" + pid; - String path = "/proc/" + pid + "/cwd/" + fn; - try { - fd = open(path); - } catch (FileNotFoundException fnf) { - path = tmpdir + "/" + fn; - fd = open(path); - } + String path = tmpdir + "/.java_pid" + pid;; + fd = open(path); // Check that the file owner/permission to avoid attaching to // bogus process diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 9eaacd91547d2d6ba0e8a0743ea24cc6e4558d95..7e59e1d21adfceddfc73394fa001582dca7fe180 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -284,9 +284,6 @@ sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh generic-all # Windows X64, java.lang.IllegalStateException javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all -# 7132199 -sun/management/jmxremote/bootstrap/JvmstatCountersTest.java generic-all - ############################################################################ # jdk_math