Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use fork instead of posix_spawn under NetBSD 5.
- Loading branch information
ryoon
committed
Jul 21, 2014
1 parent
2f422ca
commit ffd75ae
Showing
4 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
lang/openjdk7/patches/patch-jdk_src_solaris_classes_java_lang_UNIXProcess.java.bsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
$NetBSD: patch-jdk_src_solaris_classes_java_lang_UNIXProcess.java.bsd,v 1.1 2014/07/21 00:15:41 ryoon Exp $ | |||
|
|||
* Under NetBSD 5, use fork instead of posix_spawn. NetBSD 5 has no posix_spawn. | |||
|
|||
--- jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd.orig 2014-06-14 20:38:31.000000000 +0000 | |||
+++ jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd | |||
@@ -102,14 +102,28 @@ final class UNIXProcess extends Process | |||
helperpath = toCString(javahome + "/lib/jspawnhelper"); | |||
} | |||
|
|||
- String s = System.getProperty( | |||
- "jdk.lang.Process.launchMechanism", "posix_spawn"); | |||
- | |||
- try { | |||
- return LaunchMechanism.valueOf(s.toUpperCase()); | |||
- } catch (IllegalArgumentException e) { | |||
- throw new Error(s + " is not a supported " + | |||
- "process launch mechanism on this platform."); | |||
+/* NetBSD 5 does not have posix_spawn. Use fork instead. */ | |||
+ String osversion = System.getProperty("os.version"); | |||
+ if (osname.startsWith("NetBSD") && osversion.startsWith("5")) { | |||
+ String s = System.getProperty( | |||
+ "jdk.lang.Process.launchMechanism", "fork"); | |||
+ | |||
+ try { | |||
+ return LaunchMechanism.valueOf(s.toUpperCase()); | |||
+ } catch (IllegalArgumentException e) { | |||
+ throw new Error(s + " is not a supported " + | |||
+ "process launch mechanism on this platform."); | |||
+ } | |||
+ } else { | |||
+ String s = System.getProperty( | |||
+ "jdk.lang.Process.launchMechanism", "posix_spawn"); | |||
+ | |||
+ try { | |||
+ return LaunchMechanism.valueOf(s.toUpperCase()); | |||
+ } catch (IllegalArgumentException e) { | |||
+ throw new Error(s + " is not a supported " + | |||
+ "process launch mechanism on this platform."); | |||
+ } | |||
} | |||
} | |||
}); |
50 changes: 50 additions & 0 deletions
50
lang/openjdk7/patches/patch-jdk_src_solaris_native_java_lang_UNIXProcess__md.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,50 @@ | |||
$NetBSD: patch-jdk_src_solaris_native_java_lang_UNIXProcess__md.c,v 1.1 2014/07/21 00:15:41 ryoon Exp $ | |||
|
|||
* NetBSD 5 has no posix_spawn. | |||
|
|||
--- jdk/src/solaris/native/java/lang/UNIXProcess_md.c.orig 2014-06-14 20:38:31.000000000 +0000 | |||
+++ jdk/src/solaris/native/java/lang/UNIXProcess_md.c | |||
@@ -48,9 +48,15 @@ | |||
#include <signal.h> | |||
#include <string.h> | |||
|
|||
+#if defined(__NetBSD__) | |||
+#include <sys/param.h> | |||
+#endif | |||
+ | |||
#if defined(__solaris__) || defined(_ALLBSD_SOURCE) | |||
+#if !defined(__NetBSD__) || (__NetBSD_Version__ >= 600000000) | |||
#include <spawn.h> | |||
#endif | |||
+#endif | |||
|
|||
#include "childproc.h" | |||
|
|||
@@ -460,6 +466,7 @@ forkChild(ChildStuff *c) { | |||
} | |||
|
|||
#if defined(__solaris__) || defined(_ALLBSD_SOURCE) | |||
+#if !defined(__NetBSD__) || (__NetBSD_Version__ >= 600000000) | |||
static pid_t | |||
spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) { | |||
pid_t resultPid; | |||
@@ -543,6 +550,7 @@ spawnChild(JNIEnv *env, jobject process, | |||
return resultPid; | |||
} | |||
#endif | |||
+#endif | |||
|
|||
/* | |||
* Start a child process running function childProcess. | |||
@@ -556,9 +564,11 @@ startChild(JNIEnv *env, jobject process, | |||
case MODE_FORK: | |||
return forkChild(c); | |||
#if defined(__solaris__) || defined(_ALLBSD_SOURCE) | |||
+#if !defined(__NetBSD__) || (__NetBSD_Version__ >= 600000000) | |||
case MODE_POSIX_SPAWN: | |||
return spawnChild(env, process, c, helperpath); | |||
#endif | |||
+#endif | |||
default: | |||
return -1; | |||
} |