< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c

Print this page
rev 14364 : 8156020: 8145547 breaks AIX and and uses RTLD_NOLOAD incorrectly

@@ -310,28 +310,37 @@
         longjmp(j, NO_SYMBOL_EXCEPTION);
 
     return result;
 }
 
-gboolean gtk2_check(const char* lib_name, int flags)
+gboolean gtk2_check(const char* lib_name, gboolean load)
 {
     if (gtk2_libhandle != NULL) {
         /* We've already successfully opened the GTK libs, so return true. */
         return TRUE;
     } else {
         void *lib = NULL;
 
-        lib = dlopen(lib_name, flags);
+#ifdef RTLD_NOLOAD
+        /* Just check if gtk libs are already in the process space */
+        lib = dlopen(lib_name, RTLD_LAZY | RTLD_NOLOAD);
+        if (!load || lib != NULL) {
+            return lib != NULL;
+        }
+#else
+#ifdef _AIX
+        /* On AIX we could implement this with the help of loadquery(L_GETINFO, ..)  */
+        /* (see reload_table() in hotspot/src/os/aix/vm/loadlib_aix.cpp) but it is   */
+        /* probably not worth it because most AIX servers don't have GTK libs anyway */
+#endif
+#endif
 
+        lib = dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL);
         if (lib == NULL) {
             return FALSE;
         }
 
-        if (flags & RTLD_NOLOAD) {
-            return TRUE;
-        }
-
         fp_gtk_check_version = dlsym(lib, "gtk_check_version");
         /* Check for GTK 2.2+ */
         if (!fp_gtk_check_version(2, 2, 0)) {
             return TRUE;
         }
< prev index next >