< prev index next >

jdk/src/java.base/unix/native/libjli/java_md_solinux.c

Print this page

        

@@ -50,13 +50,10 @@
 #ifndef SETENV_REQUIRED
 #define SETENV_REQUIRED
 #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>
 #endif
 

@@ -186,30 +183,27 @@
         return JNI_TRUE;
     }
     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;
     jboolean serverPatternFound;
 
     /* fastest path */
     if (env == NULL) {
         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;
     if (clientPatternFound == JNI_FALSE && serverPatternFound == JNI_FALSE) {
         return JNI_FALSE;

@@ -320,11 +314,10 @@
     /* Compute/set the name of the executable */
     SetExecname(*pargv);
 
     /* 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;
       int running       = CURRENT_DATA_MODEL;
       /*

@@ -406,16 +399,16 @@
 
       /* If the data model is not changing, it is an error if the
          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);
           exit(1);
         }

@@ -425,11 +418,11 @@
         if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
             JLI_ReportErrorMessage(CFG_ERROR9);
             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);
         }
         /*
          * we seem to have everything we need, so without further ado

@@ -455,12 +448,12 @@
         if (mustsetenv) {
             /*
              * 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.
              */
 

@@ -516,14 +509,14 @@
 
             /* runpath contains current effective LD_LIBRARY_PATH setting */
 
             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);
             newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
 

@@ -537,21 +530,21 @@
                 if (lastslash)
                     *lastslash = '\0';
 
                 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
                         );
 
 
                 /*
                  * Check to make sure that the prefix of the current path is the

@@ -636,18 +629,18 @@
  * bitsWanted is used by MacOSX,  on Solaris and Linux this.
  * parameter is unused.
  */
 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);
 
     if (stat(jvmpath, &s) == 0) {

@@ -661,38 +654,38 @@
 
 /*
  * 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;
         }
         /* ensure storage for path + /jre + NULL */
         if ((JLI_StrLen(path) + 4  + 1) > (size_t) pathsize) {
             JLI_TraceLauncher("Insufficient space to store JRE path\n");
             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);
             return JNI_TRUE;
         }
     }
 
     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;
         }
     }

@@ -854,16 +847,16 @@
     if (!hSplashLib) {
         int ret;
         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);
             return NULL;
         }
< prev index next >