jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c
changeset 37811 40c09ac0ca71
parent 37716 86e2f05984f9
child 38412 96e1d2c5d435
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Sat May 07 00:54:38 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Sat May 07 08:44:48 2016 +0200
@@ -312,7 +312,7 @@
     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. */
@@ -320,16 +320,25 @@
     } 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)) {