1.1 --- a/src/os/linux/vm/os_linux.cpp Mon Nov 26 17:35:35 2018 +0100 1.2 +++ b/src/os/linux/vm/os_linux.cpp Mon Feb 25 21:38:45 2019 +0000 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -6337,10 +6337,16 @@ 1.11 // or -1 on failure (e.g. can't fork a new process). 1.12 // Unlike system(), this function can be called from signal handler. It 1.13 // doesn't block SIGINT et al. 1.14 -int os::fork_and_exec(char* cmd) { 1.15 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { 1.16 const char * argv[4] = {"sh", "-c", cmd, NULL}; 1.17 1.18 - pid_t pid = fork(); 1.19 + pid_t pid ; 1.20 + 1.21 + if (use_vfork_if_available) { 1.22 + pid = vfork(); 1.23 + } else { 1.24 + pid = fork(); 1.25 + } 1.26 1.27 if (pid < 0) { 1.28 // fork failed