hotspot/src/share/vm/prims/jvm.cpp
changeset 24242 73337a12595a
parent 23999 22eb7be3d99d
child 24426 0a69c8cdfca9
child 24351 61b33cc6d3cf
--- a/hotspot/src/share/vm/prims/jvm.cpp	Fri Apr 25 10:08:04 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Mon Apr 28 09:27:47 2014 +0200
@@ -386,6 +386,23 @@
 JVM_END
 
 
+/*
+ * Return the temporary directory that the VM uses for the attach
+ * and perf data files.
+ *
+ * It is important that this directory is well-known and the
+ * same for all VM instances. It cannot be affected by configuration
+ * variables such as java.io.tmpdir.
+ */
+JVM_ENTRY(jstring, JVM_GetTemporaryDirectory(JNIEnv *env))
+  JVMWrapper("JVM_GetTemporaryDirectory");
+  HandleMark hm(THREAD);
+  const char* temp_dir = os::get_temp_directory();
+  Handle h = java_lang_String::create_from_platform_dependent_str(temp_dir, CHECK_NULL);
+  return (jstring) JNIHandles::make_local(env, h());
+JVM_END
+
+
 // java.lang.Runtime /////////////////////////////////////////////////////////////////////////
 
 extern volatile jint vm_created;