author | sla |
Fri, 13 Mar 2015 08:35:51 +0100 | |
changeset 29607 | 659cd463df20 |
parent 26216 | 5e46c782b43c |
child 29610 | 2cc3189821f7 |
permissions | -rw-r--r-- |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
1 |
/* |
23589
05e692d15fcd
8038233: Fix unsafe strcpy in Java_sun_tools_attach_{Aix,Bsd,Linux}VirtualMachine_connect()
simonis
parents:
22597
diff
changeset
|
2 |
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. |
05e692d15fcd
8038233: Fix unsafe strcpy in Java_sun_tools_attach_{Aix,Bsd,Linux}VirtualMachine_connect()
simonis
parents:
22597
diff
changeset
|
3 |
* Copyright 2014 SAP AG. 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 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
27 |
#include "jni.h" |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
28 |
#include "jni_util.h" |
29607
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
29 |
#include "jvm.h" |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
30 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
31 |
#include <stdio.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
32 |
#include <stdlib.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
33 |
#include <string.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
34 |
#include <errno.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
35 |
#include <unistd.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
36 |
#include <signal.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
37 |
#include <dirent.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
38 |
#include <ctype.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
39 |
#include <sys/types.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
40 |
#include <sys/socket.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
41 |
#include <sys/stat.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
42 |
#include <sys/un.h> |
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 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
45 |
* Based on 'LinuxVirtualMachine.c'. Non-relevant code has been removed and all |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
46 |
* occurrences of the string "Linux" have been replaced by "Aix". |
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 |
|
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
49 |
#include "sun_tools_attach_VirtualMachineImpl.h" |
22597
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 |
#define RESTARTABLE(_cmd, _result) do { \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
52 |
do { \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
53 |
_result = _cmd; \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
54 |
} while((_result == -1) && (errno == EINTR)); \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
55 |
} while(0) |
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 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
58 |
/* |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
59 |
* Class: sun_tools_attach_VirtualMachineImpl |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
60 |
* Method: socket |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
61 |
* Signature: ()I |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
62 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
63 |
JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_socket |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
64 |
(JNIEnv *env, jclass cls) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
65 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
66 |
int fd = socket(PF_UNIX, SOCK_STREAM, 0); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
67 |
if (fd == -1) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
68 |
JNU_ThrowIOExceptionWithLastError(env, "socket"); |
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 |
/* added time out values */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
71 |
else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
72 |
struct timeval tv; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
73 |
tv.tv_sec = 2 * 60; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
74 |
tv.tv_usec = 0; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
75 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
76 |
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv, sizeof(tv)); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
77 |
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&tv, sizeof(tv)); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
78 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
79 |
return (jint)fd; |
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 |
/* |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
83 |
* Class: sun_tools_attach_VirtualMachineImpl |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
84 |
* Method: connect |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
85 |
* Signature: (ILjava/lang/String;)I |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
86 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
87 |
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_connect |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
88 |
(JNIEnv *env, jclass cls, jint fd, jstring path) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
89 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
90 |
jboolean isCopy; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
91 |
const char* p = GetStringPlatformChars(env, path, &isCopy); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
92 |
if (p != NULL) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
93 |
struct sockaddr_un addr; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
94 |
int err = 0; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
95 |
|
23589
05e692d15fcd
8038233: Fix unsafe strcpy in Java_sun_tools_attach_{Aix,Bsd,Linux}VirtualMachine_connect()
simonis
parents:
22597
diff
changeset
|
96 |
memset(&addr, 0, sizeof(addr)); |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
97 |
addr.sun_family = AF_UNIX; |
23589
05e692d15fcd
8038233: Fix unsafe strcpy in Java_sun_tools_attach_{Aix,Bsd,Linux}VirtualMachine_connect()
simonis
parents:
22597
diff
changeset
|
98 |
/* strncpy is safe because addr.sun_path was zero-initialized before. */ |
05e692d15fcd
8038233: Fix unsafe strcpy in Java_sun_tools_attach_{Aix,Bsd,Linux}VirtualMachine_connect()
simonis
parents:
22597
diff
changeset
|
99 |
strncpy(addr.sun_path, p, sizeof(addr.sun_path) - 1); |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
100 |
/* We must call bind with the actual socketaddr length. This is obligatory for AS400. */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
101 |
if (connect(fd, (struct sockaddr*)&addr, SUN_LEN(&addr)) == -1) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
102 |
err = errno; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
103 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
104 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
105 |
if (isCopy) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
106 |
JNU_ReleaseStringPlatformChars(env, path, p); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
107 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
108 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
109 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
110 |
* If the connect failed then we throw the appropriate exception |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
111 |
* here (can't throw it before releasing the string as can't call |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
112 |
* JNI with pending exception) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
113 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
114 |
if (err != 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
115 |
if (err == ENOENT) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
116 |
JNU_ThrowByName(env, "java/io/FileNotFoundException", NULL); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
117 |
} else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
118 |
char* msg = strdup(strerror(err)); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
119 |
JNU_ThrowIOException(env, msg); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
120 |
if (msg != NULL) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
121 |
free(msg); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
122 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
123 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
124 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
125 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
126 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
127 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
128 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
129 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
130 |
* Structure and callback function used to send a QUIT signal to all |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
131 |
* children of a given process |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
132 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
133 |
typedef struct { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
134 |
pid_t ppid; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
135 |
} SendQuitContext; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
136 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
137 |
static void SendQuitCallback(const pid_t pid, void* user_data) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
138 |
SendQuitContext* context = (SendQuitContext*)user_data; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
139 |
pid_t parent = getParent(pid); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
140 |
if (parent == context->ppid) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
141 |
kill(pid, SIGQUIT); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
142 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
143 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
144 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
145 |
/* |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
146 |
* Class: sun_tools_attach_VirtualMachineImpl |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
147 |
* Method: sendQuitTo |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
148 |
* Signature: (I)V |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
149 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
150 |
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
151 |
(JNIEnv *env, jclass cls, jint pid) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
152 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
153 |
if (kill((pid_t)pid, SIGQUIT)) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
154 |
JNU_ThrowIOExceptionWithLastError(env, "kill"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
155 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
156 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
157 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
158 |
/* |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
159 |
* Class: sun_tools_attach_VirtualMachineImpl |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
160 |
* Method: checkPermissions |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
161 |
* Signature: (Ljava/lang/String;)V |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
162 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
163 |
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
164 |
(JNIEnv *env, jclass cls, jstring path) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
165 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
166 |
jboolean isCopy; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
167 |
const char* p = GetStringPlatformChars(env, path, &isCopy); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
168 |
if (p != NULL) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
169 |
struct stat64 sb; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
170 |
uid_t uid, gid; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
171 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
172 |
/* added missing initialization of the stat64 buffer */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
173 |
memset(&sb, 0, sizeof(struct stat64)); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
174 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
175 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
176 |
* Check that the path is owned by the effective uid/gid of this |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
177 |
* process. Also check that group/other access is not allowed. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
178 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
179 |
uid = geteuid(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
180 |
gid = getegid(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
181 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
182 |
res = stat64(p, &sb); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
183 |
if (res != 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
184 |
/* save errno */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
185 |
res = errno; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
186 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
187 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
188 |
if (res == 0) { |
29607
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
189 |
char msg[100]; |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
190 |
jboolean isError = JNI_FALSE; |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
191 |
if (sb.st_uid != uid) { |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
192 |
jio_snprintf(msg, sizeof(msg)-1, |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
193 |
"file should be owned by the current user (which is %d) but is owned by %d", uid, sb.st_uid); |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
194 |
isError = JNI_TRUE; |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
195 |
} else if (sb.st_gid != gid) { |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
196 |
jio_snprintf(msg, sizeof(msg)-1, |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
197 |
"file's group should be the current group (which is %d) but the group is %d", gid, sb.st_gid); |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
198 |
isError = JNI_TRUE; |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
199 |
} else if ((sb.st_mode & (S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) != 0) { |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
200 |
jio_snprintf(msg, sizeof(msg)-1, |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
201 |
"file should only be readable and writable by the owner but has 0%03o access", sb.st_mode & 0777); |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
202 |
isError = JNI_TRUE; |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
203 |
} |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
204 |
if (isError) { |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
205 |
char buf[256]; |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
206 |
jio_snprintf(buf, sizeof(buf)-1, "well-known file %s is not secure: %s", p, msg); |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
207 |
JNU_ThrowIOException(env, buf); |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
208 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
209 |
} else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
210 |
char* msg = strdup(strerror(res)); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
211 |
JNU_ThrowIOException(env, msg); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
212 |
if (msg != NULL) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
213 |
free(msg); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
214 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
215 |
} |
29607
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
216 |
|
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
217 |
if (isCopy) { |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
218 |
JNU_ReleaseStringPlatformChars(env, path, p); |
659cd463df20
8074812: More specific error message when the .java_pid well-known file is not secure
sla
parents:
26216
diff
changeset
|
219 |
} |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
220 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
221 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
222 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
223 |
/* |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
224 |
* Class: sun_tools_attach_VirtualMachineImpl |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
225 |
* Method: close |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
226 |
* Signature: (I)V |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
227 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
228 |
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
229 |
(JNIEnv *env, jclass cls, jint fd) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
230 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
231 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
232 |
/* Fixed deadlock when this call of close by the client is not seen by the attach server |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
233 |
* which has accepted the (very short) connection already and is waiting for the request. But read don't get a byte, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
234 |
* because the close is lost without shutdown. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
235 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
236 |
shutdown(fd, 2); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
237 |
RESTARTABLE(close(fd), res); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
238 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
239 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
240 |
/* |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
241 |
* Class: sun_tools_attach_VirtualMachineImpl |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
242 |
* Method: read |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
243 |
* Signature: (I[BI)I |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
244 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
245 |
JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_read |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
246 |
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
247 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
248 |
unsigned char buf[128]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
249 |
size_t len = sizeof(buf); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
250 |
ssize_t n; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
251 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
252 |
size_t remaining = (size_t)(baLen - off); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
253 |
if (len > remaining) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
254 |
len = remaining; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
255 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
256 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
257 |
RESTARTABLE(read(fd, buf+off, len), n); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
258 |
if (n == -1) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
259 |
JNU_ThrowIOExceptionWithLastError(env, "read"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
260 |
} else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
261 |
if (n == 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
262 |
n = -1; // EOF |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
263 |
} else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
264 |
(*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off)); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
265 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
266 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
267 |
return n; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
268 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
269 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
270 |
/* |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
271 |
* Class: sun_tools_attach_VirtualMachineImpl |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
272 |
* Method: write |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
273 |
* Signature: (I[B)V |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
274 |
*/ |
26216
5e46c782b43c
8055230: Rename attach provider implementation class be platform neutral
mchung
parents:
25859
diff
changeset
|
275 |
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_write |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
276 |
(JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint bufLen) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
277 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
278 |
size_t remaining = bufLen; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
279 |
do { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
280 |
unsigned char buf[128]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
281 |
size_t len = sizeof(buf); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
282 |
int n; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
283 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
284 |
if (len > remaining) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
285 |
len = remaining; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
286 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
287 |
(*env)->GetByteArrayRegion(env, ba, off, len, (jbyte *)buf); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
288 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
289 |
RESTARTABLE(write(fd, buf, len), n); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
290 |
if (n > 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
291 |
off += n; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
292 |
remaining -= n; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
293 |
} else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
294 |
JNU_ThrowIOExceptionWithLastError(env, "write"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
295 |
return; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
296 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
297 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
298 |
} while (remaining > 0); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
299 |
} |