jdk/src/java.base/unix/native/libjli/java_md_solinux.c
changeset 42753 40f61533b93d
parent 40945 f241705723ea
child 42759 0ff64a5b3824
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Thu Nov 24 12:04:44 2016 +0530
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Mon Dec 05 17:56:20 2016 +0100
@@ -52,9 +52,6 @@
 #endif
 
 #ifdef __solaris__
-#  ifndef LIBARCHNAME
-#    error "The macro LIBARCHNAME was not defined on the compile line"
-#  endif
 #  include <sys/systeminfo.h>
 #  include <sys/elf.h>
 #  include <stdio.h>
@@ -188,12 +185,13 @@
     return JNI_FALSE;
 }
 /*
- * contains a lib/$LIBARCHNAME/{server,client}/libjvm.so ?
+ * contains a lib/{server,client}/libjvm.so ?
  */
 static jboolean
 ContainsLibJVM(const char *env) {
-    char clientPattern[PATH_MAX + 1];
-    char serverPattern[PATH_MAX + 1];
+    /* the usual suspects */
+    char clientPattern[] = "lib/client";
+    char serverPattern[] = "lib/server";
     char *envpath;
     char *path;
     jboolean clientPatternFound;
@@ -204,10 +202,6 @@
         return JNI_FALSE;
     }
 
-    /* the usual suspects */
-    JLI_Snprintf(clientPattern, PATH_MAX, "lib/%s/client", LIBARCHNAME);
-    JLI_Snprintf(serverPattern, PATH_MAX, "lib/%s/server", LIBARCHNAME);
-
     /* to optimize for time, test if any of our usual suspects are present. */
     clientPatternFound = JLI_StrStr(env, clientPattern) != NULL;
     serverPatternFound = JLI_StrStr(env, serverPattern) != NULL;
@@ -322,7 +316,6 @@
 
     /* Check data model flags, and exec process, if needed */
     {
-      char *arch        = LIBARCHNAME; /* like sparc or sparcv9 */
       char * jvmtype    = NULL;
       int  argc         = *pargc;
       char **argv       = *pargv;
@@ -408,12 +401,12 @@
          jvmpath does not exist */
       if (wanted == running) {
         /* Find out where the JRE is that we will be using. */
-        if (!GetJREPath(jrepath, so_jrepath, arch, JNI_FALSE) ) {
+        if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) {
           JLI_ReportErrorMessage(JRE_ERROR1);
           exit(2);
         }
-        JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
-                     jrepath, FILESEP, FILESEP,  arch, FILESEP);
+        JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%sjvm.cfg",
+                     jrepath, FILESEP, FILESEP, FILESEP);
         /* Find the specified JVM type */
         if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
           JLI_ReportErrorMessage(CFG_ERROR7);
@@ -427,7 +420,7 @@
             exit(4);
         }
 
-        if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, arch, 0 )) {
+        if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, 0 )) {
           JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
           exit(4);
         }
@@ -457,8 +450,8 @@
              * We will set the LD_LIBRARY_PATH as follows:
              *
              *     o          $JVMPATH (directory portion only)
-             *     o          $JRE/lib/$LIBARCHNAME
-             *     o          $JRE/../lib/$LIBARCHNAME
+             *     o          $JRE/lib
+             *     o          $JRE/../lib
              *
              * followed by the user's previous effective LD_LIBRARY_PATH, if
              * any.
@@ -518,10 +511,10 @@
 
             jvmpath = JLI_StringDup(jvmpath);
             new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
-                    2 * JLI_StrLen(jrepath) + 2 * JLI_StrLen(arch) +
+                    2 * JLI_StrLen(jrepath) +
 #ifdef AIX
                     /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */
-                    JLI_StrLen(jrepath) + JLI_StrLen(arch) + JLI_StrLen("/lib//jli:") +
+                    JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") +
 #endif
                     JLI_StrLen(jvmpath) + 52;
             new_runpath = JLI_MemAlloc(new_runpath_size);
@@ -539,17 +532,17 @@
 
                 sprintf(new_runpath, LD_LIBRARY_PATH "="
                         "%s:"
-                        "%s/lib/%s:"
+                        "%s/lib:"
 #ifdef AIX
-                        "%s/lib/%s/jli:" /* Needed on AIX because ld doesn't support $ORIGIN. */
+                        "%s/lib/jli:" /* Needed on AIX because ld doesn't support $ORIGIN. */
 #endif
-                        "%s/../lib/%s",
+                        "%s/../lib",
                         jvmpath,
-                        jrepath, arch,
+                        jrepath,
 #ifdef AIX
-                        jrepath, arch,
+                        jrepath,
 #endif
-                        jrepath, arch
+                        jrepath
                         );
 
 
@@ -638,14 +631,14 @@
  */
 static jboolean
 GetJVMPath(const char *jrepath, const char *jvmtype,
-           char *jvmpath, jint jvmpathsize, const char * arch, int bitsWanted)
+           char *jvmpath, jint jvmpathsize, int bitsWanted)
 {
     struct stat s;
 
     if (JLI_StrChr(jvmtype, '/')) {
         JLI_Snprintf(jvmpath, jvmpathsize, "%s/" JVM_DLL, jvmtype);
     } else {
-        JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/%s/" JVM_DLL, jrepath, arch, jvmtype);
+        JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/" JVM_DLL, jrepath, jvmtype);
     }
 
     JLI_TraceLauncher("Does `%s' exist ... ", jvmpath);
@@ -663,14 +656,14 @@
  * Find path to JRE based on .exe's location or registry settings.
  */
 static jboolean
-GetJREPath(char *path, jint pathsize, const char * arch, jboolean speculative)
+GetJREPath(char *path, jint pathsize, jboolean speculative)
 {
     char libjava[MAXPATHLEN];
     struct stat s;
 
     if (GetApplicationHome(path, pathsize)) {
         /* Is JRE co-located with the application? */
-        JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/%s/" JAVA_DLL, path, arch);
+        JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/" JAVA_DLL, path);
         if (access(libjava, F_OK) == 0) {
             JLI_TraceLauncher("JRE path is %s\n", path);
             return JNI_TRUE;
@@ -681,7 +674,7 @@
             return JNI_FALSE;
         }
         /* Does the app ship a private JRE in <apphome>/jre directory? */
-        JLI_Snprintf(libjava, sizeof(libjava), "%s/jre/lib/%s/" JAVA_DLL, path, arch);
+        JLI_Snprintf(libjava, sizeof(libjava), "%s/jre/lib/" JAVA_DLL, path);
         if (access(libjava, F_OK) == 0) {
             JLI_StrCat(path, "/jre");
             JLI_TraceLauncher("JRE path is %s\n", path);
@@ -690,7 +683,7 @@
     }
 
     if (GetApplicationHomeFromDll(path, pathsize)) {
-        JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/%s/" JAVA_DLL, path, arch);
+        JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/" JAVA_DLL, path);
         if (stat(libjava, &s) == 0) {
             JLI_TraceLauncher("JRE path is %s\n", path);
             return JNI_TRUE;
@@ -856,12 +849,12 @@
         char jrePath[MAXPATHLEN];
         char splashPath[MAXPATHLEN];
 
-        if (!GetJREPath(jrePath, sizeof(jrePath), LIBARCHNAME, JNI_FALSE)) {
+        if (!GetJREPath(jrePath, sizeof(jrePath), JNI_FALSE)) {
             JLI_ReportErrorMessage(JRE_ERROR1);
             return NULL;
         }
-        ret = JLI_Snprintf(splashPath, sizeof(splashPath), "%s/lib/%s/%s",
-                     jrePath, LIBARCHNAME, SPLASHSCREEN_SO);
+        ret = JLI_Snprintf(splashPath, sizeof(splashPath), "%s/lib/%s",
+                     jrePath, SPLASHSCREEN_SO);
 
         if (ret >= (int) sizeof(splashPath)) {
             JLI_ReportErrorMessage(JRE_ERROR11);