Path: blob/master/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c
41153 views
/*1* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifdef HEADLESS26#error This file should not be included in headless library27#endif2829#include "gnome_interface.h"3031GNOME_URL_SHOW_TYPE *gnome_url_show = NULL;3233gboolean gnome_load() {34void *vfs_handle;35void *gnome_handle;36const char *errmsg;37GNOME_VFS_INIT_TYPE *gnome_vfs_init;3839// trying to open the gnomevfs. VERSIONED_JNI_LIB_NAME40// macros formats the library name in a system specific manner41// see jdk/src/solaris/javavm/export/jvm_md.h for more details42vfs_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnomevfs-2", "0"), RTLD_LAZY);43if (vfs_handle == NULL) {44// if we cannot load the library using a version assumed by JNI45// we are trying to load the library without a version suffix46vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);47if (vfs_handle == NULL) {48#ifdef DEBUG49fprintf(stderr, "can not load libgnomevfs-2.so\n");50#endif51return FALSE;52}53}54dlerror(); /* Clear errors */55gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");56if (gnome_vfs_init == NULL){57#ifdef DEBUG58fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");59#endif60return FALSE;61}62if ((errmsg = dlerror()) != NULL) {63#ifdef DEBUG64fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);65#endif66return FALSE;67}68// call gonme_vfs_init()69(*gnome_vfs_init)();7071gnome_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnome-2", "0"), RTLD_LAZY);72if (gnome_handle == NULL) {73gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);74if (gnome_handle == NULL) {75#ifdef DEBUG76fprintf(stderr, "can not load libgnome-2.so\n");77#endif78return FALSE;79}80}81dlerror(); /* Clear errors */82gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");83if ((errmsg = dlerror()) != NULL) {84#ifdef DEBUG85fprintf(stderr, "can not find symble gnome_url_show\n");86#endif87return FALSE;88}89return TRUE;90}919293