8288396: Always create reproducible builds
Reviewed-by: amenkov, ehelin
This commit is contained in:
parent
33369719b2
commit
b4ab5fe1da
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -226,13 +226,6 @@ else
|
|||||||
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}'
|
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For reproducible builds specify the jmod --date using SOURCE_DATE in ISO-8601
|
|
||||||
ifeq ($(ENABLE_REPRODUCIBLE_BUILD), true)
|
|
||||||
JMOD_SOURCE_DATE := --date $(SOURCE_DATE_ISO_8601)
|
|
||||||
else
|
|
||||||
JMOD_SOURCE_DATE :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Create jmods in the support dir and then move them into place to keep the
|
# Create jmods in the support dir and then move them into place to keep the
|
||||||
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
|
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
|
||||||
$(eval $(call SetupExecute, create_$(JMOD_FILE), \
|
$(eval $(call SetupExecute, create_$(JMOD_FILE), \
|
||||||
@ -244,7 +237,7 @@ $(eval $(call SetupExecute, create_$(JMOD_FILE), \
|
|||||||
COMMAND := $(JMOD) create --module-version $(VERSION_SHORT) \
|
COMMAND := $(JMOD) create --module-version $(VERSION_SHORT) \
|
||||||
--target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
|
--target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
|
||||||
--module-path $(JMODS_DIR) $(JMOD_FLAGS) \
|
--module-path $(JMODS_DIR) $(JMOD_FLAGS) \
|
||||||
$(JMOD_SOURCE_DATE) \
|
--date $(SOURCE_DATE_ISO_8601) \
|
||||||
$(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
|
$(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
|
||||||
POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
|
POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
|
||||||
))
|
))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -92,7 +92,6 @@ if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
|
|||||||
export PATH="$PATH:@TOOLCHAIN_PATH@"
|
export PATH="$PATH:@TOOLCHAIN_PATH@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export HOTSPOT_BUILD_TIME="@HOTSPOT_BUILD_TIME@"
|
|
||||||
export USE_PRECOMPILED_HEADER="@USE_PRECOMPILED_HEADER@"
|
export USE_PRECOMPILED_HEADER="@USE_PRECOMPILED_HEADER@"
|
||||||
|
|
||||||
# Now locate the main script and run it.
|
# Now locate the main script and run it.
|
||||||
|
@ -786,10 +786,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
|
|||||||
$1_TOOLCHAIN_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG}"
|
$1_TOOLCHAIN_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft && test "x$ENABLE_REPRODUCIBLE_BUILD" = xtrue; then
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||||
# Enabling deterministic creates warnings if __DATE__ or __TIME__ are
|
REPRODUCIBLE_CFLAGS="-experimental:deterministic"
|
||||||
# used, and since we are, silence that warning.
|
|
||||||
REPRODUCIBLE_CFLAGS="-experimental:deterministic -wd5048"
|
|
||||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${REPRODUCIBLE_CFLAGS}],
|
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${REPRODUCIBLE_CFLAGS}],
|
||||||
PREFIX: $3,
|
PREFIX: $3,
|
||||||
IF_FALSE: [
|
IF_FALSE: [
|
||||||
@ -816,8 +814,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
|
|||||||
FILE_MACRO_CFLAGS=
|
FILE_MACRO_CFLAGS=
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft &&
|
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||||
test "x$ENABLE_REPRODUCIBLE_BUILD" = xtrue; then
|
|
||||||
# There is a known issue with the pathmap if the mapping is made to the
|
# There is a known issue with the pathmap if the mapping is made to the
|
||||||
# empty string. Add a minimal string "s" as prefix to work around this.
|
# empty string. Add a minimal string "s" as prefix to work around this.
|
||||||
# PATHMAP_FLAGS is also added to LDFLAGS in flags-ldflags.m4.
|
# PATHMAP_FLAGS is also added to LDFLAGS in flags-ldflags.m4.
|
||||||
|
@ -128,10 +128,13 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$ENABLE_REPRODUCIBLE_BUILD" = "xtrue"; then
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
REPRODUCIBLE_LDFLAGS="-experimental:deterministic"
|
||||||
REPRODUCIBLE_LDFLAGS="-experimental:deterministic"
|
FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$REPRODUCIBLE_LDFLAGS],
|
||||||
fi
|
IF_FALSE: [
|
||||||
|
REPRODUCIBLE_LDFLAGS=
|
||||||
|
]
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
|
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
|
||||||
|
@ -713,30 +713,9 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD],
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
REPRODUCIBLE_BUILD_DEFAULT=$with_source_date_present
|
|
||||||
|
|
||||||
if test "x$OPENJDK_BUILD_OS" = xwindows && \
|
|
||||||
test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse; then
|
|
||||||
# To support banning absolute paths on Windows, we must use the -pathmap
|
|
||||||
# method, which requires reproducible builds.
|
|
||||||
REPRODUCIBLE_BUILD_DEFAULT=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
UTIL_ARG_ENABLE(NAME: reproducible-build, DEFAULT: $REPRODUCIBLE_BUILD_DEFAULT,
|
|
||||||
RESULT: ENABLE_REPRODUCIBLE_BUILD,
|
|
||||||
DESC: [enable reproducible builds (not yet fully functional)],
|
|
||||||
DEFAULT_DESC: [enabled if --with-source-date is given or on Windows without absolute paths])
|
|
||||||
|
|
||||||
if test "x$OPENJDK_BUILD_OS" = xwindows && \
|
|
||||||
test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse && \
|
|
||||||
test "x$ENABLE_REPRODUCIBLE_BUILD" = xfalse; then
|
|
||||||
AC_MSG_NOTICE([On Windows it is not possible to combine --disable-reproducible-build])
|
|
||||||
AC_MSG_NOTICE([with --disable-absolute-paths-in-output.])
|
|
||||||
AC_MSG_ERROR([Cannot continue])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(SOURCE_DATE)
|
AC_SUBST(SOURCE_DATE)
|
||||||
AC_SUBST(ENABLE_REPRODUCIBLE_BUILD)
|
|
||||||
AC_SUBST(ISO_8601_FORMAT_STRING)
|
AC_SUBST(ISO_8601_FORMAT_STRING)
|
||||||
AC_SUBST(SOURCE_DATE_ISO_8601)
|
AC_SUBST(SOURCE_DATE_ISO_8601)
|
||||||
|
|
||||||
|
UTIL_DEPRECATED_ARG_ENABLE(reproducible-build)
|
||||||
])
|
])
|
||||||
|
@ -129,7 +129,6 @@ RELEASE_FILE_OS_ARCH:=@RELEASE_FILE_OS_ARCH@
|
|||||||
RELEASE_FILE_LIBC:=@RELEASE_FILE_LIBC@
|
RELEASE_FILE_LIBC:=@RELEASE_FILE_LIBC@
|
||||||
|
|
||||||
SOURCE_DATE := @SOURCE_DATE@
|
SOURCE_DATE := @SOURCE_DATE@
|
||||||
ENABLE_REPRODUCIBLE_BUILD := @ENABLE_REPRODUCIBLE_BUILD@
|
|
||||||
ISO_8601_FORMAT_STRING := @ISO_8601_FORMAT_STRING@
|
ISO_8601_FORMAT_STRING := @ISO_8601_FORMAT_STRING@
|
||||||
|
|
||||||
ifneq ($(SOURCE_DATE), updated)
|
ifneq ($(SOURCE_DATE), updated)
|
||||||
|
@ -223,10 +223,8 @@ define SetupJarArchiveBody
|
|||||||
# If reproducible build and the boot jdk jar supports --date option
|
# If reproducible build and the boot jdk jar supports --date option
|
||||||
# then specify the --date using SOURCE_DATE in ISO-8601
|
# then specify the --date using SOURCE_DATE in ISO-8601
|
||||||
$1_JAR_OPTIONS :=
|
$1_JAR_OPTIONS :=
|
||||||
ifeq ($$(ENABLE_REPRODUCIBLE_BUILD), true)
|
ifeq ($$(BOOT_JDK_JAR_SUPPORTS_DATE), true)
|
||||||
ifeq ($$(BOOT_JDK_JAR_SUPPORTS_DATE), true)
|
$1_JAR_OPTIONS += --date $(SOURCE_DATE_ISO_8601)
|
||||||
$1_JAR_OPTIONS += --date $(SOURCE_DATE_ISO_8601)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
ifneq (,$$($1_CHECK_COMPRESS_JAR))
|
ifneq (,$$($1_CHECK_COMPRESS_JAR))
|
||||||
ifneq ($(COMPRESS_JARS), true)
|
ifneq ($(COMPRESS_JARS), true)
|
||||||
|
@ -406,9 +406,7 @@ define SetupCompileNativeFileBody
|
|||||||
# For reproducible builds with gcc and clang ensure random symbol generation is
|
# For reproducible builds with gcc and clang ensure random symbol generation is
|
||||||
# seeded deterministically
|
# seeded deterministically
|
||||||
ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
|
ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
|
||||||
ifeq ($$(ENABLE_REPRODUCIBLE_BUILD), true)
|
$1_COMPILE_OPTIONS += -frandom-seed="$$($1_FILENAME)"
|
||||||
$1_COMPILE_OPTIONS += -frandom-seed="$$($1_FILENAME)"
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$$($1_OBJ_JSON): $$($1_OBJ_DEPS)
|
$$($1_OBJ_JSON): $$($1_OBJ_DEPS)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -54,7 +54,7 @@ endif
|
|||||||
# FOLLOW_SYMLINKS - Set to explicitly follow symlinks. Affects performance of
|
# FOLLOW_SYMLINKS - Set to explicitly follow symlinks. Affects performance of
|
||||||
# finding files.
|
# finding files.
|
||||||
# ZIP_OPTIONS extra options to pass to zip
|
# ZIP_OPTIONS extra options to pass to zip
|
||||||
# REPRODUCIBLE override ENABLE_REPRODUCIBLE_BUILD (to make zip reproducible or not)
|
# REPRODUCIBLE set to false to disable the step that makes zip reproducible
|
||||||
|
|
||||||
SetupZipArchive = $(NamedParamsMacroTemplate)
|
SetupZipArchive = $(NamedParamsMacroTemplate)
|
||||||
define SetupZipArchiveBody
|
define SetupZipArchiveBody
|
||||||
@ -130,7 +130,7 @@ define SetupZipArchiveBody
|
|||||||
)
|
)
|
||||||
|
|
||||||
ifeq ($$($1_REPRODUCIBLE), )
|
ifeq ($$($1_REPRODUCIBLE), )
|
||||||
$1_REPRODUCIBLE := $$(ENABLE_REPRODUCIBLE_BUILD)
|
$1_REPRODUCIBLE := true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Use a slightly shorter name for logging, but with enough path to identify this zip.
|
# Use a slightly shorter name for logging, but with enough path to identify this zip.
|
||||||
|
@ -66,6 +66,10 @@ ifeq ($(VERSION_BUILD), )
|
|||||||
VERSION_BUILD := 0
|
VERSION_BUILD := 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HOTSPOT_BUILD_TIME), )
|
||||||
|
HOTSPOT_BUILD_TIME := $(call EpochToISO8601, $(shell $(DATE) +"%s"))
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS_VM_VERSION := \
|
CFLAGS_VM_VERSION := \
|
||||||
$(VERSION_CFLAGS) \
|
$(VERSION_CFLAGS) \
|
||||||
-DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
|
-DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
|
||||||
@ -73,12 +77,9 @@ CFLAGS_VM_VERSION := \
|
|||||||
-DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
|
-DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
|
||||||
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
|
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
|
||||||
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
|
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
|
||||||
|
-DHOTSPOT_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"' \
|
||||||
#
|
#
|
||||||
|
|
||||||
ifneq ($(HOTSPOT_BUILD_TIME), )
|
|
||||||
CFLAGS_VM_VERSION += -DHOTSPOT_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"'
|
|
||||||
endif
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Disabled warnings
|
# Disabled warnings
|
||||||
|
|
||||||
|
@ -29,16 +29,10 @@ include LibCommon.gmk
|
|||||||
|
|
||||||
ifeq ($(call isTargetOs, windows), true)
|
ifeq ($(call isTargetOs, windows), true)
|
||||||
|
|
||||||
CFLAGS_LIBDT_SHMEM := $(CFLAGS_JDKLIB)
|
|
||||||
|
|
||||||
ifneq ($(HOTSPOT_BUILD_TIME), )
|
|
||||||
CFLAGS_LIBDT_SHMEM += -DSHMEM_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"'
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
|
$(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
|
||||||
NAME := dt_shmem, \
|
NAME := dt_shmem, \
|
||||||
OPTIMIZATION := LOW, \
|
OPTIMIZATION := LOW, \
|
||||||
CFLAGS := $(CFLAGS_LIBDT_SHMEM), \
|
CFLAGS := $(CFLAGS_JDKLIB), \
|
||||||
EXTRA_HEADER_DIRS := \
|
EXTRA_HEADER_DIRS := \
|
||||||
jdk.jdwp.agent:include \
|
jdk.jdwp.agent:include \
|
||||||
jdk.jdwp.agent:libjdwp/export, \
|
jdk.jdwp.agent:libjdwp/export, \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -36,7 +36,7 @@ fi
|
|||||||
# Diff exceptions
|
# Diff exceptions
|
||||||
|
|
||||||
if [ "$OPENJDK_TARGET_OS" = "linux" ]; then
|
if [ "$OPENJDK_TARGET_OS" = "linux" ]; then
|
||||||
if [ "$HOTSPOT_BUILD_TIME" = "" -o "$USE_PRECOMPILED_HEADER" = "true" ]; then
|
if [ "$USE_PRECOMPILED_HEADER" = "true" ]; then
|
||||||
ACCEPTED_BIN_DIFF="
|
ACCEPTED_BIN_DIFF="
|
||||||
./lib/server/libjvm.so
|
./lib/server/libjvm.so
|
||||||
./hotspot/gtest/server/libjvm.so
|
./hotspot/gtest/server/libjvm.so
|
||||||
|
@ -74,6 +74,10 @@ VirtualizationType Abstract_VM_Version::_detected_virtualization = NoDetectedVir
|
|||||||
#error DEBUG_LEVEL must be defined
|
#error DEBUG_LEVEL must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HOTSPOT_BUILD_TIME
|
||||||
|
#error HOTSPOT_BUILD_TIME must be defined
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VM_RELEASE HOTSPOT_VERSION_STRING
|
#define VM_RELEASE HOTSPOT_VERSION_STRING
|
||||||
|
|
||||||
// HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
|
// HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
|
||||||
@ -267,10 +271,6 @@ const char* Abstract_VM_Version::internal_vm_info_string() {
|
|||||||
#define LIBC_STR ""
|
#define LIBC_STR ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HOTSPOT_BUILD_TIME
|
|
||||||
#define HOTSPOT_BUILD_TIME __DATE__ " " __TIME__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
|
#define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
|
||||||
" for " OS "-" CPU FLOAT_ARCH_STR LIBC_STR \
|
" for " OS "-" CPU FLOAT_ARCH_STR LIBC_STR \
|
||||||
" JRE (" VERSION_STRING "), built on " HOTSPOT_BUILD_TIME \
|
" JRE (" VERSION_STRING "), built on " HOTSPOT_BUILD_TIME \
|
||||||
|
@ -1257,14 +1257,14 @@ shmemBase_getlasterror(char *msg, jint size) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
exitTransportWithError(char *message, char *fileName,
|
exitTransportWithError(char *message, char *fileName,
|
||||||
char *date, int lineNumber)
|
int lineNumber)
|
||||||
{
|
{
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
jint error;
|
jint error;
|
||||||
char buffer[500];
|
char buffer[500];
|
||||||
|
|
||||||
sprintf(buffer, "Shared Memory Transport \"%s\" (%s), line %d: %s\n",
|
sprintf(buffer, "Shared Memory Transport \"%s\", line %d: %s\n",
|
||||||
fileName, date, lineNumber, message);
|
fileName, lineNumber, message);
|
||||||
error = (*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_2);
|
error = (*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_2);
|
||||||
if (error != JNI_OK) {
|
if (error != JNI_OK) {
|
||||||
/*
|
/*
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define JAVASOFT_SHMEMBASE_H
|
#define JAVASOFT_SHMEMBASE_H
|
||||||
|
|
||||||
void exitTransportWithError(char *msg, char *fileName,
|
void exitTransportWithError(char *msg, char *fileName,
|
||||||
char *date, int lineNumber);
|
int lineNumber);
|
||||||
|
|
||||||
typedef struct SharedMemoryConnection SharedMemoryConnection;
|
typedef struct SharedMemoryConnection SharedMemoryConnection;
|
||||||
typedef struct SharedMemoryTransport SharedMemoryTransport;
|
typedef struct SharedMemoryTransport SharedMemoryTransport;
|
||||||
@ -49,15 +49,11 @@ jint shmemBase_receivePacket(SharedMemoryConnection *, jdwpPacket *packet);
|
|||||||
jint shmemBase_name(SharedMemoryTransport *, char **name);
|
jint shmemBase_name(SharedMemoryTransport *, char **name);
|
||||||
jint shmemBase_getlasterror(char *msg, jint size);
|
jint shmemBase_getlasterror(char *msg, jint size);
|
||||||
|
|
||||||
#ifndef SHMEM_BUILD_TIME
|
|
||||||
#define SHMEM_BUILD_TIME __DATE__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define SHMEM_ASSERT(expression) \
|
#define SHMEM_ASSERT(expression) \
|
||||||
do { \
|
do { \
|
||||||
if (!(expression)) { \
|
if (!(expression)) { \
|
||||||
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
|
exitTransportWithError("assertion failed", __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
@ -67,7 +63,7 @@ do { \
|
|||||||
#define SHMEM_GUARANTEE(expression) \
|
#define SHMEM_GUARANTEE(expression) \
|
||||||
do { \
|
do { \
|
||||||
if (!(expression)) { \
|
if (!(expression)) { \
|
||||||
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
|
exitTransportWithError("assertion failed", __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "shmem_md.h"
|
#include "shmem_md.h"
|
||||||
#include "sysShmem.h"
|
#include "sysShmem.h"
|
||||||
#include "shmemBase.h" /* for exitTransportWithError */
|
#include "shmemBase.h" /* for SHMEM_ASSERT */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These functions are not completely universal. For now, they are used
|
* These functions are not completely universal. For now, they are used
|
||||||
@ -39,22 +39,6 @@
|
|||||||
|
|
||||||
static HANDLE memHandle = NULL;
|
static HANDLE memHandle = NULL;
|
||||||
|
|
||||||
#ifndef SHMEM_BUILD_TIME
|
|
||||||
#define SHMEM_BUILD_TIME __DATE__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define sysAssert(expression) { \
|
|
||||||
if (!(expression)) { \
|
|
||||||
exitTransportWithError \
|
|
||||||
("\"%s\", line %d: assertion failure\n", \
|
|
||||||
__FILE__, SHMEM_BUILD_TIME, __LINE__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define sysAssert(expression) ((void) 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sysSharedMemCreate(const char *name, int length,
|
sysSharedMemCreate(const char *name, int length,
|
||||||
sys_shmem_t *mem, void **buffer)
|
sys_shmem_t *mem, void **buffer)
|
||||||
@ -62,9 +46,9 @@ sysSharedMemCreate(const char *name, int length,
|
|||||||
void *mappedMemory;
|
void *mappedMemory;
|
||||||
HANDLE memHandle;
|
HANDLE memHandle;
|
||||||
|
|
||||||
sysAssert(buffer);
|
SHMEM_ASSERT(buffer);
|
||||||
sysAssert(name);
|
SHMEM_ASSERT(name);
|
||||||
sysAssert(length > 0);
|
SHMEM_ASSERT(length > 0);
|
||||||
|
|
||||||
memHandle =
|
memHandle =
|
||||||
CreateFileMapping(INVALID_HANDLE_VALUE, /* backed by page file */
|
CreateFileMapping(INVALID_HANDLE_VALUE, /* backed by page file */
|
||||||
@ -103,8 +87,8 @@ sysSharedMemOpen(const char *name, sys_shmem_t *mem, void **buffer)
|
|||||||
void *mappedMemory;
|
void *mappedMemory;
|
||||||
HANDLE memHandle;
|
HANDLE memHandle;
|
||||||
|
|
||||||
sysAssert(name);
|
SHMEM_ASSERT(name);
|
||||||
sysAssert(buffer);
|
SHMEM_ASSERT(buffer);
|
||||||
|
|
||||||
memHandle =
|
memHandle =
|
||||||
OpenFileMapping(FILE_MAP_WRITE, /* read/write */
|
OpenFileMapping(FILE_MAP_WRITE, /* read/write */
|
||||||
@ -151,8 +135,8 @@ sysIPMutexCreate(const char *name, sys_ipmutex_t *mutexPtr)
|
|||||||
{
|
{
|
||||||
HANDLE mutex;
|
HANDLE mutex;
|
||||||
|
|
||||||
sysAssert(mutexPtr);
|
SHMEM_ASSERT(mutexPtr);
|
||||||
sysAssert(name);
|
SHMEM_ASSERT(name);
|
||||||
|
|
||||||
mutex = CreateMutex(NULL, /* no inheritance */
|
mutex = CreateMutex(NULL, /* no inheritance */
|
||||||
FALSE, /* no initial owner */
|
FALSE, /* no initial owner */
|
||||||
@ -174,8 +158,8 @@ sysIPMutexOpen(const char *name, sys_ipmutex_t *mutexPtr)
|
|||||||
{
|
{
|
||||||
HANDLE mutex;
|
HANDLE mutex;
|
||||||
|
|
||||||
sysAssert(mutexPtr);
|
SHMEM_ASSERT(mutexPtr);
|
||||||
sysAssert(name);
|
SHMEM_ASSERT(name);
|
||||||
|
|
||||||
mutex = OpenMutex(SYNCHRONIZE, /* able to wait/release */
|
mutex = OpenMutex(SYNCHRONIZE, /* able to wait/release */
|
||||||
FALSE, /* no inheritance */
|
FALSE, /* no inheritance */
|
||||||
@ -195,7 +179,7 @@ sysIPMutexEnter(sys_ipmutex_t mutex, sys_event_t event)
|
|||||||
int count = event == NULL ? 1 : 2;
|
int count = event == NULL ? 1 : 2;
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
|
|
||||||
sysAssert(mutex);
|
SHMEM_ASSERT(mutex);
|
||||||
rc = WaitForMultipleObjects(count, handles,
|
rc = WaitForMultipleObjects(count, handles,
|
||||||
FALSE, /* wait for either, not both */
|
FALSE, /* wait for either, not both */
|
||||||
INFINITE); /* infinite timeout */
|
INFINITE); /* infinite timeout */
|
||||||
@ -205,7 +189,7 @@ sysIPMutexEnter(sys_ipmutex_t mutex, sys_event_t event)
|
|||||||
int
|
int
|
||||||
sysIPMutexExit(sys_ipmutex_t mutex)
|
sysIPMutexExit(sys_ipmutex_t mutex)
|
||||||
{
|
{
|
||||||
sysAssert(mutex);
|
SHMEM_ASSERT(mutex);
|
||||||
return ReleaseMutex(mutex) ? SYS_OK : SYS_ERR;
|
return ReleaseMutex(mutex) ? SYS_OK : SYS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +205,7 @@ sysEventCreate(const char *name, sys_event_t *eventPtr, jboolean manualReset)
|
|||||||
HANDLE event;
|
HANDLE event;
|
||||||
BOOL reset = (manualReset == JNI_TRUE) ? TRUE : FALSE;
|
BOOL reset = (manualReset == JNI_TRUE) ? TRUE : FALSE;
|
||||||
|
|
||||||
sysAssert(eventPtr);
|
SHMEM_ASSERT(eventPtr);
|
||||||
|
|
||||||
event = CreateEvent(NULL, /* no inheritance */
|
event = CreateEvent(NULL, /* no inheritance */
|
||||||
reset, /* manual reset */
|
reset, /* manual reset */
|
||||||
@ -244,8 +228,8 @@ sysEventOpen(const char *name, sys_event_t *eventPtr)
|
|||||||
{
|
{
|
||||||
HANDLE event;
|
HANDLE event;
|
||||||
|
|
||||||
sysAssert(eventPtr);
|
SHMEM_ASSERT(eventPtr);
|
||||||
sysAssert(name);
|
SHMEM_ASSERT(name);
|
||||||
|
|
||||||
event = OpenEvent(SYNCHRONIZE | EVENT_MODIFY_STATE,
|
event = OpenEvent(SYNCHRONIZE | EVENT_MODIFY_STATE,
|
||||||
/* able to wait/signal */
|
/* able to wait/signal */
|
||||||
@ -271,7 +255,7 @@ sysEventWait(sys_process_t otherProcess, sys_event_t event, long timeout)
|
|||||||
* If the signalling process is specified, and it dies while we wait,
|
* If the signalling process is specified, and it dies while we wait,
|
||||||
* detect it and return an error.
|
* detect it and return an error.
|
||||||
*/
|
*/
|
||||||
sysAssert(event);
|
SHMEM_ASSERT(event);
|
||||||
|
|
||||||
handles[0] = event;
|
handles[0] = event;
|
||||||
handles[1] = otherProcess;
|
handles[1] = otherProcess;
|
||||||
@ -297,7 +281,7 @@ sysEventWait(sys_process_t otherProcess, sys_event_t event, long timeout)
|
|||||||
int
|
int
|
||||||
sysEventSignal(sys_event_t event)
|
sysEventSignal(sys_event_t event)
|
||||||
{
|
{
|
||||||
sysAssert(event);
|
SHMEM_ASSERT(event);
|
||||||
return SetEvent(event) ? SYS_OK : SYS_ERR;
|
return SetEvent(event) ? SYS_OK : SYS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +302,7 @@ sysProcessOpen(jlong processID, sys_process_t *processPtr)
|
|||||||
{
|
{
|
||||||
HANDLE process;
|
HANDLE process;
|
||||||
|
|
||||||
sysAssert(processPtr);
|
SHMEM_ASSERT(processPtr);
|
||||||
|
|
||||||
process = OpenProcess(SYNCHRONIZE, /* able to wait on death */
|
process = OpenProcess(SYNCHRONIZE, /* able to wait on death */
|
||||||
FALSE, /* no inheritance */
|
FALSE, /* no inheritance */
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 1998, 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. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
void exitTransportWithError(char *msg, char *fileName,
|
|
||||||
char *date, int lineNumber);
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,7 +27,6 @@
|
|||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
#include "sysSocket.h"
|
#include "sysSocket.h"
|
||||||
#include "socketTransport.h"
|
|
||||||
|
|
||||||
typedef jboolean bool_t;
|
typedef jboolean bool_t;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user