- remove disabling J malloc option now that pthreads stacks are mmap'ed

this is no longer a concern upon forking.
- use closefrom(2) after forking instead of less efficient heursitics
approach.
This commit is contained in:
kurt 2006-10-03 13:36:28 +00:00
parent 80559981e6
commit 545e82d800
3 changed files with 56 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.24 2006/09/26 17:48:19 kurt Exp $
# $OpenBSD: Makefile,v 1.25 2006/10/03 13:36:28 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}p20
PKGNAME-jre= jre-${V}p20
PKGNAME= jdk-${V}p21
PKGNAME-jre= jre-${V}p21
CATEGORIES= devel/jdk java

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-j2se_src_share_bin_java_c,v 1.3 2006/10/03 13:36:28 kurt Exp $
--- j2se/src/share/bin/java.c.orig Mon Sep 25 13:23:45 2006
+++ j2se/src/share/bin/java.c Mon Sep 25 13:24:09 2006
@@ -44,17 +44,6 @@
#include "manifest_info.h"
#include "version_comp.h"
-#ifdef __OpenBSD__
-/*
- * Disable Junk malloc option. java mprotects portions of the thread
- * stack. When forking, the child process deallocates the threads stacks
- * it inheritated from the parent. The junk malloc option then attempts
- * to write to the deallocated memory and segfaults because its not all
- * writable. The child proc stays in a SIGSEGV loop when this happens.
- */
-char *malloc_options = "j";
-#endif
-
#ifndef FULL_VERSION
#define FULL_VERSION JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
#endif

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-j2se_src_solaris_native_java_lang_UNIXProcess_md_c,v 1.1 2006/10/03 13:36:28 kurt Exp $
--- j2se/src/solaris/native/java/lang/UNIXProcess_md.c.orig Tue Sep 26 13:59:08 2006
+++ j2se/src/solaris/native/java/lang/UNIXProcess_md.c Tue Sep 26 14:16:50 2006
@@ -302,7 +302,20 @@ Java_java_lang_UNIXProcess_waitForProces
#if defined(_ALLBSD_SOURCE)
+#if defined(__OpenBSD__)
/*
+ * On OpenBSD closefrom will close only the opened fds without
+ * having to use heuristics and is safe to use when single
+ * threaded.
+ */
+static int
+closeDescriptors(void)
+{
+ return closefrom(3);
+}
+
+#else
+/*
* BSDNOTE: This function was returning 'int' originally. But it assumed
* that OS has some intelegent functionality to close opened-only fds
* associated with current process. Since we have to close them lineary
@@ -342,6 +355,7 @@ int closeDescriptors()
}
return (0);
}
+#endif
#if defined(__FreeBSD__)