changeset 9387:99d0f81c93dd

8034025: Remove JPLIS agent dependency on canonicalize_md.c Reviewed-by: alanb
author sla
date Fri, 07 Mar 2014 09:18:15 +0100
parents 627deed79b59
children 0815c5f7d001
files make/lib/ServiceabilityLibraries.gmk src/share/instrument/FileSystemSupport.h src/share/instrument/InvocationAdapter.c src/share/native/common/jni_util.c
diffstat 4 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/make/lib/ServiceabilityLibraries.gmk	Thu Mar 06 14:26:26 2014 -0800
+++ b/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/src/share/instrument/FileSystemSupport.h	Thu Mar 06 14:26:26 2014 -0800
+++ b/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/src/share/instrument/InvocationAdapter.c	Thu Mar 06 14:26:26 2014 -0800
+++ b/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/src/share/native/common/jni_util.c	Thu Mar 06 14:26:26 2014 -0800
+++ b/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);