8055230: Rename attach provider implementation class be platform neutral

Reviewed-by: alanb, chegar, dfuchs, dholmes, erikj, sla
This commit is contained in:
Mandy Chung 2014-08-26 14:35:33 -07:00
parent 7bded9c7bf
commit 6533d2dc01
22 changed files with 168 additions and 210 deletions

View file

@ -32,15 +32,6 @@ endef
################################################################################ ################################################################################
# Filter com.sun.tools.attach.spi.AttachProvider
$(JDK_OUTPUTDIR)/gensrc/jdk.attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider: \
$(JDK_TOPDIR)/src/jdk.attach/share/classes/META-INF/services/com.sun.tools.attach.spi.AttachProvider
$(process-provider)
GENSRC_JDK_ATTACH += $(JDK_OUTPUTDIR)/gensrc/jdk.attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider
################################################################################
# Filter com.sun.jdi.connect.Connector # Filter com.sun.jdi.connect.Connector
$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \ $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
$(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector

View file

@ -27,33 +27,11 @@ include LibCommon.gmk
################################################################################ ################################################################################
ifeq ($(OPENJDK_TARGET_OS), aix)
LIBATTACH_OS_API_DIR := aix
else
LIBATTACH_OS_API_DIR := $(OPENJDK_TARGET_OS_API_DIR)
endif
LIBATTACH_SRC := $(JDK_TOPDIR)/src/jdk.attach/$(LIBATTACH_OS_API_DIR)/native/libattach
LIBATTACH_EXCLUDE_FILES :=
ifneq ($(OPENJDK_TARGET_OS), solaris)
LIBATTACH_EXCLUDE_FILES += SolarisVirtualMachine.c
endif
ifneq ($(OPENJDK_TARGET_OS), linux)
LIBATTACH_EXCLUDE_FILES += LinuxVirtualMachine.c
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBATTACH_EXCLUDE_FILES += BsdVirtualMachine.c
endif
ifneq ($(OPENJDK_TARGET_OS),aix)
LIBATTACH_EXCLUDE_FILES += AixVirtualMachine.c
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
LIBRARY := attach, \ LIBRARY := attach, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBATTACH_SRC), \ SRC := $(JDK_TOPDIR)/src/jdk.attach/$(OPENJDK_TARGET_OS)/native/libattach, \
EXCLUDE_FILES := $(LIBATTACH_EXCLUDE_FILES), \
LANG := C, \ LANG := C, \
OPTIMIZATION := LOW, \ OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \

View file

@ -27,13 +27,13 @@
SUNWprivate_1.1 { SUNWprivate_1.1 {
global: global:
Java_sun_tools_attach_AixVirtualMachine_socket Java_sun_tools_attach_VirtualMachineImpl_socket
Java_sun_tools_attach_AixVirtualMachine_connect Java_sun_tools_attach_VirtualMachineImpl_connect
Java_sun_tools_attach_AixVirtualMachine_sendQuitTo Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo
Java_sun_tools_attach_AixVirtualMachine_checkPermissions Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
Java_sun_tools_attach_AixVirtualMachine_close Java_sun_tools_attach_VirtualMachineImpl_close
Java_sun_tools_attach_AixVirtualMachine_read Java_sun_tools_attach_VirtualMachineImpl_read
Java_sun_tools_attach_AixVirtualMachine_write Java_sun_tools_attach_VirtualMachineImpl_write
local: local:
*; *;
}; };

View file

@ -27,17 +27,17 @@
SUNWprivate_1.1 { SUNWprivate_1.1 {
global: global:
Java_sun_tools_attach_LinuxVirtualMachine_checkPermissions; Java_sun_tools_attach_VirtualMachineImpl_checkPermissions;
Java_sun_tools_attach_LinuxVirtualMachine_close; Java_sun_tools_attach_VirtualMachineImpl_close;
Java_sun_tools_attach_LinuxVirtualMachine_connect; Java_sun_tools_attach_VirtualMachineImpl_connect;
Java_sun_tools_attach_LinuxVirtualMachine_getLinuxThreadsManager; Java_sun_tools_attach_VirtualMachineImpl_getLinuxThreadsManager;
Java_sun_tools_attach_LinuxVirtualMachine_isLinuxThreads; Java_sun_tools_attach_VirtualMachineImpl_isLinuxThreads;
Java_sun_tools_attach_LinuxVirtualMachine_open; Java_sun_tools_attach_VirtualMachineImpl_open;
Java_sun_tools_attach_LinuxVirtualMachine_sendQuitTo; Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo;
Java_sun_tools_attach_LinuxVirtualMachine_sendQuitToChildrenOf; Java_sun_tools_attach_VirtualMachineImpl_sendQuitToChildrenOf;
Java_sun_tools_attach_LinuxVirtualMachine_socket; Java_sun_tools_attach_VirtualMachineImpl_socket;
Java_sun_tools_attach_LinuxVirtualMachine_read; Java_sun_tools_attach_VirtualMachineImpl_read;
Java_sun_tools_attach_LinuxVirtualMachine_write; Java_sun_tools_attach_VirtualMachineImpl_write;
local: local:
*; *;
}; };

View file

@ -27,12 +27,12 @@
SUNWprivate_1.1 { SUNWprivate_1.1 {
global: global:
Java_sun_tools_attach_SolarisVirtualMachine_checkPermissions; Java_sun_tools_attach_VirtualMachineImpl_checkPermissions;
Java_sun_tools_attach_SolarisVirtualMachine_enqueue; Java_sun_tools_attach_VirtualMachineImpl_enqueue;
Java_sun_tools_attach_SolarisVirtualMachine_open; Java_sun_tools_attach_VirtualMachineImpl_open;
Java_sun_tools_attach_SolarisVirtualMachine_close; Java_sun_tools_attach_VirtualMachineImpl_close;
Java_sun_tools_attach_SolarisVirtualMachine_read; Java_sun_tools_attach_VirtualMachineImpl_read;
Java_sun_tools_attach_SolarisVirtualMachine_sigquit; Java_sun_tools_attach_VirtualMachineImpl_sigquit;
local: local:
*; *;
}; };

View file

@ -32,19 +32,18 @@ import com.sun.tools.attach.spi.AttachProvider;
import java.io.IOException; import java.io.IOException;
// Based on 'LinuxAttachProvider.java'. All occurrences of the string // Based on linux/classes/sun/tools/attach/AttachProviderImpl.java.
// "Linux" have been textually replaced by "Aix" to avoid confusion.
/* /*
* An AttachProvider implementation for Aix that uses a UNIX domain * An AttachProvider implementation for Aix that uses a UNIX domain
* socket. * socket.
*/ */
public class AixAttachProvider extends HotSpotAttachProvider { public class AttachProviderImpl extends HotSpotAttachProvider {
// perf counter for the JVM version // perf counter for the JVM version
private static final String JVM_VERSION = "java.property.java.vm.version"; private static final String JVM_VERSION = "java.property.java.vm.version";
public AixAttachProvider() { public AttachProviderImpl() {
} }
public String name() { public String name() {
@ -64,7 +63,7 @@ public class AixAttachProvider extends HotSpotAttachProvider {
// to be not attachable. // to be not attachable.
testAttachable(vmid); testAttachable(vmid);
return new AixVirtualMachine(this, vmid); return new VirtualMachineImpl(this, vmid);
} }
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd) public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
@ -79,7 +78,7 @@ public class AixAttachProvider extends HotSpotAttachProvider {
if (vmd instanceof HotSpotVirtualMachineDescriptor) { if (vmd instanceof HotSpotVirtualMachineDescriptor) {
assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable(); assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
checkAttachPermission(); checkAttachPermission();
return new AixVirtualMachine(this, vmd.id()); return new VirtualMachineImpl(this, vmd.id());
} else { } else {
return attachVirtualMachine(vmd.id()); return attachVirtualMachine(vmd.id());
} }

View file

@ -34,13 +34,12 @@ import java.io.IOException;
import java.io.File; import java.io.File;
import java.util.Properties; import java.util.Properties;
// Based on 'LinuxVirtualMachine.java'. All occurrences of the string // Based on linux/classes/sun/tools/attach/VirtualMachineImpl.java.
// "Linux" have been textually replaced by "Aix" to avoid confusion.
/* /*
* Aix implementation of HotSpotVirtualMachine * Aix implementation of HotSpotVirtualMachine
*/ */
public class AixVirtualMachine extends HotSpotVirtualMachine { public class VirtualMachineImpl extends HotSpotVirtualMachine {
// "/tmp" is used as a global well-known location for the files // "/tmp" is used as a global well-known location for the files
// .java_pid<pid>. and .attach_pid<pid>. It is important that this // .java_pid<pid>. and .attach_pid<pid>. It is important that this
// location is the same for all processes, otherwise the tools // location is the same for all processes, otherwise the tools
@ -54,7 +53,7 @@ public class AixVirtualMachine extends HotSpotVirtualMachine {
/** /**
* Attaches to the target VM * Attaches to the target VM
*/ */
AixVirtualMachine(AttachProvider provider, String vmid) VirtualMachineImpl(AttachProvider provider, String vmid)
throws AttachNotSupportedException, IOException throws AttachNotSupportedException, IOException
{ {
super(provider, vmid); super(provider, vmid);
@ -241,11 +240,11 @@ public class AixVirtualMachine extends HotSpotVirtualMachine {
} else if (len == 0) } else if (len == 0)
return 0; return 0;
return AixVirtualMachine.read(s, bs, off, len); return VirtualMachineImpl.read(s, bs, off, len);
} }
public void close() throws IOException { public void close() throws IOException {
AixVirtualMachine.close(s); VirtualMachineImpl.close(s);
} }
} }
@ -287,7 +286,7 @@ public class AixVirtualMachine extends HotSpotVirtualMachine {
} catch (java.io.UnsupportedEncodingException x) { } catch (java.io.UnsupportedEncodingException x) {
throw new InternalError(x); throw new InternalError(x);
} }
AixVirtualMachine.write(fd, b, 0, b.length); VirtualMachineImpl.write(fd, b, 0, b.length);
} }
byte b[] = new byte[1]; byte b[] = new byte[1];
b[0] = 0; b[0] = 0;

View file

@ -45,7 +45,7 @@
* occurrences of the string "Linux" have been replaced by "Aix". * occurrences of the string "Linux" have been replaced by "Aix".
*/ */
#include "sun_tools_attach_AixVirtualMachine.h" #include "sun_tools_attach_VirtualMachineImpl.h"
#define RESTARTABLE(_cmd, _result) do { \ #define RESTARTABLE(_cmd, _result) do { \
do { \ do { \
@ -55,11 +55,11 @@
/* /*
* Class: sun_tools_attach_AixVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: socket * Method: socket
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_AixVirtualMachine_socket JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_socket
(JNIEnv *env, jclass cls) (JNIEnv *env, jclass cls)
{ {
int fd = socket(PF_UNIX, SOCK_STREAM, 0); int fd = socket(PF_UNIX, SOCK_STREAM, 0);
@ -79,11 +79,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_AixVirtualMachine_socket
} }
/* /*
* Class: sun_tools_attach_AixVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: connect * Method: connect
* Signature: (ILjava/lang/String;)I * Signature: (ILjava/lang/String;)I
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_connect JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_connect
(JNIEnv *env, jclass cls, jint fd, jstring path) (JNIEnv *env, jclass cls, jint fd, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -142,11 +142,11 @@ static void SendQuitCallback(const pid_t pid, void* user_data) {
} }
/* /*
* Class: sun_tools_attach_AixVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: sendQuitTo * Method: sendQuitTo
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_sendQuitTo JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo
(JNIEnv *env, jclass cls, jint pid) (JNIEnv *env, jclass cls, jint pid)
{ {
if (kill((pid_t)pid, SIGQUIT)) { if (kill((pid_t)pid, SIGQUIT)) {
@ -155,11 +155,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_sendQuitTo
} }
/* /*
* Class: sun_tools_attach_AixVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: checkPermissions * Method: checkPermissions
* Signature: (Ljava/lang/String;)V * Signature: (Ljava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_checkPermissions JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
(JNIEnv *env, jclass cls, jstring path) (JNIEnv *env, jclass cls, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -205,11 +205,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_checkPermissions
} }
/* /*
* Class: sun_tools_attach_AixVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: close * Method: close
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_close JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close
(JNIEnv *env, jclass cls, jint fd) (JNIEnv *env, jclass cls, jint fd)
{ {
int res; int res;
@ -222,11 +222,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_close
} }
/* /*
* Class: sun_tools_attach_AixVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: read * Method: read
* Signature: (I[BI)I * Signature: (I[BI)I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_AixVirtualMachine_read JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_read
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen) (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen)
{ {
unsigned char buf[128]; unsigned char buf[128];
@ -252,11 +252,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_AixVirtualMachine_read
} }
/* /*
* Class: sun_tools_attach_AixVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: write * Method: write
* Signature: (I[B)V * Signature: (I[B)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_AixVirtualMachine_write JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_write
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint bufLen) (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint bufLen)
{ {
size_t remaining = bufLen; size_t remaining = bufLen;

View file

@ -35,12 +35,12 @@ import java.io.IOException;
* An AttachProvider implementation for Linux that uses a UNIX domain * An AttachProvider implementation for Linux that uses a UNIX domain
* socket. * socket.
*/ */
public class LinuxAttachProvider extends HotSpotAttachProvider { public class AttachProviderImpl extends HotSpotAttachProvider {
// perf counter for the JVM version // perf counter for the JVM version
private static final String JVM_VERSION = "java.property.java.vm.version"; private static final String JVM_VERSION = "java.property.java.vm.version";
public LinuxAttachProvider() { public AttachProviderImpl() {
} }
public String name() { public String name() {
@ -60,7 +60,7 @@ public class LinuxAttachProvider extends HotSpotAttachProvider {
// to be not attachable. // to be not attachable.
testAttachable(vmid); testAttachable(vmid);
return new LinuxVirtualMachine(this, vmid); return new VirtualMachineImpl(this, vmid);
} }
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd) public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
@ -75,7 +75,7 @@ public class LinuxAttachProvider extends HotSpotAttachProvider {
if (vmd instanceof HotSpotVirtualMachineDescriptor) { if (vmd instanceof HotSpotVirtualMachineDescriptor) {
assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable(); assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
checkAttachPermission(); checkAttachPermission();
return new LinuxVirtualMachine(this, vmd.id()); return new VirtualMachineImpl(this, vmd.id());
} else { } else {
return attachVirtualMachine(vmd.id()); return attachVirtualMachine(vmd.id());
} }

View file

@ -36,7 +36,7 @@ import java.io.File;
/* /*
* Linux implementation of HotSpotVirtualMachine * Linux implementation of HotSpotVirtualMachine
*/ */
public class LinuxVirtualMachine extends HotSpotVirtualMachine { public class VirtualMachineImpl extends HotSpotVirtualMachine {
// "/tmp" is used as a global well-known location for the files // "/tmp" is used as a global well-known location for the files
// .java_pid<pid>. and .attach_pid<pid>. It is important that this // .java_pid<pid>. and .attach_pid<pid>. It is important that this
// location is the same for all processes, otherwise the tools // location is the same for all processes, otherwise the tools
@ -53,7 +53,7 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine {
/** /**
* Attaches to the target VM * Attaches to the target VM
*/ */
LinuxVirtualMachine(AttachProvider provider, String vmid) VirtualMachineImpl(AttachProvider provider, String vmid)
throws AttachNotSupportedException, IOException throws AttachNotSupportedException, IOException
{ {
super(provider, vmid); super(provider, vmid);
@ -262,11 +262,11 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine {
} else if (len == 0) } else if (len == 0)
return 0; return 0;
return LinuxVirtualMachine.read(s, bs, off, len); return VirtualMachineImpl.read(s, bs, off, len);
} }
public void close() throws IOException { public void close() throws IOException {
LinuxVirtualMachine.close(s); VirtualMachineImpl.close(s);
} }
} }
@ -308,7 +308,7 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine {
} catch (java.io.UnsupportedEncodingException x) { } catch (java.io.UnsupportedEncodingException x) {
throw new InternalError(x); throw new InternalError(x);
} }
LinuxVirtualMachine.write(fd, b, 0, b.length); VirtualMachineImpl.write(fd, b, 0, b.length);
} }
byte b[] = new byte[1]; byte b[] = new byte[1];
b[0] = 0; b[0] = 0;

View file

@ -40,7 +40,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/un.h> #include <sys/un.h>
#include "sun_tools_attach_LinuxVirtualMachine.h" #include "sun_tools_attach_VirtualMachineImpl.h"
#define RESTARTABLE(_cmd, _result) do { \ #define RESTARTABLE(_cmd, _result) do { \
do { \ do { \
@ -128,11 +128,11 @@ static pid_t getParent(pid_t pid) {
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: socket * Method: socket
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_LinuxVirtualMachine_socket JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_socket
(JNIEnv *env, jclass cls) (JNIEnv *env, jclass cls)
{ {
int fd = socket(PF_UNIX, SOCK_STREAM, 0); int fd = socket(PF_UNIX, SOCK_STREAM, 0);
@ -143,11 +143,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_LinuxVirtualMachine_socket
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: connect * Method: connect
* Signature: (ILjava/lang/String;)I * Signature: (ILjava/lang/String;)I
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_connect JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_connect
(JNIEnv *env, jclass cls, jint fd, jstring path) (JNIEnv *env, jclass cls, jint fd, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -189,11 +189,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_connect
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: isLinuxThreads * Method: isLinuxThreads
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT jboolean JNICALL Java_sun_tools_attach_LinuxVirtualMachine_isLinuxThreads JNIEXPORT jboolean JNICALL Java_sun_tools_attach_VirtualMachineImpl_isLinuxThreads
(JNIEnv *env, jclass cls) (JNIEnv *env, jclass cls)
{ {
# ifndef _CS_GNU_LIBPTHREAD_VERSION # ifndef _CS_GNU_LIBPTHREAD_VERSION
@ -250,11 +250,11 @@ static void ChildCountCallback(const pid_t pid, void* user_data) {
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: getLinuxThreadsManager * Method: getLinuxThreadsManager
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_LinuxVirtualMachine_getLinuxThreadsManager JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_getLinuxThreadsManager
(JNIEnv *env, jclass cls, jint pid) (JNIEnv *env, jclass cls, jint pid)
{ {
ChildCountContext context; ChildCountContext context;
@ -312,11 +312,11 @@ static void SendQuitCallback(const pid_t pid, void* user_data) {
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: sendQuitToChildrenOf * Method: sendQuitToChildrenOf
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_sendQuitToChildrenOf JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sendQuitToChildrenOf
(JNIEnv *env, jclass cls, jint pid) (JNIEnv *env, jclass cls, jint pid)
{ {
SendQuitContext context; SendQuitContext context;
@ -329,11 +329,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_sendQuitToChild
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: sendQuitTo * Method: sendQuitTo
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_sendQuitTo JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo
(JNIEnv *env, jclass cls, jint pid) (JNIEnv *env, jclass cls, jint pid)
{ {
if (kill((pid_t)pid, SIGQUIT)) { if (kill((pid_t)pid, SIGQUIT)) {
@ -342,11 +342,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_sendQuitTo
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: checkPermissions * Method: checkPermissions
* Signature: (Ljava/lang/String;)V * Signature: (Ljava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_checkPermissions JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
(JNIEnv *env, jclass cls, jstring path) (JNIEnv *env, jclass cls, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -390,11 +390,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_checkPermission
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: close * Method: close
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_close JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close
(JNIEnv *env, jclass cls, jint fd) (JNIEnv *env, jclass cls, jint fd)
{ {
int res; int res;
@ -402,11 +402,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_close
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: read * Method: read
* Signature: (I[BI)I * Signature: (I[BI)I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_LinuxVirtualMachine_read JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_read
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen) (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen)
{ {
unsigned char buf[128]; unsigned char buf[128];
@ -432,11 +432,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_LinuxVirtualMachine_read
} }
/* /*
* Class: sun_tools_attach_LinuxVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: write * Method: write
* Signature: (I[B)V * Signature: (I[B)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_write JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_write
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint bufLen) (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint bufLen)
{ {
size_t remaining = bufLen; size_t remaining = bufLen;

View file

@ -35,12 +35,12 @@ import java.io.IOException;
* An AttachProvider implementation for Bsd that uses a UNIX domain * An AttachProvider implementation for Bsd that uses a UNIX domain
* socket. * socket.
*/ */
public class BsdAttachProvider extends HotSpotAttachProvider { public class AttachProviderImpl extends HotSpotAttachProvider {
// perf counter for the JVM version // perf counter for the JVM version
private static final String JVM_VERSION = "java.property.java.vm.version"; private static final String JVM_VERSION = "java.property.java.vm.version";
public BsdAttachProvider() { public AttachProviderImpl() {
} }
public String name() { public String name() {
@ -60,7 +60,7 @@ public class BsdAttachProvider extends HotSpotAttachProvider {
// to be not attachable. // to be not attachable.
testAttachable(vmid); testAttachable(vmid);
return new BsdVirtualMachine(this, vmid); return new VirtualMachineImpl(this, vmid);
} }
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd) public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
@ -75,7 +75,7 @@ public class BsdAttachProvider extends HotSpotAttachProvider {
if (vmd instanceof HotSpotVirtualMachineDescriptor) { if (vmd instanceof HotSpotVirtualMachineDescriptor) {
assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable(); assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
checkAttachPermission(); checkAttachPermission();
return new BsdVirtualMachine(this, vmd.id()); return new VirtualMachineImpl(this, vmd.id());
} else { } else {
return attachVirtualMachine(vmd.id()); return attachVirtualMachine(vmd.id());
} }

View file

@ -36,7 +36,7 @@ import java.io.File;
/* /*
* Bsd implementation of HotSpotVirtualMachine * Bsd implementation of HotSpotVirtualMachine
*/ */
public class BsdVirtualMachine extends HotSpotVirtualMachine { public class VirtualMachineImpl extends HotSpotVirtualMachine {
// "tmpdir" is used as a global well-known location for the files // "tmpdir" is used as a global well-known location for the files
// .java_pid<pid>. and .attach_pid<pid>. It is important that this // .java_pid<pid>. and .attach_pid<pid>. It is important that this
// location is the same for all processes, otherwise the tools // location is the same for all processes, otherwise the tools
@ -52,7 +52,7 @@ public class BsdVirtualMachine extends HotSpotVirtualMachine {
/** /**
* Attaches to the target VM * Attaches to the target VM
*/ */
BsdVirtualMachine(AttachProvider provider, String vmid) VirtualMachineImpl(AttachProvider provider, String vmid)
throws AttachNotSupportedException, IOException throws AttachNotSupportedException, IOException
{ {
super(provider, vmid); super(provider, vmid);
@ -247,11 +247,11 @@ public class BsdVirtualMachine extends HotSpotVirtualMachine {
return 0; return 0;
} }
return BsdVirtualMachine.read(s, bs, off, len); return VirtualMachineImpl.read(s, bs, off, len);
} }
public void close() throws IOException { public void close() throws IOException {
BsdVirtualMachine.close(s); VirtualMachineImpl.close(s);
} }
} }
@ -275,7 +275,7 @@ public class BsdVirtualMachine extends HotSpotVirtualMachine {
} catch (java.io.UnsupportedEncodingException x) { } catch (java.io.UnsupportedEncodingException x) {
throw new InternalError(); throw new InternalError();
} }
BsdVirtualMachine.write(fd, b, 0, b.length); VirtualMachineImpl.write(fd, b, 0, b.length);
} }
byte b[] = new byte[1]; byte b[] = new byte[1];
b[0] = 0; b[0] = 0;

View file

@ -41,7 +41,7 @@
#include <sys/un.h> #include <sys/un.h>
#include <fcntl.h> #include <fcntl.h>
#include "sun_tools_attach_BsdVirtualMachine.h" #include "sun_tools_attach_VirtualMachineImpl.h"
#define RESTARTABLE(_cmd, _result) do { \ #define RESTARTABLE(_cmd, _result) do { \
do { \ do { \
@ -50,11 +50,11 @@
} while(0) } while(0)
/* /*
* Class: sun_tools_attach_BsdVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: socket * Method: socket
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_BsdVirtualMachine_socket JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_socket
(JNIEnv *env, jclass cls) (JNIEnv *env, jclass cls)
{ {
int fd = socket(PF_UNIX, SOCK_STREAM, 0); int fd = socket(PF_UNIX, SOCK_STREAM, 0);
@ -65,11 +65,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_BsdVirtualMachine_socket
} }
/* /*
* Class: sun_tools_attach_BsdVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: connect * Method: connect
* Signature: (ILjava/lang/String;)I * Signature: (ILjava/lang/String;)I
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_connect JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_connect
(JNIEnv *env, jclass cls, jint fd, jstring path) (JNIEnv *env, jclass cls, jint fd, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -111,11 +111,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_connect
} }
/* /*
* Class: sun_tools_attach_BsdVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: sendQuitTo * Method: sendQuitTo
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_sendQuitTo JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo
(JNIEnv *env, jclass cls, jint pid) (JNIEnv *env, jclass cls, jint pid)
{ {
if (kill((pid_t)pid, SIGQUIT)) { if (kill((pid_t)pid, SIGQUIT)) {
@ -124,11 +124,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_sendQuitTo
} }
/* /*
* Class: sun_tools_attach_BsdVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: checkPermissions * Method: checkPermissions
* Signature: (Ljava/lang/String;)V * Signature: (Ljava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_checkPermissions JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
(JNIEnv *env, jclass cls, jstring path) (JNIEnv *env, jclass cls, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -172,11 +172,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_checkPermissions
} }
/* /*
* Class: sun_tools_attach_BsdVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: close * Method: close
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_close JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close
(JNIEnv *env, jclass cls, jint fd) (JNIEnv *env, jclass cls, jint fd)
{ {
int res; int res;
@ -184,11 +184,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_close
} }
/* /*
* Class: sun_tools_attach_BsdVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: read * Method: read
* Signature: (I[BI)I * Signature: (I[BI)I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_BsdVirtualMachine_read JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_read
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen) (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen)
{ {
unsigned char buf[128]; unsigned char buf[128];
@ -214,11 +214,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_BsdVirtualMachine_read
} }
/* /*
* Class: sun_tools_attach_BsdVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: write * Method: write
* Signature: (I[B)V * Signature: (I[B)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_write JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_write
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint bufLen) (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint bufLen)
{ {
size_t remaining = bufLen; size_t remaining = bufLen;
@ -249,7 +249,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_write
* Method: createAttachFile * Method: createAttachFile
* Signature: (Ljava.lang.String;)V * Signature: (Ljava.lang.String;)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_createAttachFile(JNIEnv *env, jclass cls, jstring path) JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile(JNIEnv *env, jclass cls, jstring path)
{ {
const char* _path; const char* _path;
jboolean isCopy; jboolean isCopy;
@ -286,7 +286,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_createAttachFile(
* Method: getTempDir * Method: getTempDir
* Signature: (V)Ljava.lang.String; * Signature: (V)Ljava.lang.String;
*/ */
JNIEXPORT jstring JNICALL Java_sun_tools_attach_BsdVirtualMachine_getTempDir(JNIEnv *env, jclass cls) JNIEXPORT jstring JNICALL Java_sun_tools_attach_VirtualMachineImpl_getTempDir(JNIEnv *env, jclass cls)
{ {
// This must be hard coded because it's the system's temporary // This must be hard coded because it's the system's temporary
// directory not the java application's temp directory, ala java.io.tmpdir. // directory not the java application's temp directory, ala java.io.tmpdir.

View file

@ -22,13 +22,4 @@
# or visit www.oracle.com if you need additional information or have any # or visit www.oracle.com if you need additional information or have any
# questions. # questions.
# #
# List all Sun provided attach providers here. If there sun.tools.attach.AttachProviderImpl
# are providers that are only available on a particular OS
# then prefix the line with #[OS] and they will automatically
# uncommented by the build process.
#
#[solaris]sun.tools.attach.SolarisAttachProvider
#[windows]sun.tools.attach.WindowsAttachProvider
#[linux]sun.tools.attach.LinuxAttachProvider
#[macosx]sun.tools.attach.BsdAttachProvider
#[aix]sun.tools.attach.AixAttachProvider

View file

@ -34,9 +34,9 @@ import java.io.IOException;
* An AttachProvider implementation for Solaris that use the doors * An AttachProvider implementation for Solaris that use the doors
* interface to the VM. * interface to the VM.
*/ */
public class SolarisAttachProvider extends HotSpotAttachProvider { public class AttachProviderImpl extends HotSpotAttachProvider {
public SolarisAttachProvider() { public AttachProviderImpl() {
} }
public String name() { public String name() {
@ -56,7 +56,7 @@ public class SolarisAttachProvider extends HotSpotAttachProvider {
// to be not attachable. // to be not attachable.
testAttachable(vmid); testAttachable(vmid);
return new SolarisVirtualMachine(this, vmid); return new VirtualMachineImpl(this, vmid);
} }
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd) public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
@ -71,7 +71,7 @@ public class SolarisAttachProvider extends HotSpotAttachProvider {
if (vmd instanceof HotSpotVirtualMachineDescriptor) { if (vmd instanceof HotSpotVirtualMachineDescriptor) {
assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable(); assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
checkAttachPermission(); checkAttachPermission();
return new SolarisVirtualMachine(this, vmd.id()); return new VirtualMachineImpl(this, vmd.id());
} else { } else {
return attachVirtualMachine(vmd.id()); return attachVirtualMachine(vmd.id());
} }

View file

@ -37,7 +37,7 @@ import java.io.FileNotFoundException;
/* /*
* Solaris implementation of HotSpotVirtualMachine. * Solaris implementation of HotSpotVirtualMachine.
*/ */
public class SolarisVirtualMachine extends HotSpotVirtualMachine { public class VirtualMachineImpl extends HotSpotVirtualMachine {
// "/tmp" is used as a global well-known location for the files // "/tmp" is used as a global well-known location for the files
// .java_pid<pid>. and .attach_pid<pid>. It is important that this // .java_pid<pid>. and .attach_pid<pid>. It is important that this
// location is the same for all processes, otherwise the tools // location is the same for all processes, otherwise the tools
@ -51,7 +51,7 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine {
/** /**
* Attaches to the target VM * Attaches to the target VM
*/ */
SolarisVirtualMachine(AttachProvider provider, String vmid) VirtualMachineImpl(AttachProvider provider, String vmid)
throws AttachNotSupportedException, IOException throws AttachNotSupportedException, IOException
{ {
super(provider, vmid); super(provider, vmid);
@ -190,11 +190,11 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine {
} else if (len == 0) } else if (len == 0)
return 0; return 0;
return SolarisVirtualMachine.read(s, bs, off, len); return VirtualMachineImpl.read(s, bs, off, len);
} }
public void close() throws IOException { public void close() throws IOException {
SolarisVirtualMachine.close(s); VirtualMachineImpl.close(s);
} }
} }

View file

@ -36,7 +36,7 @@
#include "jni.h" #include "jni.h"
#include "jni_util.h" #include "jni_util.h"
#include "sun_tools_attach_SolarisVirtualMachine.h" #include "sun_tools_attach_VirtualMachineImpl.h"
#define RESTARTABLE(_cmd, _result) do { \ #define RESTARTABLE(_cmd, _result) do { \
do { \ do { \
@ -45,11 +45,11 @@
} while(0) } while(0)
/* /*
* Class: sun_tools_attach_SolarisVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: open * Method: open
* Signature: (Ljava/lang/String;)I * Signature: (Ljava/lang/String;)I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_SolarisVirtualMachine_open JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_open
(JNIEnv *env, jclass cls, jstring path) (JNIEnv *env, jclass cls, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -85,11 +85,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_SolarisVirtualMachine_open
} }
/* /*
* Class: sun_tools_attach_SolarisVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: checkPermissions * Method: checkPermissions
* Signature: (Ljava/lang/String;)V * Signature: (Ljava/lang/String;)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_SolarisVirtualMachine_checkPermissions JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
(JNIEnv *env, jclass cls, jstring path) (JNIEnv *env, jclass cls, jstring path)
{ {
jboolean isCopy; jboolean isCopy;
@ -133,11 +133,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_SolarisVirtualMachine_checkPermissi
} }
/* /*
* Class: sun_tools_attach_SolarisVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: close * Method: close
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_SolarisVirtualMachine_close JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close
(JNIEnv *env, jclass cls, jint fd) (JNIEnv *env, jclass cls, jint fd)
{ {
int ret; int ret;
@ -145,11 +145,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_SolarisVirtualMachine_close
} }
/* /*
* Class: sun_tools_attach_SolarisVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: read * Method: read
* Signature: (I[BI)I * Signature: (I[BI)I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_SolarisVirtualMachine_read JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_read
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen) (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen)
{ {
unsigned char buf[128]; unsigned char buf[128];
@ -175,11 +175,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_SolarisVirtualMachine_read
} }
/* /*
* Class: sun_tools_attach_SolarisVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: sigquit * Method: sigquit
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_SolarisVirtualMachine_sigquit JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sigquit
(JNIEnv *env, jclass cls, jint pid) (JNIEnv *env, jclass cls, jint pid)
{ {
if (kill((pid_t)pid, SIGQUIT) == -1) { if (kill((pid_t)pid, SIGQUIT) == -1) {
@ -224,11 +224,11 @@ static const char* translate_error(jint err) {
static const char* PROTOCOL_VERSION = "1"; static const char* PROTOCOL_VERSION = "1";
/* /*
* Class: sun_tools_attach_SolarisVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: enqueue * Method: enqueue
* Signature: (JILjava/lang/String;[Ljava/lang/Object;)V * Signature: (JILjava/lang/String;[Ljava/lang/Object;)V
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_SolarisVirtualMachine_enqueue JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_enqueue
(JNIEnv *env, jclass cls, jint fd, jstring cmd, jobjectArray args) (JNIEnv *env, jclass cls, jint fd, jstring cmd, jobjectArray args)
{ {
jint arg_count, i; jint arg_count, i;

View file

@ -34,9 +34,9 @@ import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
public class WindowsAttachProvider extends HotSpotAttachProvider { public class AttachProviderImpl extends HotSpotAttachProvider {
public WindowsAttachProvider() { public AttachProviderImpl() {
String os = System.getProperty("os.name"); String os = System.getProperty("os.name");
if (os.startsWith("Windows 9") || os.equals("Windows Me")) { if (os.startsWith("Windows 9") || os.equals("Windows Me")) {
throw new RuntimeException( throw new RuntimeException(
@ -66,7 +66,7 @@ public class WindowsAttachProvider extends HotSpotAttachProvider {
// to be not attachable. // to be not attachable.
testAttachable(vmid); testAttachable(vmid);
return new WindowsVirtualMachine(this, vmid); return new VirtualMachineImpl(this, vmid);
} }
public List<VirtualMachineDescriptor> listVirtualMachines() { public List<VirtualMachineDescriptor> listVirtualMachines() {
@ -84,7 +84,7 @@ public class WindowsAttachProvider extends HotSpotAttachProvider {
*/ */
private static boolean isTempPathSecure() { private static boolean isTempPathSecure() {
if (!wasTempPathChecked) { if (!wasTempPathChecked) {
synchronized (WindowsAttachProvider.class) { synchronized (AttachProviderImpl.class) {
if (!wasTempPathChecked) { if (!wasTempPathChecked) {
// get the value of TMP/TEMP, ignoring UNC, and paths that // get the value of TMP/TEMP, ignoring UNC, and paths that
// aren't absolute // aren't absolute
@ -146,7 +146,7 @@ public class WindowsAttachProvider extends HotSpotAttachProvider {
if (isLibraryLoadedByProcess("jvm.dll", processes[i])) { if (isLibraryLoadedByProcess("jvm.dll", processes[i])) {
String pid = Integer.toString(processes[i]); String pid = Integer.toString(processes[i]);
try { try {
new WindowsVirtualMachine(this, pid).detach(); new VirtualMachineImpl(this, pid).detach();
// FIXME - for now we don't have an appropriate display // FIXME - for now we don't have an appropriate display
// name so we use pid@hostname // name so we use pid@hostname

View file

@ -35,14 +35,14 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Random; import java.util.Random;
public class WindowsVirtualMachine extends HotSpotVirtualMachine { public class VirtualMachineImpl extends HotSpotVirtualMachine {
// the enqueue code stub (copied into each target VM) // the enqueue code stub (copied into each target VM)
private static byte[] stub; private static byte[] stub;
private volatile long hProcess; // handle to the process private volatile long hProcess; // handle to the process
WindowsVirtualMachine(AttachProvider provider, String id) VirtualMachineImpl(AttachProvider provider, String id)
throws AttachNotSupportedException, IOException throws AttachNotSupportedException, IOException
{ {
super(provider, id); super(provider, id);
@ -154,12 +154,12 @@ public class WindowsVirtualMachine extends HotSpotVirtualMachine {
} else if (len == 0) } else if (len == 0)
return 0; return 0;
return WindowsVirtualMachine.readPipe(hPipe, bs, off, len); return VirtualMachineImpl.readPipe(hPipe, bs, off, len);
} }
public void close() throws IOException { public void close() throws IOException {
if (hPipe != -1) { if (hPipe != -1) {
WindowsVirtualMachine.closePipe(hPipe); VirtualMachineImpl.closePipe(hPipe);
hPipe = -1; hPipe = -1;
} }
} }

View file

@ -30,15 +30,15 @@
#include "jni.h" #include "jni.h"
#include "jni_util.h" #include "jni_util.h"
#include "sun_tools_attach_WindowsAttachProvider.h" #include "sun_tools_attach_AttachProviderImpl.h"
/* /*
* Class: sun_tools_attach_WindowsAttachProvider * Class: sun_tools_attach_AttachProviderImpl
* Method: tempPath * Method: tempPath
* Signature: ()Ljava/lang/String; * Signature: ()Ljava/lang/String;
*/ */
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_sun_tools_attach_WindowsAttachProvider_tempPath(JNIEnv *env, jclass cls) Java_sun_tools_attach_AttachProviderImpl_tempPath(JNIEnv *env, jclass cls)
{ {
char buf[256]; char buf[256];
DWORD bufLen, actualLen; DWORD bufLen, actualLen;
@ -64,12 +64,12 @@ Java_sun_tools_attach_WindowsAttachProvider_tempPath(JNIEnv *env, jclass cls)
} }
/* /*
* Class: sun_tools_attach_WindowsAttachProvider * Class: sun_tools_attach_AttachProviderImpl
* Method: volumeFlags * Method: volumeFlags
* Signature: ()J * Signature: ()J
*/ */
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_tools_attach_WindowsAttachProvider_volumeFlags(JNIEnv *env, jclass cls, jstring str) Java_sun_tools_attach_AttachProviderImpl_volumeFlags(JNIEnv *env, jclass cls, jstring str)
{ {
jboolean isCopy; jboolean isCopy;
const char* volume; const char* volume;
@ -98,13 +98,13 @@ Java_sun_tools_attach_WindowsAttachProvider_volumeFlags(JNIEnv *env, jclass cls,
/* /*
* Class: sun_tools_attach_WindowsAttachProvider * Class: sun_tools_attach_AttachProviderImpl
* Method: enumProcesses * Method: enumProcesses
* Signature: ([JI)I * Signature: ([JI)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_sun_tools_attach_WindowsAttachProvider_enumProcesses(JNIEnv *env, jclass cls, Java_sun_tools_attach_AttachProviderImpl_enumProcesses(JNIEnv *env, jclass cls,
jintArray arr, jint max) jintArray arr, jint max)
{ {
DWORD size, bytesReturned; DWORD size, bytesReturned;
DWORD* ptr; DWORD* ptr;
@ -124,13 +124,13 @@ Java_sun_tools_attach_WindowsAttachProvider_enumProcesses(JNIEnv *env, jclass cl
} }
/* /*
* Class: sun_tools_attach_WindowsAttachProvider * Class: sun_tools_attach_AttachProviderImpl
* Method: isLibraryLoadedByProcess * Method: isLibraryLoadedByProcess
* Signature: (I[Ljava/lang/String;)Z * Signature: (I[Ljava/lang/String;)Z
*/ */
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_sun_tools_attach_WindowsAttachProvider_isLibraryLoadedByProcess(JNIEnv *env, jclass cls, Java_sun_tools_attach_AttachProviderImpl_isLibraryLoadedByProcess(JNIEnv *env, jclass cls,
jstring str, jint processId) jstring str, jint processId)
{ {
HANDLE hProcess; HANDLE hProcess;
jboolean isCopy; jboolean isCopy;

View file

@ -28,7 +28,7 @@
#include "jni.h" #include "jni.h"
#include "jni_util.h" #include "jni_util.h"
#include "sun_tools_attach_WindowsVirtualMachine.h" #include "sun_tools_attach_VirtualMachineImpl.h"
/* kernel32 */ /* kernel32 */
@ -124,11 +124,11 @@ void jvm_attach_thread_func_end (void) {
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: init * Method: init
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_init JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_init
(JNIEnv *env, jclass cls) (JNIEnv *env, jclass cls)
{ {
// All following APIs exist on Windows XP with SP2/Windows Server 2008 // All following APIs exist on Windows XP with SP2/Windows Server 2008
@ -139,11 +139,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_init
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: generateStub * Method: generateStub
* Signature: ()[B * Signature: ()[B
*/ */
JNIEXPORT jbyteArray JNICALL Java_sun_tools_attach_WindowsVirtualMachine_generateStub JNIEXPORT jbyteArray JNICALL Java_sun_tools_attach_VirtualMachineImpl_generateStub
(JNIEnv *env, jclass cls) (JNIEnv *env, jclass cls)
{ {
/* /*
@ -161,11 +161,11 @@ JNIEXPORT jbyteArray JNICALL Java_sun_tools_attach_WindowsVirtualMachine_generat
} }
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: openProcess * Method: openProcess
* Signature: (I)J * Signature: (I)J
*/ */
JNIEXPORT jlong JNICALL Java_sun_tools_attach_WindowsVirtualMachine_openProcess JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_openProcess
(JNIEnv *env, jclass cls, jint pid) (JNIEnv *env, jclass cls, jint pid)
{ {
HANDLE hProcess = NULL; HANDLE hProcess = NULL;
@ -236,11 +236,11 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_WindowsVirtualMachine_openProcess
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: closeProcess * Method: closeProcess
* Signature: (J)V * Signature: (J)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_closeProcess JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_closeProcess
(JNIEnv *env, jclass cls, jlong hProcess) (JNIEnv *env, jclass cls, jlong hProcess)
{ {
CloseHandle((HANDLE)hProcess); CloseHandle((HANDLE)hProcess);
@ -248,11 +248,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_closeProcess
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: createPipe * Method: createPipe
* Signature: (Ljava/lang/String;)J * Signature: (Ljava/lang/String;)J
*/ */
JNIEXPORT jlong JNICALL Java_sun_tools_attach_WindowsVirtualMachine_createPipe JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_createPipe
(JNIEnv *env, jclass cls, jstring pipename) (JNIEnv *env, jclass cls, jstring pipename)
{ {
HANDLE hPipe; HANDLE hPipe;
@ -281,22 +281,22 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_WindowsVirtualMachine_createPipe
} }
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: closePipe * Method: closePipe
* Signature: (J)V * Signature: (J)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_closePipe JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_closePipe
(JNIEnv *env, jclass cls, jlong hPipe) (JNIEnv *env, jclass cls, jlong hPipe)
{ {
CloseHandle( (HANDLE)hPipe ); CloseHandle( (HANDLE)hPipe );
} }
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: connectPipe * Method: connectPipe
* Signature: (J)V * Signature: (J)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_connectPipe JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_connectPipe
(JNIEnv *env, jclass cls, jlong hPipe) (JNIEnv *env, jclass cls, jlong hPipe)
{ {
BOOL fConnected; BOOL fConnected;
@ -309,11 +309,11 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_connectPipe
} }
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: readPipe * Method: readPipe
* Signature: (J[BII)I * Signature: (J[BII)I
*/ */
JNIEXPORT jint JNICALL Java_sun_tools_attach_WindowsVirtualMachine_readPipe JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_readPipe
(JNIEnv *env, jclass cls, jlong hPipe, jbyteArray ba, jint off, jint baLen) (JNIEnv *env, jclass cls, jlong hPipe, jbyteArray ba, jint off, jint baLen)
{ {
unsigned char buf[128]; unsigned char buf[128];
@ -352,11 +352,11 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_WindowsVirtualMachine_readPipe
/* /*
* Class: sun_tools_attach_WindowsVirtualMachine * Class: sun_tools_attach_VirtualMachineImpl
* Method: enqueue * Method: enqueue
* Signature: (JZLjava/lang/String;[Ljava/lang/Object;)V * Signature: (JZLjava/lang/String;[Ljava/lang/Object;)V
*/ */
JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_enqueue
(JNIEnv *env, jclass cls, jlong handle, jbyteArray stub, jstring cmd, (JNIEnv *env, jclass cls, jlong handle, jbyteArray stub, jstring cmd,
jstring pipename, jobjectArray args) jstring pipename, jobjectArray args)
{ {