src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c
author ihse
Sat, 03 Mar 2018 08:21:47 +0100
branchihse-warnings-cflags-branch
changeset 56230 489867818774
parent 47216 71c04702a3d5
permissions -rw-r--r--
No longer disable E_OLD_STYLE_FUNC_DEF.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32123
diff changeset
     2
 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <stdio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <dlfcn.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include <jni.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include <jni_util.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include <jvm.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "gdefs.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include <sys/param.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include <sys/utsname.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20453
diff changeset
    38
#ifdef AIX
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20453
diff changeset
    39
#include "porting_aix.h" /* For the 'dladdr' function. */
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20453
diff changeset
    40
#endif
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20453
diff changeset
    41
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#ifdef DEBUG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define VERBOSE_AWT_DEBUG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
static void *awtHandle = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
16862
247af361e9ca 8008509: 6588413 changed JNIEXPORT visibility for GCC on HSX, jdk's jni_md.h needs similar change
martin
parents: 12050
diff changeset
    48
typedef jint JNICALL JNI_OnLoad_type(JavaVM *vm, void *reserved);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
/* Initialize the Java VM instance variable when the library is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
   first loaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
JavaVM *jvm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
56230
489867818774 No longer disable E_OLD_STYLE_FUNC_DEF.
ihse
parents: 47216
diff changeset
    54
JNIEXPORT jboolean JNICALL AWTIsHeadless(void) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    static JNIEnv *env = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    static jboolean isHeadless;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    jmethodID headlessFn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    jclass graphicsEnvClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    if (env == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        graphicsEnvClass = (*env)->FindClass(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                                             "java/awt/GraphicsEnvironment");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        if (graphicsEnvClass == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
            return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        headlessFn = (*env)->GetStaticMethodID(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                                               graphicsEnvClass, "isHeadless", "()Z");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        if (headlessFn == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
            return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        isHeadless = (*env)->CallStaticBooleanMethod(env, graphicsEnvClass,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                                     headlessFn);
32123
92824eb030c5 8130507: closed/java/awt/font/JNICheck/JNICheck.sh test reports some warnings
psadhukhan
parents: 26751
diff changeset
    74
        if ((*env)->ExceptionCheck(env)) {
92824eb030c5 8130507: closed/java/awt/font/JNICheck/JNICheck.sh test reports some warnings
psadhukhan
parents: 26751
diff changeset
    75
            (*env)->ExceptionClear(env);
92824eb030c5 8130507: closed/java/awt/font/JNICheck/JNICheck.sh test reports some warnings
psadhukhan
parents: 26751
diff changeset
    76
            return JNI_TRUE;
92824eb030c5 8130507: closed/java/awt/font/JNICheck/JNICheck.sh test reports some warnings
psadhukhan
parents: 26751
diff changeset
    77
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    return isHeadless;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
    82
#define CHECK_EXCEPTION_FATAL(env, message) \
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
    83
    if ((*env)->ExceptionCheck(env)) { \
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
    84
        (*env)->ExceptionClear(env); \
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
    85
        (*env)->FatalError(env, message); \
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
    86
    }
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
    87
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    88
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    89
 * Pathnames to the various awt toolkits
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    90
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    91
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    92
#ifdef MACOSX
12050
28109b684ac0 7152186: java.awt.HeadlessException when running AWT apps [macosx]
michaelm
parents: 12047
diff changeset
    93
  #define LWAWT_PATH "/libawt_lwawt.dylib"
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    94
  #define DEFAULT_PATH LWAWT_PATH
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    95
#else
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    96
  #define XAWT_PATH "/libawt_xawt.so"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    97
  #define DEFAULT_PATH XAWT_PATH
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    98
  #define HEADLESS_PATH "/libawt_headless.so"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
    99
#endif
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   100
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
jint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
AWT_OnLoad(JavaVM *vm, void *reserved)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    Dl_info dlinfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    char buf[MAXPATHLEN];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    int32_t len;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   107
    char *p, *tk;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    JNI_OnLoad_type *JNI_OnLoad_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    struct utsname name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    JNIEnv *env = (JNIEnv *)JNU_GetEnv(vm, JNI_VERSION_1_2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    void *v;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   112
    jstring fmanager = NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   113
    jstring fmProp = NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    if (awtHandle != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        /* Avoid several loading attempts */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        return JNI_VERSION_1_2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    jvm = vm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /* Get address of this library and the directory containing it. */
23252
4c62cbe8fddf 6571600: JNI use results in UnsatisfiedLinkError looking for libmawt.so
dbuck
parents: 20453
diff changeset
   123
    dladdr((void *)AWT_OnLoad, &dlinfo);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    realpath((char *)dlinfo.dli_fname, buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    len = strlen(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    p = strrchr(buf, '/');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * The code below is responsible for:
11665
98dad53a8ba1 7110002: Rename xawt/libmawt.so and headless/libmawt.so so they can be colocated with libawt
chegar
parents: 9203
diff changeset
   130
     * 1. Loading appropriate awt library, i.e. libawt_xawt or libawt_headless
20453
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   131
     * 2. Set the "sun.font.fontmanager" system property.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   134
    fmProp = (*env)->NewStringUTF(env, "sun.font.fontmanager");
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   135
    CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager property");
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   136
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   137
#ifdef MACOSX
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   138
        fmanager = (*env)->NewStringUTF(env, "sun.font.CFontManager");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   139
        tk = LWAWT_PATH;
20453
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   140
#else
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   141
        fmanager = (*env)->NewStringUTF(env, "sun.awt.X11FontManager");
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   142
        tk = XAWT_PATH;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   143
#endif
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   144
    CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager name");
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   145
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   146
    if (fmanager && fmProp) {
20453
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   147
        JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "setProperty",
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   148
                                   "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;",
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   149
                                   fmProp, fmanager);
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   150
        CHECK_EXCEPTION_FATAL(env, "Could not allocate set properties");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
20453
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   153
#ifndef MACOSX
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    if (AWTIsHeadless()) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   155
        tk = HEADLESS_PATH;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    }
20453
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   157
#endif
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   158
e480eb64d2c2 7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure
anthony
parents: 16862
diff changeset
   159
    /* Calculate library name to load */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   160
    strncpy(p, tk, MAXPATHLEN-len-1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   162
    if (fmProp) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   163
        (*env)->DeleteLocalRef(env, fmProp);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   164
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   165
    if (fmanager) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   166
        (*env)->DeleteLocalRef(env, fmanager);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11665
diff changeset
   167
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   169
    jstring jbuf = JNU_NewStringPlatform(env, buf);
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   170
    CHECK_EXCEPTION_FATAL(env, "Could not allocate library name");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                               "(Ljava/lang/String;)V",
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23328
diff changeset
   173
                               jbuf);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    return JNI_VERSION_1_2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
JNIEXPORT jint JNICALL
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32123
diff changeset
   181
DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    return AWT_OnLoad(vm, reserved);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * This entry point must remain in libawt.so as part of a contract
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * with the CDE variant of Java Media Framework. (sdtjmplay)
11665
98dad53a8ba1 7110002: Rename xawt/libmawt.so and headless/libmawt.so so they can be colocated with libawt
chegar
parents: 9203
diff changeset
   189
 * Reflect this call over to the correct libawt_<toolkit>.so.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                                     jobject frame, jstring jcommand)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    /* type of the old backdoor function */
16862
247af361e9ca 8008509: 6588413 changed JNIEXPORT visibility for GCC on HSX, jdk's jni_md.h needs similar change
martin
parents: 12050
diff changeset
   196
    typedef void JNICALL
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        XsessionWMcommand_type(JNIEnv *env, jobject this,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                               jobject frame, jstring jcommand);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    static XsessionWMcommand_type *XsessionWMcommand = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    if (XsessionWMcommand == NULL && awtHandle == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    XsessionWMcommand = (XsessionWMcommand_type *)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        dlsym(awtHandle, "Java_sun_awt_motif_XsessionWMcommand");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    if (XsessionWMcommand == NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    (*XsessionWMcommand)(env, this, frame, jcommand);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 * This entry point must remain in libawt.so as part of a contract
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 * with the CDE variant of Java Media Framework. (sdtjmplay)
11665
98dad53a8ba1 7110002: Rename xawt/libmawt.so and headless/libmawt.so so they can be colocated with libawt
chegar
parents: 9203
diff changeset
   219
 * Reflect this call over to the correct libawt_<toolkit>.so.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jargv)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
{
16862
247af361e9ca 8008509: 6588413 changed JNIEXPORT visibility for GCC on HSX, jdk's jni_md.h needs similar change
martin
parents: 12050
diff changeset
   224
    typedef void JNICALL
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        XsessionWMcommand_New_type(JNIEnv *env, jobjectArray jargv);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    static XsessionWMcommand_New_type *XsessionWMcommand = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    if (XsessionWMcommand == NULL && awtHandle == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    XsessionWMcommand = (XsessionWMcommand_New_type *)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        dlsym(awtHandle, "Java_sun_awt_motif_XsessionWMcommand_New");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    if (XsessionWMcommand == NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    (*XsessionWMcommand)(env, jargv);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
}