mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8027434: "-XX:OnOutOfMemoryError" uses fork instead of vfork
Reviewed-by: dholmes, iklam
This commit is contained in:
parent
cfb6fb66c2
commit
cbe11130f5
7 changed files with 14 additions and 8 deletions
|
@ -5676,10 +5676,16 @@ extern char** environ;
|
|||
// 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue