jdk/src/jdk.runtime/unix/native/libjsdt/jvm_symbols_md.c
author yan
Mon, 10 Nov 2014 16:23:30 +0300
changeset 27763 1fba965925e8
parent 25859 3317bb8137f4
permissions -rw-r--r--
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1 Reviewed-by: pchelko, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
406
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
     2
 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
491
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     4
 *
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
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: 491
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
491
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
491
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    10
 *
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    15
 * accompanied this code).
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    16
 *
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
    23
 * questions.
406
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    24
 */
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    25
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    26
#include <dlfcn.h>
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    27
#include <stdlib.h>
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    28
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    29
#include <jvm.h>
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    30
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    31
#include "jvm_symbols.h"
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    32
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    33
JvmSymbols* lookupJvmSymbols() {
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    34
    JvmSymbols* syms = (JvmSymbols*)malloc(sizeof(JvmSymbols));
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    35
    if (syms != NULL) {
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    36
        syms->GetVersion = (GetVersion_t)
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    37
            dlsym(RTLD_DEFAULT, "JVM_DTraceGetVersion");
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    38
        syms->IsSupported = (IsSupported_t)
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    39
            dlsym(RTLD_DEFAULT, "JVM_DTraceIsSupported");
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    40
        syms->Activate = (Activate_t)
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    41
            dlsym(RTLD_DEFAULT, "JVM_DTraceActivate");
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    42
        syms->Dispose = (Dispose_t)
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    43
            dlsym(RTLD_DEFAULT, "JVM_DTraceDispose");
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    44
        syms->IsProbeEnabled = (IsProbeEnabled_t)
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    45
            dlsym(RTLD_DEFAULT, "JVM_DTraceIsProbeEnabled");
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    46
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    47
        if ( syms->GetVersion == NULL || syms->Activate == NULL ||
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    48
             syms->IsProbeEnabled == NULL || syms->Dispose == NULL ||
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    49
             syms->IsSupported == NULL) {
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    50
            free(syms);
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    51
            syms = NULL;
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    52
        }
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    53
    }
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    54
    return syms;
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    55
}