8161360: Deprecated vfork() should not be used on Solaris
authoralanbur
Tue, 06 Sep 2016 13:09:29 -0400
changeset 40745 6d7a656b1612
parent 40744 63f7e1b92f2a
child 40746 fb66c8bfcc34
8161360: Deprecated vfork() should not be used on Solaris Reviewed-by: rriggs, dsamersoff
jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c
--- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c	Tue Sep 06 18:16:56 2016 +0530
+++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c	Tue Sep 06 13:09:29 2016 -0400
@@ -349,6 +349,8 @@
 __attribute_noinline__
 #endif
 
+/* vfork(2) is deprecated on Solaris */
+#ifndef __solaris__
 static pid_t
 vforkChild(ChildStuff *c) {
     volatile pid_t resultPid;
@@ -367,6 +369,7 @@
     assert(resultPid != 0);  /* childProcess never returns */
     return resultPid;
 }
+#endif
 
 static pid_t
 forkChild(ChildStuff *c) {
@@ -479,8 +482,11 @@
 static pid_t
 startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
     switch (c->mode) {
+/* vfork(2) is deprecated on Solaris */
+#ifndef __solaris__
       case MODE_VFORK:
         return vforkChild(c);
+#endif
       case MODE_FORK:
         return forkChild(c);
 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX)