author | bpb |
Fri, 12 Jan 2018 11:06:24 -0800 | |
changeset 48461 | 6a1c3a5e04f3 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
1 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
2 |
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
35775
00710c1b504a
8149529: Adapt SAP copyrights to new company name in jdk repository
goetz
parents:
26454
diff
changeset
|
3 |
* Copyright (c) 2013 SAP SE. All rights reserved. |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
5 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. Oracle designates this |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
9 |
* particular file as subject to the "Classpath" exception as provided |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
10 |
* by Oracle in the LICENSE file that accompanied this code. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
11 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
12 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
14 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
15 |
* version 2 for more details (a copy is included in the LICENSE file that |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
16 |
* accompanied this code). |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
17 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License version |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
19 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
20 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
21 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
22 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
23 |
* or visit www.oracle.com if you need additional information or have any |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
24 |
* questions. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
25 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
26 |
package sun.tools.attach; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
27 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
28 |
import com.sun.tools.attach.VirtualMachine; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
29 |
import com.sun.tools.attach.VirtualMachineDescriptor; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
30 |
import com.sun.tools.attach.AttachNotSupportedException; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
31 |
import java.io.IOException; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
32 |
|
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
33 |
// Based on linux/classes/sun/tools/attach/AttachProviderImpl.java. |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
34 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
35 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
36 |
* An AttachProvider implementation for Aix that uses a UNIX domain |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
37 |
* socket. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
38 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
39 |
public class AttachProviderImpl extends HotSpotAttachProvider { |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
40 |
|
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
41 |
public AttachProviderImpl() { |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
42 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
43 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
44 |
public String name() { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
45 |
return "sun"; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
46 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
47 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
48 |
public String type() { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
49 |
return "socket"; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
50 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
51 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
52 |
public VirtualMachine attachVirtualMachine(String vmid) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
53 |
throws AttachNotSupportedException, IOException |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
54 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
55 |
checkAttachPermission(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
56 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
57 |
// AttachNotSupportedException will be thrown if the target VM can be determined |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
58 |
// to be not attachable. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
59 |
testAttachable(vmid); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
60 |
|
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
61 |
return new VirtualMachineImpl(this, vmid); |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
62 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
63 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
64 |
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
65 |
throws AttachNotSupportedException, IOException |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
66 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
67 |
if (vmd.provider() != this) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
68 |
throw new AttachNotSupportedException("provider mismatch"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
69 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
70 |
// To avoid re-checking if the VM if attachable, we check if the descriptor |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
71 |
// is for a hotspot VM - these descriptors are created by the listVirtualMachines |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
72 |
// implementation which only returns a list of attachable VMs. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
73 |
if (vmd instanceof HotSpotVirtualMachineDescriptor) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
74 |
assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
75 |
checkAttachPermission(); |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
76 |
return new VirtualMachineImpl(this, vmd.id()); |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
77 |
} else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
78 |
return attachVirtualMachine(vmd.id()); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
79 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
80 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
81 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
82 |
} |