- attempt to fully send/receive packets in socketTransport.c by handling
EINTR and continue to send/receive the rest of the packet. corrects: "ERROR: transport error 202: recv error: Interrupted system call ["transport.c",L41]" seen while debugging large projects in eclipse. from niklas@ - Prevent problems opening RandomAccessFile with "rws" as the mode by defining O_SYNC and O_DSYNC if they aren't defined. In particular we were previously defining O_SYNC bogusly to the same value as O_EXCL. from FreeBSD - close two more pthread_addr leaks
This commit is contained in:
parent
8a66388653
commit
3ebfead8e1
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.26 2006/11/11 21:04:27 steven Exp $
|
||||
# $OpenBSD: Makefile,v 1.27 2006/11/17 20:19:33 kurt Exp $
|
||||
|
||||
ONLY_FOR_ARCHS= amd64 i386
|
||||
|
||||
@ -6,8 +6,8 @@ COMMENT= "Java2(TM) Standard Edition Dev Kit v${V}"
|
||||
COMMENT-jre= "Java2(TM) Standard Edition Runtime Environment v${V}"
|
||||
V= 1.5.0
|
||||
DISTNAME= jdk-1_5_0
|
||||
PKGNAME= jdk-${V}p21
|
||||
PKGNAME-jre= jre-${V}p21
|
||||
PKGNAME= jdk-${V}p22
|
||||
PKGNAME-jre= jre-${V}p22
|
||||
|
||||
CATEGORIES= devel/jdk java
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
$OpenBSD: patch-j2se_src_share_native_java_io_io_util_h,v 1.1 2006/11/17 20:19:33 kurt Exp $
|
||||
--- j2se/src/share/native/java/io/io_util.h.orig Tue Oct 19 14:59:57 2004
|
||||
+++ j2se/src/share/native/java/io/io_util.h Wed Nov 15 13:49:33 2006
|
||||
@@ -11,7 +11,15 @@
|
||||
extern jfieldID IO_fd_fdID;
|
||||
extern jfieldID IO_handle_fdID;
|
||||
|
||||
-#if !defined(O_DSYNC) || !defined(O_SYNC)
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+#include <fcntl.h>
|
||||
+#ifndef O_SYNC
|
||||
+#define O_SYNC O_FSYNC
|
||||
+#endif
|
||||
+#ifndef O_DSYNC
|
||||
+#define O_DSYNC O_FSYNC
|
||||
+#endif
|
||||
+#elif !defined(O_DSYNC) || !defined(O_SYNC)
|
||||
#define O_SYNC (0x0800)
|
||||
#define O_DSYNC (0x2000)
|
||||
#endif
|
@ -0,0 +1,13 @@
|
||||
$OpenBSD: patch-j2se_src_share_native_sun_awt_cmm_thread_c,v 1.1 2006/11/17 20:19:33 kurt Exp $
|
||||
--- j2se/src/share/native/sun/awt/cmm/thread.c.orig Wed Nov 15 11:53:03 2006
|
||||
+++ j2se/src/share/native/sun/awt/cmm/thread.c Wed Nov 15 13:55:54 2006
|
||||
@@ -695,8 +695,7 @@ int retVal;
|
||||
|
||||
if (NULL == flags) { }
|
||||
|
||||
- pthread_attr_init(&attr);
|
||||
- retVal = pthread_create (&thread, &attr,
|
||||
+ retVal = pthread_create (&thread, NULL,
|
||||
startFunc, arg);
|
||||
if (0 != retVal) {
|
||||
return (0);
|
@ -0,0 +1,100 @@
|
||||
$OpenBSD: patch-j2se_src_share_transport_socket_socketTransport_c,v 1.1 2006/11/17 20:19:33 kurt Exp $
|
||||
--- j2se/src/share/transport/socket/socketTransport.c.orig Mon Mar 13 09:11:51 2006
|
||||
+++ j2se/src/share/transport/socket/socketTransport.c Mon Mar 13 09:09:25 2006
|
||||
@@ -122,7 +122,7 @@ handshake(int fd, jlong timeout) {
|
||||
}
|
||||
buf = b;
|
||||
buf += received;
|
||||
- n = dbgsysRecv(fd, buf, strlen(hello)-received, 0);
|
||||
+ n = recv_fully(fd, buf, strlen(hello)-received, 0);
|
||||
if (n == 0) {
|
||||
setLastError(0, "handshake failed - connection prematurally closed");
|
||||
return JDWPTRANSPORT_ERROR_IO_ERROR;
|
||||
@@ -148,7 +148,7 @@ handshake(int fd, jlong timeout) {
|
||||
}
|
||||
}
|
||||
|
||||
- if (dbgsysSend(fd, hello, strlen(hello), 0) != (int)strlen(hello)) {
|
||||
+ if (send_fully(fd, hello, strlen(hello)) != (int)strlen(hello)) {
|
||||
RETURN_IO_ERROR("send failed during handshake");
|
||||
}
|
||||
return JDWPTRANSPORT_ERROR_NONE;
|
||||
@@ -463,40 +463,40 @@ socketTransport_writePacket(jdwpTranspor
|
||||
|
||||
len = (jint)dbgsysHostToNetworkLong(len);
|
||||
|
||||
- if (dbgsysSend(socketFD,(char *)&len,sizeof(jint),0) != sizeof(jint)) {
|
||||
+ if (send_fully(socketFD,(char *)&len,sizeof(jint)) != sizeof(jint)) {
|
||||
RETURN_IO_ERROR("send failed");
|
||||
}
|
||||
|
||||
id = (jint)dbgsysHostToNetworkLong(packet->type.cmd.id);
|
||||
|
||||
- if (dbgsysSend(socketFD,(char *)&(id),sizeof(jint),0) != sizeof(jint)) {
|
||||
+ if (send_fully(socketFD,(char *)&(id),sizeof(jint)) != sizeof(jint)) {
|
||||
RETURN_IO_ERROR("send failed");
|
||||
}
|
||||
|
||||
- if (dbgsysSend(socketFD,(char *)&(packet->type.cmd.flags)
|
||||
- ,sizeof(jbyte),0) != sizeof(jbyte)) {
|
||||
+ if (send_fully(socketFD,(char *)&(packet->type.cmd.flags)
|
||||
+ ,sizeof(jbyte)) != sizeof(jbyte)) {
|
||||
RETURN_IO_ERROR("send failed");
|
||||
}
|
||||
|
||||
if (packet->type.cmd.flags & JDWPTRANSPORT_FLAGS_REPLY) {
|
||||
jshort errorCode = dbgsysHostToNetworkShort(packet->type.reply.errorCode);
|
||||
- if (dbgsysSend(socketFD,(char *)&(errorCode)
|
||||
- ,sizeof(jshort),0) != sizeof(jshort)) {
|
||||
+ if (send_fully(socketFD,(char *)&(errorCode)
|
||||
+ ,sizeof(jshort)) != sizeof(jshort)) {
|
||||
RETURN_IO_ERROR("send failed");
|
||||
}
|
||||
} else {
|
||||
- if (dbgsysSend(socketFD,(char *)&(packet->type.cmd.cmdSet)
|
||||
- ,sizeof(jbyte),0) != sizeof(jbyte)) {
|
||||
+ if (send_fully(socketFD,(char *)&(packet->type.cmd.cmdSet)
|
||||
+ ,sizeof(jbyte)) != sizeof(jbyte)) {
|
||||
RETURN_IO_ERROR("send failed");
|
||||
}
|
||||
- if (dbgsysSend(socketFD,(char *)&(packet->type.cmd.cmd)
|
||||
- ,sizeof(jbyte),0) != sizeof(jbyte)) {
|
||||
+ if (send_fully(socketFD,(char *)&(packet->type.cmd.cmd)
|
||||
+ ,sizeof(jbyte)) != sizeof(jbyte)) {
|
||||
RETURN_IO_ERROR("send failed");
|
||||
}
|
||||
}
|
||||
|
||||
data = packet->type.cmd.data;
|
||||
- if (dbgsysSend(socketFD,(char *)data,data_len,0) != data_len) {
|
||||
+ if (send_fully(socketFD,(char *)data,data_len) != data_len) {
|
||||
RETURN_IO_ERROR("send failed");
|
||||
}
|
||||
|
||||
@@ -510,6 +510,26 @@ recv_fully(int f, char *buf, int len)
|
||||
while (nbytes < len) {
|
||||
int res = dbgsysRecv(f, buf + nbytes, len - nbytes, 0);
|
||||
if (res < 0) {
|
||||
+ if (errno == EINTR)
|
||||
+ continue;
|
||||
+ return res;
|
||||
+ } else if (res == 0) {
|
||||
+ break; /* eof, return nbytes which is less than len */
|
||||
+ }
|
||||
+ nbytes += res;
|
||||
+ }
|
||||
+ return nbytes;
|
||||
+}
|
||||
+
|
||||
+static jint
|
||||
+send_fully(int f, char *buf, int len)
|
||||
+{
|
||||
+ int nbytes = 0;
|
||||
+ while (nbytes < len) {
|
||||
+ int res = dbgsysSend(f, buf + nbytes, len - nbytes, 0);
|
||||
+ if (res < 0) {
|
||||
+ if (errno == EINTR)
|
||||
+ continue;
|
||||
return res;
|
||||
} else if (res == 0) {
|
||||
break; /* eof, return nbytes which is less than len */
|
@ -0,0 +1,11 @@
|
||||
$OpenBSD: patch-j2se_src_solaris_hpi_native_threads_src_threads_md_c,v 1.3 2006/11/17 20:19:33 kurt Exp $
|
||||
--- j2se/src/solaris/hpi/native_threads/src/threads_md.c.orig Wed Nov 15 11:53:03 2006
|
||||
+++ j2se/src/solaris/hpi/native_threads/src/threads_md.c Wed Nov 15 13:55:54 2006
|
||||
@@ -544,6 +544,7 @@ sysThreadCreate(sys_thread_t **tidP, lon
|
||||
if (profiler_on)
|
||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
err = pthread_create(&tid->sys_thread, &attr, _start, (void *)tid);
|
||||
+ pthread_attr_destroy(&attr);
|
||||
|
||||
#ifndef USE_MUTEX_HANDSHAKE
|
||||
if (err == 0) {
|
Loading…
Reference in New Issue
Block a user