src/java.base/unix/native/libjli/java_md_solinux.c
author mbaesken
Thu, 28 Nov 2019 13:02:39 +0100
changeset 59323 ae2eb76c486d
parent 59217 82db5000a845
permissions -rw-r--r--
8234821: remove unused functions from libjli Reviewed-by: clanger, alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     1
/*
53346
61866ba87b31 8217044: [aix] Launcher still adds old path to jli library to LIBPATH
goetz
parents: 47216
diff changeset
     2
 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     4
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    10
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    15
 * accompanied this code).
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    16
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    20
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    23
 * questions.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    24
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    25
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    26
#include "java.h"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    27
#include "jvm_md.h"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    28
#include <dirent.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    29
#include <dlfcn.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    30
#include <fcntl.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    31
#include <inttypes.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    32
#include <stdio.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    33
#include <string.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    34
#include <stdlib.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    35
#include <sys/stat.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    36
#include <unistd.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    37
#include <sys/types.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    38
#include "manifest_info.h"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    39
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    40
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    41
#define JVM_DLL "libjvm.so"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    42
#define JAVA_DLL "libjava.so"
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
    43
#ifdef AIX
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
    44
#define LD_LIBRARY_PATH "LIBPATH"
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
    45
#else
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    46
#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
    47
#endif
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    48
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    49
/* help jettison the LD_LIBRARY_PATH settings in the future */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    50
#ifndef SETENV_REQUIRED
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    51
#define SETENV_REQUIRED
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    52
#endif
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    53
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    54
#ifdef __solaris__
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    55
#  include <sys/systeminfo.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    56
#  include <sys/elf.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    57
#  include <stdio.h>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    58
#endif
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    59
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    60
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    61
 * Flowchart of launcher execs and options processing on unix
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    62
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    63
 * The selection of the proper vm shared library to open depends on
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    64
 * several classes of command line options, including vm "flavor"
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
    65
 * options (-client, -server).
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    66
 * The vm selection options are not passed to the running
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    67
 * virtual machine; they must be screened out by the launcher.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    68
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    69
 * The version specification (if any) is processed first by the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    70
 * platform independent routine SelectVersion.  This may result in
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    71
 * the exec of the specified launcher version.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    72
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    73
 * Previously the launcher modified the LD_LIBRARY_PATH appropriately for the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    74
 * desired data model path, regardless if data models matched or not. The
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    75
 * launcher subsequently exec'ed the desired executable, in order to make the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    76
 * LD_LIBRARY_PATH path available, for the runtime linker.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    77
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    78
 * Now, in most cases,the launcher will dlopen the target libjvm.so. All
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    79
 * required libraries are loaded by the runtime linker, using the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    80
 * $RPATH/$ORIGIN baked into the shared libraries at compile time. Therefore,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    81
 * in most cases, the launcher will only exec, if the data models are
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    82
 * mismatched, and will not set any environment variables, regardless of the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    83
 * data models.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    84
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    85
 * However, if the environment contains a LD_LIBRARY_PATH, this will cause the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    86
 * launcher to inspect the LD_LIBRARY_PATH. The launcher will check
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 27938
diff changeset
    87
 *  a. if the LD_LIBRARY_PATH's first component is the path to the desired
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    88
 *     libjvm.so
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    89
 *  b. if any other libjvm.so is found in any of the paths.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    90
 * If case b is true, then the launcher will set the LD_LIBRARY_PATH to the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    91
 * desired JRE and reexec, in order to propagate the environment.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    92
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    93
 *  Main
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    94
 *  (incoming argv)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    95
 *  |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    96
 * \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    97
 * CreateExecutionEnvironment
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    98
 * (determines desired data model)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    99
 *  |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   100
 *  |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   101
 * \|/
22065
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   102
 *  Have Desired Model ? --> NO --> Exit(with error)
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   103
 *  |
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   104
 *  |
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   105
 * \|/
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   106
 * YES
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   107
 *  |
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   108
 *  |
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   109
 * \|/
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   110
 * CheckJvmType
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   111
 * (removes -client, -server, etc.)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   112
 *  |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   113
 *  |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   114
 * \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   115
 * TranslateDashJArgs...
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   116
 * (Prepare to pass args to vm)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   117
 *  |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   118
 *  |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   119
 * \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   120
 * ParseArguments
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   121
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   122
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   123
 *  \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   124
 * RequiresSetenv
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   125
 * Is LD_LIBRARY_PATH
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   126
 * and friends set ? --> NO --> Continue
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   127
 *  YES
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   128
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   129
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   130
 *  \|/
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   131
 * Path is desired JRE ? YES --> Continue
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   132
 *  NO
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   133
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   134
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   135
 *  \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   136
 * Paths have well known
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   137
 * jvm paths ?       --> NO --> Error/Exit
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   138
 *  YES
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   139
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   140
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   141
 *  \|/
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   142
 *  Does libjvm.so exist
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   143
 *  in any of them ? --> NO  --> Continue
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   144
 *   YES
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   145
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   146
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   147
 *  \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   148
 *  Set the LD_LIBRARY_PATH
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   149
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   150
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   151
 *  \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   152
 * Re-exec
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   153
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   154
 *   |
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   155
 *  \|/
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   156
 * Main
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   157
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   158
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   159
/* Store the name of the executable once computed */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   160
static char *execname = NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   161
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   162
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   163
 * execname accessor from other parts of platform dependent logic
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   164
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   165
const char *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   166
GetExecName() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   167
    return execname;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   168
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   169
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   170
#ifdef SETENV_REQUIRED
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   171
static jboolean
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   172
JvmExists(const char *path) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   173
    char tmp[PATH_MAX + 1];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   174
    struct stat statbuf;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   175
    JLI_Snprintf(tmp, PATH_MAX, "%s/%s", path, JVM_DLL);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   176
    if (stat(tmp, &statbuf) == 0) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   177
        return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   178
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   179
    return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   180
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   181
/*
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   182
 * contains a lib/{server,client}/libjvm.so ?
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   183
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   184
static jboolean
22065
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   185
ContainsLibJVM(const char *env) {
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   186
    /* the usual suspects */
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   187
    char clientPattern[] = "lib/client";
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   188
    char serverPattern[] = "lib/server";
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   189
    char *envpath;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   190
    char *path;
59217
82db5000a845 8234339: replace JLI_StrTok in java_md_solinux.c
mbaesken
parents: 58280
diff changeset
   191
    char* save_ptr = NULL;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   192
    jboolean clientPatternFound;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   193
    jboolean serverPatternFound;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   194
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   195
    /* fastest path */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   196
    if (env == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   197
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   198
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   199
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   200
    /* to optimize for time, test if any of our usual suspects are present. */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   201
    clientPatternFound = JLI_StrStr(env, clientPattern) != NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   202
    serverPatternFound = JLI_StrStr(env, serverPattern) != NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   203
    if (clientPatternFound == JNI_FALSE && serverPatternFound == JNI_FALSE) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   204
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   205
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   206
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   207
    /*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   208
     * we have a suspicious path component, check if it contains a libjvm.so
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   209
     */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   210
    envpath = JLI_StringDup(env);
59217
82db5000a845 8234339: replace JLI_StrTok in java_md_solinux.c
mbaesken
parents: 58280
diff changeset
   211
    for (path = strtok_r(envpath, ":", &save_ptr); path != NULL; path = strtok_r(NULL, ":", &save_ptr)) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   212
        if (clientPatternFound && JLI_StrStr(path, clientPattern) != NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   213
            if (JvmExists(path)) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   214
                JLI_MemFree(envpath);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   215
                return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   216
            }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   217
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   218
        if (serverPatternFound && JLI_StrStr(path, serverPattern)  != NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   219
            if (JvmExists(path)) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   220
                JLI_MemFree(envpath);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   221
                return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   222
            }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   223
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   224
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   225
    JLI_MemFree(envpath);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   226
    return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   227
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   228
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   229
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   230
 * Test whether the environment variable needs to be set, see flowchart.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   231
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   232
static jboolean
22065
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   233
RequiresSetenv(const char *jvmpath) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   234
    char jpath[PATH_MAX + 1];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   235
    char *llp;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   236
    char *dmllp = NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   237
    char *p; /* a utility pointer */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   238
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   239
#ifdef AIX
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   240
    /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   241
    return JNI_TRUE;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   242
#endif
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   243
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   244
    llp = getenv("LD_LIBRARY_PATH");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   245
#ifdef __solaris__
22065
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   246
    dmllp = getenv("LD_LIBRARY_PATH_64");
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   247
#endif /* __solaris__ */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   248
    /* no environment variable is a good environment variable */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   249
    if (llp == NULL && dmllp == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   250
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   251
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   252
#ifdef __linux
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   253
    /*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   254
     * On linux, if a binary is running as sgid or suid, glibc sets
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   255
     * LD_LIBRARY_PATH to the empty string for security purposes. (In contrast,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   256
     * on Solaris the LD_LIBRARY_PATH variable for a privileged binary does not
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   257
     * lose its settings; but the dynamic linker does apply more scrutiny to the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   258
     * path.) The launcher uses the value of LD_LIBRARY_PATH to prevent an exec
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   259
     * loop, here and further downstream. Therefore, if we are running sgid or
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   260
     * suid, this function's setting of LD_LIBRARY_PATH will be ineffective and
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   261
     * we should case a return from the calling function.  Getting the right
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   262
     * libraries will be handled by the RPATH. In reality, this check is
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   263
     * redundant, as the previous check for a non-null LD_LIBRARY_PATH will
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   264
     * return back to the calling function forthwith, it is left here to safe
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   265
     * guard against any changes, in the glibc's existing security policy.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   266
     */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   267
    if ((getgid() != getegid()) || (getuid() != geteuid())) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   268
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   269
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   270
#endif /* __linux */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   271
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   272
    /*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   273
     * Prevent recursions. Since LD_LIBRARY_PATH is the one which will be set by
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   274
     * previous versions of the JRE, thus it is the only path that matters here.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   275
     * So we check to see if the desired JRE is set.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   276
     */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   277
    JLI_StrNCpy(jpath, jvmpath, PATH_MAX);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   278
    p = JLI_StrRChr(jpath, '/');
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   279
    *p = '\0';
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   280
    if (llp != NULL && JLI_StrNCmp(llp, jpath, JLI_StrLen(jpath)) == 0) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   281
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   282
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   283
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   284
    /* scrutinize all the paths further */
22065
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   285
    if (llp != NULL &&  ContainsLibJVM(llp)) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   286
        return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   287
    }
22065
0b2684d4f49f 8024033: [launcher] remove solaris dual mode support
ksrini
parents: 20851
diff changeset
   288
    if (dmllp != NULL && ContainsLibJVM(dmllp)) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   289
        return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   290
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   291
    return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   292
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   293
#endif /* SETENV_REQUIRED */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   294
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   295
void
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   296
CreateExecutionEnvironment(int *pargc, char ***pargv,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   297
                           char jrepath[], jint so_jrepath,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   298
                           char jvmpath[], jint so_jvmpath,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   299
                           char jvmcfg[],  jint so_jvmcfg) {
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   300
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   301
    char * jvmtype = NULL;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   302
    int argc = *pargc;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   303
    char **argv = *pargv;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   304
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   305
#ifdef SETENV_REQUIRED
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   306
    jboolean mustsetenv = JNI_FALSE;
54023
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   307
#ifdef __solaris__
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   308
    char *llp64 = NULL; /* existing LD_LIBRARY_PATH_64 setting */
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   309
#endif // __solaris__
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   310
    char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   311
    char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   312
    char* newpath = NULL; /* path on new LD_LIBRARY_PATH */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   313
    char* lastslash = NULL;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   314
    char** newenvp = NULL; /* current environment */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   315
    size_t new_runpath_size;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   316
#endif  /* SETENV_REQUIRED */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   317
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   318
    /* Compute/set the name of the executable */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   319
    SetExecname(*pargv);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   320
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   321
    /* Check to see if the jvmpath exists */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   322
    /* Find out where the JRE is that we will be using. */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   323
    if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE)) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   324
        JLI_ReportErrorMessage(JRE_ERROR1);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   325
        exit(2);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   326
    }
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   327
    JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%sjvm.cfg",
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   328
            jrepath, FILESEP, FILESEP);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   329
    /* Find the specified JVM type */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   330
    if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   331
        JLI_ReportErrorMessage(CFG_ERROR7);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   332
        exit(1);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   333
    }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   334
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   335
    jvmpath[0] = '\0';
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   336
    jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   337
    if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   338
        JLI_ReportErrorMessage(CFG_ERROR9);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   339
        exit(4);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   340
    }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   341
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   342
    if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   343
        JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   344
        exit(4);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   345
    }
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   346
    /*
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   347
     * we seem to have everything we need, so without further ado
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   348
     * we return back, otherwise proceed to set the environment.
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   349
     */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   350
#ifdef SETENV_REQUIRED
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   351
    mustsetenv = RequiresSetenv(jvmpath);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   352
    JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE");
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   353
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   354
    if (mustsetenv == JNI_FALSE) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   355
        return;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   356
    }
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   357
#else
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   358
    return;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   359
#endif /* SETENV_REQUIRED */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   360
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   361
#ifdef SETENV_REQUIRED
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   362
    if (mustsetenv) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   363
        /*
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   364
         * We will set the LD_LIBRARY_PATH as follows:
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   365
         *
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   366
         *     o          $JVMPATH (directory portion only)
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   367
         *     o          $JRE/lib
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   368
         *     o          $JRE/../lib
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   369
         *
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   370
         * followed by the user's previous effective LD_LIBRARY_PATH, if
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   371
         * any.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   372
         */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   373
54023
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   374
#ifdef __solaris__
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   375
        llp64 = getenv("LD_LIBRARY_PATH_64");
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   376
        runpath = (llp64 == NULL) ? getenv(LD_LIBRARY_PATH) : llp64;
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   377
#else
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   378
        runpath = getenv(LD_LIBRARY_PATH);
54023
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   379
#endif /* __solaris__ */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   380
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   381
        /* runpath contains current effective LD_LIBRARY_PATH setting */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   382
        { /* New scope to declare local variable */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   383
            char *new_jvmpath = JLI_StringDup(jvmpath);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   384
            new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   385
                    2 * JLI_StrLen(jrepath) +
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   386
                    JLI_StrLen(new_jvmpath) + 52;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   387
            new_runpath = JLI_MemAlloc(new_runpath_size);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   388
            newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   389
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   390
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   391
            /*
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   392
             * Create desired LD_LIBRARY_PATH value for target data model.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   393
             */
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   394
            {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   395
                /* remove the name of the .so from the JVM path */
42687
7a5929518e6a 8170663: Fix minor issues in corelib and servicabilty coding.
goetz
parents: 40945
diff changeset
   396
                lastslash = JLI_StrRChr(new_jvmpath, '/');
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   397
                if (lastslash)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   398
                    *lastslash = '\0';
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   399
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   400
                sprintf(new_runpath, LD_LIBRARY_PATH "="
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   401
                        "%s:"
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   402
                        "%s/lib:"
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   403
                        "%s/../lib",
42687
7a5929518e6a 8170663: Fix minor issues in corelib and servicabilty coding.
goetz
parents: 40945
diff changeset
   404
                        new_jvmpath,
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   405
                        jrepath,
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   406
                        jrepath
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   407
                        );
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   408
42687
7a5929518e6a 8170663: Fix minor issues in corelib and servicabilty coding.
goetz
parents: 40945
diff changeset
   409
                JLI_MemFree(new_jvmpath);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   410
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   411
                /*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   412
                 * Check to make sure that the prefix of the current path is the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   413
                 * desired environment variable setting, though the RequiresSetenv
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   414
                 * checks if the desired runpath exists, this logic does a more
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   415
                 * comprehensive check.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   416
                 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   417
                if (runpath != NULL &&
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   418
                        JLI_StrNCmp(newpath, runpath, JLI_StrLen(newpath)) == 0 &&
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   419
                        (runpath[JLI_StrLen(newpath)] == 0 ||
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   420
                        runpath[JLI_StrLen(newpath)] == ':')) {
17911
04141bd79ced 8015299: Memory leak in jdk/src/solaris/bin/java_md_solinux.c
jzavgren
parents: 14690
diff changeset
   421
                    JLI_MemFree(new_runpath);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   422
                    return;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   423
                }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   424
            }
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   425
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   426
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   427
        /*
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   428
         * Place the desired environment setting onto the prefix of
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   429
         * LD_LIBRARY_PATH.  Note that this prevents any possible infinite
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   430
         * loop of execv() because we test for the prefix, above.
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   431
         */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   432
        if (runpath != 0) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   433
            /* ensure storage for runpath + colon + NULL */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   434
            if ((JLI_StrLen(runpath) + 1 + 1) > new_runpath_size) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   435
                JLI_ReportErrorMessageSys(JRE_ERROR11);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   436
                exit(1);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   437
            }
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   438
            JLI_StrCat(new_runpath, ":");
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   439
            JLI_StrCat(new_runpath, runpath);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   440
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   441
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   442
        if (putenv(new_runpath) != 0) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   443
            /* problem allocating memory; LD_LIBRARY_PATH not set properly */
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   444
            exit(1);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   445
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   446
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   447
        /*
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   448
         * Unix systems document that they look at LD_LIBRARY_PATH only
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   449
         * once at startup, so we have to re-exec the current executable
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   450
         * to get the changed environment variable to have an effect.
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   451
         */
54023
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   452
#ifdef __solaris__
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   453
        /*
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   454
         * new LD_LIBRARY_PATH took over for LD_LIBRARY_PATH_64
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   455
         */
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   456
        if (llp64 != NULL) {
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   457
            UnsetEnv("LD_LIBRARY_PATH_64");
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   458
        }
a764c49570c6 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)
henryjen
parents: 53941
diff changeset
   459
#endif // __solaris__
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   460
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   461
        newenvp = environ;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   462
    }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   463
#endif /* SETENV_REQUIRED */
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   464
    {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   465
        char *newexec = execname;
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   466
        JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   467
        (void) fflush(stdout);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   468
        (void) fflush(stderr);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   469
#ifdef SETENV_REQUIRED
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   470
        if (mustsetenv) {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   471
            execve(newexec, argv, newenvp);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   472
        } else {
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   473
            execv(newexec, argv);
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   474
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   475
#else /* !SETENV_REQUIRED */
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   476
        execv(newexec, argv);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   477
#endif /* SETENV_REQUIRED */
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   478
        JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   479
    }
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   480
    exit(1);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   481
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   482
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   483
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   484
static jboolean
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   485
GetJVMPath(const char *jrepath, const char *jvmtype,
45062
37ed4313c8c1 8169646: Remove launcher's -d32/-d64 option
ksrini
parents: 42759
diff changeset
   486
           char *jvmpath, jint jvmpathsize)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   487
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   488
    struct stat s;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   489
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   490
    if (JLI_StrChr(jvmtype, '/')) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   491
        JLI_Snprintf(jvmpath, jvmpathsize, "%s/" JVM_DLL, jvmtype);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   492
    } else {
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   493
        JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/" JVM_DLL, jrepath, jvmtype);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   494
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   495
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   496
    JLI_TraceLauncher("Does `%s' exist ... ", jvmpath);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   497
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   498
    if (stat(jvmpath, &s) == 0) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   499
        JLI_TraceLauncher("yes.\n");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   500
        return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   501
    } else {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   502
        JLI_TraceLauncher("no.\n");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   503
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   504
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   505
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   506
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   507
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   508
 * Find path to JRE based on .exe's location or registry settings.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   509
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   510
static jboolean
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   511
GetJREPath(char *path, jint pathsize, jboolean speculative)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   512
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   513
    char libjava[MAXPATHLEN];
40945
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   514
    struct stat s;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   515
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   516
    if (GetApplicationHome(path, pathsize)) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   517
        /* Is JRE co-located with the application? */
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   518
        JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/" JAVA_DLL, path);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   519
        if (access(libjava, F_OK) == 0) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   520
            JLI_TraceLauncher("JRE path is %s\n", path);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   521
            return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   522
        }
31690
3944eaf3322c 8073773: Presume path preparedness
ksrini
parents: 30467
diff changeset
   523
        /* ensure storage for path + /jre + NULL */
3944eaf3322c 8073773: Presume path preparedness
ksrini
parents: 30467
diff changeset
   524
        if ((JLI_StrLen(path) + 4  + 1) > (size_t) pathsize) {
3944eaf3322c 8073773: Presume path preparedness
ksrini
parents: 30467
diff changeset
   525
            JLI_TraceLauncher("Insufficient space to store JRE path\n");
3944eaf3322c 8073773: Presume path preparedness
ksrini
parents: 30467
diff changeset
   526
            return JNI_FALSE;
3944eaf3322c 8073773: Presume path preparedness
ksrini
parents: 30467
diff changeset
   527
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   528
        /* Does the app ship a private JRE in <apphome>/jre directory? */
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   529
        JLI_Snprintf(libjava, sizeof(libjava), "%s/jre/lib/" JAVA_DLL, path);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   530
        if (access(libjava, F_OK) == 0) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   531
            JLI_StrCat(path, "/jre");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   532
            JLI_TraceLauncher("JRE path is %s\n", path);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   533
            return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   534
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   535
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   536
40945
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   537
    if (GetApplicationHomeFromDll(path, pathsize)) {
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   538
        JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/" JAVA_DLL, path);
40945
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   539
        if (stat(libjava, &s) == 0) {
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   540
            JLI_TraceLauncher("JRE path is %s\n", path);
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   541
            return JNI_TRUE;
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   542
        }
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   543
    }
f241705723ea 8165524: Better detect JRE that Linux JLI will be using
ksrini
parents: 31690
diff changeset
   544
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   545
    if (!speculative)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   546
      JLI_ReportErrorMessage(JRE_ERROR8 JAVA_DLL);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   547
    return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   548
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   549
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   550
jboolean
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   551
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   552
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   553
    void *libjvm;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   554
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   555
    JLI_TraceLauncher("JVM path is %s\n", jvmpath);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   556
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   557
    libjvm = dlopen(jvmpath, RTLD_NOW + RTLD_GLOBAL);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   558
    if (libjvm == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   559
#if defined(__solaris__) && defined(__sparc) && !defined(_LP64) /* i.e. 32-bit sparc */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   560
      FILE * fp;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   561
      Elf32_Ehdr elf_head;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   562
      int count;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   563
      int location;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   564
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   565
      fp = fopen(jvmpath, "r");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   566
      if (fp == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   567
        JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   568
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   569
      }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   570
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   571
      /* read in elf header */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   572
      count = fread((void*)(&elf_head), sizeof(Elf32_Ehdr), 1, fp);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   573
      fclose(fp);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   574
      if (count < 1) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   575
        JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   576
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   577
      }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   578
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   579
      /*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   580
       * Check for running a server vm (compiled with -xarch=v8plus)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   581
       * on a stock v8 processor.  In this case, the machine type in
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   582
       * the elf header would not be included the architecture list
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   583
       * provided by the isalist command, which is turn is gotten from
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   584
       * sysinfo.  This case cannot occur on 64-bit hardware and thus
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   585
       * does not have to be checked for in binaries with an LP64 data
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   586
       * model.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   587
       */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   588
      if (elf_head.e_machine == EM_SPARC32PLUS) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   589
        char buf[257];  /* recommended buffer size from sysinfo man
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   590
                           page */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   591
        long length;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   592
        char* location;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   593
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   594
        length = sysinfo(SI_ISALIST, buf, 257);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   595
        if (length > 0) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   596
            location = JLI_StrStr(buf, "sparcv8plus ");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   597
          if (location == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   598
            JLI_ReportErrorMessage(JVM_ERROR3);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   599
            return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   600
          }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   601
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   602
      }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   603
#endif
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   604
        JLI_ReportErrorMessage(DLL_ERROR1, __LINE__);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   605
        JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   606
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   607
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   608
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   609
    ifn->CreateJavaVM = (CreateJavaVM_t)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   610
        dlsym(libjvm, "JNI_CreateJavaVM");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   611
    if (ifn->CreateJavaVM == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   612
        JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   613
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   614
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   615
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   616
    ifn->GetDefaultJavaVMInitArgs = (GetDefaultJavaVMInitArgs_t)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   617
        dlsym(libjvm, "JNI_GetDefaultJavaVMInitArgs");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   618
    if (ifn->GetDefaultJavaVMInitArgs == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   619
        JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   620
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   621
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   622
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   623
    ifn->GetCreatedJavaVMs = (GetCreatedJavaVMs_t)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   624
        dlsym(libjvm, "JNI_GetCreatedJavaVMs");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   625
    if (ifn->GetCreatedJavaVMs == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   626
        JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   627
        return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   628
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   629
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   630
    return JNI_TRUE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   631
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   632
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   633
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   634
 * Compute the name of the executable
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   635
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   636
 * In order to re-exec securely we need the absolute path of the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   637
 * executable. On Solaris getexecname(3c) may not return an absolute
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   638
 * path so we use dladdr to get the filename of the executable and
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   639
 * then use realpath to derive an absolute path. From Solaris 9
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   640
 * onwards the filename returned in DL_info structure from dladdr is
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   641
 * an absolute pathname so technically realpath isn't required.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   642
 * On Linux we read the executable name from /proc/self/exe.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   643
 * As a fallback, and for platforms other than Solaris and Linux,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   644
 * we use FindExecName to compute the executable name.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   645
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   646
const char*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   647
SetExecname(char **argv)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   648
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   649
    char* exec_path = NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   650
#if defined(__solaris__)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   651
    {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   652
        Dl_info dlinfo;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   653
        int (*fptr)();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   654
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   655
        fptr = (int (*)())dlsym(RTLD_DEFAULT, "main");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   656
        if (fptr == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   657
            JLI_ReportErrorMessage(DLL_ERROR3, dlerror());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   658
            return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   659
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   660
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   661
        if (dladdr((void*)fptr, &dlinfo)) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   662
            char *resolved = (char*)JLI_MemAlloc(PATH_MAX+1);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   663
            if (resolved != NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   664
                exec_path = realpath(dlinfo.dli_fname, resolved);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   665
                if (exec_path == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   666
                    JLI_MemFree(resolved);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   667
                }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   668
            }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   669
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   670
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   671
#elif defined(__linux__)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   672
    {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   673
        const char* self = "/proc/self/exe";
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   674
        char buf[PATH_MAX+1];
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   675
        int len = readlink(self, buf, PATH_MAX);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   676
        if (len >= 0) {
17911
04141bd79ced 8015299: Memory leak in jdk/src/solaris/bin/java_md_solinux.c
jzavgren
parents: 14690
diff changeset
   677
            buf[len] = '\0';            /* readlink(2) doesn't NUL terminate */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   678
            exec_path = JLI_StringDup(buf);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   679
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   680
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   681
#else /* !__solaris__ && !__linux__ */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   682
    {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   683
        /* Not implemented */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   684
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   685
#endif
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   686
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   687
    if (exec_path == NULL) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   688
        exec_path = FindExecName(argv[0]);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   689
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   690
    execname = exec_path;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   691
    return exec_path;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   692
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   693
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   694
/* --- Splash Screen shared library support --- */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   695
static const char* SPLASHSCREEN_SO = JNI_LIB_NAME("splashscreen");
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   696
static void* hSplashLib = NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   697
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   698
void* SplashProcAddress(const char* name) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   699
    if (!hSplashLib) {
20842
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   700
        int ret;
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   701
        char jrePath[MAXPATHLEN];
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   702
        char splashPath[MAXPATHLEN];
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   703
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   704
        if (!GetJREPath(jrePath, sizeof(jrePath), JNI_FALSE)) {
20842
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   705
            JLI_ReportErrorMessage(JRE_ERROR1);
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   706
            return NULL;
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   707
        }
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   708
        ret = JLI_Snprintf(splashPath, sizeof(splashPath), "%s/lib/%s",
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 40945
diff changeset
   709
                     jrePath, SPLASHSCREEN_SO);
20842
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   710
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   711
        if (ret >= (int) sizeof(splashPath)) {
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   712
            JLI_ReportErrorMessage(JRE_ERROR11);
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   713
            return NULL;
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   714
        }
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   715
        if (ret < 0) {
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   716
            JLI_ReportErrorMessage(JRE_ERROR13);
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   717
            return NULL;
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   718
        }
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   719
        hSplashLib = dlopen(splashPath, RTLD_LAZY | RTLD_GLOBAL);
276a62b19d45 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris
ksrini
parents: 17911
diff changeset
   720
        JLI_TraceLauncher("Info: loaded %s\n", splashPath);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   721
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   722
    if (hSplashLib) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   723
        void* sym = dlsym(hSplashLib, name);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   724
        return sym;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   725
    } else {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   726
        return NULL;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   727
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   728
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   729
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   730
/*
53941
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   731
 * Signature adapter for pthread_create() or thr_create().
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   732
 */
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   733
static void* ThreadJavaMain(void* args) {
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   734
    return (void*)(intptr_t)JavaMain(args);
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   735
}
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   736
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   737
/*
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   738
 * Block current thread and continue execution in a new thread.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   739
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   740
int
53941
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   741
CallJavaMainInNewThread(jlong stack_size, void* args) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   742
    int rslt;
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   743
#ifndef __solaris__
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   744
    pthread_t tid;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   745
    pthread_attr_t attr;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   746
    pthread_attr_init(&attr);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   747
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   748
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   749
    if (stack_size > 0) {
53941
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   750
        pthread_attr_setstacksize(&attr, stack_size);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   751
    }
46846
292be53258b7 8175342: assert(InstanceKlass::cast(k)->is_initialized()) failed: need to increase java_thread_min_stack_allowed calculation
cjplummer
parents: 42759
diff changeset
   752
    pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   753
53941
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   754
    if (pthread_create(&tid, &attr, ThreadJavaMain, args) == 0) {
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   755
        void* tmp;
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   756
        pthread_join(tid, &tmp);
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   757
        rslt = (int)(intptr_t)tmp;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   758
    } else {
53941
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   759
       /*
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   760
        * Continue execution in current thread if for some reason (e.g. out of
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   761
        * memory/LWP)  a new thread can't be created. This will likely fail
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   762
        * later in JavaMain as JNI_CreateJavaVM needs to create quite a
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   763
        * few new threads, anyway, just give it a try..
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   764
        */
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   765
        rslt = JavaMain(args);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   766
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   767
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   768
    pthread_attr_destroy(&attr);
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   769
#else /* __solaris__ */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   770
    thread_t tid;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   771
    long flags = 0;
53941
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   772
    if (thr_create(NULL, stack_size, ThreadJavaMain, args, flags, &tid) == 0) {
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   773
        void* tmp;
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   774
        thr_join(tid, NULL, &tmp);
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   775
        rslt = (int)(intptr_t)tmp;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   776
    } else {
53941
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   777
        /* See above. Continue in current thread if thr_create() failed */
f9302cf718c9 8215009: GCC 8 compilation error in libjli
dchuyko
parents: 53346
diff changeset
   778
        rslt = JavaMain(args);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   779
    }
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents: 20851
diff changeset
   780
#endif /* !__solaris__ */
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   781
    return rslt;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   782
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   783
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   784
/* Coarse estimation of number of digits assuming the worst case is a 64-bit pid. */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   785
#define MAX_PID_STR_SZ   20
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   786
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   787
int
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   788
JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   789
        int argc, char **argv,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   790
        int mode, char *what, int ret)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   791
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   792
    ShowSplashScreen();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   793
    return ContinueInNewThread(ifn, threadStackSize, argc, argv, mode, what, ret);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   794
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   795
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   796
void
30467
075f4f160f19 8076264: [macosx] Launching app on MacOSX requires enclosing class
serb
parents: 29742
diff changeset
   797
PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   798
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   799
    // stubbed out for windows and *nixes.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   800
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   801
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   802
void
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   803
RegisterThread()
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   804
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   805
    // stubbed out for windows and *nixes.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   806
}
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   807
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   808
/*
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   809
 * on unix, we return a false to indicate this option is not applicable
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   810
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   811
jboolean
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   812
ProcessPlatformOption(const char *arg)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   813
{
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   814
    return JNI_FALSE;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   815
}