jdk/src/demo/unix/jvmti/hprof/hprof_md.c
author duke
Wed, 05 Jul 2017 19:57:26 +0200
changeset 26050 5d268650760d
parent 25859 3317bb8137f4
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
     2
 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * Redistribution and use in source and binary forms, with or without
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * modification, are permitted provided that the following conditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * are met:
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *   - Redistributions of source code must retain the above copyright
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *     notice, this list of conditions and the following disclaimer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *   - Redistributions in binary form must reproduce the above copyright
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 *     notice, this list of conditions and the following disclaimer in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 *     documentation and/or other materials provided with the distribution.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    15
 *   - Neither the name of Oracle nor the names of its
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *     contributors may be used to endorse or promote products derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 *     from this software without specific prior written permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
10292
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    32
/*
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    33
 * This source code is provided to illustrate the usage of a given feature
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    34
 * or technique and has been deliberately simplified. Additional steps
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    35
 * required for a production-quality application, such as security checks,
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    36
 * input validation and proper error handling, might not be present in
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    37
 * this sample code.
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    38
 */
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    39
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    40
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#include <sys/types.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#include <sys/stat.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#include <fcntl.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
    45
#if !defined(LINUX) && !defined(_ALLBSD_SOURCE) && !defined(AIX)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#include <procfs.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#include <stdio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#include <sys/socket.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#include <sys/errno.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#include <unistd.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
#include <errno.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#include <dlfcn.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#include <sys/time.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
#include <netdb.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#include <netinet/in.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#include <sys/param.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#include <time.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#include "jni.h"
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 10292
diff changeset
    65
#include "jvm_md.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#include "hprof.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
    68
#ifdef AIX
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
    69
#include "porting_aix.h" /* For the 'dladdr' function. */
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
    70
#endif
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
    71
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
md_getpid(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    static int pid = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    if ( pid >= 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        return pid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    pid = getpid();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    return pid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
md_sleep(unsigned seconds)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    sleep(seconds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
md_init(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
{
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
    93
#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /* No Hi-Res timer option? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    if ( gdata->micro_state_accounting ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        char proc_ctl_fn[48];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        int  procfd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        /* Turn on micro state accounting, once per process */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        (void)md_snprintf(proc_ctl_fn, sizeof(proc_ctl_fn),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                "/proc/%d/ctl", md_getpid());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        procfd = open(proc_ctl_fn, O_WRONLY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        if (procfd >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            long ctl_op[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            ctl_op[0] = PCSET;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            ctl_op[1] = PR_MSACCT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            (void)write(procfd, ctl_op, sizeof(ctl_op));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            (void)close(procfd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
md_connect(char *hostname, unsigned short port)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    struct hostent *hentry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    struct sockaddr_in s;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    int fd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /* create a socket */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    fd = socket(AF_INET, SOCK_STREAM, 0);
13014
e2fe1611bb04 7176138: Fixes for missing close() calls and possible null pointer reference instead of fatal error
ohair
parents: 12047
diff changeset
   126
    if ( fd < 0 ) {
e2fe1611bb04 7176138: Fixes for missing close() calls and possible null pointer reference instead of fatal error
ohair
parents: 12047
diff changeset
   127
        return -1;
e2fe1611bb04 7176138: Fixes for missing close() calls and possible null pointer reference instead of fatal error
ohair
parents: 12047
diff changeset
   128
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /* find remote host's addr from name */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    if ((hentry = gethostbyname(hostname)) == NULL) {
13014
e2fe1611bb04 7176138: Fixes for missing close() calls and possible null pointer reference instead of fatal error
ohair
parents: 12047
diff changeset
   132
        (void)close(fd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    (void)memset((char *)&s, 0, sizeof(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /* set remote host's addr; its already in network byte order */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    (void)memcpy(&s.sin_addr.s_addr, *(hentry->h_addr_list),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
           (int)sizeof(s.sin_addr.s_addr));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /* set remote host's port */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    s.sin_port = htons(port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    s.sin_family = AF_INET;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    /* now try connecting */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    if (-1 == connect(fd, (struct sockaddr*)&s, sizeof(s))) {
13014
e2fe1611bb04 7176138: Fixes for missing close() calls and possible null pointer reference instead of fatal error
ohair
parents: 12047
diff changeset
   145
        (void)close(fd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    return fd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
md_recv(int f, char *buf, int len, int option)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    return recv(f, buf, len, option);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
md_shutdown(int filedes, int option)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    return shutdown(filedes, option);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
md_open(const char *filename)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    return open(filename, O_RDONLY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
md_open_binary(const char *filename)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    return md_open(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
md_creat(const char *filename)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    return open(filename, O_WRONLY | O_CREAT | O_TRUNC,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
md_creat_binary(const char *filename)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    return md_creat(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
jlong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
md_seek(int filedes, jlong cur)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    jlong new_pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    if ( cur == (jlong)-1 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        new_pos = lseek(filedes, 0, SEEK_END);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        new_pos = lseek(filedes, cur, SEEK_SET);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    return new_pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
md_close(int filedes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    (void)close(filedes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
md_send(int s, const char *msg, int len, int flags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    int res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        res = send(s, msg, len, flags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    } while ((res < 0) && (errno == EINTR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    return res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
md_write(int filedes, const void *buf, int nbyte)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    int res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        res = write(filedes, buf, nbyte);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    } while ((res < 0) && (errno == EINTR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    return res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
md_read(int filedes, void *buf, int nbyte)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    int res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        res = read(filedes, buf, nbyte);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    } while ((res < 0) && (errno == EINTR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    return res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
/* Time of day in milli-seconds */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
static jlong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
md_timeofday(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    struct timeval tv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    if ( gettimeofday(&tv, (void *)0) != 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        return (jlong)0; /* EOVERFLOW ? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    /*LINTED*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    return ((jlong)tv.tv_sec * (jlong)1000) + (jlong)(tv.tv_usec / 1000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
/* Hi-res timer in micro-seconds */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
jlong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
md_get_microsecs(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
{
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
   260
#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    return (jlong)(md_timeofday() * (jlong)1000); /* Milli to micro */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    return (jlong)(gethrtime()/(hrtime_t)1000); /* Nano seconds to micro seconds */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
/* Time of day in milli-seconds */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
jlong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
md_get_timemillis(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    return md_timeofday();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
/* Current CPU hi-res CPU time used */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
jlong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
md_get_thread_cpu_timemillis(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
{
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
   278
#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    return md_timeofday();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    return (jlong)(gethrvtime()/1000); /* Nano seconds to milli seconds */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
md_get_prelude_path(char *path, int path_len, char *filename)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    void *addr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    char libdir[FILENAME_MAX+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    Dl_info dlinfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    libdir[0] = 0;
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
   293
#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    addr = (void*)&Agent_OnLoad;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    /* Just using &Agent_OnLoad will get the first external symbol with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     *   this name in the first .so, which may not be libhprof.so.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     *   On Solaris we can actually ask for the address of our Agent_OnLoad.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    addr = dlsym(RTLD_SELF, "Agent_OnLoad");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    /* Just in case the above didn't work (missing linker patch?). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    if ( addr == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        addr = (void*)&Agent_OnLoad;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    /* Use dladdr() to get the full path to libhprof.so, which we use to find
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *  the prelude file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    dlinfo.dli_fname = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    (void)dladdr(addr, &dlinfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    if ( dlinfo.dli_fname != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        char * lastSlash;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        /* Full path to library name, need to move up one directory to 'lib' */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        (void)strcpy(libdir, (char *)dlinfo.dli_fname);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
        lastSlash = strrchr(libdir, '/');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        if ( lastSlash != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            *lastSlash = '\0';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 10292
diff changeset
   321
#ifndef __APPLE__
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 10292
diff changeset
   322
        // not sure why other platforms have to go up two levels, but on macos we only need up one
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        lastSlash = strrchr(libdir, '/');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        if ( lastSlash != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            *lastSlash = '\0';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 10292
diff changeset
   327
#endif /* __APPLE__ */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    (void)snprintf(path, path_len, "%s/%s", libdir, filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
md_vsnprintf(char *s, int n, const char *format, va_list ap)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    return vsnprintf(s, n, format, ap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
md_snprintf(char *s, int n, const char *format, ...)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    int ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    va_list ap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    va_start(ap, format);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    ret = md_vsnprintf(s, n, format, ap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    va_end(ap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
md_system_error(char *buf, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    char *p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    buf[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    p = strerror(errno);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    if ( p != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        (void)strcpy(buf, p);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
unsigned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
md_htons(unsigned short s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    return htons(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
unsigned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
md_htonl(unsigned l)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    return htonl(l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
unsigned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
md_ntohs(unsigned short s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    return ntohs(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
unsigned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
md_ntohl(unsigned l)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    return ntohl(l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
   387
static void dll_build_name(char* buffer, size_t buflen,
16726
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   388
                           const char* paths, const char* fname) {
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   389
    char *path, *paths_copy, *next_token;
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   390
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   391
    paths_copy = strdup(paths);
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   392
    if (paths_copy == NULL) {
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   393
        return;
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   394
    }
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   395
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   396
    next_token = NULL;
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   397
    path = strtok_r(paths_copy, ":", &next_token);
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
   398
16726
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   399
    while (path != NULL) {
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   400
        snprintf(buffer, buflen, "%s/lib%s" JNI_LIB_SUFFIX, path, fname);
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   401
        if (access(buffer, F_OK) == 0) {
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   402
            break;
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   403
        }
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   404
        *buffer = '\0';
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   405
        path = strtok_r(NULL, ":", &next_token);
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   406
    }
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
   407
16726
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   408
    free(paths_copy);
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
   409
}
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
   410
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
/* Create the actual fill filename for a dynamic library.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
void
16726
f76b2e6bd199 8009558: linked_md.c::dll_build_name can get stuck in an infinite loop
sla
parents: 16057
diff changeset
   413
md_build_library_name(char *holder, int holderlen, const char *pname, const char *fname)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    int   pnamelen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    /* Length of options directory location. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    pnamelen = pname ? strlen(pname) : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
   420
    *holder = '\0';
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    /* Quietly truncate on buffer overflow.  Should be an error. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    if (pnamelen + (int)strlen(fname) + 10 > holderlen) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    /* Construct path to library */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    if (pnamelen == 0) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 10292
diff changeset
   428
        (void)snprintf(holder, holderlen, "lib%s" JNI_LIB_SUFFIX, fname);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    } else {
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
   430
      dll_build_name(holder, holderlen, pname, fname);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
/* Load this library (return NULL on error, and error message in err_buf) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
void *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
md_load_library(const char *name, char *err_buf, int err_buflen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    void * result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    result = dlopen(name, RTLD_LAZY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    if (result == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        (void)strncpy(err_buf, dlerror(), err_buflen-2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        err_buf[err_buflen-1] = '\0';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
/* Unload this library */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
md_unload_library(void *handle)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    (void)dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
/* Find an entry point inside this library (return NULL if not found) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
void *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
md_find_library_entry(void *handle, const char *name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    void * sym;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    sym =  dlsym(handle, name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    return sym;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
}
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
   464
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 16726
diff changeset
   465