src/hotspot/os/linux/os_linux.cpp
changeset 52109 101c2b6eacbe
parent 51996 84743156e780
child 52302 912b79d983d9
--- a/src/hotspot/os/linux/os_linux.cpp	Fri Oct 12 10:58:06 2018 +0200
+++ b/src/hotspot/os/linux/os_linux.cpp	Tue Oct 09 16:08:07 2018 +0530
@@ -5676,10 +5676,16 @@
 // or -1 on failure (e.g. can't fork a new process).
 // Unlike system(), this function can be called from signal handler. It
 // doesn't block SIGINT et al.
-int os::fork_and_exec(char* cmd) {
+int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
   const char * argv[4] = {"sh", "-c", cmd, NULL};
 
-  pid_t pid = fork();
+  pid_t pid ;
+
+  if (use_vfork_if_available) {
+    pid = vfork();
+  } else {
+    pid = fork();
+  }
 
   if (pid < 0) {
     // fork failed