6981484: Update development launcher
Add new development launcher called hotspot(.exe) Reviewed-by: coleenp
This commit is contained in:
parent
c4121e4375
commit
7765368022
@ -24,19 +24,23 @@
|
||||
|
||||
# Rules to build gamma launcher, used by vm.make
|
||||
|
||||
# gamma[_g]: launcher
|
||||
|
||||
LAUNCHER_SCRIPT = hotspot
|
||||
LAUNCHER = gamma
|
||||
LAUNCHER_G = $(LAUNCHER)$(G_SUFFIX)
|
||||
|
||||
LAUNCHERDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/launcher
|
||||
LAUNCHERFLAGS = $(ARCHFLAG) \
|
||||
LAUNCHERDIR := $(GAMMADIR)/src/os/posix/launcher
|
||||
LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
|
||||
LAUNCHERFLAGS := $(ARCHFLAG) \
|
||||
-I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
|
||||
-I$(LAUNCHERDIR_SHARE) \
|
||||
-DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
|
||||
-DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
|
||||
-DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
|
||||
-DARCH=\"$(LIBARCH)\" \
|
||||
-DGAMMA \
|
||||
-DLAUNCHER_TYPE=\"gamma\" \
|
||||
-DLINK_INTO_$(LINK_INTO)
|
||||
-DLINK_INTO_$(LINK_INTO) \
|
||||
$(TARGET_DEFINES)
|
||||
|
||||
ifeq ($(LINK_INTO),AOUT)
|
||||
LAUNCHER.o = launcher.o $(JVM_OBJ_FILES)
|
||||
@ -55,22 +59,35 @@ LINK_LAUNCHER = $(LINK.c)
|
||||
LINK_LAUNCHER/PRE_HOOK = $(LINK_LIB.CC/PRE_HOOK)
|
||||
LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CC/POST_HOOK)
|
||||
|
||||
launcher.o: launcher.c $(LAUNCHERDIR)/java.c $(LAUNCHERDIR)/java_md.c
|
||||
$(CC) -g -c -o $@ launcher.c $(LAUNCHERFLAGS) $(CPPFLAGS) $(TARGET_DEFINES)
|
||||
LAUNCHER_OUT = launcher
|
||||
|
||||
launcher.c:
|
||||
@echo Generating $@
|
||||
$(QUIETLY) { \
|
||||
echo '#define debug launcher_debug'; \
|
||||
echo '#include "java.c"'; \
|
||||
echo '#include "java_md.c"'; \
|
||||
} > $@
|
||||
SUFFIXES += .d
|
||||
|
||||
SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
|
||||
SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
|
||||
|
||||
OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
|
||||
|
||||
DEPFILES := $(patsubst %.o,%.d,$(OBJS))
|
||||
-include $(DEPFILES)
|
||||
|
||||
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
|
||||
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
|
||||
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CPPFLAGS)
|
||||
|
||||
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
|
||||
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
|
||||
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CPPFLAGS)
|
||||
|
||||
$(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
|
||||
$(QUIETLY) echo Linking launcher...
|
||||
$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
|
||||
$(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(OBJS) $(LIBS_LAUNCHER)
|
||||
$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
|
||||
|
||||
$(LAUNCHER): $(LAUNCHER_SCRIPT)
|
||||
|
||||
$(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
|
||||
$(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
|
||||
$(QUIETLY) chmod +x $@
|
||||
|
||||
$(LAUNCHER): $(LAUNCHER.o) $(LIBJVM) $(LAUNCHER_MAPFILE)
|
||||
$(QUIETLY) { \
|
||||
echo Linking launcher...; \
|
||||
$(LINK_LAUNCHER/PRE_HOOK) \
|
||||
$(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(LAUNCHER.o) $(LIBS_LAUNCHER); \
|
||||
$(LINK_LAUNCHER/POST_HOOK) \
|
||||
[ -f $(LAUNCHER_G) ] || { ln -s $@ $(LAUNCHER_G); }; \
|
||||
}
|
||||
|
@ -24,18 +24,22 @@
|
||||
|
||||
# Rules to build gamma launcher, used by vm.make
|
||||
|
||||
# gamma[_g]: launcher
|
||||
LAUNCHER_SCRIPT = hotspot
|
||||
LAUNCHER = gamma
|
||||
LAUNCHER_G = $(LAUNCHER)$(G_SUFFIX)
|
||||
|
||||
LAUNCHERDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/launcher
|
||||
LAUNCHERDIR = $(GAMMADIR)/src/os/posix/launcher
|
||||
LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
|
||||
LAUNCHERFLAGS = $(ARCHFLAG) \
|
||||
-I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
|
||||
-I$(LAUNCHERDIR_SHARE) \
|
||||
-DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
|
||||
-DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
|
||||
-DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
|
||||
-DARCH=\"$(LIBARCH)\" \
|
||||
-DGAMMA \
|
||||
-DLAUNCHER_TYPE=\"gamma\" \
|
||||
-DLINK_INTO_$(LINK_INTO)
|
||||
-DLINK_INTO_$(LINK_INTO) \
|
||||
$(TARGET_DEFINES)
|
||||
|
||||
ifeq ($(LINK_INTO),AOUT)
|
||||
LAUNCHER.o = launcher.o $(JVM_OBJ_FILES)
|
||||
@ -68,24 +72,37 @@ ifeq ("${Platform_compiler}", "sparcWorks")
|
||||
#LAUNCHERFLAGS += -W0,-noglobal
|
||||
endif # Platform_compiler == sparcWorks
|
||||
|
||||
launcher.o: launcher.c $(LAUNCHERDIR)/java.c $(LAUNCHERDIR)/java_md.c
|
||||
$(CC) -g -c -o $@ launcher.c $(LAUNCHERFLAGS) $(CPPFLAGS) ${TARGET_DEFINES}
|
||||
LAUNCHER_OUT = launcher
|
||||
|
||||
launcher.c:
|
||||
@echo Generating $@
|
||||
$(QUIETLY) { \
|
||||
echo '#define debug launcher_debug'; \
|
||||
echo '#include "java.c"'; \
|
||||
echo '#include "java_md.c"'; \
|
||||
} > $@
|
||||
SUFFIXES += .d
|
||||
|
||||
$(LAUNCHER): $(LAUNCHER.o) $(LIBJVM) $(LAUNCHER_MAPFILE)
|
||||
SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
|
||||
SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
|
||||
|
||||
OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
|
||||
|
||||
DEPFILES := $(patsubst %.o,%.d,$(OBJS))
|
||||
-include $(DEPFILES)
|
||||
|
||||
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
|
||||
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
|
||||
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CPPFLAGS)
|
||||
|
||||
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
|
||||
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
|
||||
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CPPFLAGS)
|
||||
|
||||
$(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
|
||||
ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
|
||||
@echo Linking launcher...
|
||||
$(QUIETLY) echo Linking launcher...
|
||||
$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
|
||||
$(QUIETLY) \
|
||||
$(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(LAUNCHER.o) $(LIBS_LAUNCHER)
|
||||
$(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(OBJS) $(LIBS_LAUNCHER)
|
||||
$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
|
||||
[ -f $(LAUNCHER_G) ] || ln -s $@ $(LAUNCHER_G)
|
||||
endif # filter -sbfast -xsbfast
|
||||
|
||||
$(LAUNCHER): $(LAUNCHER_SCRIPT)
|
||||
|
||||
$(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
|
||||
$(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
|
||||
$(QUIETLY) chmod +x $@
|
||||
|
||||
|
@ -26,6 +26,7 @@ HS_INTERNAL_NAME=jvm
|
||||
HS_FNAME=$(HS_INTERNAL_NAME).dll
|
||||
AOUT=$(HS_FNAME)
|
||||
SAWINDBG=sawindbg.dll
|
||||
LAUNCHER_NAME=hotspot.exe
|
||||
GENERATED=../generated
|
||||
|
||||
# Allow the user to turn off precompiled headers from the command line.
|
||||
@ -33,7 +34,7 @@ GENERATED=../generated
|
||||
BUILD_PCH_FILE=_build_pch_file.obj
|
||||
!endif
|
||||
|
||||
default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
|
||||
default:: $(BUILD_PCH_FILE) $(AOUT) $(LAUNCHER_NAME) checkAndBuildSA
|
||||
|
||||
!include ../local.make
|
||||
!include compile.make
|
||||
@ -62,3 +63,4 @@ $(AOUT): $(Res_Files) $(Obj_Files)
|
||||
|
||||
!include $(WorkSpace)/make/windows/makefiles/shared.make
|
||||
!include $(WorkSpace)/make/windows/makefiles/sa.make
|
||||
!include $(WorkSpace)/make/windows/makefiles/launcher.make
|
||||
|
@ -26,6 +26,7 @@ HS_INTERNAL_NAME=jvm
|
||||
HS_FNAME=$(HS_INTERNAL_NAME).dll
|
||||
AOUT=$(HS_FNAME)
|
||||
SAWINDBG=sawindbg.dll
|
||||
LAUNCHER_NAME=hotspot.exe
|
||||
GENERATED=../generated
|
||||
|
||||
# Allow the user to turn off precompiled headers from the command line.
|
||||
@ -33,7 +34,7 @@ GENERATED=../generated
|
||||
BUILD_PCH_FILE=_build_pch_file.obj
|
||||
!endif
|
||||
|
||||
default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
|
||||
default:: $(BUILD_PCH_FILE) $(AOUT) $(LAUNCHER_NAME) checkAndBuildSA
|
||||
|
||||
!include ../local.make
|
||||
!include compile.make
|
||||
@ -62,3 +63,4 @@ $(AOUT): $(Res_Files) $(Obj_Files)
|
||||
|
||||
!include $(WorkSpace)/make/windows/makefiles/shared.make
|
||||
!include $(WorkSpace)/make/windows/makefiles/sa.make
|
||||
!include $(WorkSpace)/make/windows/makefiles/launcher.make
|
||||
|
67
hotspot/make/windows/makefiles/launcher.make
Normal file
67
hotspot/make/windows/makefiles/launcher.make
Normal file
@ -0,0 +1,67 @@
|
||||
#
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
#
|
||||
|
||||
LAUNCHER_FLAGS=$(ARCHFLAG) \
|
||||
/D FULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
|
||||
/D JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
|
||||
/D JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
|
||||
/D GAMMA \
|
||||
/D LAUNCHER_TYPE=\"gamma\" \
|
||||
/D _CRT_SECURE_NO_WARNINGS \
|
||||
/D _CRT_SECURE_NO_DEPRECATE \
|
||||
/D LINK_INTO_LIBJVM \
|
||||
/I $(WorkSpace)\src\os\windows\launcher \
|
||||
/I $(WorkSpace)\src\share\tools\launcher
|
||||
|
||||
CPP_FLAGS=$(CPP_FLAGS) $(LAUNCHER_FLAGS)
|
||||
|
||||
LINK_FLAGS=/manifest $(HS_INTERNAL_NAME).lib kernel32.lib user32.lib /nologo /machine:$(MACHINE) /map /debug /subsystem:console
|
||||
|
||||
!if "$(COMPILER_NAME)" == "VS2005"
|
||||
# This VS2005 compiler has /GS as a default and requires bufferoverflowU.lib
|
||||
# on the link command line, otherwise we get missing __security_check_cookie
|
||||
# externals at link time. Even with /GS-, you need bufferoverflowU.lib.
|
||||
BUFFEROVERFLOWLIB = bufferoverflowU.lib
|
||||
LINK_FLAGS = $(LINK_FLAGS) $(BUFFEROVERFLOWLIB)
|
||||
!endif
|
||||
|
||||
LAUNCHERDIR = $(GAMMADIR)/src/os/windows/launcher
|
||||
LAUNCHERDIR_SHARE = $(GAMMADIR)/src/share/tools/launcher
|
||||
|
||||
OUTDIR = launcher
|
||||
|
||||
{$(LAUNCHERDIR)}.c{$(OUTDIR)}.obj:
|
||||
-mkdir $(OUTDIR)
|
||||
$(CPP) $(CPP_FLAGS) /c /Fo$@ $<
|
||||
|
||||
{$(LAUNCHERDIR_SHARE)}.c{$(OUTDIR)}.obj:
|
||||
-mkdir $(OUTDIR)
|
||||
$(CPP) $(CPP_FLAGS) /c /Fo$@ $<
|
||||
|
||||
$(OUTDIR)\*.obj: $(LAUNCHERDIR)\*.c $(LAUNCHERDIR)\*.h $(LAUNCHERDIR_SHARE)\*.c $(LAUNCHERDIR_SHARE)\*.h
|
||||
|
||||
$(LAUNCHER_NAME): $(OUTDIR)\java.obj $(OUTDIR)\java_md.obj $(OUTDIR)\jli_util.obj
|
||||
$(LINK) $(LINK_FLAGS) /out:$@ $**
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
HS_INTERNAL_NAME=jvm
|
||||
HS_FNAME=$(HS_INTERNAL_NAME).dll
|
||||
AOUT=$(HS_FNAME)
|
||||
LAUNCHER_NAME=hotspot.exe
|
||||
GENERATED=../generated
|
||||
|
||||
# Allow the user to turn off precompiled headers from the command line.
|
||||
@ -32,7 +33,7 @@ GENERATED=../generated
|
||||
BUILD_PCH_FILE=_build_pch_file.obj
|
||||
!endif
|
||||
|
||||
default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
|
||||
default:: $(BUILD_PCH_FILE) $(AOUT) $(LAUNCHER_NAME) checkAndBuildSA
|
||||
|
||||
!include ../local.make
|
||||
!include compile.make
|
||||
@ -73,3 +74,4 @@ $(AOUT): $(Res_Files) $(Obj_Files)
|
||||
|
||||
!include $(WorkSpace)/make/windows/makefiles/shared.make
|
||||
!include $(WorkSpace)/make/windows/makefiles/sa.make
|
||||
!include $(WorkSpace)/make/windows/makefiles/launcher.make
|
||||
|
@ -22,10 +22,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
|
||||
* search "GAMMA" for gamma specific changes.
|
||||
*/
|
||||
|
||||
#include "java.h"
|
||||
#include <dirent.h>
|
||||
@ -45,64 +41,42 @@
|
||||
#include "version_comp.h"
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <pthread.h>
|
||||
#else
|
||||
#include <thread.h>
|
||||
#endif
|
||||
|
||||
#define JVM_DLL "libjvm.so"
|
||||
#define JAVA_DLL "libjava.so"
|
||||
|
||||
#ifndef GAMMA /* launcher.make defines ARCH */
|
||||
|
||||
/*
|
||||
* If a processor / os combination has the ability to run binaries of
|
||||
* two data models and cohabitation of jre/jdk bits with both data
|
||||
* models is supported, then DUAL_MODE is defined. When DUAL_MODE is
|
||||
* defined, the architecture names for the narrow and wide version of
|
||||
* the architecture are defined in BIG_ARCH and SMALL_ARCH. Currently
|
||||
* the architecture are defined in LIBARCH64NAME and LIBARCH32NAME. Currently
|
||||
* only Solaris on sparc/sparcv9 and i586/amd64 is DUAL_MODE; linux
|
||||
* i586/amd64 could be defined as DUAL_MODE but that is not the
|
||||
* current policy.
|
||||
*/
|
||||
|
||||
#ifdef _LP64
|
||||
|
||||
# ifdef ia64
|
||||
# define ARCH "ia64"
|
||||
# elif defined(amd64)
|
||||
# define ARCH "amd64"
|
||||
# elif defined(__sparc)
|
||||
# define ARCH "sparcv9"
|
||||
# else
|
||||
# define ARCH "unknown" /* unknown 64-bit architecture */
|
||||
# endif
|
||||
|
||||
#else /* 32-bit data model */
|
||||
|
||||
# ifdef i586
|
||||
# define ARCH "i386"
|
||||
# elif defined(__sparc)
|
||||
# define ARCH "sparc"
|
||||
# elif defined(arm)
|
||||
# define ARCH "arm"
|
||||
# elif defined(PPC)
|
||||
# define ARCH "ppc"
|
||||
# endif
|
||||
|
||||
#endif /* _LP64 */
|
||||
#ifndef LIBARCHNAME
|
||||
# error "The macro LIBARCHNAME was not defined on the compile line"
|
||||
#endif
|
||||
|
||||
#ifdef __sun
|
||||
# define DUAL_MODE
|
||||
# ifdef __sparc
|
||||
# define BIG_ARCH "sparcv9"
|
||||
# define SMALL_ARCH "sparc"
|
||||
# else
|
||||
# define BIG_ARCH "amd64"
|
||||
# define SMALL_ARCH "i386"
|
||||
# ifndef LIBARCH32NAME
|
||||
# error "The macro LIBARCH32NAME was not defined on the compile line"
|
||||
# endif
|
||||
# ifndef LIBARCH64NAME
|
||||
# error "The macro LIBARCH64NAME was not defined on the compile line"
|
||||
# endif
|
||||
# include <sys/systeminfo.h>
|
||||
# include <sys/elf.h>
|
||||
# include <stdio.h>
|
||||
#else
|
||||
# ifndef ARCH
|
||||
# include <sys/systeminfo.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* ifndef GAMMA */
|
||||
@ -111,7 +85,6 @@
|
||||
extern char **environ;
|
||||
|
||||
#ifndef GAMMA
|
||||
|
||||
/*
|
||||
* A collection of useful strings. One should think of these as #define
|
||||
* entries, but actual strings can be more efficient (with many compilers).
|
||||
@ -124,7 +97,7 @@ static const char *system_dir = "/usr/jdk";
|
||||
static const char *user_dir = "/jdk";
|
||||
#endif
|
||||
|
||||
#endif /* ifndef GAMMA */
|
||||
#endif /* ifndef GAMMA */
|
||||
|
||||
/*
|
||||
* Flowchart of launcher execs and options processing on unix
|
||||
@ -196,23 +169,13 @@ static jboolean GetJVMPath(const char *jrepath, const char *jvmtype,
|
||||
char *jvmpath, jint jvmpathsize, char * arch);
|
||||
static jboolean GetJREPath(char *path, jint pathsize, char * arch, jboolean speculative);
|
||||
|
||||
#ifndef GAMMA
|
||||
const char *
|
||||
GetArch()
|
||||
{
|
||||
static char *arch = NULL;
|
||||
static char buf[12];
|
||||
if (arch) {
|
||||
return arch;
|
||||
}
|
||||
|
||||
#ifdef ARCH
|
||||
strcpy(buf, ARCH);
|
||||
#else
|
||||
sysinfo(SI_ARCHITECTURE, buf, sizeof(buf));
|
||||
#endif
|
||||
arch = buf;
|
||||
return arch;
|
||||
return LIBARCHNAME;
|
||||
}
|
||||
#endif /* ifndef GAMMA */
|
||||
|
||||
void
|
||||
CreateExecutionEnvironment(int *_argcp,
|
||||
@ -287,7 +250,7 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
{ /* open new scope to declare local variables */
|
||||
int i;
|
||||
|
||||
newargv = (char **)MemAlloc((argc+1) * sizeof(*newargv));
|
||||
newargv = (char **)JLI_MemAlloc((argc+1) * sizeof(*newargv));
|
||||
newargv[newargc++] = argv[0];
|
||||
|
||||
/* scan for data model arguments and remove from argument list;
|
||||
@ -358,7 +321,7 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
#ifdef DUAL_MODE
|
||||
if (running != wanted) {
|
||||
/* Find out where the JRE is that we will be using. */
|
||||
if (!GetJREPath(jrepath, so_jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH), JNI_TRUE)) {
|
||||
if (!GetJREPath(jrepath, so_jrepath, ((wanted==64)?LIBARCH64NAME:LIBARCH32NAME), JNI_TRUE)) {
|
||||
goto EndDataModelSpeculate;
|
||||
}
|
||||
|
||||
@ -366,14 +329,14 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
* Read in jvm.cfg for target data model and process vm
|
||||
* selection options.
|
||||
*/
|
||||
if (ReadKnownVMs(jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH), JNI_TRUE) < 1) {
|
||||
if (ReadKnownVMs(jrepath, ((wanted==64)?LIBARCH64NAME:LIBARCH32NAME), JNI_TRUE) < 1) {
|
||||
goto EndDataModelSpeculate;
|
||||
}
|
||||
jvmpath[0] = '\0';
|
||||
jvmtype = CheckJvmType(_argcp, _argvp, JNI_TRUE);
|
||||
/* exec child can do error checking on the existence of the path */
|
||||
jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath,
|
||||
((wanted==64)?BIG_ARCH:SMALL_ARCH));
|
||||
((wanted==64)?LIBARCH64NAME:LIBARCH32NAME));
|
||||
|
||||
}
|
||||
EndDataModelSpeculate: /* give up and let other code report error message */
|
||||
@ -388,8 +351,8 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
* We will set the LD_LIBRARY_PATH as follows:
|
||||
*
|
||||
* o $JVMPATH (directory portion only)
|
||||
* o $JRE/lib/$ARCH
|
||||
* o $JRE/../lib/$ARCH
|
||||
* o $JRE/lib/$LIBARCHNAME
|
||||
* o $JRE/../lib/$LIBARCHNAME
|
||||
*
|
||||
* followed by the user's previous effective LD_LIBRARY_PATH, if
|
||||
* any.
|
||||
@ -483,8 +446,8 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
|
||||
/* runpath contains current effective LD_LIBRARY_PATH setting */
|
||||
|
||||
jvmpath = strdup(jvmpath);
|
||||
new_runpath = MemAlloc( ((runpath!=NULL)?strlen(runpath):0) +
|
||||
jvmpath = JLI_StringDup(jvmpath);
|
||||
new_runpath = JLI_MemAlloc( ((runpath!=NULL)?strlen(runpath):0) +
|
||||
2*strlen(jrepath) + 2*strlen(arch) +
|
||||
strlen(jvmpath) + 52);
|
||||
newpath = new_runpath + strlen("LD_LIBRARY_PATH=");
|
||||
@ -500,7 +463,7 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
*lastslash = '\0';
|
||||
|
||||
|
||||
/* jvmpath, ((running != wanted)?((wanted==64)?"/"BIG_ARCH:"/.."):""), */
|
||||
/* jvmpath, ((running != wanted)?((wanted==64)?"/"LIBARCH64NAME:"/.."):""), */
|
||||
|
||||
sprintf(new_runpath, "LD_LIBRARY_PATH="
|
||||
"%s:"
|
||||
@ -508,8 +471,8 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
"%s/../lib/%s",
|
||||
jvmpath,
|
||||
#ifdef DUAL_MODE
|
||||
jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH),
|
||||
jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH)
|
||||
jrepath, ((wanted==64)?LIBARCH64NAME:LIBARCH32NAME),
|
||||
jrepath, ((wanted==64)?LIBARCH64NAME:LIBARCH32NAME)
|
||||
#else
|
||||
jrepath, arch,
|
||||
jrepath, arch
|
||||
@ -576,7 +539,7 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
* executable must be updated accordingly; the executable name
|
||||
* and directory the executable resides in are separate. In the
|
||||
* case of 32 => 64, the new bits are assumed to reside in, e.g.
|
||||
* "olddir/BIGARCH/execname"; in the case of 64 => 32,
|
||||
* "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32,
|
||||
* the bits are assumed to be in "olddir/../execname". For example,
|
||||
*
|
||||
* olddir/sparcv9/execname
|
||||
@ -586,19 +549,21 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
*/
|
||||
|
||||
if (running != wanted) {
|
||||
char *oldexec = strcpy(MemAlloc(strlen(execname) + 1), execname);
|
||||
char *oldexec = strcpy(JLI_MemAlloc(strlen(execname) + 1), execname);
|
||||
char *olddir = oldexec;
|
||||
char *oldbase = strrchr(oldexec, '/');
|
||||
|
||||
|
||||
newexec = MemAlloc(strlen(execname) + 20);
|
||||
newexec = JLI_MemAlloc(strlen(execname) + 20);
|
||||
*oldbase++ = 0;
|
||||
sprintf(newexec, "%s/%s/%s", olddir,
|
||||
((wanted==64) ? BIG_ARCH : ".."), oldbase);
|
||||
((wanted==64) ? LIBARCH64NAME : ".."), oldbase);
|
||||
argv[0] = newexec;
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)fflush(stdout);
|
||||
(void)fflush(stderr);
|
||||
execve(newexec, argv, newenvp);
|
||||
perror("execve()");
|
||||
|
||||
@ -630,12 +595,14 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
|
||||
#else /* ifndef GAMMA */
|
||||
|
||||
/* gamma launcher is simpler in that it doesn't handle VM flavors, data */
|
||||
/* model, LD_LIBRARY_PATH, etc. Assuming everything is set-up correctly */
|
||||
/* all we need to do here is to return correct path names. See also */
|
||||
/* GetJVMPath() and GetApplicationHome(). */
|
||||
/*
|
||||
* gamma launcher is simpler in that it doesn't handle VM flavors, data
|
||||
* model, LD_LIBRARY_PATH, etc. Assuming everything is set-up correctly
|
||||
* all we need to do here is to return correct path names. See also
|
||||
* GetJVMPath() and GetApplicationHome().
|
||||
*/
|
||||
|
||||
{ char *arch = (char *)GetArch(); /* like sparc or sparcv9 */
|
||||
{ char *arch = (char *) ARCH; /* like sparc or sparcv9 */
|
||||
char *p;
|
||||
|
||||
if (!GetJREPath(jrepath, so_jrepath, arch, JNI_FALSE) ) {
|
||||
@ -669,9 +636,11 @@ GetJVMPath(const char *jrepath, const char *jvmtype,
|
||||
sprintf(jvmpath, "%s/lib/%s/%s/" JVM_DLL, jrepath, arch, jvmtype);
|
||||
}
|
||||
#else
|
||||
/* For gamma launcher, JVM is either built-in or in the same directory. */
|
||||
/* Either way we return "<exe_path>/libjvm.so" where <exe_path> is the */
|
||||
/* directory where gamma launcher is located. */
|
||||
/*
|
||||
* For gamma launcher, JVM is either built-in or in the same directory.
|
||||
* Either way we return "<exe_path>/libjvm.so" where <exe_path> is the
|
||||
* directory where gamma launcher is located.
|
||||
*/
|
||||
|
||||
char *p;
|
||||
|
||||
@ -684,7 +653,7 @@ GetJVMPath(const char *jrepath, const char *jvmtype,
|
||||
/* this case shouldn't happen */
|
||||
snprintf(jvmpath, jvmpathsize, "%s", JVM_DLL);
|
||||
}
|
||||
#endif
|
||||
#endif /* ifndef GAMMA */
|
||||
|
||||
if (_launcher_debug)
|
||||
printf("Does `%s' exist ... ", jvmpath);
|
||||
@ -742,7 +711,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
|
||||
ifn->GetDefaultJavaVMInitArgs = JNI_GetDefaultJavaVMInitArgs;
|
||||
return JNI_TRUE;
|
||||
#else
|
||||
Dl_info dlinfo;
|
||||
Dl_info dlinfo;
|
||||
void *libjvm;
|
||||
|
||||
if (_launcher_debug) {
|
||||
@ -813,24 +782,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
|
||||
error:
|
||||
fprintf(stderr, "Error: failed %s, because %s\n", jvmpath, dlerror());
|
||||
return JNI_FALSE;
|
||||
#endif /* GAMMA */
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the path to the file that has the usage message for -X options.
|
||||
*/
|
||||
void
|
||||
GetXUsagePath(char *buf, jint bufsize)
|
||||
{
|
||||
static const char Xusage_txt[] = "/Xusage.txt";
|
||||
Dl_info dlinfo;
|
||||
|
||||
/* we use RTLD_NOW because of problems with ld.so.1 and green threads */
|
||||
dladdr(dlsym(dlopen(JVM_DLL, RTLD_NOW), "JNI_CreateJavaVM"), &dlinfo);
|
||||
strncpy(buf, (char *)dlinfo.dli_fname, bufsize - sizeof(Xusage_txt));
|
||||
|
||||
buf[bufsize-1] = '\0';
|
||||
strcpy(strrchr(buf, '/'), Xusage_txt);
|
||||
#endif /* ifndef GAMMA */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -860,13 +812,16 @@ GetApplicationHome(char *buf, jint bufsize)
|
||||
|
||||
#ifdef GAMMA
|
||||
{
|
||||
/* gamma launcher uses JAVA_HOME environment variable to find JDK/JRE */
|
||||
char* java_home_var = getenv("JAVA_HOME");
|
||||
if (java_home_var == NULL) {
|
||||
printf("JAVA_HOME must point to a valid JDK/JRE to run gamma\n");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
snprintf(buf, bufsize, "%s", java_home_var);
|
||||
/* gamma launcher uses JAVA_HOME or ALT_JAVA_HOME environment variable to find JDK/JRE */
|
||||
char* java_home_var = getenv("ALT_JAVA_HOME");
|
||||
if (java_home_var == NULL) {
|
||||
java_home_var = getenv("JAVA_HOME");
|
||||
}
|
||||
if (java_home_var == NULL) {
|
||||
printf("JAVA_HOME or ALT_JAVA_HOME must point to a valid JDK/JRE to run gamma\n");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
snprintf(buf, bufsize, "%s", java_home_var);
|
||||
}
|
||||
#else
|
||||
if (strrchr(buf, '/') == 0) {
|
||||
@ -885,7 +840,7 @@ GetApplicationHome(char *buf, jint bufsize)
|
||||
return JNI_FALSE;
|
||||
}
|
||||
*(strrchr(buf, '/')) = '\0'; /* bin */
|
||||
#endif /* GAMMA */
|
||||
#endif /* ifndef GAMMA */
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
@ -915,7 +870,7 @@ Resolve(char *indir, char *cmd)
|
||||
if ((strlen(indir) + strlen(cmd) + 1) > PATH_MAX) return 0;
|
||||
sprintf(name, "%s%c%s", indir, FILE_SEPARATOR, cmd);
|
||||
if (!ProgramExists(name)) return 0;
|
||||
real = MemAlloc(PATH_MAX + 2);
|
||||
real = JLI_MemAlloc(PATH_MAX + 2);
|
||||
if (!realpath(name, real))
|
||||
strcpy(real, name);
|
||||
return real;
|
||||
@ -948,7 +903,7 @@ FindExecName(char *program)
|
||||
/* from search path? */
|
||||
path = getenv("PATH");
|
||||
if (!path || !*path) path = ".";
|
||||
tmp_path = MemAlloc(strlen(path) + 2);
|
||||
tmp_path = JLI_MemAlloc(strlen(path) + 2);
|
||||
strcpy(tmp_path, path);
|
||||
|
||||
for (f=tmp_path; *f && result==0; ) {
|
||||
@ -967,7 +922,7 @@ FindExecName(char *program)
|
||||
if (result != 0) break;
|
||||
}
|
||||
|
||||
free(tmp_path);
|
||||
JLI_MemFree(tmp_path);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1000,11 +955,11 @@ SetExecname(char **argv)
|
||||
{
|
||||
Dl_info dlinfo;
|
||||
if (dladdr((void*)&SetExecname, &dlinfo)) {
|
||||
char *resolved = (char*)MemAlloc(PATH_MAX+1);
|
||||
char *resolved = (char*)JLI_MemAlloc(PATH_MAX+1);
|
||||
if (resolved != NULL) {
|
||||
exec_path = realpath(dlinfo.dli_fname, resolved);
|
||||
if (exec_path == NULL) {
|
||||
free(resolved);
|
||||
JLI_MemFree(resolved);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1016,7 +971,7 @@ SetExecname(char **argv)
|
||||
int len = readlink(self, buf, PATH_MAX);
|
||||
if (len >= 0) {
|
||||
buf[len] = '\0'; /* readlink doesn't nul terminate */
|
||||
exec_path = strdup(buf);
|
||||
exec_path = JLI_StringDup(buf);
|
||||
}
|
||||
}
|
||||
#else /* !__sun && !__linux */
|
||||
@ -1091,8 +1046,7 @@ void PrintMachineDependentOptions() {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef GAMMA /* gamma launcher does not have ergonomics */
|
||||
|
||||
#ifndef GAMMA
|
||||
/*
|
||||
* The following methods (down to ServerClassMachine()) answer
|
||||
* the question about whether a machine is a "server-class"
|
||||
@ -1164,7 +1118,7 @@ solaris_sparc_ServerClassMachine(void) {
|
||||
}
|
||||
}
|
||||
if (_launcher_debug) {
|
||||
printf("solaris_" ARCH "_ServerClassMachine: %s\n",
|
||||
printf("solaris_" LIBARCHNAME "_ServerClassMachine: %s\n",
|
||||
(result == JNI_TRUE ? "JNI_TRUE" : "JNI_FALSE"));
|
||||
}
|
||||
return result;
|
||||
@ -1262,7 +1216,6 @@ get_cpuid(uint32_t arg,
|
||||
uint32_t value_of_edx = 0;
|
||||
__asm__ volatile (/* Instructions */
|
||||
/* ebx is callee-save, so push it */
|
||||
/* even though it's in the clobbers section */
|
||||
" pushl %%ebx \n"
|
||||
" movl %4, %%eax \n"
|
||||
" cpuid \n"
|
||||
@ -1281,7 +1234,7 @@ get_cpuid(uint32_t arg,
|
||||
: /* Inputs */
|
||||
"m" (arg)
|
||||
: /* Clobbers */
|
||||
"%eax", "%ebx", "%ecx", "%edx"
|
||||
"%eax", "%ecx", "%edx"
|
||||
);
|
||||
*eaxp = value_of_eax;
|
||||
*ebxp = value_of_ebx;
|
||||
@ -1461,7 +1414,7 @@ solaris_i586_ServerClassMachine(void) {
|
||||
}
|
||||
}
|
||||
if (_launcher_debug) {
|
||||
printf("solaris_" ARCH "_ServerClassMachine: %s\n",
|
||||
printf("solaris_" LIBARCHNAME "_ServerClassMachine: %s\n",
|
||||
(result == JNI_TRUE ? "true" : "false"));
|
||||
}
|
||||
return result;
|
||||
@ -1494,7 +1447,7 @@ linux_i586_ServerClassMachine(void) {
|
||||
}
|
||||
}
|
||||
if (_launcher_debug) {
|
||||
printf("linux_" ARCH "_ServerClassMachine: %s\n",
|
||||
printf("linux_" LIBARCHNAME "_ServerClassMachine: %s\n",
|
||||
(result == JNI_TRUE ? "true" : "false"));
|
||||
}
|
||||
return result;
|
||||
@ -1506,7 +1459,11 @@ linux_i586_ServerClassMachine(void) {
|
||||
jboolean
|
||||
ServerClassMachine(void) {
|
||||
jboolean result = JNI_FALSE;
|
||||
#if defined(__sun) && defined(__sparc)
|
||||
#if defined(NEVER_ACT_AS_SERVER_CLASS_MACHINE)
|
||||
result = JNI_FALSE;
|
||||
#elif defined(ALWAYS_ACT_AS_SERVER_CLASS_MACHINE)
|
||||
result = JNI_TRUE;
|
||||
#elif defined(__sun) && defined(__sparc)
|
||||
result = solaris_sparc_ServerClassMachine();
|
||||
#elif defined(__sun) && defined(i586)
|
||||
result = solaris_i586_ServerClassMachine();
|
||||
@ -1521,10 +1478,6 @@ ServerClassMachine(void) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* ifndef GAMMA */
|
||||
|
||||
#ifndef GAMMA /* gamma launcher does not choose JDK/JRE/JVM */
|
||||
|
||||
/*
|
||||
* Since using the file system as a registry is a bit risky, perform
|
||||
* additional sanity checks on the identified directory to validate
|
||||
@ -1591,13 +1544,13 @@ static char
|
||||
else if (strncmp(dp->d_name, "j2sdk", 5) == 0)
|
||||
offset = 5;
|
||||
if (offset > 0) {
|
||||
if ((acceptable_release(dp->d_name + offset,
|
||||
if ((JLI_AcceptableRelease(dp->d_name + offset,
|
||||
info->jre_version)) && CheckSanity(dirname, dp->d_name))
|
||||
if ((best == NULL) || (exact_version_id(
|
||||
if ((best == NULL) || (JLI_ExactVersionId(
|
||||
dp->d_name + offset, best + best_offset) > 0)) {
|
||||
if (best != NULL)
|
||||
free(best);
|
||||
best = strdup(dp->d_name);
|
||||
JLI_MemFree(best);
|
||||
best = JLI_StringDup(dp->d_name);
|
||||
best_offset = offset;
|
||||
}
|
||||
}
|
||||
@ -1607,9 +1560,9 @@ static char
|
||||
if (best == NULL)
|
||||
return (NULL);
|
||||
else {
|
||||
ret_str = MemAlloc(strlen(dirname) + strlen(best) + 2);
|
||||
ret_str = JLI_MemAlloc(strlen(dirname) + strlen(best) + 2);
|
||||
ret_str = strcat(strcat(strcpy(ret_str, dirname), "/"), best);
|
||||
free(best);
|
||||
JLI_MemFree(best);
|
||||
return (ret_str);
|
||||
}
|
||||
}
|
||||
@ -1636,16 +1589,17 @@ LocateJRE(manifest_info* info)
|
||||
* Start by getting JAVA_VERSION_PATH
|
||||
*/
|
||||
if (info->jre_restrict_search)
|
||||
path = strdup(system_dir);
|
||||
path = JLI_StringDup(system_dir);
|
||||
else if ((path = getenv("JAVA_VERSION_PATH")) != NULL)
|
||||
path = strdup(path);
|
||||
path = JLI_StringDup(path);
|
||||
else
|
||||
if ((home = getenv("HOME")) != NULL) {
|
||||
path = (char *)MemAlloc(strlen(home) + 13);
|
||||
path = (char *)JLI_MemAlloc(strlen(home) + strlen(system_dir) +
|
||||
strlen(user_dir) + 2);
|
||||
path = strcat(strcat(strcat(strcpy(path, home),
|
||||
user_dir), ":"), system_dir);
|
||||
} else
|
||||
path = strdup(system_dir);
|
||||
path = JLI_StringDup(system_dir);
|
||||
|
||||
/*
|
||||
* Step through each directory on the path. Terminate the scan with
|
||||
@ -1662,7 +1616,7 @@ LocateJRE(manifest_info* info)
|
||||
if (dp != NULL)
|
||||
dp++;
|
||||
}
|
||||
free(path);
|
||||
JLI_MemFree(path);
|
||||
return (target);
|
||||
}
|
||||
|
||||
@ -1740,16 +1694,19 @@ ExecJRE(char *jre, char **argv)
|
||||
argv[0] = progname;
|
||||
if (_launcher_debug) {
|
||||
int i;
|
||||
printf("execv(\"%s\"", wanted);
|
||||
for (i = 0; argv[i] != NULL; i++)
|
||||
printf(", \"%s\"", argv[i]);
|
||||
printf(")\n");
|
||||
printf("ReExec Command: %s (%s)\n", wanted, argv[0]);
|
||||
printf("ReExec Args:");
|
||||
for (i = 1; argv[i] != NULL; i++)
|
||||
printf(" %s", argv[i]);
|
||||
printf("\n");
|
||||
}
|
||||
(void)fflush(stdout);
|
||||
(void)fflush(stderr);
|
||||
execv(wanted, argv);
|
||||
perror("execv()");
|
||||
fprintf(stderr, "Exec of %s failed\n", wanted);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#endif /* ifndef GAMMA */
|
||||
|
||||
/*
|
||||
@ -1830,23 +1787,92 @@ UnsetEnv(char *name)
|
||||
{
|
||||
return(borrowed_unsetenv(name));
|
||||
}
|
||||
/*
|
||||
* The implementation for finding classes from the bootstrap
|
||||
* class loader, refer to java.h
|
||||
*/
|
||||
static FindClassFromBootLoader_t *findBootClass = NULL;
|
||||
|
||||
jclass
|
||||
FindBootStrapClass(JNIEnv *env, const char* classname)
|
||||
{
|
||||
if (findBootClass == NULL) {
|
||||
findBootClass = (FindClassFromBootLoader_t *)dlsym(RTLD_DEFAULT,
|
||||
"JVM_FindClassFromBootLoader");
|
||||
if (findBootClass == NULL) {
|
||||
fprintf(stderr, "Error: could load method JVM_FindClassFromBootLoader");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return findBootClass(env, classname, JNI_FALSE);
|
||||
/* --- Splash Screen shared library support --- */
|
||||
|
||||
static const char* SPLASHSCREEN_SO = "libsplashscreen.so";
|
||||
|
||||
static void* hSplashLib = NULL;
|
||||
|
||||
void* SplashProcAddress(const char* name) {
|
||||
if (!hSplashLib) {
|
||||
hSplashLib = dlopen(SPLASHSCREEN_SO, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
if (hSplashLib) {
|
||||
void* sym = dlsym(hSplashLib, name);
|
||||
return sym;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void SplashFreeLibrary() {
|
||||
if (hSplashLib) {
|
||||
dlclose(hSplashLib);
|
||||
hSplashLib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
jlong_format_specifier() {
|
||||
return "%lld";
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread
|
||||
*/
|
||||
int
|
||||
ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
||||
int rslt;
|
||||
#ifdef __linux__
|
||||
pthread_t tid;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||
|
||||
if (stack_size > 0) {
|
||||
pthread_attr_setstacksize(&attr, stack_size);
|
||||
}
|
||||
|
||||
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
|
||||
void * tmp;
|
||||
pthread_join(tid, &tmp);
|
||||
rslt = (int)tmp;
|
||||
} else {
|
||||
/*
|
||||
* Continue execution in current thread if for some reason (e.g. out of
|
||||
* memory/LWP) a new thread can't be created. This will likely fail
|
||||
* later in continuation as JNI_CreateJavaVM needs to create quite a
|
||||
* few new threads, anyway, just give it a try..
|
||||
*/
|
||||
rslt = continuation(args);
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
#else
|
||||
thread_t tid;
|
||||
long flags = 0;
|
||||
if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
|
||||
void * tmp;
|
||||
thr_join(tid, NULL, &tmp);
|
||||
rslt = (int)tmp;
|
||||
} else {
|
||||
/* See above. Continue in current thread if thr_create() failed */
|
||||
rslt = continuation(args);
|
||||
}
|
||||
#endif
|
||||
return rslt;
|
||||
}
|
||||
|
||||
/* Coarse estimation of number of digits assuming the worst case is a 64-bit pid. */
|
||||
#define MAX_PID_STR_SZ 20
|
||||
|
||||
void SetJavaLauncherPlatformProps() {
|
||||
/* Linux only */
|
||||
#ifdef __linux__
|
||||
const char *substr = "-Dsun.java.launcher.pid=";
|
||||
char *pid_prop_str = (char *)JLI_MemAlloc(strlen(substr) + MAX_PID_STR_SZ + 1);
|
||||
sprintf(pid_prop_str, "%s%d", substr, getpid());
|
||||
AddOption(pid_prop_str, NULL);
|
||||
#endif
|
||||
}
|
@ -22,11 +22,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
|
||||
* search "GAMMA" for gamma specific changes.
|
||||
*/
|
||||
|
||||
#ifndef JAVA_MD_H
|
||||
#define JAVA_MD_H
|
||||
|
||||
@ -36,10 +31,12 @@
|
||||
#ifndef GAMMA
|
||||
#include "manifest_info.h"
|
||||
#endif
|
||||
#include "jli_util.h"
|
||||
|
||||
#define PATH_SEPARATOR ':'
|
||||
#define FILESEP "/"
|
||||
#define FILE_SEPARATOR '/'
|
||||
#define IS_FILE_SEPARATOR(c) ((c) == '/')
|
||||
#ifndef MAXNAMELEN
|
||||
#define MAXNAMELEN PATH_MAX
|
||||
#endif
|
||||
@ -71,7 +68,7 @@
|
||||
* Function prototypes.
|
||||
*/
|
||||
#ifndef GAMMA
|
||||
char *LocateJRE(manifest_info* info);
|
||||
char *LocateJRE(manifest_info *info);
|
||||
void ExecJRE(char *jre, char **argv);
|
||||
#endif
|
||||
int UnsetEnv(char *name);
|
208
hotspot/src/os/posix/launcher/launcher.script
Normal file
208
hotspot/src/os/posix/launcher/launcher.script
Normal file
@ -0,0 +1,208 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
|
||||
# This script launches HotSpot.
|
||||
#
|
||||
# If the first parameter is either "-gdb" or "-gud", HotSpot will be
|
||||
# launched inside gdb. "-gud" means "open an Emacs window and run gdb
|
||||
# inside Emacs".
|
||||
#
|
||||
# If the first parameter is "-dbx", HotSpot will be launched inside dbx.
|
||||
#
|
||||
# If the first parameter is "-valgrind", HotSpot will be launched
|
||||
# inside Valgrind (http://valgrind.kde.org) using the Memcheck skin,
|
||||
# and with memory leak detection enabled. This currently (2005jan19)
|
||||
# requires at least Valgrind 2.3.0. -Xmx16m will also be passed as
|
||||
# the first parameter to HotSpot, since lowering HotSpot's memory
|
||||
# consumption makes execution inside of Valgrind *a lot* faster.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# User changeable parameters ------------------------------------------------
|
||||
#
|
||||
|
||||
# This is the name of the gdb binary to use
|
||||
if [ ! "$GDB" ]
|
||||
then
|
||||
GDB=gdb
|
||||
fi
|
||||
|
||||
# This is the name of the gdb binary to use
|
||||
if [ ! "$DBX" ]
|
||||
then
|
||||
DBX=dbx
|
||||
fi
|
||||
|
||||
# This is the name of the Valgrind binary to use
|
||||
if [ ! "$VALGRIND" ]
|
||||
then
|
||||
VALGRIND=valgrind
|
||||
fi
|
||||
|
||||
# This is the name of Emacs for running GUD
|
||||
EMACS=emacs
|
||||
|
||||
#
|
||||
# End of user changeable parameters -----------------------------------------
|
||||
#
|
||||
|
||||
# Make sure the paths are fully specified, i.e. they must begin with /.
|
||||
SCRIPT=$(cd $(dirname $0) && pwd)/$(basename $0)
|
||||
RUNDIR=$(pwd)
|
||||
|
||||
# Look whether the user wants to run inside gdb
|
||||
case "$1" in
|
||||
-gdb)
|
||||
MODE=gdb
|
||||
shift
|
||||
;;
|
||||
-gud)
|
||||
MODE=gud
|
||||
shift
|
||||
;;
|
||||
-dbx)
|
||||
MODE=dbx
|
||||
shift
|
||||
;;
|
||||
-valgrind)
|
||||
MODE=valgrind
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
MODE=run
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${ALT_JAVA_HOME}" = "" ]; then
|
||||
if [ "${JAVA_HOME}" = "" ]; then
|
||||
echo "Neither ALT_JAVA_HOME nor JAVA_HOME is set. Aborting.";
|
||||
exit 1;
|
||||
else
|
||||
JDK=${JAVA_HOME%%/jre};
|
||||
fi
|
||||
else
|
||||
JDK=${ALT_JAVA_HOME%%/jre};
|
||||
fi
|
||||
|
||||
# We will set the LD_LIBRARY_PATH as follows:
|
||||
# o $JVMPATH (directory portion only)
|
||||
# o $JRE/lib/$ARCH
|
||||
# followed by the user's previous effective LD_LIBRARY_PATH, if
|
||||
# any.
|
||||
JRE=$JDK/jre
|
||||
JAVA_HOME=$JDK
|
||||
ARCH=@@LIBARCH@@
|
||||
|
||||
# Find out the absolute path to this script
|
||||
MYDIR=$(cd $(dirname $SCRIPT) && pwd)
|
||||
|
||||
SBP=${MYDIR}:${JRE}/lib/${ARCH}
|
||||
|
||||
# Set up a suitable LD_LIBRARY_PATH
|
||||
|
||||
if [ -z "$LD_LIBRARY_PATH" ]
|
||||
then
|
||||
LD_LIBRARY_PATH="$SBP"
|
||||
else
|
||||
LD_LIBRARY_PATH="$SBP:$LD_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
export LD_LIBRARY_PATH
|
||||
export JAVA_HOME
|
||||
|
||||
JPARMS="$@ $JAVA_ARGS";
|
||||
|
||||
# Locate the gamma development launcher
|
||||
LAUNCHER=${MYDIR}/gamma
|
||||
if [ ! -x $LAUNCHER ] ; then
|
||||
echo Error: Cannot find the gamma development launcher \"$LAUNCHER\"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GDBSRCDIR=$MYDIR
|
||||
BASEDIR=$(cd $MYDIR/../../.. && pwd)
|
||||
|
||||
init_gdb() {
|
||||
# Create a gdb script in case we should run inside gdb
|
||||
GDBSCR=/tmp/hsl.$$
|
||||
rm -f $GDBSCR
|
||||
cat >>$GDBSCR <<EOF
|
||||
cd `pwd`
|
||||
handle SIGUSR1 nostop noprint
|
||||
handle SIGUSR2 nostop noprint
|
||||
set args $JPARMS
|
||||
file $LAUNCHER
|
||||
directory $GDBSRCDIR
|
||||
# Get us to a point where we can set breakpoints in libjvm.so
|
||||
break InitializeJVM
|
||||
run
|
||||
# Stop in InitializeJVM
|
||||
delete 1
|
||||
# We can now set breakpoints wherever we like
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
case "$MODE" in
|
||||
gdb)
|
||||
init_gdb
|
||||
$GDB -x $GDBSCR
|
||||
rm -f $GDBSCR
|
||||
;;
|
||||
gud)
|
||||
init_gdb
|
||||
# First find out what emacs version we're using, so that we can
|
||||
# use the new pretty GDB mode if emacs -version >= 22.1
|
||||
case $($EMACS -version 2> /dev/null) in
|
||||
*GNU\ Emacs\ 2[23]*)
|
||||
emacs_gud_cmd="gdba"
|
||||
emacs_gud_args="--annotate=3"
|
||||
;;
|
||||
*)
|
||||
emacs_gud_cmd="gdb"
|
||||
emacs_gud_args=
|
||||
;;
|
||||
esac
|
||||
$EMACS --eval "($emacs_gud_cmd \"$GDB $emacs_gud_args -x $GDBSCR\")";
|
||||
rm -f $GDBSCR
|
||||
;;
|
||||
dbx)
|
||||
$DBX -s $MYDIR/.dbxrc $LAUNCHER $JPARAMS
|
||||
;;
|
||||
valgrind)
|
||||
echo Warning: Defaulting to 16Mb heap to make Valgrind run faster, use -Xmx for larger heap
|
||||
echo
|
||||
$VALGRIND --tool=memcheck --leak-check=yes --num-callers=50 $LAUNCHER -Xmx16m $JPARMS
|
||||
;;
|
||||
run)
|
||||
LD_PRELOAD=$PRELOADING exec $LAUNCHER $JPARMS
|
||||
;;
|
||||
*)
|
||||
echo Error: Internal error, unknown launch mode \"$MODE\"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
RETVAL=$?
|
||||
exit $RETVAL
|
File diff suppressed because it is too large
Load Diff
@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
|
||||
* search "GAMMA" for gamma specific changes.
|
||||
*/
|
||||
|
||||
#ifndef _JAVA_H_
|
||||
#define _JAVA_H_
|
||||
|
||||
/*
|
||||
* Get system specific defines.
|
||||
*/
|
||||
#include "jni.h"
|
||||
#include "java_md.h"
|
||||
|
||||
/*
|
||||
* Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
|
||||
*/
|
||||
typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
|
||||
typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args);
|
||||
|
||||
typedef struct {
|
||||
CreateJavaVM_t CreateJavaVM;
|
||||
GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
|
||||
} InvocationFunctions;
|
||||
|
||||
/*
|
||||
* Prototypes for launcher functions in the system specific java_md.c.
|
||||
*/
|
||||
|
||||
jboolean
|
||||
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn);
|
||||
|
||||
void
|
||||
GetXUsagePath(char *buf, jint bufsize);
|
||||
|
||||
jboolean
|
||||
GetApplicationHome(char *buf, jint bufsize);
|
||||
|
||||
const char *
|
||||
GetArch();
|
||||
|
||||
void CreateExecutionEnvironment(int *_argc,
|
||||
char ***_argv,
|
||||
char jrepath[],
|
||||
jint so_jrepath,
|
||||
char jvmpath[],
|
||||
jint so_jvmpath,
|
||||
char **original_argv);
|
||||
|
||||
/*
|
||||
* Report an error message to stderr or a window as appropriate. The
|
||||
* flag always is set to JNI_TRUE if message is to be reported to both
|
||||
* strerr and windows and set to JNI_FALSE if the message should only
|
||||
* be sent to a window.
|
||||
*/
|
||||
void ReportErrorMessage(char * message, jboolean always);
|
||||
void ReportErrorMessage2(char * format, char * string, jboolean always);
|
||||
|
||||
/*
|
||||
* Report an exception which terminates the vm to stderr or a window
|
||||
* as appropriate.
|
||||
*/
|
||||
void ReportExceptionDescription(JNIEnv * env);
|
||||
|
||||
jboolean RemovableMachineDependentOption(char * option);
|
||||
void PrintMachineDependentOptions();
|
||||
|
||||
/*
|
||||
* Functions defined in java.c and used in java_md.c.
|
||||
*/
|
||||
jint ReadKnownVMs(const char *jrepath, char * arch, jboolean speculative);
|
||||
char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
|
||||
void* MemAlloc(size_t size);
|
||||
|
||||
/*
|
||||
* Make launcher spit debug output.
|
||||
*/
|
||||
extern jboolean _launcher_debug;
|
||||
|
||||
/*
|
||||
* This allows for finding classes from the VM's bootstrap class loader
|
||||
* directly, FindClass uses the application class loader internally, this will
|
||||
* cause unnecessary searching of the classpath for the required classes.
|
||||
*/
|
||||
typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env,
|
||||
const char *name,
|
||||
jboolean throwError));
|
||||
|
||||
jclass FindBootStrapClass(JNIEnv *env, const char *classname);
|
||||
|
||||
#endif /* _JAVA_H_ */
|
File diff suppressed because it is too large
Load Diff
1465
hotspot/src/os/windows/launcher/java_md.c
Normal file
1465
hotspot/src/os/windows/launcher/java_md.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -22,28 +22,31 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
|
||||
* search "GAMMA" for gamma specific changes.
|
||||
*/
|
||||
|
||||
#ifndef JAVA_MD_H
|
||||
#define JAVA_MD_H
|
||||
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <jni.h>
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#ifndef GAMMA
|
||||
#include "manifest_info.h"
|
||||
#endif
|
||||
#include "jli_util.h"
|
||||
|
||||
#define PATH_SEPARATOR ':'
|
||||
#define FILESEP "/"
|
||||
#define FILE_SEPARATOR '/'
|
||||
#ifndef MAXNAMELEN
|
||||
#define MAXNAMELEN PATH_MAX
|
||||
#ifdef GAMMA
|
||||
#define stricmp _stricmp
|
||||
#define strnicmp _strnicmp
|
||||
#define snprintf _snprintf
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
#define PATH_SEPARATOR ';'
|
||||
#define FILESEP "\\"
|
||||
#define FILE_SEPARATOR '\\'
|
||||
#define IS_FILE_SEPARATOR(c) ((c) == '\\' || (c) == '/')
|
||||
#define MAXPATHLEN MAX_PATH
|
||||
#define MAXNAMELEN MAX_PATH
|
||||
|
||||
#ifdef JAVA_ARGS
|
||||
/*
|
||||
* ApplicationHome is prepended to each of these entries; the resulting
|
||||
@ -51,27 +54,26 @@
|
||||
* value of -cp option to the launcher.
|
||||
*/
|
||||
#ifndef APP_CLASSPATH
|
||||
#define APP_CLASSPATH { "/lib/tools.jar", "/classes" }
|
||||
#define APP_CLASSPATH { "\\lib\\tools.jar", "\\classes" }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETHRTIME
|
||||
/*
|
||||
* Support for doing cheap, accurate interval timing.
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#define CounterGet() (gethrtime()/1000)
|
||||
#define Counter2Micros(counts) (counts)
|
||||
#else
|
||||
#define CounterGet() (0)
|
||||
#define Counter2Micros(counts) (1)
|
||||
#endif /* HAVE_GETHRTIME */
|
||||
extern jlong CounterGet(void);
|
||||
extern jlong Counter2Micros(jlong counts);
|
||||
|
||||
#ifdef JAVAW
|
||||
#define main _main
|
||||
extern int _main(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function prototypes.
|
||||
*/
|
||||
#ifndef GAMMA
|
||||
char *LocateJRE(manifest_info* info);
|
||||
char *LocateJRE(manifest_info *info);
|
||||
void ExecJRE(char *jre, char **argv);
|
||||
#endif
|
||||
int UnsetEnv(char *name);
|
@ -1708,7 +1708,37 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
return;
|
||||
}
|
||||
|
||||
buf[0] = '\0';
|
||||
if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
|
||||
// Support for the gamma launcher. Check for an
|
||||
// ALT_JAVA_HOME or JAVA_HOME environment variable
|
||||
// and fix up the path so it looks like
|
||||
// libjvm.so is installed there (append a fake suffix
|
||||
// hotspot/libjvm.so).
|
||||
char* java_home_var = ::getenv("ALT_JAVA_HOME");
|
||||
if (java_home_var == NULL) {
|
||||
java_home_var = ::getenv("JAVA_HOME");
|
||||
}
|
||||
if (java_home_var != NULL && java_home_var[0] != 0) {
|
||||
|
||||
strncpy(buf, java_home_var, buflen);
|
||||
|
||||
// determine if this is a legacy image or modules image
|
||||
// modules image doesn't have "jre" subdirectory
|
||||
size_t len = strlen(buf);
|
||||
char* jrebin_p = buf + len;
|
||||
jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
|
||||
if (0 != _access(buf, 0)) {
|
||||
jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
|
||||
}
|
||||
len = strlen(buf);
|
||||
jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
|
||||
}
|
||||
}
|
||||
|
||||
if(buf[0] == '\0') {
|
||||
GetModuleFileName(vm_lib_handle, buf, buflen);
|
||||
}
|
||||
strcpy(saved_jvm_path, buf);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,10 +22,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
|
||||
* search "GAMMA" for gamma specific changes.
|
||||
*/
|
||||
|
||||
#ifndef _JAVA_H_
|
||||
#define _JAVA_H_
|
||||
@ -35,6 +31,7 @@
|
||||
*/
|
||||
#include "jni.h"
|
||||
#include "java_md.h"
|
||||
#include "jli_util.h"
|
||||
|
||||
/*
|
||||
* Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
|
||||
@ -89,26 +86,26 @@ void ReportExceptionDescription(JNIEnv * env);
|
||||
jboolean RemovableMachineDependentOption(char * option);
|
||||
void PrintMachineDependentOptions();
|
||||
|
||||
const char *jlong_format_specifier();
|
||||
/*
|
||||
* Block current thread and continue execution in new thread
|
||||
*/
|
||||
int ContinueInNewThread(int (JNICALL *continuation)(void *),
|
||||
jlong stack_size, void * args);
|
||||
|
||||
/* sun.java.launcher.* platform properties. */
|
||||
void SetJavaLauncherPlatformProps(void);
|
||||
|
||||
/*
|
||||
* Functions defined in java.c and used in java_md.c.
|
||||
*/
|
||||
jint ReadKnownVMs(const char *jrepath, char * arch, jboolean speculative);
|
||||
char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
|
||||
void* MemAlloc(size_t size);
|
||||
void AddOption(char *str, void *info);
|
||||
|
||||
/*
|
||||
* Make launcher spit debug output.
|
||||
*/
|
||||
extern jboolean _launcher_debug;
|
||||
/*
|
||||
* This allows for finding classes from the VM's bootstrap class loader
|
||||
* directly, FindClass uses the application class loader internally, this will
|
||||
* cause unnecessary searching of the classpath for the required classes.
|
||||
*/
|
||||
typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env,
|
||||
const char *name,
|
||||
jboolean throwError));
|
||||
|
||||
jclass FindBootStrapClass(JNIEnv *env, const char *classname);
|
||||
|
||||
#endif /* _JAVA_H_ */
|
88
hotspot/src/share/tools/launcher/jli_util.c
Normal file
88
hotspot/src/share/tools/launcher/jli_util.c
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "jli_util.h"
|
||||
|
||||
#ifdef GAMMA
|
||||
#ifdef _WINDOWS
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns a pointer to a block of at least 'size' bytes of memory.
|
||||
* Prints error message and exits if the memory could not be allocated.
|
||||
*/
|
||||
void *
|
||||
JLI_MemAlloc(size_t size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
if (p == 0) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Equivalent to realloc(size).
|
||||
* Prints error message and exits if the memory could not be reallocated.
|
||||
*/
|
||||
void *
|
||||
JLI_MemRealloc(void *ptr, size_t size)
|
||||
{
|
||||
void *p = realloc(ptr, size);
|
||||
if (p == 0) {
|
||||
perror("realloc");
|
||||
exit(1);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrapper over strdup(3C) which prints an error message and exits if memory
|
||||
* could not be allocated.
|
||||
*/
|
||||
char *
|
||||
JLI_StringDup(const char *s1)
|
||||
{
|
||||
char *s = strdup(s1);
|
||||
if (s == NULL) {
|
||||
perror("strdup");
|
||||
exit(1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Very equivalent to free(ptr).
|
||||
* Here to maintain pairing with the above routines.
|
||||
*/
|
||||
void
|
||||
JLI_MemFree(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
35
hotspot/src/share/tools/launcher/jli_util.h
Normal file
35
hotspot/src/share/tools/launcher/jli_util.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _JLI_UTIL_H
|
||||
#define _JLI_UTIL_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void *JLI_MemAlloc(size_t size);
|
||||
void *JLI_MemRealloc(void *ptr, size_t size);
|
||||
char *JLI_StringDup(const char *s1);
|
||||
void JLI_MemFree(void *ptr);
|
||||
|
||||
#endif /* _JLI_UTIL_H */
|
494
hotspot/src/share/tools/launcher/wildcard.c
Normal file
494
hotspot/src/share/tools/launcher/wildcard.c
Normal file
@ -0,0 +1,494 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class-Path Wildcards
|
||||
*
|
||||
* The syntax for wildcards is a single asterisk. The class path
|
||||
* foo/"*", e.g., loads all jar files in the directory named foo.
|
||||
* (This requires careful quotation when used in shell scripts.)
|
||||
*
|
||||
* Only files whose names end in .jar or .JAR are matched.
|
||||
* Files whose names end in .zip, or which have a particular
|
||||
* magic number, regardless of filename extension, are not
|
||||
* matched.
|
||||
*
|
||||
* Files are considered regardless of whether or not they are
|
||||
* "hidden" in the UNIX sense, i.e., have names beginning with '.'.
|
||||
*
|
||||
* A wildcard only matches jar files, not class files in the same
|
||||
* directory. If you want to load both class files and jar files from
|
||||
* a single directory foo then you can say foo:foo/"*", or foo/"*":foo
|
||||
* if you want the jar files to take precedence.
|
||||
*
|
||||
* Subdirectories are not searched recursively, i.e., foo/"*" only
|
||||
* looks for jar files in foo, not in foo/bar, foo/baz, etc.
|
||||
*
|
||||
* Expansion of wildcards is done early, prior to the invocation of a
|
||||
* program's main method, rather than late, during the class-loading
|
||||
* process itself. Each element of the input class path containing a
|
||||
* wildcard is replaced by the (possibly empty) sequence of elements
|
||||
* generated by enumerating the jar files in the named directory. If
|
||||
* the directory foo contains a.jar, b.jar, and c.jar,
|
||||
* e.g., then the class path foo/"*" is expanded into
|
||||
* foo/a.jar:foo/b.jar:foo/c.jar, and that string would be the value
|
||||
* of the system property java.class.path.
|
||||
*
|
||||
* The order in which the jar files in a directory are enumerated in
|
||||
* the expanded class path is not specified and may vary from platform
|
||||
* to platform and even from moment to moment on the same machine. A
|
||||
* well-constructed application should not depend upon any particular
|
||||
* order. If a specific order is required then the jar files can be
|
||||
* enumerated explicitly in the class path.
|
||||
*
|
||||
* The CLASSPATH environment variable is not treated any differently
|
||||
* from the -classpath (equiv. -cp) command-line option,
|
||||
* i.e. wildcards are honored in all these cases.
|
||||
*
|
||||
* Class-path wildcards are not honored in the Class-Path jar-manifest
|
||||
* header.
|
||||
*
|
||||
* Class-path wildcards are honored not only by the Java launcher but
|
||||
* also by most other command-line tools that accept class paths, and
|
||||
* in particular by javac and javadoc.
|
||||
*
|
||||
* Class-path wildcards are not honored in any other kind of path, and
|
||||
* especially not in the bootstrap class path, which is a mere
|
||||
* artifact of our implementation and not something that developers
|
||||
* should use.
|
||||
*
|
||||
* Classpath wildcards are only expanded in the Java launcher code,
|
||||
* supporting the use of wildcards on the command line and in the
|
||||
* CLASSPATH environment variable. We do not support the use of
|
||||
* wildcards by applications that embed the JVM.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "java.h" /* Strictly for PATH_SEPARATOR/FILE_SEPARATOR */
|
||||
#include "jli_util.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else /* Unix */
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#endif /* Unix */
|
||||
|
||||
static int
|
||||
exists(const char* filename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return _access(filename, 0) == 0;
|
||||
#else
|
||||
return access(filename, F_OK) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define NEW_(TYPE) ((TYPE) JLI_MemAlloc(sizeof(struct TYPE##_)))
|
||||
|
||||
/*
|
||||
* Wildcard directory iteration.
|
||||
* WildcardIterator_for(wildcard) returns an iterator.
|
||||
* Each call to that iterator's next() method returns the basename
|
||||
* of an entry in the wildcard's directory. The basename's memory
|
||||
* belongs to the iterator. The caller is responsible for prepending
|
||||
* the directory name and file separator, if necessary.
|
||||
* When done with the iterator, call the close method to clean up.
|
||||
*/
|
||||
typedef struct WildcardIterator_* WildcardIterator;
|
||||
|
||||
#ifdef _WIN32
|
||||
struct WildcardIterator_
|
||||
{
|
||||
HANDLE handle;
|
||||
char *firstFile; /* Stupid FindFirstFile...FindNextFile */
|
||||
};
|
||||
|
||||
static WildcardIterator
|
||||
WildcardIterator_for(const char *wildcard)
|
||||
{
|
||||
WIN32_FIND_DATA find_data;
|
||||
WildcardIterator it = NEW_(WildcardIterator);
|
||||
HANDLE handle = FindFirstFile(wildcard, &find_data);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
it->handle = handle;
|
||||
it->firstFile = find_data.cFileName;
|
||||
return it;
|
||||
}
|
||||
|
||||
static char *
|
||||
WildcardIterator_next(WildcardIterator it)
|
||||
{
|
||||
WIN32_FIND_DATA find_data;
|
||||
if (it->firstFile != NULL) {
|
||||
char *firstFile = it->firstFile;
|
||||
it->firstFile = NULL;
|
||||
return firstFile;
|
||||
}
|
||||
return FindNextFile(it->handle, &find_data)
|
||||
? find_data.cFileName : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
WildcardIterator_close(WildcardIterator it)
|
||||
{
|
||||
if (it) {
|
||||
FindClose(it->handle);
|
||||
JLI_MemFree(it->firstFile);
|
||||
JLI_MemFree(it);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* Unix */
|
||||
struct WildcardIterator_
|
||||
{
|
||||
DIR *dir;
|
||||
};
|
||||
|
||||
static WildcardIterator
|
||||
WildcardIterator_for(const char *wildcard)
|
||||
{
|
||||
DIR *dir;
|
||||
int wildlen = strlen(wildcard);
|
||||
if (wildlen < 2) {
|
||||
dir = opendir(".");
|
||||
} else {
|
||||
char *dirname = JLI_StringDup(wildcard);
|
||||
dirname[wildlen - 1] = '\0';
|
||||
dir = opendir(dirname);
|
||||
JLI_MemFree(dirname);
|
||||
}
|
||||
if (dir == NULL)
|
||||
return NULL;
|
||||
else {
|
||||
WildcardIterator it = NEW_(WildcardIterator);
|
||||
it->dir = dir;
|
||||
return it;
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
WildcardIterator_next(WildcardIterator it)
|
||||
{
|
||||
struct dirent* dirp = readdir(it->dir);
|
||||
return dirp ? dirp->d_name : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
WildcardIterator_close(WildcardIterator it)
|
||||
{
|
||||
if (it) {
|
||||
closedir(it->dir);
|
||||
JLI_MemFree(it);
|
||||
}
|
||||
}
|
||||
#endif /* Unix */
|
||||
|
||||
static int
|
||||
equal(const char *s1, const char *s2)
|
||||
{
|
||||
return strcmp(s1, s2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* FileList ADT - a dynamic list of C filenames
|
||||
*/
|
||||
struct FileList_
|
||||
{
|
||||
char **files;
|
||||
int size;
|
||||
int capacity;
|
||||
};
|
||||
typedef struct FileList_ *FileList;
|
||||
|
||||
static FileList
|
||||
FileList_new(int capacity)
|
||||
{
|
||||
FileList fl = NEW_(FileList);
|
||||
fl->capacity = capacity;
|
||||
fl->files = (char **) JLI_MemAlloc(capacity * sizeof(fl->files[0]));
|
||||
fl->size = 0;
|
||||
return fl;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_WILDCARD
|
||||
static void
|
||||
FileList_print(FileList fl)
|
||||
{
|
||||
int i;
|
||||
putchar('[');
|
||||
for (i = 0; i < fl->size; i++) {
|
||||
if (i > 0) printf(", ");
|
||||
printf("\"%s\"",fl->files[i]);
|
||||
}
|
||||
putchar(']');
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
FileList_free(FileList fl)
|
||||
{
|
||||
if (fl) {
|
||||
if (fl->files) {
|
||||
int i;
|
||||
for (i = 0; i < fl->size; i++)
|
||||
JLI_MemFree(fl->files[i]);
|
||||
JLI_MemFree(fl->files);
|
||||
}
|
||||
JLI_MemFree(fl);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FileList_ensureCapacity(FileList fl, int capacity)
|
||||
{
|
||||
if (fl->capacity < capacity) {
|
||||
while (fl->capacity < capacity)
|
||||
fl->capacity *= 2;
|
||||
fl->files = JLI_MemRealloc(fl->files,
|
||||
fl->capacity * sizeof(fl->files[0]));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FileList_add(FileList fl, char *file)
|
||||
{
|
||||
FileList_ensureCapacity(fl, fl->size+1);
|
||||
fl->files[fl->size++] = file;
|
||||
}
|
||||
|
||||
static void
|
||||
FileList_addSubstring(FileList fl, const char *beg, int len)
|
||||
{
|
||||
char *filename = (char *) JLI_MemAlloc(len+1);
|
||||
memcpy(filename, beg, len);
|
||||
filename[len] = '\0';
|
||||
FileList_ensureCapacity(fl, fl->size+1);
|
||||
fl->files[fl->size++] = filename;
|
||||
}
|
||||
|
||||
static char *
|
||||
FileList_join(FileList fl, char sep)
|
||||
{
|
||||
int i;
|
||||
int size;
|
||||
char *path;
|
||||
char *p;
|
||||
for (i = 0, size = 1; i < fl->size; i++)
|
||||
size += strlen(fl->files[i]) + 1;
|
||||
|
||||
path = JLI_MemAlloc(size);
|
||||
|
||||
for (i = 0, p = path; i < fl->size; i++) {
|
||||
int len = strlen(fl->files[i]);
|
||||
if (i > 0) *p++ = sep;
|
||||
memcpy(p, fl->files[i], len);
|
||||
p += len;
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
static FileList
|
||||
FileList_split(const char *path, char sep)
|
||||
{
|
||||
const char *p, *q;
|
||||
int len = strlen(path);
|
||||
int count;
|
||||
FileList fl;
|
||||
for (count = 1, p = path; p < path + len; p++)
|
||||
count += (*p == sep);
|
||||
fl = FileList_new(count);
|
||||
for (p = path;;) {
|
||||
for (q = p; q <= path + len; q++) {
|
||||
if (*q == sep || *q == '\0') {
|
||||
FileList_addSubstring(fl, p, q - p);
|
||||
if (*q == '\0')
|
||||
return fl;
|
||||
p = q + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
isJarFileName(const char *filename)
|
||||
{
|
||||
int len = strlen(filename);
|
||||
return (len >= 4) &&
|
||||
(filename[len - 4] == '.') &&
|
||||
(equal(filename + len - 3, "jar") ||
|
||||
equal(filename + len - 3, "JAR")) &&
|
||||
/* Paranoia: Maybe filename is "DIR:foo.jar" */
|
||||
(strchr(filename, PATH_SEPARATOR) == NULL);
|
||||
}
|
||||
|
||||
static char *
|
||||
wildcardConcat(const char *wildcard, const char *basename)
|
||||
{
|
||||
int wildlen = strlen(wildcard);
|
||||
int baselen = strlen(basename);
|
||||
char *filename = (char *) JLI_MemAlloc(wildlen + baselen);
|
||||
/* Replace the trailing '*' with basename */
|
||||
memcpy(filename, wildcard, wildlen-1);
|
||||
memcpy(filename+wildlen-1, basename, baselen+1);
|
||||
return filename;
|
||||
}
|
||||
|
||||
static FileList
|
||||
wildcardFileList(const char *wildcard)
|
||||
{
|
||||
const char *basename;
|
||||
FileList fl = FileList_new(16);
|
||||
WildcardIterator it = WildcardIterator_for(wildcard);
|
||||
if (it == NULL)
|
||||
return NULL;
|
||||
while ((basename = WildcardIterator_next(it)) != NULL)
|
||||
if (isJarFileName(basename))
|
||||
FileList_add(fl, wildcardConcat(wildcard, basename));
|
||||
WildcardIterator_close(it);
|
||||
return fl;
|
||||
}
|
||||
|
||||
static int
|
||||
isWildcard(const char *filename)
|
||||
{
|
||||
int len = strlen(filename);
|
||||
return (len > 0) &&
|
||||
(filename[len - 1] == '*') &&
|
||||
(len == 1 || IS_FILE_SEPARATOR(filename[len - 2])) &&
|
||||
(! exists(filename));
|
||||
}
|
||||
|
||||
static void
|
||||
FileList_expandWildcards(FileList fl)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < fl->size; i++) {
|
||||
if (isWildcard(fl->files[i])) {
|
||||
FileList expanded = wildcardFileList(fl->files[i]);
|
||||
if (expanded != NULL && expanded->size > 0) {
|
||||
JLI_MemFree(fl->files[i]);
|
||||
FileList_ensureCapacity(fl, fl->size + expanded->size);
|
||||
for (j = fl->size - 1; j >= i+1; j--)
|
||||
fl->files[j+expanded->size-1] = fl->files[j];
|
||||
for (j = 0; j < expanded->size; j++)
|
||||
fl->files[i+j] = expanded->files[j];
|
||||
i += expanded->size - 1;
|
||||
fl->size += expanded->size - 1;
|
||||
/* fl expropriates expanded's elements. */
|
||||
expanded->size = 0;
|
||||
}
|
||||
FileList_free(expanded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
JLI_WildcardExpandClasspath(const char *classpath)
|
||||
{
|
||||
char *expanded;
|
||||
FileList fl;
|
||||
|
||||
if (strchr(classpath, '*') == NULL)
|
||||
return classpath;
|
||||
fl = FileList_split(classpath, PATH_SEPARATOR);
|
||||
FileList_expandWildcards(fl);
|
||||
expanded = FileList_join(fl, PATH_SEPARATOR);
|
||||
FileList_free(fl);
|
||||
if (getenv("_JAVA_LAUNCHER_DEBUG") != 0)
|
||||
printf("Expanded wildcards:\n"
|
||||
" before: \"%s\"\n"
|
||||
" after : \"%s\"\n",
|
||||
classpath, expanded);
|
||||
return expanded;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_WILDCARD
|
||||
static void
|
||||
wildcardExpandArgv(const char ***argv)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; (*argv)[i]; i++) {
|
||||
if (equal((*argv)[i], "-cp") ||
|
||||
equal((*argv)[i], "-classpath")) {
|
||||
i++;
|
||||
(*argv)[i] = wildcardExpandClasspath((*argv)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
debugPrintArgv(char *argv[])
|
||||
{
|
||||
int i;
|
||||
putchar('[');
|
||||
for (i = 0; argv[i]; i++) {
|
||||
if (i > 0) printf(", ");
|
||||
printf("\"%s\"", argv[i]);
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
argv[0] = "java";
|
||||
wildcardExpandArgv((const char***)&argv);
|
||||
debugPrintArgv(argv);
|
||||
/* execvp("java", argv); */
|
||||
return 0;
|
||||
}
|
||||
#endif /* DEBUG_WILDCARD */
|
||||
|
||||
/* Cute little perl prototype implementation....
|
||||
|
||||
my $sep = ($^O =~ /^(Windows|cygwin)/) ? ";" : ":";
|
||||
|
||||
sub expand($) {
|
||||
opendir DIR, $_[0] or return $_[0];
|
||||
join $sep, map {"$_[0]/$_"} grep {/\.(jar|JAR)$/} readdir DIR;
|
||||
}
|
||||
|
||||
sub munge($) {
|
||||
join $sep,
|
||||
map {(! -r $_ and s/[\/\\]+\*$//) ? expand $_ : $_} split $sep, $_[0];
|
||||
}
|
||||
|
||||
for (my $i = 0; $i < @ARGV - 1; $i++) {
|
||||
$ARGV[$i+1] = munge $ARGV[$i+1] if $ARGV[$i] =~ /^-c(p|lasspath)$/;
|
||||
}
|
||||
|
||||
$ENV{CLASSPATH} = munge $ENV{CLASSPATH} if exists $ENV{CLASSPATH};
|
||||
@ARGV = ("java", @ARGV);
|
||||
print "@ARGV\n";
|
||||
exec @ARGV;
|
||||
|
||||
*/
|
34
hotspot/src/share/tools/launcher/wildcard.h
Normal file
34
hotspot/src/share/tools/launcher/wildcard.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef WILDCARD_H_
|
||||
#define WILDCARD_H_
|
||||
|
||||
#ifdef EXPAND_CLASSPATH_WILDCARDS
|
||||
const char *JLI_WildcardExpandClasspath(const char *classpath);
|
||||
#else
|
||||
#define JLI_WildcardExpandClasspath(s) (s)
|
||||
#endif
|
||||
|
||||
#endif /* include guard */
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "prims/jni.h"
|
||||
#include "runtime/reflectionCompat.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
#ifdef TARGET_OS_FAMILY_linux
|
||||
# include "jvm_linux.h"
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user