src/os/linux/vm/os_linux.cpp

changeset 9637
eef07cd490d4
parent 9572
624a0741915c
parent 9620
97d605522fcb
child 9703
2fdf635bcf28
     1.1 --- a/src/os/linux/vm/os_linux.cpp	Wed Jul 03 20:04:13 2019 +0800
     1.2 +++ b/src/os/linux/vm/os_linux.cpp	Wed Jul 03 20:42:37 2019 +0800
     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 @@ -724,6 +724,10 @@
    1.11    }
    1.12  }
    1.13  
    1.14 +void os::Linux::expand_stack_to(address bottom) {
    1.15 +  _expand_stack_to(bottom);
    1.16 +}
    1.17 +
    1.18  bool os::Linux::manually_expand_stack(JavaThread * t, address addr) {
    1.19    assert(t!=NULL, "just checking");
    1.20    assert(t->osthread()->expanding_stack(), "expand should be set");
    1.21 @@ -6354,10 +6358,16 @@
    1.22  // or -1 on failure (e.g. can't fork a new process).
    1.23  // Unlike system(), this function can be called from signal handler. It
    1.24  // doesn't block SIGINT et al.
    1.25 -int os::fork_and_exec(char* cmd) {
    1.26 +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
    1.27    const char * argv[4] = {"sh", "-c", cmd, NULL};
    1.28  
    1.29 -  pid_t pid = fork();
    1.30 +  pid_t pid ;
    1.31 +
    1.32 +  if (use_vfork_if_available) {
    1.33 +    pid = vfork();
    1.34 +  } else {
    1.35 +    pid = fork();
    1.36 +  }
    1.37  
    1.38    if (pid < 0) {
    1.39      // fork failed

mercurial