8034025: Remove JPLIS agent dependency on canonicalize_md.c
authorsla
Fri, 07 Mar 2014 09:18:15 +0100
changeset 23235 d1b1878b2eaa
parent 23141 099891b1d86f
child 23236 7c5997f59e20
8034025: Remove JPLIS agent dependency on canonicalize_md.c Reviewed-by: alanb
jdk/make/lib/ServiceabilityLibraries.gmk
jdk/src/share/instrument/FileSystemSupport.h
jdk/src/share/instrument/InvocationAdapter.c
jdk/src/share/native/common/jni_util.c
--- a/jdk/make/lib/ServiceabilityLibraries.gmk	Wed Jul 05 19:32:12 2017 +0200
+++ b/jdk/make/lib/ServiceabilityLibraries.gmk	Fri Mar 07 09:18:15 2014 +0100
@@ -203,7 +203,6 @@
 ##########################################################################################
 
 LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/share/instrument \
-    $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
 
 LIBINSTRUMENT_FILES := \
@@ -218,9 +217,8 @@
     JavaExceptions.c \
     PathCharsValidator.c \
     Reentrancy.c \
-    Utilities.c \
-    canonicalize_md.c
-
+    Utilities.c
+    
 LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument
 LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
     -I$(JDK_TOPDIR)/src/share/instrument \
@@ -239,6 +237,8 @@
   LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
   # equivalent of strcasecmp is stricmp on Windows
   LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
+else
+  LIBINSTRUMENT_LDFLAGS_SUFFIX := -ljava
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
--- a/jdk/src/share/instrument/FileSystemSupport.h	Wed Jul 05 19:32:12 2017 +0200
+++ b/jdk/src/share/instrument/FileSystemSupport.h	Fri Mar 07 09:18:15 2014 +0100
@@ -65,9 +65,3 @@
  * Resolve the child pathname string against the parent.
  */
 char* resolve(const char* parent, const char* child);
-
-/**
- * Convert a pathname to canonical form.
- * -- compiled in from src/<platform>/native/java/io/canonicalize_md.c
- */
-int canonicalize(char *original, char *resolved, int len);
--- a/jdk/src/share/instrument/InvocationAdapter.c	Wed Jul 05 19:32:12 2017 +0200
+++ b/jdk/src/share/instrument/InvocationAdapter.c	Fri Mar 07 09:18:15 2014 +0100
@@ -669,6 +669,13 @@
     jplis_assert((void*)res != (void*)NULL);     \
 }
 
+/**
+ * Convert a pathname to canonical form.
+ * This method is exported from libjava.
+ */
+extern int
+Canonicalize(JNIEnv *unused, char *orig, char *out, int len);
+
 
 /*
  * This function takes the value of the Boot-Class-Path attribute,
@@ -790,7 +797,8 @@
             char* resolved;
 
             if (!haveBasePath) {
-                if (canonicalize((char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {
+                /* Use NULL as the JNIEnv since we know that Canonicalize does not use it. */
+                if (Canonicalize(NULL, (char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {
                     fprintf(stderr, "WARNING: unable to canonicalize %s\n", jarfile);
                     free(path);
                     continue;
--- a/jdk/src/share/native/common/jni_util.c	Wed Jul 05 19:32:12 2017 +0200
+++ b/jdk/src/share/native/common/jni_util.c	Fri Mar 07 09:18:15 2014 +0100
@@ -834,12 +834,12 @@
 /*
  * Export the platform dependent path canonicalization so that
  * VM can find it when loading system classes.
- *
+ * This function is also used by the instrumentation agent.
  */
 extern int canonicalize(char *path, const char *out, int len);
 
 JNIEXPORT int
-Canonicalize(JNIEnv *env, char *orig, char *out, int len)
+Canonicalize(JNIEnv *unused, char *orig, char *out, int len)
 {
     /* canonicalize an already natived path */
     return canonicalize(orig, out, len);