summaryrefslogtreecommitdiff
path: root/lang/openjdk7/patches/patch-jdk_src_solaris_classes_java_lang_UNIXProcess.java.bsd
blob: 715cb11f4784140cf17ae42b7856c9c8e90ebfa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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.");
+                    }
                 }
             }
         });