* src/vm/vm.c [WITH_JRE_LAYOUT] (libgen.h, unistd.h): Removed.
authortwisti <none@none>
Wed, 22 Aug 2007 18:45:31 +0000 (18:45 +0000)
committertwisti <none@none>
Wed, 22 Aug 2007 18:45:31 +0000 (18:45 +0000)
* src/vm/properties.c (errno.h): Added.
[WITH_JRE_LAYOUT] (libgen.h): Likewise.
(properties_set) [WITH_CLASSPATH_SUN]: Set sun.boot.library.path
property.

* src/native/vm/nativevm.c (vm/properties.h): Added.
(nativevm_preinit) [WITH_CLASSPATH_SUN]: Use properties_get to get
sun.boot.library.path.

src/native/vm/nativevm.c
src/vm/properties.c
src/vm/vm.c

index 08df417b84739fe7504bea5d9247d806187bae3e..029394433925b6213286f0dbc6ad77bc61ba20c6 100644 (file)
@@ -44,6 +44,7 @@
 
 # include "native/native.h"
 
+# include "vm/properties.h"
 # include "vm/vm.h"
 
 # include "vmcore/class.h"
@@ -94,24 +95,27 @@ bool nativevm_preinit(void)
 
 # elif defined(WITH_CLASSPATH_SUN)
 
-       char        *path;
+       char        *boot_library_path;
        int          len;
+       char        *p;
        utf         *u;
        lt_dlhandle  handle;
 
+       boot_library_path = properties_get("sun.boot.library.path");
+
        len =
-               strlen(classpath_libdir) +
+               strlen(boot_library_path) +
                strlen("/libjava.so") +
                strlen("0");
 
-       path = MNEW(char, len);
+       p = MNEW(char, len);
 
-       strcpy(path, classpath_libdir);
-       strcat(path, "/libjava.so");
+       strcpy(p, boot_library_path);
+       strcat(p, "/libjava.so");
 
-       u = utf_new_char(path);
+       u = utf_new_char(p);
 
-       MFREE(path, char, len);
+       MFREE(p, char, len);
 
        handle = native_library_open(u);
        native_library_add(u, NULL, handle);
index 54641c3fe8ab285d284a2abcb0e9df1b73f65196..303204d96b28cd3190854804e9ba5a502c55d42c 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: properties.c 8399 2007-08-22 18:24:23Z twisti $
+   $Id: properties.c 8401 2007-08-22 18:45:31Z twisti $
 
 */
 
 
 #include "config.h"
 
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
 #include <sys/utsname.h>
 
+#if defined(WITH_JRE_LAYOUT)
+# include <libgen.h>
+#endif
+
 #include "vm/types.h"
 
 #include "mm/memory.h"
@@ -182,6 +187,15 @@ void properties_set(void)
                strcat(java_home, "/..");
        }
 
+       /* Set the path to Java core native libraries. */
+
+       len = strlen(java_home) + strlen("/lib/"JAVA_ARCH) + strlen("0");
+
+       boot_library_path = MNEW(char, len);
+
+       strcpy(boot_library_path, java_home);
+       strcat(boot_library_path, "/lib/"JAVA_ARCH);
+
 # else
 #  error unknown classpath configuration
 # endif
@@ -504,7 +518,10 @@ void properties_set(void)
 
 # elif defined(WITH_CLASSPATH_SUN)
 
-       /* Nothing to do. */
+       /* Actually this property is set by OpenJDK, but we need it in
+          nativevm_preinit(). */
+
+       properties_add("sun.boot.library.path", boot_library_path);
 
 # else
 
index 76a1cb88e5ca064e9a8394831bcac5730a0de48d..99fc243051a5470a61f38a3c9cc98c4f5902b51a 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: vm.c 8399 2007-08-22 18:24:23Z twisti $
+   $Id: vm.c 8401 2007-08-22 18:45:31Z twisti $
 
 */
 
 #include <stdint.h>
 #include <stdlib.h>
 
-#if defined(WITH_JRE_LAYOUT)
-# include <libgen.h>
-# include <unistd.h>
-#endif
-
 #include "vm/types.h"
 
 #include "arch.h"